| 1 | # Copyright 2002 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 Gentoo Technologies, Inc. |
| 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.60 2004/05/01 22:03:12 rac 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.10 2002/05/22 19:34:02 danarmak Exp $ |
6 | # Maintained by the Perl herd <perl@gentoo.org> |
|
|
7 | # |
| 5 | # The perl-module eclass is designed to allow easier installation of perl |
8 | # The perl-module eclass is designed to allow easier installation of perl |
| 6 | # modules, and their incorporation into the Gentoo Linux system. |
9 | # modules, and their incorporation into the Gentoo Linux system. |
| 7 | |
10 | |
| 8 | #first inherit the pkg_postinst() and pkg_postrm() functions |
11 | ECLASS=perl-module |
| 9 | inherit perl-post |
12 | INHERITED="${INHERITED} ${ECLASS}" |
| 10 | |
13 | |
| 11 | ECLASS=base |
14 | EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm \ |
| 12 | EXPORT_FUNCTIONS src_compile src_install src_test |
15 | src_compile src_install src_test \ |
|
|
16 | perlinfo updatepod |
| 13 | |
17 | |
| 14 | newdepend ">=sys-devel/perl-5" |
|
|
| 15 | |
18 | |
| 16 | base_src_compile() { |
19 | DEPEND="dev-lang/perl" |
|
|
20 | SRC_PREP="no" |
|
|
21 | SRC_TEST="skip" |
| 17 | |
22 | |
|
|
23 | PERL_VERSION="" |
|
|
24 | SITE_ARCH="" |
|
|
25 | SITE_LIB="" |
|
|
26 | ARCH_LIB="" |
|
|
27 | POD_DIR="" |
|
|
28 | |
|
|
29 | perl-module_src_prep() { |
|
|
30 | |
|
|
31 | perlinfo |
|
|
32 | |
|
|
33 | SRC_PREP="yes" |
|
|
34 | if [ "${style}" == "builder" ]; then |
|
|
35 | perl ${S}/Build.PL installdirs=vendor destdir=${D} |
|
|
36 | else |
| 18 | perl Makefile.PL ${myconf} |
37 | perl Makefile.PL ${myconf} \ |
| 19 | make ${mymake} || die "compilation failed" |
38 | PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D} |
|
|
39 | fi |
| 20 | } |
40 | } |
| 21 | |
41 | |
| 22 | base_src_test() { |
42 | perl-module_src_compile() { |
| 23 | make test |
43 | |
|
|
44 | [ "${SRC_PREP}" != "yes" ] && perl-module_src_prep |
|
|
45 | if [ "${style}" != "builder" ]; then |
|
|
46 | make ${mymake} || die "compilation failed" |
|
|
47 | fi |
|
|
48 | |
|
|
49 | if [ "${SRC_TEST}" == "do" ]; then |
|
|
50 | perl-module_src_test || die "test failed" |
|
|
51 | SRC_TEST="done" |
|
|
52 | fi |
| 24 | } |
53 | } |
| 25 | |
54 | |
| 26 | base_src_install() { |
55 | perl-module_src_test() { |
|
|
56 | if [ "${style}" == "builder" ]; then |
|
|
57 | perl ${S}/Build test |
|
|
58 | else |
|
|
59 | make test |
|
|
60 | fi |
|
|
61 | } |
| 27 | |
62 | |
|
|
63 | perl-module_src_install() { |
|
|
64 | |
|
|
65 | perlinfo |
| 28 | dodir ${POD_DIR} |
66 | dodir ${POD_DIR} |
| 29 | |
67 | |
| 30 | test -z ${mytargets} && mytargets="install" |
68 | test -z ${mytargets} && mytargets="install" |
|
|
69 | |
|
|
70 | if [ "${style}" == "builder" ]; then |
|
|
71 | perl ${S}/Build install |
|
|
72 | else |
|
|
73 | make ${myinst} ${mytargets} || die |
|
|
74 | fi |
|
|
75 | |
|
|
76 | if [ -f ${D}${ARCH_LIB}/perllocal.pod ]; |
|
|
77 | then |
|
|
78 | touch ${D}/${POD_DIR}/${P}.pod |
|
|
79 | sed -e "s:${D}::g" \ |
|
|
80 | ${D}${ARCH_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod |
|
|
81 | touch ${D}/${POD_DIR}/${P}.pod.arch |
|
|
82 | cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.arch |
|
|
83 | rm -f ${D}/${ARCH_LIB}/perllocal.pod |
|
|
84 | fi |
| 31 | |
85 | |
| 32 | make \ |
86 | if [ -f ${D}${SITE_LIB}/perllocal.pod ]; |
| 33 | PREFIX=${D}/usr \ |
87 | then |
| 34 | INSTALLMAN1DIR=${D}/usr/share/man/man1 \ |
88 | touch ${D}/${POD_DIR}/${P}.pod |
| 35 | INSTALLMAN2DIR=${D}/usr/share/man/man2 \ |
89 | sed -e "s:${D}::g" \ |
| 36 | INSTALLMAN3DIR=${D}/usr/share/man/man3 \ |
90 | ${D}${SITE_LIB}/perllocal.pod >> ${D}/${POD_DIR}/${P}.pod |
| 37 | INSTALLMAN4DIR=${D}/usr/share/man/man4 \ |
91 | touch ${D}/${POD_DIR}/${P}.pod.site |
| 38 | INSTALLMAN5DIR=${D}/usr/share/man/man5 \ |
92 | cat ${D}/${POD_DIR}/${P}.pod >>${D}/${POD_DIR}/${P}.pod.site |
| 39 | INSTALLMAN6DIR=${D}/usr/share/man/man6 \ |
93 | rm -f ${D}/${SITE_LIB}/perllocal.pod |
| 40 | INSTALLMAN7DIR=${D}/usr/share/man/man7 \ |
94 | fi |
| 41 | INSTALLMAN8DIR=${D}/usr/share/man/man8 \ |
|
|
| 42 | ${myinst} \ |
|
|
| 43 | ${mytargets} || die |
|
|
| 44 | |
95 | |
| 45 | sed -e "s:${D}::g" \ |
96 | for FILE in `find ${D} -type f -name "*.html" -o -name ".packlist"`; do |
| 46 | ${D}/${ARCH_LIB}/perllocal.pod \ |
97 | sed -i -e "s:${D}:/:g" ${FILE} |
| 47 | > ${D}/${POD_DIR}/${P}.pod |
98 | done |
|
|
99 | |
|
|
100 | for doc in Change* MANIFEST* README*; do |
|
|
101 | [ -s "$doc" ] && dodoc $doc |
|
|
102 | done |
|
|
103 | dodoc ${mydoc} |
|
|
104 | } |
|
|
105 | |
|
|
106 | |
|
|
107 | perl-module_pkg_setup() { |
|
|
108 | |
|
|
109 | perlinfo |
|
|
110 | } |
|
|
111 | |
|
|
112 | |
|
|
113 | perl-module_pkg_preinst() { |
| 48 | |
114 | |
| 49 | rm -f ${D}/${ARCH_LIB}/perllocal.pod |
115 | perlinfo |
|
|
116 | } |
| 50 | |
117 | |
| 51 | dodoc Change* MANIFEST* README* ${mydoc} |
118 | perl-module_pkg_postinst() { |
|
|
119 | |
|
|
120 | updatepod |
| 52 | } |
121 | } |
|
|
122 | |
|
|
123 | perl-module_pkg_prerm() { |
|
|
124 | |
|
|
125 | updatepod |
|
|
126 | } |
|
|
127 | |
|
|
128 | perl-module_pkg_postrm() { |
|
|
129 | |
|
|
130 | updatepod |
|
|
131 | } |
|
|
132 | |
|
|
133 | perlinfo() { |
|
|
134 | |
|
|
135 | if [ -f /usr/bin/perl ] |
|
|
136 | then |
|
|
137 | POD_DIR="/usr/share/perl/gentoo-pods/${version}" |
|
|
138 | fi |
|
|
139 | eval `perl '-V:version'` |
|
|
140 | PERL_VERSION=${version} |
|
|
141 | eval `perl '-V:installsitearch'` |
|
|
142 | SITE_ARCH=${installsitearch} |
|
|
143 | eval `perl '-V:installarchlib'` |
|
|
144 | ARCH_LIB=${installarchlib} |
|
|
145 | eval `perl '-V:installarchlib'` |
|
|
146 | ARCH_LIB=${installarchlib} |
|
|
147 | eval `perl '-V:installsitearch'` |
|
|
148 | SITE_LIB=${installsitearch} |
|
|
149 | } |
|
|
150 | |
|
|
151 | updatepod() { |
|
|
152 | perlinfo |
|
|
153 | |
|
|
154 | if [ -d "${POD_DIR}" ] |
|
|
155 | then |
|
|
156 | for FILE in `find ${POD_DIR} -type f -name "*.pod.arch"`; do |
|
|
157 | cat ${FILE} >> ${ARCH_LIB}/perllocal.pod |
|
|
158 | rm -f ${FILE} |
|
|
159 | done |
|
|
160 | for FILE in `find ${POD_DIR} -type f -name "*.pod.site"`; do |
|
|
161 | cat ${FILE} >> ${SITE_LIB}/perllocal.pod |
|
|
162 | rm -f ${FILE} |
|
|
163 | done |
|
|
164 | fi |
|
|
165 | } |