Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5499 - (hide annotations) (download)
Wed Jun 30 22:42:30 2010 UTC (13 years, 10 months ago) by niro
File size: 3041 byte(s)
-ghc is only needed to build the package
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 niro 5499 SDEPEND="${SDEPEND}
13 niro 5489 >= 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 niro 5494 SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} haskell_preinstall haskell_postinstall haskell_preremove"
27 niro 5489
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     runhaskell $(haskell_ghc_setup_script) configure \
71     --ghc \
72     --prefix=/usr \
73     --libdir=/usr/$(mlibdir) \
74     --libsubdir=ghc-$(haskell_ghc_version)/${PNAME/#haskell-/}-${PVER} \
75     --datadir=/usr/share \
76     --datasubdir=ghc-$(haskell_ghc_version)/${PNAME/#haskell-/}-${PVER} \
77     ${configure_opts} \
78     || die
79     }
80    
81     haskell_src_compile()
82     {
83     cd ${SRCDIR}
84     haskell_src_configure || die
85     runhaskell $(haskell_ghc_setup_script) build || die
86     }
87    
88     haskell_src_install()
89     {
90     cd ${SRCDIR}
91    
92     runhaskell $(haskell_ghc_setup_script) copy --destdir=${BINDIR} || die
93    
94 niro 5493 # create register scripts
95     haskell_install_register || die
96    
97 niro 5489 # install docs
98     local i
99     for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
100     FAQ LICENSE NEWS README TODO prologue.txt
101     do
102     if [ -f ${SRCDIR}/${i} ]
103     then
104     minstalldocs ${i} || die
105     fi
106     done
107     }
108    
109     haskell_preinstall()
110     {
111     if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh ]]
112     then
113     echo "unregister haskell module ${HASKELL_PNAME} ..."
114     ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh
115     fi
116     }
117    
118     haskell_postinstall()
119     {
120     if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/register.sh ]]
121     then
122     echo "register haskell module ${HASKELL_PNAME} ..."
123     ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/register.sh
124     fi
125     }
126    
127     # haskell_preremove()
128     # {
129     # if [[ -x ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh ]]
130     # then
131     # echo "unregister haskell module ${HASKELL_PNAME} ..."
132     # ${MROOT}/usr/share/haskell/${HASKELL_PNAME}/unregister.sh
133     # fi
134     # }
135    
136     export_inherits haskell src_prepare src_compile src_install preinstall postinstall #preremove