1 |
commit: f49167d933ef33c4f02f0aa335bb91f251ba1e7f |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Mar 29 23:19:57 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 30 11:45:10 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f49167d9 |
7 |
|
8 |
www-client/firefox-bin: use wrapper |
9 |
|
10 |
This change will replace /usr/bin/firefox-bin symlink with a |
11 |
wrapper script: |
12 |
|
13 |
- Using a wrapper will allow us to set additional variables |
14 |
more easily. |
15 |
|
16 |
- The wrapper will address an issue that prevented external applications |
17 |
from opening links when a Firefox instance was already running. |
18 |
|
19 |
- In general, the wrapper will allow user to execute 'firefox-bin' from |
20 |
wherever and whenever they like without getting an error that an |
21 |
instance is already running. |
22 |
|
23 |
In addition, Wayland support was exposed via USE flag. |
24 |
|
25 |
Package-Manager: Portage-2.3.96, Repoman-2.3.22 |
26 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
27 |
|
28 |
.../firefox-bin/files/firefox-bin-wayland.sh | 7 ++ |
29 |
www-client/firefox-bin/files/firefox-bin-x11.sh | 7 ++ |
30 |
www-client/firefox-bin/files/firefox-bin.sh | 100 +++++++++++++++ |
31 |
.../firefox-bin/firefox-bin-68.6.0-r1.ebuild | 136 +++++++++++++-------- |
32 |
www-client/firefox-bin/firefox-bin-74.0-r1.ebuild | 136 +++++++++++++-------- |
33 |
5 files changed, 290 insertions(+), 96 deletions(-) |
34 |
|
35 |
diff --git a/www-client/firefox-bin/files/firefox-bin-wayland.sh b/www-client/firefox-bin/files/firefox-bin-wayland.sh |
36 |
new file mode 100644 |
37 |
index 00000000000..6107d507385 |
38 |
--- /dev/null |
39 |
+++ b/www-client/firefox-bin/files/firefox-bin-wayland.sh |
40 |
@@ -0,0 +1,7 @@ |
41 |
+#!/bin/sh |
42 |
+ |
43 |
+# |
44 |
+# Run Mozilla Firefox (bin) on Wayland |
45 |
+# |
46 |
+export MOZ_ENABLE_WAYLAND=1 |
47 |
+exec @PREFIX@/bin/firefox-bin "$@" |
48 |
|
49 |
diff --git a/www-client/firefox-bin/files/firefox-bin-x11.sh b/www-client/firefox-bin/files/firefox-bin-x11.sh |
50 |
new file mode 100644 |
51 |
index 00000000000..915ac2cac19 |
52 |
--- /dev/null |
53 |
+++ b/www-client/firefox-bin/files/firefox-bin-x11.sh |
54 |
@@ -0,0 +1,7 @@ |
55 |
+#!/bin/sh |
56 |
+ |
57 |
+# |
58 |
+# Run Mozilla Firefox (bin) on X11 |
59 |
+# |
60 |
+export MOZ_DISABLE_WAYLAND=1 |
61 |
+exec @PREFIX@/bin/firefox-bin "$@" |
62 |
|
63 |
diff --git a/www-client/firefox-bin/files/firefox-bin.sh b/www-client/firefox-bin/files/firefox-bin.sh |
64 |
new file mode 100644 |
65 |
index 00000000000..5bf52692b3d |
66 |
--- /dev/null |
67 |
+++ b/www-client/firefox-bin/files/firefox-bin.sh |
68 |
@@ -0,0 +1,100 @@ |
69 |
+#!/bin/bash |
70 |
+ |
71 |
+## |
72 |
+## Usage: |
73 |
+## |
74 |
+## $ firefox-bin |
75 |
+## |
76 |
+## This script is meant to run Mozilla Firefox in Gentoo. |
77 |
+ |
78 |
+cmdname=$(basename "$0") |
79 |
+ |
80 |
+## |
81 |
+## Variables |
82 |
+## |
83 |
+MOZ_ARCH=$(uname -m) |
84 |
+case ${MOZ_ARCH} in |
85 |
+ x86_64|s390x|sparc64) |
86 |
+ MOZ_LIB_DIR="@PREFIX@/lib64" |
87 |
+ SECONDARY_LIB_DIR="@PREFIX@/lib" |
88 |
+ ;; |
89 |
+ *) |
90 |
+ MOZ_LIB_DIR="@PREFIX@/lib" |
91 |
+ SECONDARY_LIB_DIR="@PREFIX@/lib64" |
92 |
+ ;; |
93 |
+esac |
94 |
+ |
95 |
+MOZ_FIREFOX_FILE="firefox-bin" |
96 |
+MOZILLA_FIVE_HOME="@MOZ_FIVE_HOME@" |
97 |
+MOZ_EXTENSIONS_PROFILE_DIR="${HOME}/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" |
98 |
+MOZ_PROGRAM="${MOZILLA_FIVE_HOME}/${MOZ_FIREFOX_FILE}" |
99 |
+APULSELIB_DIR="@APULSELIB_DIR@" |
100 |
+DESKTOP_FILE="firefox-bin" |
101 |
+ |
102 |
+## |
103 |
+## Enable Wayland backend? |
104 |
+## |
105 |
+if @DEFAULT_WAYLAND@ && [[ -z ${MOZ_DISABLE_WAYLAND} ]]; then |
106 |
+ if [[ -n "$WAYLAND_DISPLAY" ]]; then |
107 |
+ DESKTOP_FILE="firefox-bin-wayland" |
108 |
+ export MOZ_ENABLE_WAYLAND=1 |
109 |
+ fi |
110 |
+elif [[ -n ${MOZ_DISABLE_WAYLAND} ]]; then |
111 |
+ DESKTOP_FILE="firefox-bin-x11" |
112 |
+fi |
113 |
+ |
114 |
+## |
115 |
+## Use D-Bus remote exclusively when there's Wayland display. |
116 |
+## |
117 |
+if [[ -n "${WAYLAND_DISPLAY}" ]]; then |
118 |
+ export MOZ_DBUS_REMOTE=1 |
119 |
+fi |
120 |
+ |
121 |
+## |
122 |
+## Make sure that we set the plugin path |
123 |
+## |
124 |
+MOZ_PLUGIN_DIR="plugins" |
125 |
+ |
126 |
+if [[ -n "${MOZ_PLUGIN_PATH}" ]]; then |
127 |
+ MOZ_PLUGIN_PATH=${MOZ_PLUGIN_PATH}:${MOZ_LIB_DIR}/mozilla/${MOZ_PLUGIN_DIR} |
128 |
+else |
129 |
+ MOZ_PLUGIN_PATH=${MOZ_LIB_DIR}/mozilla/${MOZ_PLUGIN_DIR} |
130 |
+fi |
131 |
+ |
132 |
+if [[ -d "${SECONDARY_LIB_DIR}/mozilla/${MOZ_PLUGIN_DIR}" ]]; then |
133 |
+ MOZ_PLUGIN_PATH=${MOZ_PLUGIN_PATH}:${SECONDARY_LIB_DIR}/mozilla/${MOZ_PLUGIN_DIR} |
134 |
+fi |
135 |
+ |
136 |
+export MOZ_PLUGIN_PATH |
137 |
+ |
138 |
+## |
139 |
+## Set MOZ_APP_LAUNCHER for gnome-session |
140 |
+## |
141 |
+export MOZ_APP_LAUNCHER="@PREFIX@/bin/${cmdname}" |
142 |
+ |
143 |
+## |
144 |
+## Disable the GNOME crash dialog, Moz has it's own |
145 |
+## |
146 |
+if [[ "$XDG_CURRENT_DESKTOP" == "GNOME" ]]; then |
147 |
+ GNOME_DISABLE_CRASH_DIALOG=1 |
148 |
+ export GNOME_DISABLE_CRASH_DIALOG |
149 |
+fi |
150 |
+ |
151 |
+# Don't throw "old profile" dialog box. |
152 |
+export MOZ_ALLOW_DOWNGRADE=1 |
153 |
+ |
154 |
+## |
155 |
+## Set special variables for -bin |
156 |
+export LD_LIBRARY_PATH="${APULSELIB_DIR:${APULSELIB_DIR}:}${MOZILLA_FIVE_HOME}" |
157 |
+export GTK_PATH="${MOZ_LIB_DIR}/gtk-3.0" |
158 |
+ |
159 |
+## |
160 |
+## Route to the correct .desktop file to get proper |
161 |
+## names and contect menus |
162 |
+## |
163 |
+if [[ $@ != *"--name "* ]]; then |
164 |
+ set -- "--name ${DESKTOP_FILE}" "$@" |
165 |
+fi |
166 |
+ |
167 |
+# Run the browser |
168 |
+exec ${MOZ_PROGRAM} $@ |
169 |
|
170 |
diff --git a/www-client/firefox-bin/firefox-bin-68.6.0-r1.ebuild b/www-client/firefox-bin/firefox-bin-68.6.0-r1.ebuild |
171 |
index 340bb361295..eb30ac30836 100644 |
172 |
--- a/www-client/firefox-bin/firefox-bin-68.6.0-r1.ebuild |
173 |
+++ b/www-client/firefox-bin/firefox-bin-68.6.0-r1.ebuild |
174 |
@@ -35,7 +35,7 @@ RESTRICT="strip mirror" |
175 |
KEYWORDS="-* amd64 x86" |
176 |
SLOT="0" |
177 |
LICENSE="MPL-2.0 GPL-2 LGPL-2.1" |
178 |
-IUSE="+alsa +ffmpeg +pulseaudio selinux startup-notification" |
179 |
+IUSE="+alsa +ffmpeg +pulseaudio selinux startup-notification wayland" |
180 |
|
181 |
DEPEND="app-arch/unzip |
182 |
alsa? ( |
183 |
@@ -96,22 +96,47 @@ src_unpack() { |
184 |
} |
185 |
|
186 |
src_install() { |
187 |
- declare MOZILLA_FIVE_HOME=/opt/${MOZ_PN} |
188 |
+ local MOZILLA_FIVE_HOME=/opt/${MOZ_PN} |
189 |
+ |
190 |
+ # Install firefox in /opt |
191 |
+ dodir ${MOZILLA_FIVE_HOME%/*} |
192 |
+ mv "${S}" "${ED%/}"${MOZILLA_FIVE_HOME} || die |
193 |
+ cd "${WORKDIR}" || die |
194 |
+ |
195 |
+ # Install language packs |
196 |
+ MOZEXTENSION_TARGET="distribution/extensions" \ |
197 |
+ MOZ_INSTALL_L10N_XPIFILE="1" \ |
198 |
+ mozlinguas_src_install |
199 |
+ |
200 |
+ # Disable built-in auto-update because we update firefox-bin through package manager |
201 |
+ insinto ${MOZILLA_FIVE_HOME}/distribution/ |
202 |
+ newins "${FILESDIR}"/disable-auto-update.policy.json policies.json |
203 |
+ |
204 |
+ # Fix prefs that make no sense for a system-wide install |
205 |
+ insinto ${MOZILLA_FIVE_HOME}/defaults/pref/ |
206 |
+ doins "${FILESDIR}"/local-settings.js |
207 |
+ insinto ${MOZILLA_FIVE_HOME} |
208 |
+ newins "${FILESDIR}"/all-gentoo-3.js all-gentoo.js |
209 |
|
210 |
local size sizes icon_path icon name |
211 |
sizes="16 32 48 128" |
212 |
- icon_path="${S}/browser/chrome/icons/default" |
213 |
+ icon_path="${MOZILLA_FIVE_HOME}/browser/chrome/icons/default" |
214 |
icon="${PN}" |
215 |
- name="Mozilla Firefox" |
216 |
+ name="Mozilla Firefox (bin)" |
217 |
+ |
218 |
+ local apulselib= |
219 |
+ if use alsa && ! use pulseaudio; then |
220 |
+ apulselib="${EPREFIX%/}/usr/$(get_libdir)/apulse" |
221 |
+ patchelf --set-rpath "${apulselib}" "${ED%/}"${MOZILLA_FIVE_HOME}/libxul.so || die |
222 |
+ fi |
223 |
|
224 |
# Install icons and .desktop for menu entry |
225 |
- for size in ${sizes}; do |
226 |
+ for size in ${sizes} ; do |
227 |
insinto "/usr/share/icons/hicolor/${size}x${size}/apps" |
228 |
newins "${icon_path}/default${size}.png" "${icon}.png" |
229 |
done |
230 |
# Install a 48x48 icon into /usr/share/pixmaps for legacy DEs |
231 |
- newicon "${S}"/browser/chrome/icons/default/default48.png ${PN}.png |
232 |
- newmenu "${FILESDIR}/${PN}-r1.desktop" "${PN}.desktop" |
233 |
+ newicon ${MOZILLA_FIVE_HOME}/browser/chrome/icons/default/default48.png ${PN}.png |
234 |
|
235 |
# Add StartupNotify=true bug 237317 |
236 |
local startup_notify="false" |
237 |
@@ -119,48 +144,63 @@ src_install() { |
238 |
startup_notify="true" |
239 |
fi |
240 |
|
241 |
- sed -i \ |
242 |
- -e "s:@NAME@:${name} (bin):" \ |
243 |
- -e "s:@EXEC@:firefox-bin:" \ |
244 |
- -e "s:@ICON@:${icon}:" \ |
245 |
- -e "s:@STARTUP_NOTIFY@:${startup_notify}:" \ |
246 |
- "${ED%/}/usr/share/applications/${PN}.desktop" || die |
247 |
- |
248 |
- # Install firefox in /opt |
249 |
- dodir ${MOZILLA_FIVE_HOME%/*} |
250 |
- mv "${S}" "${ED}"${MOZILLA_FIVE_HOME} || die |
251 |
- |
252 |
- # Disable built-in auto-update because we update firefox-bin through package manager |
253 |
- insinto ${MOZILLA_FIVE_HOME}/distribution/ |
254 |
- newins "${FILESDIR}"/disable-auto-update.policy.json policies.json |
255 |
- |
256 |
- # Fix prefs that make no sense for a system-wide install |
257 |
- insinto ${MOZILLA_FIVE_HOME}/defaults/pref/ |
258 |
- doins "${FILESDIR}"/local-settings.js |
259 |
- insinto ${MOZILLA_FIVE_HOME} |
260 |
- newins "${FILESDIR}"/all-gentoo-2.js all-gentoo.js |
261 |
- |
262 |
- # Install language packs |
263 |
- MOZEXTENSION_TARGET="distribution/extensions" \ |
264 |
- MOZ_INSTALL_L10N_XPIFILE="1" \ |
265 |
- mozlinguas_src_install |
266 |
- |
267 |
- if use alsa && ! use pulseaudio; then |
268 |
- local apulselib="/usr/$(get_libdir)/apulse" |
269 |
- patchelf --set-rpath "${apulselib}" "${ED}"${MOZILLA_FIVE_HOME}/libxul.so || die |
270 |
+ local display_protocols="auto X11" use_wayland="false" |
271 |
+ if use wayland ; then |
272 |
+ display_protocols+=" Wayland" |
273 |
+ use_wayland="true" |
274 |
fi |
275 |
|
276 |
- # Create /usr/bin/firefox-bin |
277 |
- dodir /usr/bin/ |
278 |
- local apulselib=$(usex pulseaudio "/usr/$(get_libdir)/apulse:" "") |
279 |
- cat <<-EOF >"${ED}"usr/bin/${PN} |
280 |
- #!/bin/sh |
281 |
- unset LD_PRELOAD |
282 |
- LD_LIBRARY_PATH="${apulselib}/opt/firefox/" \\ |
283 |
- GTK_PATH=/usr/$(get_libdir)/gtk-3.0/ \\ |
284 |
- exec /opt/${MOZ_PN}/${MOZ_PN} "\$@" |
285 |
- EOF |
286 |
- fperms 0755 /usr/bin/${PN} |
287 |
+ local app_name desktop_filename display_protocol exec_command |
288 |
+ for display_protocol in ${display_protocols} ; do |
289 |
+ app_name="${name} on ${display_protocol}" |
290 |
+ desktop_filename="${PN}-${display_protocol,,}.desktop" |
291 |
+ |
292 |
+ case ${display_protocol} in |
293 |
+ Wayland) |
294 |
+ exec_command="${PN}-wayland --name ${PN}-wayland" |
295 |
+ newbin "${FILESDIR}"/firefox-bin-wayland.sh ${PN}-wayland |
296 |
+ ;; |
297 |
+ X11) |
298 |
+ exec_command="${PN}-x11 --name ${PN}-x11" |
299 |
+ if use wayland ; then |
300 |
+ # Only needed when there's actually a choice |
301 |
+ newbin "${FILESDIR}"/firefox-bin-x11.sh ${PN}-x11 |
302 |
+ fi |
303 |
+ ;; |
304 |
+ *) |
305 |
+ app_name="${name}" |
306 |
+ desktop_filename="${PN}.desktop" |
307 |
+ exec_command='firefox-bin' |
308 |
+ ;; |
309 |
+ esac |
310 |
+ |
311 |
+ newmenu "${FILESDIR}/${PN}-r1.desktop" "${desktop_filename}" |
312 |
+ sed -i \ |
313 |
+ -e "s:@NAME@:${app_name}:" \ |
314 |
+ -e "s:@EXEC@:${exec_command}:" \ |
315 |
+ -e "s:@ICON@:${icon}:" \ |
316 |
+ -e "s:@STARTUP_NOTIFY@:${startup_notify}:" \ |
317 |
+ "${ED%/}/usr/share/applications/${desktop_filename}" || die |
318 |
+ done |
319 |
+ |
320 |
+ rm -f "${ED%/}"/usr/bin/firefox-bin || die |
321 |
+ newbin "${FILESDIR}"/firefox-bin.sh firefox-bin |
322 |
+ |
323 |
+ local wrapper |
324 |
+ for wrapper in \ |
325 |
+ "${ED%/}"/usr/bin/firefox-bin \ |
326 |
+ "${ED%/}"/usr/bin/firefox-bin-x11 \ |
327 |
+ "${ED%/}"/usr/bin/firefox-bin-wayland \ |
328 |
+ ; do |
329 |
+ [[ ! -f "${wrapper}" ]] && continue |
330 |
+ |
331 |
+ sed -i \ |
332 |
+ -e "s:@PREFIX@:${EPREFIX%/}/usr:" \ |
333 |
+ -e "s:@MOZ_FIVE_HOME@:${MOZILLA_FIVE_HOME}:" \ |
334 |
+ -e "s:@APULSELIB_DIR@:${apulselib}:" \ |
335 |
+ -e "s:@DEFAULT_WAYLAND@:${use_wayland}:" \ |
336 |
+ "${wrapper}" || die |
337 |
+ done |
338 |
|
339 |
# revdep-rebuild entry |
340 |
insinto /etc/revdep-rebuild |
341 |
@@ -171,7 +211,7 @@ src_install() { |
342 |
share_plugins_dir |
343 |
|
344 |
# Required in order to use plugins and even run firefox on hardened. |
345 |
- pax-mark mr "${ED}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container} |
346 |
+ pax-mark mr "${ED%/}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container} |
347 |
} |
348 |
|
349 |
pkg_postinst() { |
350 |
|
351 |
diff --git a/www-client/firefox-bin/firefox-bin-74.0-r1.ebuild b/www-client/firefox-bin/firefox-bin-74.0-r1.ebuild |
352 |
index 6182293952b..f8f296dafd1 100644 |
353 |
--- a/www-client/firefox-bin/firefox-bin-74.0-r1.ebuild |
354 |
+++ b/www-client/firefox-bin/firefox-bin-74.0-r1.ebuild |
355 |
@@ -35,7 +35,7 @@ RESTRICT="strip mirror" |
356 |
KEYWORDS="-* amd64 x86" |
357 |
SLOT="0" |
358 |
LICENSE="MPL-2.0 GPL-2 LGPL-2.1" |
359 |
-IUSE="+alsa +ffmpeg +pulseaudio selinux startup-notification" |
360 |
+IUSE="+alsa +ffmpeg +pulseaudio selinux startup-notification wayland" |
361 |
|
362 |
DEPEND="app-arch/unzip |
363 |
alsa? ( |
364 |
@@ -96,22 +96,47 @@ src_unpack() { |
365 |
} |
366 |
|
367 |
src_install() { |
368 |
- declare MOZILLA_FIVE_HOME=/opt/${MOZ_PN} |
369 |
+ local MOZILLA_FIVE_HOME=/opt/${MOZ_PN} |
370 |
+ |
371 |
+ # Install firefox in /opt |
372 |
+ dodir ${MOZILLA_FIVE_HOME%/*} |
373 |
+ mv "${S}" "${ED%/}"${MOZILLA_FIVE_HOME} || die |
374 |
+ cd "${WORKDIR}" || die |
375 |
+ |
376 |
+ # Install language packs |
377 |
+ MOZEXTENSION_TARGET="distribution/extensions" \ |
378 |
+ MOZ_INSTALL_L10N_XPIFILE="1" \ |
379 |
+ mozlinguas_src_install |
380 |
+ |
381 |
+ # Disable built-in auto-update because we update firefox-bin through package manager |
382 |
+ insinto ${MOZILLA_FIVE_HOME}/distribution/ |
383 |
+ newins "${FILESDIR}"/disable-auto-update.policy.json policies.json |
384 |
+ |
385 |
+ # Fix prefs that make no sense for a system-wide install |
386 |
+ insinto ${MOZILLA_FIVE_HOME}/defaults/pref/ |
387 |
+ doins "${FILESDIR}"/local-settings.js |
388 |
+ insinto ${MOZILLA_FIVE_HOME} |
389 |
+ newins "${FILESDIR}"/all-gentoo-3.js all-gentoo.js |
390 |
|
391 |
local size sizes icon_path icon name |
392 |
sizes="16 32 48 128" |
393 |
- icon_path="${S}/browser/chrome/icons/default" |
394 |
+ icon_path="${MOZILLA_FIVE_HOME}/browser/chrome/icons/default" |
395 |
icon="${PN}" |
396 |
- name="Mozilla Firefox" |
397 |
+ name="Mozilla Firefox (bin)" |
398 |
+ |
399 |
+ local apulselib= |
400 |
+ if use alsa && ! use pulseaudio; then |
401 |
+ apulselib="${EPREFIX%/}/usr/$(get_libdir)/apulse" |
402 |
+ patchelf --set-rpath "${apulselib}" "${ED%/}"${MOZILLA_FIVE_HOME}/libxul.so || die |
403 |
+ fi |
404 |
|
405 |
# Install icons and .desktop for menu entry |
406 |
- for size in ${sizes}; do |
407 |
+ for size in ${sizes} ; do |
408 |
insinto "/usr/share/icons/hicolor/${size}x${size}/apps" |
409 |
newins "${icon_path}/default${size}.png" "${icon}.png" |
410 |
done |
411 |
# Install a 48x48 icon into /usr/share/pixmaps for legacy DEs |
412 |
- newicon "${S}"/browser/chrome/icons/default/default48.png ${PN}.png |
413 |
- newmenu "${FILESDIR}/${PN}-r1.desktop" "${PN}.desktop" |
414 |
+ newicon ${MOZILLA_FIVE_HOME}/browser/chrome/icons/default/default48.png ${PN}.png |
415 |
|
416 |
# Add StartupNotify=true bug 237317 |
417 |
local startup_notify="false" |
418 |
@@ -119,48 +144,63 @@ src_install() { |
419 |
startup_notify="true" |
420 |
fi |
421 |
|
422 |
- sed -i \ |
423 |
- -e "s:@NAME@:${name} (bin):" \ |
424 |
- -e "s:@EXEC@:firefox-bin:" \ |
425 |
- -e "s:@ICON@:${icon}:" \ |
426 |
- -e "s:@STARTUP_NOTIFY@:${startup_notify}:" \ |
427 |
- "${ED%/}/usr/share/applications/${PN}.desktop" || die |
428 |
- |
429 |
- # Install firefox in /opt |
430 |
- dodir ${MOZILLA_FIVE_HOME%/*} |
431 |
- mv "${S}" "${ED}"${MOZILLA_FIVE_HOME} || die |
432 |
- |
433 |
- # Disable built-in auto-update because we update firefox-bin through package manager |
434 |
- insinto ${MOZILLA_FIVE_HOME}/distribution/ |
435 |
- newins "${FILESDIR}"/disable-auto-update.policy.json policies.json |
436 |
- |
437 |
- # Fix prefs that make no sense for a system-wide install |
438 |
- insinto ${MOZILLA_FIVE_HOME}/defaults/pref/ |
439 |
- doins "${FILESDIR}"/local-settings.js |
440 |
- insinto ${MOZILLA_FIVE_HOME} |
441 |
- newins "${FILESDIR}"/all-gentoo-3.js all-gentoo.js |
442 |
- |
443 |
- # Install language packs |
444 |
- MOZEXTENSION_TARGET="distribution/extensions" \ |
445 |
- MOZ_INSTALL_L10N_XPIFILE="1" \ |
446 |
- mozlinguas_src_install |
447 |
- |
448 |
- if use alsa && ! use pulseaudio; then |
449 |
- local apulselib="/usr/$(get_libdir)/apulse" |
450 |
- patchelf --set-rpath "${apulselib}" "${ED}"${MOZILLA_FIVE_HOME}/libxul.so || die |
451 |
+ local display_protocols="auto X11" use_wayland="false" |
452 |
+ if use wayland ; then |
453 |
+ display_protocols+=" Wayland" |
454 |
+ use_wayland="true" |
455 |
fi |
456 |
|
457 |
- # Create /usr/bin/firefox-bin |
458 |
- dodir /usr/bin/ |
459 |
- local apulselib=$(usex pulseaudio "" $(usex alsa "/usr/$(get_libdir)/apulse:" "")) |
460 |
- cat <<-EOF >"${ED}"usr/bin/${PN} |
461 |
- #!/bin/sh |
462 |
- unset LD_PRELOAD |
463 |
- LD_LIBRARY_PATH="${apulselib}/opt/firefox/" \\ |
464 |
- GTK_PATH=/usr/$(get_libdir)/gtk-3.0/ \\ |
465 |
- exec /opt/${MOZ_PN}/${MOZ_PN} "\$@" |
466 |
- EOF |
467 |
- fperms 0755 /usr/bin/${PN} |
468 |
+ local app_name desktop_filename display_protocol exec_command |
469 |
+ for display_protocol in ${display_protocols} ; do |
470 |
+ app_name="${name} on ${display_protocol}" |
471 |
+ desktop_filename="${PN}-${display_protocol,,}.desktop" |
472 |
+ |
473 |
+ case ${display_protocol} in |
474 |
+ Wayland) |
475 |
+ exec_command="${PN}-wayland --name ${PN}-wayland" |
476 |
+ newbin "${FILESDIR}"/firefox-bin-wayland.sh ${PN}-wayland |
477 |
+ ;; |
478 |
+ X11) |
479 |
+ exec_command="${PN}-x11 --name ${PN}-x11" |
480 |
+ if use wayland ; then |
481 |
+ # Only needed when there's actually a choice |
482 |
+ newbin "${FILESDIR}"/firefox-bin-x11.sh ${PN}-x11 |
483 |
+ fi |
484 |
+ ;; |
485 |
+ *) |
486 |
+ app_name="${name}" |
487 |
+ desktop_filename="${PN}.desktop" |
488 |
+ exec_command='firefox-bin' |
489 |
+ ;; |
490 |
+ esac |
491 |
+ |
492 |
+ newmenu "${FILESDIR}/${PN}-r1.desktop" "${desktop_filename}" |
493 |
+ sed -i \ |
494 |
+ -e "s:@NAME@:${app_name}:" \ |
495 |
+ -e "s:@EXEC@:${exec_command}:" \ |
496 |
+ -e "s:@ICON@:${icon}:" \ |
497 |
+ -e "s:@STARTUP_NOTIFY@:${startup_notify}:" \ |
498 |
+ "${ED%/}/usr/share/applications/${desktop_filename}" || die |
499 |
+ done |
500 |
+ |
501 |
+ rm -f "${ED%/}"/usr/bin/firefox-bin || die |
502 |
+ newbin "${FILESDIR}"/firefox-bin.sh firefox-bin |
503 |
+ |
504 |
+ local wrapper |
505 |
+ for wrapper in \ |
506 |
+ "${ED%/}"/usr/bin/firefox-bin \ |
507 |
+ "${ED%/}"/usr/bin/firefox-bin-x11 \ |
508 |
+ "${ED%/}"/usr/bin/firefox-bin-wayland \ |
509 |
+ ; do |
510 |
+ [[ ! -f "${wrapper}" ]] && continue |
511 |
+ |
512 |
+ sed -i \ |
513 |
+ -e "s:@PREFIX@:${EPREFIX%/}/usr:" \ |
514 |
+ -e "s:@MOZ_FIVE_HOME@:${MOZILLA_FIVE_HOME}:" \ |
515 |
+ -e "s:@APULSELIB_DIR@:${apulselib}:" \ |
516 |
+ -e "s:@DEFAULT_WAYLAND@:${use_wayland}:" \ |
517 |
+ "${wrapper}" || die |
518 |
+ done |
519 |
|
520 |
# revdep-rebuild entry |
521 |
insinto /etc/revdep-rebuild |
522 |
@@ -171,7 +211,7 @@ src_install() { |
523 |
share_plugins_dir |
524 |
|
525 |
# Required in order to use plugins and even run firefox on hardened. |
526 |
- pax-mark mr "${ED}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container} |
527 |
+ pax-mark mr "${ED%/}"${MOZILLA_FIVE_HOME}/{firefox,firefox-bin,plugin-container} |
528 |
} |
529 |
|
530 |
pkg_postinst() { |