diff options
author | Duncan Coutts <dcoutts@gentoo.org> | 2006-05-18 20:44:34 +0000 |
---|---|---|
committer | Duncan Coutts <dcoutts@gentoo.org> | 2006-05-18 20:44:34 +0000 |
commit | 8a3083ae854d02fdaae2f7955b1c8dc640bf0d82 (patch) | |
tree | df65925c4917f3fc401659b66b69494430c8b951 /dev-lang/ghc-bin | |
parent | Support gcc-4.x better at the expense of hardened gcc-3.x. (diff) | |
download | historical-8a3083ae854d02fdaae2f7955b1c8dc640bf0d82.tar.gz historical-8a3083ae854d02fdaae2f7955b1c8dc640bf0d82.tar.bz2 historical-8a3083ae854d02fdaae2f7955b1c8dc640bf0d82.zip |
Generate a ghc wrapper script with the correct GHC_CFLAGS at install time.
Package-Manager: portage-2.1_pre10-r5
Diffstat (limited to 'dev-lang/ghc-bin')
-rw-r--r-- | dev-lang/ghc-bin/ChangeLog | 8 | ||||
-rw-r--r-- | dev-lang/ghc-bin/files/digest-ghc-bin-6.4.1-r1 | 21 | ||||
-rw-r--r-- | dev-lang/ghc-bin/ghc-bin-6.4.1-r1.ebuild | 103 | ||||
-rw-r--r-- | dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild | 89 |
4 files changed, 196 insertions, 25 deletions
diff --git a/dev-lang/ghc-bin/ChangeLog b/dev-lang/ghc-bin/ChangeLog index 95d026ce2eae..c64201299a8d 100644 --- a/dev-lang/ghc-bin/ChangeLog +++ b/dev-lang/ghc-bin/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-lang/ghc-bin # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc-bin/ChangeLog,v 1.49 2006/05/03 22:38:28 dcoutts Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc-bin/ChangeLog,v 1.50 2006/05/18 20:44:34 dcoutts Exp $ + + 18 May 2006; Duncan Coutts <dcoutts@gentoo.org> ghc-bin-6.4.1-r1.ebuild, + ghc-bin-6.4.2.ebuild: + Generate a ghc wrapper script with the correct GHC_CFLAGS at install time. + Tidy up the unpack/compile/install phases. Add all the arches that are in + the KEYWORDS in 6.4.1 to the KEYWORDS in 6.4.1-r1. *ghc-bin-6.4.2 (03 May 2006) diff --git a/dev-lang/ghc-bin/files/digest-ghc-bin-6.4.1-r1 b/dev-lang/ghc-bin/files/digest-ghc-bin-6.4.1-r1 index 118371c217ba..ef6fef872780 100644 --- a/dev-lang/ghc-bin/files/digest-ghc-bin-6.4.1-r1 +++ b/dev-lang/ghc-bin/files/digest-ghc-bin-6.4.1-r1 @@ -1,3 +1,24 @@ +MD5 1d0a0e281fd057d1332d4268da49801a ghc-bin-6.4.1-alpha.tbz2 37043978 +RMD160 35b5de80cf635f1cdcda40d8e2a03306f255fdc3 ghc-bin-6.4.1-alpha.tbz2 37043978 +SHA256 6d025031c34c8fb95265f39e373853468c8d7597b06f4af086c1d01b4bcb527e ghc-bin-6.4.1-alpha.tbz2 37043978 +MD5 d7f170508b4c7b5cd40b0d5e92685c1e ghc-bin-6.4.1-amd64.tbz2 17639473 +RMD160 8853c7314b8bf55018c26b5bdda7791347bed7ef ghc-bin-6.4.1-amd64.tbz2 17639473 +SHA256 3204824f51b8a0aa9b91dea58f702f905ba0e77a6d8706bb8e3396e4931bfe17 ghc-bin-6.4.1-amd64.tbz2 17639473 +MD5 75948584ec38b46f2168d869bd860d6e ghc-bin-6.4.1-hppa.tbz2 34152913 +RMD160 3494b88e591ac0ed6d24382d3e57fff56aac4037 ghc-bin-6.4.1-hppa.tbz2 34152913 +SHA256 f55ac99d5075638727995b2c7bc1063f625022917ee9dcb545cfdfd41e5ddd65 ghc-bin-6.4.1-hppa.tbz2 34152913 MD5 94d4673ccbac4bf449ed1c448260136f ghc-bin-6.4.1-ia64.tbz2 40220699 RMD160 683e4f56c2a3244947a8658680209aa0ffef90d0 ghc-bin-6.4.1-ia64.tbz2 40220699 SHA256 c37f32930cfe594b940ca24b85ced1cd5057c801b67666e12b2e38173220b873 ghc-bin-6.4.1-ia64.tbz2 40220699 +MD5 1b54055eaf0c4916da963481fa8b43e7 ghc-bin-6.4.1-ppc.tbz2 25575569 +RMD160 efabde19967193323ed11894930e46554affe14f ghc-bin-6.4.1-ppc.tbz2 25575569 +SHA256 6b212f71d5e466d609c66380b76bd3efdb6bf3bfb13fd781ecea3b5757694787 ghc-bin-6.4.1-ppc.tbz2 25575569 +MD5 1be59597f2a984fd3f69f9e3d076602f ghc-bin-6.4.1-ppc64.tbz2 28245351 +RMD160 45b0498ae5baa5691bed0f78d8d8a32ee25439b9 ghc-bin-6.4.1-ppc64.tbz2 28245351 +SHA256 9421ac68ac5af55da9fb06866bb5afb3ce61bf74aeeb1896f79077bb1dba8e45 ghc-bin-6.4.1-ppc64.tbz2 28245351 +MD5 cd0f80c503e5b4c956d7725c3764718e ghc-bin-6.4.1-sparc.tbz2 31121002 +RMD160 2eeb3b4d8af76978d46daf44831e44ed3b4f5d8a ghc-bin-6.4.1-sparc.tbz2 31121002 +SHA256 36c0f660c5178ae91e8b40fdd8213a52238264217db59c0c4f9ff3dc0179d5e7 ghc-bin-6.4.1-sparc.tbz2 31121002 +MD5 a8c95e84f15acf1cf741a50a773eb626 ghc-bin-6.4.1-x86.tbz2 23234832 +RMD160 9e6ac0880f1d0e38039e7715d7efac81f74496c7 ghc-bin-6.4.1-x86.tbz2 23234832 +SHA256 edaea7c4d2f5da7ce9c4a57c9869af133ca72f25d89f899f26a3dedf82c64d98 ghc-bin-6.4.1-x86.tbz2 23234832 diff --git a/dev-lang/ghc-bin/ghc-bin-6.4.1-r1.ebuild b/dev-lang/ghc-bin/ghc-bin-6.4.1-r1.ebuild index 9e4db447fe88..3ff3227b4dd3 100644 --- a/dev-lang/ghc-bin/ghc-bin-6.4.1-r1.ebuild +++ b/dev-lang/ghc-bin/ghc-bin-6.4.1-r1.ebuild @@ -1,16 +1,23 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc-bin/ghc-bin-6.4.1-r1.ebuild,v 1.1 2006/03/26 23:01:55 dcoutts Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc-bin/ghc-bin-6.4.1-r1.ebuild,v 1.2 2006/05/18 20:44:34 dcoutts Exp $ -inherit base multilib ghc-package +inherit base multilib flag-o-matic toolchain-funcs ghc-package DESCRIPTION="Glasgow Haskell Compiler" HOMEPAGE="http://www.haskell.org/ghc/" # list all arches for proper digest building: -SRC_URI="ia64? ( mirror://gentoo/${P}-ia64.tbz2 )" +SRC_URI="alpha? ( mirror://gentoo/${P}-alpha.tbz2 ) + amd64? ( mirror://gentoo/${P}-amd64.tbz2 ) + hppa? ( mirror://gentoo/${P}-hppa.tbz2 ) + ia64? ( mirror://gentoo/${P}-ia64.tbz2 ) + ppc? ( mirror://gentoo/${P}-ppc.tbz2 ) + ppc64? ( mirror://gentoo/${P}-ppc64.tbz2 ) + sparc? ( mirror://gentoo/${P}-sparc.tbz2 ) + x86? ( mirror://gentoo/${P}-x86.tbz2 )" LICENSE="as-is" -KEYWORDS="-* ~ia64" +KEYWORDS="-* ~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" SLOT="0" IUSE="" # use the non-binary version if you want to have more choice @@ -28,27 +35,97 @@ PROVIDE="virtual/ghc" S="${WORKDIR}" +append-ghc-cflags() { + local flag compile assemble link + for flag in $*; do + case ${flag} in + compile) compile="yes";; + assemble) assemble="yes";; + link) link="yes";; + *) + [[ ${compile} ]] && GHC_CFLAGS="${GHC_CFLAGS} -optc${flag}" + [[ ${assemble} ]] && GHC_CFLAGS="${GHC_CFLAGS} -opta${flag}" + [[ ${link} ]] && GHC_CFLAGS="${GHC_CFLAGS} -optl${flag}";; + esac + done +} + +ghc_setup_cflags() { + # We need to be very careful with the CFLAGS we ask ghc to pass through to + # gcc. There are plenty of flags which will make gcc produce output that + # breaks ghc in various ways. The main ones we want to pass through are + # -mcpu / -march flags. These are important for arches like alpha & sparc. + # We also use these CFLAGS for building the C parts of ghc, ie the rts. + strip-flags + strip-unsupported-flags + filter-flags -fPIC + + GHC_CFLAGS="" + for flag in ${CFLAGS}; do + case ${flag} in + + # Ignore extra optimisation (ghc passes -O to gcc anyway) + # -O2 and above break on too many systems + -O*) ;; + + # Arch and ABI flags are what we're really after + -m*) append-ghc-cflags compile assemble ${flag};; + + # Debugging flags don't help either. You can't debug Haskell code + # at the C source level and the mangler discards the debug info. + -g*) ;; + + # Ignore all other flags, including all -f* flags + esac + done + + # hardened-gcc needs to be disabled, because the mangler doesn't accept + # its output. + gcc-specs-pie && append-ghc-cflags compile link -nopie + gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector + + # We also add -Wa,--noexecstack to get ghc to generate .o files with + # non-exectable stack. This it a hack until ghc does it itself properly. + append-ghc-cflags assemble "-Wa,--noexecstack" +} + +ghc_setup_wrapper() { + echo '#!/bin/bash' + echo "GHCBIN=\"${LOC}/$(get_libdir)/ghc-$1/ghc-$1\";" + echo "TOPDIROPT=\"-B${LOC}/$(get_libdir)/ghc-$1\";" + echo "GHC_CFLAGS=\"${GHC_CFLAGS}\";" + echo '# Mini-driver for GHC' + echo 'exec $GHCBIN $TOPDIROPT $GHC_CFLAGS ${1+"$@"}' +} + src_unpack() { base_src_unpack - cd "${S}" - # relocate from /usr to /opt/ghc + # Setup the ghc wrapper script + ghc_setup_cflags + ghc_setup_wrapper ${PV} > "${S}/usr/bin/ghc-${PV}" + + # Relocate from /usr to /opt/ghc sed -i -e "s|/usr|${LOC}|g" \ - usr/bin/ghc-${PV} usr/bin/ghci-${PV} usr/bin/ghc-pkg-${PV} \ - usr/bin/hsc2hs usr/$(get_libdir)/ghc-${PV}/package.conf + "${S}/usr/bin/ghci-${PV}" \ + "${S}/usr/bin/ghc-pkg-${PV}" \ + "${S}/usr/bin/hsc2hs" \ + "${S}/usr/$(get_libdir)/ghc-${PV}/package.conf" sed -i -e "s|/usr/$(get_libdir)|${LOC}/$(get_libdir)|" \ - usr/bin/ghcprof + "${S}/usr/bin/ghcprof" + + # Fix to remove CFLAGS that were accidentally added to the ghci wrapper + sed -i -e '$s|-optc[a-z-]*||g' "${S}/usr/bin/ghci-${PV}" } src_compile() { - mkdir -p ./${LOC} - mv usr/* ./${LOC} - rmdir usr + true } src_install () { - mv * "${D}" + mkdir "${D}/opt" + mv "${S}/usr" "${D}/opt/ghc" insinto /etc/env.d doins "${FILESDIR}/10ghc" diff --git a/dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild b/dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild index 5c23e1627fc2..5b06e3b299d0 100644 --- a/dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild +++ b/dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild @@ -1,8 +1,8 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild,v 1.1 2006/05/03 22:38:28 dcoutts Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild,v 1.2 2006/05/18 20:44:34 dcoutts Exp $ -inherit base multilib ghc-package +inherit base multilib flag-o-matic toolchain-funcs ghc-package DESCRIPTION="Glasgow Haskell Compiler" HOMEPAGE="http://www.haskell.org/ghc/" @@ -28,27 +28,94 @@ PROVIDE="virtual/ghc" S="${WORKDIR}" +append-ghc-cflags() { + local flag compile assemble link + for flag in $*; do + case ${flag} in + compile) compile="yes";; + assemble) assemble="yes";; + link) link="yes";; + *) + [[ ${compile} ]] && GHC_CFLAGS="${GHC_CFLAGS} -optc${flag}" + [[ ${assemble} ]] && GHC_CFLAGS="${GHC_CFLAGS} -opta${flag}" + [[ ${link} ]] && GHC_CFLAGS="${GHC_CFLAGS} -optl${flag}";; + esac + done +} + +ghc_setup_cflags() { + # We need to be very careful with the CFLAGS we ask ghc to pass through to + # gcc. There are plenty of flags which will make gcc produce output that + # breaks ghc in various ways. The main ones we want to pass through are + # -mcpu / -march flags. These are important for arches like alpha & sparc. + # We also use these CFLAGS for building the C parts of ghc, ie the rts. + strip-flags + strip-unsupported-flags + filter-flags -fPIC + + GHC_CFLAGS="" + for flag in ${CFLAGS}; do + case ${flag} in + + # Ignore extra optimisation (ghc passes -O to gcc anyway) + # -O2 and above break on too many systems + -O*) ;; + + # Arch and ABI flags are what we're really after + -m*) append-ghc-cflags compile assemble ${flag};; + + # Debugging flags don't help either. You can't debug Haskell code + # at the C source level and the mangler discards the debug info. + -g*) ;; + + # Ignore all other flags, including all -f* flags + esac + done + + # hardened-gcc needs to be disabled, because the mangler doesn't accept + # its output. + gcc-specs-pie && append-ghc-cflags compile link -nopie + gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector + + # We also add -Wa,--noexecstack to get ghc to generate .o files with + # non-exectable stack. This it a hack until ghc does it itself properly. + append-ghc-cflags assemble "-Wa,--noexecstack" +} + +ghc_setup_wrapper() { + echo '#!/bin/bash' + echo "GHCBIN=\"${LOC}/$(get_libdir)/ghc-$1/ghc-$1\";" + echo "TOPDIROPT=\"-B${LOC}/$(get_libdir)/ghc-$1\";" + echo "GHC_CFLAGS=\"${GHC_CFLAGS}\";" + echo '# Mini-driver for GHC' + echo 'exec $GHCBIN $TOPDIROPT $GHC_CFLAGS ${1+"$@"}' +} + src_unpack() { base_src_unpack - cd "${S}" - # relocate from /usr to /opt/ghc + # Setup the ghc wrapper script + ghc_setup_cflags + ghc_setup_wrapper ${PV} > "${S}/usr/bin/ghc-${PV}" + + # Relocate from /usr to /opt/ghc sed -i -e "s|/usr|${LOC}|g" \ - usr/bin/ghc-${PV} usr/bin/ghci-${PV} usr/bin/ghc-pkg-${PV} \ - usr/bin/hsc2hs usr/$(get_libdir)/ghc-${PV}/package.conf + "${S}/usr/bin/ghci-${PV}" \ + "${S}/usr/bin/ghc-pkg-${PV}" \ + "${S}/usr/bin/hsc2hs" \ + "${S}/usr/$(get_libdir)/ghc-${PV}/package.conf" sed -i -e "s|/usr/$(get_libdir)|${LOC}/$(get_libdir)|" \ - usr/bin/ghcprof + "${S}/usr/bin/ghcprof" } src_compile() { - mkdir -p ./${LOC} - mv usr/* ./${LOC} - rmdir usr + true } src_install () { - mv * "${D}" + mkdir "${D}/opt" + mv "${S}/usr" "${D}/opt/ghc" insinto /etc/env.d doins "${FILESDIR}/10ghc" |