Annotation of /branches/magellan-next/include/haskell.sminc
Parent Directory | Revision Log
Revision 5493 -
(hide annotations)
(download)
Wed Jun 30 16:38:32 2010 UTC (14 years, 4 months ago) by niro
Original Path: trunk/core/include/haskell.sminc
File size: 2941 byte(s)
Wed Jun 30 16:38:32 2010 UTC (14 years, 4 months ago) by niro
Original Path: trunk/core/include/haskell.sminc
File size: 2941 byte(s)
- create register scripts too
1 | niro | 5489 | # $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 | niro | 5492 | SRC_URI=( |
19 | ${SRC_URI[*]} | ||
20 | http://hackage.haskell.org/packages/archive/${PNAME/#haskell-/}/${PVER}/${SRCFILE} | ||
21 | mirror://${PNAME}/${SRCFILE} | ||
22 | ) | ||
23 | niro | 5489 | |
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 | niro | 5493 | # create register scripts |
94 | haskell_install_register || die | ||
95 | |||
96 | niro | 5489 | # install docs |
97 | local i | ||
98 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
99 | FAQ LICENSE NEWS README TODO prologue.txt | ||
100 | do | ||
101 | if [ -f ${SRCDIR}/${i} ] | ||
102 | then | ||
103 | minstalldocs ${i} || die | ||
104 | fi | ||
105 | done | ||
106 | } | ||
107 | |||
108 | haskell_preinstall() | ||
109 | { | ||
110 | if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh ]] | ||
111 | then | ||
112 | echo "unregister haskell module ${HASKELL_PNAME} ..." | ||
113 | ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh | ||
114 | fi | ||
115 | } | ||
116 | |||
117 | haskell_postinstall() | ||
118 | { | ||
119 | if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/register.sh ]] | ||
120 | then | ||
121 | echo "register haskell module ${HASKELL_PNAME} ..." | ||
122 | ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/register.sh | ||
123 | fi | ||
124 | } | ||
125 | |||
126 | # haskell_preremove() | ||
127 | # { | ||
128 | # if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh ]] | ||
129 | # then | ||
130 | # echo "unregister haskell module ${HASKELL_PNAME} ..." | ||
131 | # ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh | ||
132 | # fi | ||
133 | # } | ||
134 | |||
135 | export_inherits haskell src_prepare src_compile src_install preinstall postinstall #preremove |