/[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.115 Revision 1.122
1# Copyright 1999-2004 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.115 2009/03/26 17:40:23 tove Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.122 2010/02/03 00:20:07 hanno 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:
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
15inherit eutils base 15inherit eutils base
16[[ ${CATEGORY} == "perl-core" ]] && inherit alternatives
17
18PERL_EXPF="src_unpack src_compile src_test src_install"
16 19
17case "${EAPI:-0}" in 20case "${EAPI:-0}" in
18 0|1) 21 0|1)
19 EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm src_compile src_install src_test src_unpack 22 PERL_EXPF="${PERL_EXPF} pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm"
20 ;; 23 ;;
21 2) 24 2)
22 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install 25 PERL_EXPF="${PERL_EXPF} src_prepare src_configure"
26 [[ ${CATEGORY} == "perl-core" ]] && \
27 PERL_EXPF="${PERL_EXPF} pkg_postinst pkg_postrm"
23 28
24 case "${GENTOO_DEPEND_ON_PERL:-yes}" in 29 case "${GENTOO_DEPEND_ON_PERL:-yes}" in
25 yes) 30 yes)
26 DEPEND="dev-lang/perl[-build]" 31 DEPEND="dev-lang/perl[-build]"
27 RDEPEND="${DEPEND}" 32 RDEPEND="${DEPEND}"
28 ;; 33 ;;
29 esac 34 esac
30 ;; 35 ;;
31esac 36esac
32 37
38EXPORT_FUNCTIONS ${PERL_EXPF}
39
33DESCRIPTION="Based on the $ECLASS eclass" 40DESCRIPTION="Based on the $ECLASS eclass"
34 41
35LICENSE="${LICENSE:-|| ( Artistic GPL-2 )}" 42LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}"
36 43
37[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz" 44[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz"
38[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \ 45[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
39 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION}/${MODULE_A}" 46 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION}/${MODULE_A}"
40[[ -z "${HOMEPAGE}" ]] && \ 47[[ -z "${HOMEPAGE}" ]] && \
41 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}" 48 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/"
42 49
43SRC_PREP="no" 50SRC_PREP="no"
44SRC_TEST="skip" 51SRC_TEST="skip"
45PREFER_BUILDPL="yes" 52PREFER_BUILDPL="yes"
46 53
53 60
54pm_echovar="" 61pm_echovar=""
55perlinfo_done=false 62perlinfo_done=false
56 63
57perl-module_src_unpack() { 64perl-module_src_unpack() {
58 base_src_unpack unpack 65 base_src_unpack
59 has "${EAPI:-0}" 0 1 && perl-module_src_prepare 66 has src_prepare ${PERL_EXPF} || perl-module_src_prepare
60} 67}
61 68
62perl-module_src_prepare() { 69perl-module_src_prepare() {
63 if [[ -n ${PATCHES} ]] ; then 70 has src_prepare ${PERL_EXPF} && base_src_prepare
64 base_src_unpack autopatch
65 fi
66 esvn_clean 71 esvn_clean
67} 72}
68 73
69perl-module_src_configure() { 74perl-module_src_configure() {
70 perl-module_src_prep 75 perl-module_src_prep
71} 76}
72 77
73perl-module_src_prep() { 78perl-module_src_prep() {
74 [[ "${SRC_PREP}" = "yes" ]] && return 0 79 [[ ${SRC_PREP} = yes ]] && return 0
75 SRC_PREP="yes" 80 SRC_PREP="yes"
76 81
77 ${perlinfo_done} || perlinfo 82 ${perlinfo_done} || perlinfo
78 83
79 export PERL_MM_USE_DEFAULT=1 84 export PERL_MM_USE_DEFAULT=1
80 # Disable ExtUtils::AutoInstall from prompting 85 # Disable ExtUtils::AutoInstall from prompting
81 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" 86 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
82 87
83 if [[ "${PREFER_BUILDPL}" == "yes" && -f Build.PL ]] ; then 88 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then
84 einfo "Using Module::Build" 89 einfo "Using Module::Build"
90 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."
92 ewarn " Add virtual/perl-Module-Build to DEPEND!"
93 fi
85 perl Build.PL \ 94 perl Build.PL \
86 --installdirs=vendor \ 95 --installdirs=vendor \
87 --libdoc= \ 96 --libdoc= \
88 --destdir="${D}" \ 97 --destdir="${D}" \
89 --create_packlist=0 \ 98 --create_packlist=0 \
90 --extra_linker_flags="${LDFLAGS}" \
91 ${myconf} \ 99 ${myconf} \
92 <<< "${pm_echovar}" \ 100 <<< "${pm_echovar}" \
93 || die "Unable to build! (are you using USE=\"build\"?)" 101 || die "Unable to build! (are you using USE=\"build\"?)"
94 elif [[ -f Makefile.PL ]] ; then 102 elif [[ -f Makefile.PL ]] ; then
95 einfo "Using ExtUtils::MakeMaker" 103 einfo "Using ExtUtils::MakeMaker"
109} 117}
110 118
111perl-module_src_compile() { 119perl-module_src_compile() {
112 ${perlinfo_done} || perlinfo 120 ${perlinfo_done} || perlinfo
113 121
114 has "${EAPI:-0}" 0 1 && perl-module_src_prep 122 has src_configure ${PERL_EXPF} || perl-module_src_prep
115 123
116 if [[ -f Build ]] ; then 124 if [[ -f Build ]] ; then
117 ./Build build \ 125 ./Build build \
118 || die "compilation failed" 126 || die "compilation failed"
119 elif [[ -f Makefile ]] ; then 127 elif [[ -f Makefile ]] ; then
123 || die "compilation failed" 131 || die "compilation failed"
124# OPTIMIZE="${CFLAGS}" \ 132# OPTIMIZE="${CFLAGS}" \
125 fi 133 fi
126} 134}
127 135
136# For testers:
137# This code attempts to work out your threadingness from MAKEOPTS
138# and apply them to Test::Harness.
139#
140# If you want more verbose testing, set TEST_VERBOSE=1
141# in your bashrc | /etc/make.conf | ENV
142#
143# For ebuild writers:
144# If you wish to enable default tests w/ 'make test' ,
145#
146# SRC_TEST="do"
147#
148# If you wish to have threads run in parallel ( using the users makeopts )
149# all of the following have been tested to work.
150#
151# SRC_TEST="do parallel"
152# SRC_TEST="parallel"
153# SRC_TEST="parallel do"
154# SRC_TEST=parallel
155#
156
128perl-module_src_test() { 157perl-module_src_test() {
129 if [[ "${SRC_TEST}" == "do" ]] ; then 158 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
159 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/" )
161 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}"
162 fi
130 ${perlinfo_done} || perlinfo 163 ${perlinfo_done} || perlinfo
131 if [[ -f Build ]] ; then 164 if [[ -f Build ]] ; then
132 ./Build test || die "test failed" 165 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
133 elif [[ -f Makefile ]] ; then 166 elif [[ -f Makefile ]] ; then
134 emake test || die "test failed" 167 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
135 fi 168 fi
136 fi 169 fi
137} 170}
138 171
139perl-module_src_install() { 172perl-module_src_install() {
161 find "${D}"/usr/share/man -depth -type d -empty -delete 194 find "${D}"/usr/share/man -depth -type d -empty -delete
162 fi 195 fi
163 196
164 fixlocalpod 197 fixlocalpod
165 198
166 for f in Change* CHANGES README* ${mydoc}; do 199 for f in Change* CHANGES README* TODO ${mydoc}; do
167 [[ -s "${f}" ]] && dodoc ${f} 200 [[ -s ${f} ]] && dodoc ${f}
168 done 201 done
169 202
170 if [[ -d "${D}/${VENDOR_LIB}" ]] ; then 203 if [[ -d ${D}/${VENDOR_LIB} ]] ; then
171 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \ 204 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
172 -o \( -name '*.bs' -a -empty \) \) -delete 205 -o \( -name '*.bs' -a -empty \) \) -delete
173 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete 206 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
174 fi 207 fi
175 208
176 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do 209 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
177 if file "${f}" | grep -q -i " text" ; then 210 if file "${f}" | grep -q -i " text" ; then
178if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ;fi 211 grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
179 sed -i -e "s:${D}:/:g" "${f}" 212 sed -i -e "s:${D}:/:g" "${f}"
180 fi 213 fi
181 done 214 done
215
216 linkduallifescripts
182} 217}
183 218
184perl-module_pkg_setup() { 219perl-module_pkg_setup() {
185 ${perlinfo_done} || perlinfo 220 ${perlinfo_done} || perlinfo
186} 221}
187 222
188perl-module_pkg_preinst() { 223perl-module_pkg_preinst() {
189 ${perlinfo_done} || perlinfo 224 ${perlinfo_done} || perlinfo
190} 225}
191 226
192perl-module_pkg_postinst() { : ; } 227perl-module_pkg_postinst() {
193# einfo "Man pages are not installed for most modules now." 228 linkduallifescripts
194# einfo "Please use perldoc instead." 229}
195#}
196 230
197perl-module_pkg_prerm() { : ; } 231perl-module_pkg_prerm() { : ; }
198 232
199perl-module_pkg_postrm() { : ; } 233perl-module_pkg_postrm() {
234 linkduallifescripts
235}
200 236
201perlinfo() { 237perlinfo() {
202 perlinfo_done=true 238 perlinfo_done=true
203 239
204 local f version install{site{arch,lib},archlib,vendor{arch,lib}} 240 local f version install{{site,vendor}{arch,lib},archlib}
205 for f in version install{site{arch,lib},archlib,vendor{arch,lib}} ; do 241 for f in version install{{site,vendor}{arch,lib},archlib} ; do
206 eval "$(perl -V:${f} )" 242 eval "$(perl -V:${f} )"
207 done 243 done
208 PERL_VERSION=${version} 244 PERL_VERSION=${version}
209 SITE_ARCH=${installsitearch} 245 SITE_ARCH=${installsitearch}
210 SITE_LIB=${installsitelib} 246 SITE_LIB=${installsitelib}
215 251
216fixlocalpod() { 252fixlocalpod() {
217 find "${D}" -type f -name perllocal.pod -delete 253 find "${D}" -type f -name perllocal.pod -delete
218 find "${D}" -depth -mindepth 1 -type d -empty -delete 254 find "${D}" -depth -mindepth 1 -type d -empty -delete
219} 255}
256
257linkduallifescripts() {
258 if [[ ${CATEGORY} != perl-core ]] || ! has_version ">=dev-lang/perl-5.8.8-r8" ; then
259 return 0
260 fi
261
262 local i ff
263 if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then
264 for i in "${DUALLIFESCRIPTS[@]}" ; do
265 alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-[0-9]*"
266 ff=`echo "${ROOT}"/usr/share/man/man1/${i}-${PV}-${P}.1*`
267 ff=${ff##*.1}
268 alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-[0-9]*"
269 done
270 else
271 pushd "${D}" > /dev/null
272 for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do
273 mv ${i}{,-${PV}-${P}} || die
274 DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/}
275 if [[ -f usr/share/man/man1/${i##*/}.1 ]] ; then
276 mv usr/share/man/man1/${i##*/}{.1,-${PV}-${P}.1} || die
277 fi
278 done
279 popd > /dev/null
280 fi
281}

Legend:
Removed from v.1.115  
changed lines
  Added in v.1.122

  ViewVC Help
Powered by ViewVC 1.1.20