9 |
: ${HOMEPAGE="http://hackage.haskell.org/package/${PNAME/#haskell-/}"} |
: ${HOMEPAGE="http://hackage.haskell.org/package/${PNAME/#haskell-/}"} |
10 |
|
|
11 |
# some sane default dependencies |
# some sane default dependencies |
12 |
DEPEND="${DEPEND} |
SDEPEND="${SDEPEND} |
13 |
>= dev-lang/ghc-6.12" |
>= dev-lang/ghc-6.12" |
14 |
|
|
15 |
# default SRCFILE SRCDIR and SRC_URI |
# default SRCFILE SRCDIR and SRC_URI |
16 |
: ${SRCFILE="${PNAME/#haskell-/}-${PVER}.tar.gz"} |
: ${SRCFILE="${PNAME/#haskell-/}-${PVER}.tar.gz"} |
17 |
: ${SRCDIR="${BUILDDIR}/${PNAME/#haskell-/}-${PVER}"} |
: ${SRCDIR="${BUILDDIR}/${PNAME/#haskell-/}-${PVER}"} |
18 |
: ${SRC_URI=( "http://hackage.haskell.org/packages/archive/${PNAME/#haskell-/}/${PVER}/${SRCFILE}" "mirror://${PNAME}/${SRCFILE}" )} |
SRC_URI=( |
19 |
|
${SRC_URI[*]} |
20 |
|
http://hackage.haskell.org/packages/archive/${PNAME/#haskell-/}/${PVER}/${SRCFILE} |
21 |
|
mirror://${PNAME}/${SRCFILE} |
22 |
|
) |
23 |
|
|
24 |
|
# possible features which are supported atm |
25 |
|
HASKELL_POSSIBLE_FEATURES="split-objs shared register haddock" |
26 |
|
# default haskell features |
27 |
|
HASKELL_FEATURES="split-objs shared register" |
28 |
|
|
29 |
HASKELL_PNAME="${PNAME}" |
HASKELL_PNAME="${PNAME}" |
30 |
SPECIAL_VARS="HASKELL_PNAME" |
SPECIAL_VARS="${SPECIAL_VARS} HASKELL_PNAME" |
31 |
|
SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} haskell_preinstall haskell_postinstall haskell_preremove haskell_postremove" |
32 |
|
|
33 |
|
haskell_feature() |
34 |
|
{ |
35 |
|
local search="$1" |
36 |
|
local feature |
37 |
|
for feature in ${HASKELL_FEATURES} |
38 |
|
do |
39 |
|
# feature was found |
40 |
|
[[ ${search} = ${feature} ]] && return 0 |
41 |
|
done |
42 |
|
|
43 |
|
# feature was *not* found |
44 |
|
return 1 |
45 |
|
} |
46 |
|
|
47 |
|
haskell_feature_is_supported() |
48 |
|
{ |
49 |
|
local search="$1" |
50 |
|
local feature |
51 |
|
for feature in ${HASKELL_POSSIBLE_FEATURES} |
52 |
|
do |
53 |
|
# feature was found |
54 |
|
[[ ${search} = ${feature} ]] && return 0 |
55 |
|
done |
56 |
|
|
57 |
|
# feature was *not* found |
58 |
|
return 1 |
59 |
|
} |
60 |
|
|
61 |
|
haskell_disable_feature() |
62 |
|
{ |
63 |
|
local feature="$1" |
64 |
|
haskell_feature_is_supported || die "haskell feature '${feature}' not supported!" |
65 |
|
export HASKELL_FEATURES="${HASKELL_FEATURES/${feature}/}" |
66 |
|
} |
67 |
|
|
68 |
|
haskell_enable_feature() |
69 |
|
{ |
70 |
|
local feature="$1" |
71 |
|
haskell_feature_is_supported || die "haskell feature '${feature}' not supported!" |
72 |
|
export HASKELL_FEATURES+=" ${feature}" |
73 |
|
} |
74 |
|
|
75 |
haskell_ghc_version() |
haskell_ghc_version() |
76 |
{ |
{ |
114 |
{ |
{ |
115 |
local configure_opts="$@" |
local configure_opts="$@" |
116 |
|
|
117 |
|
haskell_feature split-objs && configure_opts+=" --enable-split-objs" |
118 |
|
haskell_feature shared && configure_opts+=" --enable-shared" |
119 |
|
|
120 |
runhaskell $(haskell_ghc_setup_script) configure \ |
runhaskell $(haskell_ghc_setup_script) configure \ |
121 |
--ghc \ |
--ghc \ |
122 |
--prefix=/usr \ |
--prefix=/usr \ |
138 |
haskell_src_install() |
haskell_src_install() |
139 |
{ |
{ |
140 |
cd ${SRCDIR} |
cd ${SRCDIR} |
|
|
|
141 |
runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die |
runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die |
142 |
|
|
143 |
|
# create register scripts |
144 |
|
haskell_feature register && haskell_install_register || die |
145 |
|
|
146 |
# install docs |
# install docs |
147 |
local i |
local i |
148 |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
182 |
# fi |
# fi |
183 |
# } |
# } |
184 |
|
|
185 |
export_inherits haskell src_prepare src_compile src_install preinstall postinstall #preremove |
# to be on the safe side, fix all broken packages afer a package remove |
186 |
|
haskell_postremove() |
187 |
|
{ |
188 |
|
if [[ -x $(which ghc-pkg) ]] |
189 |
|
then |
190 |
|
local broken="$(ghc-pkg check --simple-output)" |
191 |
|
if [[ ! -z ${broken} ]] |
192 |
|
then |
193 |
|
echo "fixing broken haskell modules:" |
194 |
|
local pkg |
195 |
|
for pkg in ${broken} |
196 |
|
do |
197 |
|
echo " unregister ${pkg} ..." |
198 |
|
ghc-pkg unregister ${pkg} |
199 |
|
done |
200 |
|
fi |
201 |
|
fi |
202 |
|
} |
203 |
|
|
204 |
|
export_inherits haskell src_prepare src_compile src_install preinstall postinstall postremove #preremove |