fix(cabal)

use 4-digit versions, fix zlib build error, pin ghc version

closes #4015
closes #5670
This commit is contained in:
Jacob Heider 2023-11-09 15:40:32 -05:00 committed by Jacob Heider
parent b16832379c
commit 733e93170c

View file

@ -1,12 +1,10 @@
distributable: distributable:
url: https://hackage.haskell.org/packages/archive/cabal-install/{{ version }}.0/cabal-install-{{ version }}.0.tar.gz url: https://hackage.haskell.org/packages/archive/cabal-install/{{ version.raw }}/cabal-install-{{ version.raw }}.tar.gz
strip-components: 1 strip-components: 1
versions: versions:
github: haskell/cabal/releases github: haskell/cabal/releases
strip: strip: /^[Cc]abal /
- /^[Cc]abal /
- /\.0$/ #FIXME cabal uses 4 digit versioning
dependencies: dependencies:
haskell.org: 9 haskell.org: 9
@ -18,62 +16,66 @@ provides:
build: build:
dependencies: dependencies:
haskell.org: 9.6.3 # later version pass invalid linker flags on darwin clang-14
curl.se: '*' curl.se: '*'
linux/aarch64: linux/aarch64:
github.com/numactl/numactl: ^2 # downloaded cabal needs this github.com/numactl/numactl: ^2 # downloaded cabal needs this
tukaani.org/xz: 5 tukaani.org/xz: 5
script: |- script:
case "X{{ hw.target }}" in # utf-8 issues
"Xaarch64-apple-darwin") - run: export HOME="$(mktemp -d)"
BOOTSTRAP="https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.6.0.0/cabal-install-3.6.0.0-aarch64-darwin-big-sur.tar.xz" if: linux
;;
"Xx86_64-apple-darwin")
BOOTSTRAP="https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-x86_64-apple-darwin17.7.0.tar.xz"
;;
"Xx86_64-unknown-linux-gnu")
BOOTSTRAP="https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz"
;;
"Xaarch64-unknown-linux-gnu")
BOOTSTRAP="https://downloads.haskell.org/ghcup/unofficial-bindists/cabal/3.7.0.0-pre20220407/cabal-install-3.7-aarch64-linux-deb10.tar.xz"
;;
*)
echo "Unknown arch. Please update the pantry."
exit 1
esac
if [[ "X{{ hw.platform }}" == Xlinux ]]; then - run: |
ADDITIONAL_CABAL_FLAGS="--with-gcc=clang" if test ! -e .bootstrap/cabal; then
fi if test ! -e .bootstrap; then
mkdir .bootstrap
if test ! -e .bootstrap/cabal; then fi
if test ! -e .bootstrap; then curl -L "${BOOTSTRAP}" | tar Jxf - -C .bootstrap
mkdir .bootstrap fi
fi
curl -L "${BOOTSTRAP}" | tar Jxf - -C .bootstrap
fi
## This seems dirty, but building is an internal-only gig atm. ## This seems dirty, but building is an internal-only gig atm.
# Likely fix is to use CABAL_DIR in build scripts # Likely fix is to use CABAL_DIR in build scripts
if test -e ~/.cabal/bin; then - run: |
rm -r ~/.cabal/bin if test -e ~/.cabal/bin; then
fi rm -r ~/.cabal/bin
fi
# this is not an acceptable solution, do you know a better one? pls PR 🙏 # this is not an acceptable solution, do you know a better one? pls PR 🙏
#FIXME also this sed line sucks but I got bored trying to make it work #FIXME also this sed line sucks but I got bored trying to make it work
sed -i.bak \ # zlib 0.7.0.0 doesn't respect our rpaths with its intermediate build products
-e 's/build-depends: base.*/build-depends: base >=4.10 \&\& <5/' \ - |
-e 's/text.*>=.*/text >= 1.2.3 \&\& < 3,/' \ sed -i \
cabal-install.cabal -e 's/build-depends: base.*/build-depends: base >=4.10 \&\& <5/' \
-e 's/text.*>=.*/text >= 1.2.3 \&\& < 3,/' \
-e 's/zlib.*< .*/zlib >= 0.5.3 \&\& < 0.7,/' \
cabal-install.cabal
# ^^ SEE https://github.com/haskell/cabal/issues/8118 # ^^ SEE https://github.com/haskell/cabal/issues/8118
rm *.bak - mkdir -p "{{prefix}}/bin"
mkdir -p "{{prefix}}/bin" - ./.bootstrap/cabal v2-update
./.bootstrap/cabal v2-update
./.bootstrap/cabal v2-install \ - ./.bootstrap/cabal v2-install
--install-method=copy \ --install-method=copy
--installdir={{prefix}}/bin \ --installdir={{prefix}}/bin
$ADDITIONAL_CABAL_FLAGS $ADDITIONAL_CABAL_FLAGS
env:
darwin/aarch64:
BOOTSTRAP: https://downloads.haskell.org/~cabal/cabal-install-3.10.2.0/cabal-install-3.10.2.0-aarch64-darwin.tar.xz
darwin/x86-64:
BOOTSTRAP: https://downloads.haskell.org/~cabal/cabal-install-3.10.2.0/cabal-install-3.10.2.0-x86_64-darwin.tar.xz
linux/x86-64:
BOOTSTRAP: https://downloads.haskell.org/~cabal/cabal-install-3.10.2.0/cabal-install-3.10.2.0-x86_64-linux-deb10.tar.xz
linux/aarch64:
BOOTSTRAP: https://downloads.haskell.org/~cabal/cabal-install-3.10.2.0/cabal-install-3.10.2.0-aarch64-linux-deb10.tar.xz
linux:
ADDITIONAL_CABAL_FLAGS:
- -v3
# else segfaults
- --enable-relocatable
- --ghc-option=-fPIC
- --ghc-option=-Wl,-pie
test: | test:
cabal --config-file=./config user-config init - cabal --config-file=./config user-config init
cabal --config-file=./config info Cabal - cabal --config-file=./config info Cabal