/[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.116
1# Copyright 1999-2004 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.58 2004/04/02 10:22:50 mcummings 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# 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 eutils base
12INHERITED="${INHERITED} ${ECLASS}"
13 16
17case "${EAPI:-0}" in
18 0|1)
14EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm \ 19 EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm src_compile src_install src_test src_unpack
15 src_compile src_install src_test \ 20 ;;
16 perlinfo updatepod 21 2)
22 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install
17 23
24 case "${GENTOO_DEPEND_ON_PERL:-yes}" in
25 yes)
26 DEPEND="dev-lang/perl[-build]"
27 RDEPEND="${DEPEND}"
28 ;;
29 esac
30 ;;
31esac
18 32
19newdepend ">=dev-lang/perl-5.8.0-r12" 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
20SRC_PREP="no" 43SRC_PREP="no"
21SRC_TEST="skip" 44SRC_TEST="skip"
45PREFER_BUILDPL="yes"
22 46
23PERL_VERSION="" 47PERL_VERSION=""
24SITE_ARCH="" 48SITE_ARCH=""
25SITE_LIB="" 49SITE_LIB=""
26ARCH_LIB="" 50ARCH_LIB=""
27POD_DIR="" 51VENDOR_ARCH=""
28MMSIXELEVEN="" 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}
29 72
30perl-module_src_prep() { 73perl-module_src_prep() {
74 [[ "${SRC_PREP}" = "yes" ]] && return 0
31 SRC_PREP="yes" 75 SRC_PREP="yes"
32 if [ "${style}" == "builder" ]; then 76
33 perl ${S}/Build.PL installdirs=vendor destdir=${D} 77 ${perlinfo_done} || perlinfo
34 else 78
35 if [ "${MMSIXELEVEN}" ]; then 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"
36 perl Makefile.PL ${myconf} \ 95 perl Makefile.PL \
37 PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D} 96 PREFIX=/usr \
38 else 97 INSTALLDIRS=vendor \
39 perl Makefile.PL ${myconf} \ 98 INSTALLMAN3DIR='none' \
40 PREFIX=${D}/usr INSTALLDIRS=vendor 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
108}
109
110perl-module_src_compile() {
111 ${perlinfo_done} || perlinfo
112
113 has "${EAPI:-0}" 0 1 && perl-module_src_prep
114
115 if [[ -f Build ]] ; then
116 ./Build build \
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
125}
126
127perl-module_src_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"
41 fi 134 fi
42 fi 135 fi
43
44}
45
46perl-module_src_compile() {
47
48 [ "${SRC_PREP}" != "yes" ] && perl-module_src_prep
49 if [ "${style}" != "builder" ]; then
50 make ${mymake} || die "compilation failed"
51 fi
52
53 if [ "${SRC_TEST}" == "do" ]; then
54 perl-module_src_test || die "test failed"
55 SRC_TEST="done"
56 fi
57}
58
59perl-module_src_test() {
60 if [ "${style}" == "builder" ]; then
61 perl ${S}/Build test
62 else
63 make test
64 fi
65
66} 136}
67 137
68perl-module_src_install() { 138perl-module_src_install() {
69 139 local f
70 perlinfo 140 ${perlinfo_done} || perlinfo
71 dodir ${POD_DIR} 141
72 142 if [[ -z ${mytargets} ]] ; then
73 test -z ${mytargets} && mytargets="install" 143 case "${CATEGORY}" in
74 144 dev-perl|perl-core) mytargets="pure_install" ;;
75 if [ "${style}" == "builder" ]; then 145 *) mytargets="install" ;;
76 perl ${S}/Build install 146 esac
77 else 147 fi
78 if [ "${MMSIXELEVEN}" ]; then 148
149 if [[ -f Build ]] ; then
150 ./Build ${mytargets} \
151 || die "./Build ${mytargets} failed"
152 elif [[ -f Makefile ]] ; then
79 make ${myinst} ${mytargets} || die 153 emake ${myinst} ${mytargets} \
80 else 154 || die "emake ${myinst} ${mytargets} failed"
81 make \ 155 fi
82 PREFIX=${D}/usr \ 156
83 INSTALLMAN1DIR=${D}/usr/share/man/man1 \ 157 if [[ -d "${D}"/usr/share/man ]] ; then
84 INSTALLMAN2DIR=${D}/usr/share/man/man2 \ 158# einfo "Cleaning out stray man files"
85 INSTALLMAN3DIR=${D}/usr/share/man/man3 \ 159 find "${D}"/usr/share/man -type f -name "*.3pm" -delete
86 INSTALLMAN4DIR=${D}/usr/share/man/man4 \ 160 find "${D}"/usr/share/man -depth -type d -empty -delete
87 INSTALLMAN5DIR=${D}/usr/share/man/man5 \ 161 fi
88 INSTALLMAN6DIR=${D}/usr/share/man/man6 \ 162
89 INSTALLMAN7DIR=${D}/usr/share/man/man7 \ 163 fixlocalpod
90 INSTALLMAN8DIR=${D}/usr/share/man/man8 \ 164
91 INSTALLSITEMAN1DIR=${D}/usr/share/man/man1 \ 165 for f in Change* CHANGES README* ${mydoc}; do
92 INSTALLSITEMAN2DIR=${D}/usr/share/man/man2 \ 166 [[ -s "${f}" ]] && dodoc ${f}
93 INSTALLSITEMAN3DIR=${D}/usr/share/man/man3 \ 167 done
94 INSTALLSITEMAN4DIR=${D}/usr/share/man/man4 \ 168
95 INSTALLSITEMAN5DIR=${D}/usr/share/man/man5 \ 169 if [[ -d "${D}/${VENDOR_LIB}" ]] ; then
96 INSTALLSITEMAN6DIR=${D}/usr/share/man/man6 \ 170 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
97 INSTALLSITEMAN7DIR=${D}/usr/share/man/man7 \ 171 -o \( -name '*.bs' -a -empty \) \) -delete
98 INSTALLSITEMAN8DIR=${D}/usr/share/man/man8 \ 172 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
99 INSTALLVENDORMAN3DIR=${D}/usr/share/man/man3 \ 173 fi
100 INSTALLSITEARCH=${D}/${SITE_ARCH} \ 174
101 INSTALLSCRIPT=${D}/usr/bin \ 175 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
102 ${myinst} \ 176 if file "${f}" | grep -q -i " text" ; then
103 ${mytargets} || die 177if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ;fi
178 sed -i -e "s:${D}:/:g" "${f}"
104 fi 179 fi
105 fi
106
107 if [ -f ${D}${ARCH_LIB}/perllocal.pod ];
108 then
109 touch ${D}/${POD_DIR}/${P}.pod
110 sed -e "s:${D}::g" \
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
127 for FILE in `find ${D} -type f -name "*.html" -o -name ".packlist"`; do
128 sed -i -e "s:${D}:/:g" ${FILE}
129 done 180 done
181}
130 182
131 for doc in Change* MANIFEST* README*; do 183perl-module_pkg_setup() {
132 [ -s "$doc" ] && dodoc $doc 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} )"
133 done 206 done
134 dodoc ${mydoc}
135}
136
137
138perl-module_pkg_setup() {
139
140 perlinfo
141}
142
143
144perl-module_pkg_preinst() {
145
146 perlinfo
147}
148
149perl-module_pkg_postinst() {
150
151 updatepod
152}
153
154perl-module_pkg_prerm() {
155
156 updatepod
157}
158
159perl-module_pkg_postrm() {
160
161 updatepod
162}
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} 207 PERL_VERSION=${version}
172 eval `perl '-V:installsitearch'`
173 SITE_ARCH=${installsitearch} 208 SITE_ARCH=${installsitearch}
174 eval `perl '-V:installarchlib'` 209 SITE_LIB=${installsitelib}
175 ARCH_LIB=${installarchlib} 210 ARCH_LIB=${installarchlib}
176 eval `perl '-V:installarchlib'` 211 VENDOR_LIB=${installvendorlib}
177 ARCH_LIB=${installarchlib} 212 VENDOR_ARCH=${installvendorarch}
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} 213}
184 214
185updatepod() { 215fixlocalpod() {
186 perlinfo 216 find "${D}" -type f -name perllocal.pod -delete
187 217 find "${D}" -depth -mindepth 1 -type d -empty -delete
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} 218}

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

  ViewVC Help
Powered by ViewVC 1.1.20