/[gentoo-x86]/eclass/perl-module.eclass
Gentoo

Diff of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.67

  ViewVC Help
Powered by ViewVC 1.1.20