Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5492 - (show annotations) (download)
Wed Jun 30 16:36:45 2010 UTC (13 years, 10 months ago) by niro
File size: 2880 byte(s)
- fixed SRC_URI handling
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 DEPEND="${DEPEND}
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
27 haskell_ghc_version()
28 {
29 local ver
30 ver=$(ghc --numeric-version)
31 echo "${ver}"
32 }
33
34 haskell_ghc_setup_script()
35 {
36 local setup
37 if [[ -e Setup.lhs ]]
38 then
39 setup="Setup.lhs"
40 elif [[ -e Setup.hs ]]
41 then
42 setup="Setup.hs"
43 else
44 die "unkown setup script"
45 fi
46
47 echo "${setup}"
48 }
49
50 haskell_install_register()
51 {
52 runhaskell $(haskell_ghc_setup_script) register --gen-script || die
53 runhaskell $(haskell_ghc_setup_script) unregister --gen-script || die
54
55 minstalldir /usr/share/haskell/${PNAME} || die
56 minstallexec register.sh /usr/share/haskell/${PNAME} || die
57 minstallexec unregister.sh /usr/share/haskell/${PNAME} || die
58 }
59
60 haskell_src_prepare()
61 {
62 munpack ${SRCFILE} || die
63 }
64
65 haskell_src_configure()
66 {
67 local configure_opts="$@"
68
69 runhaskell $(haskell_ghc_setup_script) configure \
70 --ghc \
71 --prefix=/usr \
72 --libdir=/usr/$(mlibdir) \
73 --libsubdir=ghc-$(haskell_ghc_version)/${PNAME/#haskell-/}-${PVER} \
74 --datadir=/usr/share \
75 --datasubdir=ghc-$(haskell_ghc_version)/${PNAME/#haskell-/}-${PVER} \
76 ${configure_opts} \
77 || die
78 }
79
80 haskell_src_compile()
81 {
82 cd ${SRCDIR}
83 haskell_src_configure || die
84 runhaskell $(haskell_ghc_setup_script) build || die
85 }
86
87 haskell_src_install()
88 {
89 cd ${SRCDIR}
90
91 runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die
92
93 # install docs
94 local i
95 for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
96 FAQ LICENSE NEWS README TODO prologue.txt
97 do
98 if [ -f ${SRCDIR}/${i} ]
99 then
100 minstalldocs ${i} || die
101 fi
102 done
103 }
104
105 haskell_preinstall()
106 {
107 if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh ]]
108 then
109 echo "unregister haskell module ${HASKELL_PNAME} ..."
110 ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh
111 fi
112 }
113
114 haskell_postinstall()
115 {
116 if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/register.sh ]]
117 then
118 echo "register haskell module ${HASKELL_PNAME} ..."
119 ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/register.sh
120 fi
121 }
122
123 # haskell_preremove()
124 # {
125 # if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh ]]
126 # then
127 # echo "unregister haskell module ${HASKELL_PNAME} ..."
128 # ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh
129 # fi
130 # }
131
132 export_inherits haskell src_prepare src_compile src_install preinstall postinstall #preremove