diff options
author | pho <pho@pkgsrc.org> | 2015-02-04 06:53:18 +0000 |
---|---|---|
committer | pho <pho@pkgsrc.org> | 2015-02-04 06:53:18 +0000 |
commit | 9799b2c5289c05f693d35ce4a81331638d42254a (patch) | |
tree | d22ce1d7e919758e808bdf354403a13646d06720 /lang/ghc7 | |
parent | 458a1843484671d62bd360733a9af607140fd39c (diff) | |
download | pkgsrc-9799b2c5289c05f693d35ce4a81331638d42254a.tar.gz |
lang/ghc7 no longer requires ${PREFIX}/lib to be put into /etc/ld-elf.so.conf
The installed GHC has already been working without the ld hack. These
changes should only affect the package build so revbump isn't needed.
Makefile (CONFIGURE_ENV):
Refactored with no semantic changes.
Makefile (post-patch):
${WRKSRC}/libraries/base/configure.ac is patched too.
Makefile (CHECK_SHLIBS_SUPPORTED):
Removed the variable as the package now supports it.
Makefile (CHECK_SHLIBS_SKIP):
Added to skip checks for dynamic Haskell libraries. See the comment
for details.
bootstrap.mk (pre-configure):
Use ${CONFIGURE_ENV} when configuring the stage-0 compiler. See the
comment for details.
patches/patch-libraries_base_configure.ac:
Added to prevent {CPP,LD}FLAGS from being clobbered. See the comment
for details. I will send the patch to the upstream in a few days or
weeks (or even months, depending on my busyness).
Diffstat (limited to 'lang/ghc7')
-rw-r--r-- | lang/ghc7/Makefile | 52 | ||||
-rw-r--r-- | lang/ghc7/bootstrap.mk | 10 | ||||
-rw-r--r-- | lang/ghc7/distinfo | 3 | ||||
-rw-r--r-- | lang/ghc7/patches/patch-libraries_base_configure.ac | 57 |
4 files changed, 98 insertions, 24 deletions
diff --git a/lang/ghc7/Makefile b/lang/ghc7/Makefile index ff0558a4caa..96169630e38 100644 --- a/lang/ghc7/Makefile +++ b/lang/ghc7/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.13 2015/02/03 02:32:05 pho Exp $ +# $NetBSD: Makefile,v 1.14 2015/02/04 06:53:18 pho Exp $ # ----------------------------------------------------------------------------- # Package metadata # @@ -45,6 +45,10 @@ DISTFILES= ${DEFAULT_DISTFILES} #DISTFILES+= ${BOOT_ARCHIVE} #.endif +.for i in ${DISTFILES:M*-boot-*} +SITES.${i}?= ${MASTER_SITE_LOCAL} +.endfor + WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} # We don't want to extract all of the DISTFILEs. @@ -56,7 +60,8 @@ EXTRACT_ONLY= ${DEFAULT_DISTFILES} # USE_TOOLS+= autoconf gmake perl:run GNU_CONFIGURE= yes -USE_GNU_CONFIGURE_HOST= no +USE_GNU_CONFIGURE_HOST= no +USE_LIBTOOL= yes CONFIGURE_ARGS+= \ --with-gcc=${CC:Q} \ @@ -66,18 +71,22 @@ CONFIGURE_ARGS+= \ --with-iconv-libraries=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_LIBDIRS.iconv:Q} CONFIGURE_ENV+= \ - CONF_CC_OPTS_STAGE0=${CFLAGS:Q} \ - CONF_GCC_LINKER_OPTS_STAGE0=${LDFLAGS:Q} \ - CONF_LD_LINKER_OPTS_STAGE0=${LDFLAGS:Q} \ - CONF_CC_OPTS_STAGE1=${CFLAGS:Q} \ - CONF_GCC_LINKER_OPTS_STAGE1=${LDFLAGS:Q} \ - CONF_LD_LINKER_OPTS_STAGE1=${LDFLAGS:Q} \ - CONF_CC_OPTS_STAGE2=${CFLAGS:Q} \ - CONF_GCC_LINKER_OPTS_STAGE2=${LDFLAGS:Q} \ - CONF_LD_LINKER_OPTS_STAGE2=${LDFLAGS:Q} \ ac_cv_path_fp_prog_ar=${AR:Q} \ PerlCmd=${PERL5:Q} +# CFLAGS and LDFLAGS are currently not honored by "./configure". Since +# LDFLAGS contains rpath flags it's very important to force GHC to +# honor it. Otherwise neither GHC itself nor executables it produces +# will have any rpaths so users will have to put "${PREFIX}/lib" into +# their "/etc/ld-elf.so.conf". See +# http://hackage.haskell.org/trac/ghc/ticket/2933 +.for stage in 0 1 2 +CONFIGURE_ENV+= \ + CONF_CC_OPTS_STAGE${stage}=${CFLAGS:Q} \ + CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:Q} \ + CONF_LD_LINKER_OPTS_STAGE${stage}=${LDFLAGS:Q} +.endfor + # ----------------------------------------------------------------------------- # Build hooks @@ -86,21 +95,19 @@ CONFIGURE_ENV+= \ # We patch configure.ac in some directories. post-patch: @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" + ${RUN} cd ${WRKSRC:Q}/libraries/base && autoconf ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf # Define the target "pre-configure" and non-standard "bootstrap". .include "../../lang/ghc7/bootstrap.mk" -.for i in ${DISTFILES:M*-boot-*} -SITES.${i}?= ${MASTER_SITE_LOCAL} -.endfor - # Our pre-configure phase installs a bindist of bootstrapping compiler # directly into TOOLS_DIR so that ./configure can find it. -post-configure: + # Here we generate mk/build.mk dynamically. +post-configure: ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk # We need to tell the libraries/terminfo/configure that our ncurses is @@ -173,10 +180,15 @@ GENERATE_PLIST+= \ # There is an unused script which don't pass the portability test. CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw -# GHC currently *requires* ${PREFIX}/lib to be in -# "/etc/ld-elf.so.conf". See -# http://hackage.haskell.org/trac/ghc/ticket/2933 -CHECK_SHLIBS_SUPPORTED= no +# Dynamic Haskell libraries currently have no rpaths to any dependent +# Haskell libraries so we must skip shlibs check for them. Note that +# the situation seems to be changed in GHC 7.8.1 so we should +# readdress this later. See +# https://ghc.haskell.org/trac/ghc/ticket/8266 (slightly off-topic but +# pho@ found no description for the -fuse-rpath flag.) +.if !empty(PKGNAME:Mghc-7.6.*) +CHECK_SHLIBS_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* +.endif # ----------------------------------------------------------------------------- diff --git a/lang/ghc7/bootstrap.mk b/lang/ghc7/bootstrap.mk index e1a8ce32349..4fac52410b5 100644 --- a/lang/ghc7/bootstrap.mk +++ b/lang/ghc7/bootstrap.mk @@ -1,4 +1,4 @@ -# $NetBSD: bootstrap.mk,v 1.12 2015/02/03 02:32:05 pho Exp $ +# $NetBSD: bootstrap.mk,v 1.13 2015/02/04 06:53:18 pho Exp $ # ----------------------------------------------------------------------------- # Select a bindist of bootstrapping compiler based on a per-platform # basis. @@ -18,7 +18,7 @@ BOOT_ARCHIVE:= ${PKGNAME}-boot-i386-unknown-freebsd.tar.xz BOOT_ARCHIVE:= ${PKGNAME}-boot-i386-unknown-netbsd.tar.xz .elif ${MACHINE_ARCH} == "powerpc" && ${OPSYS} == "Darwin" -BOOT_ARCHIVE:= ${PKGNAME_NOREV}-boot-powerpc-apple-darwin.tar.xz +BOOT_ARCHIVE:= ${PKGNAME}-boot-powerpc-apple-darwin.tar.xz # Existence of libelf makes LeadingUnderscore being "NO", which is # incorrect for this platform. See ${WRKSRC}/aclocal.m4 # (FP_LEADING_UNDERSCORE) @@ -59,14 +59,18 @@ USE_TOOLS+= gmake xzcat xz pre-configure: @${TEST} -f ${DISTDIR:Q}/${DIST_SUBDIR:Q}/${BOOT_ARCHIVE} || \ ${FAIL_MSG} "Put your trusted bootstrap archive as ${DISTDIR}/${DIST_SUBDIR}/${BOOT_ARCHIVE}" + @${PHASE_MSG} "Extracting bootstrapping compiler for ${PKGNAME}" ${RUN} ${MKDIR} ${WRKDIR:Q}/build-extract ${RUN} cd ${WRKDIR:Q}/build-extract && \ ${EXTRACT_CMD_DEFAULT} ${DISTDIR:Q}/${DIST_SUBDIR:Q}/${BOOT_ARCHIVE} +# It is important to install the stage-0 compiler with our rpath flags +# configured, otherwise it will produce executables with no rpath and +# fail in the configure phase. @${PHASE_MSG} "Preparing bootstrapping compiler for ${PKGNAME}" ${RUN} cd ${WRKDIR:Q}/build-extract/${PKGNAME_NOREV}-boot && \ - ${SH} ./configure \ + ${PKGSRC_SETENV} ${CONFIGURE_ENV} ${SH} ./configure \ --prefix=${TOOLS_DIR:Q} && \ ${MAKE_PROGRAM} install diff --git a/lang/ghc7/distinfo b/lang/ghc7/distinfo index a27ffa0aa9f..2b0e90703b5 100644 --- a/lang/ghc7/distinfo +++ b/lang/ghc7/distinfo @@ -1,10 +1,11 @@ -$NetBSD: distinfo,v 1.4 2014/05/24 04:49:40 obache Exp $ +$NetBSD: distinfo,v 1.5 2015/02/04 06:53:18 pho Exp $ SHA1 (ghc-7.6.3-src.tar.bz2) = 8938e1ef08b37a4caa071fa169e79a3001d065ff RMD160 (ghc-7.6.3-src.tar.bz2) = 82a673ed38b7cf9a59afeb01057625fc761a822b Size (ghc-7.6.3-src.tar.bz2) = 110763823 bytes SHA1 (patch-Makefile) = a6692a4a90b8003a8719c51d82d15f5af0ba1907 SHA1 (patch-ghc.mk) = c4210aaa3e2b4a319b0b70da375ac89fddde5cb7 +SHA1 (patch-libraries_base_configure.ac) = 4f160844cf0e0fe6c5825b9a0ad8287d6eaaecc1 SHA1 (patch-libraries_integer-gmp_configure.ac) = bc5ce3a6c39d681c413eb08b66e7287e39406fe0 SHA1 (patch-libraries_integer-simple_GHC_Integer.hs) = f079285bc489c194959b9bee2aa5c977ec77ae1e SHA1 (patch-libraries_integer-simple_GHC_Integer_Type.hs) = b3140e169726f78f6d3b4edcd4cc119b6f767bfa diff --git a/lang/ghc7/patches/patch-libraries_base_configure.ac b/lang/ghc7/patches/patch-libraries_base_configure.ac new file mode 100644 index 00000000000..5a42d47c598 --- /dev/null +++ b/lang/ghc7/patches/patch-libraries_base_configure.ac @@ -0,0 +1,57 @@ +$NetBSD: patch-libraries_base_configure.ac,v 1.1 2015/02/04 06:53:18 pho Exp $ + +Do not clobber CPPFLAGS nor LDFLAGS: + +When we are using pkgsrc converters/libiconv, we have libiconv.so in +${PREFIX}/lib and "-Wl,-R${PREFIX}/lib" in LDFLAGS. In this case +FP_SEARCH_LIBS_PROTO(iconv) appends "-liconv" to $LIBS so it will be +linked to any conftest executables that follow, including one which +will be generated by AC_CHECK_SIZEOF(). + +The problem that if libraries listed in $LIBS are in a non-standard +path while rpath flags are missing (due to LDFLAGS being clobbered in +this case), conftest executables cannot run even if they can be +linked. And if anything goes wrong during AC_CHECK_SIZEOF(T), it +considers sizeof(T) as 0 unless T is known to be an existing type. + + ... + checking for library containing iconv... -liconv + checking for library containing locale_charset... none required + checking size of struct MD5Context... 0 + ... + +This means SIZEOF_STRUCT_MD5CONTEXT is defined to 0, +GHC.Fingerprint.fingerprintData allocates 0 bytes on the heap, +MD5Init/Update/Final corrupts the heap and then Bad Things will +happen. + +--- libraries/base/configure.ac.orig 2013-04-18 21:30:14.000000000 +0000 ++++ libraries/base/configure.ac +@@ -70,13 +70,13 @@ dnl------------------------------------- + AC_ARG_WITH([iconv-includes], + [AC_HELP_STRING([--with-iconv-includes], + [directory containing iconv.h])], +- [ICONV_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval"], ++ [ICONV_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval $CPPFLAGS"], + [ICONV_INCLUDE_DIRS=]) + + AC_ARG_WITH([iconv-libraries], + [AC_HELP_STRING([--with-iconv-libraries], + [directory containing iconv library])], +- [ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval"], ++ [ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval $LDFLAGS"], + [ICONV_LIB_DIRS=]) + + AC_SUBST(ICONV_INCLUDE_DIRS) +@@ -183,7 +183,10 @@ fi + + # Hack - md5.h needs HsFFI.h. Is there a better way to do this? + CFLAGS="-I../../includes $CFLAGS" +-AC_CHECK_SIZEOF([struct MD5Context], ,[#include "include/md5.h"]) ++dnl Calling AC_CHECK_TYPE(T) makes AC_CHECK_SIZEOF(T) abort on failure ++dnl instead of considering sizeof(T) as 0. ++AC_CHECK_TYPE([struct MD5Context], [], [], [#include "include/md5.h"]) ++AC_CHECK_SIZEOF([struct MD5Context], [], [#include "include/md5.h"]) + + AC_SUBST(EXTRA_LIBS) + AC_CONFIG_FILES([base.buildinfo]) |