Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5500 - (show annotations) (download)
Wed Jun 30 22:49:24 2010 UTC (13 years, 10 months ago) by niro
File size: 3118 byte(s)
-always enable split-objs and shared libraries
1 # $Id$
2
3 # default includes
4 sminclude mtools
5
6 # some sane default values
7 : ${PCATEGORIE="dev-haskell"}
8 : ${DESCRIPTION="${PNAME}"}
9 : ${HOMEPAGE="http://hackage.haskell.org/package/${PNAME/#haskell-/}"}
10
11 # some sane default dependencies
12 SDEPEND="${SDEPEND}
13 >= dev-lang/ghc-6.12"
14
15 # default SRCFILE SRCDIR and SRC_URI
16 : ${SRCFILE="${PNAME/#haskell-/}-${PVER}.tar.gz"}
17 : ${SRCDIR="${BUILDDIR}/${PNAME/#haskell-/}-${PVER}"}
18 SRC_URI=(
19 ${SRC_URI[*]}
20 http://hackage.haskell.org/packages/archive/${PNAME/#haskell-/}/${PVER}/${SRCFILE}
21 mirror://${PNAME}/${SRCFILE}
22 )
23
24 HASKELL_PNAME="${PNAME}"
25 SPECIAL_VARS="HASKELL_PNAME"
26 SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} haskell_preinstall haskell_postinstall haskell_preremove"
27
28 haskell_ghc_version()
29 {
30 local ver
31 ver=$(ghc --numeric-version)
32 echo "${ver}"
33 }
34
35 haskell_ghc_setup_script()
36 {
37 local setup
38 if [[ -e Setup.lhs ]]
39 then
40 setup="Setup.lhs"
41 elif [[ -e Setup.hs ]]
42 then
43 setup="Setup.hs"
44 else
45 die "unkown setup script"
46 fi
47
48 echo "${setup}"
49 }
50
51 haskell_install_register()
52 {
53 runhaskell $(haskell_ghc_setup_script) register --gen-script || die
54 runhaskell $(haskell_ghc_setup_script) unregister --gen-script || die
55
56 minstalldir /usr/share/haskell/${PNAME} || die
57 minstallexec register.sh /usr/share/haskell/${PNAME} || die
58 minstallexec unregister.sh /usr/share/haskell/${PNAME} || die
59 }
60
61 haskell_src_prepare()
62 {
63 munpack ${SRCFILE} || die
64 }
65
66 haskell_src_configure()
67 {
68 local configure_opts="$@"
69
70 configure_opts+=" --enable-split-objs"
71 configure_opts+=" --enable-shared"
72
73 runhaskell $(haskell_ghc_setup_script) configure \
74 --ghc \
75 --prefix=/usr \
76 --libdir=/usr/$(mlibdir) \
77 --libsubdir=ghc-$(haskell_ghc_version)/${PNAME/#haskell-/}-${PVER} \
78 --datadir=/usr/share \
79 --datasubdir=ghc-$(haskell_ghc_version)/${PNAME/#haskell-/}-${PVER} \
80 ${configure_opts} \
81 || die
82 }
83
84 haskell_src_compile()
85 {
86 cd ${SRCDIR}
87 haskell_src_configure || die
88 runhaskell $(haskell_ghc_setup_script) build || die
89 }
90
91 haskell_src_install()
92 {
93 cd ${SRCDIR}
94
95 runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die
96
97 # create register scripts
98 haskell_install_register || die
99
100 # install docs
101 local i
102 for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
103 FAQ LICENSE NEWS README TODO prologue.txt
104 do
105 if [ -f ${SRCDIR}/${i} ]
106 then
107 minstalldocs ${i} || die
108 fi
109 done
110 }
111
112 haskell_preinstall()
113 {
114 if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh ]]
115 then
116 echo "unregister haskell module ${HASKELL_PNAME} ..."
117 ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh
118 fi
119 }
120
121 haskell_postinstall()
122 {
123 if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/register.sh ]]
124 then
125 echo "register haskell module ${HASKELL_PNAME} ..."
126 ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/register.sh
127 fi
128 }
129
130 # haskell_preremove()
131 # {
132 # if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh ]]
133 # then
134 # echo "unregister haskell module ${HASKELL_PNAME} ..."
135 # ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh
136 # fi
137 # }
138
139 export_inherits haskell src_prepare src_compile src_install preinstall postinstall #preremove