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

Contents of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.134 - (hide annotations) (download)
Sat Sep 15 16:16:53 2012 UTC (23 months, 2 weeks ago) by zmedico
Branch: MAIN
Changes since 1.133: +2 -4 lines
Remove redundant DESCRIPTION variable settings.

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

  ViewVC Help
Powered by ViewVC 1.1.20