Index: head/lang/Makefile =================================================================== --- head/lang/Makefile +++ head/lang/Makefile @@ -113,6 +113,7 @@ SUBDIR += gforth SUBDIR += ghc SUBDIR += ghc843 + SUBDIR += ghc862 SUBDIR += gjs SUBDIR += gnat_util SUBDIR += gnatcross-aarch64 Index: head/lang/ghc/bsd.ghc.mk =================================================================== --- head/lang/ghc/bsd.ghc.mk +++ head/lang/ghc/bsd.ghc.mk @@ -85,6 +85,19 @@ . else BOOT_GHC_VERSION= 8.4.3 . endif + +# When GHC being compiled and GHC used for bootstrapping support different +# LLVM versions, we have to pull in both. Luckily, this is relatively rare. +. if ${ARCH} == aarch64 || ${ARCH} == armv6 || ${ARCH} == armv7 +# LLVM version that bootstrap compiler uses +BOOT_LLVM_VERSION= 50 + +. if ${BOOT_LLVM_VERSION} != ${LLVM_VERSION} +BUILD_DEPENDS+= llc${BOOT_LLVM_VERSION}:devel/llvm${BOOT_LLVM_VERSION} +RUN_DEPENDS+= llc${BOOT_LLVM_VERSION}:devel/llvm${BOOT_LLVM_VERSION} +. endif +. endif + DISTFILES+= ghc-${BOOT_GHC_VERSION}-boot-${ARCH}-freebsd${EXTRACT_SUFX}:boot .endif # MBOOT Index: head/lang/ghc862/Makefile =================================================================== --- head/lang/ghc862/Makefile +++ head/lang/ghc862/Makefile @@ -0,0 +1,31 @@ +# $FreeBSD$ + +PORTNAME= ghc +PORTVERSION= ${GHC_VERSION} +PKGNAMESUFFIX= 862 +CATEGORIES= lang haskell +MASTER_SITES= http://www.haskell.org/ghc/dist/${PORTVERSION}/:source \ + LOCAL/arrowd/:boot \ + ${HACKAGE_SITE}hscolour-${HSCOLOUR_VERSION}/:docs + +EXTRACT_ONLY= ${_DISTFILES:C/hscolour.*$//g} +DISTFILES= ghc-${PORTVERSION}-src${EXTRACT_SUFX}:source \ + hscolour-${HSCOLOUR_VERSION}.tar.gz:docs + +MAINTAINER= haskell@FreeBSD.org +COMMENT= Compiler for the functional language Haskell + +LICENSE= BSD3CLAUSE +LICENSE_FILE= ${WRKSRC}/LICENSE + +GHC_VERSION= 8.6.2 +HSCOLOUR_VERSION= 1.24.4 +LLVM_VERSION= 60 + +CONFLICTS_INSTALL= ghc-7.4.* ghc-7.6.* ghc-7.8.* ghc-7.10.* ghc-8.0.* ghc-8.4.* + +PLIST= ${.CURDIR}/../../lang/ghc/pkg-plist + +.include "${.CURDIR}/../../lang/ghc/bsd.ghc.mk" + +.include Index: head/lang/ghc862/distinfo =================================================================== --- head/lang/ghc862/distinfo +++ head/lang/ghc862/distinfo @@ -0,0 +1,15 @@ +TIMESTAMP = 1543568924 +SHA256 (ghc-8.6.2-src.tar.xz) = caaa819d21280ecde90a4773143dee188711e9ff175a27cfbaee56eb851d76d5 +SIZE (ghc-8.6.2-src.tar.xz) = 19024236 +SHA256 (ghc-8.4.3-boot-amd64-freebsd.tar.xz) = 0e0324a539d471a813ed4d18c537fb19be22a4e250bd5434a3a911b9d5343724 +SIZE (ghc-8.4.3-boot-amd64-freebsd.tar.xz) = 67718400 +SHA256 (ghc-8.4.3-boot-i386-freebsd.tar.xz) = 65fcd48b1c0166e028b3f6d50ad295525e6b84490da82663ec66165e57e87972 +SIZE (ghc-8.4.3-boot-i386-freebsd.tar.xz) = 66143592 +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/ghc862/files/build.mk.in =================================================================== --- head/lang/ghc862/files/build.mk.in +++ head/lang/ghc862/files/build.mk.in @@ -0,0 +1,20 @@ +docdir = %%PREFIX%%/share/doc/ghc-%%GHC_VERSION%% +htmldir = %%PREFIX%%/share/doc/ghc-%%GHC_VERSION%% +mandir = %%PREFIX%%/man +infodir = %%PREFIX%%/info +DYNAMIC_GHC_PROGRAMS = %%WITH_DYNAMIC%% +BUILD_PROF_LIBS = %%WITH_PROFILE%% +HADDOCK_DOCS = %%WITH_DOCS%% +HSCOLOUR_SRCS = %%WITH_DOCS%% +INTEGER_LIBRARY = %%INTEGER_LIBRARY%% +# disable xelatex: PR 231438 +BUILD_SPHINX_PDF = NO +BSD_PATH_TO_HSC2HS = %%HSC2HS%% +SRC_HC_OPTS += -I%%NCURSESINC%% -L%%NCURSESLIB%% -I%%LOCALBASE%%/include -L%%LOCALBASE%%/lib +SRC_CC_OPTS += %%CFLAGS%% +EXTRA_HSC2HS_OPTS += -I%%LOCALBASE%%/include --lflag=-L%%LOCALBASE%%/lib +EXTRA_LD_OPTS += -L%%LOCALBASE%%/lib +EXTRA_CABAL_CONFIGURE_FLAGS += --extra-include-dirs=%%LOCALBASE%%/include +EXTRA_CABAL_CONFIGURE_FLAGS += --extra-lib-dirs=%%LOCALBASE%%/lib +libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes=%%NCURSESINC%% --configure-option=--with-curses-libraries=%%NCURSESLIB%% +V = 0 Index: head/lang/ghc862/files/extra-patch-aclocal.m4 =================================================================== --- head/lang/ghc862/files/extra-patch-aclocal.m4 +++ head/lang/ghc862/files/extra-patch-aclocal.m4 @@ -0,0 +1,16 @@ +--- aclocal.m4.orig 2018-03-25 21:22:32 UTC ++++ aclocal.m4 +@@ -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/ghc862/files/patch-configure.ac =================================================================== --- head/lang/ghc862/files/patch-configure.ac +++ head/lang/ghc862/files/patch-configure.ac @@ -0,0 +1,12 @@ +--- 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/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 + CrossCompiling=YES Index: head/lang/ghc862/files/patch-ghc.mk =================================================================== --- head/lang/ghc862/files/patch-ghc.mk +++ head/lang/ghc862/files/patch-ghc.mk @@ -0,0 +1,20 @@ +--- ghc.mk.orig 2018-09-16 20:53:54 UTC ++++ ghc.mk +@@ -96,6 +96,7 @@ endif + # Catch make if it runs away into an infinite loop + ifeq "$(MAKE_RESTARTS)" "" + else ifeq "$(MAKE_RESTARTS)" "1" ++else ifeq "$(MAKE_RESTARTS)" "2" + else + $(error Make has restarted itself $(MAKE_RESTARTS) times; is there a makefile bug? See http://ghc.haskell.org/trac/ghc/wiki/Building/Troubleshooting#Makehasrestarteditself3timesisthereamakefilebug for details) + endif +@@ -461,9 +462,7 @@ PACKAGES_STAGE1 += template-haskell + PACKAGES_STAGE1 += ghc-compact + PACKAGES_STAGE1 += ghc-heap + +-ifeq "$(HADDOCK_DOCS)" "YES" + PACKAGES_STAGE1 += xhtml +-endif + + ifeq "$(WITH_TERMINFO)" "YES" + PACKAGES_STAGE1 += terminfo Index: head/lang/ghc862/files/patch-libraries__Cabal__Cabal__Distribution__Simple__Program__Builtin.hs =================================================================== --- head/lang/ghc862/files/patch-libraries__Cabal__Cabal__Distribution__Simple__Program__Builtin.hs +++ head/lang/ghc862/files/patch-libraries__Cabal__Cabal__Distribution__Simple__Program__Builtin.hs @@ -0,0 +1,39 @@ +--- libraries/Cabal/Cabal/Distribution/Simple/Program/Builtin.hs.orig 2017-11-28 16:40:34 UTC ++++ libraries/Cabal/Cabal/Distribution/Simple/Program/Builtin.hs +@@ -59,6 +59,8 @@ import Distribution.Compat.Exception + import Distribution.Verbosity + import Distribution.Version + ++import System.FilePath (takeDirectory) ++ + import qualified Data.Map as Map + + -- ------------------------------------------------------------ +@@ -265,11 +267,13 @@ alexProgram = (simpleProgram "alex") { + + gccProgram :: Program + gccProgram = (simpleProgram "gcc") { +- programFindVersion = findProgramVersion "-dumpversion" id +- } ++ programFindLocation = \v p -> findProgramOnSearchPath v p "%%CC%%" ++} + + arProgram :: Program +-arProgram = simpleProgram "ar" ++arProgram = (simpleProgram "ar") { ++ programFindLocation = \v p -> findProgramOnSearchPath v p "%%AR%%" ++} + + stripProgram :: Program + stripProgram = (simpleProgram "strip") { +@@ -337,7 +341,9 @@ greencardProgram :: Program + greencardProgram = simpleProgram "greencard" + + ldProgram :: Program +-ldProgram = simpleProgram "ld" ++ldProgram = (simpleProgram "ld") { ++ programFindLocation = \v p -> findProgramOnSearchPath v p "%%LD%%" ++ } + + tarProgram :: Program + tarProgram = (simpleProgram "tar") { Index: head/lang/ghc862/files/wrap.c =================================================================== --- head/lang/ghc862/files/wrap.c +++ head/lang/ghc862/files/wrap.c @@ -0,0 +1,55 @@ +/* -*- ugly-hack-mode -*- */ +/* $FreeBSD$ */ + +#include + +struct old_dirent; +struct old_stat; + +__asm(".symver old_readdir_r, readdir_r@FBSD_1.0"); +int old_readdir_r(void *dirp, struct old_dirent *entry, + struct old_dirent **result); +__asm(".symver old_stat, stat@FBSD_1.0"); +int old_stat(const char * restrict path, struct old_stat * restrict sb); +__asm(".symver old_lstat, lstat@FBSD_1.0"); +int old_lstat(const char * restrict path, struct old_stat * restrict sb); +__asm(".symver old_fstat, fstat@FBSD_1.0"); +int old_fstat(int fd, struct old_stat *sb); +__asm(".symver old_mknod, mknod@FBSD_1.0"); +int old_mknod(const char *path, mode_t mode, uint32_t dev); + +int +__wrap_readdir_r(void *dirp, struct old_dirent *entry, + struct old_dirent **result) +{ + + return (old_readdir_r(dirp, entry, result)); +} + +int +__wrap_stat(const char * restrict path, struct old_stat * restrict sb) +{ + + return (old_stat(path, sb)); +} + +int +__wrap_lstat(const char * restrict path, struct old_stat * restrict sb) +{ + + return (old_lstat(path, sb)); +} + +int +__wrap_fstat(int fd, struct old_stat *sb) +{ + + return (old_fstat(fd, sb)); +} + +int +__wrap_mknod(const char *path, mode_t mode, uint32_t dev) +{ + + return (old_mknod(path, mode, dev)); +} Index: head/lang/ghc862/pkg-descr =================================================================== --- head/lang/ghc862/pkg-descr +++ head/lang/ghc862/pkg-descr @@ -0,0 +1,20 @@ +The Glasgow Haskell Compiler is a state-of-the-art, open source, compiler and +interactive environment for the functional language Haskell. Highlights: + + * Supports the entire Haskell 2010 language plus a wide variety of + extensions. + * Has particularly good support for concurrency and parallelism, including + support for Software Transactional Memory (STM). + * Generates fast code, particularly for concurrent programs. + * Works on several platforms including FreeBSD, Windows, Mac, Linux, most + varieties of Unix, and several different processor architectures. + * Has extensive optimisation capabilities, including inter-module optimisation. + * Compiles Haskell code either directly to native code or using LLVM as a + back-end. It can also generate C code as an intermediate target for porting + to new platforms. The interactive environment compiles Haskell to bytecode, + and supports execution of mixed bytecode/compiled programs. + * Profiling is supported, both by time/allocation and various kinds of heap + profiling. + * Comes with several libraries, and thousands more are available on Hackage. + +WWW: http://www.haskell.org/ghc/