mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
testing/ghc-current: new aport
This commit is contained in:
parent
ba08ac2a22
commit
9cf732f6ca
446
testing/ghc-current/APKBUILD
Normal file
446
testing/ghc-current/APKBUILD
Normal file
@ -0,0 +1,446 @@
|
||||
# Maintainer: Celeste <cielesti@protonmail.com>
|
||||
maintainer="Celeste <cielesti@protonmail.com>"
|
||||
pkgname=ghc-current
|
||||
pkgver=9.15_pre20250726
|
||||
_gitrev=cc1116e06c4cc140f6efd9fb1317a587e3f0b08b
|
||||
pkgrel=0
|
||||
_pkgdate="${pkgver##*_pre}"
|
||||
_pkgver="${pkgver%%_pre*}.$_pkgdate"
|
||||
# GHC version used to bootstrap the build. This is relevant for the
|
||||
# bootstrapping of the Hadrian build system used by GHC these days.
|
||||
case "$CARCH" in
|
||||
loongarch64) _bootstrapver=9.12.2 ;;
|
||||
*) _bootstrapver=9.8.2 ;;
|
||||
esac
|
||||
pkgdesc="Current snapshot of the Glasgow Haskell Compiler"
|
||||
url="https://haskell.org/ghc"
|
||||
arch="aarch64 loongarch64 x86_64"
|
||||
# Note ghc's license is basically BSD-3. If you'd like to know more visit:
|
||||
# * https://www.haskell.org/ghc/license
|
||||
# * https://ghc.haskell.org/trac/ghc/wiki/Licensing
|
||||
license="BSD-3-Clause"
|
||||
|
||||
# Note that ghc is sensitive to the version of llvm used.
|
||||
#
|
||||
# Ref: https://ghc.haskell.org/trac/ghc/wiki/Status/GHC-8.0.1
|
||||
# https://ghc.haskell.org/trac/ghc/wiki/ImprovedLLVMBackend
|
||||
#
|
||||
_llvmver=18
|
||||
# Without libffi-dev in $depends linking of software via ghc(1) fails.
|
||||
depends="
|
||||
cmd:cc
|
||||
gmp-dev
|
||||
libffi-dev
|
||||
llvm$_llvmver
|
||||
"
|
||||
makedepends_build="
|
||||
autoconf
|
||||
automake
|
||||
clang$_llvmver
|
||||
coreutils
|
||||
ghc-bootstrap~$_bootstrapver
|
||||
grep
|
||||
libffi-dev
|
||||
llvm$_llvmver
|
||||
ncurses-dev
|
||||
python3
|
||||
xz
|
||||
"
|
||||
makedepends_host="
|
||||
gmp-dev
|
||||
libffi-dev
|
||||
linux-headers
|
||||
musl-dev
|
||||
ncurses-dev
|
||||
zlib-dev
|
||||
"
|
||||
|
||||
# XXX: ghc-bootstrap is a hack to allow this abuild to depend on itself.
|
||||
# Adding "ghc" to makedepends would not work, because abuild implicitly removes
|
||||
# $pkgname and $subpackages from the abuild's dependencies.
|
||||
provides="ghc-bootstrap=$pkgver"
|
||||
provider_priority=5 # lowest
|
||||
install="$pkgname-cmds.post-install"
|
||||
subpackages="$pkgname-cmds::noarch $pkgname-doc"
|
||||
|
||||
_happy_ver=1.20.1.1
|
||||
_libffi_tarballs_commit=a5480d7e7f86a9bb5b44dd1156a92f69f7c185ec
|
||||
_nofib_commit=b7391df4540ac8b11b35e1b2e2c15819b5171798
|
||||
_libraries_Cabal_commit=703582f80f6d7f0c914ef4b885affcfc7b7b6ec8
|
||||
_libraries_Win32_commit=7d0772bb265a6c59eb14c441cf65c778895528df
|
||||
_libraries_array_commit=6d59d5deb4f2a12656ab4c4371c0d12dac4875ef
|
||||
_libraries_binary_commit=a625eee2eb9dfb4019c051b59d6007c9dded88aa
|
||||
_libraries_bytestring_commit=d984ad00644c0157bad04900434b9d36f23633c5
|
||||
_libraries_containers_commit=801b06e5d4392b028e519d5ca116a2881d559721
|
||||
_libraries_deepseq_commit=ae2762ac241a61852c9ff4c287af234fb1ad931f
|
||||
_libraries_directory_commit=ffd4fc248ee36095ddec55598b0f8e3a9ac762a8
|
||||
_libraries_exceptions_commit=b6c4290124eb1138358bf04ad9f33e67f6c5c1d8
|
||||
_libraries_file_io_commit=21303160b5dd91d6197bd1d20a8796ba2a819d4e
|
||||
_libraries_filepath_commit=cbcd0ccf92f47e6c10fb9cc513a7b26facfc19fe
|
||||
_libraries_ghc_internal_gmp_gmp_tarballs_commit=01149ce3471128e9fe0feca607579981f4b64395
|
||||
_libraries_haskeline_commit=991953cd5d3bb9e8057de4a0d8f2cae3455865d8
|
||||
_libraries_hpc_commit=7b7aed397cbe2bb36824d8627527fa4d5abffaa6
|
||||
_libraries_mtl_commit=37cbd924cb71eba591a2e2b6b131767f632d22c9
|
||||
_libraries_os_string_commit=2e693aad07540173a0169971b27c9acac28eeff1
|
||||
_libraries_parsec_commit=552730e23e1fd2dae46a60d75138b8d173492462
|
||||
_libraries_pretty_commit=c3a1469306b35fa5d023dc570554f97f1a90435d
|
||||
_libraries_process_commit=ae50731b5fb221a7631f7e9d818fc6716c85c51e
|
||||
_libraries_semaphore_compat_commit=ba87d1bb0209bd9f29bda1c878ddf345f8a2b199
|
||||
_libraries_stm_commit=23bdcc2319965911af28542e76fc01f37c107d40
|
||||
_libraries_terminfo_commit=16db154e3e97e6bff62329574163851a7090f3b6
|
||||
_libraries_text_commit=f1a05704a153ecc6a9bd45f6df8dd99820e74a2d
|
||||
_libraries_time_commit=e5c5d1987011efe88a21ab6ded45aaa33a16274f
|
||||
_libraries_transformers_commit=cee47cca7705edafe0a5839439e679edbd61890a
|
||||
_libraries_unix_commit=1c3548c3906bb0d912eda5685968934183f4b51f
|
||||
_libraries_xhtml_commit=68353ccd1a2e776d6c2b11619265d8140bb7dc07
|
||||
_utils_hpc_commit=5923da3fe77993b7afc15b5163cffcaa7da6ecf5
|
||||
_utils_hsc2hs_commit=fe3990b9f35000427b016a79330d9f195587cad8
|
||||
|
||||
source="https://gitlab.haskell.org/ghc/ghc/-/archive/$_gitrev/ghc-$_gitrev.tar.gz
|
||||
https://hackage.haskell.org/package/happy-$_happy_ver/happy-$_happy_ver.tar.gz
|
||||
https://gitlab.haskell.org/ghc/libffi-tarballs/-/archive/$_libffi_tarballs_commit/libffi-tarballs-$_libffi_tarballs_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/nofib/-/archive/$_nofib_commit/nofib-$_nofib_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/Cabal/-/archive/$_libraries_Cabal_commit/Cabal-$_libraries_Cabal_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/Win32/-/archive/$_libraries_Win32_commit/Win32-$_libraries_Win32_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/array/-/archive/$_libraries_array_commit/array-$_libraries_array_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/binary/-/archive/$_libraries_binary_commit/binary-$_libraries_binary_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/bytestring/-/archive/$_libraries_bytestring_commit/bytestring-$_libraries_bytestring_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/containers/-/archive/$_libraries_containers_commit/containers-$_libraries_containers_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/deepseq/-/archive/$_libraries_deepseq_commit/deepseq-$_libraries_deepseq_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/directory/-/archive/$_libraries_directory_commit/directory-$_libraries_directory_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/exceptions/-/archive/$_libraries_exceptions_commit/exceptions-$_libraries_exceptions_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/file-io/-/archive/$_libraries_file_io_commit/file-io-$_libraries_file_io_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/filepath/-/archive/$_libraries_filepath_commit/filepath-$_libraries_filepath_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/gmp-tarballs/-/archive/$_libraries_ghc_internal_gmp_gmp_tarballs_commit/gmp-tarballs-$_libraries_ghc_internal_gmp_gmp_tarballs_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/haskeline/-/archive/$_libraries_haskeline_commit/haskeline-$_libraries_haskeline_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/hpc/-/archive/$_libraries_hpc_commit/hpc-$_libraries_hpc_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/mtl/-/archive/$_libraries_mtl_commit/mtl-$_libraries_mtl_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/os-string/-/archive/$_libraries_os_string_commit/os-string-$_libraries_os_string_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/parsec/-/archive/$_libraries_parsec_commit/parsec-$_libraries_parsec_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/pretty/-/archive/$_libraries_pretty_commit/pretty-$_libraries_pretty_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/process/-/archive/$_libraries_process_commit/process-$_libraries_process_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/semaphore-compat/-/archive/$_libraries_semaphore_compat_commit/semaphore-compat-$_libraries_semaphore_compat_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/stm/-/archive/$_libraries_stm_commit/stm-$_libraries_stm_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/terminfo/-/archive/$_libraries_terminfo_commit/terminfo-$_libraries_terminfo_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/text/-/archive/$_libraries_text_commit/text-$_libraries_text_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/time/-/archive/$_libraries_time_commit/time-$_libraries_time_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/transformers/-/archive/$_libraries_transformers_commit/transformers-$_libraries_transformers_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/unix/-/archive/$_libraries_unix_commit/unix-$_libraries_unix_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/packages/xhtml/-/archive/$_libraries_xhtml_commit/xhtml-$_libraries_xhtml_commit.tar.gz
|
||||
https://gitlab.haskell.org/hpc/hpc-bin/-/archive/$_utils_hpc_commit/hpc-bin-$_utils_hpc_commit.tar.gz
|
||||
https://gitlab.haskell.org/ghc/hsc2hs/-/archive/$_utils_hsc2hs_commit/hsc2hs-$_utils_hsc2hs_commit.tar.gz
|
||||
|
||||
plan-bootstrap-from-9.8.2.json
|
||||
plan-bootstrap-from-9.12.2.json
|
||||
|
||||
fix-hadrian-bootstrap-riCabalHash.patch
|
||||
parallel-hadrian-bootstrap.patch
|
||||
"
|
||||
options="$options !check" # run tests in community/ghc
|
||||
options="$options !strip" # we strip it manually in package()
|
||||
options="$options net" # required for fetching sources in the Hadrian plan
|
||||
options="$options $pkgname-cmds::!tracedeps" # do not provide cmd:ghc=$pkgver
|
||||
|
||||
builddir="$srcdir/ghc-$_gitrev"
|
||||
if [ -f "$HADRIAN" -a -x "$HADRIAN" ]; then
|
||||
_hadrian="$HADRIAN"
|
||||
else
|
||||
_hadrian="$builddir/hadrian/bootstrap/_build/bin/hadrian"
|
||||
fi
|
||||
_hadrian_args="-j${JOBS:-1} --docs=none"
|
||||
|
||||
if [ "$CBUILD" != "$CTARGET" ]; then
|
||||
_hadrian_args="$_hadrian_args --flavour=quickest"
|
||||
else
|
||||
_hadrian_args="$_hadrian_args --flavour=perf+no_profiled_libs+omit_pragmas --hash-unit-ids"
|
||||
fi
|
||||
|
||||
_subst_alpine_targets() {
|
||||
# Switch llvm-targets from unknown-linux-gnueabihf->alpine-linux
|
||||
# so we can match the llvm vendor string alpine uses
|
||||
sed -i \
|
||||
-e 's/i386-unknown-linux/i586-alpine-linux/g' \
|
||||
-e 's/unknown-linux-musl/alpine-linux-musl/g' \
|
||||
-e 's/unknown-linux-gnueabihf/alpine-linux/g' \
|
||||
-e 's/unknown-linux-gnueabi/alpine-linux/g' \
|
||||
-e 's/unknown-linux-gnu/alpine-linux/g' \
|
||||
-e 's/riscv64-unknown-linux/riscv64-alpine-linux-musl/g' \
|
||||
-e 's/loongarch64-unknown-linux/loongarch64-alpine-linux-musl/g' \
|
||||
"$builddir"/llvm-targets
|
||||
}
|
||||
|
||||
prepare() {
|
||||
if ! [ -r "$srcdir"/plan-bootstrap-from-$_bootstrapver.json ]; then
|
||||
die "Plan for bootstrapping from $_bootstrapver is missing"
|
||||
fi
|
||||
|
||||
rmdir -v libffi-tarballs nofib libraries/Cabal libraries/Win32 \
|
||||
libraries/array libraries/binary libraries/bytestring \
|
||||
libraries/containers libraries/deepseq libraries/directory \
|
||||
libraries/exceptions libraries/file-io libraries/filepath \
|
||||
libraries/ghc-internal/gmp/gmp-tarballs libraries/haskeline \
|
||||
libraries/hpc libraries/mtl libraries/os-string \
|
||||
libraries/parsec libraries/pretty libraries/process \
|
||||
libraries/semaphore-compat libraries/stm libraries/terminfo \
|
||||
libraries/text libraries/time libraries/transformers \
|
||||
libraries/unix libraries/xhtml utils/hpc utils/hsc2hs
|
||||
|
||||
mv -v ../libffi-tarballs-$_libffi_tarballs_commit \
|
||||
libffi-tarballs
|
||||
mv -v ../nofib-$_nofib_commit \
|
||||
nofib
|
||||
mv -v ../Cabal-$_libraries_Cabal_commit \
|
||||
libraries/Cabal
|
||||
mv -v ../Win32-$_libraries_Win32_commit \
|
||||
libraries/Win32
|
||||
mv -v ../array-$_libraries_array_commit \
|
||||
libraries/array
|
||||
mv -v ../binary-$_libraries_binary_commit \
|
||||
libraries/binary
|
||||
mv -v ../bytestring-$_libraries_bytestring_commit \
|
||||
libraries/bytestring
|
||||
mv -v ../containers-$_libraries_containers_commit \
|
||||
libraries/containers
|
||||
mv -v ../deepseq-$_libraries_deepseq_commit \
|
||||
libraries/deepseq
|
||||
mv -v ../directory-$_libraries_directory_commit \
|
||||
libraries/directory
|
||||
mv -v ../exceptions-$_libraries_exceptions_commit \
|
||||
libraries/exceptions
|
||||
mv -v ../file-io-$_libraries_file_io_commit \
|
||||
libraries/file-io
|
||||
mv -v ../filepath-$_libraries_filepath_commit \
|
||||
libraries/filepath
|
||||
mv -v ../gmp-tarballs-$_libraries_ghc_internal_gmp_gmp_tarballs_commit \
|
||||
libraries/ghc-internal/gmp/gmp-tarballs
|
||||
mv -v ../haskeline-$_libraries_haskeline_commit \
|
||||
libraries/haskeline
|
||||
mv -v ../hpc-$_libraries_hpc_commit \
|
||||
libraries/hpc
|
||||
mv -v ../mtl-$_libraries_mtl_commit \
|
||||
libraries/mtl
|
||||
mv -v ../os-string-$_libraries_os_string_commit \
|
||||
libraries/os-string
|
||||
mv -v ../parsec-$_libraries_parsec_commit \
|
||||
libraries/parsec
|
||||
mv -v ../pretty-$_libraries_pretty_commit \
|
||||
libraries/pretty
|
||||
mv -v ../process-$_libraries_process_commit \
|
||||
libraries/process
|
||||
mv -v ../semaphore-compat-$_libraries_semaphore_compat_commit \
|
||||
libraries/semaphore-compat
|
||||
mv -v ../stm-$_libraries_stm_commit \
|
||||
libraries/stm
|
||||
mv -v ../terminfo-$_libraries_terminfo_commit \
|
||||
libraries/terminfo
|
||||
mv -v ../text-$_libraries_text_commit \
|
||||
libraries/text
|
||||
mv -v ../time-$_libraries_time_commit \
|
||||
libraries/time
|
||||
mv -v ../transformers-$_libraries_transformers_commit \
|
||||
libraries/transformers
|
||||
mv -v ../unix-$_libraries_unix_commit \
|
||||
libraries/unix
|
||||
mv -v ../xhtml-$_libraries_xhtml_commit \
|
||||
libraries/xhtml
|
||||
mv -v ../hpc-bin-$_utils_hpc_commit \
|
||||
utils/hpc
|
||||
mv -v ../hsc2hs-$_utils_hsc2hs_commit \
|
||||
utils/hsc2hs
|
||||
|
||||
default_prepare
|
||||
_subst_alpine_targets
|
||||
|
||||
# configure reads the date and git commit from these 2 files
|
||||
echo "$_pkgdate" > VERSION_DATE
|
||||
echo "$_gitrev" > GIT_COMMIT_ID
|
||||
|
||||
autoreconf -fvi
|
||||
local conf; for conf in */configure.ac */*/configure.ac; do
|
||||
autoreconf -fvi "${conf%/*}"
|
||||
done
|
||||
}
|
||||
|
||||
_configure() {
|
||||
# clang instead of llvm-as: https://gitlab.haskell.org/ghc/ghc/-/issues/24630
|
||||
./configure \
|
||||
--disable-ld-override \
|
||||
ac_cv_prog_CC="$CC" ac_cv_path_ac_pt_CXX="$CXX" \
|
||||
CC="$CC" CXX="$CXX" LD="$LD" \
|
||||
CLANG=/usr/lib/llvm$_llvmver/bin/clang \
|
||||
LLVMAS=/usr/lib/llvm$_llvmver/bin/clang \
|
||||
LLC=/usr/lib/llvm$_llvmver/bin/llc \
|
||||
OPT=/usr/lib/llvm$_llvmver/bin/opt \
|
||||
"$@"
|
||||
}
|
||||
|
||||
build() {
|
||||
# Happy is required when building from git archive, which doesn't contain
|
||||
# pre-generated compiler/GHC/Parser.hs and compiler/GHC/Cmm/Parser.hs.
|
||||
cd "$srcdir"/happy-$_happy_ver
|
||||
runhaskell Setup.hs configure \
|
||||
"--datadir=$srcdir/happy-$_happy_ver/data" \
|
||||
"--datasubdir=" \
|
||||
-f -bootstrap
|
||||
runhaskell Setup.hs build -j "--ghc-options=-j -O1"
|
||||
|
||||
# Build the hadrian build system.
|
||||
#
|
||||
# See:
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/tree/master/hadrian/bootstrap
|
||||
# * https://www.haskell.org/ghc/blog/20220805-make-to-hadrian.html
|
||||
cd "$builddir"/hadrian/bootstrap/
|
||||
[ -x "$_hadrian" ] || python3 ./bootstrap.py \
|
||||
-j ${JOBS:-1} \
|
||||
-w /usr/bin/ghc \
|
||||
--no-archive \
|
||||
-d "$srcdir"/plan-bootstrap-from-$_bootstrapver.json
|
||||
|
||||
# NOTE: ghc build system requires host == build, and it ends up
|
||||
# compiling the cross-compiler (stage1) and cross-compiling with
|
||||
# that the native compiler (stage2)
|
||||
cd "$builddir"
|
||||
_configure \
|
||||
--build=$CBUILD \
|
||||
--host=$CBUILD \
|
||||
--target=$CTARGET \
|
||||
--prefix=/usr \
|
||||
--with-system-libffi \
|
||||
HAPPY="$srcdir"/happy-$_happy_ver/dist/build/happy/happy \
|
||||
ALEX="$builddir"/hadrian/bootstrap/_build/bin/alex
|
||||
|
||||
"$_hadrian" $_hadrian_args binary-dist-dir
|
||||
}
|
||||
|
||||
package() {
|
||||
local ghclib="$pkgdir/usr/lib/ghc-$_pkgver/lib"
|
||||
local newpath path target
|
||||
|
||||
# Hadrian's install command doesn't support DESTDIR.
|
||||
# Hence, we need to install via the bindist.
|
||||
cd "$builddir"/_build/bindist/ghc-*
|
||||
# Need to re-run configure.
|
||||
# See: https://gitlab.haskell.org/ghc/ghc/-/issues/22058
|
||||
_configure --prefix=/usr
|
||||
|
||||
make DESTDIR="$pkgdir" RECACHE_PACKAGE_DB=NO install
|
||||
|
||||
install -Dvm644 "$builddir"/LICENSE \
|
||||
-t "$pkgdir"/usr/share/licenses/$pkgname/
|
||||
|
||||
cd "$pkgdir"
|
||||
|
||||
# This dir is empty when HTML docs aren't built.
|
||||
rmdir -v usr/share/doc/ghc-$_pkgver
|
||||
|
||||
# Fixup install tree if needed.
|
||||
if [ -d usr/lib/$CTARGET-ghc-$_pkgver ]; then
|
||||
# different location
|
||||
ghclib="$pkgdir/usr/lib/$CTARGET-ghc-$_pkgver/lib"
|
||||
|
||||
# Rename binaries and fix links.
|
||||
for path in usr/bin/"$CTARGET"-*; do
|
||||
newpath="${path//$CTARGET-/}"
|
||||
|
||||
if [ -h "$path" ]; then
|
||||
target="$(readlink $path)"
|
||||
ln -sf "${target//$CTARGET-/}" "$newpath"
|
||||
rm "$path"
|
||||
else
|
||||
mv "$path" "$newpath"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Remove triplet prefix from settings -- the intention is
|
||||
# that the native compiler will use native gcc/ld on the target.
|
||||
sed -i "s|$CTARGET-||g" "$ghclib"/settings
|
||||
|
||||
# Can't do a full strip on archives.
|
||||
find . -type f \( -name "*.so" -o -name "*.a" \) \
|
||||
-exec ${CROSS_COMPILE}strip --strip-unneeded {} \;
|
||||
find "$ghclib"/../bin -type f \
|
||||
-exec ${CROSS_COMPILE}strip {} \;
|
||||
}
|
||||
|
||||
cmds() {
|
||||
pkgdesc="$pkgdesc (commands)"
|
||||
provides="$pkgname-bootstrap=$pkgver-r$pkgrel"
|
||||
depends="$pkgname=$pkgver-r$pkgrel"
|
||||
install_if="$pkgname=$pkgver-r$pkgrel"
|
||||
|
||||
amove usr/bin
|
||||
}
|
||||
|
||||
# Helper function, requires curl and jq to run
|
||||
print_submodules() {
|
||||
local submodules="$(
|
||||
curl -H "Accept: application/vnd.github+json" -Ssf \
|
||||
"https://api.github.com/repos/ghc/ghc/git/trees/$_gitrev?recursive=true" \
|
||||
| jq '.tree[] | select(.type == "commit")'
|
||||
)"
|
||||
|
||||
local path; for path in libffi-tarballs nofib \
|
||||
libraries/Cabal libraries/Win32 \
|
||||
libraries/array libraries/binary \
|
||||
libraries/bytestring libraries/containers \
|
||||
libraries/deepseq libraries/directory \
|
||||
libraries/exceptions libraries/file-io \
|
||||
libraries/filepath libraries/ghc-internal/gmp/gmp-tarballs \
|
||||
libraries/haskeline libraries/hpc \
|
||||
libraries/mtl libraries/os-string \
|
||||
libraries/parsec libraries/pretty \
|
||||
libraries/process libraries/semaphore-compat \
|
||||
libraries/stm libraries/terminfo \
|
||||
libraries/text libraries/time \
|
||||
libraries/transformers libraries/unix \
|
||||
libraries/xhtml utils/hpc utils/hsc2hs
|
||||
do
|
||||
printf "_${path//[-\/]/_}_commit=%s\n" \
|
||||
"$(
|
||||
echo "$submodules" \
|
||||
| jq -r --arg path "$path" \
|
||||
'select(.path == $path) | .sha'
|
||||
)"
|
||||
done
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
0d487b52366c56febcafa6e46fa5be084548c20f9541bba5374e94cf70411d10a9e3683ea4baa981b2bb1ca249eb9c2242c0c39448a31c79501bde54b2cba872 ghc-cc1116e06c4cc140f6efd9fb1317a587e3f0b08b.tar.gz
|
||||
a2ff6a1778884de22f4900a22b8a451ed5dc8a8e66020ce9e186a03068257748a3810c63b56f1efa0b646d99fe637f87178983f387d4c49bc33b82613877ec48 happy-1.20.1.1.tar.gz
|
||||
2458d055d9619574abcd2541d530f2d279c425bfadb5b25958998f0c2273019c8bef4d0f5629dfa322350a3bd46ab2204173c0a36e180b8c26a4dd84e118f6b3 libffi-tarballs-a5480d7e7f86a9bb5b44dd1156a92f69f7c185ec.tar.gz
|
||||
f03a0a6a38d0dd53f2ca7eaa8c3b9a0c1e073fad768b66018ee646e7f0befccc7a837cd7aac02608edba5383a915dacd5317cb58f116400eaa553b2686dc4213 nofib-b7391df4540ac8b11b35e1b2e2c15819b5171798.tar.gz
|
||||
fd73b8186648add512380464dacb079ac065db9c2d25869ab8bca9ec1a8a89ea6b8ab475362b41069c2f698dbaa7ee78a64e9c1089d2ef9cd7ed2dfd2ba0619c Cabal-703582f80f6d7f0c914ef4b885affcfc7b7b6ec8.tar.gz
|
||||
1e50e8bb84e9cc5a6324bd4f2fcc3cc4358514eac47fe97a8a7e6f9a0a671d517c05fc98dfd328d13a0bab2cad4941085092e6021ee98dcc8b3cbafa95c0bd21 Win32-7d0772bb265a6c59eb14c441cf65c778895528df.tar.gz
|
||||
518ecdb2053a37f48ccd5f3e6134ced2aac5667077f8b62fe49560d72fd1313d67343b0e209d9b11291c4f086a51defff3c5cf520f7a209548d5562f7e22a024 array-6d59d5deb4f2a12656ab4c4371c0d12dac4875ef.tar.gz
|
||||
1ccb5acccd4b7606f17c0242f7305e0c4d372176166efdf0a8e776d6c6fce24d16c144e329acb1a3628bfd73484e11781e36fccbff021c869871041e0ea07cd5 binary-a625eee2eb9dfb4019c051b59d6007c9dded88aa.tar.gz
|
||||
afdd62a7d4548cc4c661417252ca45ddf48fc9d319687baec855b32d82a960271538043caad4a6d3da8b32629f2600594291095ce39683027e36a9a9ebd754b0 bytestring-d984ad00644c0157bad04900434b9d36f23633c5.tar.gz
|
||||
14d50fbdc04de859efcaa80116dbb4493d3bd2f347dae2dde88b7cbbaf8bec6fea0ba0c8a878531c74b781344181054f1a20b1c69346773a3d9ee37f0b998140 containers-801b06e5d4392b028e519d5ca116a2881d559721.tar.gz
|
||||
04ce617ae59d98e94347b5e04eedfd578faefc2ce44ce620b9abecfae965ad48acea8c326bc26265ac680d2551790736034cca00ed841b93cfdcc136d0f9eba8 deepseq-ae2762ac241a61852c9ff4c287af234fb1ad931f.tar.gz
|
||||
e339f046228ba65ab00a20fddd66b75a4270c48ead7e5b75e6bfe5f1b33ca60120db69ebe56e454664b9ea0ce0d48ccb09645b4e8eb170fb77ff9d4a8dc5512a directory-ffd4fc248ee36095ddec55598b0f8e3a9ac762a8.tar.gz
|
||||
06b11637e147042bdae505769d0a8941b52b4d7088df03894bc54f2f4855e8cc781cca73c0d286c1f2ac6ae579cd2c7eea28c2756f7211bcf43e934083b97c97 exceptions-b6c4290124eb1138358bf04ad9f33e67f6c5c1d8.tar.gz
|
||||
da3071d5903e37124f0d254bbe56783184c8e26959600fef129d8d0eaba9b8dafbcc42f512fdea11bbf36a92493aeba8a50cbb1b5aa996e08a3880ee7b3d2fc7 file-io-21303160b5dd91d6197bd1d20a8796ba2a819d4e.tar.gz
|
||||
c1f582db4b9d7e41359cdca24846c34dee8845a404a26aedf6e69cb8b1355ed11eee43b399de391054a63f5c926462980e81ea5b8e7e5ed2ca98d0c98b7b5a54 filepath-cbcd0ccf92f47e6c10fb9cc513a7b26facfc19fe.tar.gz
|
||||
977a1db22413cdc294345a2d4d58976b34bd097dba457229083c11768aea15053e08cf409d15d7651a7b513e4847a9884beb267e64a062a364e9e0c01d350ff8 gmp-tarballs-01149ce3471128e9fe0feca607579981f4b64395.tar.gz
|
||||
f341799dee1761556c1a7179c6adc830e9f80a6ef5fed8d4ac593128f9d1bfc828913d20bb62749d9d2db9f6836fcc2af7a99855be1dcb6c43ff35350361daf0 haskeline-991953cd5d3bb9e8057de4a0d8f2cae3455865d8.tar.gz
|
||||
ba7dce56e1b058b488d4a337d190435d2913c12d01611ea92dee4fe5836e17caf464c6d3b43d276de9a7e77e4c5fdbea9a4c7f83b841664ef54b627163d09b18 hpc-7b7aed397cbe2bb36824d8627527fa4d5abffaa6.tar.gz
|
||||
c5e5fc0a165ee886612cbedd912744d7f4fb71424a15ba7c645a013ef6e35941736b9e9d695807d929227a3fc7f6cc8b8b59f62692cf413fbe2c6594ee504594 mtl-37cbd924cb71eba591a2e2b6b131767f632d22c9.tar.gz
|
||||
57213a9b9f79f5e317d59e8dfc6d2fb8de3601ff3fd59a100e81d9c9806c1c5cc248279e820bd053c3b0f7e841bcdf46ea67c0309eb0ff518966821f6f2e0e17 os-string-2e693aad07540173a0169971b27c9acac28eeff1.tar.gz
|
||||
868f8b54461f16dc7db2669a98c342fdc5030170ad1df21c01ee6097cbd4e35a5a4adf22a8b7a67b862260f807558483f006822824a5bf0e868ba78a2cc720fa parsec-552730e23e1fd2dae46a60d75138b8d173492462.tar.gz
|
||||
1aebabc2620194459bfca5aa203767175447464922af4764c9ef4080775ee7c3adecc6f5d3adfa6545f77f48d9e548db013deaf9f1f529862a99c3d78b3037ad pretty-c3a1469306b35fa5d023dc570554f97f1a90435d.tar.gz
|
||||
901f31e369ed275bda75ddf97f087d007f0b54435222ebd07cf129d0302eac8e7b7efb0e0c1e129b74869cc284b055bb3191785703768e953efc1c55311ec51a process-ae50731b5fb221a7631f7e9d818fc6716c85c51e.tar.gz
|
||||
b36947c913dbf41ba0ff39414bdd53517804b0d6b9a4c6d555456fc025c15a540602b773bcaf267f71f4f899ade74fe2893addd4777652140a8ac601699fd1cb semaphore-compat-ba87d1bb0209bd9f29bda1c878ddf345f8a2b199.tar.gz
|
||||
1d5ac68c593f69c49c6ae7ba4b54e9c36725fecdffc1757a9577b094645749385beea884458b497118c6cf993a03b6ac98245019b15dc2f99b9afe1e17a786d5 stm-23bdcc2319965911af28542e76fc01f37c107d40.tar.gz
|
||||
aa591c8ab0a1d4e05d2bd9aa4d9b4881f4a240a39a9998ba76c5e0d4ca5b7b17faa6541cdac79e3a8d4775c27325c4fef77a309496871379913cb20866588c6b terminfo-16db154e3e97e6bff62329574163851a7090f3b6.tar.gz
|
||||
24743e85d376458a4533140d73edf3a28b1966ab8aeab38b5f1a462dfeb21882c1c2033ee0a326261ed404e471eb754e1c040c862f6c90a81110c8d352850827 text-f1a05704a153ecc6a9bd45f6df8dd99820e74a2d.tar.gz
|
||||
c15a6ca23a3e55e187a50b7095672dfcf56fd4f7415b0b44fd74434191b2f142162fc95e3def3f82cfdd4dd6cd032414620a819e069df5056600cc2b5c43ed1a time-e5c5d1987011efe88a21ab6ded45aaa33a16274f.tar.gz
|
||||
3cd763e7d4a38324756dcc5135abcb95aa5bb2ba8dea340ba2a771a210804dc477536ef42c3dec0818e299fbbe354c03609be06aa769d84e589da0f6a70fbf70 transformers-cee47cca7705edafe0a5839439e679edbd61890a.tar.gz
|
||||
23f23ecd144259ea184434d0de384744b2c0e03691b1a1b2e9127fc4f501348b27181a0384c2a0096cf471b3c9a0fd35f3176e95e5bc8b215ee8eb885565e5fa unix-1c3548c3906bb0d912eda5685968934183f4b51f.tar.gz
|
||||
cc14d9e0e25031a05a6bd6006f5ed3b0db716c1c96e1a0d2973b5e4d43c9a3944cb41a5248578e98d843dbbea1ac6b6c3046654eaa6337a66f9832c4f644ac6c xhtml-68353ccd1a2e776d6c2b11619265d8140bb7dc07.tar.gz
|
||||
bb761665eaaeb1adf2825bd5e00ea3ee1c9b3f9e3054ede00b3c26f13b452f96878e5aef3b76632fb40ee4b613af93c980b36b4a8a9222e790a7628618302060 hpc-bin-5923da3fe77993b7afc15b5163cffcaa7da6ecf5.tar.gz
|
||||
54cce8463de88aa71a87d1632c312712c99eadc0bdd4361f1f9cff1f9088dcd677b57ee6ab7ba1cb1159ea849b8a28f798a68fcaa866990bd6563146f5dcd20d hsc2hs-fe3990b9f35000427b016a79330d9f195587cad8.tar.gz
|
||||
1321f2c6bc21d17ec1f2a8d5a00465ae5c8fbb18c77aa13e11cc1ebac4d2556a60c070887c5aa20dfd40e8293be85bdc1e2741e8dd141607eb9d69d9934e1a9b plan-bootstrap-from-9.8.2.json
|
||||
41d3dc50bba6c66d508a3f0e4d9a88671c9aa9609248b70e20a3fec56f724b0bf681aec90f44be7a56e74624f7b8e9b92dc409933ad236e6956a4f3d7654efee plan-bootstrap-from-9.12.2.json
|
||||
7ae3095fb91a739b2285be682f82014953e17a10aef3d969d44ea54f80e3fc5dae080e55619b0bf69b482416477ebebe8fe5c0b1914b36b6de02cbdde6129794 fix-hadrian-bootstrap-riCabalHash.patch
|
||||
0e59d1c39e1e51ed697edc3aa87f219212a0e19312f5cdfd30b8d219b1bf8e64b36495acf7bc75920dadab8eee04ca66e022e61842152668b0daf4d597010b58 parallel-hadrian-bootstrap.patch
|
||||
"
|
31
testing/ghc-current/fix-hadrian-bootstrap-riCabalHash.patch
Normal file
31
testing/ghc-current/fix-hadrian-bootstrap-riCabalHash.patch
Normal file
@ -0,0 +1,31 @@
|
||||
Patch-Source: https://cdn.netbsd.org/pub/pkgsrc/pkgsrc-2024Q1/pkgsrc/lang/ghc96/patches/patch-hadrian_bootstrap_src_Main.hs
|
||||
|
||||
Reference: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12603#note_565099
|
||||
--
|
||||
$NetBSD: patch-hadrian_bootstrap_src_Main.hs,v 1.2 2023/11/02 15:29:31 pho Exp $
|
||||
|
||||
Fix build with cabal-install-parsers >= 0.6. This doesn't affect normal
|
||||
builds. It's only for creating Hadrian bootstrap source archives.
|
||||
|
||||
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11546
|
||||
|
||||
--- a/hadrian/bootstrap/src/Main.hs
|
||||
+++ b/hadrian/bootstrap/src/Main.hs
|
||||
@@ -1,3 +1,5 @@
|
||||
+{-# Language CPP #-}
|
||||
+
|
||||
module Main (main) where
|
||||
|
||||
import Data.Either (partitionEithers)
|
||||
@@ -84,7 +86,11 @@ main2 meta plan = do
|
||||
return
|
||||
( Hackage
|
||||
, Just $ fromIntegral (I.riRevision relInfo)
|
||||
+#if MIN_VERSION_cabal_install_parsers(0, 6, 0)
|
||||
+ , P.sha256FromByteString $ I.getSHA256 $ I.riCabalHash relInfo
|
||||
+#else
|
||||
, P.sha256FromByteString $ I.getSHA256 $ I.riCabal relInfo
|
||||
+#endif
|
||||
)
|
||||
|
||||
Nothing -> case P.uType unit of
|
5
testing/ghc-current/ghc-current-cmds.post-install
Normal file
5
testing/ghc-current/ghc-current-cmds.post-install
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Force ghc-pkg to recache the base installed packages. Necessary as we
|
||||
# did make install DESTDIR=... so the cache has invalid locations.
|
||||
|
||||
ghc-pkg recache
|
103
testing/ghc-current/parallel-hadrian-bootstrap.patch
Normal file
103
testing/ghc-current/parallel-hadrian-bootstrap.patch
Normal file
@ -0,0 +1,103 @@
|
||||
Patch-Source: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12610
|
||||
--
|
||||
From eea465641340ad6d493093f68ffaebb22e000ded Mon Sep 17 00:00:00 2001
|
||||
From: PHO <pho@cielonegro.org>
|
||||
Date: Sat, 11 May 2024 23:43:52 +0900
|
||||
Subject: [PATCH] hadrian/bootstrap/bootstrap.py: Add an option --jobs=N for
|
||||
parallel compilation
|
||||
|
||||
This makes bootstrapping hadrian a lot faster.
|
||||
---
|
||||
hadrian/bootstrap/bootstrap.py | 26 +++++++++++++++++---------
|
||||
1 file changed, 17 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/hadrian/bootstrap/bootstrap.py
|
||||
+++ b/hadrian/bootstrap/bootstrap.py
|
||||
@@ -186,24 +186,24 @@ def resolve_dep(dep : BootstrapDep) -> Path:
|
||||
return sdist_dir
|
||||
|
||||
|
||||
-def install_dep(dep: BootstrapDep, ghc: Compiler) -> None:
|
||||
+def install_dep(dep: BootstrapDep, ghc: Compiler, jobs: int|None) -> None:
|
||||
dist_dir = (DISTDIR / f'{dep.package}-{dep.version}').resolve()
|
||||
|
||||
sdist_dir = resolve_dep(dep)
|
||||
|
||||
- install_sdist(dist_dir, sdist_dir, ghc, dep.flags, dep.component)
|
||||
+ install_sdist(dist_dir, sdist_dir, ghc, dep.flags, dep.component, jobs)
|
||||
|
||||
-def install_sdist(dist_dir: Path, sdist_dir: Path, ghc: Compiler, flags: List[str], component):
|
||||
+def install_sdist(dist_dir: Path, sdist_dir: Path, ghc: Compiler, flags: List[str], component, jobs: int|None):
|
||||
prefix = PSEUDOSTORE.resolve()
|
||||
flags_option = ' '.join(flags)
|
||||
setup_dist_dir = dist_dir / 'setup'
|
||||
setup = setup_dist_dir / 'Setup'
|
||||
|
||||
- build_args = [
|
||||
+ common_args = [
|
||||
f'--builddir={dist_dir}',
|
||||
]
|
||||
|
||||
- configure_args = build_args + [
|
||||
+ configure_args = common_args + [
|
||||
f'--package-db={PKG_DB.resolve()}',
|
||||
f'--prefix={prefix}',
|
||||
f'--bindir={BINDIR.resolve()}',
|
||||
@@ -215,6 +215,12 @@ def install_sdist(dist_dir: Path, sdist_dir: Path, ghc: Compiler, flags: List[st
|
||||
f'{component or ""}'
|
||||
]
|
||||
|
||||
+ build_args = common_args.copy()
|
||||
+ if jobs is not None:
|
||||
+ build_args.append(f'--jobs={jobs}')
|
||||
+
|
||||
+ install_args = common_args.copy()
|
||||
+
|
||||
def check_call(args: List[str]) -> None:
|
||||
subprocess_run(args, cwd=sdist_dir, check=True)
|
||||
|
||||
@@ -231,7 +237,7 @@ def install_sdist(dist_dir: Path, sdist_dir: Path, ghc: Compiler, flags: List[st
|
||||
check_call([str(ghc.ghc_path), '--make', '-package-env=-', '-i', f'-odir={setup_dist_dir}', f'-hidir={setup_dist_dir}', '-o', setup, 'Setup'])
|
||||
check_call([setup, 'configure'] + configure_args)
|
||||
check_call([setup, 'build'] + build_args)
|
||||
- check_call([setup, 'install'] + build_args)
|
||||
+ check_call([setup, 'install'] + install_args)
|
||||
|
||||
def hash_file(h, f: BinaryIO) -> SHA256Hash:
|
||||
while True:
|
||||
@@ -246,7 +252,7 @@ def hash_file(h, f: BinaryIO) -> SHA256Hash:
|
||||
UnitId = NewType('UnitId', str)
|
||||
PlanUnit = NewType('PlanUnit', dict)
|
||||
|
||||
-def bootstrap(info: BootstrapInfo, ghc: Compiler) -> None:
|
||||
+def bootstrap(info: BootstrapInfo, ghc: Compiler, jobs: int|None) -> None:
|
||||
if not PKG_DB.exists():
|
||||
print(f'Creating package database {PKG_DB}')
|
||||
PKG_DB.parent.mkdir(parents=True, exist_ok=True)
|
||||
@@ -256,7 +262,7 @@ def bootstrap(info: BootstrapInfo, ghc: Compiler) -> None:
|
||||
check_builtin(dep, ghc)
|
||||
|
||||
for dep in info.dependencies:
|
||||
- install_dep(dep, ghc)
|
||||
+ install_dep(dep, ghc, jobs)
|
||||
|
||||
# Steps
|
||||
#######################################################################
|
||||
@@ -382,6 +388,8 @@ def main() -> None:
|
||||
help='produce a Hadrian distribution archive (default)')
|
||||
parser.add_argument('--no-archive', dest='want_archive', action='store_false',
|
||||
help='do not produce a Hadrian distribution archive')
|
||||
+ parser.add_argument('-j', '--jobs', type=int,
|
||||
+ help='the number of jobs to run simultaneously')
|
||||
parser.set_defaults(want_archive=True)
|
||||
|
||||
subparsers = parser.add_subparsers(dest="command")
|
||||
@@ -488,7 +496,7 @@ Alternatively, you could use `bootstrap.py -w {ghc.ghc_path} -d {args.deps} fetc
|
||||
plan = gen_fetch_plan(info)
|
||||
fetch_from_plan(plan, TARBALLS)
|
||||
|
||||
- bootstrap(info, ghc)
|
||||
+ bootstrap(info, ghc, args.jobs)
|
||||
hadrian_path = (BINDIR / 'hadrian').resolve()
|
||||
|
||||
print(dedent(f'''
|
1
testing/ghc-current/plan-bootstrap-from-9.12.2.json
Normal file
1
testing/ghc-current/plan-bootstrap-from-9.12.2.json
Normal file
File diff suppressed because one or more lines are too long
1
testing/ghc-current/plan-bootstrap-from-9.8.2.json
Normal file
1
testing/ghc-current/plan-bootstrap-from-9.8.2.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user