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

Contents of /eclass/perl-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.55 - (hide annotations) (download)
Mon Dec 22 20:40:05 2003 UTC (11 years 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 vapier 1.33 # Copyright 1999-2003 Gentoo Technologies, Inc.
2 vapier 1.30 # Distributed under the terms of the GNU General Public License v2
3 rac 1.55 # $Header: /home/cvsroot/gentoo-x86/eclass/perl-module.eclass,v 1.54 2003/10/24 05:09:32 rac Exp $
4 vapier 1.33 #
5 seemant 1.1 # Author: Seemant Kulleen <seemant@gentoo.org>
6 vapier 1.33 #
7 seemant 1.1 # The perl-module eclass is designed to allow easier installation of perl
8     # modules, and their incorporation into the Gentoo Linux system.
9 seemant 1.3
10 danarmak 1.14 ECLASS=perl-module
11 seemant 1.35 INHERITED="${INHERITED} ${ECLASS}"
12 danarmak 1.13
13 seemant 1.35 EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm \
14 seemant 1.37 src_compile src_install src_test \
15     perlinfo updatepod
16 seemant 1.1
17 mcummings 1.25 eval `perl '-V:version'`
18 rac 1.48 newdepend ">=dev-lang/perl-5.8.0-r12"
19 azarah 1.11 SRC_PREP="no"
20 rac 1.55 SRC_TEST="skip"
21 azarah 1.11
22 seemant 1.35 SITE_LIB=""
23     ARCH_LIB=""
24     POD_DIR=""
25    
26 rac 1.51 # handling of DESTDIR changed in makemaker 6.11
27 rac 1.54 MMSIXELEVEN=`perl -e 'use ExtUtils::MakeMaker; print( $ExtUtils::MakeMaker::VERSION ge "6.11" )'`
28 rac 1.51
29 aliz 1.15 perl-module_src_prep() {
30 azarah 1.11
31     SRC_PREP="yes"
32 mcummings 1.43 if [ "${style}" == "builder" ]; then
33 rac 1.48 perl ${S}/Build.PL installdirs=vendor destdir=${D}
34 mcummings 1.43 else
35 rac 1.51 if [ "${MMSIXELEVEN}" ]; then
36     perl Makefile.PL ${myconf} \
37     PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D}
38     else
39     perl Makefile.PL ${myconf} \
40 johnm 1.52 PREFIX=${D}/usr INSTALLDIRS=vendor
41 rac 1.51 fi
42 mcummings 1.43 fi
43    
44 azarah 1.11 }
45    
46 aliz 1.15 perl-module_src_compile() {
47 seemant 1.6
48 aliz 1.15 [ "${SRC_PREP}" != "yes" ] && perl-module_src_prep
49 mcummings 1.43 if [ "${style}" != "builder" ]; then
50     make ${mymake} || die "compilation failed"
51     fi
52    
53 rac 1.55 if [ "${SRC_TEST}" == "do" ]; then
54     perl-module_src_test || die "test failed"
55     SRC_TEST="done"
56     fi
57 seemant 1.8 }
58    
59 aliz 1.15 perl-module_src_test() {
60 mcummings 1.43 if [ "${style}" == "builder" ]; then
61     perl ${S}/Build test
62     else
63     make test
64     fi
65    
66 seemant 1.1 }
67    
68 aliz 1.15 perl-module_src_install() {
69 seemant 1.12
70 seemant 1.35 perlinfo
71 seemant 1.1 dodir ${POD_DIR}
72    
73 seemant 1.9 test -z ${mytargets} && mytargets="install"
74 mcummings 1.31 eval `perl '-V:installsitearch'`
75     SITE_ARCH=${installsitearch}
76     eval `perl '-V:installarchlib'`
77     ARCH_LIB=${installarchlib}
78    
79 mcummings 1.43 if [ "${style}" == "builder" ]; then
80     perl ${S}/Build install
81     else
82 rac 1.51 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 mcummings 1.43 fi
110 mcummings 1.20
111     if [ -f ${D}${ARCH_LIB}/perllocal.pod ];
112     then
113 seemant 1.27 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 mcummings 1.20 fi
120 seemant 1.1
121 mcummings 1.20 if [ -f ${D}${SITE_LIB}/perllocal.pod ];
122     then
123 seemant 1.27 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 mcummings 1.20 fi
130 mcummings 1.38
131     for FILE in `find ${D} -type f -name "*.html" -o -name ".packlist"`; do
132 mcummings 1.42 sed -i -e "s:${D}:/:g" ${FILE}
133 mcummings 1.38 done
134 seemant 1.1
135 lanius 1.53 for doc in Change* MANIFEST* README*; do
136     [ -s "$doc" ] && dodoc $doc
137     done
138     dodoc ${mydoc}
139 seemant 1.35 }
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 seemant 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20