1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
7 PYTHON_COMPAT=( python3_{5,6,7} )
8 PYTHON_REQ_USE='ncurses,sqlite,ssl,threads(+)'
10 # This list can be updated with scripts/get_langs.sh from the mozilla overlay
11 # note - could not roll langpacks for: ca fi
12 #MOZ_LANGS=(ca cs de en-GB es-AR es-ES fi fr gl hu it ja lt nb-NO nl pl pt-PT
13 # ru sk sv-SE tr uk zh-CN zh-TW)
14 MOZ_LANGS=(cs de en-GB es-AR es-ES fr hu it ja lt nl pl pt-PT
15 ru sk sv-SE zh-CN zh-TW)
18 MOZ_PV="${MOZ_PV/_alpha/a}"
19 MOZ_PV="${MOZ_PV/_beta/b}"
20 MOZ_PV="${MOZ_PV/_rc/rc}"
21 MOZ_PV="${MOZ_PV/_p[0-9]}"
23 MY_MOZ_P="${PN}-${MOZ_PV}"
25 if [[ ${PV} == *_pre* ]] ; then
26 MOZ_HTTP_URI="https://archive.mozilla.org/pub/${PN}/candidates/${MOZ_PV}-candidates/build${PV##*_pre}"
27 #MOZ_LANGPACK_HTTP_URI="https://archive.mozilla.org/pub/${PN}/releases/2.49.4"
28 #MOZ_LANGPACK_PREFIX="linux-i686/xpi/"
29 SRC_URI+=" ${MOZ_HTTP_URI}/source/${MY_MOZ_P}.source.tar.xz -> ${P}.source.tar.xz
30 ${MOZ_HTTP_URI}/source/${MY_MOZ_P}.source-l10n.tar.xz -> ${P}.source-l10n.tar.xz"
31 S="${WORKDIR}/${MY_MOZ_P}"
33 MOZ_HTTP_URI="https://archive.mozilla.org/pub/${PN}/releases/${MOZ_PV}"
34 #MOZ_LANGPACK_PREFIX="langpack/${MY_MOZ_P}."
35 #MOZ_LANGPACK_SUFFIX=".langpack.xpi"
36 S="${WORKDIR}/${PN}-${MOZ_PV}"
37 SRC_URI+=" ${MOZ_HTTP_URI}/source/${MY_MOZ_P}.source.tar.xz -> ${P}.source.tar.xz
38 ${MOZ_HTTP_URI}/source/${MY_MOZ_P}.source-l10n.tar.xz -> ${P}.source-l10n.tar.xz"
41 #MOZCONFIG_OPTIONAL_GTK2ONLY=1
42 MOZCONFIG_OPTIONAL_WIFI=1
43 MOZ_GENERATE_LANGPACKS=1
44 MOZ_L10N_SOURCEDIR="${S}/${P}-l10n"
45 inherit check-reqs flag-o-matic toolchain-funcs eutils mozconfig-v6.60 pax-utils xdg-utils autotools mozextension nsplugins mozlinguas-v2
47 PATCH="${PN}-2.49.5-patches-01"
49 DESCRIPTION="Seamonkey Web Browser"
50 HOMEPAGE="http://www.seamonkey-project.org"
51 KEYWORDS="~amd64 ~ppc64 ~x86"
54 LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
55 IUSE="+calendar +chatzilla +crypt +gmp-autoupdate +ipc jack minimal pulseaudio +roaming selinux test"
58 https://dev.gentoo.org/~axs/mozilla/patchsets/${PATCH}.tar.xz
59 https://dev.gentoo.org/~polynomial-c/mozilla/patchsets/${PATCH}.tar.xz
62 ASM_DEPEND=">=dev-lang/yasm-1.1"
66 >=dev-libs/nspr-4.13.1
67 jack? ( virtual/jack )
68 crypt? ( <x11-plugins/enigmail-2.1.0 )
73 !elibc_glibc? ( !elibc_uclibc? ( !elibc_musl? ( dev-libs/libexecinfo ) ) )
74 amd64? ( ${ASM_DEPEND}
80 # allow GMP_PLUGIN_LIST to be set in an eclass or
81 # overridden in the enviromnent (advanced hackers only)
82 if [[ -z $GMP_PLUGIN_LIST ]] ; then
83 GMP_PLUGIN_LIST=( gmp-gmpopenh264 gmp-widevinecdm )
86 BUILD_OBJ_DIR="${S}/seamonk"
89 if [[ ${PV} == *_pre* ]] ; then
90 ewarn "You're using an unofficial release of ${PN}. Don't file any bug in"
91 ewarn "Gentoo's Bugtracker against this package in case it breaks for you."
92 ewarn "Those belong to upstream: https://bugzilla.mozilla.org"
99 # Ensure we have enough disk space to compile
100 if use debug || use test ; then
101 CHECKREQS_DISK_BUILD="8G"
103 CHECKREQS_DISK_BUILD="4G"
109 unpack ${A/ ${P}.source-l10n.tar.xz}
111 mkdir "${S}/${P}-l10n" || die
112 cd "${S}/${P}-l10n" || die
113 unpack ${P}.source-l10n.tar.xz
118 eapply "${WORKDIR}"/seamonkey
120 # browser patches go here
121 pushd "${S}"/mozilla &>/dev/null || die
122 rm -f "${WORKDIR}"/firefox/1000_gentoo_install_dir.patch \
123 "${WORKDIR}"/firefox/1001_disable_sdk_install.patch
124 eapply "${WORKDIR}"/firefox
125 popd &>/dev/null || die
128 eapply "${FILESDIR}"/${PN}-gcc9.patch
130 if grep -q '^sdkdir.*$(MOZ_APP_NAME)-devel' mozilla/config/baseconfig.mk ; then
131 sed '/^sdkdir/s@-devel@@' \
132 -i mozilla/config/baseconfig.mk || die
134 einfo "baseconfig.mk hackery no longer needed."
137 # Shell scripts sometimes contain DOS line endings; bug 391889
138 grep -rlZ --include="*.sh" $'\r$' . |
139 while read -r -d $'\0' file ; do
140 einfo edos2unix "${file}"
144 # Allow user to apply any additional patches without modifing ebuild
147 local ms="${S}/mozilla"
149 # Enable gnomebreakpad
151 sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
152 "${ms}"/build/unix/run-mozilla.sh || die "sed failed!"
155 # Ensure that are plugins dir is enabled as default
156 sed -i -e "s:/usr/lib/mozilla/plugins:/usr/lib/nsbrowser/plugins:" \
157 "${ms}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 32bit!"
158 sed -i -e "s:/usr/lib64/mozilla/plugins:/usr/lib64/nsbrowser/plugins:" \
159 "${ms}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 64bit!"
161 # Don't exit with error when some libs are missing which we have in
163 sed '/^MOZ_PKG_FATAL_WARNINGS/s@= 1@= 0@' \
164 -i "${S}"/suite/installer/Makefile.in || die
165 # Don't error out when there's no files to be removed:
166 sed 's@\(xargs rm\)$@\1 -f@' \
167 -i "${ms}"/toolkit/mozapps/installer/packager.mk || die
169 # Don't build libs-% locale files for chatzilla if we are not building chatzilla
170 # (this is hard-coded in the build system at present rather than being based on configuration)
171 if ! use chatzilla ; then
172 sed '/extensions\/irc\/locales libs-/s@^@#@' \
173 -i "${S}"/suite/locales/Makefile.in || die
176 eautoreconf old-configure.in
177 cd "${S}"/mozilla || die
178 eautoconf old-configure.in
179 cd "${S}"/mozilla/js/src || die
180 eautoconf old-configure.in
181 cd "${S}"/mozilla/memory/jemalloc/src || die
182 WANT_AUTOCONF= eautoconf
186 MEXTENSIONS="default"
187 # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
188 # Note: These are for Gentoo Linux use ONLY. For your own distribution, please
189 # get your own set of keys.
190 _google_api_key=AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc
192 ####################################
194 # mozconfig, CFLAGS and CXXFLAGS setup
196 ####################################
201 # enable JACK, bug 600002
202 mozconfig_use_enable jack
204 # It doesn't compile on alpha without this LDFLAGS
205 use alpha && append-ldflags "-Wl,--no-relax"
207 if ! use chatzilla ; then
210 if ! use roaming ; then
211 MEXTENSIONS+=",-sroaming"
214 # Setup api key for location services
215 echo -n "${_google_api_key}" > "${S}"/google-api-key
216 mozconfig_annotate '' --with-google-api-keyfile="${S}/google-api-key"
218 mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
220 # Other sm-specific settings
221 mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
222 mozconfig_annotate '' --enable-safe-browsing
223 mozconfig_use_enable calendar
225 # Use an objdir to keep things organized.
226 echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig
227 echo "mk_add_options XARGS=/usr/bin/xargs" >> "${S}"/.mozconfig
231 # Finalize and report settings
234 # Required until seamonkey-2.53 is available
236 -e '/--enable-application/s@comm/suite@suite@' \
237 -e '/--enable-linker/d' \
240 # Work around breakage in makeopts with --no-print-directory
241 MAKEOPTS="${MAKEOPTS/--no-print-directory/}"
243 if [[ $(gcc-major-version) -lt 4 ]] ; then
244 append-cxxflags -fno-stack-protector
245 elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]] ; then
246 if use amd64 || use x86 ; then
247 append-flags -mno-avx
251 # workaround for funky/broken upstream configure...
252 SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
253 emake V=1 -f client.mk configure
257 MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL}" \
258 emake V=1 -f client.mk
260 mozlinguas_src_compile
264 MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
265 DICTPATH="\"${EPREFIX}/usr/share/myspell\""
268 cd "${BUILD_OBJ_DIR}" || die
270 # Pax mark xpcshell for hardened support, only used for startupcache creation.
271 pax-mark m "${BUILD_OBJ_DIR}/dist/bin/xpcshell"
273 # Copy our preference before omnijar is created.
274 sed "s|SEAMONKEY_PVR|${PVR}|" "${FILESDIR}"/all-gentoo-1.js > \
275 "${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" \
278 # Set default path to search for dictionaries.
279 echo "pref(\"spellchecker.dictionary_path\", ${DICTPATH});" \
280 >> "${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" \
283 echo 'pref("extensions.autoDisableScopes", 3);' >> \
284 "${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" \
288 if ! use gmp-autoupdate ; then
289 for plugin in "${GMP_PLUGIN_LIST[@]}" ; do
290 echo "pref(\"media.${plugin}.autoupdate\", false);" >> \
291 "${S}/${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
296 MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
297 emake DESTDIR="${D}" install
298 MOZ_P="${P/_*}" mozlinguas_src_install
299 cp "${FILESDIR}"/${PN}.desktop "${T}" || die
301 sed 's|^\(MimeType=.*\)$|\1text/x-vcard;text/directory;application/mbox;message/rfc822;x-scheme-handler/mailto;|' \
302 -i "${T}"/${PN}.desktop || die
303 sed 's|^\(Categories=.*\)$|\1Email;|' -i "${T}"/${PN}.desktop \
306 # Add StartupNotify=true bug 290401
307 if use startup-notification ; then
308 echo "StartupNotify=true" >> "${T}"/${PN}.desktop || die
311 # Install icon and .desktop for menu entry
312 newicon "${S}"/suite/branding/nightly/content/icon64.png ${PN}.png
313 domenu "${T}"/${PN}.desktop
315 # Required in order to use plugins and even run seamonkey on hardened.
316 pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{seamonkey,seamonkey-bin,plugin-container}
318 if use minimal ; then
319 rm -rf "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk}
322 if use chatzilla ; then
323 local emid='{59c81df5-4b7a-477b-912d-4e0fdf64e5f2}'
325 # remove the en_US-only xpi file so a version with all requested locales can be installed
326 if [[ -e "${ED}"${MOZILLA_FIVE_HOME}/distribution/extensions/${emid}.xpi ]]; then
327 rm -f "${ED}"${MOZILLA_FIVE_HOME}/distribution/extensions/${emid}.xpi || die
330 # merge the extra locales into the main extension
331 mozlinguas_xpistage_langpacks "${BUILD_OBJ_DIR}"/dist/xpi-stage/chatzilla
333 # install the merged extension
334 mkdir -p "${T}/${emid}" || die
335 cp -RLp -t "${T}/${emid}" "${BUILD_OBJ_DIR}"/dist/xpi-stage/chatzilla/* || die
336 insinto ${MOZILLA_FIVE_HOME}/distribution/extensions
337 doins -r "${T}/${emid}"
340 # Handle plugins dir through nsplugins.eclass
343 # revdep-rebuild entry
344 insinto /etc/revdep-rebuild
345 echo "SEARCH_DIRS_MASK=${MOZILLA_FIVE_HOME}*" >> ${T}/11${PN}
350 MOZILLA_FIVE_HOME="${ROOT}/usr/$(get_libdir)/${PN}"
352 if [ -d ${MOZILLA_FIVE_HOME}/plugins ] ; then
353 rm ${MOZILLA_FIVE_HOME}/plugins -rf
358 MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
360 # Update mimedb for the new .desktop file
361 xdg_desktop_database_update
363 if ! use gmp-autoupdate ; then
364 elog "USE='-gmp-autoupdate' has disabled the following plugins from updating or"
365 elog "installing into new profiles:"
367 for plugin in "${GMP_PLUGIN_LIST[@]}"; do elog "\t ${plugin}" ; done
370 if use chatzilla ; then
371 elog "chatzilla is now an extension which can be en-/disabled and configured via"
372 elog "the Add-on manager."