1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.67 2005/03/14 18:28:04 mcummings Exp $
#
# Author: Seemant Kulleen <seemant@gentoo.org>
# Maintained by the Perl herd <perl@gentoo.org>
#
# The perl-module eclass is designed to allow easier installation of perl
# modules, and their incorporation into the Gentoo Linux system.
ECLASS=perl-module
INHERITED="${INHERITED} ${ECLASS}"
EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm \
src_compile src_install src_test \
perlinfo updatepod
# 2004.05.10 rac
# block on makemaker versions earlier than that in the 5.8.2 core. in
# actuality, this should be handled in the perl ebuild, so every perl
# ebuild should block versions of MakeMaker older than the one it
# carries. in the meantime, since we have dumped support for MakeMaker
# <6.11 and the associated broken DESTDIR handling, block here to save
# people from sandbox trouble.
#
# 2004.05.25 rac
# for the same reasons, make the perl dep >=5.8.2 to get everybody
# with 5.8.0 and its 6.03 makemaker up to a version that can
# understand DESTDIR
#
# 2004.10.01 mcummings
# noticed a discrepancy in how we were sed fixing references to ${D}
#
# 2005.03.14 mcummings
# Updated eclass to include a specific function for dealing with perlocal.pods -
# this should avoid the conflicts we've been running into with the introduction
# of file collision features by giving us a single exportable function to deal
# with the pods. Modifications to the eclass provided by Yaakov S
# <yselkowitz@hotmail.com> in bug 83622
#
# <later the same day>
# The long awaited (by me) fix for automagically detecting and dealing
# with module-build dependancies. I've chosen not to make it a default dep since
# this adds overhead to people that might not otherwise need it, and instead
# modified the eclass to detect the existence of a Build.PL and behave
# accordingly. This will fix issues with g-cpan builds that needs module-build
# support, as well as get rid of the (annoying) style=builder vars. I know of
# only one module that needed to be hacked for this, Class-MethodMaker-2.05, but
# that module has a bad Build.PL to begin with. Ebuilds should continue to
# DEPEND on module-build<-version> as needed, but there should be no need for
# the style directive any more (especially since it isn't in the eclass
# anymore). Enjoy!
DEPEND=">=dev-lang/perl-5.8.2 !<dev-perl/ExtUtils-MakeMaker-6.17"
SRC_PREP="no"
SRC_TEST="skip"
PERL_VERSION=""
SITE_ARCH=""
SITE_LIB=""
VENDOR_LIB=""
VENDOR_ARCH=""
ARCH_LIB=""
POD_DIR=""
BUILDER_VER=""
perl-module_src_prep() {
perlinfo
export PERL_MM_USE_DEFAULT=1
SRC_PREP="yes"
if [ -f ${S}/Build.PL ]; then
if [ -z ${BUILDER_VER} ]; then
eerror
eerror "Please post a bug on http://bugs.gentoo.org assigned to"
eerror "perl@gentoo.org - ${P} was added without a dependancy"
eerror "on dev-perl/module-build"
eerror "${BUILDER_VER}"
eerror
die
else
perl ${S}/Build.PL installdirs=vendor destdir=${D}
fi
else
perl Makefile.PL ${myconf} \
PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D}
fi
}
perl-module_src_compile() {
perlinfo
[ "${SRC_PREP}" != "yes" ] && perl-module_src_prep
if [ -z ${BUILDER_VER} ]; then
make ${mymake} || die "compilation failed"
fi
if [ "${SRC_TEST}" == "do" ]; then
perl-module_src_test || die "test failed"
SRC_TEST="done"
fi
}
perl-module_src_test() {
perlinfo
if [ -z ${BUILDER_VER} ]; then
make test
else
perl ${S}/Build test
fi
}
perl-module_src_install() {
perlinfo
test -z ${mytargets} && mytargets="install"
if [ -z ${BUILDER_VER} ]; then
make ${myinst} ${mytargets} || die
else
perl ${S}/Build install
fi
fixlocalpod
for FILE in `find ${D} -type f |grep -v '.so'`; do
STAT=`file $FILE| grep -i " text"`
if [ "${STAT}x" != "x" ]; then
sed -i -e "s:${D}:/:g" ${FILE}
fi
done
for doc in Change* MANIFEST* README*; do
[ -s "$doc" ] && dodoc $doc
done
dodoc ${mydoc}
}
perl-module_pkg_setup() {
perlinfo
}
perl-module_pkg_preinst() {
perlinfo
}
perl-module_pkg_postinst() {
updatepod
}
perl-module_pkg_prerm() {
updatepod
}
perl-module_pkg_postrm() {
updatepod
}
perlinfo() {
eval `perl '-V:version'`
PERL_VERSION=${version}
eval `perl '-V:installsitearch'`
SITE_ARCH=${installsitearch}
eval `perl '-V:installsitearch'`
SITE_LIB=${installsitearch}
eval `perl '-V:installarchlib'`
ARCH_LIB=${installarchlib}
eval `perl '-V:installvendorlib'`
VENDOR_LIB=${installvendorlib}
eval `perl '-V:installvendorarch'`
VENDOR_ARCH=${installvendorarch}
if [ -f ${S}/Build.PL ]; then
if [ ${PN} == "module-build" ]; then
BUILDER_VER="1" # A bootstrapping if you will
else
BUILDER_VER=`perl -MModule::Build -e 'print "$Module::Build::VERSION;"' `
fi
fi
if [ -f /usr/bin/perl ]
then
POD_DIR="/usr/share/perl/gentoo-pods/${version}"
fi
}
fixlocalpod() {
perlinfo
dodir ${POD_DIR}
if [ -f ${D}${ARCH_LIB}/perllocal.pod ];
then
touch ${D}/${POD_DIR}/${P}.pod
sed -e "s:${D}::g" \
${D}${ARCH_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
touch ${D}/${POD_DIR}/${P}.pod.arch
cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.arch
rm -f ${D}/${ARCH_LIB}/perllocal.pod
fi
if [ -f ${D}${SITE_LIB}/perllocal.pod ];
then
touch ${D}/${POD_DIR}/${P}.pod
sed -e "s:${D}::g" \
${D}${SITE_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
touch ${D}/${POD_DIR}/${P}.pod.site
cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.site
rm -f ${D}/${SITE_LIB}/perllocal.pod
fi
if [ -f ${D}${VENDOR_LIB}/perllocal.pod ];
then
touch ${D}/${POD_DIR}/${P}.pod
sed -e "s:${D}::g" \
${D}${VENDOR_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
touch ${D}/${POD_DIR}/${P}.pod.vendor
cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.vendor
rm -f ${D}/${VENDOR_LIB}/perllocal.pod
fi
}
updatepod() {
perlinfo
if [ -d "${POD_DIR}" ]
then
for FILE in `find ${POD_DIR} -type f -name "*.pod.arch"`; do
cat ${FILE} >> ${ARCH_LIB}/perllocal.pod
rm -f ${FILE}
done
for FILE in `find ${POD_DIR} -type f -name "*.pod.site"`; do
cat ${FILE} >> ${SITE_LIB}/perllocal.pod
rm -f ${FILE}
done
for FILE in `find ${POD_DIR} -type f -name "*.pod.vendor"`; do
cat ${FILE} >> ${VENDOR_LIB}/perllocal.pod
rm -f ${FILE}
done
fi
}
|