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

# @ECLASS: mozilla-scm.eclass
# @MAINTAINER:
# Sardem FF7 <sardemff7.pub@gmail.com>
# @BLURB: This eclass provides Mozilla SCM building support

WANT_AUTOCONF="2.1"

inherit mozilla-scm-fetch base multilib toolchain-funcs autotools python

MAJ_XUL_PV="7.0"

MOZ_HG_BASE_URI="http://hg.mozilla.org"

S="${WORKDIR}/${XULRUNNER_HG_MODULE}"

#
# Some per-application stuff
#
IS_LIBXUL=false
MOZLIBDIR="/usr/$(get_libdir)/xulrunner-${MAJ_XUL_PV}"
MOZDEVELDIR="/usr/$(get_libdir)/xulrunner-devel-${MAJ_XUL_PV}"
SDKDIR="${MOZDEVELDIR}/sdk"
MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
case "${PN}" in
	xulrunner)
		IS_LIBXUL=true
		MOZ_APPLICATION=xulrunner
		MOZILLA_FIVE_HOME="${MOZLIBDIR}"
	;;
	firefox)
		MOZ_APPLICATION=browser
	;;
	thunderbird)
		MOZ_APPLICATION=mail
	;;
esac

EXPORT_FUNCTIONS pkg_setup src_unpack src_configure src_install pkg_postinst

# @ECLASS-VARIABLE: EHG_REVISION
# @DESCRIPTION:
# Create working directory for specified revision, defaults to tip.
#
# EHG_REVISION is passed as a value for --rev parameter, so it can be more than
# just a revision, please consult `hg help revisions' for more details.
: ${EHG_REVISION:=tip}


##
## Base common stuff
##
RDEPEND=""
[ "${PN}" != "nspr" ] && RDEPEND+="~dev-libs/nspr-9999"
if [ -n "${MOZ_APPLICATION}" ]; then
	IUSE="mozdom"

	DEPEND="
		meta-sync/mozilla-repositories[mozdom=]
		"
	RDEPEND+="
		x11-libs/libXrender
		x11-libs/libXt
		x11-libs/libXmu
		>=sys-libs/zlib-1.1.4
		"

	${IS_LIBXUL} || \
	RDEPEND+="
		~net-libs/xulrunner-9999[libnotify=,mozdom=,raw=,system-sqlite=,webm=,wifi=]
		"
else
	DEPEND="
		meta-sync/mozilla-repositories
		"
fi

DEPEND+="${RDEPEND}
	app-arch/zip
	dev-util/pkgconfig
	=dev-lang/python-2*[threads]
	"

##
## eclass exported function
## src_unpack
##
function mozilla-scm_src_unpack {
	local base_dest=${1:-${XULRUNNER_HG_MODULE}}
	addwrite "$(dirname "${EHG_STORE_DIR}")" || die "addwrite failed"
	moz_hg_unpack "${XULRUNNER_HG_MODULE}" "${base_dest}"
	use mozdom && moz_hg_unpack "${MOZDOM_HG_MODULE}" "${base_dest}/extensions/inspector"
}

##
## eclass exported function
## pkg_setup
##
function mozilla-scm_pkg_setup {
	# Ensure we always build with C locale.
	export LANG="C"
	export LC_ALL="C"
	export LC_MESSAGES="C"
	export LC_CTYPE="C"

	python_set_active_version 2
}

##
## eclass exported function
## src_configure
##
function mozilla-scm_src_configure {
	CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" PYTHON="$(PYTHON)" econf "$@"
}

##
## eclass exported function
## src_install
##
function mozilla-scm_src_install {
	emake DESTDIR="${D}" install || die "emake install failed"

	local prefdir="${ED}/${MOZILLA_FIVE_HOME}/defaults/pref"
	[[ -d "${prefdir}erences" ]] && prefdir+="erences"
	cp "${FILESDIR}"/default-prefs.js \
		"${prefdir}/all-gentoo.js" || \
		die "failed to cp default-prefs.js"

	# Workaround
	if ! ${IS_LIBXUL}; then
		dosym ../xulrunner-${MAJ_XUL_PV} "${MOZILLA_FIVE_HOME}"/xulrunner \
			|| die "failed to workaround xulrunner gre stuff"
	fi
}

##
## eclass exported function
## pkg_postinst
##
function mozilla-scm_pkg_postinst {
	if ! ${IS_LIBXUL}; then
		ewarn "All the packages built against ${PN} won't compile,"
		ewarn "any package that fails to build warrants a bug report."

		inherit fdo-mime
		# Update mimedb for the new .desktop file
		fdo-mime_desktop_database_update
	fi

	ewarn "This is highly experimental DO NOT file a bug report"
	ewarn "on Gentoo's bugzilla, please visit the Mozilla one instead"

	einfo "Don't forget to sync with meta-sync/mozilla-repositories"
}