/[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.121 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.121 2010/01/13 15:15:45 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 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() {
66 debug-print-function $FUNCNAME "$@"
70 has src_prepare ${PERL_EXPF} && base_src_prepare 67 has src_prepare ${PERL_EXPF} && base_src_prepare
68 perl_fix_osx_extra
71 esvn_clean 69 esvn_clean
72} 70}
73 71
74perl-module_src_configure() { 72perl-module_src_configure() {
73 debug-print-function $FUNCNAME "$@"
75 perl-module_src_prep 74 perl-module_src_prep
76} 75}
77 76
78perl-module_src_prep() { 77perl-module_src_prep() {
78 debug-print-function $FUNCNAME "$@"
79 [[ ${SRC_PREP} = yes ]] && return 0 79 [[ ${SRC_PREP} = yes ]] && return 0
80 SRC_PREP="yes" 80 SRC_PREP="yes"
81 81
82 ${perlinfo_done} || perlinfo 82 perl_set_version
83 perl_set_eprefix
83 84
84 export PERL_MM_USE_DEFAULT=1 85 export PERL_MM_USE_DEFAULT=1
85 # Disable ExtUtils::AutoInstall from prompting 86 # Disable ExtUtils::AutoInstall from prompting
86 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" 87 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
87 88
89 einfo "Using Module::Build" 90 einfo "Using Module::Build"
90 if [[ ${DEPEND} != *virtual/perl-Module-Build* && ${PN} != Module-Build ]] ; then 91 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 "QA Notice: The ebuild uses Module::Build but doesn't depend on it."
92 ewarn " Add virtual/perl-Module-Build to DEPEND!" 93 ewarn " Add virtual/perl-Module-Build to DEPEND!"
93 fi 94 fi
94 perl Build.PL \ 95 set -- \
95 --installdirs=vendor \ 96 --installdirs=vendor \
96 --libdoc= \ 97 --libdoc= \
97 --destdir="${D}" \ 98 --destdir="${D}" \
98 --create_packlist=0 \ 99 --create_packlist=0 \
99 ${myconf} \ 100 ${myconf}
100 <<< "${pm_echovar}" \ 101 einfo "perl Build.PL" "$@"
102 perl Build.PL "$@" <<< "${pm_echovar}" \
101 || die "Unable to build! (are you using USE=\"build\"?)" 103 || die "Unable to build! (are you using USE=\"build\"?)"
102 elif [[ -f Makefile.PL ]] ; then 104 elif [[ -f Makefile.PL ]] ; then
103 einfo "Using ExtUtils::MakeMaker" 105 einfo "Using ExtUtils::MakeMaker"
104 perl Makefile.PL \ 106 set -- \
105 PREFIX=/usr \ 107 PREFIX=${EPREFIX}/usr \
106 INSTALLDIRS=vendor \ 108 INSTALLDIRS=vendor \
107 INSTALLMAN3DIR='none' \ 109 INSTALLMAN3DIR='none' \
108 DESTDIR="${D}" \ 110 DESTDIR="${D}" \
109 ${myconf} \ 111 ${myconf}
110 <<< "${pm_echovar}" \ 112 einfo "perl Makefile.PL" "$@"
113 perl Makefile.PL "$@" <<< "${pm_echovar}" \
111 || die "Unable to build! (are you using USE=\"build\"?)" 114 || die "Unable to build! (are you using USE=\"build\"?)"
112 fi 115 fi
113 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then 116 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
114 einfo "No Make or Build file detected..." 117 einfo "No Make or Build file detected..."
115 return 118 return
116 fi 119 fi
117} 120}
118 121
119perl-module_src_compile() { 122perl-module_src_compile() {
120 ${perlinfo_done} || perlinfo 123 debug-print-function $FUNCNAME "$@"
124 perl_set_version
121 125
122 has src_configure ${PERL_EXPF} || perl-module_src_prep 126 has src_configure ${PERL_EXPF} || perl-module_src_prep
123 127
124 if [[ -f Build ]] ; then 128 if [[ -f Build ]] ; then
125 ./Build build \ 129 ./Build build \
153# SRC_TEST="parallel do" 157# SRC_TEST="parallel do"
154# SRC_TEST=parallel 158# SRC_TEST=parallel
155# 159#
156 160
157perl-module_src_test() { 161perl-module_src_test() {
162 debug-print-function $FUNCNAME "$@"
158 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then 163 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
159 if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then 164 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/" ) 165 export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" )
161 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}" 166 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}"
162 fi 167 fi
163 ${perlinfo_done} || perlinfo 168 ${perlinfo_done} || perl_set_version
164 if [[ -f Build ]] ; then 169 if [[ -f Build ]] ; then
165 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" 170 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
166 elif [[ -f Makefile ]] ; then 171 elif [[ -f Makefile ]] ; then
167 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed" 172 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
168 fi 173 fi
169 fi 174 fi
170} 175}
171 176
172perl-module_src_install() { 177perl-module_src_install() {
178 debug-print-function $FUNCNAME "$@"
179
180 perl_set_version
181 perl_set_eprefix
182
173 local f 183 local f
174 ${perlinfo_done} || perlinfo
175 184
176 if [[ -z ${mytargets} ]] ; then 185 if [[ -z ${mytargets} ]] ; then
177 case "${CATEGORY}" in 186 case "${CATEGORY}" in
178 dev-perl|perl-core) mytargets="pure_install" ;; 187 dev-perl|perl-core) mytargets="pure_install" ;;
179 *) mytargets="install" ;; 188 *) mytargets="install" ;;
186 elif [[ -f Makefile ]] ; then 195 elif [[ -f Makefile ]] ; then
187 emake ${myinst} ${mytargets} \ 196 emake ${myinst} ${mytargets} \
188 || die "emake ${myinst} ${mytargets} failed" 197 || die "emake ${myinst} ${mytargets} failed"
189 fi 198 fi
190 199
191 if [[ -d "${D}"/usr/share/man ]] ; then 200 perl_delete_module_manpages
192# einfo "Cleaning out stray man files" 201 perl_delete_localpod
193 find "${D}"/usr/share/man -type f -name "*.3pm" -delete 202 perl_delete_packlist
194 find "${D}"/usr/share/man -depth -type d -empty -delete 203 perl_remove_temppath
195 fi
196 204
197 fixlocalpod
198
199 for f in Change* CHANGES README* TODO ${mydoc}; do 205 for f in Change* CHANGES README* TODO FAQ ${mydoc}; do
200 [[ -s ${f} ]] && dodoc ${f} 206 [[ -s ${f} ]] && dodoc ${f}
201 done 207 done
202 208
203 if [[ -d ${D}/${VENDOR_LIB} ]] ; then
204 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
205 -o \( -name '*.bs' -a -empty \) \) -delete
206 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
207 fi
208
209 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
210 if file "${f}" | grep -q -i " text" ; then
211 grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
212 sed -i -e "s:${D}:/:g" "${f}"
213 fi
214 done
215
216 linkduallifescripts 209 perl_link_duallife_scripts
217} 210}
218 211
219perl-module_pkg_setup() { 212perl-module_pkg_setup() {
220 ${perlinfo_done} || perlinfo 213 debug-print-function $FUNCNAME "$@"
214 perl_set_version
221} 215}
222 216
223perl-module_pkg_preinst() { 217perl-module_pkg_preinst() {
224 ${perlinfo_done} || perlinfo 218 debug-print-function $FUNCNAME "$@"
219 perl_set_version
225} 220}
226 221
227perl-module_pkg_postinst() { 222perl-module_pkg_postinst() {
223 debug-print-function $FUNCNAME "$@"
228 linkduallifescripts 224 perl_link_duallife_scripts
229} 225}
230 226
231perl-module_pkg_prerm() { : ; } 227perl-module_pkg_prerm() {
228 debug-print-function $FUNCNAME "$@"
229}
232 230
233perl-module_pkg_postrm() { 231perl-module_pkg_postrm() {
232 debug-print-function $FUNCNAME "$@"
234 linkduallifescripts 233 perl_link_duallife_scripts
235} 234}
236
237perlinfo() {
238 perlinfo_done=true
239
240 local f version install{{site,vendor}{arch,lib},archlib}
241 for f in version install{{site,vendor}{arch,lib},archlib} ; do
242 eval "$(perl -V:${f} )"
243 done
244 PERL_VERSION=${version}
245 SITE_ARCH=${installsitearch}
246 SITE_LIB=${installsitelib}
247 ARCH_LIB=${installarchlib}
248 VENDOR_LIB=${installvendorlib}
249 VENDOR_ARCH=${installvendorarch}
250}
251
252fixlocalpod() {
253 find "${D}" -type f -name perllocal.pod -delete
254 find "${D}" -depth -mindepth 1 -type d -empty -delete
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.121  
changed lines
  Added in v.1.123

  ViewVC Help
Powered by ViewVC 1.1.20