Created
December 30, 2023 10:57
-
-
Save figue/1d7193d1dbba6e0f302b394c881e49d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Joan Figueras <ffigue at gmail> | |
# Contributor (Parabola): fauno <fauno@kiwwwi.com.ar> | |
# Contributor: Jan Alexander Steffens (heftig) <heftig@archlinux.org> | |
# Contributor: Ionut Biru <ibiru@archlinux.org> | |
# Contributor: Jakub Schmidtke <sjakub@gmail.com> | |
pkgname=icecat | |
pkgver=115.6.0 | |
pkgrel=2 | |
_commit=f889514426e512e5602c71e1b411ae0332a33366 | |
pkgdesc="GNU version of the Firefox browser." | |
arch=(x86_64) | |
license=( | |
GPL | |
LGPL | |
MPL | |
) | |
depends=( | |
dbus | |
ffmpeg | |
gtk3 | |
libpulse | |
libxss | |
libxt | |
mime-types | |
nss | |
ttf-font | |
) | |
makedepends=( | |
cbindgen | |
clang | |
diffutils | |
dump_syms | |
imake | |
inetutils | |
jack | |
lld | |
llvm | |
mesa | |
nasm | |
nodejs | |
python | |
rust | |
unzip | |
wasi-compiler-rt | |
wasi-libc | |
wasi-libc++ | |
wasi-libc++abi | |
xorg-server-xvfb | |
yasm | |
zip | |
) | |
optdepends=( | |
'hunspell-en_US: Spell checking, American English' | |
'libnotify: Notification integration' | |
'networkmanager: Location detection via available WiFi networks' | |
'pulseaudio: Audio support' | |
'speech-dispatcher: Text-to-Speech' | |
'xdg-desktop-portal: Screensharing with Wayland' | |
) | |
options=( | |
!debug | |
!emptydirs | |
!lto | |
!makeflags | |
!strip | |
) | |
source=(https://git.savannah.gnu.org/cgit/gnuzilla.git/snapshot/gnuzilla-${_commit}.tar.gz | |
icecat.desktop icecat-safe.desktop) | |
sha256sums=('634d4bf8a55279f20b7109c18709faf992af14d824165df4c258c3f6f6036952' | |
'e00dbf01803cdd36fd9e1c0c018c19bb6f97e43016ea87062e6134bdc172bc7d' | |
'33dd309eeb99ec730c97ba844bf6ce6c7840f7d27da19c82389cdefee8c20208') | |
prepare() { | |
cd gnuzilla-${_commit} | |
# Uncomment if you have issues with gpg download... WITH PROXY gpg doesn't work!!!!!! | |
#sed -e 's/^verify_sources$//g' -i makeicecat | |
mkdir output || rm -rf output/* # Clean output just in case is already an old build there | |
if [ -f "${SRCDEST}/firefox-${pkgver}esr.source.tar.xz" ] && [ -f "${SRCDEST}/firefox-${pkgver}esr.source.tar.xz.asc" ]; then cp -f "${SRCDEST}"/firefox-${pkgver}esr.source.tar.xz{,.asc} output/ ; fi | |
# Patches to avoid download sources if you have in your $startdir | |
sed -e '/rm -rf output/d' -i makeicecat | |
sed -e 's/wget -N/wget -nv -Nc/g' -i makeicecat | |
# Other patches | |
sed '/^finalize_sourceball$/d' -i makeicecat | |
# If we want to avoid all locales, we can use variable _SPEED=y to build it with only 1 locale. Use variable _LOCALE to define it | |
if [[ $_SPEED =~ [y|Y] ]]; then | |
msg2 "Building without all locales..." | |
sed -e 's/DEVEL=0/DEVEL=1/g' -i makeicecat | |
# Also you can choose your locale using external variable _LOCALE. By default in upstream script this locale is es-ES | |
[ -z "$_LOCALE" ] || sed -e "s/es-ES/$_LOCALE/g" -i makeicecat && echo "$_LOCALE" > custom-shipped-locales | |
rm -rf data/files-to-append/l10n/* | |
fi | |
# Thanks to cysp74 to report this bug | |
sed -e 's;find l10n -wholename '\''\*/brand.dtd'\'' | xargs;find l10n -wholename '\''\*/brand.dtd'\'' | xargs -r;g' -i makeicecat | |
# Produce IceCat sources | |
bash makeicecat | |
cd output/icecat-${pkgver} | |
# Patch to move files directly to /usr/lib/icecat. No more symlinks. | |
sed -e 's;$(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION);$(libdir)/$(MOZ_APP_NAME);g' -i config/baseconfig.mk | |
sed -e 's;$(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION);$(libdir)/$(MOZ_APP_NAME)-devel;g' -i config/baseconfig.mk | |
printf '%b' " \e[1;36m->\e[0m\033[1m Starting build...\n" | |
cat >./mozconfig <<END | |
ac_add_options --enable-application=browser | |
mk_add_options MOZ_OBJDIR=${PWD@Q}/obj | |
ac_add_options --prefix=/usr | |
ac_add_options --enable-release | |
ac_add_options --enable-hardening | |
ac_add_options --enable-optimize | |
ac_add_options --enable-rust-simd | |
ac_add_options --enable-linker=lld | |
ac_add_options --disable-elf-hack | |
ac_add_options --disable-bootstrap | |
ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot | |
# Branding | |
ac_add_options --enable-official-branding | |
ac_add_options --with-distribution-id=org.gnu | |
ac_add_options --with-unsigned-addon-scopes=app,system | |
ac_add_options --allow-addon-sideload | |
export MOZ_APP_REMOTINGNAME=${pkgname//-/} | |
# System libraries | |
ac_add_options --with-system-nspr | |
ac_add_options --with-system-nss | |
# Features | |
ac_add_options --enable-alsa | |
ac_add_options --enable-jack | |
ac_add_options --disable-crashreporter | |
ac_add_options --disable-updater | |
ac_add_options --disable-tests | |
ac_add_options --disable-eme | |
ac_add_options --with-app-basename=icecat | |
ac_add_options --with-app-name=icecat | |
END | |
} | |
build() { | |
cd gnuzilla-${_commit}/output/icecat-${pkgver} | |
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=pip | |
export MOZBUILD_STATE_PATH="$srcdir/mozbuild" | |
export MOZ_BUILD_DATE="$(date -u${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH} +%Y%m%d%H%M%S)" | |
export MOZ_ENABLE_FULL_SYMBOLS=1 | |
export MOZ_NOSPAM=1 | |
# malloc_usable_size is used in various parts of the codebase | |
CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}" | |
CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}" | |
# LTO needs more open files | |
ulimit -n 4096 | |
# Do 3-tier PGO | |
echo "Building instrumented browser..." | |
cat >>./mozconfig <<END | |
ac_add_options --enable-profile-generate=cross | |
END | |
./mach build | |
echo "Profiling instrumented browser..." | |
./mach package | |
LLVM_PROFDATA=llvm-profdata \ | |
JARLOG_FILE="$PWD/jarlog" \ | |
xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \ | |
./mach python build/pgo/profileserver.py | |
stat -c "Profile data found (%s bytes)" merged.profdata | |
test -s merged.profdata | |
stat -c "Jar log found (%s bytes)" jarlog | |
test -s jarlog | |
echo "Removing instrumented browser..." | |
./mach clobber | |
echo "Building optimized browser..." | |
cat >>./mozconfig <<END | |
ac_add_options --enable-lto=cross,full | |
ac_add_options --enable-profile-use=cross | |
ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata | |
ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog | |
END | |
./mach build | |
} | |
package () { | |
cd gnuzilla-${_commit}/output/icecat-${pkgver} | |
# Remove cose.manifest and cose.sig cause march install fails | |
find obj-x86_64-pc-linux-gnu/dist/bin/browser/extensions -name cose.manifest -delete | |
find obj-x86_64-pc-linux-gnu/dist/bin/browser/extensions -name cose.sig -delete | |
DESTDIR="$pkgdir" ./mach install | |
local vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js" | |
install -Dvm644 /dev/stdin "$vendorjs" <<END | |
// Use LANG environment variable to choose locale | |
pref("intl.locale.requested", ""); | |
// Use system-provided dictionaries | |
pref("spellchecker.dictionary_path", "/usr/share/hunspell"); | |
// Disable default browser checking. | |
pref("browser.shell.checkDefaultBrowser", false); | |
// Don't disable extensions in the application directory | |
pref("extensions.autoDisableScopes", 11); | |
END | |
local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini" | |
install -Dvm644 /dev/stdin "$distini" <<END | |
[Global] | |
id=archlinux | |
version=1.0 | |
about=GNU IceCat for Arch Linux | |
[Preferences] | |
app.distributor=archlinux | |
app.distributor.channel=$pkgname | |
app.partner.archlinux=archlinux | |
END | |
printf '%b' " \e[1;36m->\e[0m\033[1m Finishing...\n" | |
install -m755 -d ${pkgdir}/usr/share/applications | |
install -m755 -d ${pkgdir}/usr/share/pixmaps | |
for i in 16 32 48; do | |
install -Dm644 browser/branding/official/default${i}.png \ | |
"$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/icecat.png" | |
done | |
install -Dm644 browser/branding/official/default48.png ${pkgdir}/usr/share/pixmaps/icecat.png | |
install -Dm644 ${srcdir}/icecat.desktop ${pkgdir}/usr/share/applications/ | |
install -Dm644 ${srcdir}/icecat-safe.desktop ${pkgdir}/usr/share/applications/ | |
} | |
# vim:set sw=2 sts=-1 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment