/[gentoo-x86]/dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild
Gentoo

Contents of /dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (hide annotations) (download)
Thu Dec 13 15:59:54 2007 UTC (5 years, 5 months ago) by dcoutts
Branch: MAIN
Changes since 1.16: +1 -3 lines
Stop providing virtual/ghc. Nothing in portage has depended on it for some time.
(Portage version: 2.1.3.19)

1 kolmodin 1.14 # Copyright 1999-2007 Gentoo Foundation
2 dcoutts 1.1 # Distributed under the terms of the GNU General Public License v2
3 dcoutts 1.17 # $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc-bin/ghc-bin-6.4.2.ebuild,v 1.16 2007/07/10 16:07:00 dcoutts Exp $
4 dcoutts 1.1
5 cparrott 1.3 # Note to users of hardened gcc-3.x:
6     #
7     # If you emerge ghc-bin with hardened gcc it should work fine (because
8     # we turn off the hardened features that would otherwise break ghc).
9     # However, emerging ghc-bin while using a vanilla gcc and then switching
10     # to hardened gcc (using gcc-config) will leave you with a broken ghc. To
11     # fix it you would need to either switch back to vanilla gcc or re-emerge
12     # ghc-bin (or ghc). Note that also if you are using hardened gcc-3.x and
13     # you switch to gcc-4.x that this will also break ghc and you'll need to
14     # re-emerge ghc-bin (or ghc). People using vanilla gcc can switch between
15     # gcc-3.x and 4.x with no problems.
16    
17 dcoutts 1.2 inherit base multilib flag-o-matic toolchain-funcs ghc-package
18 dcoutts 1.1
19     DESCRIPTION="Glasgow Haskell Compiler"
20     HOMEPAGE="http://www.haskell.org/ghc/"
21     # list all arches for proper digest building:
22 cparrott 1.6 SRC_URI="alpha? ( mirror://gentoo/${P}-alpha.tbz2 )
23 kolmodin 1.14 amd64? ( mirror://gentoo/${P}-amd64.tbz2 )
24 gustavoz 1.12 hppa? ( mirror://gentoo/${P}-hppa.tbz2 )
25 dcoutts 1.16 ia64? ( mirror://gentoo/${P}-ia64.tbz2 )
26 cparrott 1.5 ppc? ( mirror://gentoo/${P}-ppc.tbz2 )
27     ppc64? ( mirror://gentoo/${P}-ppc64.tbz2 )
28 dcoutts 1.4 sparc? ( mirror://gentoo/${P}-sparc.tbz2 )
29     x86? ( mirror://gentoo/${P}-x86.tbz2 )
30     x86-fbsd? ( mirror://gentoo/${P}-x86-fbsd.tbz2 )"
31 dcoutts 1.1
32     LICENSE="as-is"
33 dcoutts 1.16 KEYWORDS="-* ~alpha amd64 hppa ~ia64 ppc ppc64 sparc x86 ~x86-fbsd"
34 dcoutts 1.1 SLOT="0"
35     IUSE="" # use the non-binary version if you want to have more choice
36    
37 peper 1.15 RESTRICT="strip" # already stripped
38 dcoutts 1.1
39     LOC="/opt/ghc"
40    
41     DEPEND=""
42     RDEPEND=">=dev-lang/perl-5.6.1
43     >=sys-devel/gcc-2.95.3
44     >=dev-libs/gmp-4.1
45     =sys-libs/readline-5*"
46    
47     S="${WORKDIR}"
48    
49 dcoutts 1.2 append-ghc-cflags() {
50     local flag compile assemble link
51     for flag in $*; do
52     case ${flag} in
53     compile) compile="yes";;
54     assemble) assemble="yes";;
55     link) link="yes";;
56     *)
57     [[ ${compile} ]] && GHC_CFLAGS="${GHC_CFLAGS} -optc${flag}"
58     [[ ${assemble} ]] && GHC_CFLAGS="${GHC_CFLAGS} -opta${flag}"
59     [[ ${link} ]] && GHC_CFLAGS="${GHC_CFLAGS} -optl${flag}";;
60     esac
61     done
62     }
63    
64     ghc_setup_cflags() {
65     # We need to be very careful with the CFLAGS we ask ghc to pass through to
66     # gcc. There are plenty of flags which will make gcc produce output that
67     # breaks ghc in various ways. The main ones we want to pass through are
68     # -mcpu / -march flags. These are important for arches like alpha & sparc.
69     # We also use these CFLAGS for building the C parts of ghc, ie the rts.
70     strip-flags
71     strip-unsupported-flags
72     filter-flags -fPIC
73    
74     GHC_CFLAGS=""
75     for flag in ${CFLAGS}; do
76     case ${flag} in
77    
78     # Ignore extra optimisation (ghc passes -O to gcc anyway)
79     # -O2 and above break on too many systems
80     -O*) ;;
81    
82     # Arch and ABI flags are what we're really after
83     -m*) append-ghc-cflags compile assemble ${flag};;
84    
85     # Debugging flags don't help either. You can't debug Haskell code
86     # at the C source level and the mangler discards the debug info.
87     -g*) ;;
88    
89     # Ignore all other flags, including all -f* flags
90     esac
91     done
92    
93     # hardened-gcc needs to be disabled, because the mangler doesn't accept
94     # its output.
95     gcc-specs-pie && append-ghc-cflags compile link -nopie
96     gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector
97    
98     # We also add -Wa,--noexecstack to get ghc to generate .o files with
99     # non-exectable stack. This it a hack until ghc does it itself properly.
100     append-ghc-cflags assemble "-Wa,--noexecstack"
101     }
102    
103     ghc_setup_wrapper() {
104     echo '#!/bin/bash'
105     echo "GHCBIN=\"${LOC}/$(get_libdir)/ghc-$1/ghc-$1\";"
106     echo "TOPDIROPT=\"-B${LOC}/$(get_libdir)/ghc-$1\";"
107     echo "GHC_CFLAGS=\"${GHC_CFLAGS}\";"
108     echo '# Mini-driver for GHC'
109     echo 'exec $GHCBIN $TOPDIROPT $GHC_CFLAGS ${1+"$@"}'
110     }
111    
112 dcoutts 1.1 src_unpack() {
113     base_src_unpack
114    
115 dcoutts 1.2 # Setup the ghc wrapper script
116     ghc_setup_cflags
117     ghc_setup_wrapper ${PV} > "${S}/usr/bin/ghc-${PV}"
118    
119     # Relocate from /usr to /opt/ghc
120 dcoutts 1.1 sed -i -e "s|/usr|${LOC}|g" \
121 dcoutts 1.2 "${S}/usr/bin/ghci-${PV}" \
122     "${S}/usr/bin/ghc-pkg-${PV}" \
123     "${S}/usr/bin/hsc2hs" \
124     "${S}/usr/$(get_libdir)/ghc-${PV}/package.conf"
125 dcoutts 1.1
126     sed -i -e "s|/usr/$(get_libdir)|${LOC}/$(get_libdir)|" \
127 dcoutts 1.2 "${S}/usr/bin/ghcprof"
128 dcoutts 1.1 }
129    
130     src_compile() {
131 dcoutts 1.2 true
132 dcoutts 1.1 }
133    
134     src_install () {
135 dcoutts 1.2 mkdir "${D}/opt"
136     mv "${S}/usr" "${D}/opt/ghc"
137 dcoutts 1.1
138 kolmodin 1.14 doenvd "${FILESDIR}/10ghc"
139 dcoutts 1.1 }
140    
141     pkg_postinst () {
142     ghc-reregister
143     ewarn "IMPORTANT:"
144     ewarn "If you have upgraded from another version of ghc-bin or"
145     ewarn "if you have switched from ghc to ghc-bin, please run:"
146     ewarn " /opt/ghc/sbin/ghc-updater"
147     ewarn "to re-merge all ghc-based Haskell libraries."
148     }

  ViewVC Help
Powered by ViewVC 1.1.13