www-servers/apache: Added libressl patch
[gentoo.git] / www-client / seamonkey / seamonkey-2.49.5_pre3.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 WANT_AUTOCONF="2.1"
6
7 PYTHON_COMPAT=( python3_{5,6,7} )
8 PYTHON_REQ_USE='ncurses,sqlite,ssl,threads(+)'
9
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)
16
17 MOZ_PV="${PV/_pre*}"
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]}"
22 MOZ_P="${P}"
23 MY_MOZ_P="${PN}-${MOZ_PV}"
24
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}"
32 else
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"
39 fi
40
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
46
47 PATCH="${PN}-2.49.5-patches-01"
48
49 DESCRIPTION="Seamonkey Web Browser"
50 HOMEPAGE="http://www.seamonkey-project.org"
51 KEYWORDS="~amd64 ~ppc64 ~x86"
52
53 SLOT="0"
54 LICENSE="MPL-2.0 GPL-2 LGPL-2.1"
55 IUSE="+calendar +chatzilla +crypt +gmp-autoupdate +ipc jack minimal pulseaudio +roaming selinux test"
56
57 SRC_URI+="
58         https://dev.gentoo.org/~axs/mozilla/patchsets/${PATCH}.tar.xz
59         https://dev.gentoo.org/~polynomial-c/mozilla/patchsets/${PATCH}.tar.xz
60 "
61
62 ASM_DEPEND=">=dev-lang/yasm-1.1"
63
64 RDEPEND="
65         >=dev-libs/nss-3.28.3
66         >=dev-libs/nspr-4.13.1
67         jack? ( virtual/jack )
68         crypt? ( <x11-plugins/enigmail-2.1.0 )
69 "
70
71 DEPEND="
72         ${RDEPEND}
73         !elibc_glibc? ( !elibc_uclibc? ( !elibc_musl? ( dev-libs/libexecinfo ) ) )
74         amd64? ( ${ASM_DEPEND}
75                 virtual/opengl )
76         x86? ( ${ASM_DEPEND}
77                 virtual/opengl )
78 "
79
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 )
84 fi
85
86 BUILD_OBJ_DIR="${S}/seamonk"
87
88 pkg_setup() {
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"
93         fi
94
95         moz_pkgsetup
96 }
97
98 pkg_pretend() {
99         # Ensure we have enough disk space to compile
100         if use debug || use test ; then
101                 CHECKREQS_DISK_BUILD="8G"
102         else
103                 CHECKREQS_DISK_BUILD="4G"
104         fi
105         check-reqs_pkg_setup
106 }
107
108 src_unpack() {
109         unpack ${A/ ${P}.source-l10n.tar.xz}
110
111         mkdir "${S}/${P}-l10n" || die
112         cd "${S}/${P}-l10n" || die
113         unpack ${P}.source-l10n.tar.xz
114 }
115
116 src_prepare() {
117         # Apply our patches
118         eapply "${WORKDIR}"/seamonkey
119
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
126
127         # gcc9 patch #685092
128         eapply "${FILESDIR}"/${PN}-gcc9.patch
129
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
133         else
134                 einfo "baseconfig.mk hackery no longer needed."
135         fi
136
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}"
141                 edos2unix "${file}"
142         done
143
144         # Allow user to apply any additional patches without modifing ebuild
145         eapply_user
146
147         local ms="${S}/mozilla"
148
149         # Enable gnomebreakpad
150         if use debug ; then
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!"
153         fi
154
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!"
160
161         # Don't exit with error when some libs are missing which we have in
162         # system.
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
168
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
174         fi
175
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
183 }
184
185 src_configure() {
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
191
192         ####################################
193         #
194         # mozconfig, CFLAGS and CXXFLAGS setup
195         #
196         ####################################
197
198         mozconfig_init
199         mozconfig_config
200
201         # enable JACK, bug 600002
202         mozconfig_use_enable jack
203
204         # It doesn't compile on alpha without this LDFLAGS
205         use alpha && append-ldflags "-Wl,--no-relax"
206
207         if ! use chatzilla ; then
208                 MEXTENSIONS+=",-irc"
209         fi
210         if ! use roaming ; then
211                 MEXTENSIONS+=",-sroaming"
212         fi
213
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"
217
218         mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
219
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
224
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
228
229         mozlinguas_mozconfig
230
231         # Finalize and report settings
232         mozconfig_final
233
234         # Required until seamonkey-2.53 is available
235         sed \
236                 -e '/--enable-application/s@comm/suite@suite@' \
237                 -e '/--enable-linker/d' \
238                 -i .mozconfig || die
239
240         # Work around breakage in makeopts with --no-print-directory
241         MAKEOPTS="${MAKEOPTS/--no-print-directory/}"
242
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
248                 fi
249         fi
250
251         # workaround for funky/broken upstream configure...
252         SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
253         emake V=1 -f client.mk configure
254 }
255
256 src_compile() {
257         MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL}" \
258         emake V=1 -f client.mk
259
260         mozlinguas_src_compile
261 }
262
263 src_install() {
264         MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
265         DICTPATH="\"${EPREFIX}/usr/share/myspell\""
266
267         local emid
268         cd "${BUILD_OBJ_DIR}" || die
269
270         # Pax mark xpcshell for hardened support, only used for startupcache creation.
271         pax-mark m "${BUILD_OBJ_DIR}/dist/bin/xpcshell"
272
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" \
276                 || die
277
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" \
281                 || die
282
283         echo 'pref("extensions.autoDisableScopes", 3);' >> \
284                 "${BUILD_OBJ_DIR}/dist/bin/defaults/pref/all-gentoo.js" \
285                 || die
286
287         local plugin
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" \
292                                 || dir
293                 done
294         fi
295
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
300
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 \
304                 || die
305
306         # Add StartupNotify=true bug 290401
307         if use startup-notification ; then
308                 echo "StartupNotify=true" >> "${T}"/${PN}.desktop || die
309         fi
310
311         # Install icon and .desktop for menu entry
312         newicon "${S}"/suite/branding/nightly/content/icon64.png ${PN}.png
313         domenu "${T}"/${PN}.desktop
314
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}
317
318         if use minimal ; then
319                 rm -rf "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk}
320         fi
321
322         if use chatzilla ; then
323                 local emid='{59c81df5-4b7a-477b-912d-4e0fdf64e5f2}'
324
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
328                 fi
329
330                 # merge the extra locales into the main extension
331                 mozlinguas_xpistage_langpacks "${BUILD_OBJ_DIR}"/dist/xpi-stage/chatzilla
332
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}"
338         fi
339
340         # Handle plugins dir through nsplugins.eclass
341         share_plugins_dir
342
343         # revdep-rebuild entry
344         insinto /etc/revdep-rebuild
345         echo "SEARCH_DIRS_MASK=${MOZILLA_FIVE_HOME}*" >> ${T}/11${PN}
346         doins "${T}"/11${PN}
347 }
348
349 pkg_preinst() {
350         MOZILLA_FIVE_HOME="${ROOT}/usr/$(get_libdir)/${PN}"
351
352         if [ -d ${MOZILLA_FIVE_HOME}/plugins ] ; then
353                 rm ${MOZILLA_FIVE_HOME}/plugins -rf
354         fi
355 }
356
357 pkg_postinst() {
358         MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}"
359
360         # Update mimedb for the new .desktop file
361         xdg_desktop_database_update
362
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:"
366                 local plugin
367                 for plugin in "${GMP_PLUGIN_LIST[@]}"; do elog "\t ${plugin}" ; done
368         fi
369
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."
373         fi
374 }