ghc: enable package & fix for current ndk (#8436)

This commit is contained in:
xtkoba 2022-01-04 20:13:23 +09:00 committed by GitHub
parent db0c11cba7
commit 579c10293c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 3 deletions

View File

@ -1,10 +1,9 @@
# Build failure with recent NDK.
TERMUX_PKG_HOMEPAGE=https://www.haskell.org/ghc/
TERMUX_PKG_DESCRIPTION="The Glasgow Haskell Compilation system"
TERMUX_PKG_LICENSE="BSD 2-Clause, BSD 3-Clause, LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=8.10.1
TERMUX_PKG_REVISION=5
TERMUX_PKG_REVISION=6
TERMUX_PKG_SRCURL=http://downloads.haskell.org/~ghc/${TERMUX_PKG_VERSION}/ghc-${TERMUX_PKG_VERSION}-src.tar.xz
TERMUX_PKG_SHA256=4e3b07f83a266b3198310f19f71e371ebce97c769b14f0d688f4cbf2a2a1edf5
TERMUX_PKG_DEPENDS="binutils, clang, iconv, libffi, llvm, ncurses"
@ -18,6 +17,26 @@ DYNAMIC_GHC_PROGRAMS=NO
termux_step_pre_configure() {
termux_setup_ghc
_WRAPPER_BIN=$TERMUX_PKG_BUILDDIR/_wrapper/bin
mkdir -p $_WRAPPER_BIN
_WRAPPER_AR=$_WRAPPER_BIN/$TERMUX_HOST_PLATFORM-ar
cat > $_WRAPPER_AR <<-EOF
#!$(which sh)
exec $(which $AR) "\$@"
EOF
chmod 0700 $_WRAPPER_AR
for cmd in llc opt; do
local wrapper="$_WRAPPER_BIN/$cmd"
cat > "$wrapper" <<-EOF
#!$(which sh)
exec /usr/lib/llvm-10/bin/${cmd} "\$@"
EOF
chmod 0700 "$wrapper"
done
export PATH=$_WRAPPER_BIN:$PATH
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --target=${TERMUX_HOST_PLATFORM}"
# After stage 0, cabal passes a host string to the libraries' configure scripts that isn't valid.
@ -78,6 +97,8 @@ patch -Np1 <<EOF
endif
EOF
export TERMUX_LD="$LD"
unset AR
unset AS
unset CC

View File

@ -0,0 +1,15 @@
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -547,9 +547,9 @@
# why no LD=@LD@ ?
LD_STAGE0 = @LD_STAGE0@
-LD_STAGE1 = $(LD)
-LD_STAGE2 = $(LD)
-LD_STAGE3 = $(LD)
+LD_STAGE1 = $(TERMUX_LD)
+LD_STAGE2 = $(TERMUX_LD)
+LD_STAGE3 = $(TERMUX_LD)
# Cross-compiling options
# See Note [CrossCompiling vs Stage1Only]