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

Contents of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.123 - (hide annotations) (download)
Sat Apr 17 19:56:27 2010 UTC (4 years, 5 months ago) by tove
Branch: MAIN
Changes since 1.122: +48 -95 lines
Add perl-helper.eclass (#302183) and update perl-module.eclass per <http://archives.gentoo.org/gentoo-dev/msg_82ff2383bd5836dda541d0b2b4685ec8.xml>. Add support for EAPI=3 (#310513). Removes "AppleDouble encoded Macintosh files"  (#268497)

1 tove 1.117 # Copyright 1999-2009 Gentoo Foundation
2 vapier 1.30 # Distributed under the terms of the GNU General Public License v2
3 hanno 1.122 # $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.121 2010/01/13 15:15: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.123 inherit perl-helper eutils base
16 tove 1.117
17     PERL_EXPF="src_unpack src_compile src_test src_install"
18 tove 1.113
19     case "${EAPI:-0}" in
20     0|1)
21 tove 1.117 PERL_EXPF="${PERL_EXPF} pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm"
22 tove 1.113 ;;
23 tove 1.123 2|3)
24 tove 1.117 PERL_EXPF="${PERL_EXPF} src_prepare src_configure"
25     [[ ${CATEGORY} == "perl-core" ]] && \
26     PERL_EXPF="${PERL_EXPF} pkg_postinst pkg_postrm"
27 tove 1.113
28     case "${GENTOO_DEPEND_ON_PERL:-yes}" in
29     yes)
30     DEPEND="dev-lang/perl[-build]"
31     RDEPEND="${DEPEND}"
32     ;;
33     esac
34     ;;
35 tove 1.123 *)
36     DEPEND="EAPI-UNSUPPORTED"
37     ;;
38 tove 1.113 esac
39 danarmak 1.13
40 tove 1.117 EXPORT_FUNCTIONS ${PERL_EXPF}
41    
42 tove 1.113 DESCRIPTION="Based on the $ECLASS eclass"
43 seemant 1.1
44 hanno 1.122 LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}"
45 robbat2 1.109
46 tove 1.113 [[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz"
47     [[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \
48 tove 1.123 SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}"
49 tove 1.113 [[ -z "${HOMEPAGE}" ]] && \
50 tove 1.118 HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/"
51 mcummings 1.66
52 azarah 1.11 SRC_PREP="no"
53 rac 1.55 SRC_TEST="skip"
54 mcummings 1.97 PREFER_BUILDPL="yes"
55 azarah 1.11
56 mcummings 1.101 pm_echovar=""
57 tove 1.113 perlinfo_done=false
58 seemant 1.35
59 mcummings 1.102 perl-module_src_unpack() {
60 tove 1.123 debug-print-function $FUNCNAME "$@"
61 tove 1.121 base_src_unpack
62 tove 1.117 has src_prepare ${PERL_EXPF} || perl-module_src_prepare
63 tove 1.113 }
64    
65     perl-module_src_prepare() {
66 tove 1.123 debug-print-function $FUNCNAME "$@"
67 tove 1.121 has src_prepare ${PERL_EXPF} && base_src_prepare
68 tove 1.123 perl_fix_osx_extra
69 tove 1.113 esvn_clean
70     }
71    
72     perl-module_src_configure() {
73 tove 1.123 debug-print-function $FUNCNAME "$@"
74 tove 1.113 perl-module_src_prep
75 mcummings 1.102 }
76    
77 aliz 1.15 perl-module_src_prep() {
78 tove 1.123 debug-print-function $FUNCNAME "$@"
79 tove 1.117 [[ ${SRC_PREP} = yes ]] && return 0
80 tove 1.113 SRC_PREP="yes"
81 rac 1.60
82 tove 1.123 perl_set_version
83     perl_set_eprefix
84 rac 1.60
85 rac 1.64 export PERL_MM_USE_DEFAULT=1
86 mcummings 1.90 # Disable ExtUtils::AutoInstall from prompting
87     export PERL_EXTUTILS_AUTOINSTALL="--skipdeps"
88 rac 1.64
89 tove 1.117 if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then
90 mcummings 1.97 einfo "Using Module::Build"
91 tove 1.120 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!"
94     fi
95 tove 1.123 set -- \
96 tove 1.113 --installdirs=vendor \
97     --libdoc= \
98     --destdir="${D}" \
99     --create_packlist=0 \
100 tove 1.123 ${myconf}
101     einfo "perl Build.PL" "$@"
102     perl Build.PL "$@" <<< "${pm_echovar}" \
103 tove 1.113 || die "Unable to build! (are you using USE=\"build\"?)"
104     elif [[ -f Makefile.PL ]] ; then
105 mcummings 1.85 einfo "Using ExtUtils::MakeMaker"
106 tove 1.123 set -- \
107     PREFIX=${EPREFIX}/usr \
108 tove 1.113 INSTALLDIRS=vendor \
109     INSTALLMAN3DIR='none' \
110     DESTDIR="${D}" \
111 tove 1.123 ${myconf}
112     einfo "perl Makefile.PL" "$@"
113     perl Makefile.PL "$@" <<< "${pm_echovar}" \
114 tove 1.113 || die "Unable to build! (are you using USE=\"build\"?)"
115 mcummings 1.88 fi
116 tove 1.113 if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then
117 mcummings 1.88 einfo "No Make or Build file detected..."
118 mcummings 1.85 return
119 mcummings 1.43 fi
120 azarah 1.11 }
121    
122 aliz 1.15 perl-module_src_compile() {
123 tove 1.123 debug-print-function $FUNCNAME "$@"
124     perl_set_version
125 tove 1.113
126 tove 1.117 has src_configure ${PERL_EXPF} || perl-module_src_prep
127 seemant 1.6
128 tove 1.113 if [[ -f Build ]] ; then
129     ./Build build \
130     || die "compilation failed"
131     elif [[ -f Makefile ]] ; then
132     emake \
133     OTHERLDFLAGS="${LDFLAGS}" \
134     ${mymake} \
135     || die "compilation failed"
136     # OPTIMIZE="${CFLAGS}" \
137 mcummings 1.43 fi
138 seemant 1.8 }
139    
140 tove 1.117 # For testers:
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     #
150     # SRC_TEST="do"
151     #
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     #
160    
161 aliz 1.15 perl-module_src_test() {
162 tove 1.123 debug-print-function $FUNCNAME "$@"
163 tove 1.117 if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then
164     if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then
165     export HARNESS_OPTIONS=j$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/" )
166     einfo "Test::Harness Jobs=${HARNESS_OPTIONS}"
167     fi
168 tove 1.123 ${perlinfo_done} || perl_set_version
169 tove 1.113 if [[ -f Build ]] ; then
170 tove 1.117 ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed"
171 tove 1.113 elif [[ -f Makefile ]] ; then
172 tove 1.117 emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed"
173 mcummings 1.68 fi
174 mcummings 1.43 fi
175 seemant 1.1 }
176    
177 aliz 1.15 perl-module_src_install() {
178 tove 1.123 debug-print-function $FUNCNAME "$@"
179    
180     perl_set_version
181     perl_set_eprefix
182    
183 tove 1.113 local f
184 swegener 1.76
185 tove 1.114 if [[ -z ${mytargets} ]] ; then
186     case "${CATEGORY}" in
187     dev-perl|perl-core) mytargets="pure_install" ;;
188     *) mytargets="install" ;;
189     esac
190     fi
191 swegener 1.76
192 tove 1.113 if [[ -f Build ]] ; then
193     ./Build ${mytargets} \
194     || die "./Build ${mytargets} failed"
195     elif [[ -f Makefile ]] ; then
196     emake ${myinst} ${mytargets} \
197     || die "emake ${myinst} ${mytargets} failed"
198     fi
199    
200 tove 1.123 perl_delete_module_manpages
201     perl_delete_localpod
202     perl_delete_packlist
203     perl_remove_temppath
204 mcummings 1.20
205 tove 1.123 for f in Change* CHANGES README* TODO FAQ ${mydoc}; do
206 tove 1.117 [[ -s ${f} ]] && dodoc ${f}
207 mcummings 1.98 done
208 mcummings 1.65
209 tove 1.123 perl_link_duallife_scripts
210 seemant 1.35 }
211    
212     perl-module_pkg_setup() {
213 tove 1.123 debug-print-function $FUNCNAME "$@"
214     perl_set_version
215 seemant 1.35 }
216    
217     perl-module_pkg_preinst() {
218 tove 1.123 debug-print-function $FUNCNAME "$@"
219     perl_set_version
220 seemant 1.35 }
221    
222 tove 1.117 perl-module_pkg_postinst() {
223 tove 1.123 debug-print-function $FUNCNAME "$@"
224     perl_link_duallife_scripts
225 tove 1.117 }
226 seemant 1.35
227 tove 1.123 perl-module_pkg_prerm() {
228     debug-print-function $FUNCNAME "$@"
229     }
230 seemant 1.35
231 tove 1.117 perl-module_pkg_postrm() {
232 tove 1.123 debug-print-function $FUNCNAME "$@"
233     perl_link_duallife_scripts
234 tove 1.117 }

  ViewVC Help
Powered by ViewVC 1.1.20