--- /dev/null
+From
+ https://github.com/erikd/ghc-llvm-next/blob/llvm-3.8/patches/01-bitcast.patch
+
+diff -u -r ../ghc-8.0.1/compiler/llvmGen/Llvm/PpLlvm.hs ./compiler/llvmGen/Llvm/PpLlvm.hs
+--- ../ghc-8.0.1/compiler/llvmGen/Llvm/PpLlvm.hs 2016-05-16 13:08:53.000000000 -0400
++++ ./compiler/llvmGen/Llvm/PpLlvm.hs 2016-06-23 16:59:36.113778783 -0400
+@@ -73,7 +73,7 @@
+ Nothing -> empty
+
+ rhs = case dat of
+- Just stat -> ppr stat
++ Just stat -> pprSpecialStatic stat
+ Nothing -> ppr (pLower $ getVarType var)
+
+ -- Position of linkage is different for aliases.
+diff -u -r ../ghc-8.0.1/compiler/llvmGen/Llvm/Types.hs ./compiler/llvmGen/Llvm/Types.hs
+--- ../ghc-8.0.1/compiler/llvmGen/Llvm/Types.hs 2016-05-16 13:08:53.000000000 -0400
++++ ./compiler/llvmGen/Llvm/Types.hs 2016-06-23 17:00:14.569166114 -0400
+@@ -175,6 +175,11 @@
+ ppr (LMSub s1 s2)
+ = pprStaticArith s1 s2 (sLit "sub") (sLit "fsub") "LMSub"
+
++pprSpecialStatic :: LlvmStatic -> SDoc
++pprSpecialStatic (LMBitc v t) =
++ ppr (pLower t) <> text ", bitcast (" <> ppr v <> text " to " <> ppr t <> char ')'
++pprSpecialStatic stat = ppr stat
++
+ pprStaticArith :: LlvmStatic -> LlvmStatic -> LitString -> LitString -> String -> SDoc
+ pprStaticArith s1 s2 int_op float_op op_name =
+ let ty1 = getStatType s1
# https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Linux
# and
# https://github.com/neurocyte/ghc-android
-# Status: Current GHC does not support llvm 3.7.
+# Status: Current GHC supports llvm 3.7, but look at
+# https://github.com/erikd/ghc-llvm-next
+# for building against llvm 3.8.
TERMUX_PKG_HOMEPAGE=https://www.haskell.org/ghc/
TERMUX_PKG_DESCRIPTION="The Glasgow Haskell Compilation system"
-TERMUX_PKG_VERSION=7.10.2
+TERMUX_PKG_VERSION=8.0.1
TERMUX_PKG_SRCURL=http://downloads.haskell.org/~ghc/${TERMUX_PKG_VERSION}/ghc-${TERMUX_PKG_VERSION}-src.tar.xz
TERMUX_PKG_FOLDERNAME=ghc-$TERMUX_PKG_VERSION
TERMUX_PKG_BUILD_IN_SRC=yes
# TERMUX_PKG_DEPENDS="libandroid-support"
-TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-target=$TERMUX_HOST_PLATFORM --host=x86_64-unknown-linux --build=x86_64-unknown-linux --target=$TERMUX_HOST_PLATFORM"
-TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-iconv-includes=$TERMUX_PREFIX/include -with-iconv-libraries=$TERMUX_PREFIX/lib"
+TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-iconv-includes=$TERMUX_PREFIX/include -with-iconv-libraries=$TERMUX_PREFIX/lib"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-curses-includes=$TERMUX_PREFIX/include/ncursesw -with-curses-libraries=$TERMUX_PREFIX/lib"
+# FIXME: This triplet is not known to compiler/llvmGen/LlvmCodeGen/Ppr.hs:
+TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --host=${TERMUX_HOST_PLATFORM}"
+TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --target=${TERMUX_HOST_PLATFORM}"
+TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --host=x86_64-unknown-linux --build=x86_64-unknown-linux"
ORIG_CFLAGS="$CFLAGS"
ORIG_CPPFLAGS="$CPPFLAGS"
# Avoid "Can't use -fPIC or -dynamic on this platform":
echo "DYNAMIC_GHC_PROGRAMS = NO" >> mk/build.mk
- echo "GhcLibWays = v" >> mk/build.m
+ echo "GhcLibWays = v" >> mk/build.mk
+ # "Can not build haddock docs when CrossCompiling or Stage1Only".
+ echo "HADDOCK_DOCS=NO" >> mk/build.mk
}
--- /dev/null
+diff -u -r ../ghc-8.0.1/compiler/llvmGen/LlvmCodeGen/Ppr.hs ./compiler/llvmGen/LlvmCodeGen/Ppr.hs
+--- ../ghc-8.0.1/compiler/llvmGen/LlvmCodeGen/Ppr.hs 2016-05-16 13:08:53.000000000 -0400
++++ ./compiler/llvmGen/LlvmCodeGen/Ppr.hs 2016-06-23 17:54:27.073877144 -0400
+@@ -44,12 +44,18 @@
+ Platform { platformArch = ArchX86, platformOS = OSLinux } ->
+ text "target datalayout = \"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32\""
+ $+$ text "target triple = \"i386-pc-linux-gnu\""
++ Platform { platformArch = ArchX86, platformOS = OSAndroid } ->
++ text "target datalayout = \"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32\""
++ $+$ text "target triple = \"i386-pc-linux-android\""
+ Platform { platformArch = ArchX86_64, platformOS = OSDarwin } ->
+ text "target datalayout = \"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64\""
+ $+$ text "target triple = \"x86_64-apple-darwin10.0.0\""
+ Platform { platformArch = ArchX86_64, platformOS = OSLinux } ->
+ text "target datalayout = \"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64\""
+ $+$ text "target triple = \"x86_64-linux-gnu\""
++ Platform { platformArch = ArchX86_64, platformOS = OSAndroid } ->
++ text "target datalayout = \"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64\""
++ $+$ text "target triple = \"x86_64-linux-android\""
+ Platform { platformArch = ArchARM {}, platformOS = OSLinux } ->
+ text "target datalayout = \"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32\""
+ $+$ text "target triple = \"armv6-unknown-linux-gnueabihf\""
+@@ -71,6 +77,9 @@
+ Platform { platformArch = ArchARM64, platformOS = OSLinux } ->
+ text "target datalayout = \"e-m:e-i64:64-i128:128-n32:64-S128\""
+ $+$ text "target triple = \"aarch64-unknown-linux-gnu\""
++ Platform { platformArch = ArchARM64, platformOS = OSAndroid } ->
++ text "target datalayout = \"e-m:e-i64:64-i128:128-n32:64-S128\""
++ $+$ text "target triple = \"aarch64-unknown-linux-android\""
+ _ ->
+ if platformIsCrossCompiling platform
+ then panic "LlvmCodeGen.Ppr: Cross compiling without valid target info."
--- /dev/null
+diff -u -r ../ghc-8.0.1/configure ./configure
+--- ../ghc-8.0.1/configure 2016-05-17 12:36:51.000000000 -0400
++++ ./configure 2016-06-23 16:46:28.690875698 -0400
+@@ -7126,7 +7126,7 @@
+ # tools we are looking for. In the past, GHC supported a number of
+ # versions of LLVM simultaneously, but that stopped working around
+ # 3.5/3.6 release of LLVM.
+-LlvmVersion=3.7
++LlvmVersion=3.8
+
+ sUPPORTED_LLVM_VERSION=$(echo \($LlvmVersion\) | sed 's/\./,/')
+