summaryrefslogtreecommitdiff
path: root/repo/firefox/firefox.xibuild
blob: 7d345f040443a0a4e91f8cc6e346155b7aa15493 (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
#!/bin/sh

NAME="firefox"
DESC="Firefox web browser"

MAKEDEPS="make rust cbindgen"
DEPS="libseccomp nodejs alsa-lib atk cairo dbus ffmpeg fontconfig freetype2 gdk-pixbuf glib gtk3 icu libevent libffi libpng libvpx libwebp libx11 libxcb libxcomposite libxdamage libxext libxfixes libxrandr musl nspr nss pango pixman zlib dbus-glib"

PKG_VER=100.0.2

SOURCE="https://ftp.mozilla.org/pub/firefox/releases/$PKG_VER/source/firefox-$PKG_VER.source.tar.xz"
ADDITIONAL="
allow-custom-rust-vendor.patch
avoid-redefinition.patch
disable-moz-stackwalk.patch
disable-neon-in-aom.patch
firefox-safe.desktop
firefox.desktop
fix-fortify-system-wrappers.patch
fix-rust-target.patch
fix-webrtc-glibcisms.patch
mallinfo.patch
sandbox-fork.patch
sandbox-largefile.patch
sandbox-sched_setscheduler.patch
stab.h
"

prepare () {
    apply_patches

    cp stab.h toolkit/crashreporter/google-breakpad/src/

    sed -i 's/\("files":{\)[^}]*/\1/' third_party/rust/audio_thread_priority/.cargo-checksum.json
    sed -i 's/\("files":{\)[^}]*/\1/' third_party/rust/target-lexicon-0.9.0/.cargo-checksum.json
}

build () {
    mkdir -p objdir
    cd objdir
    export SHELL=/bin/sh
	export BUILD_OFFICIAL=1
	export MOZILLA_OFFICIAL=1
	export USE_SHORT_LIBNAME=1
	export MACH_USE_SYSTEM_PYTHON=1
	export MOZBUILD_STATE_PATH=$BUILD_ROOT/mozbuild
	# disable desktop notifications
	export MOZ_NOSPAM=1
	# Find our triplet JSON
	export RUST_TARGET="x86_64-unknown-linux-musl"
	# Build with Clang, takes less RAM
	export CC="clang"
	export CXX="clang++"

	export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/lib/firefox"
    ../mach configure \
        --without-wasm-sandboxed-libraries \
		--prefix=/usr \
        --disable-elf-hack \
        --enable-rust-simd \
        --enable-sandbox \
		--disable-cargo-incremental \
		--disable-crashreporter \
		--disable-install-strip \
		--disable-jemalloc \
		--disable-minify \
		--disable-profiling \
		--disable-strip \
		--disable-tests \
		--disable-updater \
		--enable-alsa \
		--enable-dbus \
		--enable-default-toolkit=cairo-gtk3-wayland \
		--enable-dom-streams \
		--enable-ffmpeg \
		--enable-hardening \
		--enable-necko-wifi \
		--enable-official-branding \
		--enable-optimize="$CFLAGS -O2" \
		--enable-pulseaudio \
		--enable-release \
		--enable-system-ffi \
		--enable-system-pixman \
		--with-distribution-id=xilinux \
		--with-libclang-path=/usr/lib \
		--with-system-ffi \
		--with-system-icu \
		--with-system-jpeg \
		--with-system-libevent \
		--with-system-libvpx \
		--with-system-nspr \
		--with-system-nss \
		--with-system-pixman \
		--with-system-png \
		--with-system-webp \
		--with-system-zlib \
		--with-unsigned-addon-scopes=app,system  &&
	../mach build
}

package () {

	DESTDIR="$PKG_DEST" MOZ_MAKE_FLAGS="$MAKEOPTS" ../mach install

	install -m755 -d "$PKG_DEST"/usr/share/applications
	install -m755 -d "$PKG_DEST"/usr/share/pixmaps

	local _png
	for _png in ../browser/branding/official/default*.png; do
		local i=${_png%.png}
		i=${i##*/default}
		install -D -m644 "$_png" "$PKG_DEST"/usr/share/icons/hicolor/"$i"x"$i"/apps/firefox.png
	done

	install -m644 ../browser/branding/official/default48.png \
		"$PKG_DEST"/usr/share/pixmaps/firefox.png
	install -m644 ../firefox.desktop "$PKG_DEST"/usr/share/applications/org.mozilla.firefox.desktop
	install -m644 ../firefox-safe.desktop "$PKG_DEST"/usr/share/applications/org.mozilla.firefox-safe.desktop

	# Add StartupWMClass=firefox on the .desktop files so Desktop Environments
	# correctly associate the window with their icon, the correct fix is to have
	# firefox sets its own AppID but this will work for the meantime
	# See: https://bugzilla.mozilla.org/show_bug.cgi?id=1607399
	echo "StartupWMClass=firefox" >> $PKG_DEST/usr/share/applications/org.mozilla.firefox.desktop
	echo "StartupWMClass=firefox" >> $PKG_DEST/usr/share/applications/org.mozilla.firefox-safe.desktop

	# install our vendor prefs
	install -d $PKG_DEST/usr/lib/firefox/browser/defaults/preferences

	cat >> $PKG_DEST/usr/lib/firefox/browser/defaults/preferences/firefox-branding.js <<- EOF
	// Use LANG environment variable to choose locale
	pref("intl.locale.requested", "");

	// Disable default browser checking.
	pref("browser.shell.checkDefaultBrowser", false);

	// Don't disable our bundled extensions in the application directory
	pref("extensions.autoDisableScopes", 11);
	pref("extensions.shownSelectionUI", true);
	EOF
}