/[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.58 Revision 1.123
1# Copyright 1999-2004 Gentoo Technologies, Inc. 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.58 2004/04/02 10:22:50 mcummings 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# Maintained by the Perl herd <perl@gentoo.org> 6
7# 7# @ECLASS: perl-module.eclass
8# @MAINTAINER:
9# perl@gentoo.org
10# @BLURB: eclass for perl modules
11# @DESCRIPTION:
8# 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
9# modules, and their incorporation into the Gentoo Linux system. 13# modules, and their incorporation into the Gentoo Linux system.
10 14
11ECLASS=perl-module 15inherit perl-helper eutils base
12INHERITED="${INHERITED} ${ECLASS}"
13 16
17PERL_EXPF="src_unpack src_compile src_test src_install"
18
19case "${EAPI:-0}" in
20 0|1)
14EXPORT_FUNCTIONS 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"
15 src_compile src_install src_test \ 22 ;;
16 perlinfo updatepod 23 2|3)
24 PERL_EXPF="${PERL_EXPF} src_prepare src_configure"
25 [[ ${CATEGORY} == "perl-core" ]] && \
26 PERL_EXPF="${PERL_EXPF} pkg_postinst pkg_postrm"
17 27
28 case "${GENTOO_DEPEND_ON_PERL:-yes}" in
29 yes)
30 DEPEND="dev-lang/perl[-build]"
31 RDEPEND="${DEPEND}"
32 ;;
33 esac
34 ;;
35 *)
36 DEPEND="EAPI-UNSUPPORTED"
37 ;;
38esac
18 39
19newdepend ">=dev-lang/perl-5.8.0-r12" 40EXPORT_FUNCTIONS ${PERL_EXPF}
41
42DESCRIPTION="Based on the $ECLASS eclass"
43
44LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}"
45
46[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz"
47[[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
48 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}"
49[[ -z "${HOMEPAGE}" ]] && \
50 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/"
51
20SRC_PREP="no" 52SRC_PREP="no"
21SRC_TEST="skip" 53SRC_TEST="skip"
54PREFER_BUILDPL="yes"
22 55
23PERL_VERSION="" 56pm_echovar=""
24SITE_ARCH="" 57perlinfo_done=false
25SITE_LIB="" 58
26ARCH_LIB="" 59perl-module_src_unpack() {
27POD_DIR="" 60 debug-print-function $FUNCNAME "$@"
28MMSIXELEVEN="" 61 base_src_unpack
62 has src_prepare ${PERL_EXPF} || perl-module_src_prepare
63}
64
65perl-module_src_prepare() {
66 debug-print-function $FUNCNAME "$@"
67 has src_prepare ${PERL_EXPF} && base_src_prepare
68 perl_fix_osx_extra
69 esvn_clean
70}
71
72perl-module_src_configure() {
73 debug-print-function $FUNCNAME "$@"
74 perl-module_src_prep
75}
29 76
30perl-module_src_prep() { 77perl-module_src_prep() {
78 debug-print-function $FUNCNAME "$@"
79 [[ ${SRC_PREP} = yes ]] && return 0
31 SRC_PREP="yes" 80 SRC_PREP="yes"
32 if [ "${style}" == "builder" ]; then 81
33 perl ${S}/Build.PL installdirs=vendor destdir=${D} 82 perl_set_version
34 else 83 perl_set_eprefix
35 if [ "${MMSIXELEVEN}" ]; then 84
36 perl Makefile.PL ${myconf} \ 85 export PERL_MM_USE_DEFAULT=1
37 PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D} 86 # Disable ExtUtils::AutoInstall from prompting
38 else 87 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
39 perl Makefile.PL ${myconf} \ 88
40 PREFIX=${D}/usr INSTALLDIRS=vendor 89 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then
90 einfo "Using Module::Build"
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!"
41 fi 94 fi
95 set -- \
96 --installdirs=vendor \
97 --libdoc= \
98 --destdir="${D}" \
99 --create_packlist=0 \
100 ${myconf}
101 einfo "perl Build.PL" "$@"
102 perl Build.PL "$@" <<< "${pm_echovar}" \
103 || die "Unable to build! (are you using USE=\"build\"?)"
104 elif [[ -f Makefile.PL ]] ; then
105 einfo "Using ExtUtils::MakeMaker"
106 set -- \
107 PREFIX=${EPREFIX}/usr \
108 INSTALLDIRS=vendor \
109 INSTALLMAN3DIR='none' \
110 DESTDIR="${D}" \
111 ${myconf}
112 einfo "perl Makefile.PL" "$@"
113 perl Makefile.PL "$@" <<< "${pm_echovar}" \
114 || die "Unable to build! (are you using USE=\"build\"?)"
42 fi 115 fi
43 116 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
117 einfo "No Make or Build file detected..."
118 return
119 fi
44} 120}
45 121
46perl-module_src_compile() { 122perl-module_src_compile() {
123 debug-print-function $FUNCNAME "$@"
124 perl_set_version
47 125
48 [ "${SRC_PREP}" != "yes" ] && perl-module_src_prep 126 has src_configure ${PERL_EXPF} || perl-module_src_prep
49 if [ "${style}" != "builder" ]; then 127
128 if [[ -f Build ]] ; then
129 ./Build build \
50 make ${mymake} || die "compilation failed" 130 || die "compilation failed"
131 elif [[ -f Makefile ]] ; then
132 emake \
133 OTHERLDFLAGS="${LDFLAGS}" \
134 ${mymake} \
135 || die "compilation failed"
136# OPTIMIZE="${CFLAGS}" \
51 fi 137 fi
138}
52 139
53 if [ "${SRC_TEST}" == "do" ]; then 140# For testers:
54 perl-module_src_test || die "test failed" 141# This code attempts to work out your threadingness from MAKEOPTS
142# and apply them to Test::Harness.
143#
144# If you want more verbose testing, set TEST_VERBOSE=1
145# in your bashrc | /etc/make.conf | ENV
146#
147# For ebuild writers:
148# If you wish to enable default tests w/ 'make test' ,
149#
55 SRC_TEST="done" 150# SRC_TEST="do"
56 fi 151#
57} 152# If you wish to have threads run in parallel ( using the users makeopts )
153# all of the following have been tested to work.
154#
155# SRC_TEST="do parallel"
156# SRC_TEST="parallel"
157# SRC_TEST="parallel do"
158# SRC_TEST=parallel
159#
58 160
59perl-module_src_test() { 161perl-module_src_test() {
60 if [ "${style}" == "builder" ]; then 162 debug-print-function $FUNCNAME "$@"
61 perl ${S}/Build test 163 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
62 else 164 if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then
63 make test 165 export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" )
166 einfo "Test::Harness Jobs=${HARNESS_OPTIONS}"
64 fi 167 fi
65 168 ${perlinfo_done} || perl_set_version
169 if [[ -f Build ]] ; then
170 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
171 elif [[ -f Makefile ]] ; then
172 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
173 fi
174 fi
66} 175}
67 176
68perl-module_src_install() { 177perl-module_src_install() {
69 178 debug-print-function $FUNCNAME "$@"
70 perlinfo 179
71 dodir ${POD_DIR} 180 perl_set_version
72 181 perl_set_eprefix
73 test -z ${mytargets} && mytargets="install" 182
74 183 local f
75 if [ "${style}" == "builder" ]; then 184
76 perl ${S}/Build install 185 if [[ -z ${mytargets} ]] ; then
77 else 186 case "${CATEGORY}" in
78 if [ "${MMSIXELEVEN}" ]; then 187 dev-perl|perl-core) mytargets="pure_install" ;;
188 *) mytargets="install" ;;
189 esac
190 fi
191
192 if [[ -f Build ]] ; then
193 ./Build ${mytargets} \
194 || die "./Build ${mytargets} failed"
195 elif [[ -f Makefile ]] ; then
79 make ${myinst} ${mytargets} || die 196 emake ${myinst} ${mytargets} \
80 else 197 || die "emake ${myinst} ${mytargets} failed"
81 make \
82 PREFIX=${D}/usr \
83 INSTALLMAN1DIR=${D}/usr/share/man/man1 \
84 INSTALLMAN2DIR=${D}/usr/share/man/man2 \
85 INSTALLMAN3DIR=${D}/usr/share/man/man3 \
86 INSTALLMAN4DIR=${D}/usr/share/man/man4 \
87 INSTALLMAN5DIR=${D}/usr/share/man/man5 \
88 INSTALLMAN6DIR=${D}/usr/share/man/man6 \
89 INSTALLMAN7DIR=${D}/usr/share/man/man7 \
90 INSTALLMAN8DIR=${D}/usr/share/man/man8 \
91 INSTALLSITEMAN1DIR=${D}/usr/share/man/man1 \
92 INSTALLSITEMAN2DIR=${D}/usr/share/man/man2 \
93 INSTALLSITEMAN3DIR=${D}/usr/share/man/man3 \
94 INSTALLSITEMAN4DIR=${D}/usr/share/man/man4 \
95 INSTALLSITEMAN5DIR=${D}/usr/share/man/man5 \
96 INSTALLSITEMAN6DIR=${D}/usr/share/man/man6 \
97 INSTALLSITEMAN7DIR=${D}/usr/share/man/man7 \
98 INSTALLSITEMAN8DIR=${D}/usr/share/man/man8 \
99 INSTALLVENDORMAN3DIR=${D}/usr/share/man/man3 \
100 INSTALLSITEARCH=${D}/${SITE_ARCH} \
101 INSTALLSCRIPT=${D}/usr/bin \
102 ${myinst} \
103 ${mytargets} || die
104 fi 198 fi
105 fi
106 199
107 if [ -f ${D}${ARCH_LIB}/perllocal.pod ]; 200 perl_delete_module_manpages
108 then 201 perl_delete_localpod
109 touch ${D}/${POD_DIR}/${P}.pod 202 perl_delete_packlist
110 sed -e "s:${D}::g" \ 203 perl_remove_temppath
111 ${D}${ARCH_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
112 touch ${D}/${POD_DIR}/${P}.pod.arch
113 cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.arch
114 rm -f ${D}/${ARCH_LIB}/perllocal.pod
115 fi
116
117 if [ -f ${D}${SITE_LIB}/perllocal.pod ];
118 then
119 touch ${D}/${POD_DIR}/${P}.pod
120 sed -e "s:${D}::g" \
121 ${D}${SITE_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
122 touch ${D}/${POD_DIR}/${P}.pod.site
123 cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.site
124 rm -f ${D}/${SITE_LIB}/perllocal.pod
125 fi
126 204
127 for FILE in `find ${D} -type f -name "*.html" -o -name ".packlist"`; do 205 for f in Change* CHANGES README* TODO FAQ ${mydoc}; do
128 sed -i -e "s:${D}:/:g" ${FILE} 206 [[ -s ${f} ]] && dodoc ${f}
129 done 207 done
130 208
131 for doc in Change* MANIFEST* README*; do 209 perl_link_duallife_scripts
132 [ -s "$doc" ] && dodoc $doc
133 done
134 dodoc ${mydoc}
135} 210}
136
137 211
138perl-module_pkg_setup() { 212perl-module_pkg_setup() {
139 213 debug-print-function $FUNCNAME "$@"
140 perlinfo 214 perl_set_version
141} 215}
142
143 216
144perl-module_pkg_preinst() { 217perl-module_pkg_preinst() {
145 218 debug-print-function $FUNCNAME "$@"
146 perlinfo 219 perl_set_version
147} 220}
148 221
149perl-module_pkg_postinst() { 222perl-module_pkg_postinst() {
150 223 debug-print-function $FUNCNAME "$@"
151 updatepod 224 perl_link_duallife_scripts
152} 225}
153 226
154perl-module_pkg_prerm() { 227perl-module_pkg_prerm() {
155 228 debug-print-function $FUNCNAME "$@"
156 updatepod
157} 229}
158 230
159perl-module_pkg_postrm() { 231perl-module_pkg_postrm() {
160 232 debug-print-function $FUNCNAME "$@"
161 updatepod 233 perl_link_duallife_scripts
162} 234}
163
164perlinfo() {
165
166 if [ -f /usr/bin/perl ]
167 then
168 POD_DIR="/usr/share/perl/gentoo-pods/${version}"
169 fi
170 eval `perl '-V:version'`
171 PERL_VERSION=${version}
172 eval `perl '-V:installsitearch'`
173 SITE_ARCH=${installsitearch}
174 eval `perl '-V:installarchlib'`
175 ARCH_LIB=${installarchlib}
176 eval `perl '-V:installarchlib'`
177 ARCH_LIB=${installarchlib}
178 eval `perl '-V:installsitearch'`
179 SITE_LIB=${installsitearch}
180# handling of DESTDIR changed in makemaker 6.11
181 MMSIXELEVEN=`perl -e 'use ExtUtils::MakeMaker; print( $ExtUtils::MakeMaker::VERSION ge "6.11" )'`
182
183}
184
185updatepod() {
186 perlinfo
187
188 if [ -d "${POD_DIR}" ]
189 then
190 for FILE in `find ${POD_DIR} -type f -name "*.pod.arch"`; do
191 cat ${FILE} >> ${ARCH_LIB}/perllocal.pod
192 rm -f ${FILE}
193 done
194 for FILE in `find ${POD_DIR} -type f -name "*.pod.site"`; do
195 cat ${FILE} >> ${SITE_LIB}/perllocal.pod
196 rm -f ${FILE}
197 done
198 fi
199}

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

  ViewVC Help
Powered by ViewVC 1.1.20