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

Contents of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.144 - (hide annotations) (download)
Sat Nov 1 17:34:28 2014 UTC (3 years, 2 months ago) by dilfridge
Branch: MAIN
Changes since 1.143: +17 -27 lines
Drop EAPI=0,1,2,3 support in perl-module.eclass, this time for real. Further cleanups will follow.

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

  ViewVC Help
Powered by ViewVC 1.1.20