Annotation of /branches/R11-unstable/include/perl.sminc
Parent Directory | Revision Log
Revision 2 -
(hide annotations)
(download)
Fri Oct 10 13:29:42 2008 UTC (16 years ago) by niro
Original Path: trunk/core/include/perl.sminc
File size: 3246 byte(s)
Fri Oct 10 13:29:42 2008 UTC (16 years ago) by niro
Original Path: trunk/core/include/perl.sminc
File size: 3246 byte(s)
import repo
1 | niro | 2 | # $Header: /magellan-cvs/smage/include/perl.sminc,v 1.15 2007-06-15 22:06:59 niro Exp $ |
2 | |||
3 | # inherits {pre,post}install() and {pre,post}remove() to mage file | ||
4 | INHERITS="${INHERITS} perl" | ||
5 | |||
6 | # taken from gentoo eclass perm-module.eclass | ||
7 | perlinfo() | ||
8 | { | ||
9 | if [ -f /usr/bin/perl ] | ||
10 | then | ||
11 | POD_DIR="/usr/share/perl/magellan-pods/${version}" | ||
12 | fi | ||
13 | |||
14 | eval $(perl '-V:version') | ||
15 | PERL_VERSION=${version} | ||
16 | |||
17 | eval $(perl '-V:installsitearch') | ||
18 | SITE_ARCH=${installsitearch} | ||
19 | |||
20 | eval $(perl '-V:installarchlib') | ||
21 | ARCH_LIB=${installarchlib} | ||
22 | |||
23 | eval $(perl '-V:installsitearch') | ||
24 | SITE_LIB=${installsitearch} | ||
25 | |||
26 | local installvendorlib | ||
27 | eval $(perl '-V:installvendorlib') | ||
28 | VENDOR_LIB=${installvendorlib} | ||
29 | |||
30 | local installvendorarch | ||
31 | eval $(perl '-V:installvendorarch') | ||
32 | VENDOR_ARCH=${installvendorarch} | ||
33 | |||
34 | # handling of DESTDIR changed in makemaker 6.11 | ||
35 | MMSIXELEVEN=$(perl -e 'use ExtUtils::MakeMaker; print( $ExtUtils::MakeMaker::VERSION ge "6.11" )') | ||
36 | } | ||
37 | |||
38 | # taken from gentoo eclass perl-module.eclass | ||
39 | updatepod() | ||
40 | { | ||
41 | local i | ||
42 | |||
43 | perlinfo | ||
44 | |||
45 | if [ -d "${POD_DIR}" ] | ||
46 | then | ||
47 | for i in $(find ${POD_DIR} -type f -name "*.pod.arch") | ||
48 | do | ||
49 | cat ${i} >> ${ARCH_LIB}/perllocal.pod | ||
50 | rm -f ${i} | ||
51 | done | ||
52 | for i in $(find ${POD_DIR} -type f -name "*.pod.site") | ||
53 | do | ||
54 | cat ${i} >> ${SITE_LIB}/perllocal.pod | ||
55 | rm -f ${i} | ||
56 | done | ||
57 | for i in $(find ${POD_DIR} -type f -name "*.pod.vendor") | ||
58 | do | ||
59 | cat ${i} >> ${VENDOR_LIB}/perllocal.pod | ||
60 | rm -f ${i} | ||
61 | done | ||
62 | fi | ||
63 | } | ||
64 | |||
65 | fixlocalpod() | ||
66 | { | ||
67 | perlinfo | ||
68 | |||
69 | if [ -f ${BINDIR}${ARCH_LIB}/perllocal.pod ] | ||
70 | then | ||
71 | rm -f ${BINDIR}/${ARCH_LIB}/perllocal.pod | ||
72 | fi | ||
73 | |||
74 | if [ -f ${BINDIR}${SITE_LIB}/perllocal.pod ] | ||
75 | then | ||
76 | rm -f ${BINDIR}/${SITE_LIB}/perllocal.pod | ||
77 | fi | ||
78 | |||
79 | if [ -f ${BINDIR}${VENDOR_LIB}/perllocal.pod ] | ||
80 | then | ||
81 | rm -f ${BINDIR}/${VENDOR_LIB}/perllocal.pod | ||
82 | fi | ||
83 | } | ||
84 | |||
85 | perl_src_prepare() | ||
86 | { | ||
87 | munpack ${SRCFILE} || die | ||
88 | } | ||
89 | |||
90 | perl_src_compile() | ||
91 | { | ||
92 | cd ${SRCDIR} | ||
93 | |||
94 | perlinfo | ||
95 | |||
96 | export PERL_MM_USE_DEFAULT=1 | ||
97 | export PERL_EXTUTILS_AUTOINSTALL="--skipdeps" | ||
98 | |||
99 | local configure_opts="$@" | ||
100 | |||
101 | if [[ -f Build.PL ]] | ||
102 | then | ||
103 | perl Build.PL \ | ||
104 | --installdirs=vendor \ | ||
105 | --destdir=${BINDIR} \ | ||
106 | --libdoc= \ | ||
107 | || die | ||
108 | perl Build build || die | ||
109 | |||
110 | elif [[ -f Makefile.PL ]] | ||
111 | then | ||
112 | perl Makefile.PL \ | ||
113 | ${configure_opts} \ | ||
114 | PREFIX=/usr \ | ||
115 | INSTALLMAN3DIR='none' \ | ||
116 | INSTALLDIRS=vendor \ | ||
117 | DESTDIR=${BINDIR} \ | ||
118 | || die | ||
119 | make || die | ||
120 | else | ||
121 | die "No buildscript detected!" | ||
122 | fi | ||
123 | |||
124 | fixlocalpod | ||
125 | } | ||
126 | |||
127 | perl_src_install() | ||
128 | { | ||
129 | local i | ||
130 | local stat | ||
131 | |||
132 | perlinfo | ||
133 | |||
134 | if [[ -f Makefile ]] | ||
135 | then | ||
136 | make install || die | ||
137 | elif [[ -f Build ]] | ||
138 | then | ||
139 | perl ${SRCDIR}/Build install || die | ||
140 | else | ||
141 | die "No installscript detected!" | ||
142 | fi | ||
143 | |||
144 | # clean manfiles | ||
145 | for i in $(find ${BINDIR} -type f -name "*.3pm*") | ||
146 | do | ||
147 | rm ${i} || die | ||
148 | done | ||
149 | find ${BINDIR}/usr/share/man -depth -type d 2>/dev/null | xargs -r rmdir 2>/dev/null | ||
150 | |||
151 | # remove local podfiles | ||
152 | fixlocalpod | ||
153 | |||
154 | # remove BINDIR from text so files | ||
155 | for i in $(find ${BINDIR} -type f | grep -v '.so') | ||
156 | do | ||
157 | stat=$(file ${i} | grep -i " text") | ||
158 | if [[ ${stat}x != x ]] | ||
159 | then | ||
160 | sed -i "s:${BINDIR}:/:g" ${i} || die | ||
161 | fi | ||
162 | done | ||
163 | |||
164 | local i | ||
165 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
166 | FAQ LICENSE NEWS README TODO | ||
167 | do | ||
168 | if [ -f ${SRCDIR}/${i} ] | ||
169 | then | ||
170 | minstalldocs ${i} || die | ||
171 | fi | ||
172 | done | ||
173 | } | ||
174 | |||
175 | |||
176 | export_inherits perl src_prepare src_compile src_install |