summaryrefslogtreecommitdiff
blob: 1cf817503fbe912acd2a7c2d1181224d349436a1 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/spidermonkey/spidermonkey-1.5_rc6-r1.ebuild,v 1.12 2005/12/06 11:21:35 jer Exp $

inherit eutils toolchain-funcs

MY_PV="${PV/_/-}a"
DESCRIPTION="Stand-alone JavaScript C library"
HOMEPAGE="http://www.mozilla.org/js/spidermonkey/"
SRC_URI="ftp://ftp.mozilla.org/pub/mozilla.org/js/js-${MY_PV}.tar.gz"

LICENSE="NPL-1.1"
SLOT="0"
KEYWORDS="amd64 ~hppa ppc ppc64 ~x86"
IUSE=""

DEPEND=""

S=${WORKDIR}/js/src/

src_unpack() {
	unpack ${A}
	cd ${S}

	epatch ${FILESDIR}/${P}-va_copy-fix.patch || die 'Patching failed.'
}

src_compile() {
	cat >>Makefile.ref<<'EOF'

.PHONY: install-headers
install-headers: $(HFILES)
	install -g root -o root -m 555 -d $(DESTDIR)/usr/include/js
	install -g root -o root -m 444 $^ $(DESTDIR)/usr/include/js
EOF

	tc-export CC LD AR

	do_my_compile() {
		emake -j1 \
		-f Makefile.ref \
		BUILD_OPT=1
		return $?
	}

	# it needs to run twice
	{ do_my_compile || do_my_compile ;} || die
}

src_install() {
	cd Linux_All_OPT.OBJ
	dolib.a libjs.a || die "libjs.a failed"
	dolib.so libjs.so || die "libjs.so failed"
	dobin js jscpucfg || die "dobin failed"
	cd -

	make -f Makefile.ref \
		DESTDIR=${D} install-headers \
		|| die "make install-headers failed."

	dodoc ../README
	dohtml README.html
}