Magellan Linux

Contents of /trunk/include/perl.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11558 - (show annotations) (download)
Mon Mar 12 21:31:31 2012 UTC (12 years, 1 month ago) by niro
File size: 4061 byte(s)
-fixed minstalldocs multilib issue
1 # $Id$
2
3 # inherits {pre,post}install() and {pre,post}remove() to mage file
4 INHERITS="${INHERITS} perl"
5
6 # taken from gentoo eclass perm-module.eclass
7 perlinfo()
8 {
9 if [ -f /usr/bin/perl ]
10 then
11 POD_DIR="/usr/share/perl/magellan-pods/${version}"
12 fi
13
14 eval $(perl '-V:version')
15 PERL_VERSION=${version}
16
17 eval $(perl '-V:installsitearch')
18 SITE_ARCH=${installsitearch}
19
20 eval $(perl '-V:installarchlib')
21 ARCH_LIB=${installarchlib}
22
23 eval $(perl '-V:installsitearch')
24 SITE_LIB=${installsitearch}
25
26 local installvendorlib
27 eval $(perl '-V:installvendorlib')
28 VENDOR_LIB=${installvendorlib}
29
30 local installvendorarch
31 eval $(perl '-V:installvendorarch')
32 VENDOR_ARCH=${installvendorarch}
33
34 # handling of DESTDIR changed in makemaker 6.11
35 MMSIXELEVEN=$(perl -e 'use ExtUtils::MakeMaker; print( $ExtUtils::MakeMaker::VERSION ge "6.11" )')
36 }
37
38 # taken from gentoo eclass perl-module.eclass
39 updatepod()
40 {
41 local i
42
43 perlinfo
44
45 if [ -d "${POD_DIR}" ]
46 then
47 for i in $(find ${POD_DIR} -type f -name "*.pod.arch")
48 do
49 cat ${i} >> ${ARCH_LIB}/perllocal.pod
50 rm -f ${i}
51 done
52 for i in $(find ${POD_DIR} -type f -name "*.pod.site")
53 do
54 cat ${i} >> ${SITE_LIB}/perllocal.pod
55 rm -f ${i}
56 done
57 for i in $(find ${POD_DIR} -type f -name "*.pod.vendor")
58 do
59 cat ${i} >> ${VENDOR_LIB}/perllocal.pod
60 rm -f ${i}
61 done
62 fi
63 }
64
65 fixlocalpod()
66 {
67 perlinfo
68
69 if [ -f ${BINDIR}${ARCH_LIB}/perllocal.pod ]
70 then
71 rm -f ${BINDIR}/${ARCH_LIB}/perllocal.pod
72 fi
73
74 if [ -f ${BINDIR}${SITE_LIB}/perllocal.pod ]
75 then
76 rm -f ${BINDIR}/${SITE_LIB}/perllocal.pod
77 fi
78
79 if [ -f ${BINDIR}${VENDOR_LIB}/perllocal.pod ]
80 then
81 rm -f ${BINDIR}/${VENDOR_LIB}/perllocal.pod
82 fi
83 }
84
85 perl_src_prepare()
86 {
87 munpack ${SRCFILE} || die
88 }
89
90 perl_src_check()
91 {
92 return 0
93 }
94
95 perl_run_src_compile()
96 {
97 perlinfo
98
99 export PERL_MM_USE_DEFAULT=1
100 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
101
102 local configure_opts="$@"
103
104 if [[ -f Build.PL ]]
105 then
106 perl Build.PL \
107 --installdirs=vendor \
108 --destdir=${BINDIR} \
109 --libdoc= \
110 || die
111 perl Build build || die
112
113 elif [[ -f Makefile.PL ]]
114 then
115 perl Makefile.PL \
116 ${configure_opts} \
117 PREFIX=/usr \
118 INSTALLMAN3DIR='none' \
119 INSTALLDIRS=vendor \
120 DESTDIR=${BINDIR} \
121 || die
122 make || die
123 else
124 die "No buildscript detected!"
125 fi
126
127 fixlocalpod
128 }
129
130 perl_src_compile()
131 {
132 cd ${SRCDIR}
133 perl_run_src_compile $@ || die
134 }
135
136 perl_multilib_src_compile()
137 {
138 local abi
139 for abi in ${MULTILIB_ABIS}
140 do
141 cd ${SRCDIR}-${abi}/${SRCSUBDIR}
142 abi-${abi} perl_run_src_compile $@ || die
143 done
144 }
145
146 perl_run_src_install()
147 {
148 local i
149 local stat
150
151 perlinfo
152
153 if [[ -f Makefile ]]
154 then
155 make install || die
156 elif [[ -f Build ]]
157 then
158 perl ${SRCDIR}/Build install || die
159 else
160 die "No installscript detected!"
161 fi
162
163 # clean manfiles
164 for i in $(find ${BINDIR} -type f -name "*.3pm*")
165 do
166 rm ${i} || die
167 done
168 find ${BINDIR}/usr/share/man -depth -type d 2>/dev/null | xargs -r rmdir 2>/dev/null
169
170 # remove local podfiles
171 fixlocalpod
172
173 # remove BINDIR from text so files
174 for i in $(find ${BINDIR} -type f | grep -v '.so')
175 do
176 stat=$(file ${i} | grep -i " text")
177 if [[ ${stat}x != x ]]
178 then
179 sed -i "s:${BINDIR}:/:g" ${i} || die
180 fi
181 done
182 }
183
184 perl_src_install()
185 {
186 cd ${SRCDIR}
187 perl_run_src_install || die
188
189 local i
190 for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
191 FAQ LICENSE NEWS README TODO
192 do
193 if [ -f ${SRCDIR}/${i} ]
194 then
195 minstalldocs ${i} || die
196 fi
197 done
198 }
199
200 perl_multilib_src_install()
201 {
202 local abi
203 local saved_SRCDIR="${SRCDIR}"
204
205 for abi in ${MULTILIB_ABIS}
206 do
207 SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"
208 cd ${SRCDIR}
209 abi-${abi} perl_run_src_install $@ || die
210
211 local i
212 for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
213 FAQ LICENSE NEWS README TODO
214 do
215 if [ -f ${SRCDIR}/${i} ]
216 then
217 oldminstalldocs ${i} || die
218 fi
219 done
220 done
221 SRCDIR="${saved_SRCDIR}"
222 }
223
224 export_inherits perl src_prepare src_check
225 if [[ ${MULTILIB_BUILD} = true ]]
226 then
227 export_inherits perl_multilib src_compile src_install
228 else
229 export_inherits perl src_compile src_install
230 fi