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:
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
versions:
github: haskell/cabal/releases
strip:
- /^[Cc]abal /
- /\.0$/ #FIXME cabal uses 4 digit versioning
strip: /^[Cc]abal /
dependencies:
haskell.org: 9
@ -18,62 +16,66 @@ provides:
build:
dependencies:
haskell.org: 9.6.3 # later version pass invalid linker flags on darwin clang-14
curl.se: '*'
linux/aarch64:
github.com/numactl/numactl: ^2 # downloaded cabal needs this
github.com/numactl/numactl: ^2 # downloaded cabal needs this
tukaani.org/xz: 5
script: |-
case "X{{ hw.target }}" in
"Xaarch64-apple-darwin")
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"
;;
"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
script:
# utf-8 issues
- run: export HOME="$(mktemp -d)"
if: linux
if [[ "X{{ hw.platform }}" == Xlinux ]]; then
ADDITIONAL_CABAL_FLAGS="--with-gcc=clang"
fi
if test ! -e .bootstrap/cabal; then
if test ! -e .bootstrap; then
mkdir .bootstrap
fi
curl -L "${BOOTSTRAP}" | tar Jxf - -C .bootstrap
fi
- run: |
if test ! -e .bootstrap/cabal; then
if test ! -e .bootstrap; then
mkdir .bootstrap
fi
curl -L "${BOOTSTRAP}" | tar Jxf - -C .bootstrap
fi
## This seems dirty, but building is an internal-only gig atm.
# Likely fix is to use CABAL_DIR in build scripts
if test -e ~/.cabal/bin; then
rm -r ~/.cabal/bin
fi
- run: |
if test -e ~/.cabal/bin; then
rm -r ~/.cabal/bin
fi
# 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
sed -i.bak \
-e 's/build-depends: base.*/build-depends: base >=4.10 \&\& <5/' \
-e 's/text.*>=.*/text >= 1.2.3 \&\& < 3,/' \
cabal-install.cabal
# zlib 0.7.0.0 doesn't respect our rpaths with its intermediate build products
- |
sed -i \
-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
rm *.bak
- mkdir -p "{{prefix}}/bin"
mkdir -p "{{prefix}}/bin"
./.bootstrap/cabal v2-update
./.bootstrap/cabal v2-install \
--install-method=copy \
--installdir={{prefix}}/bin \
- ./.bootstrap/cabal v2-update
- ./.bootstrap/cabal v2-install
--install-method=copy
--installdir={{prefix}}/bin
$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: |
cabal --config-file=./config user-config init
cabal --config-file=./config info Cabal
test:
- cabal --config-file=./config user-config init
- cabal --config-file=./config info Cabal