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} |
# all packages with haskell in the name needs ghc as runtime |
13 |
|
if [[ ${PNAME/#haskell-/} != ${PNAME} ]] |
14 |
|
then |
15 |
|
DEPEND="${DEPEND} |
16 |
|
>= dev-lang/ghc-6.12" |
17 |
|
fi |
18 |
|
# all other only as SDEPEND |
19 |
|
SDEPEND="${SDEPEND} |
20 |
>= dev-lang/ghc-6.12" |
>= dev-lang/ghc-6.12" |
21 |
|
|
22 |
# default SRCFILE SRCDIR and SRC_URI |
# default SRCFILE SRCDIR and SRC_URI |
23 |
: ${SRCFILE="${PNAME/#haskell-/}-${PVER}.tar.gz"} |
: ${SRCFILE="${PNAME/#haskell-/}-${PVER}.tar.gz"} |
24 |
: ${SRCDIR="${BUILDDIR}/${PNAME/#haskell-/}-${PVER}"} |
: ${SRCDIR="${BUILDDIR}/${PNAME/#haskell-/}-${PVER}"} |
25 |
: ${SRC_URI=( "http://hackage.haskell.org/packages/archive/${PNAME/#haskell-/}/${PVER}/${SRCFILE}" "mirror://${PNAME}/${SRCFILE}" )} |
SRC_URI=( |
26 |
|
${SRC_URI[*]} |
27 |
|
http://hackage.haskell.org/packages/archive/${PNAME/#haskell-/}/${PVER}/${SRCFILE} |
28 |
|
mirror://${PNAME}/${SRCFILE} |
29 |
|
) |
30 |
|
|
31 |
|
# possible features which are supported atm |
32 |
|
HASKELL_POSSIBLE_FEATURES="split-objs shared register haddock" |
33 |
|
# default haskell features |
34 |
|
HASKELL_FEATURES="split-objs shared register" |
35 |
|
|
36 |
HASKELL_PNAME="${PNAME}" |
HASKELL_PNAME="${PNAME}" |
37 |
SPECIAL_VARS="HASKELL_PNAME" |
SPECIAL_VARS="${SPECIAL_VARS} HASKELL_PNAME" |
38 |
|
SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} haskell_preinstall haskell_postinstall haskell_preremove haskell_postremove" |
39 |
|
|
40 |
|
haskell_feature() |
41 |
|
{ |
42 |
|
local search="$1" |
43 |
|
local feature |
44 |
|
for feature in ${HASKELL_FEATURES} |
45 |
|
do |
46 |
|
# feature was found |
47 |
|
[[ ${search} = ${feature} ]] && return 0 |
48 |
|
done |
49 |
|
|
50 |
|
# feature was *not* found |
51 |
|
return 1 |
52 |
|
} |
53 |
|
|
54 |
|
haskell_feature_is_supported() |
55 |
|
{ |
56 |
|
local search="$1" |
57 |
|
local feature |
58 |
|
for feature in ${HASKELL_POSSIBLE_FEATURES} |
59 |
|
do |
60 |
|
# feature was found |
61 |
|
[[ ${search} = ${feature} ]] && return 0 |
62 |
|
done |
63 |
|
|
64 |
|
# feature was *not* found |
65 |
|
return 1 |
66 |
|
} |
67 |
|
|
68 |
|
haskell_disable_feature() |
69 |
|
{ |
70 |
|
local feature="$1" |
71 |
|
haskell_feature_is_supported "${feature}" || die "haskell feature '${feature}' not supported!" |
72 |
|
echo -e "${COLBLUE}--- ${COLRED}disabled haskell feature '${feature}'${COLDEFAULT}" |
73 |
|
export HASKELL_FEATURES="${HASKELL_FEATURES/${feature}/}" |
74 |
|
} |
75 |
|
|
76 |
|
haskell_enable_feature() |
77 |
|
{ |
78 |
|
local feature="$1" |
79 |
|
haskell_feature_is_supported "${feature}" || die "haskell feature '${feature}' not supported!" |
80 |
|
echo -e "${COLBLUE}+++ ${COLGREEN}enabled haskell feature '${feature}'${COLDEFAULT}" |
81 |
|
export HASKELL_FEATURES+=" ${feature}" |
82 |
|
} |
83 |
|
|
84 |
haskell_ghc_version() |
haskell_ghc_version() |
85 |
{ |
{ |
123 |
{ |
{ |
124 |
local configure_opts="$@" |
local configure_opts="$@" |
125 |
|
|
126 |
|
haskell_feature split-objs && configure_opts+=" --enable-split-objs" |
127 |
|
haskell_feature shared && configure_opts+=" --enable-shared" |
128 |
|
|
129 |
runhaskell $(haskell_ghc_setup_script) configure \ |
runhaskell $(haskell_ghc_setup_script) configure \ |
130 |
--ghc \ |
--ghc \ |
131 |
--prefix=/usr \ |
--prefix=/usr \ |
137 |
|| die |
|| die |
138 |
} |
} |
139 |
|
|
140 |
|
haskell_src_build() |
141 |
|
{ |
142 |
|
runhaskell $(haskell_ghc_setup_script) build || die |
143 |
|
} |
144 |
|
|
145 |
haskell_src_compile() |
haskell_src_compile() |
146 |
{ |
{ |
147 |
cd ${SRCDIR} |
cd ${SRCDIR} |
148 |
haskell_src_configure || die |
haskell_src_configure || die |
149 |
runhaskell $(haskell_ghc_setup_script) build || die |
haskell_src_build || die |
150 |
} |
} |
151 |
|
|
152 |
haskell_src_install() |
haskell_src_install() |
153 |
{ |
{ |
154 |
cd ${SRCDIR} |
cd ${SRCDIR} |
|
|
|
155 |
runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die |
runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die |
156 |
|
|
157 |
|
# create register scripts |
158 |
|
if haskell_feature register |
159 |
|
then |
160 |
|
haskell_install_register || die |
161 |
|
fi |
162 |
|
|
163 |
# install docs |
# install docs |
164 |
local i |
local i |
165 |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
199 |
# fi |
# fi |
200 |
# } |
# } |
201 |
|
|
202 |
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 |
203 |
|
haskell_postremove() |
204 |
|
{ |
205 |
|
if [[ -x $(which ghc-pkg) ]] |
206 |
|
then |
207 |
|
local broken="$(ghc-pkg check --simple-output)" |
208 |
|
if [[ ! -z ${broken} ]] |
209 |
|
then |
210 |
|
echo "fixing broken haskell modules:" |
211 |
|
local pkg |
212 |
|
for pkg in ${broken} |
213 |
|
do |
214 |
|
echo " unregister ${pkg} ..." |
215 |
|
ghc-pkg unregister ${pkg} |
216 |
|
done |
217 |
|
fi |
218 |
|
fi |
219 |
|
} |
220 |
|
|
221 |
|
export_inherits haskell src_prepare src_compile src_install preinstall postinstall postremove #preremove |