/[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.121 Revision 1.126
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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.121 2010/01/13 15:15:45 tove Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.126 2010/07/15 11:44:48 tove Exp $
4# 4#
5# Author: Seemant Kulleen <seemant@gentoo.org> 5# Author: Seemant Kulleen <seemant@gentoo.org>
6 6
7# @ECLASS: perl-module.eclass 7# @ECLASS: perl-module.eclass
8# @MAINTAINER: 8# @MAINTAINER:
17 17
18PERL_EXPF="src_unpack src_compile src_test src_install" 18PERL_EXPF="src_unpack src_compile src_test src_install"
19 19
20case "${EAPI:-0}" in 20case "${EAPI:-0}" in
21 0|1) 21 0|1)
22 PERL_EXPF="${PERL_EXPF} pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm" 22 PERL_EXPF+=" pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm"
23 ;; 23 ;;
24 2) 24 2|3)
25 PERL_EXPF="${PERL_EXPF} src_prepare src_configure" 25 PERL_EXPF+=" src_prepare src_configure"
26 [[ ${CATEGORY} == "perl-core" ]] && \ 26 [[ ${CATEGORY} == "perl-core" ]] && \
27 PERL_EXPF="${PERL_EXPF} pkg_postinst pkg_postrm" 27 PERL_EXPF+=" pkg_postinst pkg_postrm"
28 28
29 case "${GENTOO_DEPEND_ON_PERL:-yes}" in 29 case "${GENTOO_DEPEND_ON_PERL:-yes}" in
30 yes) 30 yes)
31 DEPEND="dev-lang/perl[-build]" 31 DEPEND="dev-lang/perl[-build]"
32 RDEPEND="${DEPEND}" 32 RDEPEND="${DEPEND}"
33 ;; 33 ;;
34 esac 34 esac
35 ;; 35 ;;
36 *)
37 DEPEND="EAPI-UNSUPPORTED"
38 ;;
36esac 39esac
37 40
41case "${PERL_EXPORT_PHASE_FUNCTIONS:-yes}" in
42 yes)
38EXPORT_FUNCTIONS ${PERL_EXPF} 43 EXPORT_FUNCTIONS ${PERL_EXPF}
44 ;;
45 no)
46 debug-print "PERL_EXPORT_PHASE_FUNCTIONS=no"
47 ;;
48 *)
49 DEPEND+=" PERL_EXPORT_PHASE_FUNCTIONS-UNSUPPORTED"
50 ;;
51esac
39 52
40DESCRIPTION="Based on the $ECLASS eclass" 53DESCRIPTION="Based on the $ECLASS eclass"
41 54
42LICENSE="${LICENSE:-|| ( Artistic GPL-2 )}" 55LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}"
43 56
44[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz" 57[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz"
45[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \ 58[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
46 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION}/${MODULE_A}" 59 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}"
47[[ -z "${HOMEPAGE}" ]] && \ 60[[ -z "${HOMEPAGE}" ]] && \
48 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/" 61 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/"
49 62
50SRC_PREP="no" 63SRC_PREP="no"
51SRC_TEST="skip" 64SRC_TEST="skip"
52PREFER_BUILDPL="yes" 65PREFER_BUILDPL="yes"
53 66
54PERL_VERSION=""
55SITE_ARCH=""
56SITE_LIB=""
57ARCH_LIB=""
58VENDOR_ARCH=""
59VENDOR_LIB=""
60
61pm_echovar="" 67pm_echovar=""
62perlinfo_done=false 68perlinfo_done=false
63 69
64perl-module_src_unpack() { 70perl-module_src_unpack() {
71 debug-print-function $FUNCNAME "$@"
65 base_src_unpack 72 base_src_unpack
66 has src_prepare ${PERL_EXPF} || perl-module_src_prepare 73 has src_prepare ${PERL_EXPF} || perl-module_src_prepare
67} 74}
68 75
69perl-module_src_prepare() { 76perl-module_src_prepare() {
77 debug-print-function $FUNCNAME "$@"
70 has src_prepare ${PERL_EXPF} && base_src_prepare 78 has src_prepare ${PERL_EXPF} && base_src_prepare
79 perl_fix_osx_extra
71 esvn_clean 80 esvn_clean
72} 81}
73 82
74perl-module_src_configure() { 83perl-module_src_configure() {
84 debug-print-function $FUNCNAME "$@"
75 perl-module_src_prep 85 perl-module_src_prep
76} 86}
77 87
78perl-module_src_prep() { 88perl-module_src_prep() {
89 debug-print-function $FUNCNAME "$@"
79 [[ ${SRC_PREP} = yes ]] && return 0 90 [[ ${SRC_PREP} = yes ]] && return 0
80 SRC_PREP="yes" 91 SRC_PREP="yes"
81 92
82 ${perlinfo_done} || perlinfo 93 perl_set_version
94 perl_set_eprefix
83 95
84 export PERL_MM_USE_DEFAULT=1 96 export PERL_MM_USE_DEFAULT=1
85 # Disable ExtUtils::AutoInstall from prompting 97 # Disable ExtUtils::AutoInstall from prompting
86 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" 98 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
87 99
88 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then 100 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then
89 einfo "Using Module::Build" 101 einfo "Using Module::Build"
90 if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != Module-Build ]] ; then 102 if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != Module-Build ]] ; then
91 ewarn "QA Notice: The ebuild uses Module::Build but doesn't depend on it." 103 eqawarn "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
92 ewarn " Add virtual/perl-Module-Build to DEPEND!" 104 eqawarn " Add virtual/perl-Module-Build to DEPEND!"
93 fi 105 fi
94 perl Build.PL \ 106 set -- \
95 --installdirs=vendor \ 107 --installdirs=vendor \
96 --libdoc= \ 108 --libdoc= \
97 --destdir="${D}" \ 109 --destdir="${D}" \
98 --create_packlist=0 \ 110 --create_packlist=0 \
99 ${myconf} \ 111 ${myconf}
100 <<< "${pm_echovar}" \ 112 einfo "perl Build.PL" "$@"
113 perl Build.PL "$@" <<< "${pm_echovar}" \
101 || die "Unable to build! (are you using USE=\"build\"?)" 114 || die "Unable to build! (are you using USE=\"build\"?)"
102 elif [[ -f Makefile.PL ]] ; then 115 elif [[ -f Makefile.PL ]] ; then
103 einfo "Using ExtUtils::MakeMaker" 116 einfo "Using ExtUtils::MakeMaker"
104 perl Makefile.PL \ 117 set -- \
105 PREFIX=/usr \ 118 PREFIX=${EPREFIX}/usr \
106 INSTALLDIRS=vendor \ 119 INSTALLDIRS=vendor \
107 INSTALLMAN3DIR='none' \ 120 INSTALLMAN3DIR='none' \
108 DESTDIR="${D}" \ 121 DESTDIR="${D}" \
109 ${myconf} \ 122 ${myconf}
110 <<< "${pm_echovar}" \ 123 einfo "perl Makefile.PL" "$@"
124 perl Makefile.PL "$@" <<< "${pm_echovar}" \
111 || die "Unable to build! (are you using USE=\"build\"?)" 125 || die "Unable to build! (are you using USE=\"build\"?)"
112 fi 126 fi
113 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then 127 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
114 einfo "No Make or Build file detected..." 128 einfo "No Make or Build file detected..."
115 return 129 return
116 fi 130 fi
117} 131}
118 132
119perl-module_src_compile() { 133perl-module_src_compile() {
120 ${perlinfo_done} || perlinfo 134 debug-print-function $FUNCNAME "$@"
135 perl_set_version
121 136
122 has src_configure ${PERL_EXPF} || perl-module_src_prep 137 has src_configure ${PERL_EXPF} || perl-module_src_prep
123 138
124 if [[ -f Build ]] ; then 139 if [[ -f Build ]] ; then
125 ./Build build \ 140 ./Build build \
153# SRC_TEST="parallel do" 168# SRC_TEST="parallel do"
154# SRC_TEST=parallel 169# SRC_TEST=parallel
155# 170#
156 171
157perl-module_src_test() { 172perl-module_src_test() {
173 debug-print-function $FUNCNAME "$@"
158 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then 174 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
159 if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then 175 if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then
160 export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" ) 176 export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" )
161 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}" 177 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}"
162 fi 178 fi
163 ${perlinfo_done} || perlinfo 179 ${perlinfo_done} || perl_set_version
164 if [[ -f Build ]] ; then 180 if [[ -f Build ]] ; then
165 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" 181 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
166 elif [[ -f Makefile ]] ; then 182 elif [[ -f Makefile ]] ; then
167 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed" 183 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
168 fi 184 fi
169 fi 185 fi
170} 186}
171 187
172perl-module_src_install() { 188perl-module_src_install() {
189 debug-print-function $FUNCNAME "$@"
190
191 perl_set_version
192 perl_set_eprefix
193
173 local f 194 local f
174 ${perlinfo_done} || perlinfo
175 195
176 if [[ -z ${mytargets} ]] ; then 196 if [[ -z ${mytargets} ]] ; then
177 case "${CATEGORY}" in 197 case "${CATEGORY}" in
178 dev-perl|perl-core) mytargets="pure_install" ;; 198 dev-perl|perl-core) mytargets="pure_install" ;;
179 *) mytargets="install" ;; 199 *) mytargets="install" ;;
186 elif [[ -f Makefile ]] ; then 206 elif [[ -f Makefile ]] ; then
187 emake ${myinst} ${mytargets} \ 207 emake ${myinst} ${mytargets} \
188 || die "emake ${myinst} ${mytargets} failed" 208 || die "emake ${myinst} ${mytargets} failed"
189 fi 209 fi
190 210
191 if [[ -d "${D}"/usr/share/man ]] ; then 211 perl_delete_module_manpages
192# einfo "Cleaning out stray man files" 212 perl_delete_localpod
193 find "${D}"/usr/share/man -type f -name "*.3pm" -delete 213 perl_delete_packlist
194 find "${D}"/usr/share/man -depth -type d -empty -delete 214 perl_remove_temppath
195 fi
196 215
197 fixlocalpod
198
199 for f in Change* CHANGES README* TODO ${mydoc}; do 216 for f in Change* CHANGES README* TODO FAQ ${mydoc}; do
200 [[ -s ${f} ]] && dodoc ${f} 217 [[ -s ${f} ]] && dodoc ${f}
201 done 218 done
202 219
220 perl_link_duallife_scripts
221}
222
223perl-module_pkg_setup() {
224 debug-print-function $FUNCNAME "$@"
225 perl_set_version
226}
227
228perl-module_pkg_preinst() {
229 debug-print-function $FUNCNAME "$@"
230 perl_set_version
231}
232
233perl-module_pkg_postinst() {
234 debug-print-function $FUNCNAME "$@"
235 perl_link_duallife_scripts
236}
237
238perl-module_pkg_prerm() {
239 debug-print-function $FUNCNAME "$@"
240}
241
242perl-module_pkg_postrm() {
243 debug-print-function $FUNCNAME "$@"
244 perl_link_duallife_scripts
245}
246
247perlinfo() {
248 debug-print-function $FUNCNAME "$@"
249 perl_set_version
250}
251
252perl_set_version() {
253 debug-print-function $FUNCNAME "$@"
254 debug-print "$FUNCNAME: perlinfo_done=${perlinfo_done}"
255 ${perlinfo_done} && return 0
256 perlinfo_done=true
257
258 local f version install{{site,vendor}{arch,lib},archlib}
259 eval "$(perl -V:{version,install{{site,vendor}{arch,lib},archlib}} )"
260 PERL_VERSION=${version}
261 SITE_ARCH=${installsitearch}
262 SITE_LIB=${installsitelib}
263 ARCH_LIB=${installarchlib}
264 VENDOR_LIB=${installvendorlib}
265 VENDOR_ARCH=${installvendorarch}
266}
267
268fixlocalpod() {
269 debug-print-function $FUNCNAME "$@"
270 perl_delete_localpod
271}
272
273perl_delete_localpod() {
274 debug-print-function $FUNCNAME "$@"
275
276 find "${D}" -type f -name perllocal.pod -delete
277 find "${D}" -depth -mindepth 1 -type d -empty -delete
278}
279
280perl_fix_osx_extra() {
281 debug-print-function $FUNCNAME "$@"
282
283 # Remove "AppleDouble encoded Macintosh file"
284 local f
285 find "${S}" -type f -name "._*" -print0 | while read -rd '' f ; do
286 einfo "Removing AppleDouble encoded Macintosh file: ${f#${S}/}"
287 rm -f "${f}"
288 f=${f#${S}/}
289 # f=${f//\//\/}
290 # f=${f//\./\.}
291 # sed -i "/${f}/d" "${S}"/MANIFEST || die
292 grep -q "${f}" "${S}"/MANIFEST && \
293 elog "AppleDouble encoded Macintosh file in MANIFEST: ${f#${S}/}"
294 done
295}
296
297perl_delete_module_manpages() {
298 debug-print-function $FUNCNAME "$@"
299
300 perl_set_eprefix
301
302 if [[ -d "${ED}"/usr/share/man ]] ; then
303# einfo "Cleaning out stray man files"
304 find "${ED}"/usr/share/man -type f -name "*.3pm" -delete
305 find "${ED}"/usr/share/man -depth -type d -empty -delete
306 fi
307}
308
309
310perl_delete_packlist() {
311 debug-print-function $FUNCNAME "$@"
312 perl_set_version
203 if [[ -d ${D}/${VENDOR_LIB} ]] ; then 313 if [[ -d ${D}/${VENDOR_ARCH} ]] ; then
204 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \ 314 find "${D}/${VENDOR_ARCH}" -type f -a \( -name .packlist \
205 -o \( -name '*.bs' -a -empty \) \) -delete 315 -o \( -name '*.bs' -a -empty \) \) -delete
206 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete 316 find "${D}" -depth -mindepth 1 -type d -empty -delete
207 fi 317 fi
318}
319
320perl_remove_temppath() {
321 debug-print-function $FUNCNAME "$@"
208 322
209 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do 323 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
210 if file "${f}" | grep -q -i " text" ; then 324 if file "${f}" | grep -q -i " text" ; then
211 grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}" 325 grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
212 sed -i -e "s:${D}:/:g" "${f}" 326 sed -i -e "s:${D}:/:g" "${f}"
213 fi 327 fi
214 done 328 done
215
216 linkduallifescripts
217} 329}
218 330
219perl-module_pkg_setup() {
220 ${perlinfo_done} || perlinfo
221}
222
223perl-module_pkg_preinst() {
224 ${perlinfo_done} || perlinfo
225}
226
227perl-module_pkg_postinst() {
228 linkduallifescripts
229}
230
231perl-module_pkg_prerm() { : ; }
232
233perl-module_pkg_postrm() {
234 linkduallifescripts
235}
236
237perlinfo() {
238 perlinfo_done=true
239
240 local f version install{{site,vendor}{arch,lib},archlib}
241 for f in version install{{site,vendor}{arch,lib},archlib} ; do
242 eval "$(perl -V:${f} )"
243 done
244 PERL_VERSION=${version}
245 SITE_ARCH=${installsitearch}
246 SITE_LIB=${installsitelib}
247 ARCH_LIB=${installarchlib}
248 VENDOR_LIB=${installvendorlib}
249 VENDOR_ARCH=${installvendorarch}
250}
251
252fixlocalpod() {
253 find "${D}" -type f -name perllocal.pod -delete
254 find "${D}" -depth -mindepth 1 -type d -empty -delete
255}
256
257linkduallifescripts() { 331perl_link_duallife_scripts() {
332 debug-print-function $FUNCNAME "$@"
258 if [[ ${CATEGORY} != perl-core ]] || ! has_version ">=dev-lang/perl-5.8.8-r8" ; then 333 if [[ ${CATEGORY} != perl-core ]] || ! has_version ">=dev-lang/perl-5.8.8-r8" ; then
259 return 0 334 return 0
260 fi 335 fi
336
337 perl_set_eprefix
261 338
262 local i ff 339 local i ff
263 if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then 340 if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then
264 for i in "${DUALLIFESCRIPTS[@]}" ; do 341 for i in "${DUALLIFESCRIPTS[@]}" ; do
265 alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-[0-9]*" 342 alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-[0-9]*"
266 ff=`echo "${ROOT}"/usr/share/man/man1/${i}-${PV}-${P}.1*` 343 ff=`echo "${EROOT}"/usr/share/man/man1/${i}-${PV}-${P}.1*`
267 ff=${ff##*.1} 344 ff=${ff##*.1}
268 alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-[0-9]*" 345 alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-[0-9]*"
269 done 346 done
270 else 347 else
271 pushd "${D}" > /dev/null 348 pushd "${ED}" > /dev/null
272 for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do 349 for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do
273 mv ${i}{,-${PV}-${P}} || die 350 mv ${i}{,-${PV}-${P}} || die
274 DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/} 351 DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/}
275 if [[ -f usr/share/man/man1/${i##*/}.1 ]] ; then 352 if [[ -f usr/share/man/man1/${i##*/}.1 ]] ; then
276 mv usr/share/man/man1/${i##*/}{.1,-${PV}-${P}.1} || die 353 mv usr/share/man/man1/${i##*/}{.1,-${PV}-${P}.1} || die
277 fi 354 fi
278 done 355 done
279 popd > /dev/null 356 popd > /dev/null
280 fi 357 fi
281} 358}
359
360perl_set_eprefix() {
361 debug-print-function $FUNCNAME "$@"
362 case ${EAPI:-0} in
363 0|1|2)
364 if ! use prefix; then
365 EPREFIX=
366 ED=${D}
367 EROOT=${ROOT}
368 fi
369 ;;
370 esac
371}

Legend:
Removed from v.1.121  
changed lines
  Added in v.1.126

  ViewVC Help
Powered by ViewVC 1.1.20