/[gentoo-x86]/eclass/perl-module.eclass
Gentoo

Contents of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.115 - (hide annotations) (download)
Thu Mar 26 17:40:23 2009 UTC (5 years, 7 months ago) by tove
Branch: MAIN
Changes since 1.114: +13 -9 lines
Fix quoting of pm_echovar (#263671)

1 vapier 1.63 # Copyright 1999-2004 Gentoo Foundation
2 vapier 1.30 # Distributed under the terms of the GNU General Public License v2
3 tove 1.115 # $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.114 2009/03/11 06:36:45 tove Exp $
4 vapier 1.33 #
5 seemant 1.1 # Author: Seemant Kulleen <seemant@gentoo.org>
6 tove 1.113
7     # @ECLASS: perl-module.eclass
8     # @MAINTAINER:
9     # perl@gentoo.org
10     # @BLURB: eclass for perl modules
11     # @DESCRIPTION:
12 seemant 1.1 # The perl-module eclass is designed to allow easier installation of perl
13     # modules, and their incorporation into the Gentoo Linux system.
14 seemant 1.3
15 tove 1.113 inherit eutils base
16    
17     case "${EAPI:-0}" in
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
23    
24     case "${GENTOO_DEPEND_ON_PERL:-yes}" in
25     yes)
26     DEPEND="dev-lang/perl[-build]"
27     RDEPEND="${DEPEND}"
28     ;;
29     esac
30     ;;
31     esac
32 danarmak 1.13
33 tove 1.113 DESCRIPTION="Based on the $ECLASS eclass"
34 seemant 1.1
35 tove 1.113 LICENSE="${LICENSE:-|| ( Artistic GPL-2 )}"
36 robbat2 1.109
37 tove 1.113 [[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz"
38     [[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
39 robbat2 1.112 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION}/${MODULE_A}"
40 tove 1.113 [[ -z "${HOMEPAGE}" ]] && \
41     HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}"
42 mcummings 1.66
43 azarah 1.11 SRC_PREP="no"
44 rac 1.55 SRC_TEST="skip"
45 mcummings 1.97 PREFER_BUILDPL="yes"
46 azarah 1.11
47 mcummings 1.57 PERL_VERSION=""
48     SITE_ARCH=""
49 seemant 1.35 SITE_LIB=""
50 tove 1.113 ARCH_LIB=""
51     VENDOR_ARCH=""
52 mcummings 1.65 VENDOR_LIB=""
53 tove 1.113
54 mcummings 1.101 pm_echovar=""
55 tove 1.113 perlinfo_done=false
56 seemant 1.35
57 mcummings 1.102 perl-module_src_unpack() {
58 tove 1.113 base_src_unpack unpack
59     has "${EAPI:-0}" 0 1 && perl-module_src_prepare
60     }
61    
62     perl-module_src_prepare() {
63     if [[ -n ${PATCHES} ]] ; then
64 mcummings 1.102 base_src_unpack autopatch
65     fi
66 tove 1.113 esvn_clean
67     }
68    
69     perl-module_src_configure() {
70     perl-module_src_prep
71 mcummings 1.102 }
72    
73 aliz 1.15 perl-module_src_prep() {
74 tove 1.113 [[ "${SRC_PREP}" = "yes" ]] && return 0
75     SRC_PREP="yes"
76 rac 1.60
77 tove 1.113 ${perlinfo_done} || perlinfo
78 rac 1.60
79 rac 1.64 export PERL_MM_USE_DEFAULT=1
80 mcummings 1.90 # Disable ExtUtils::AutoInstall from prompting
81     export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
82 rac 1.64
83 tove 1.113 if [[ "${PREFER_BUILDPL}" == "yes" && -f Build.PL ]] ; then
84 mcummings 1.97 einfo "Using Module::Build"
85 tove 1.113 perl Build.PL \
86     --installdirs=vendor \
87     --libdoc= \
88     --destdir="${D}" \
89     --create_packlist=0 \
90     --extra_linker_flags="${LDFLAGS}" \
91     ${myconf} \
92 tove 1.115 <<< "${pm_echovar}" \
93 tove 1.113 || die "Unable to build! (are you using USE=\"build\"?)"
94     elif [[ -f Makefile.PL ]] ; then
95 mcummings 1.85 einfo "Using ExtUtils::MakeMaker"
96 tove 1.113 perl Makefile.PL \
97     PREFIX=/usr \
98     INSTALLDIRS=vendor \
99     INSTALLMAN3DIR='none' \
100     DESTDIR="${D}" \
101     ${myconf} \
102 tove 1.115 <<< "${pm_echovar}" \
103 tove 1.113 || die "Unable to build! (are you using USE=\"build\"?)"
104 mcummings 1.88 fi
105 tove 1.113 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
106 mcummings 1.88 einfo "No Make or Build file detected..."
107 mcummings 1.85 return
108 mcummings 1.43 fi
109 azarah 1.11 }
110    
111 aliz 1.15 perl-module_src_compile() {
112 tove 1.113 ${perlinfo_done} || perlinfo
113    
114     has "${EAPI:-0}" 0 1 && perl-module_src_prep
115 seemant 1.6
116 tove 1.113 if [[ -f Build ]] ; then
117     ./Build build \
118     || die "compilation failed"
119     elif [[ -f Makefile ]] ; then
120     emake \
121     OTHERLDFLAGS="${LDFLAGS}" \
122     ${mymake} \
123     || die "compilation failed"
124     # OPTIMIZE="${CFLAGS}" \
125 mcummings 1.43 fi
126 seemant 1.8 }
127    
128 aliz 1.15 perl-module_src_test() {
129 tove 1.113 if [[ "${SRC_TEST}" == "do" ]] ; then
130     ${perlinfo_done} || perlinfo
131     if [[ -f Build ]] ; then
132     ./Build test || die "test failed"
133     elif [[ -f Makefile ]] ; then
134     emake test || die "test failed"
135 mcummings 1.68 fi
136 mcummings 1.43 fi
137 seemant 1.1 }
138    
139 aliz 1.15 perl-module_src_install() {
140 tove 1.113 local f
141     ${perlinfo_done} || perlinfo
142 swegener 1.76
143 tove 1.114 if [[ -z ${mytargets} ]] ; then
144     case "${CATEGORY}" in
145     dev-perl|perl-core) mytargets="pure_install" ;;
146     *) mytargets="install" ;;
147     esac
148     fi
149 swegener 1.76
150 tove 1.113 if [[ -f Build ]] ; then
151     ./Build ${mytargets} \
152     || die "./Build ${mytargets} failed"
153     elif [[ -f Makefile ]] ; then
154     emake ${myinst} ${mytargets} \
155     || die "emake ${myinst} ${mytargets} failed"
156     fi
157    
158 tove 1.115 if [[ -d "${D}"/usr/share/man ]] ; then
159     # einfo "Cleaning out stray man files"
160     find "${D}"/usr/share/man -type f -name "*.3pm" -delete
161     find "${D}"/usr/share/man -depth -type d -empty -delete
162     fi
163 swegener 1.76
164 tove 1.113 fixlocalpod
165 mcummings 1.20
166 tove 1.113 for f in Change* CHANGES README* ${mydoc}; do
167     [[ -s "${f}" ]] && dodoc ${f}
168 mcummings 1.98 done
169 mcummings 1.65
170 tove 1.115 if [[ -d "${D}/${VENDOR_LIB}" ]] ; then
171     find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \
172     -o \( -name '*.bs' -a -empty \) \) -delete
173     find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete
174     fi
175 tove 1.113
176     find "${D}" -type f -not -name '*.so' -print0 | while read -rd '' f ; do
177     if file "${f}" | grep -q -i " text" ; then
178     if grep -q "${D}" "${f}" ; then ewarn "QA: File contains a temporary path ${f}" ;fi
179     sed -i -e "s:${D}:/:g" "${f}"
180 mcummings 1.65 fi
181 mcummings 1.38 done
182 seemant 1.35 }
183    
184     perl-module_pkg_setup() {
185 tove 1.113 ${perlinfo_done} || perlinfo
186 seemant 1.35 }
187    
188     perl-module_pkg_preinst() {
189 tove 1.113 ${perlinfo_done} || perlinfo
190 seemant 1.35 }
191    
192 tove 1.113 perl-module_pkg_postinst() { : ; }
193     # einfo "Man pages are not installed for most modules now."
194     # einfo "Please use perldoc instead."
195     #}
196 seemant 1.35
197 tove 1.113 perl-module_pkg_prerm() { : ; }
198 seemant 1.35
199 tove 1.113 perl-module_pkg_postrm() { : ; }
200 seemant 1.35
201     perlinfo() {
202 tove 1.113 perlinfo_done=true
203 seemant 1.35
204 tove 1.113 local f version install{site{arch,lib},archlib,vendor{arch,lib}}
205     for f in version install{site{arch,lib},archlib,vendor{arch,lib}} ; do
206     eval "$(perl -V:${f} )"
207     done
208 mcummings 1.58 PERL_VERSION=${version}
209     SITE_ARCH=${installsitearch}
210 mcummings 1.79 SITE_LIB=${installsitelib}
211 mcummings 1.58 ARCH_LIB=${installarchlib}
212 mcummings 1.65 VENDOR_LIB=${installvendorlib}
213     VENDOR_ARCH=${installvendorarch}
214 seemant 1.35 }
215    
216 mcummings 1.66 fixlocalpod() {
217 tove 1.113 find "${D}" -type f -name perllocal.pod -delete
218     find "${D}" -depth -mindepth 1 -type d -empty -delete
219 seemant 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20