summaryrefslogtreecommitdiff
blob: 7350e6b331cf7402a92d4894ca3fe2732520c87c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/perl/perl-5.6.1-r11.ebuild,v 1.12 2004/01/18 06:46:58 rac Exp $

DESCRIPTION="Larry Wall's Practical Extraction and Reporting Language"
SRC_URI="ftp://ftp.perl.org/pub/CPAN/src/${P}.tar.gz"
HOMEPAGE="http://www.perl.org/"

LICENSE="Artistic GPL-2"
SLOT="0"
KEYWORDS="~x86 ppc ~sparc ~alpha mips ~hppa"
IUSE="berkdb gdbm"

RDEPEND="gdbm? ( >=sys-libs/gdbm-1.8.0 )
	>=sys-libs/db-3.2.3h-r3
	=sys-libs/db-1.85-r1"
DEPEND="sys-apps/groff
	>=sys-apps/portage-2.0.45-r5
	${RDEPEND}"

PDEPEND=">=dev-perl/ExtUtils-MakeMaker-6.05-r4
	>=dev-perl/Safe-2.09"

src_compile() {
	use gdbm || use berkdb || die "You must have either gdbm or berkdb installed and in your use flags."

	#The following is to handle international users. Perl does nls post-install
	export LC_ALL=C

	if [ "${ARCH}" = "alpha" ]; then
		CFLAGS="${CFLAGS} -fPIC"
		CXXFLAGS="${CXXFLAGS} -fPIC"
	fi

	local myconf
	if [ "`use gdbm`" ]
	then
		myconf="-Di_gdbm"
	fi

	# It seems that perl config use the hostname instead of the osname on hppa
	if [ "`use hppa`" ]
	then
		myconf="${myconf} -Dosname=linux"
	fi

	if [ "`use berkdb`" ]
	then
		myconf="${myconf} -Di_db -Di_ndbm"
	else
		myconf="${myconf} -Ui_db -Ui_ndbm"
	fi

	# put in built-in removal patch
	patch -p1 < ${FILESDIR}/${PV}-builtin-fixup.diff || die
	patch -p0 < ${FILESDIR}/${PV}-op-test-fix.diff || die

	# configure for libperl.so
	sh Configure -des \
		-Darchname=${CHOST%%-*}-linux \
		-Dcccdlflags='-fPIC' \
		-Dcc=gcc \
		-Dccdlflags='-rdynamic' \
		-Dprefix='/usr' \
		-Dvendorprefix='/usr' \
		-Dsiteprefixx='/usr' \
		-Dlocincpth=' ' \
		-Doptimize="${CFLAGS}" \
		-Duselargefiles \
		-Duseshrplib \
		-Dman3ext=3pm \
		-Dlibperl=libperl.so \
		-Dd_dosuid \
		-Dd_semctl_semun \
		-Dcf_by=Gentoo \
		-Ud_csh \
		${myconf} || die
	# add optimization flags
	cp config.sh config.sh.orig
	sed -e "s:optimize='-O2':optimize=\'${CFLAGS}\':" config.sh.orig > config.sh
	# create libperl.so and move it out of the way
	mv -f Makefile Makefile_orig
	sed -e 's#^CCDLFLAGS = -rdynamic -Wl,-rpath,/usr/lib/perl5/.*#CCDLFLAGS = -rdynamic#' \
	    -e 's#^all: $(FIRSTMAKEFILE) #all: README #' \
		Makefile_orig > Makefile
	export PARCH=`grep myarchname config.sh | cut -f2 -d"'"`

	make -f Makefile depend || die
	make -f Makefile libperl.so || die
	mv libperl.so ${WORKDIR}

	# starting from scratch again
	cd ${WORKDIR}
	rm -rf ${S}
	unpack ${A}
	cd ${S}

	# put in built-in removal patch
	patch -p1 < ${FILESDIR}/${PV}-builtin-fixup.diff || die
	patch -p0 < ${FILESDIR}/${PV}-op-test-fix.diff || die

	# configure for libperl.a
# this is gross -- from Christian Gafton, Red Hat
	cat > config.over <<EOF
installprefix=${D}/usr
#test -d \$installprefix || mkdir \$installprefix
#test -d \$installprefix/bin || mkdir \$installprefix/bin
installarchlib=\`echo \$installarchlib | sed "s!\$prefix!\$installprefix!"\`
installbin=\`echo \$installbin | sed "s!\$prefix!\$installprefix!"\`
#installman1dir=\$installprefix/share/man/man1
#installman3dir=\$installprefix/share/man/man3
installman1dir=\`echo \$installman1dir | sed "s!\$prefix!\$installprefix!"\`
installman3dir=\`echo \$installman3dir | sed "s!\$prefix!\$installprefix!"\`
installman1dir=\`echo \$installman1dir | sed "s!/man/!/share/man/!"\`
installman3dir=\`echo \$installman3dir | sed "s!/man/!/share/man/!"\`
man1ext=1
man3ext=3pm
installprivlib=\`echo \$installprivlib | sed "s!\$prefix!\$installprefix!"\`
installscript=\`echo \$installscript | sed "s!\$prefix!\$installprefix!"\`
installsitelib=\`echo \$installsitelib | sed "s!\$prefix!\$installprefix!"\`
installsitearch=\`echo \$installsitearch | sed "s!\$prefix!\$installprefix!"\`
EOF

	sh Configure -des \
		-Dcc=gcc \
		-Dprefix='/usr' \
		-Dvendorprefix='/usr' \
		-Dsiteprefixx='/usr' \
		-Darchname=${CHOST%%-*}-linux \
		-Doptimize="${CFLAGS}" \
		-Duselargefiles \
		-Dd_dosuid \
		-Dlocincpth=' ' \
		-Dd_semctl_semun \
		-Dman3ext=3pm \
		-Dcf_by=Gentoo \
		-Ud_csh \
		${myconf} || die

	#Optimize ;)
	cp config.sh config.sh.orig
	sed -e "s:optimize='-O2':optimize=\'${CFLAGS}\':" config.sh.orig > config.sh
	#THIS IS USED LATER:
	export PARCH=`grep myarchname config.sh | cut -f2 -d"'"`

# Umm, for some reason this doesn't want to work, so we'll just remove
#  the makefiles and let make rebuild them itself. (It seems to do it
#  right the second time... -- pete
#    cp makefile makefile.orig
#    sed -e "s:^0::" makefile.orig > makefile

	mv Makefile Makefile_orig
	sed -e 's#^all: $(FIRSTMAKEFILE) #all: README #' \
		Makefile_orig > Makefile

	make || die

	# Parallel make fails
	# dont use the || die since some tests fail on bootstrap
	if [ `expr "$PARCH" ":" "sparc"` -gt 4 ]; then
		echo "Skipping tests on this platform"
	else
	    make test
	fi
}

src_install() {
#The following is to handle international users. Perl does nls post-install
	export LC_ALL=C

	export PARCH=`grep myarchname config.sh | cut -f2 -d"'"`

	insinto /usr/lib/perl5/${PV}/${PARCH}/CORE/
	doins ${WORKDIR}/libperl.so
	dosym /usr/lib/perl5/${PV}/${PARCH}/CORE/libperl.so /usr/lib/libperl.so


#    make -f Makefile \
#		INSTALLMAN1DIR=${D}/usr/share/man/man1 \
#		INSTALLMAN3DIR=${D}/usr/share/man/man3 \
#		install || die

	make \
		DESTDIR=${D} \
		INSTALLMAN1DIR=${D}/usr/share/man/man1 \
		INSTALLMAN3DIR=${D}/usr/share/man/man3 \
		install || die "Unable to make install"
	install -m 755 utils/pl2pm ${D}/usr/bin/pl2pm

	#man pages

#	./perl installman \
#		--man1dir=${D}/usr/share/man/man1 \
#		--man1ext=1 \
#		--man3dir=${D}/usr/share/man/man3 \
#		--man3ext=3


	# This removes ${D} from Config.pm

	dosed /usr/lib/perl5/${PV}/${CHOST%%-*}-linux/Config.pm
	dosed /usr/lib/perl5/${PV}/${CHOST%%-*}-linux/.packlist

	# DOCUMENTATION

	dodoc Changes* Artistic Copying README Todo* AUTHORS
	prepalldocs


	# HTML Documentation
	dodir /usr/share/doc/${PF}/html
	${D}/usr/bin/perl installhtml --recurse --htmldir=${D}/usr/share/doc/${PF}/html

}


pkg_postinst() {
	# generates the ph files for perl
	cd /usr/include; h2ph -r -l .

}