/[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.116 Revision 1.118
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.116 2009/03/29 17:32:31 tove Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.118 2009/11/10 12:53:53 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:
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-2 )}"
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
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 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 if [[ -n ${PATCHES} ]] ; then
64 base_src_unpack autopatch 71 base_src_unpack autopatch
69perl-module_src_configure() { 76perl-module_src_configure() {
70 perl-module_src_prep 77 perl-module_src_prep
71} 78}
72 79
73perl-module_src_prep() { 80perl-module_src_prep() {
74 [[ "${SRC_PREP}" = "yes" ]] && return 0 81 [[ ${SRC_PREP} = yes ]] && return 0
75 SRC_PREP="yes" 82 SRC_PREP="yes"
76 83
77 ${perlinfo_done} || perlinfo 84 ${perlinfo_done} || perlinfo
78 85
79 export PERL_MM_USE_DEFAULT=1 86 export PERL_MM_USE_DEFAULT=1
80 # Disable ExtUtils::AutoInstall from prompting 87 # Disable ExtUtils::AutoInstall from prompting
81 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" 88 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
82 89
83 if [[ "${PREFER_BUILDPL}" == "yes" && -f Build.PL ]] ; then 90 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then
84 einfo "Using Module::Build" 91 einfo "Using Module::Build"
85 perl Build.PL \ 92 perl Build.PL \
86 --installdirs=vendor \ 93 --installdirs=vendor \
87 --libdoc= \ 94 --libdoc= \
88 --destdir="${D}" \ 95 --destdir="${D}" \
108} 115}
109 116
110perl-module_src_compile() { 117perl-module_src_compile() {
111 ${perlinfo_done} || perlinfo 118 ${perlinfo_done} || perlinfo
112 119
113 has "${EAPI:-0}" 0 1 && perl-module_src_prep 120 has src_configure ${PERL_EXPF} || perl-module_src_prep
114 121
115 if [[ -f Build ]] ; then 122 if [[ -f Build ]] ; then
116 ./Build build \ 123 ./Build build \
117 || die "compilation failed" 124 || die "compilation failed"
118 elif [[ -f Makefile ]] ; then 125 elif [[ -f Makefile ]] ; then
122 || die "compilation failed" 129 || die "compilation failed"
123# OPTIMIZE="${CFLAGS}" \ 130# OPTIMIZE="${CFLAGS}" \
124 fi 131 fi
125} 132}
126 133
134# For testers:
135# This code attempts to work out your threadingness from MAKEOPTS
136# and apply them to Test::Harness.
137#
138# If you want more verbose testing, set TEST_VERBOSE=1
139# in your bashrc | /etc/make.conf | ENV
140#
141# For ebuild writers:
142# If you wish to enable default tests w/ 'make test' ,
143#
144# SRC_TEST="do"
145#
146# If you wish to have threads run in parallel ( using the users makeopts )
147# all of the following have been tested to work.
148#
149# SRC_TEST="do parallel"
150# SRC_TEST="parallel"
151# SRC_TEST="parallel do"
152# SRC_TEST=parallel
153#
154
127perl-module_src_test() { 155perl-module_src_test() {
128 if [[ "${SRC_TEST}" == "do" ]] ; then 156 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
157 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/" )
159 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}"
160 fi
129 ${perlinfo_done} || perlinfo 161 ${perlinfo_done} || perlinfo
130 if [[ -f Build ]] ; then 162 if [[ -f Build ]] ; then
131 ./Build test || die "test failed" 163 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
132 elif [[ -f Makefile ]] ; then 164 elif [[ -f Makefile ]] ; then
133 emake test || die "test failed" 165 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
134 fi 166 fi
135 fi 167 fi
136} 168}
137 169
138perl-module_src_install() { 170perl-module_src_install() {
160 find "${D}"/usr/share/man -depth -type d -empty -delete 192 find "${D}"/usr/share/man -depth -type d -empty -delete
161 fi 193 fi
162 194
163 fixlocalpod 195 fixlocalpod
164 196
165 for f in Change* CHANGES README* ${mydoc}; do 197 for f in Change* CHANGES README* TODO ${mydoc}; do
166 [[ -s "${f}" ]] && dodoc ${f} 198 [[ -s ${f} ]] && dodoc ${f}
167 done 199 done
168 200
169 if [[ -d "${D}/${VENDOR_LIB}" ]] ; then 201 if [[ -d ${D}/${VENDOR_LIB} ]] ; then
170 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \ 202 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
171 -o \( -name '*.bs' -a -empty \) \) -delete 203 -o \( -name '*.bs' -a -empty \) \) -delete
172 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete 204 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
173 fi 205 fi
174 206
175 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do 207 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
176 if file "${f}" | grep -q -i " text" ; then 208 if file "${f}" | grep -q -i " text" ; then
177if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ;fi 209 grep -q "${D}" "${f}" && ewarn "QA: File contains a temporary path ${f}"
178 sed -i -e "s:${D}:/:g" "${f}" 210 sed -i -e "s:${D}:/:g" "${f}"
179 fi 211 fi
180 done 212 done
213
214 linkduallifescripts
181} 215}
182 216
183perl-module_pkg_setup() { 217perl-module_pkg_setup() {
184 ${perlinfo_done} || perlinfo 218 ${perlinfo_done} || perlinfo
185} 219}
186 220
187perl-module_pkg_preinst() { 221perl-module_pkg_preinst() {
188 ${perlinfo_done} || perlinfo 222 ${perlinfo_done} || perlinfo
189} 223}
190 224
191perl-module_pkg_postinst() { : ; } 225perl-module_pkg_postinst() {
192# einfo "Man pages are not installed for most modules now." 226 linkduallifescripts
193# einfo "Please use perldoc instead." 227}
194#}
195 228
196perl-module_pkg_prerm() { : ; } 229perl-module_pkg_prerm() { : ; }
197 230
198perl-module_pkg_postrm() { : ; } 231perl-module_pkg_postrm() {
232 linkduallifescripts
233}
199 234
200perlinfo() { 235perlinfo() {
201 perlinfo_done=true 236 perlinfo_done=true
202 237
203 local f version install{site{arch,lib},archlib,vendor{arch,lib}} 238 local f version install{{site,vendor}{arch,lib},archlib}
204 for f in version install{site{arch,lib},archlib,vendor{arch,lib}} ; do 239 for f in version install{{site,vendor}{arch,lib},archlib} ; do
205 eval "$(perl -V:${f} )" 240 eval "$(perl -V:${f} )"
206 done 241 done
207 PERL_VERSION=${version} 242 PERL_VERSION=${version}
208 SITE_ARCH=${installsitearch} 243 SITE_ARCH=${installsitearch}
209 SITE_LIB=${installsitelib} 244 SITE_LIB=${installsitelib}
214 249
215fixlocalpod() { 250fixlocalpod() {
216 find "${D}" -type f -name perllocal.pod -delete 251 find "${D}" -type f -name perllocal.pod -delete
217 find "${D}" -depth -mindepth 1 -type d -empty -delete 252 find "${D}" -depth -mindepth 1 -type d -empty -delete
218} 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.116  
changed lines
  Added in v.1.118

  ViewVC Help
Powered by ViewVC 1.1.20