/[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.34 Revision 1.116
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2004 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.34 2003/03/11 21:26:32 seemant Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.116 2009/03/29 17:32:31 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
8# @MAINTAINER:
9# perl@gentoo.org
10# @BLURB: eclass for perl modules
11# @DESCRIPTION:
7# 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
8# modules, and their incorporation into the Gentoo Linux system. 13# modules, and their incorporation into the Gentoo Linux system.
9 14
10#first inherit the pkg_postinst() and pkg_postrm() functions 15inherit eutils base
11inherit perl-post
12 16
13ECLASS=perl-module 17case "${EAPI:-0}" in
14INHERITED="$INHERITED $ECLASS" 18 0|1)
19 EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm src_compile src_install src_test src_unpack
20 ;;
21 2)
22 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install
15 23
16EXPORT_FUNCTIONS src_compile src_install src_test 24 case "${GENTOO_DEPEND_ON_PERL:-yes}" in
17 25 yes)
18eval `perl '-V:version'`
19DEPEND="dev-lang/perl 26 DEPEND="dev-lang/perl[-build]"
20 >=dev-perl/ExtUtils-MakeMaker-6.05-r1 27 RDEPEND="${DEPEND}"
21 ${DEPEND}" 28 ;;
29 esac
30 ;;
31esac
32
33DESCRIPTION="Based on the $ECLASS eclass"
34
35LICENSE="${LICENSE:-|| ( Artistic GPL-2 )}"
36
37[[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz"
38[[ -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}"
40[[ -z "${HOMEPAGE}" ]] && \
41 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}"
42
22SRC_PREP="no" 43SRC_PREP="no"
44SRC_TEST="skip"
45PREFER_BUILDPL="yes"
46
47PERL_VERSION=""
48SITE_ARCH=""
49SITE_LIB=""
50ARCH_LIB=""
51VENDOR_ARCH=""
52VENDOR_LIB=""
53
54pm_echovar=""
55perlinfo_done=false
56
57perl-module_src_unpack() {
58 base_src_unpack unpack
59 has "${EAPI:-0}" 0 1 && perl-module_src_prepare
60}
61
62perl-module_src_prepare() {
63 if [[ -n ${PATCHES} ]] ; then
64 base_src_unpack autopatch
65 fi
66 esvn_clean
67}
68
69perl-module_src_configure() {
70 perl-module_src_prep
71}
23 72
24perl-module_src_prep() { 73perl-module_src_prep() {
25 74 [[ "${SRC_PREP}" = "yes" ]] && return 0
26 SRC_PREP="yes" 75 SRC_PREP="yes"
76
77 ${perlinfo_done} || perlinfo
78
79 export PERL_MM_USE_DEFAULT=1
80 # Disable ExtUtils::AutoInstall from prompting
81 export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
82
83 if [[ "${PREFER_BUILDPL}" == "yes" && -f Build.PL ]] ; then
84 einfo "Using Module::Build"
85 perl Build.PL \
86 --installdirs=vendor \
87 --libdoc= \
88 --destdir="${D}" \
89 --create_packlist=0 \
90 ${myconf} \
91 <<< "${pm_echovar}" \
92 || die "Unable to build! (are you using USE=\"build\"?)"
93 elif [[ -f Makefile.PL ]] ; then
94 einfo "Using ExtUtils::MakeMaker"
27 perl Makefile.PL ${myconf} \ 95 perl Makefile.PL \
28 PREFIX=${D}/usr 96 PREFIX=/usr \
97 INSTALLDIRS=vendor \
98 INSTALLMAN3DIR='none' \
99 DESTDIR="${D}" \
100 ${myconf} \
101 <<< "${pm_echovar}" \
102 || die "Unable to build! (are you using USE=\"build\"?)"
103 fi
104 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
105 einfo "No Make or Build file detected..."
106 return
107 fi
29} 108}
30 109
31perl-module_src_compile() { 110perl-module_src_compile() {
111 ${perlinfo_done} || perlinfo
32 112
33 [ "${SRC_PREP}" != "yes" ] && perl-module_src_prep 113 has "${EAPI:-0}" 0 1 && perl-module_src_prep
114
115 if [[ -f Build ]] ; then
116 ./Build build \
34 make ${mymake} || die "compilation failed" 117 || die "compilation failed"
118 elif [[ -f Makefile ]] ; then
119 emake \
120 OTHERLDFLAGS="${LDFLAGS}" \
121 ${mymake} \
122 || die "compilation failed"
123# OPTIMIZE="${CFLAGS}" \
124 fi
35} 125}
36 126
37perl-module_src_test() { 127perl-module_src_test() {
38 make test 128 if [[ "${SRC_TEST}" == "do" ]] ; then
129 ${perlinfo_done} || perlinfo
130 if [[ -f Build ]] ; then
131 ./Build test || die "test failed"
132 elif [[ -f Makefile ]] ; then
133 emake test || die "test failed"
134 fi
135 fi
39} 136}
40 137
41perl-module_src_install() { 138perl-module_src_install() {
42 139 local f
43 perl-post_perlinfo 140 ${perlinfo_done} || perlinfo
44 dodir ${POD_DIR} 141
45 142 if [[ -z ${mytargets} ]] ; then
46 test -z ${mytargets} && mytargets="install" 143 case "${CATEGORY}" in
47 eval `perl '-V:installsitearch'` 144 dev-perl|perl-core) mytargets="pure_install" ;;
145 *) mytargets="install" ;;
146 esac
147 fi
148
149 if [[ -f Build ]] ; then
150 ./Build ${mytargets} \
151 || die "./Build ${mytargets} failed"
152 elif [[ -f Makefile ]] ; then
153 emake ${myinst} ${mytargets} \
154 || die "emake ${myinst} ${mytargets} failed"
155 fi
156
157 if [[ -d "${D}"/usr/share/man ]] ; then
158# einfo "Cleaning out stray man files"
159 find "${D}"/usr/share/man -type f -name "*.3pm" -delete
160 find "${D}"/usr/share/man -depth -type d -empty -delete
161 fi
162
163 fixlocalpod
164
165 for f in Change* CHANGES README* ${mydoc}; do
166 [[ -s "${f}" ]] && dodoc ${f}
167 done
168
169 if [[ -d "${D}/${VENDOR_LIB}" ]] ; then
170 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
171 -o \( -name '*.bs' -a -empty \) \) -delete
172 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
173 fi
174
175 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
176 if file "${f}" | grep -q -i " text" ; then
177if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ;fi
178 sed -i -e "s:${D}:/:g" "${f}"
179 fi
180 done
181}
182
183perl-module_pkg_setup() {
184 ${perlinfo_done} || perlinfo
185}
186
187perl-module_pkg_preinst() {
188 ${perlinfo_done} || perlinfo
189}
190
191perl-module_pkg_postinst() { : ; }
192# einfo "Man pages are not installed for most modules now."
193# einfo "Please use perldoc instead."
194#}
195
196perl-module_pkg_prerm() { : ; }
197
198perl-module_pkg_postrm() { : ; }
199
200perlinfo() {
201 perlinfo_done=true
202
203 local f version install{site{arch,lib},archlib,vendor{arch,lib}}
204 for f in version install{site{arch,lib},archlib,vendor{arch,lib}} ; do
205 eval "$(perl -V:${f} )"
206 done
207 PERL_VERSION=${version}
48 SITE_ARCH=${installsitearch} 208 SITE_ARCH=${installsitearch}
49 eval `perl '-V:installarchlib'` 209 SITE_LIB=${installsitelib}
50 ARCH_LIB=${installarchlib} 210 ARCH_LIB=${installarchlib}
51 211 VENDOR_LIB=${installvendorlib}
52 212 VENDOR_ARCH=${installvendorarch}
53 make \
54 PREFIX=${D}/usr \
55 INSTALLMAN1DIR=${D}/usr/share/man/man1 \
56 INSTALLMAN2DIR=${D}/usr/share/man/man2 \
57 INSTALLMAN3DIR=${D}/usr/share/man/man3 \
58 INSTALLMAN4DIR=${D}/usr/share/man/man4 \
59 INSTALLMAN5DIR=${D}/usr/share/man/man5 \
60 INSTALLMAN6DIR=${D}/usr/share/man/man6 \
61 INSTALLMAN7DIR=${D}/usr/share/man/man7 \
62 INSTALLMAN8DIR=${D}/usr/share/man/man8 \
63 INSTALLSITEMAN1DIR=${D}/usr/share/man/man1 \
64 INSTALLSITEMAN2DIR=${D}/usr/share/man/man2 \
65 INSTALLSITEMAN3DIR=${D}/usr/share/man/man3 \
66 INSTALLSITEMAN4DIR=${D}/usr/share/man/man4 \
67 INSTALLSITEMAN5DIR=${D}/usr/share/man/man5 \
68 INSTALLSITEMAN6DIR=${D}/usr/share/man/man6 \
69 INSTALLSITEMAN7DIR=${D}/usr/share/man/man7 \
70 INSTALLSITEMAN8DIR=${D}/usr/share/man/man8 \
71 INSTALLSITEARCH=${D}/${SITE_ARCH} \
72 INSTALLSCRIPT=${D}/usr/bin \
73 ${myinst} \
74 ${mytargets} || die
75
76
77 if [ -f ${D}${ARCH_LIB}/perllocal.pod ];
78 then
79 touch ${D}/${POD_DIR}/${P}.pod
80 sed -e "s:${D}::g" \
81 ${D}${ARCH_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
82 touch ${D}/${POD_DIR}/${P}.pod.arch
83 cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.arch
84 rm -f ${D}/${ARCH_LIB}/perllocal.pod
85 fi
86
87 if [ -f ${D}${SITE_LIB}/perllocal.pod ];
88 then
89 touch ${D}/${POD_DIR}/${P}.pod
90 sed -e "s:${D}::g" \
91 ${D}${SITE_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
92 touch ${D}/${POD_DIR}/${P}.pod.site
93 cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.site
94 rm -f ${D}/${SITE_LIB}/perllocal.pod
95 fi
96
97 dodoc Change* MANIFEST* README* ${mydoc}
98} 213}
214
215fixlocalpod() {
216 find "${D}" -type f -name perllocal.pod -delete
217 find "${D}" -depth -mindepth 1 -type d -empty -delete
218}

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.116

  ViewVC Help
Powered by ViewVC 1.1.20