/[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.124 Revision 1.132
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2011 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.124 2010/04/22 11:43:30 tove Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.132 2012/04/15 20:15:39 vapier Exp $
4#
5# Author: Seemant Kulleen <seemant@gentoo.org>
6 4
7# @ECLASS: perl-module.eclass 5# @ECLASS: perl-module.eclass
8# @MAINTAINER: 6# @MAINTAINER:
9# perl@gentoo.org 7# perl@gentoo.org
8# @AUTHOR:
9# Seemant Kulleen <seemant@gentoo.org>
10# @BLURB: eclass for perl modules 10# @BLURB: eclass for perl modules
11# @DESCRIPTION: 11# @DESCRIPTION:
12# The perl-module eclass is designed to allow easier installation of perl 12# The perl-module eclass is designed to allow easier installation of perl
13# modules, and their incorporation into the Gentoo Linux system. 13# modules, and their incorporation into the Gentoo Linux system.
14 14
19 19
20case "${EAPI:-0}" in 20case "${EAPI:-0}" in
21 0|1) 21 0|1)
22 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|3) 24 2|3|4)
25 PERL_EXPF+=" src_prepare src_configure" 25 PERL_EXPF+=" src_prepare src_configure"
26 [[ ${CATEGORY} == "perl-core" ]] && \ 26 [[ ${CATEGORY} == "perl-core" ]] && \
27 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
32 RDEPEND="${DEPEND}" 32 RDEPEND="${DEPEND}"
33 ;; 33 ;;
34 esac 34 esac
35 ;; 35 ;;
36 *) 36 *)
37 DEPEND="EAPI-UNSUPPORTED" 37 die "EAPI=${EAPI} is not supported by perl-module.eclass"
38 ;; 38 ;;
39esac 39esac
40 40
41case "${PERL_EXPORT_PHASE_FUNCTIONS:-yes}" in 41case "${PERL_EXPORT_PHASE_FUNCTIONS:-yes}" in
42 yes) 42 yes)
44 ;; 44 ;;
45 no) 45 no)
46 debug-print "PERL_EXPORT_PHASE_FUNCTIONS=no" 46 debug-print "PERL_EXPORT_PHASE_FUNCTIONS=no"
47 ;; 47 ;;
48 *) 48 *)
49 DEPEND+=" PERL_EXPORT_PHASE_FUNCTIONS-UNSUPPORTED" 49 die "PERL_EXPORT_PHASE_FUNCTIONS=${PERL_EXPORT_PHASE_FUNCTIONS} is not supported by perl-module.eclass"
50 ;; 50 ;;
51esac 51esac
52 52
53DESCRIPTION="Based on the $ECLASS eclass" 53DESCRIPTION="Based on the $ECLASS eclass"
54 54
55LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}" 55LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}"
56 56
57[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz" 57if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then
58 : ${MY_P:=${MY_PN:-${PN}}-${MY_PV:-${MODULE_VERSION:-${PV}}}}
59 S=${MY_S:-${WORKDIR}/${MY_P}}
60fi
61
62[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && \
63 MODULE_A="${MY_P:-${P}}.${MODULE_A_EXT:-tar.gz}"
58[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \ 64[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
59 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}" 65 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}"
60[[ -z "${HOMEPAGE}" ]] && \ 66[[ -z "${HOMEPAGE}" ]] && \
61 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/" 67 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/"
62 68
91 SRC_PREP="yes" 97 SRC_PREP="yes"
92 98
93 perl_set_version 99 perl_set_version
94 perl_set_eprefix 100 perl_set_eprefix
95 101
96 export PERL_MM_USE_DEFAULT=1 102 [[ -z ${pm_echovar} ]] && export PERL_MM_USE_DEFAULT=1
97 # Disable ExtUtils::AutoInstall from prompting 103 # Disable ExtUtils::AutoInstall from prompting
98 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" 104 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
99 105
106 if [[ $(declare -p myconf 2>&-) != "declare -a myconf="* ]]; then
107 local myconf_local=(${myconf})
108 else
109 local myconf_local=("${myconf[@]}")
110 fi
111
100 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then 112 if [[ ( ${PREFER_BUILDPL} == yes || ! -f Makefile.PL ) && -f Build.PL ]] ; then
101 einfo "Using Module::Build" 113 einfo "Using Module::Build"
102 if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != Module-Build ]] ; then 114 if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != Module-Build ]] ; then
103 ewarn "QA Notice: The ebuild uses Module::Build but doesn't depend on it." 115 eqawarn "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
104 ewarn " Add virtual/perl-Module-Build to DEPEND!" 116 eqawarn " Add virtual/perl-Module-Build to DEPEND!"
117 if [[ -n ${PERLQAFATAL} ]]; then
118 eerror "Bailing out due to PERLQAFATAL=1";
119 die;
120 fi
105 fi 121 fi
106 set -- \ 122 set -- \
107 --installdirs=vendor \ 123 --installdirs=vendor \
108 --libdoc= \ 124 --libdoc= \
109 --destdir="${D}" \ 125 --destdir="${D}" \
110 --create_packlist=0 \ 126 --create_packlist=0 \
111 ${myconf} 127 "${myconf_local[@]}"
112 einfo "perl Build.PL" "$@" 128 einfo "perl Build.PL" "$@"
113 perl Build.PL "$@" <<< "${pm_echovar}" \ 129 perl Build.PL "$@" <<< "${pm_echovar}" \
114 || die "Unable to build! (are you using USE=\"build\"?)" 130 || die "Unable to build!"
115 elif [[ -f Makefile.PL ]] ; then 131 elif [[ -f Makefile.PL ]] ; then
116 einfo "Using ExtUtils::MakeMaker" 132 einfo "Using ExtUtils::MakeMaker"
117 set -- \ 133 set -- \
118 PREFIX=${EPREFIX}/usr \ 134 PREFIX=${EPREFIX}/usr \
119 INSTALLDIRS=vendor \ 135 INSTALLDIRS=vendor \
120 INSTALLMAN3DIR='none' \ 136 INSTALLMAN3DIR='none' \
121 DESTDIR="${D}" \ 137 DESTDIR="${D}" \
122 ${myconf} 138 "${myconf_local[@]}"
123 einfo "perl Makefile.PL" "$@" 139 einfo "perl Makefile.PL" "$@"
124 perl Makefile.PL "$@" <<< "${pm_echovar}" \ 140 perl Makefile.PL "$@" <<< "${pm_echovar}" \
125 || die "Unable to build! (are you using USE=\"build\"?)" 141 || die "Unable to build!"
126 fi 142 fi
127 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then 143 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
128 einfo "No Make or Build file detected..." 144 einfo "No Make or Build file detected..."
129 return 145 return
130 fi 146 fi
134 debug-print-function $FUNCNAME "$@" 150 debug-print-function $FUNCNAME "$@"
135 perl_set_version 151 perl_set_version
136 152
137 has src_configure ${PERL_EXPF} || perl-module_src_prep 153 has src_configure ${PERL_EXPF} || perl-module_src_prep
138 154
155 if [[ $(declare -p mymake 2>&-) != "declare -a mymake="* ]]; then
156 local mymake_local=(${mymake})
157 else
158 local mymake_local=("${mymake[@]}")
159 fi
160
139 if [[ -f Build ]] ; then 161 if [[ -f Build ]] ; then
140 ./Build build \ 162 ./Build build \
141 || die "compilation failed" 163 || die "Compilation failed"
142 elif [[ -f Makefile ]] ; then 164 elif [[ -f Makefile ]] ; then
143 emake \ 165 set -- \
144 OTHERLDFLAGS="${LDFLAGS}" \ 166 OTHERLDFLAGS="${LDFLAGS}" \
145 ${mymake} \ 167 "${mymake_local[@]}"
168 einfo "emake" "$@"
169 emake "$@" \
146 || die "compilation failed" 170 || die "Compilation failed"
147# OPTIMIZE="${CFLAGS}" \ 171# OPTIMIZE="${CFLAGS}" \
148 fi 172 fi
149} 173}
150 174
151# For testers: 175# For testers:
171 195
172perl-module_src_test() { 196perl-module_src_test() {
173 debug-print-function $FUNCNAME "$@" 197 debug-print-function $FUNCNAME "$@"
174 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then 198 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
175 if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then 199 if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then
176 export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" ) 200 export HARNESS_OPTIONS=j$(makeopts_jobs)
177 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}" 201 einfo "Test::Harness Jobs=$(makeopts_jobs)"
178 fi 202 fi
179 ${perlinfo_done} || perl_set_version 203 ${perlinfo_done} || perl_set_version
180 if [[ -f Build ]] ; then 204 if [[ -f Build ]] ; then
181 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" 205 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
182 elif [[ -f Makefile ]] ; then 206 elif [[ -f Makefile ]] ; then
198 dev-perl|perl-core) mytargets="pure_install" ;; 222 dev-perl|perl-core) mytargets="pure_install" ;;
199 *) mytargets="install" ;; 223 *) mytargets="install" ;;
200 esac 224 esac
201 fi 225 fi
202 226
227 if [[ $(declare -p myinst 2>&-) != "declare -a myinst="* ]]; then
228 local myinst_local=(${myinst})
229 else
230 local myinst_local=("${myinst[@]}")
231 fi
232
203 if [[ -f Build ]] ; then 233 if [[ -f Build ]] ; then
204 ./Build ${mytargets} \ 234 ./Build ${mytargets} \
205 || die "./Build ${mytargets} failed" 235 || die "./Build ${mytargets} failed"
206 elif [[ -f Makefile ]] ; then 236 elif [[ -f Makefile ]] ; then
207 emake ${myinst} ${mytargets} \ 237 emake "${myinst_local[@]}" ${mytargets} \
208 || die "emake ${myinst} ${mytargets} failed" 238 || die "emake ${myinst_local[@]} ${mytargets} failed"
209 fi 239 fi
210 240
211 perl_delete_module_manpages 241 perl_delete_module_manpages
212 perl_delete_localpod 242 perl_delete_localpod
213 perl_delete_packlist 243 perl_delete_packlist
308 338
309 339
310perl_delete_packlist() { 340perl_delete_packlist() {
311 debug-print-function $FUNCNAME "$@" 341 debug-print-function $FUNCNAME "$@"
312 perl_set_version 342 perl_set_version
313 if [[ -d ${D}/${VENDOR_LIB} ]] ; then 343 if [[ -d ${D}/${VENDOR_ARCH} ]] ; then
314 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \ 344 find "${D}/${VENDOR_ARCH}" -type f -a \( -name .packlist \
315 -o \( -name '*.bs' -a -empty \) \) -delete 345 -o \( -name '*.bs' -a -empty \) \) -delete
316 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete 346 find "${D}" -depth -mindepth 1 -type d -empty -delete
317 fi 347 fi
318} 348}
319 349
320perl_remove_temppath() { 350perl_remove_temppath() {
321 debug-print-function $FUNCNAME "$@" 351 debug-print-function $FUNCNAME "$@"
337 perl_set_eprefix 367 perl_set_eprefix
338 368
339 local i ff 369 local i ff
340 if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then 370 if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then
341 for i in "${DUALLIFESCRIPTS[@]}" ; do 371 for i in "${DUALLIFESCRIPTS[@]}" ; do
342 alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-[0-9]*" 372 alternatives_auto_makesym "/${i}" "/${i}-[0-9]*"
373 done
374 for i in "${DUALLIFEMAN[@]}" ; do
343 ff=`echo "${EROOT}"/usr/share/man/man1/${i}-${PV}-${P}.1*` 375 ff=`echo "${EROOT}"/${i%.1}-${PV}-${P}.1*`
344 ff=${ff##*.1} 376 ff=${ff##*.1}
345 alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-[0-9]*" 377 alternatives_auto_makesym "/${i}${ff}" "/${i%.1}-[0-9]*"
346 done 378 done
347 else 379 else
348 pushd "${ED}" > /dev/null 380 pushd "${ED}" > /dev/null
349 for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do 381 for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do
350 mv ${i}{,-${PV}-${P}} || die 382 mv ${i}{,-${PV}-${P}} || die
351 DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/} 383 #DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/}
352 if [[ -f usr/share/man/man1/${i##*/}.1 ]] ; then 384 DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i}
353 mv usr/share/man/man1/${i##*/}{.1,-${PV}-${P}.1} || die 385 done
354 fi 386 for i in $(find usr/share/man/man1 -maxdepth 1 -type f 2>/dev/null) ; do
387 mv ${i} ${i%.1}-${PV}-${P}.1 || die
388 DUALLIFEMAN[${#DUALLIFEMAN[*]}]=${i}
355 done 389 done
356 popd > /dev/null 390 popd > /dev/null
357 fi 391 fi
358} 392}
359 393

Legend:
Removed from v.1.124  
changed lines
  Added in v.1.132

  ViewVC Help
Powered by ViewVC 1.1.20