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

Contents of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.143 - (hide annotations) (download)
Mon Oct 20 12:47:32 2014 UTC (3 years, 10 months ago) by dilfridge
Branch: MAIN
Changes since 1.142: +2 -1 lines
Output which ebuild actually has bad EAPI

1 dilfridge 1.140 # Copyright 1999-2014 Gentoo Foundation
2 vapier 1.30 # Distributed under the terms of the GNU General Public License v2
3 dilfridge 1.143 # $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.142 2014/10/19 20:59:15 dilfridge Exp $
4 tove 1.113
5     # @ECLASS: perl-module.eclass
6     # @MAINTAINER:
7     # perl@gentoo.org
8 vapier 1.131 # @AUTHOR:
9     # Seemant Kulleen <seemant@gentoo.org>
10 tove 1.113 # @BLURB: eclass for perl modules
11     # @DESCRIPTION:
12 seemant 1.1 # The perl-module eclass is designed to allow easier installation of perl
13     # modules, and their incorporation into the Gentoo Linux system.
14 seemant 1.3
15 zlogene 1.139 inherit eutils multiprocessing unpacker
16 tove 1.124 [[ ${CATEGORY} == "perl-core" ]] && inherit alternatives
17 tove 1.117
18     PERL_EXPF="src_unpack src_compile src_test src_install"
19 tove 1.113
20     case "${EAPI:-0}" in
21 dilfridge 1.141 0|1)
22 tove 1.124 PERL_EXPF+=" pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm"
23 tove 1.113 ;;
24 dilfridge 1.141 2|3|4|5)
25 tove 1.124 PERL_EXPF+=" src_prepare src_configure"
26 tove 1.117 [[ ${CATEGORY} == "perl-core" ]] && \
27 tove 1.124 PERL_EXPF+=" pkg_postinst pkg_postrm"
28 tove 1.113
29     case "${GENTOO_DEPEND_ON_PERL:-yes}" in
30 dilfridge 1.138 yes)
31     case "${EAPI:-0}" in
32     5)
33     case "${GENTOO_DEPEND_ON_PERL_SUBSLOT:-yes}" in
34     yes)
35     DEPEND="dev-lang/perl:=[-build(-)]"
36     ;;
37     *)
38     DEPEND="dev-lang/perl[-build(-)]"
39     ;;
40     esac
41     ;;
42     *)
43 mattst88 1.137 DEPEND="|| ( >=dev-lang/perl-5.16 <dev-lang/perl-5.16[-build] )"
44 tove 1.113 ;;
45 dilfridge 1.138 esac
46     RDEPEND="${DEPEND}"
47     ;;
48 tove 1.113 esac
49     ;;
50 tove 1.123 *)
51 tove 1.127 die "EAPI=${EAPI} is not supported by perl-module.eclass"
52 tove 1.123 ;;
53 tove 1.113 esac
54 danarmak 1.13
55 dilfridge 1.142 case "${EAPI:-0}" in
56     4|5)
57     ;;
58     *)
59     ewarn
60     ewarn "******************************************************************"
61 dilfridge 1.143 ewarn "${EBUILD}:"
62 dilfridge 1.142 ewarn "Support for EAPI=${EAPI:-0} in perl-module.eclass will be removed"
63     ewarn "on 1/Nov/2014. Please fix your overlay ebuilds to use EAPI=5."
64     ewarn "******************************************************************"
65     ewarn
66     ;;
67     esac
68    
69 tove 1.124 case "${PERL_EXPORT_PHASE_FUNCTIONS:-yes}" in
70     yes)
71     EXPORT_FUNCTIONS ${PERL_EXPF}
72     ;;
73     no)
74     debug-print "PERL_EXPORT_PHASE_FUNCTIONS=no"
75     ;;
76     *)
77 tove 1.127 die "PERL_EXPORT_PHASE_FUNCTIONS=${PERL_EXPORT_PHASE_FUNCTIONS} is not supported by perl-module.eclass"
78 tove 1.124 ;;
79     esac
80 tove 1.117
81 hanno 1.122 LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}"
82 robbat2 1.109
83 tove 1.127 if [[ -n ${MY_PN} || -n ${MY_PV} || -n ${MODULE_VERSION} ]] ; then
84     : ${MY_P:=${MY_PN:-${PN}}-${MY_PV:-${MODULE_VERSION:-${PV}}}}
85     S=${MY_S:-${WORKDIR}/${MY_P}}
86     fi
87 tove 1.130
88 robbat2 1.128 [[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && \
89     MODULE_A="${MY_P:-${P}}.${MODULE_A_EXT:-tar.gz}"
90 tove 1.113 [[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
91 tove 1.123 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}"
92 tove 1.113 [[ -z "${HOMEPAGE}" ]] && \
93 tove 1.118 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/"
94 mcummings 1.66
95 azarah 1.11 SRC_PREP="no"
96 rac 1.55 SRC_TEST="skip"
97 mcummings 1.97 PREFER_BUILDPL="yes"
98 azarah 1.11
99 mcummings 1.101 pm_echovar=""
100 tove 1.113 perlinfo_done=false
101 seemant 1.35
102 mcummings 1.102 perl-module_src_unpack() {
103 tove 1.123 debug-print-function $FUNCNAME "$@"
104 dilfridge 1.141
105     case "${EAPI:-0}" in
106 dilfridge 1.142 5)
107     ;;
108     4)
109     eqawarn "Support for EAPI=${EAPI:-0} in perl-module.eclass is deprecated."
110     eqawarn "Please fix your ebuilds to use EAPI=5."
111 dilfridge 1.141 ;;
112     *)
113     ;;
114     esac
115    
116 zlogene 1.139 unpacker_src_unpack
117 tove 1.117 has src_prepare ${PERL_EXPF} || perl-module_src_prepare
118 tove 1.113 }
119    
120     perl-module_src_prepare() {
121 tove 1.123 debug-print-function $FUNCNAME "$@"
122 zlogene 1.139 has src_prepare ${PERL_EXPF} && \
123     [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
124     debug-print "$FUNCNAME: applying user patches"
125     epatch_user
126 tove 1.123 perl_fix_osx_extra
127 tove 1.113 esvn_clean
128     }
129    
130     perl-module_src_configure() {
131 tove 1.123 debug-print-function $FUNCNAME "$@"
132 tove 1.113 perl-module_src_prep
133 mcummings 1.102 }
134    
135 aliz 1.15 perl-module_src_prep() {
136 tove 1.123 debug-print-function $FUNCNAME "$@"
137 tove 1.117 [[ ${SRC_PREP} = yes ]] && return 0
138 tove 1.113 SRC_PREP="yes"
139 rac 1.60
140 tove 1.123 perl_set_version
141     perl_set_eprefix
142 rac 1.60
143 tove 1.130 [[ -z ${pm_echovar} ]] && export PERL_MM_USE_DEFAULT=1
144 mcummings 1.90 # Disable ExtUtils::AutoInstall from prompting
145     export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
146 rac 1.64
147 tove 1.127 if [[ $(declare -p myconf 2>&-) != "declare -a myconf="* ]]; then
148     local myconf_local=(${myconf})
149     else
150     local myconf_local=("${myconf[@]}")
151     fi
152    
153     if [[ ( ${PREFER_BUILDPL} == yes || ! -f Makefile.PL ) && -f Build.PL ]] ; then
154 mcummings 1.97 einfo "Using Module::Build"
155 tove 1.120 if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != Module-Build ]] ; then
156 tove 1.126 eqawarn "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
157     eqawarn " Add virtual/perl-Module-Build to DEPEND!"
158 tove 1.127 if [[ -n ${PERLQAFATAL} ]]; then
159     eerror "Bailing out due to PERLQAFATAL=1";
160     die;
161     fi
162 tove 1.120 fi
163 tove 1.123 set -- \
164 tove 1.113 --installdirs=vendor \
165     --libdoc= \
166     --destdir="${D}" \
167     --create_packlist=0 \
168 tove 1.127 "${myconf_local[@]}"
169 tove 1.123 einfo "perl Build.PL" "$@"
170     perl Build.PL "$@" <<< "${pm_echovar}" \
171 tove 1.127 || die "Unable to build!"
172 tove 1.113 elif [[ -f Makefile.PL ]] ; then
173 mcummings 1.85 einfo "Using ExtUtils::MakeMaker"
174 tove 1.123 set -- \
175     PREFIX=${EPREFIX}/usr \
176 tove 1.113 INSTALLDIRS=vendor \
177     INSTALLMAN3DIR='none' \
178     DESTDIR="${D}" \
179 tove 1.127 "${myconf_local[@]}"
180 tove 1.123 einfo "perl Makefile.PL" "$@"
181     perl Makefile.PL "$@" <<< "${pm_echovar}" \
182 tove 1.127 || die "Unable to build!"
183 mcummings 1.88 fi
184 tove 1.113 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
185 mcummings 1.88 einfo "No Make or Build file detected..."
186 mcummings 1.85 return
187 mcummings 1.43 fi
188 azarah 1.11 }
189    
190 aliz 1.15 perl-module_src_compile() {
191 tove 1.123 debug-print-function $FUNCNAME "$@"
192     perl_set_version
193 tove 1.113
194 tove 1.117 has src_configure ${PERL_EXPF} || perl-module_src_prep
195 seemant 1.6
196 tove 1.127 if [[ $(declare -p mymake 2>&-) != "declare -a mymake="* ]]; then
197     local mymake_local=(${mymake})
198     else
199     local mymake_local=("${mymake[@]}")
200     fi
201    
202 tove 1.113 if [[ -f Build ]] ; then
203     ./Build build \
204 tove 1.127 || die "Compilation failed"
205 tove 1.113 elif [[ -f Makefile ]] ; then
206 tove 1.127 set -- \
207 tove 1.113 OTHERLDFLAGS="${LDFLAGS}" \
208 tove 1.127 "${mymake_local[@]}"
209     einfo "emake" "$@"
210     emake "$@" \
211     || die "Compilation failed"
212 tove 1.113 # OPTIMIZE="${CFLAGS}" \
213 mcummings 1.43 fi
214 seemant 1.8 }
215    
216 tove 1.117 # For testers:
217     # This code attempts to work out your threadingness from MAKEOPTS
218     # and apply them to Test::Harness.
219     #
220     # If you want more verbose testing, set TEST_VERBOSE=1
221 zmedico 1.136 # in your bashrc | /etc/portage/make.conf | ENV
222 tove 1.117 #
223     # For ebuild writers:
224     # If you wish to enable default tests w/ 'make test' ,
225     #
226     # SRC_TEST="do"
227     #
228     # If you wish to have threads run in parallel ( using the users makeopts )
229     # all of the following have been tested to work.
230     #
231     # SRC_TEST="do parallel"
232     # SRC_TEST="parallel"
233     # SRC_TEST="parallel do"
234     # SRC_TEST=parallel
235     #
236    
237 aliz 1.15 perl-module_src_test() {
238 tove 1.123 debug-print-function $FUNCNAME "$@"
239 tove 1.117 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
240     if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then
241 vapier 1.132 export HARNESS_OPTIONS=j$(makeopts_jobs)
242     einfo "Test::Harness Jobs=$(makeopts_jobs)"
243 tove 1.117 fi
244 tove 1.123 ${perlinfo_done} || perl_set_version
245 tove 1.113 if [[ -f Build ]] ; then
246 tove 1.117 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
247 tove 1.113 elif [[ -f Makefile ]] ; then
248 tove 1.117 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
249 mcummings 1.68 fi
250 mcummings 1.43 fi
251 seemant 1.1 }
252    
253 aliz 1.15 perl-module_src_install() {
254 tove 1.123 debug-print-function $FUNCNAME "$@"
255    
256     perl_set_version
257     perl_set_eprefix
258    
259 tove 1.113 local f
260 swegener 1.76
261 tove 1.114 if [[ -z ${mytargets} ]] ; then
262     case "${CATEGORY}" in
263     dev-perl|perl-core) mytargets="pure_install" ;;
264     *) mytargets="install" ;;
265     esac
266     fi
267 swegener 1.76
268 tove 1.127 if [[ $(declare -p myinst 2>&-) != "declare -a myinst="* ]]; then
269     local myinst_local=(${myinst})
270     else
271     local myinst_local=("${myinst[@]}")
272     fi
273    
274 tove 1.113 if [[ -f Build ]] ; then
275     ./Build ${mytargets} \
276     || die "./Build ${mytargets} failed"
277     elif [[ -f Makefile ]] ; then
278 tove 1.127 emake "${myinst_local[@]}" ${mytargets} \
279     || die "emake ${myinst_local[@]} ${mytargets} failed"
280 tove 1.113 fi
281    
282 tove 1.123 perl_delete_module_manpages
283     perl_delete_localpod
284     perl_delete_packlist
285     perl_remove_temppath
286 mcummings 1.20
287 tove 1.123 for f in Change* CHANGES README* TODO FAQ ${mydoc}; do
288 tove 1.117 [[ -s ${f} ]] && dodoc ${f}
289 mcummings 1.98 done
290 mcummings 1.65
291 tove 1.123 perl_link_duallife_scripts
292 seemant 1.35 }
293    
294     perl-module_pkg_setup() {
295 tove 1.123 debug-print-function $FUNCNAME "$@"
296     perl_set_version
297 seemant 1.35 }
298    
299     perl-module_pkg_preinst() {
300 tove 1.123 debug-print-function $FUNCNAME "$@"
301     perl_set_version
302 seemant 1.35 }
303    
304 tove 1.117 perl-module_pkg_postinst() {
305 tove 1.123 debug-print-function $FUNCNAME "$@"
306     perl_link_duallife_scripts
307 tove 1.117 }
308 seemant 1.35
309 tove 1.123 perl-module_pkg_prerm() {
310     debug-print-function $FUNCNAME "$@"
311     }
312 seemant 1.35
313 tove 1.117 perl-module_pkg_postrm() {
314 tove 1.123 debug-print-function $FUNCNAME "$@"
315     perl_link_duallife_scripts
316 tove 1.117 }
317 tove 1.124
318     perlinfo() {
319     debug-print-function $FUNCNAME "$@"
320     perl_set_version
321     }
322    
323     perl_set_version() {
324     debug-print-function $FUNCNAME "$@"
325     debug-print "$FUNCNAME: perlinfo_done=${perlinfo_done}"
326     ${perlinfo_done} && return 0
327     perlinfo_done=true
328    
329     local f version install{{site,vendor}{arch,lib},archlib}
330     eval "$(perl -V:{version,install{{site,vendor}{arch,lib},archlib}} )"
331     PERL_VERSION=${version}
332     SITE_ARCH=${installsitearch}
333     SITE_LIB=${installsitelib}
334     ARCH_LIB=${installarchlib}
335     VENDOR_LIB=${installvendorlib}
336     VENDOR_ARCH=${installvendorarch}
337     }
338    
339     fixlocalpod() {
340     debug-print-function $FUNCNAME "$@"
341     perl_delete_localpod
342     }
343    
344     perl_delete_localpod() {
345     debug-print-function $FUNCNAME "$@"
346    
347     find "${D}" -type f -name perllocal.pod -delete
348     find "${D}" -depth -mindepth 1 -type d -empty -delete
349     }
350    
351     perl_fix_osx_extra() {
352     debug-print-function $FUNCNAME "$@"
353    
354     # Remove "AppleDouble encoded Macintosh file"
355     local f
356     find "${S}" -type f -name "._*" -print0 | while read -rd '' f ; do
357     einfo "Removing AppleDouble encoded Macintosh file: ${f#${S}/}"
358     rm -f "${f}"
359     f=${f#${S}/}
360     # f=${f//\//\/}
361     # f=${f//\./\.}
362     # sed -i "/${f}/d" "${S}"/MANIFEST || die
363     grep -q "${f}" "${S}"/MANIFEST && \
364     elog "AppleDouble encoded Macintosh file in MANIFEST: ${f#${S}/}"
365     done
366     }
367    
368     perl_delete_module_manpages() {
369     debug-print-function $FUNCNAME "$@"
370    
371     perl_set_eprefix
372    
373     if [[ -d "${ED}"/usr/share/man ]] ; then
374     # einfo "Cleaning out stray man files"
375     find "${ED}"/usr/share/man -type f -name "*.3pm" -delete
376     find "${ED}"/usr/share/man -depth -type d -empty -delete
377     fi
378     }
379    
380    
381     perl_delete_packlist() {
382     debug-print-function $FUNCNAME "$@"
383     perl_set_version
384 tove 1.125 if [[ -d ${D}/${VENDOR_ARCH} ]] ; then
385     find "${D}/${VENDOR_ARCH}" -type f -a \( -name .packlist \
386 tove 1.124 -o \( -name '*.bs' -a -empty \) \) -delete
387 tove 1.125 find "${D}" -depth -mindepth 1 -type d -empty -delete
388 tove 1.124 fi
389     }
390    
391     perl_remove_temppath() {
392     debug-print-function $FUNCNAME "$@"
393    
394     find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
395     if file "${f}" | grep -q -i " text" ; then
396     grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
397     sed -i -e "s:${D}:/:g" "${f}"
398     fi
399     done
400     }
401    
402     perl_link_duallife_scripts() {
403     debug-print-function $FUNCNAME "$@"
404     if [[ ${CATEGORY} != perl-core ]] || ! has_version ">=dev-lang/perl-5.8.8-r8" ; then
405     return 0
406     fi
407    
408     perl_set_eprefix
409    
410     local i ff
411     if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then
412     for i in "${DUALLIFESCRIPTS[@]}" ; do
413 tove 1.130 alternatives_auto_makesym "/${i}" "/${i}-[0-9]*"
414     done
415     for i in "${DUALLIFEMAN[@]}" ; do
416     ff=`echo "${EROOT}"/${i%.1}-${PV}-${P}.1*`
417 tove 1.124 ff=${ff##*.1}
418 tove 1.130 alternatives_auto_makesym "/${i}${ff}" "/${i%.1}-[0-9]*"
419 tove 1.124 done
420     else
421     pushd "${ED}" > /dev/null
422     for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do
423     mv ${i}{,-${PV}-${P}} || die
424 tove 1.130 #DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/}
425     DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i}
426     done
427     for i in $(find usr/share/man/man1 -maxdepth 1 -type f 2>/dev/null) ; do
428     mv ${i} ${i%.1}-${PV}-${P}.1 || die
429     DUALLIFEMAN[${#DUALLIFEMAN[*]}]=${i}
430 tove 1.124 done
431     popd > /dev/null
432     fi
433     }
434    
435     perl_set_eprefix() {
436     debug-print-function $FUNCNAME "$@"
437     case ${EAPI:-0} in
438     0|1|2)
439     if ! use prefix; then
440     EPREFIX=
441     ED=${D}
442     EROOT=${ROOT}
443     fi
444     ;;
445     esac
446     }

  ViewVC Help
Powered by ViewVC 1.1.20