Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142208575
D15674.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D15674.diff
View Options
Index: head/lang/ghc/Makefile
===================================================================
--- head/lang/ghc/Makefile
+++ head/lang/ghc/Makefile
@@ -15,7 +15,7 @@
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
-ONLY_FOR_ARCHS= i386 amd64
+ONLY_FOR_ARCHS= aarch64 amd64 armv6 armv7 i386
GHC_VERSION= 8.4.3
HSCOLOUR_VERSION= 1.24.4
@@ -56,6 +56,10 @@
OPTIONS_SUB= yes
OPTIONS_DEFAULT= PROFILE DYNAMIC
+# ghci segfaults on arm when dynamic linking is used
+OPTIONS_EXCLUDE_armv6= DYNAMIC
+OPTIONS_EXCLUDE_armv7= DYNAMIC
+OPTIONS_EXCLUDE_aarch64= DYNAMIC
BOOT_DESC= Use installed GHC for bootstrapping
BOOTH_DESC= Use installed HsColour for bootstrapping
@@ -93,6 +97,26 @@
DISTFILES+= ghc-${BOOT_GHC_VERSION}-boot-${ARCH}-freebsd${EXTRACT_SUFX}:boot
.endif # MBOOT
+.if ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7
+# CONFIGURE_TARGET must to be the same as the llvm triple
+CONFIGURE_TARGET= ${ARCH}-unknown-freebsd${"${ARCH:Maarch64}" != "":?:-gnueabihf}
+EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-aclocal.m4
+BUILD_DEPENDS+= ld.gold:devel/binutils \
+ llc50:devel/llvm50
+RUN_DEPENDS+= ld.gold:devel/binutils \
+ llc50:devel/llvm50
+USE_GCC= yes
+CONFIGURE_ENV+= OPT=opt50 LLC=llc50
+
+. if ${OSVERSION} < 1200064
+IGNORE= lang/ghc on ARM requires at least __FreeBSD_version 1200064
+. endif
+
+. ifdef QEMU_EMULATING
+IGNORE= qemu-user-static isn't able to build lang/ghc, but it builds fine on a real hardware
+. endif
+.endif
+
# Turn off for a while, see PR 228727
CONFIGURE_ARGS+= --enable-dtrace=0
.if ${OSVERSION} < 1200000
@@ -159,7 +183,9 @@
.endif # MDOCS
post-extract:
-.if empty(PORT_OPTIONS:MBOOT) && ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200031
+# don't use the "wrap" trick on arches that use post-ino64 bootstrap binaries (arm*)
+.if empty(PORT_OPTIONS:MBOOT) && ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200031 && \
+ ${ARCH} != aarch64 && ${ARCH} != armv6 && ${ARCH} != armv7
@${REINPLACE_CMD} -e 's|@SettingsCCompilerLinkFlags@|& -Wl,--wrap=readdir_r,--wrap=stat,--wrap=lstat,--wrap=fstat,--wrap=mknod|' ${BOOT_DIR}/settings.in
.endif
@@ -192,6 +218,12 @@
s|%%AR%%|${AR}|; \
s|%%LD%%|${LD}|' \
${WRKSRC}/libraries/Cabal/Cabal/Distribution/Simple/Program/Builtin.hs
+# we must use binutils:ld on arm
+.if ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7
+ @${REINPLACE_CMD} -e 's|LD_NO_GOLD=ld|LD_NO_GOLD=${LOCALBASE}/bin/ld|' \
+ ${WRKSRC}/aclocal.m4
+.endif
+
.if empty(PORT_OPTIONS:MBOOT)
@${REINPLACE_CMD} -e '/^mandir/d' ${BOOT_DIR}/mk/build.mk
@${REINPLACE_CMD} -e '/^infodir/d' ${BOOT_DIR}/mk/build.mk
@@ -205,7 +237,8 @@
@${MKDIR} ${TMPDIR}
.if empty(PORT_OPTIONS:MBOOT) && ${OPSYS} == FreeBSD && \
- ${OSVERSION} >= 1200031
+ ${OSVERSION} >= 1200031 && \
+ ${ARCH} != aarch64 && ${ARCH} != armv6 && ${ARCH} != armv7
${CC} ${CFLAGS} -c -o ${BOOT_DIR}/wrap.o ${PATCHDIR}/wrap.c
for x in ${BOOT_DIR}/rts/dist/build/libCffi*.a; do \
${AR} q $$x ${BOOT_DIR}/wrap.o; ${RANLIB} $$x; \
Index: head/lang/ghc/bsd.cabal.mk
===================================================================
--- head/lang/ghc/bsd.cabal.mk
+++ head/lang/ghc/bsd.cabal.mk
@@ -54,10 +54,7 @@
CABAL_LIBDIR= ${PREFIX}/lib/cabal/ghc-${GHC_VERSION}
CABAL_LIBSUBDIR= ${PACKAGE}
-CABAL_ARCH= x86_64
-.if ("${ARCH}" == "i386")
-CABAL_ARCH= i386
-.endif
+CABAL_ARCH= ${ARCH:S/amd64/x86_64/:C/armv.*/arm/}
CABAL_ARCHSUBDIR= ${CABAL_ARCH}-freebsd-ghc-${GHC_VERSION}
CABAL_LIBDIR_REL= ${CABAL_LIBDIR:S,^${PREFIX}/,,}
Index: head/lang/ghc/distinfo
===================================================================
--- head/lang/ghc/distinfo
+++ head/lang/ghc/distinfo
@@ -7,3 +7,9 @@
SIZE (ghc-8.4.2-boot-i386-freebsd.tar.xz) = 69976728
SHA256 (hscolour-1.24.4.tar.gz) = 243332b082294117f37b2c2c68079fa61af68b36223b3fc07594f245e0e5321d
SIZE (hscolour-1.24.4.tar.gz) = 28729
+SHA256 (ghc-8.4.2-boot-aarch64-freebsd.tar.xz) = 18412f10bb172dbaff7f31505845fbd43fdde14046463fdacc42e26683be311d
+SIZE (ghc-8.4.2-boot-aarch64-freebsd.tar.xz) = 100240140
+SHA256 (ghc-8.4.2-boot-armv6-freebsd.tar.xz) = 61d3a4486dbb904b05a735e98f23a49c2b464d6b19212dd655ff578f36d02f0d
+SIZE (ghc-8.4.2-boot-armv6-freebsd.tar.xz) = 107368936
+SHA256 (ghc-8.4.2-boot-armv7-freebsd.tar.xz) = eedb9416870bfe82315155751871e31e815b718b381ccf4f7e45a99a6ad7c94d
+SIZE (ghc-8.4.2-boot-armv7-freebsd.tar.xz) = 110153548
Index: head/lang/ghc/files/extra-patch-aclocal.m4
===================================================================
--- head/lang/ghc/files/extra-patch-aclocal.m4
+++ head/lang/ghc/files/extra-patch-aclocal.m4
@@ -0,0 +1,54 @@
+--- aclocal.m4.orig 2018-03-25 21:22:32 UTC
++++ aclocal.m4
+@@ -648,6 +648,14 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
+ $3="$$3 -D_HPUX_SOURCE"
+ $5="$$5 -D_HPUX_SOURCE"
+ ;;
++ arm*freebsd*)
++ # On arm/freebsd, tell gcc to generate Arm
++ # instructions (ie not Thumb) and to link using the gold linker.
++ # Forcing LD to be ld.gold is done in FIND_LD m4 macro.
++ $2="$$2 -marm"
++ $3="$$3 -Wl,-z,noexecstack"
++ $4="$$4 -z noexecstack"
++ ;;
+ arm*linux*)
+ # On arm/linux and arm/android, tell gcc to generate Arm
+ # instructions (ie not Thumb).
+@@ -656,6 +664,11 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
+ $4="$$4 -z noexecstack"
+ ;;
+
++ aarch64*freebsd*)
++ $3="$$3 -Wl,-z,noexecstack"
++ $4="$$4 -z noexecstack"
++ ;;
++
+ aarch64*linux*)
+ $3="$$3 -Wl,-z,noexecstack"
+ $4="$$4 -z noexecstack"
+@@ -1917,6 +1930,10 @@ case "$1" in
+ # converts the canonicalized target into someting llvm can understand
+ AC_DEFUN([GHC_LLVM_TARGET], [
+ case "$2-$3" in
++ *-freebsd*-gnueabihf)
++ llvm_target_vendor="unknown"
++ llvm_target_os="freebsd-gnueabihf"
++ ;;
+ hardfloat-*eabi)
+ llvm_target_vendor="unknown"
+ llvm_target_os="$3""hf"
+@@ -2361,13 +2378,6 @@ AC_DEFUN([FIND_LD],[
+ [enable_ld_override=yes])
+
+ find_ld() {
+- # Make sure the user didn't specify LD manually.
+- if test "z$LD" != "z"; then
+- AC_CHECK_TARGET_TOOL([LD], [ld])
+- LD_NO_GOLD=$LD
+- return
+- fi
+-
+ # Manually iterate over possible names since we want to ensure that, e.g.,
+ # if ld.lld is installed but gcc doesn't support -fuse-ld=lld, that we
+ # then still try ld.gold and -fuse-ld=gold.
Index: head/lang/ghc/files/patch-configure
===================================================================
--- head/lang/ghc/files/patch-configure
+++ head/lang/ghc/files/patch-configure
@@ -0,0 +1,22 @@
+--- configure.orig 2018-03-06 20:04:54 UTC
++++ configure
+@@ -9108,6 +9108,19 @@ $as_echo_n "checking Setting up CFLAGS, LDFLAGS, IGNOR
+ IGNORE_LINKER_LD_FLAGS="$IGNORE_LINKER_LD_FLAGS -z noexecstack"
+ ;;
+
++ arm*freebsd*)
++ # On arm/freebsd, tell gcc to generate Arm
++ # instructions (ie not Thumb).
++ CFLAGS="$CFLAGS -marm"
++ LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
++ IGNORE_LINKER_LD_FLAGS="$IGNORE_LINKER_LD_FLAGS -z noexecstack"
++ ;;
++
++ aarch64*freebsd*)
++ LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
++ IGNORE_LINKER_LD_FLAGS="$IGNORE_LINKER_LD_FLAGS -z noexecstack"
++ ;;
++
+ powerpc-ibm-aix*)
+ # We need `-D_THREAD_SAFE` to unlock the thread-local `errno`.
+ CFLAGS="$CFLAGS -D_THREAD_SAFE"
Index: head/lang/ghc/files/patch-configure.ac
===================================================================
--- head/lang/ghc/files/patch-configure.ac
+++ head/lang/ghc/files/patch-configure.ac
@@ -1,11 +1,11 @@
---- configure.ac.orig 2018-03-06 16:48:53 UTC
+--- configure.ac.orig 2018-04-17 19:30:22 UTC
+++ configure.ac
@@ -447,6 +447,9 @@ XCODE_VERSION()
dnl ** Building a cross compiler?
dnl --------------------------------------------------------------
CrossCompiling=NO
+
-+build=`echo $build | sed -e 's/amd64-/x86_64-/g; s/-freebsd.*$/-freebsd/g'`
++build=`echo $build | sed -e 's/amd64-/x86_64-/g; s/armv[[67]]-/arm-/g; s/-freebsd.*$/-freebsd/g'`
+
# If 'host' and 'target' differ, then this means we are building a cross-compiler.
if test "$TargetPlatform" != "$HostPlatform" ; then
Index: head/lang/ghc/files/patch-llvm-targets
===================================================================
--- head/lang/ghc/files/patch-llvm-targets
+++ head/lang/ghc/files/patch-llvm-targets
@@ -0,0 +1,10 @@
+--- llvm-targets.orig 2018-03-17 14:04:41 UTC
++++ llvm-targets
+@@ -20,4 +20,7 @@
+ ,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
+ ,("i386-apple-ios", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", ""))
+ ,("x86_64-apple-ios", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", ""))
++,("armv6-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align"))
++,("armv7-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+strict-align"))
++,("aarch64-unknown-freebsd", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
+ ]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 18, 6:31 AM (16 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27705822
Default Alt Text
D15674.diff (9 KB)
Attached To
Mode
D15674: lang/ghc: add armv6, armv7 and aarch64 to the list of supported architectures
Attached
Detach File
Event Timeline
Log In to Comment