Index: lang/ghc/Makefile =================================================================== --- lang/ghc/Makefile (revision 471389) +++ lang/ghc/Makefile (working copy) @@ -14,7 +14,7 @@ LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE -ONLY_FOR_ARCHS= i386 amd64 +ONLY_FOR_ARCHS= aarch64 amd64 armv6 armv7 i386 GHC_VERSION= 8.4.2 HSCOLOUR_VERSION= 1.24.4 @@ -92,6 +92,25 @@ 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+= ${LOCALBASE}/bin/ld.gold:devel/binutils \ + llc50:devel/llvm50 +RUN_DEPENDS+= ${LOCALBASE}/bin/ld.gold:devel/binutils \ + llc50:devel/llvm50 +USE_GCC= yes + +.if ${OSVERSION} < 1200064 +IGNORE= lang/ghc requires at least __FreeBSD_version 1200064 +.endif + +.ifdef QEMU_EMULATING +IGNORE= qemu-user-static is too buggy to build lang/ghc, works fine on a real hardware +.endif +.endif + .if ${OSVERSION} < 1200000 USE_GCC= yes CONFIGURE_ARGS+= --enable-dtrace=0 @@ -157,7 +176,8 @@ .endif # MDOCS post-extract: -.if empty(PORT_OPTIONS:MBOOT) && ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200031 +.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 @@ -190,6 +210,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|LOCALBASE|${PREFIX}|' \ + ${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 @@ -203,7 +229,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: lang/ghc/distinfo =================================================================== --- lang/ghc/distinfo (revision 471389) +++ lang/ghc/distinfo (working copy) @@ -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.1-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: lang/ghc/files/extra-patch-aclocal.m4 =================================================================== --- lang/ghc/files/extra-patch-aclocal.m4 (nonexistent) +++ lang/ghc/files/extra-patch-aclocal.m4 (working copy) @@ -0,0 +1,88 @@ +--- 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" +@@ -1087,7 +1100,7 @@ AC_DEFUN([FP_PROG_AR], + fp_prog_ar=$(cygpath -m $fp_prog_ar) + fi + else +- AC_CHECK_TARGET_TOOL([fp_prog_ar], [ar]) ++ AC_CHECK_TOOL([fp_prog_ar], [ar]) + fi + fi + if test -z "$fp_prog_ar"; then +@@ -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" +@@ -2071,7 +2088,7 @@ AC_DEFUN([XCODE_VERSION],[ + # + AC_DEFUN([FIND_LLVM_PROG],[ + # Test for program with and without version name. +- AC_CHECK_TOOLS([$1], [$2-$3 $2], [:]) ++ AC_CHECK_TOOLS([$1], [$2], [:]) + if test "$$1" != ":"; then + AC_MSG_CHECKING([$$1 is version $3]) + if test `$$1 --version | grep -c "version $3"` -gt 0 ; then +@@ -2361,19 +2378,12 @@ 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. + for possible_ld in ld.lld ld.gold ld; do + TmpLd="" # In case the user set LD +- AC_CHECK_TARGET_TOOL([TmpLd], [$possible_ld]) ++ AC_CHECK_TOOL([TmpLd], [$possible_ld]) + if test "x$TmpLd" = "x"; then continue; fi + + out=`$TmpLd --version` +@@ -2383,7 +2393,7 @@ AC_DEFUN([FIND_LD],[ + FP_CC_LINKER_FLAG_TRY(bfd, $2) ;; + "GNU gold"*) + FP_CC_LINKER_FLAG_TRY(gold, $2) +- LD_NO_GOLD=ld ++ LD_NO_GOLD=LOCALBASE/bin/ld + ;; + "LLD"*) + FP_CC_LINKER_FLAG_TRY(lld, $2) ;; Property changes on: lang/ghc/files/extra-patch-aclocal.m4 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: lang/ghc/files/patch-configure =================================================================== --- lang/ghc/files/patch-configure (nonexistent) +++ lang/ghc/files/patch-configure (working copy) @@ -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" Property changes on: lang/ghc/files/patch-configure ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: lang/ghc/files/patch-configure.ac =================================================================== --- lang/ghc/files/patch-configure.ac (revision 471389) +++ lang/ghc/files/patch-configure.ac (working copy) @@ -1,5 +1,5 @@ ---- configure.ac.orig 2018-03-06 16:48:53 UTC -+++ configure.ac +--- configure.ac.orig 2018-04-17 19:30:22.000000000 +0200 ++++ configure.ac 2018-05-31 08:26:27.809565000 +0200 @@ -447,6 +447,9 @@ XCODE_VERSION() dnl ** Building a cross compiler? dnl -------------------------------------------------------------- @@ -10,6 +10,39 @@ # If 'host' and 'target' differ, then this means we are building a cross-compiler. if test "$TargetPlatform" != "$HostPlatform" ; then CrossCompiling=YES +@@ -614,7 +617,7 @@ AC_SUBST([RanlibCmd]) + + dnl ** which strip to use? + dnl -------------------------------------------------------------- +-AC_CHECK_TARGET_TOOL([STRIP], [strip]) ++AC_CHECK_TOOL([STRIP], [strip]) + StripCmd="$STRIP" + AC_SUBST([StripCmd]) + +@@ -639,6 +642,7 @@ AC_SUBST([LibtoolCmd]) + # versions of LLVM simultaneously, but that stopped working around + # 3.5/3.6 release of LLVM. + LlvmVersion=5.0 ++FreeBSDLlvmVersion=$(echo $LlvmVersion | sed 's/\.//') + AC_SUBST([LlvmVersion]) + sUPPORTED_LLVM_VERSION=$(echo \($LlvmVersion\) | sed 's/\./,/') + AC_DEFINE_UNQUOTED([sUPPORTED_LLVM_VERSION], ${sUPPORTED_LLVM_VERSION}, [The supported LLVM version number]) +@@ -651,13 +655,13 @@ AC_SUBST([ClangCmd]) + + dnl ** Which LLVM llc to use? + dnl -------------------------------------------------------------- +-FIND_LLVM_PROG([LLC], [llc], [$LlvmVersion]) ++FIND_LLVM_PROG([LLC], [llc$FreeBSDLlvmVersion], [$LlvmVersion]) + LlcCmd="$LLC" + AC_SUBST([LlcCmd]) + + dnl ** Which LLVM opt to use? + dnl -------------------------------------------------------------- +-FIND_LLVM_PROG([OPT], [opt], [$LlvmVersion]) ++FIND_LLVM_PROG([OPT], [opt$FreeBSDLlvmVersion], [$LlvmVersion]) + OptCmd="$OPT" + AC_SUBST([OptCmd]) + @@ -1163,6 +1158,11 @@ if test "$ac_cv_sizeof_void_p" -eq 8 ; t # The flag MAP_NORESERVE is supported for source compatibility reasons, # but is completely ignored by OS mmap Index: lang/ghc/files/patch-distrib_configure.ac.in =================================================================== --- lang/ghc/files/patch-distrib_configure.ac.in (nonexistent) +++ lang/ghc/files/patch-distrib_configure.ac.in (working copy) @@ -0,0 +1,27 @@ +--- distrib/configure.ac.in.orig 2018-01-15 20:26:32.000000000 +0100 ++++ distrib/configure.ac.in 2018-05-31 16:48:52.246113000 +0200 +@@ -113,7 +113,7 @@ FP_PROG_LD_FILELIST + + dnl ** which strip to use? + dnl -------------------------------------------------------------- +-AC_CHECK_TARGET_TOOL([STRIP], [strip]) ++AC_CHECK_TOOL([STRIP], [strip]) + StripCmd="$STRIP" + AC_SUBST([StripCmd]) + +@@ -125,13 +125,13 @@ LlvmVersion=@LlvmVersion@ + + dnl ** Which LLVM llc to use? + dnl -------------------------------------------------------------- +-FIND_LLVM_PROG([LLC], [llc], [$LlvmVersion]) ++FIND_LLVM_PROG([LLC], [llc50], [$LlvmVersion]) + LlcCmd="$LLC" + AC_SUBST([LlcCmd]) + + dnl ** Which LLVM opt to use? + dnl -------------------------------------------------------------- +-FIND_LLVM_PROG([OPT], [opt], [$LlvmVersion]) ++FIND_LLVM_PROG([OPT], [opt50], [$LlvmVersion]) + OptCmd="$OPT" + AC_SUBST([OptCmd]) + Property changes on: lang/ghc/files/patch-distrib_configure.ac.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: lang/ghc/files/patch-llvm-targets =================================================================== --- lang/ghc/files/patch-llvm-targets (nonexistent) +++ lang/ghc/files/patch-llvm-targets (working copy) @@ -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")) + ] Property changes on: lang/ghc/files/patch-llvm-targets ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property