/[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.60 Revision 1.114
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.60 2004/05/01 22:03:12 rac Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.114 2009/03/11 06:36:45 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
18 24 case "${GENTOO_DEPEND_ON_PERL:-yes}" in
25 yes)
19DEPEND="dev-lang/perl" 26 DEPEND="dev-lang/perl[-build]"
27 RDEPEND="${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
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=""
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}
28 72
29perl-module_src_prep() { 73perl-module_src_prep() {
30 74 [[ "${SRC_PREP}" = "yes" ]] && return 0
31 perlinfo
32
33 SRC_PREP="yes" 75 SRC_PREP="yes"
34 if [ "${style}" == "builder" ]; then 76
35 perl ${S}/Build.PL installdirs=vendor destdir=${D} 77 ${perlinfo_done} || perlinfo
36 else 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 --extra_linker_flags="${LDFLAGS}" \
91 ${myconf} \
92 <<< ${pm_echovar} \
93 || die "Unable to build! (are you using USE=\"build\"?)"
94 elif [[ -f Makefile.PL ]] ; then
95 einfo "Using ExtUtils::MakeMaker"
37 perl Makefile.PL ${myconf} \ 96 perl Makefile.PL \
38 PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D} 97 PREFIX=/usr \
98 INSTALLDIRS=vendor \
99 INSTALLMAN3DIR='none' \
100 DESTDIR="${D}" \
101 ${myconf} \
102 <<< ${pm_echovar} \
103 || die "Unable to build! (are you using USE=\"build\"?)"
104 fi
105 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
106 einfo "No Make or Build file detected..."
107 return
39 fi 108 fi
40} 109}
41 110
42perl-module_src_compile() { 111perl-module_src_compile() {
112 ${perlinfo_done} || perlinfo
43 113
44 [ "${SRC_PREP}" != "yes" ] && perl-module_src_prep 114 has "${EAPI:-0}" 0 1 && perl-module_src_prep
45 if [ "${style}" != "builder" ]; then 115
116 if [[ -f Build ]] ; then
117 ./Build build \
46 make ${mymake} || die "compilation failed" 118 || die "compilation failed"
47 fi 119 elif [[ -f Makefile ]] ; then
48 120 emake \
49 if [ "${SRC_TEST}" == "do" ]; then 121 OTHERLDFLAGS="${LDFLAGS}" \
50 perl-module_src_test || die "test failed" 122 ${mymake} \
51 SRC_TEST="done" 123 || die "compilation failed"
124# OPTIMIZE="${CFLAGS}" \
52 fi 125 fi
53} 126}
54 127
55perl-module_src_test() { 128perl-module_src_test() {
56 if [ "${style}" == "builder" ]; then 129 if [[ "${SRC_TEST}" == "do" ]] ; then
57 perl ${S}/Build test 130 ${perlinfo_done} || perlinfo
58 else 131 if [[ -f Build ]] ; then
59 make test 132 ./Build test || die "test failed"
133 elif [[ -f Makefile ]] ; then
134 emake test || die "test failed"
135 fi
60 fi 136 fi
61} 137}
62 138
63perl-module_src_install() { 139perl-module_src_install() {
64 140 local f
65 perlinfo 141 ${perlinfo_done} || perlinfo
66 dodir ${POD_DIR} 142
67 143 if [[ -z ${mytargets} ]] ; then
68 test -z ${mytargets} && mytargets="install" 144 case "${CATEGORY}" in
69 145 dev-perl|perl-core) mytargets="pure_install" ;;
70 if [ "${style}" == "builder" ]; then 146 *) mytargets="install" ;;
71 perl ${S}/Build install 147 esac
72 else 148 fi
149
150 if [[ -f Build ]] ; then
151 ./Build ${mytargets} \
152 || die "./Build ${mytargets} failed"
153 elif [[ -f Makefile ]] ; then
73 make ${myinst} ${mytargets} || die 154 emake ${myinst} ${mytargets} \
155 || die "emake ${myinst} ${mytargets} failed"
74 fi 156 fi
75 157
76 if [ -f ${D}${ARCH_LIB}/perllocal.pod ]; 158# einfo "Cleaning out stray man files"
77 then 159 find "${D}" -type f -name "*.3pm" -delete
78 touch ${D}/${POD_DIR}/${P}.pod 160 find "${D}"/usr/share/man -depth -type d -empty -delete 2>/dev/null
79 sed -e "s:${D}::g" \
80 ${D}${ARCH_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
81 touch ${D}/${POD_DIR}/${P}.pod.arch
82 cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.arch
83 rm -f ${D}/${ARCH_LIB}/perllocal.pod
84 fi
85
86 if [ -f ${D}${SITE_LIB}/perllocal.pod ];
87 then
88 touch ${D}/${POD_DIR}/${P}.pod
89 sed -e "s:${D}::g" \
90 ${D}${SITE_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
91 touch ${D}/${POD_DIR}/${P}.pod.site
92 cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.site
93 rm -f ${D}/${SITE_LIB}/perllocal.pod
94 fi
95 161
96 for FILE in `find ${D} -type f -name "*.html" -o -name ".packlist"`; do 162 fixlocalpod
97 sed -i -e "s:${D}:/:g" ${FILE} 163
164 for f in Change* CHANGES README* ${mydoc}; do
165 [[ -s "${f}" ]] && dodoc ${f}
98 done 166 done
99 167
100 for doc in Change* MANIFEST* README*; do 168 find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
101 [ -s "$doc" ] && dodoc $doc 169 -o \( -name '*.bs' -a -empty \) \) -delete
170 find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
171
172 find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
173 if file "${f}" | grep -q -i " text" ; then
174if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ;fi
175 sed -i -e "s:${D}:/:g" "${f}"
176 fi
102 done 177 done
103 dodoc ${mydoc}
104} 178}
105
106 179
107perl-module_pkg_setup() { 180perl-module_pkg_setup() {
108 181 ${perlinfo_done} || perlinfo
109 perlinfo
110} 182}
111
112 183
113perl-module_pkg_preinst() { 184perl-module_pkg_preinst() {
114 185 ${perlinfo_done} || perlinfo
115 perlinfo
116} 186}
117 187
118perl-module_pkg_postinst() { 188perl-module_pkg_postinst() { : ; }
189# einfo "Man pages are not installed for most modules now."
190# einfo "Please use perldoc instead."
191#}
119 192
120 updatepod
121}
122
123perl-module_pkg_prerm() { 193perl-module_pkg_prerm() { : ; }
124
125 updatepod
126}
127 194
128perl-module_pkg_postrm() { 195perl-module_pkg_postrm() { : ; }
129
130 updatepod
131}
132 196
133perlinfo() { 197perlinfo() {
198 perlinfo_done=true
134 199
135 if [ -f /usr/bin/perl ] 200 local f version install{site{arch,lib},archlib,vendor{arch,lib}}
136 then 201 for f in version install{site{arch,lib},archlib,vendor{arch,lib}} ; do
137 POD_DIR="/usr/share/perl/gentoo-pods/${version}" 202 eval "$(perl -V:${f} )"
138 fi 203 done
139 eval `perl '-V:version'`
140 PERL_VERSION=${version} 204 PERL_VERSION=${version}
141 eval `perl '-V:installsitearch'`
142 SITE_ARCH=${installsitearch} 205 SITE_ARCH=${installsitearch}
143 eval `perl '-V:installarchlib'` 206 SITE_LIB=${installsitelib}
144 ARCH_LIB=${installarchlib} 207 ARCH_LIB=${installarchlib}
145 eval `perl '-V:installarchlib'` 208 VENDOR_LIB=${installvendorlib}
146 ARCH_LIB=${installarchlib} 209 VENDOR_ARCH=${installvendorarch}
147 eval `perl '-V:installsitearch'`
148 SITE_LIB=${installsitearch}
149} 210}
150 211
151updatepod() { 212fixlocalpod() {
152 perlinfo 213 find "${D}" -type f -name perllocal.pod -delete
153 214 find "${D}" -depth -mindepth 1 -type d -empty -delete
154 if [ -d "${POD_DIR}" ]
155 then
156 for FILE in `find ${POD_DIR} -type f -name "*.pod.arch"`; do
157 cat ${FILE} >> ${ARCH_LIB}/perllocal.pod
158 rm -f ${FILE}
159 done
160 for FILE in `find ${POD_DIR} -type f -name "*.pod.site"`; do
161 cat ${FILE} >> ${SITE_LIB}/perllocal.pod
162 rm -f ${FILE}
163 done
164 fi
165} 215}

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.114

  ViewVC Help
Powered by ViewVC 1.1.20