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



inherit mozilla-scm mozilla-config prefix pax-utils

DESCRIPTION="Mozilla runtime package that can be used to bootstrap XUL+XPCOM applications"
HOMEPAGE="http://developer.mozilla.org/en/docs/XULRunner"

KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
SLOT="1.9"
IUSE="debug"

RDEPEND="
	!www-plugins/weave
	"

src_prepare() {
	# Gentoo specific stuff
	epatch "${FILESDIR}"/gentoo-specific.patch

	eprefixify \
		extensions/java/xpcom/interfaces/org/mozilla/xpcom/Mozilla.java \
		xpcom/build/nsXPCOMPrivate.h \
		xulrunner/installer/Makefile.in \
		xulrunner/app/nsRegisterGREUnix.cpp

	# fix double symbols due to double -ljemalloc
	sed -i \
		-e '/^LIBS += $(JEMALLOC_LIBS)/s/^/#/' \
		xulrunner/stub/Makefile.in \
		|| die

	# Gentoo install dirs
	sed -i \
		-e 's:$(MOZ_APP_VERSION):'"${MAJ_XUL_PV}:" \
		config/autoconf.mk.in \
		|| die "${MAJ_XUL_PV} sed failed!"

	# Enable gnomebreakpad
	if use debug ; then
		sed -i \
			-e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
			build/unix/run-mozilla.sh \
			|| die "sed failed!"
	fi

	sed -i -e '/^MOZ_JS_SHARED_LIBS=/c\MOZ_JS_SHARED_LIBS=$`js-config --libs`' configure.in \
		|| die "failed to add libmozjs configure"
	sed -i -e '/^MOZ_JS_SHARED_LIBS=/aCFLAGS="$`js-config --cflags` $CFLAGS"' configure.in \
		|| die "failed to add libmozjs configure"
	sed -i -e '\|^AC_OUTPUT_SUBDIRS(js/src)|d' configure.in \
		|| die "remove js/src configure failed"
	sed -i -e '\|^include $(topsrcdir)/config/js/build.mk|d' toolkit/toolkit-tiers.mk \
		|| die "remove config/js/build.mk failed"
	sed -i -e '/mozilla-js.pc/d' xulrunner/installer/Makefile.in \
		|| die "remove mozilla-js.pc failed"

	eautoreconf
}

src_configure() {
	# Disable no-print-directory
	MAKEOPTS=${MAKEOPTS/--no-print-directory/}

	# Ensure that are plugins dir is enabled as default
	sed -i -e "s:/usr/lib/mozilla/plugins:/usr/$(get_libdir)/nsbrowser/plugins:" \
		"${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path!"

	# hack added to workaround bug 299905 on hosts with libc that doesn't
	# support tls, (probably will only hit this condition with Gentoo Prefix)
	tc-has-tls -l || export ac_cv_thread_keyword=no

	mozconfig_configure
}

src_install() {
	mozilla-scm_src_install

	rm "${ED}"/usr/bin/xulrunner

	if has_multilib_profile; then
		local config
		for config in "${ED}"/etc/gre.d/*.system.conf ; do
			mv "${config}" "${config%.conf}.${CHOST}.conf"
		done
	fi

	dodir /usr/bin
	dosym "${MOZLIBDIR}/xulrunner" "/usr/bin/xulrunner-${MAJ_XUL_PV}" || die

	# env.d file for ld search path
	dodir /etc/env.d
	echo "LDPATH=${EPREFIX}/${MOZLIBDIR}" > "${ED}"/etc/env.d/08xulrunner || die "env.d failed"

	pax-mark m "${ED}"/${MOZLIBDIR}/plugin-container
}