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

Contents of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.55 - (show annotations) (download)
Mon Dec 22 20:40:05 2003 UTC (10 years, 11 months ago) by rac
Branch: MAIN
Changes since 1.54: +6 -1 lines
Add SRC_TEST functionality. If you define SRC_TEST to "do",
src_compile will run make test.  In the future, this may become the
default, but for now the default is "skip", to maintain compatibility.

1 # Copyright 1999-2003 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.54 2003/10/24 05:09:32 rac Exp $
4 #
5 # Author: Seemant Kulleen <seemant@gentoo.org>
6 #
7 # The perl-module eclass is designed to allow easier installation of perl
8 # modules, and their incorporation into the Gentoo Linux system.
9
10 ECLASS=perl-module
11 INHERITED="${INHERITED} ${ECLASS}"
12
13 EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm \
14 src_compile src_install src_test \
15 perlinfo updatepod
16
17 eval `perl '-V:version'`
18 newdepend ">=dev-lang/perl-5.8.0-r12"
19 SRC_PREP="no"
20 SRC_TEST="skip"
21
22 SITE_LIB=""
23 ARCH_LIB=""
24 POD_DIR=""
25
26 # handling of DESTDIR changed in makemaker 6.11
27 MMSIXELEVEN=`perl -e 'use ExtUtils::MakeMaker; print( $ExtUtils::MakeMaker::VERSION ge "6.11" )'`
28
29 perl-module_src_prep() {
30
31 SRC_PREP="yes"
32 if [ "${style}" == "builder" ]; then
33 perl ${S}/Build.PL installdirs=vendor destdir=${D}
34 else
35 if [ "${MMSIXELEVEN}" ]; then
36 perl Makefile.PL ${myconf} \
37 PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D}
38 else
39 perl Makefile.PL ${myconf} \
40 PREFIX=${D}/usr INSTALLDIRS=vendor
41 fi
42 fi
43
44 }
45
46 perl-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
59 perl-module_src_test() {
60 if [ "${style}" == "builder" ]; then
61 perl ${S}/Build test
62 else
63 make test
64 fi
65
66 }
67
68 perl-module_src_install() {
69
70 perlinfo
71 dodir ${POD_DIR}
72
73 test -z ${mytargets} && mytargets="install"
74 eval `perl '-V:installsitearch'`
75 SITE_ARCH=${installsitearch}
76 eval `perl '-V:installarchlib'`
77 ARCH_LIB=${installarchlib}
78
79 if [ "${style}" == "builder" ]; then
80 perl ${S}/Build install
81 else
82 if [ "${MMSIXELEVEN}" ]; then
83 make ${myinst} ${mytargets} || die
84 else
85 make \
86 PREFIX=${D}/usr \
87 INSTALLMAN1DIR=${D}/usr/share/man/man1 \
88 INSTALLMAN2DIR=${D}/usr/share/man/man2 \
89 INSTALLMAN3DIR=${D}/usr/share/man/man3 \
90 INSTALLMAN4DIR=${D}/usr/share/man/man4 \
91 INSTALLMAN5DIR=${D}/usr/share/man/man5 \
92 INSTALLMAN6DIR=${D}/usr/share/man/man6 \
93 INSTALLMAN7DIR=${D}/usr/share/man/man7 \
94 INSTALLMAN8DIR=${D}/usr/share/man/man8 \
95 INSTALLSITEMAN1DIR=${D}/usr/share/man/man1 \
96 INSTALLSITEMAN2DIR=${D}/usr/share/man/man2 \
97 INSTALLSITEMAN3DIR=${D}/usr/share/man/man3 \
98 INSTALLSITEMAN4DIR=${D}/usr/share/man/man4 \
99 INSTALLSITEMAN5DIR=${D}/usr/share/man/man5 \
100 INSTALLSITEMAN6DIR=${D}/usr/share/man/man6 \
101 INSTALLSITEMAN7DIR=${D}/usr/share/man/man7 \
102 INSTALLSITEMAN8DIR=${D}/usr/share/man/man8 \
103 INSTALLVENDORMAN3DIR=${D}/usr/share/man/man3 \
104 INSTALLSITEARCH=${D}/${SITE_ARCH} \
105 INSTALLSCRIPT=${D}/usr/bin \
106 ${myinst} \
107 ${mytargets} || die
108 fi
109 fi
110
111 if [ -f ${D}${ARCH_LIB}/perllocal.pod ];
112 then
113 touch ${D}/${POD_DIR}/${P}.pod
114 sed -e "s:${D}::g" \
115 ${D}${ARCH_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
116 touch ${D}/${POD_DIR}/${P}.pod.arch
117 cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.arch
118 rm -f ${D}/${ARCH_LIB}/perllocal.pod
119 fi
120
121 if [ -f ${D}${SITE_LIB}/perllocal.pod ];
122 then
123 touch ${D}/${POD_DIR}/${P}.pod
124 sed -e "s:${D}::g" \
125 ${D}${SITE_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod
126 touch ${D}/${POD_DIR}/${P}.pod.site
127 cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.site
128 rm -f ${D}/${SITE_LIB}/perllocal.pod
129 fi
130
131 for FILE in `find ${D} -type f -name "*.html" -o -name ".packlist"`; do
132 sed -i -e "s:${D}:/:g" ${FILE}
133 done
134
135 for doc in Change* MANIFEST* README*; do
136 [ -s "$doc" ] && dodoc $doc
137 done
138 dodoc ${mydoc}
139 }
140
141
142 perl-module_pkg_setup() {
143
144 perlinfo
145 }
146
147
148 perl-module_pkg_preinst() {
149
150 perlinfo
151 }
152
153 perl-module_pkg_postinst() {
154
155 updatepod
156 }
157
158 perl-module_pkg_prerm() {
159
160 updatepod
161 }
162
163 perl-module_pkg_postrm() {
164
165 updatepod
166 }
167
168 perlinfo() {
169
170 if [ -f /usr/bin/perl ]
171 then
172 eval `perl '-V:installarchlib'`
173 eval `perl '-V:installsitearch'`
174 ARCH_LIB=${installarchlib}
175 SITE_LIB=${installsitearch}
176
177 eval `perl '-V:version'`
178 POD_DIR="/usr/share/perl/gentoo-pods/${version}"
179 fi
180
181 }
182
183 updatepod() {
184 perlinfo
185
186 if [ -d "${POD_DIR}" ]
187 then
188 for FILE in `find ${POD_DIR} -type f -name "*.pod.arch"`; do
189 cat ${FILE} >> ${ARCH_LIB}/perllocal.pod
190 rm -f ${FILE}
191 done
192 for FILE in `find ${POD_DIR} -type f -name "*.pod.site"`; do
193 cat ${FILE} >> ${SITE_LIB}/perllocal.pod
194 rm -f ${FILE}
195 done
196 fi
197 }

  ViewVC Help
Powered by ViewVC 1.1.20