Magellan Linux

Diff of /trunk/core/include/haskell.sminc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5493 by niro, Wed Jun 30 16:38:32 2010 UTC revision 5543 by niro, Thu Jul 1 15:34:38 2010 UTC
# Line 9  sminclude mtools Line 9  sminclude mtools
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
# Line 21  SRC_URI=( Line 21  SRC_URI=(
21   mirror://${PNAME}/${SRCFILE}   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 "${feature}" || die "haskell feature '${feature}' not supported!"
65     echo -e "${COLBLUE}--- ${COLRED}  disabled haskell feature '${feature}'${COLDEFAULT}"
66     export HASKELL_FEATURES="${HASKELL_FEATURES/${feature}/}"
67    }
68    
69    haskell_enable_feature()
70    {
71     local feature="$1"
72     haskell_feature_is_supported "${feature}" || die "haskell feature '${feature}' not supported!"
73     echo -e "${COLBLUE}--- ${COLGREEN}  enabled haskell feature '${feature}'${COLDEFAULT}"
74     export HASKELL_FEATURES+=" ${feature}"
75    }
76    
77  haskell_ghc_version()  haskell_ghc_version()
78  {  {
# Line 66  haskell_src_configure() Line 116  haskell_src_configure()
116  {  {
117   local configure_opts="$@"   local configure_opts="$@"
118    
119     haskell_feature split-objs && configure_opts+=" --enable-split-objs"
120     haskell_feature shared && configure_opts+=" --enable-shared"
121    
122   runhaskell $(haskell_ghc_setup_script) configure \   runhaskell $(haskell_ghc_setup_script) configure \
123   --ghc \   --ghc \
124   --prefix=/usr \   --prefix=/usr \
# Line 77  haskell_src_configure() Line 130  haskell_src_configure()
130   || die   || die
131  }  }
132    
133    haskell_src_build()
134    {
135     runhaskell $(haskell_ghc_setup_script) build || die
136    }
137    
138  haskell_src_compile()  haskell_src_compile()
139  {  {
140   cd ${SRCDIR}   cd ${SRCDIR}
141   haskell_src_configure || die   haskell_src_configure || die
142   runhaskell $(haskell_ghc_setup_script) build || die   haskell_src_build || die
143  }  }
144    
145  haskell_src_install()  haskell_src_install()
146  {  {
147   cd ${SRCDIR}   cd ${SRCDIR}
   
148   runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die   runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die
149    
150   # create register scripts   # create register scripts
151   haskell_install_register || die   haskell_feature register && haskell_install_register || die
152    
153   # install docs   # install docs
154   local i   local i
# Line 132  haskell_postinstall() Line 189  haskell_postinstall()
189  # fi  # fi
190  # }  # }
191    
192  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
193    haskell_postremove()
194    {
195     if [[ -x $(which ghc-pkg) ]]
196     then
197     local broken="$(ghc-pkg check --simple-output)"
198     if [[ ! -z ${broken} ]]
199     then
200     echo "fixing broken haskell modules:"
201     local pkg
202     for pkg in ${broken}
203     do
204     echo "   unregister ${pkg} ..."
205     ghc-pkg unregister ${pkg}
206     done
207     fi
208     fi
209    }
210    
211    export_inherits haskell src_prepare src_compile src_install preinstall postinstall postremove #preremove

Legend:
Removed from v.5493  
changed lines
  Added in v.5543