/[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.118 Revision 1.123
1# Copyright 1999-2009 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.118 2009/11/10 12:53:53 tove Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.123 2010/04/17 19:56:27 tove 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:
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
15inherit eutils base 15inherit perl-helper eutils base
16[[ ${CATEGORY} == "perl-core" ]] && inherit alternatives
17 16
18PERL_EXPF="src_unpack src_compile src_test src_install" 17PERL_EXPF="src_unpack src_compile src_test src_install"
19 18
20case "${EAPI:-0}" in 19case "${EAPI:-0}" in
21 0|1) 20 0|1)
22 PERL_EXPF="${PERL_EXPF} pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm" 21 PERL_EXPF="${PERL_EXPF} pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm"
23 ;; 22 ;;
24 2) 23 2|3)
25 PERL_EXPF="${PERL_EXPF} src_prepare src_configure" 24 PERL_EXPF="${PERL_EXPF} src_prepare src_configure"
26 [[ ${CATEGORY} == "perl-core" ]] && \ 25 [[ ${CATEGORY} == "perl-core" ]] && \
27 PERL_EXPF="${PERL_EXPF} pkg_postinst pkg_postrm" 26 PERL_EXPF="${PERL_EXPF} pkg_postinst pkg_postrm"
28 27
29 case "${GENTOO_DEPEND_ON_PERL:-yes}" in 28 case "${GENTOO_DEPEND_ON_PERL:-yes}" in
31 DEPEND="dev-lang/perl[-build]" 30 DEPEND="dev-lang/perl[-build]"
32 RDEPEND="${DEPEND}" 31 RDEPEND="${DEPEND}"
33 ;; 32 ;;
34 esac 33 esac
35 ;; 34 ;;
35 *)
36 DEPEND="EAPI-UNSUPPORTED"
37 ;;
36esac 38esac
37 39
38EXPORT_FUNCTIONS ${PERL_EXPF} 40EXPORT_FUNCTIONS ${PERL_EXPF}
39 41
40DESCRIPTION="Based on the $ECLASS eclass" 42DESCRIPTION="Based on the $ECLASS eclass"
41 43
42LICENSE="${LICENSE:-|| ( Artistic GPL-2 )}" 44LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}"
43 45
44[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz" 46[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz"
45[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \ 47[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
46 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION}/${MODULE_A}" 48 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}"
47[[ -z "${HOMEPAGE}" ]] && \ 49[[ -z "${HOMEPAGE}" ]] && \
48 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/" 50 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/"
49 51
50SRC_PREP="no" 52SRC_PREP="no"
51SRC_TEST="skip" 53SRC_TEST="skip"
52PREFER_BUILDPL="yes" 54PREFER_BUILDPL="yes"
53 55
54PERL_VERSION=""
55SITE_ARCH=""
56SITE_LIB=""
57ARCH_LIB=""
58VENDOR_ARCH=""
59VENDOR_LIB=""
60
61pm_echovar="" 56pm_echovar=""
62perlinfo_done=false 57perlinfo_done=false
63 58
64perl-module_src_unpack() { 59perl-module_src_unpack() {
60 debug-print-function $FUNCNAME "$@"
65 base_src_unpack unpack 61 base_src_unpack
66 has src_prepare ${PERL_EXPF} || perl-module_src_prepare 62 has src_prepare ${PERL_EXPF} || perl-module_src_prepare
67} 63}
68 64
69perl-module_src_prepare() { 65perl-module_src_prepare() {
70 if [[ -n ${PATCHES} ]] ; then 66 debug-print-function $FUNCNAME "$@"
71 base_src_unpack autopatch 67 has src_prepare ${PERL_EXPF} && base_src_prepare
72 fi 68 perl_fix_osx_extra
73 esvn_clean 69 esvn_clean
74} 70}
75 71
76perl-module_src_configure() { 72perl-module_src_configure() {
73 debug-print-function $FUNCNAME "$@"
77 perl-module_src_prep 74 perl-module_src_prep
78} 75}
79 76
80perl-module_src_prep() { 77perl-module_src_prep() {
78 debug-print-function $FUNCNAME "$@"
81 [[ ${SRC_PREP} = yes ]] && return 0 79 [[ ${SRC_PREP} = yes ]] && return 0
82 SRC_PREP="yes" 80 SRC_PREP="yes"
83 81
84 ${perlinfo_done} || perlinfo 82 perl_set_version
83 perl_set_eprefix
85 84
86 export PERL_MM_USE_DEFAULT=1 85 export PERL_MM_USE_DEFAULT=1
87 # Disable ExtUtils::AutoInstall from prompting 86 # Disable ExtUtils::AutoInstall from prompting
88 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" 87 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
89 88
90 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then 89 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then
91 einfo "Using Module::Build" 90 einfo "Using Module::Build"
92 perl Build.PL \ 91 if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != Module-Build ]] ; then
92 ewarn "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
93 ewarn " Add virtual/perl-Module-Build to DEPEND!"
94 fi
95 set -- \
93 --installdirs=vendor \ 96 --installdirs=vendor \
94 --libdoc= \ 97 --libdoc= \
95 --destdir="${D}" \ 98 --destdir="${D}" \
96 --create_packlist=0 \ 99 --create_packlist=0 \
97 ${myconf} \ 100 ${myconf}
98 <<< "${pm_echovar}" \ 101 einfo "perl Build.PL" "$@"
102 perl Build.PL "$@" <<< "${pm_echovar}" \
99 || die "Unable to build! (are you using USE=\"build\"?)" 103 || die "Unable to build! (are you using USE=\"build\"?)"
100 elif [[ -f Makefile.PL ]] ; then 104 elif [[ -f Makefile.PL ]] ; then
101 einfo "Using ExtUtils::MakeMaker" 105 einfo "Using ExtUtils::MakeMaker"
102 perl Makefile.PL \ 106 set -- \
103 PREFIX=/usr \ 107 PREFIX=${EPREFIX}/usr \
104 INSTALLDIRS=vendor \ 108 INSTALLDIRS=vendor \
105 INSTALLMAN3DIR='none' \ 109 INSTALLMAN3DIR='none' \
106 DESTDIR="${D}" \ 110 DESTDIR="${D}" \
107 ${myconf} \ 111 ${myconf}
108 <<< "${pm_echovar}" \ 112 einfo "perl Makefile.PL" "$@"
113 perl Makefile.PL "$@" <<< "${pm_echovar}" \
109 || die "Unable to build! (are you using USE=\"build\"?)" 114 || die "Unable to build! (are you using USE=\"build\"?)"
110 fi 115 fi
111 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then 116 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
112 einfo "No Make or Build file detected..." 117 einfo "No Make or Build file detected..."
113 return 118 return
114 fi 119 fi
115} 120}
116 121
117perl-module_src_compile() { 122perl-module_src_compile() {
118 ${perlinfo_done} || perlinfo 123 debug-print-function $FUNCNAME "$@"
124 perl_set_version
119 125
120 has src_configure ${PERL_EXPF} || perl-module_src_prep 126 has src_configure ${PERL_EXPF} || perl-module_src_prep
121 127
122 if [[ -f Build ]] ; then 128 if [[ -f Build ]] ; then
123 ./Build build \ 129 ./Build build \
151# SRC_TEST="parallel do" 157# SRC_TEST="parallel do"
152# SRC_TEST=parallel 158# SRC_TEST=parallel
153# 159#
154 160
155perl-module_src_test() { 161perl-module_src_test() {
162 debug-print-function $FUNCNAME "$@"
156 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then 163 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
157 if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then 164 if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then
158 export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" ) 165 export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" )
159 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}" 166 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}"
160 fi 167 fi
161 ${perlinfo_done} || perlinfo 168 ${perlinfo_done} || perl_set_version
162 if [[ -f Build ]] ; then 169 if [[ -f Build ]] ; then
163 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" 170 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
164 elif [[ -f Makefile ]] ; then 171 elif [[ -f Makefile ]] ; then
165 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed" 172 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
166 fi 173 fi
167 fi 174 fi
168} 175}
169 176
170perl-module_src_install() { 177perl-module_src_install() {
178 debug-print-function $FUNCNAME "$@"
179
180 perl_set_version
181 perl_set_eprefix
182
171 local f 183 local f
172 ${perlinfo_done} || perlinfo
173 184
174 if [[ -z ${mytargets} ]] ; then 185 if [[ -z ${mytargets} ]] ; then
175 case "${CATEGORY}" in 186 case "${CATEGORY}" in
176 dev-perl|perl-core) mytargets="pure_install" ;; 187 dev-perl|perl-core) mytargets="pure_install" ;;
177 *) mytargets="install" ;; 188 *) mytargets="install" ;;
184 elif [[ -f Makefile ]] ; then 195 elif [[ -f Makefile ]] ; then
185 emake ${myinst} ${mytargets} \ 196 emake ${myinst} ${mytargets} \
186 || die "emake ${myinst} ${mytargets} failed" 197 || die "emake ${myinst} ${mytargets} failed"
187 fi 198 fi
188 199
189 if [[ -d "${D}"/usr/share/man ]] ; then 200 perl_delete_module_manpages
190# einfo "Cleaning out stray man files" 201 perl_delete_localpod
191 find "${D}"/usr/share/man -type f -name "*.3pm" -delete 202 perl_delete_packlist
192 find "${D}"/usr/share/man -depth -type d -empty -delete 203 perl_remove_temppath
193 fi
194 204
195 fixlocalpod
196
197 for f in Change* CHANGES README* TODO ${mydoc}; do 205 for f in Change* CHANGES README* TODO FAQ ${mydoc}; do
198 [[ -s ${f} ]] && dodoc ${f} 206 [[ -s ${f} ]] && dodoc ${f}
199 done 207 done
200 208
201 if [[ -d ${D}/${VENDOR_LIB} ]] ; then
202 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
203 -o \( -name '*.bs' -a -empty \) \) -delete
204 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
205 fi
206
207 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
208 if file "${f}" | grep -q -i " text" ; then
209 grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
210 sed -i -e "s:${D}:/:g" "${f}"
211 fi
212 done
213
214 linkduallifescripts 209 perl_link_duallife_scripts
215} 210}
216 211
217perl-module_pkg_setup() { 212perl-module_pkg_setup() {
218 ${perlinfo_done} || perlinfo 213 debug-print-function $FUNCNAME "$@"
214 perl_set_version
219} 215}
220 216
221perl-module_pkg_preinst() { 217perl-module_pkg_preinst() {
222 ${perlinfo_done} || perlinfo 218 debug-print-function $FUNCNAME "$@"
219 perl_set_version
223} 220}
224 221
225perl-module_pkg_postinst() { 222perl-module_pkg_postinst() {
223 debug-print-function $FUNCNAME "$@"
226 linkduallifescripts 224 perl_link_duallife_scripts
227} 225}
228 226
229perl-module_pkg_prerm() { : ; } 227perl-module_pkg_prerm() {
228 debug-print-function $FUNCNAME "$@"
229}
230 230
231perl-module_pkg_postrm() { 231perl-module_pkg_postrm() {
232 debug-print-function $FUNCNAME "$@"
232 linkduallifescripts 233 perl_link_duallife_scripts
233} 234}
234
235perlinfo() {
236 perlinfo_done=true
237
238 local f version install{{site,vendor}{arch,lib},archlib}
239 for f in version install{{site,vendor}{arch,lib},archlib} ; do
240 eval "$(perl -V:${f} )"
241 done
242 PERL_VERSION=${version}
243 SITE_ARCH=${installsitearch}
244 SITE_LIB=${installsitelib}
245 ARCH_LIB=${installarchlib}
246 VENDOR_LIB=${installvendorlib}
247 VENDOR_ARCH=${installvendorarch}
248}
249
250fixlocalpod() {
251 find "${D}" -type f -name perllocal.pod -delete
252 find "${D}" -depth -mindepth 1 -type d -empty -delete
253}
254
255linkduallifescripts() {
256 if [[ ${CATEGORY} != perl-core ]] || ! has_version ">=dev-lang/perl-5.10.1" ; then
257 return 0
258 fi
259
260 local i ff
261 if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ; then
262 for i in "${DUALLIFESCRIPTS[@]}" ; do
263 alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-[0-9]*"
264 ff=`echo "${ROOT}"/usr/share/man/man1/${i}-${PV}-${P}.1*`
265 ff=${ff##*.1}
266 alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-[0-9]*"
267 done
268 else
269 pushd "${D}" > /dev/null
270 for i in $(find usr/bin -maxdepth 1 -type f 2>/dev/null) ; do
271 mv ${i}{,-${PV}-${P}} || die
272 DUALLIFESCRIPTS[${#DUALLIFESCRIPTS[*]}]=${i##*/}
273 if [[ -f usr/share/man/man1/${i##*/}.1 ]] ; then
274 mv usr/share/man/man1/${i##*/}{.1,-${PV}-${P}.1} || die
275 fi
276 done
277 popd > /dev/null
278 fi
279}

Legend:
Removed from v.1.118  
changed lines
  Added in v.1.123

  ViewVC Help
Powered by ViewVC 1.1.20