aboutsummaryrefslogtreecommitdiff
blob: 7c395ee62887410f29c5ff497a25f6b6e9e59437 (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="3"

inherit mozilla-scm

DESCRIPTION="Netscape Portable Runtime"
HOMEPAGE="http://www.mozilla.org/projects/nspr/"

KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="debug static-libs"

src_prepare() {
	mkdir inst
	#epatch "${FILESDIR}"/${PN}-4.7.0-prtime.patch
	epatch "${FILESDIR}"/libs.patch
	epatch "${FILESDIR}"/pkgconfig.patch
	sed -i -e 's/perl5//g' nsprpub/configure || die

	# Respect LDFLAGS
	sed -i -e 's/\$(MKSHLIB) \$(OBJS)/\$(MKSHLIB) \$(LDFLAGS) \$(OBJS)/g' \
		nsprpub/config/rules.mk
}

src_configure() {
	cd "${S}"/build

	ECONF_SOURCE="../nsprpub" econf \
		$(use_enable amd64 64bit) \
		$(use_enable debug) \
		$(use_enable !debug optimize) \
		--libdir="${EPREFIX}/usr/$(get_libdir)" \
		|| die "econf failed"
}

src_compile() {
	cd "${S}"/build
	emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" || die "failed to build"
}

src_install () {
	# Their build system is royally confusing, as usual
	cd "${S}"/build
	emake DESTDIR="${D}" install || die "emake install failed"

	cd "${ED}"/usr/$(get_libdir)
	if ! use static-libs; then
		for file in *.a; do
			rm -f ${file} || die "failed to remove static libraries."
		done
	fi

	local n=
	MINOR_VERSION=$(sed -n -r -e 's|.*NSPR_[0-9]+_([0-9]+)(_[0-9]+)?.*|\1|p' "${S}"/nsprpub/TAG-INFO)
	for file in *$(get_libname); do
		n=${file%$(get_libname)}$(get_libname ${MINOR_VERSION})
		mv ${file} ${n} || die "failed to mv files around"
		ln -s ${n} ${file} || die "failed to symlink files."
	done

	# Remove stupid files in /usr/bin
	rm -f "${ED}"/usr/bin/prerr.properties || die "failed to cleanup unneeded files"
}

pkg_postinst() {
	ewarn
	ewarn "Please make sure you run revdep-rebuild after upgrade."
	ewarn "This is *extremely* important to ensure your system nspr works properly."
	ewarn
}