User:Matoro/GHCbootstrap

From Gentoo Wiki
Jump to:navigation Jump to:search

Simple instructions for getting a GHC bootstrap binpkg using Debian binaries. See what architectures Debian has support for here: https://packages.debian.org/sid/ghc


I use app-arch/atool as a wrapper around app-arch/dpkg so I don't have to remember flags.

user $emerge -v1 app-arch/atool app-arch/dpkg
user $aunpack ghc_9.0.2-3_riscv64.deb
user $pushd ghc_9.0.2-3_riscv64

Copy the contents over to /usr/local. Careful with the path slashes!

root #rsync -avh --progress usr/ var /usr/local/
user $pushd /usr/local

Now replace absolute paths everywhere except in header files.

root #find . -type f -not -path '*/\.*' -not -name '*.h' -exec grep -Il '/usr' {} \; | xargs sed -i 's#/usr#/usr/local#g'
root #ln -svf ../../var/lib/ghc/package.conf.d lib/ghc/package.conf.d

Translate Debian tuples to generic ones. You can find a listing here: https://wiki.debian.org/Multiarch/Tuples

root #sed -i 's/riscv64-linux-gnu/riscv64-unknown-linux-gnu/g' 'lib/ghc/settings'

Add FFI headers to the global include path.

root #ln -sv ../lib64/libffi/include/ffi.h /usr/include/ffi.h
root #ln -sv ../lib64/libffi/include/ffitarget.h /usr/include/ffitarget.h

Refresh the environment and you should have a working GHC!

root #env-update
root #ldconfig
user $source /etc/profile
user $hash -r
user $ghc --version

Recache the package database before attempting build.

root #ghc-pkg recache
root #FEATURES=buildpkg USE="ghcbootstrap llvm" emerge -v1 dev-lang/ghc