fix haskell.org build and rpath issues (#2)

Extreme bunch of work by all of us. In the end it was just a matter of finding the env vars for LDFLAGS for the various stages.

Dang ghc-devs, you hate us.

Co-authored-by: Jonathan Chang <me@jonathanchang.org>
Co-authored-by: Max Howell <mxcl@me.com>
This commit is contained in:
Jacob Heider 2022-12-01 08:05:12 -05:00 committed by GitHub
parent a17830b38e
commit 616098e71a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
distributable: distributable:
url: https://downloads.haskell.org/~ghc/{{ version}}/ghc-{{ version}}-src.tar.xz url: https://downloads.haskell.org/~ghc/{{version}}/ghc-{{version}}-src.tar.xz
sig: "{{url}}.sig"
strip-components: 1 strip-components: 1
versions: versions:
@ -9,9 +10,9 @@ versions:
# strip: # strip:
# - /^ghc-/ # - /^ghc-/
# - /-release$/ # - /-release$/
# however ghc breaks every time they release a new version
# so you are welcome to embrace trying to build it, we kindly ask they care
#NOTE relocatable if we edit the shell scripts # more about ensuring their monolithic nonsense has stability in builds
provides: provides:
- bin/ghc - bin/ghc
@ -27,7 +28,8 @@ provides:
dependencies: dependencies:
gnu.org/gmp: 6 gnu.org/gmp: 6
invisible-island.net/ncurses: 6 invisible-island.net/ncurses: 6
tea.xyz/gx/cc: c99 # ghc uses `gcc` as part of its build process tea.xyz/gx/cc: 'c99' # ghc uses this during builds
sourceware.org/libffi: 3
build: build:
dependencies: dependencies:
@ -36,17 +38,19 @@ build:
tea.xyz/gx/make: '*' #FIXME specifically, gnu make is *required* tea.xyz/gx/make: '*' #FIXME specifically, gnu make is *required*
curl.se: '*' curl.se: '*'
gnu.org/m4: '*' gnu.org/m4: '*'
script: |- git-scm.org: ^2
# `ghc` needs `ghc` to bootstrap `ghc` python.org: ^3
# The canonical way to achieve this is with `ghcup` gnu.org/patch: '*'
# To that end, we capture $HOME so as to no pollute the user's life with unwanted linux:
# stage0 tooling. Instead, everything is localized to {{ prefix }}/src, and can be github.com/numactl/numactl: ^2 # ghcup needs this
# cleaned up at will, and won't capture any of the user's workflow
export HOME={{ prefix }}/src # `ghc` needs `ghc` to bootstrap `ghc`
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 # The canonical way to achieve this is with `ghcup`
export BOOTSTRAP_HASKELL_ADJUST_BASHRC=0 # To that end, we capture $HOME so as to no pollute the user's life with unwanted
export BOOTSTRAP_HASKELL_GHC_VERSION={{ version }} # stage0 tooling. Instead, everything is localized to $HOME, and can be
# cleaned up at will, and won't capture any of the user's workflow
script: |
export HOME="$(pwd)"
if test -d .ghcup; then if test -d .ghcup; then
echo "ghcup already installed" echo "ghcup already installed"
@ -54,24 +58,49 @@ build:
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
fi fi
PATH="{{ prefix }}/src/.ghcup/bin:$PATH" PATH="$HOME/.ghcup/bin:$PATH"
if test -e {{ prefix }}/src/.cabal/bin; then if test -e $HOME/.cabal/bin; then
rm -r {{ prefix }}/src/.cabal/bin rm -r $HOME/.cabal/bin
fi fi
cabal update && cabal install alex happy cabal update
cabal install alex happy
export PATH="{{ prefix }}/src/.cabal/bin:$PATH" export PATH="$HOME/.cabal/bin:$PATH"
GHC="{{ prefix }}/src/.ghcup/bin/ghc" GHC="$HOME/.ghcup/bin/ghc"
export CPATH=/opt/invisible-island.net/ncurses/v6/include/ncursesw:$CPATH ./configure $ARGS
hadrian/build -j --docs=none --prefix="{{prefix}}" install
#FIXME oddly, they dont provide `./configure`; we have to generate it for shim in $(find "{{prefix}}/bin" -type f); do
autoconf sed -i.bak -e 's_="{{prefix}}_="$(dirname $(dirname $0))_' $shim
./configure --prefix={{ prefix }} rm $shim.bak
done
hadrian/build -j install --prefix={{ prefix }} --docs=none env:
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
BOOTSTRAP_HASKELL_ADJUST_BASHRC: 0
BOOTSTRAP_HASKELL_GHC_VERSION: ${{version}}
CONF_CC_OPTS_STAGE0: $LDFLAGS
CONF_CC_OPTS_STAGE1: $LDFLAGS
CONF_CC_OPTS_STAGE2: $LDFLAGS
CONF_GCC_LINKER_OPTS_STAGE0: $LDFLAGS
CONF_GCC_LINKER_OPTS_STAGE1: $LDFLAGS
CONF_GCC_LINKER_OPTS_STAGE2: $LDFLAGS
ARGS:
- --prefix={{prefix}}
- --disable-numa
- --with-curses-includes={{deps.invisible-island.net/ncurses.prefix}}/include/ncursesw
- --with-intree-gmp
- --with-system-libffi
linux:
C_INCLUDE_PATH: ${{deps.invisible-island.net/ncurses.prefix}}/include/ncursesw
# ^^ yep telling `./configure` about it just aint enough
darwin:
ARGS:
- --with-ffi-includes=$(xcrun --show-sdk-path)/usr/include/ffi
# workaround `fatal error: 'ffitarget_arm64.h' file not found`
C_INCLUDE_PATH: $(xcrun --show-sdk-path)/usr/include/ffi
test: test:
script: | script: |