| 1 | # Copyright 2002 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2009 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.123 2010/04/17 19:56:27 tove Exp $ |
|
|
4 | # |
| 3 | # Author: Seemant Kulleen <seemant@gentoo.org> |
5 | # Author: Seemant Kulleen <seemant@gentoo.org> |
| 4 | # $Header: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.29 2002/10/20 06:45:12 seemant Exp $ |
6 | |
|
|
7 | # @ECLASS: perl-module.eclass |
|
|
8 | # @MAINTAINER: |
|
|
9 | # perl@gentoo.org |
|
|
10 | # @BLURB: eclass for perl modules |
|
|
11 | # @DESCRIPTION: |
| 5 | # 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 |
| 6 | # modules, and their incorporation into the Gentoo Linux system. |
13 | # modules, and their incorporation into the Gentoo Linux system. |
| 7 | |
14 | |
| 8 | #first inherit the pkg_postinst() and pkg_postrm() functions |
15 | inherit perl-helper eutils base |
| 9 | inherit perl-post |
|
|
| 10 | |
16 | |
| 11 | ECLASS=perl-module |
17 | PERL_EXPF="src_unpack src_compile src_test src_install" |
| 12 | INHERITED="$INHERITED $ECLASS" |
|
|
| 13 | |
18 | |
| 14 | EXPORT_FUNCTIONS src_compile src_install src_test |
19 | case "${EAPI:-0}" in |
|
|
20 | 0|1) |
|
|
21 | PERL_EXPF="${PERL_EXPF} pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm" |
|
|
22 | ;; |
|
|
23 | 2|3) |
|
|
24 | PERL_EXPF="${PERL_EXPF} src_prepare src_configure" |
|
|
25 | [[ ${CATEGORY} == "perl-core" ]] && \ |
|
|
26 | PERL_EXPF="${PERL_EXPF} pkg_postinst pkg_postrm" |
| 15 | |
27 | |
| 16 | eval `perl '-V:version'` |
28 | case "${GENTOO_DEPEND_ON_PERL:-yes}" in |
|
|
29 | yes) |
|
|
30 | DEPEND="dev-lang/perl[-build]" |
| 17 | DEPEND="${DEPEND} |
31 | RDEPEND="${DEPEND}" |
| 18 | sys-devel/perl" |
32 | ;; |
|
|
33 | esac |
|
|
34 | ;; |
|
|
35 | *) |
|
|
36 | DEPEND="EAPI-UNSUPPORTED" |
|
|
37 | ;; |
|
|
38 | esac |
|
|
39 | |
|
|
40 | EXPORT_FUNCTIONS ${PERL_EXPF} |
|
|
41 | |
|
|
42 | DESCRIPTION="Based on the $ECLASS eclass" |
|
|
43 | |
|
|
44 | LICENSE="${LICENSE:-|| ( Artistic GPL-1 GPL-2 GPL-3 )}" |
|
|
45 | |
|
|
46 | [[ -z "${SRC_URI}" && -z "${MODULE_A}" ]] && MODULE_A="${MY_P:-${P}}.tar.gz" |
|
|
47 | [[ -z "${SRC_URI}" && -n "${MODULE_AUTHOR}" ]] && \ |
|
|
48 | SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}" |
|
|
49 | [[ -z "${HOMEPAGE}" ]] && \ |
|
|
50 | HOMEPAGE="http://search.cpan.org/dist/${MY_PN:-${PN}}/" |
|
|
51 | |
| 19 | SRC_PREP="no" |
52 | SRC_PREP="no" |
|
|
53 | SRC_TEST="skip" |
|
|
54 | PREFER_BUILDPL="yes" |
|
|
55 | |
|
|
56 | pm_echovar="" |
|
|
57 | perlinfo_done=false |
|
|
58 | |
|
|
59 | perl-module_src_unpack() { |
|
|
60 | debug-print-function $FUNCNAME "$@" |
|
|
61 | base_src_unpack |
|
|
62 | has src_prepare ${PERL_EXPF} || perl-module_src_prepare |
|
|
63 | } |
|
|
64 | |
|
|
65 | perl-module_src_prepare() { |
|
|
66 | debug-print-function $FUNCNAME "$@" |
|
|
67 | has src_prepare ${PERL_EXPF} && base_src_prepare |
|
|
68 | perl_fix_osx_extra |
|
|
69 | esvn_clean |
|
|
70 | } |
|
|
71 | |
|
|
72 | perl-module_src_configure() { |
|
|
73 | debug-print-function $FUNCNAME "$@" |
|
|
74 | perl-module_src_prep |
|
|
75 | } |
| 20 | |
76 | |
| 21 | perl-module_src_prep() { |
77 | perl-module_src_prep() { |
| 22 | |
78 | debug-print-function $FUNCNAME "$@" |
|
|
79 | [[ ${SRC_PREP} = yes ]] && return 0 |
| 23 | SRC_PREP="yes" |
80 | SRC_PREP="yes" |
| 24 | perl Makefile.PL ${myconf} \ |
81 | |
| 25 | PREFIX=${D}/usr |
82 | perl_set_version |
|
|
83 | perl_set_eprefix |
|
|
84 | |
|
|
85 | export PERL_MM_USE_DEFAULT=1 |
|
|
86 | # Disable ExtUtils::AutoInstall from prompting |
|
|
87 | export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" |
|
|
88 | |
|
|
89 | if [[ ${PREFER_BUILDPL} == yes && -f Build.PL ]] ; then |
|
|
90 | einfo "Using Module::Build" |
|
|
91 | 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 | set -- \ |
|
|
96 | --installdirs=vendor \ |
|
|
97 | --libdoc= \ |
|
|
98 | --destdir="${D}" \ |
|
|
99 | --create_packlist=0 \ |
|
|
100 | ${myconf} |
|
|
101 | einfo "perl Build.PL" "$@" |
|
|
102 | perl Build.PL "$@" <<< "${pm_echovar}" \ |
|
|
103 | || die "Unable to build! (are you using USE=\"build\"?)" |
|
|
104 | elif [[ -f Makefile.PL ]] ; then |
|
|
105 | einfo "Using ExtUtils::MakeMaker" |
|
|
106 | set -- \ |
|
|
107 | PREFIX=${EPREFIX}/usr \ |
|
|
108 | INSTALLDIRS=vendor \ |
|
|
109 | INSTALLMAN3DIR='none' \ |
|
|
110 | DESTDIR="${D}" \ |
|
|
111 | ${myconf} |
|
|
112 | einfo "perl Makefile.PL" "$@" |
|
|
113 | perl Makefile.PL "$@" <<< "${pm_echovar}" \ |
|
|
114 | || die "Unable to build! (are you using USE=\"build\"?)" |
|
|
115 | fi |
|
|
116 | if [[ ! -f Build.PL && ! -f Makefile.PL ]] ; then |
|
|
117 | einfo "No Make or Build file detected..." |
|
|
118 | return |
|
|
119 | fi |
| 26 | } |
120 | } |
| 27 | |
121 | |
| 28 | perl-module_src_compile() { |
122 | perl-module_src_compile() { |
|
|
123 | debug-print-function $FUNCNAME "$@" |
|
|
124 | perl_set_version |
| 29 | |
125 | |
| 30 | [ "${SRC_PREP}" != "yes" ] && perl-module_src_prep |
126 | has src_configure ${PERL_EXPF} || perl-module_src_prep |
|
|
127 | |
|
|
128 | if [[ -f Build ]] ; then |
|
|
129 | ./Build build \ |
| 31 | make ${mymake} || die "compilation failed" |
130 | || die "compilation failed" |
|
|
131 | elif [[ -f Makefile ]] ; then |
|
|
132 | emake \ |
|
|
133 | OTHERLDFLAGS="${LDFLAGS}" \ |
|
|
134 | ${mymake} \ |
|
|
135 | || die "compilation failed" |
|
|
136 | # OPTIMIZE="${CFLAGS}" \ |
|
|
137 | fi |
| 32 | } |
138 | } |
|
|
139 | |
|
|
140 | # 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 | # |
| 33 | |
160 | |
| 34 | perl-module_src_test() { |
161 | perl-module_src_test() { |
| 35 | make test |
162 | debug-print-function $FUNCNAME "$@" |
|
|
163 | 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 | ${perlinfo_done} || perl_set_version |
|
|
169 | if [[ -f Build ]] ; then |
|
|
170 | ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" |
|
|
171 | elif [[ -f Makefile ]] ; then |
|
|
172 | emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed" |
|
|
173 | fi |
|
|
174 | fi |
| 36 | } |
175 | } |
| 37 | |
176 | |
| 38 | perl-module_src_install() { |
177 | perl-module_src_install() { |
| 39 | |
178 | debug-print-function $FUNCNAME "$@" |
| 40 | perl-post_perlinfo |
|
|
| 41 | dodir ${POD_DIR} |
|
|
| 42 | |
|
|
| 43 | test -z ${mytargets} && mytargets="install" |
|
|
| 44 | |
|
|
| 45 | make \ |
|
|
| 46 | PREFIX=${D}/usr \ |
|
|
| 47 | INSTALLMAN1DIR=${D}/usr/share/man/man1 \ |
|
|
| 48 | INSTALLMAN2DIR=${D}/usr/share/man/man2 \ |
|
|
| 49 | INSTALLMAN3DIR=${D}/usr/share/man/man3 \ |
|
|
| 50 | INSTALLMAN4DIR=${D}/usr/share/man/man4 \ |
|
|
| 51 | INSTALLMAN5DIR=${D}/usr/share/man/man5 \ |
|
|
| 52 | INSTALLMAN6DIR=${D}/usr/share/man/man6 \ |
|
|
| 53 | INSTALLMAN7DIR=${D}/usr/share/man/man7 \ |
|
|
| 54 | INSTALLMAN8DIR=${D}/usr/share/man/man8 \ |
|
|
| 55 | ${myinst} \ |
|
|
| 56 | ${mytargets} || die |
|
|
| 57 | |
179 | |
|
|
180 | perl_set_version |
|
|
181 | perl_set_eprefix |
| 58 | |
182 | |
| 59 | if [ -f ${D}${ARCH_LIB}/perllocal.pod ]; |
183 | local f |
| 60 | then |
|
|
| 61 | touch ${D}/${POD_DIR}/${P}.pod |
|
|
| 62 | sed -e "s:${D}::g" \ |
|
|
| 63 | ${D}${ARCH_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod |
|
|
| 64 | touch ${D}/${POD_DIR}/${P}.pod.arch |
|
|
| 65 | cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.arch |
|
|
| 66 | rm -f ${D}/${ARCH_LIB}/perllocal.pod |
|
|
| 67 | fi |
|
|
| 68 | |
|
|
| 69 | if [ -f ${D}${SITE_LIB}/perllocal.pod ]; |
|
|
| 70 | then |
|
|
| 71 | touch ${D}/${POD_DIR}/${P}.pod |
|
|
| 72 | sed -e "s:${D}::g" \ |
|
|
| 73 | ${D}${SITE_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod |
|
|
| 74 | touch ${D}/${POD_DIR}/${P}.pod.site |
|
|
| 75 | cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.site |
|
|
| 76 | rm -f ${D}/${SITE_LIB}/perllocal.pod |
|
|
| 77 | fi |
|
|
| 78 | |
184 | |
| 79 | dodoc Change* MANIFEST* README* ${mydoc} |
185 | if [[ -z ${mytargets} ]] ; then |
|
|
186 | case "${CATEGORY}" in |
|
|
187 | dev-perl|perl-core) mytargets="pure_install" ;; |
|
|
188 | *) mytargets="install" ;; |
|
|
189 | esac |
|
|
190 | fi |
|
|
191 | |
|
|
192 | 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 | perl_delete_module_manpages |
|
|
201 | perl_delete_localpod |
|
|
202 | perl_delete_packlist |
|
|
203 | perl_remove_temppath |
|
|
204 | |
|
|
205 | for f in Change* CHANGES README* TODO FAQ ${mydoc}; do |
|
|
206 | [[ -s ${f} ]] && dodoc ${f} |
|
|
207 | done |
|
|
208 | |
|
|
209 | perl_link_duallife_scripts |
| 80 | } |
210 | } |
|
|
211 | |
|
|
212 | perl-module_pkg_setup() { |
|
|
213 | debug-print-function $FUNCNAME "$@" |
|
|
214 | perl_set_version |
|
|
215 | } |
|
|
216 | |
|
|
217 | perl-module_pkg_preinst() { |
|
|
218 | debug-print-function $FUNCNAME "$@" |
|
|
219 | perl_set_version |
|
|
220 | } |
|
|
221 | |
|
|
222 | perl-module_pkg_postinst() { |
|
|
223 | debug-print-function $FUNCNAME "$@" |
|
|
224 | perl_link_duallife_scripts |
|
|
225 | } |
|
|
226 | |
|
|
227 | perl-module_pkg_prerm() { |
|
|
228 | debug-print-function $FUNCNAME "$@" |
|
|
229 | } |
|
|
230 | |
|
|
231 | perl-module_pkg_postrm() { |
|
|
232 | debug-print-function $FUNCNAME "$@" |
|
|
233 | perl_link_duallife_scripts |
|
|
234 | } |