mirror of
https://github.com/ivabus/pantry
synced 2024-11-22 08:25:07 +03:00
fix(haskell) (#3001)
* fix(haskell) vendor GHC * needs make * debugging * fix shims
This commit is contained in:
parent
47a730de57
commit
39296731e7
2 changed files with 167 additions and 89 deletions
|
@ -1,25 +1,41 @@
|
||||||
distributable:
|
distributable: ~
|
||||||
url: https://downloads.haskell.org/~ghc/{{version}}/ghc-{{version}}-src.tar.xz
|
|
||||||
sig: "{{url}}.sig"
|
|
||||||
strip-components: 1
|
|
||||||
|
|
||||||
versions:
|
versions:
|
||||||
github: ghc/ghc/tags
|
github: ghc/ghc/tags
|
||||||
strip:
|
strip:
|
||||||
- /^ghc-/
|
- /^ghc-/
|
||||||
- /-release$/
|
- /-release$/
|
||||||
ignore: [9.5.x, 9.6.x] #FIXME help us to build these!
|
|
||||||
|
|
||||||
provides:
|
provides:
|
||||||
- bin/ghc
|
- bin/ghc
|
||||||
|
- bin/ghc-{{version.marketing}}
|
||||||
|
- bin/ghc-{{version}}
|
||||||
- bin/ghc-pkg
|
- bin/ghc-pkg
|
||||||
|
- bin/ghc-pkg-{{version.marketing}}
|
||||||
|
- bin/ghc-pkg-{{version}}
|
||||||
- bin/ghci
|
- bin/ghci
|
||||||
|
- bin/ghci-{{version.marketing}}
|
||||||
|
- bin/ghci-{{version}}
|
||||||
|
- bin/ghcup
|
||||||
- bin/haddock
|
- bin/haddock
|
||||||
|
- bin/haddock-{{version.marketing}}
|
||||||
|
- bin/haddock-{{version}}
|
||||||
- bin/hp2ps
|
- bin/hp2ps
|
||||||
|
- bin/hp2ps-{{version.marketing}}
|
||||||
|
- bin/hp2ps-{{version}}
|
||||||
- bin/hpc
|
- bin/hpc
|
||||||
|
- bin/hpc-{{version.marketing}}
|
||||||
|
- bin/hpc-{{version}}
|
||||||
- bin/hsc2hs
|
- bin/hsc2hs
|
||||||
|
- bin/hsc2hs-{{version.marketing}}
|
||||||
|
- bin/hsc2hs-{{version}}
|
||||||
- bin/runghc
|
- bin/runghc
|
||||||
|
- bin/runghc-{{version.marketing}}
|
||||||
|
- bin/runghc-{{version}}
|
||||||
- bin/runhaskell
|
- bin/runhaskell
|
||||||
|
- bin/runhaskell-{{version.marketing}}
|
||||||
|
- bin/runhaskell-{{version}}
|
||||||
|
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
gnu.org/gmp: 6
|
gnu.org/gmp: 6
|
||||||
|
@ -27,96 +43,33 @@ dependencies:
|
||||||
tea.xyz/gx/cc: 'c99' # ghc uses this during builds
|
tea.xyz/gx/cc: 'c99' # ghc uses this during builds
|
||||||
sourceware.org/libffi: 3
|
sourceware.org/libffi: 3
|
||||||
|
|
||||||
|
warnings:
|
||||||
|
- vendored
|
||||||
|
|
||||||
build:
|
build:
|
||||||
dependencies:
|
dependencies:
|
||||||
gnu.org/autoconf: ^2
|
|
||||||
gnu.org/automake: ^1 # `aclocal` is used during the build for some reason
|
|
||||||
tea.xyz/gx/make: '*' #FIXME specifically, gnu make is *required*
|
|
||||||
curl.se: '*'
|
curl.se: '*'
|
||||||
gnu.org/m4: '*'
|
tea.xyz/gx/make: '*'
|
||||||
git-scm.org: ^2
|
script:
|
||||||
python.org: ^3
|
- curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
|
||||||
gnu.org/patch: '*'
|
- PATH={{prefix}}/.ghcup/bin:$PATH
|
||||||
linux:
|
- ghcup install ghc {{version}}
|
||||||
github.com/numactl/numactl: ^2 # ghcup needs this
|
- ghcup set ghc {{version}}
|
||||||
|
- run: ln -s .ghcup/* .
|
||||||
# `ghc` needs `ghc` to bootstrap `ghc`
|
working-directory: ${{prefix}}
|
||||||
# The canonical way to achieve this is with `ghcup`
|
- run: |
|
||||||
# To that end, we capture $HOME so as to no pollute the user's life with unwanted
|
sed -i.bak -e "s|$TEA_PREFIX|\$TEA_PREFIX|g" *-{{version}}
|
||||||
# stage0 tooling. Instead, everything is localized to $HOME, and can be
|
rm *.bak
|
||||||
# cleaned up at will, and won't capture any of the user's workflow
|
working-directory: ${{prefix}}/ghc/{{version}}/bin
|
||||||
script: |
|
|
||||||
export HOME="$(pwd)"
|
|
||||||
|
|
||||||
if test -d .ghcup; then
|
|
||||||
echo "ghcup already installed"
|
|
||||||
else
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
PATH="$HOME/.ghcup/bin:$PATH"
|
|
||||||
|
|
||||||
if test -e $HOME/.cabal/bin; then
|
|
||||||
rm -r $HOME/.cabal/bin
|
|
||||||
fi
|
|
||||||
|
|
||||||
export PATH="$HOME/.cabal/bin:$PATH"
|
|
||||||
GHC="$HOME/.ghcup/bin/ghc"
|
|
||||||
|
|
||||||
# We need PIC on linux-x86_64 (it's already on the other
|
|
||||||
# platforms). This does that.
|
|
||||||
# https://www.hobson.space/posts/haskell-foreign-library/
|
|
||||||
|
|
||||||
sed -i.bak \
|
|
||||||
's/\((OSLinux, ArchAArch64) -> \[Opt_PIC, Opt_ExternalDynamicRefs\]\)/\1\n (OSLinux, ArchX86_64) -> \[Opt_PIC, Opt_ExternalDynamicRefs\]/' \
|
|
||||||
compiler/GHC/Driver/Session.hs
|
|
||||||
rm compiler/GHC/Driver/Session.hs.bak
|
|
||||||
|
|
||||||
./configure $ARGS
|
|
||||||
hadrian/build $HADRIAN_ARGS install
|
|
||||||
|
|
||||||
for shim in $(find "{{prefix}}/bin" -type f); do
|
|
||||||
sed -i.bak -e 's_="{{prefix}}_="$(dirname $(dirname $0))_' $shim
|
|
||||||
rm $shim.bak
|
|
||||||
done
|
|
||||||
|
|
||||||
sed -i.bak 's|{{tea.prefix}}|$TEA_PREFIX|g' "{{prefix}}/bin/hsc2hs-ghc-{{version}}"
|
|
||||||
rm "{{prefix}}/bin/hsc2hs-ghc-{{version}}.bak"
|
|
||||||
env:
|
env:
|
||||||
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
|
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
|
||||||
BOOTSTRAP_HASKELL_ADJUST_BASHRC: 0
|
BOOTSTRAP_HASKELL_NO_UPGRADE: 1
|
||||||
BOOTSTRAP_HASKELL_GHC_VERSION: ${{version}}
|
BOOTSTRAP_HASKELL_MINIMAL: 1
|
||||||
CONF_CC_OPTS_STAGE0: $CFLAGS
|
GHCUP_INSTALL_BASE_PREFIX: ${{prefix}}
|
||||||
CONF_CC_OPTS_STAGE1: $CFLAGS
|
GHCUP_SKIP_UPDATE_CHECK: 1
|
||||||
CONF_CC_OPTS_STAGE2: $CFLAGS
|
|
||||||
CONF_GCC_LINKER_OPTS_STAGE0: $LDFLAGS
|
|
||||||
CONF_GCC_LINKER_OPTS_STAGE1: $LDFLAGS
|
|
||||||
CONF_GCC_LINKER_OPTS_STAGE2: $LDFLAGS
|
|
||||||
# ChatGPT
|
|
||||||
GHC_OPTIONS: -fPIC
|
|
||||||
ARGS:
|
|
||||||
- --prefix={{prefix}}
|
|
||||||
- --disable-numa
|
|
||||||
- --with-curses-includes={{deps.invisible-island.net/ncurses.prefix}}/include/ncursesw
|
|
||||||
- --with-intree-gmp
|
|
||||||
- --with-system-libffi
|
|
||||||
HADRIAN_ARGS:
|
|
||||||
- -j
|
|
||||||
- --docs=none
|
|
||||||
- --flavour=release
|
|
||||||
- --prefix="{{prefix}}"
|
|
||||||
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:
|
||||||
out=$(runghc $FIXTURE)
|
- test "$(runghc $FIXTURE)" = "Hello World"
|
||||||
test "$out" = "Hello World"
|
|
||||||
fixture:
|
fixture:
|
||||||
main = putStrLn "Hello World"
|
main = putStrLn "Hello World"
|
||||||
|
|
125
projects/haskell.org/package.yml-from-source
Normal file
125
projects/haskell.org/package.yml-from-source
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
### This was deprecated due to significant drift and revlock in
|
||||||
|
### ghc's build system
|
||||||
|
|
||||||
|
distributable:
|
||||||
|
url: https://downloads.haskell.org/~ghc/{{version}}/ghc-{{version}}-src.tar.xz
|
||||||
|
sig: "{{url}}.sig"
|
||||||
|
strip-components: 1
|
||||||
|
|
||||||
|
versions:
|
||||||
|
github: ghc/ghc/tags
|
||||||
|
strip:
|
||||||
|
- /^ghc-/
|
||||||
|
- /-release$/
|
||||||
|
ignore: [9.5.x, 9.6.x] #FIXME help us to build these!
|
||||||
|
|
||||||
|
provides:
|
||||||
|
- bin/ghc
|
||||||
|
- bin/ghc-pkg
|
||||||
|
- bin/ghci
|
||||||
|
- bin/haddock
|
||||||
|
- bin/hp2ps
|
||||||
|
- bin/hpc
|
||||||
|
- bin/hsc2hs
|
||||||
|
- bin/runghc
|
||||||
|
- bin/runhaskell
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
gnu.org/gmp: 6
|
||||||
|
invisible-island.net/ncurses: 6
|
||||||
|
tea.xyz/gx/cc: 'c99' # ghc uses this during builds
|
||||||
|
sourceware.org/libffi: 3
|
||||||
|
|
||||||
|
build:
|
||||||
|
dependencies:
|
||||||
|
gnu.org/autoconf: ^2
|
||||||
|
gnu.org/automake: ^1 # `aclocal` is used during the build for some reason
|
||||||
|
tea.xyz/gx/make: '*' #FIXME specifically, gnu make is *required*
|
||||||
|
curl.se: '*'
|
||||||
|
gnu.org/m4: '*'
|
||||||
|
git-scm.org: ^2
|
||||||
|
python.org: ^3
|
||||||
|
gnu.org/patch: '*'
|
||||||
|
linux:
|
||||||
|
github.com/numactl/numactl: ^2 # ghcup needs this
|
||||||
|
|
||||||
|
# `ghc` needs `ghc` to bootstrap `ghc`
|
||||||
|
# The canonical way to achieve this is with `ghcup`
|
||||||
|
# To that end, we capture $HOME so as to no pollute the user's life with unwanted
|
||||||
|
# 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
|
||||||
|
echo "ghcup already installed"
|
||||||
|
else
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
PATH="$HOME/.ghcup/bin:$PATH"
|
||||||
|
|
||||||
|
if test -e $HOME/.cabal/bin; then
|
||||||
|
rm -r $HOME/.cabal/bin
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PATH="$HOME/.cabal/bin:$PATH"
|
||||||
|
GHC="$HOME/.ghcup/bin/ghc"
|
||||||
|
|
||||||
|
# We need PIC on linux-x86_64 (it's already on the other
|
||||||
|
# platforms). This does that.
|
||||||
|
# https://www.hobson.space/posts/haskell-foreign-library/
|
||||||
|
|
||||||
|
sed -i.bak \
|
||||||
|
's/\((OSLinux, ArchAArch64) -> \[Opt_PIC, Opt_ExternalDynamicRefs\]\)/\1\n (OSLinux, ArchX86_64) -> \[Opt_PIC, Opt_ExternalDynamicRefs\]/' \
|
||||||
|
compiler/GHC/Driver/Session.hs
|
||||||
|
rm compiler/GHC/Driver/Session.hs.bak
|
||||||
|
|
||||||
|
./configure $ARGS
|
||||||
|
hadrian/build $HADRIAN_ARGS install
|
||||||
|
|
||||||
|
for shim in $(find "{{prefix}}/bin" -type f); do
|
||||||
|
sed -i.bak -e 's_="{{prefix}}_="$(dirname $(dirname $0))_' $shim
|
||||||
|
rm $shim.bak
|
||||||
|
done
|
||||||
|
|
||||||
|
sed -i.bak 's|{{tea.prefix}}|$TEA_PREFIX|g' "{{prefix}}/bin/hsc2hs-ghc-{{version}}"
|
||||||
|
rm "{{prefix}}/bin/hsc2hs-ghc-{{version}}.bak"
|
||||||
|
env:
|
||||||
|
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
|
||||||
|
BOOTSTRAP_HASKELL_ADJUST_BASHRC: 0
|
||||||
|
BOOTSTRAP_HASKELL_GHC_VERSION: ${{version}}
|
||||||
|
CONF_CC_OPTS_STAGE0: $CFLAGS
|
||||||
|
CONF_CC_OPTS_STAGE1: $CFLAGS
|
||||||
|
CONF_CC_OPTS_STAGE2: $CFLAGS
|
||||||
|
CONF_GCC_LINKER_OPTS_STAGE0: $LDFLAGS
|
||||||
|
CONF_GCC_LINKER_OPTS_STAGE1: $LDFLAGS
|
||||||
|
CONF_GCC_LINKER_OPTS_STAGE2: $LDFLAGS
|
||||||
|
# ChatGPT
|
||||||
|
GHC_OPTIONS: -fPIC
|
||||||
|
ARGS:
|
||||||
|
- --prefix={{prefix}}
|
||||||
|
- --disable-numa
|
||||||
|
- --with-curses-includes={{deps.invisible-island.net/ncurses.prefix}}/include/ncursesw
|
||||||
|
- --with-intree-gmp
|
||||||
|
- --with-system-libffi
|
||||||
|
HADRIAN_ARGS:
|
||||||
|
- -j
|
||||||
|
- --docs=none
|
||||||
|
- --flavour=release
|
||||||
|
- --prefix="{{prefix}}"
|
||||||
|
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:
|
||||||
|
script: |
|
||||||
|
out=$(runghc $FIXTURE)
|
||||||
|
test "$out" = "Hello World"
|
||||||
|
fixture:
|
||||||
|
main = putStrLn "Hello World"
|
Loading…
Reference in a new issue