Annotation of /trunk/include/perl.sminc
Parent Directory | Revision Log
Revision 11548 -
(hide annotations)
(download)
Mon Mar 12 21:08:46 2012 UTC (12 years, 8 months ago) by niro
File size: 3874 byte(s)
Mon Mar 12 21:08:46 2012 UTC (12 years, 8 months ago) by niro
File size: 3874 byte(s)
-fixed logic
1 | niro | 11541 | # $Id$ |
2 | niro | 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 | niro | 11548 | perl_multilib_src_prepare() |
91 | { | ||
92 | munpack ${SRCFILE} || die | ||
93 | } | ||
94 | |||
95 | niro | 11541 | perl_run_src_compile() |
96 | niro | 2 | { |
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 | niro | 11541 | perl_src_compile() |
131 | niro | 2 | { |
132 | niro | 4233 | cd ${SRCDIR} |
133 | niro | 11541 | perl_run_src_compile $@ || die |
134 | } | ||
135 | niro | 4233 | |
136 | niro | 11548 | perl_multilib_src_compile() |
137 | niro | 11541 | { |
138 | local abi | ||
139 | niro | 11545 | for abi in ${MULTILIB_ABIS} |
140 | niro | 11541 | do |
141 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} | ||
142 | perl_run_src_compile $@ || die | ||
143 | done | ||
144 | } | ||
145 | |||
146 | niro | 11546 | perl_run_src_install() |
147 | niro | 11541 | { |
148 | niro | 2 | 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 | local i | ||
184 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
185 | FAQ LICENSE NEWS README TODO | ||
186 | do | ||
187 | if [ -f ${SRCDIR}/${i} ] | ||
188 | then | ||
189 | minstalldocs ${i} || die | ||
190 | fi | ||
191 | done | ||
192 | } | ||
193 | |||
194 | niro | 11541 | perl_src_compile() |
195 | { | ||
196 | cd ${SRCDIR} | ||
197 | perl_run_src_compile $@ || die | ||
198 | } | ||
199 | niro | 2 | |
200 | niro | 11548 | perl_multilib_src_compile() |
201 | niro | 11541 | { |
202 | local abi | ||
203 | local saved_SRCDIR="${SRCDIR}" | ||
204 | |||
205 | niro | 11545 | for abi in ${MULTILIB_ABIS} |
206 | niro | 11541 | do |
207 | export SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" | ||
208 | cd ${SRCDIR} | ||
209 | perl_run_src_compile $@ || die | ||
210 | done | ||
211 | export SRCDIR="${saved_SRCDIR}" | ||
212 | } | ||
213 | |||
214 | niro | 11543 | if [[ ${MULTILIB_BUILD} = true ]] |
215 | niro | 11541 | then |
216 | niro | 11548 | export_inherits perl_multilib src_prepare src_compile src_install |
217 | niro | 11543 | else |
218 | niro | 11541 | export_inherits perl src_prepare src_compile src_install |
219 | fi |