From 5a3e90ddabd3560f763c2ae828da3b7bd08f5925 Mon Sep 17 00:00:00 2001
From: jc_gargma <jc_gargma@iserlohn-fortress.net>
Date: Sun, 17 Jul 2022 12:45:22 -0700
Subject: Get this package to actually compile and use a custom mozconfig.

---
 PKGBUILD           | 51 ++++++++++++++++++++++++++++++++++++++-------------
 mozconfig.in.clang | 23 +++++++++++++++--------
 2 files changed, 53 insertions(+), 21 deletions(-)

diff --git a/PKGBUILD b/PKGBUILD
index fa89452..55d137b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -30,11 +30,36 @@ arch=(x86_64 aarch64)
 license=(MPL GPL LGPL)
 url="https://www.mozilla.org/en-US/firefox/enterprise/"
 depends=(gtk3 libxt mime-types dbus-glib ffmpeg ttf-font libpulse alsa-lib
-         bzip2 libffi icu libjpeg-turbo libevent libvpx nspr nss pixman libpng sqlite libwebp zlib)
+         libffi icu libjpeg-turbo libvpx nspr nss pixman libpng12 libwebp zlib)
 makedepends=(unzip zip diffutils yasm mesa imake inetutils xorg-server-xvfb
              autoconf2.13 rust clang llvm jack nodejs cbindgen nasm
-             python-setuptools python-psutil python-zstandard lld dump_syms
-             wasi-compiler-rt wasi-libc wasi-libc++ wasi-libc++abi)
+             lld dump_syms
+             wasi-compiler-rt wasi-libc wasi-libc++ wasi-libc++abi
+# Use as many system python modules as possible
+             python-aiohttp python-appdirs python-async-timeout python-attrs
+             python-blessings python-cbor2 python-certifi python-chardet python-click
+             python-colorama python-cookies python-cram
+             python-distro python-ecdsa
+             python-idna python-importlib-metadata
+             python-iso8601 python-jaraco.context python-jaraco.functools python-jaraco.text
+             python-jsonschema python-markupsafe
+             python-mohawk python-more-itertools python-multidict
+             python-nspektr python-ordered-set python-packaging python-pathspec python-pip
+             python-ply python-pyasn1 python-pyasn1-modules
+             python-pyparsing python-pyrsistent python-pytoml python-yaml
+             python-requests python-requests-unixsocket python-responses python-rsa
+             python-setuptools python-six
+             python-tomli python-tqdm python-trove-classifiers python-typing-extensions
+             python-urllib3 python-validate-pyproject python-voluptuous python-wheel
+             python-yarl python-zipp python-zstandard)
+# # Firefox explicitly requires these python modules be outdated
+# python-psutil)
+# # Arch lacks these python modules
+# python-compare-locales python-diskcache python-esprima
+# python-fluent.migrate python-fluent.syntax python-idna-ssl python-Jinja2 python-jsmin
+# python-json-e python-mozilla-version python-pip-tools python-redo python-sentry-sdk
+# python-slugid python-taskcluster python-taskcluster-taskgraph python-taskcluster-urls
+# python-yamllint)
 optdepends=('networkmanager: Location detection via available WiFi networks'
             'libnotify: Notification integration'
             'alsa-utils: ALSA support'
@@ -72,7 +97,7 @@ sha512sums=('ce804fa4e5dda3b8c4c7937f18994a184b0eb7d8fb9484dc924d04d3213ee3daf01
             '46b76cc688099bbd4124c0b94eea45c1c43a95e1aab9ea8ff6b9c29cdefe383f7a4885f09ceef34e5e6ee2f1f589024b575352b26512feca703c68a48dc5818f'
             'b579b73176c72a5ecf36e3f63bba08fdb8041ae99d54e5cab906660fed6a9cf2311f7ca1ec1649e451cc6d5a4b1e6060b974b1d7befe9c8df3c5a89c50383c17'
             'b075df0ddbcbc5eed5ef9d02d859da8f104fe507808050e9a990c8f3aeb01645b77972a3af07bd2427680449104af623065d97fbbc40fc42aea0b5ba931e8324'
-            '315d88a3b401c56b26592a071efdb9ba4b6a06f03a6d8a9f7c7cf41c3762be81b0474ae493f18a044d06ed34bbc51492c773a8b741b1d490ffc0bea11a34d41c'
+            '0250c7789519ca011b87238fbb9a5b7067ae0b5e9c3ac7a0c7700199e47d0d7ef11cdcc33444a5cf1f0b23aaeb59c84bf7fb11965b4d8cf518066a4e0b76d595'
             '6c933ebfd683b955a3deb2f47b13f582ccd40f57e1164a0c821a65c4bc6040a1e0baf3a4aab1354c3e0ceeb4f3fab53612e54dfd0f56d320cf0a64bf3c270526'
             '34b90b6033d8c6196600aa820f8d5038ef506f07a6c8b90bc1b5691c47172df8778757aa9db68116bef9ced2d5592320e6d7a47cfb20cf133ba5757739d9968d'
             'e3e095eaa6427d1f8a392b16789ba51c1f13ec8a26f9128eada7fbf190ca8a47c92453e6cfd89676138869e7fdac765ff83cde01cc8b02d1de914c7eb4b1b22e')
@@ -83,7 +108,7 @@ b2sums=('f0caff349ffc28d10f3094957cb93d54ed4bac4a19532353dd4f09314435227af552647
         '1c3af4cc5199cf7b9f3aad9ceab98b3e8a3dc0d38f50896ed2f32ac648f1e904a1cdda5da559964885989edbfab4c4bf65448e9a0f71d946c77ec0ab5a6aff4c'
         '63a8dd9d8910f9efb353bed452d8b4b2a2da435857ccee083fc0c557f8c4c1339ca593b463db320f70387a1b63f1a79e709e9d12c69520993e26d85a3d742e34'
         '877eda442eb4730600dccf209a6e961ad3122ab456bbfda4ff041e8493ebaaf96224ac218360931259ff4214482f6bf65b3a3052f977ade1a274f38ffd859535'
-        '89b36fd35b0bf1fc672f60801ce77800ec7247b058b96d5a120e9035703b1a962967f287e3fd5336c0a901b5ca809c0c342cd6d648c1e20fa4b840ff96383cb7'
+        'e19354af8bfb4cce4c2e0dbddc6a9087aab97b2e77e9e5afefc8960c5dba0846d8a8e8061334dca50c0ab515f8114fcb36c9d8ba6e2cb31b00d3e8b70319db66'
         '0f8e203bda791428acf526481959978d26e988d34b5f0490c2f9ac3307feefaf7ec7511ba4647c3f254c86288a7265476df860dee38ae5a7aaba9e264b1fe4bc'
         '1dce1277c0c8b83089551057ed61c8794aa65242d0c19573dab96081f00b1042af73fbc0a40ba49dfa31eff46f4636ffd985cf8e6bd28db614a639ca6c11c74e'
         '379adf3726664668f6167eaeab35dec40342d9288ff081d22a8363f163ab0945b17ce69e7d4276a31e99e56f690afa070c410c51a5060ed835356fd216256e7b')
@@ -102,14 +127,14 @@ prepare() {
   if [ "${_modpgo}" == "1" ]; then
     # Add the custom mozconfig for clang pgo
     cp $srcdir/mozconfig.in.clang $srcdir/${_pkgname}-${pkgver}/.mozconfig
-  cat >$srcdir/${_pkgname}-${pkgver}/.mozconfig - <<END
+  cat >>$srcdir/${_pkgname}-${pkgver}/.mozconfig - <<END
 mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
 ac_add_options --enable-profile-generate=cross
 END
   elif [ "${_modpgo}" == "0" ]; then
     # Add the custom mozconfig for clang
     cp $srcdir/mozconfig.in.clang $srcdir/${_pkgname}-${pkgver}/.mozconfig
-  cat >$srcdir/${_pkgname}-${pkgver}/.mozconfig - <<END
+  cat >>$srcdir/${_pkgname}-${pkgver}/.mozconfig - <<END
 mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
 END
   fi
@@ -185,7 +210,7 @@ build() {
   echo "Building optimized browser..."
   # Add the custom mozconfig
   cp $srcdir/mozconfig.in.clang $srcdir/${_pkgname}-${pkgver}/.mozconfig
-  cat >$srcdir/${_pkgname}-${pkgver}/.mozconfig - <<END
+  cat >>$srcdir/${_pkgname}-${pkgver}/.mozconfig - <<END
 mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
 ac_add_options --enable-lto=cross
 ac_add_options --enable-profile-use=cross
@@ -205,11 +230,11 @@ package() {
   DESTDIR="$pkgdir" ./mach install
 
   # Don't install in /usr/local
-  rm -rf "$pkgdir/usr/local/bin"
-  mkdir "$pkgdir/usr/lib"
-  mkdir "$pkgdir/usr/bin"
-  cp -r --reflink "$pkgdir/usr/local/lib/firefox" "$pkgdir/usr/lib/firefox"
-  rm -rf "$pkgdir/usr/local/lib/firefox"
+  #rm -rf "$pkgdir/usr/local/bin"
+  #mkdir "$pkgdir/usr/lib"
+  #mkdir "$pkgdir/usr/bin"
+  #cp -r --reflink "$pkgdir/usr/local/lib/firefox" "$pkgdir/usr/lib/firefox"
+  #rm -rf "$pkgdir/usr/local/lib/firefox"
 
   install -Dm644 $srcdir/distribution.ini \
   "$pkgdir/usr/lib/$_pkgname/distribution/distribution.ini"
diff --git a/mozconfig.in.clang b/mozconfig.in.clang
index 66b3786..b92df2c 100644
--- a/mozconfig.in.clang
+++ b/mozconfig.in.clang
@@ -27,27 +27,33 @@ ac_add_options --with-unsigned-addon-scopes=app,system
 ac_add_options --allow-addon-sideload
 ac_add_options MOZ_TELEMETRY_REPORTING=
 export MOZILLA_OFFICIAL=1
-export MOZ_REQUIRE_SIGNING=0
+export MOZ_REQUIRE_SIGNING=
 export MOZ_ADDON_SIGNING=0
 
 # System libraries
 # # system-bz2 does not work with gcc builds
-ac_add_options --with-system-bz2
+# system-bz2 is no longer a thing
+# ac_add_options --with-system-bz2
 ac_add_options --with-system-ffi
 ac_add_options --with-system-icu
 ac_add_options --with-system-jpeg
-ac_add_options --with-system-libevent
+# # system-libevent breaks compiling
+# # ipc/chromium/src/base/message_pump_libevent.cc:45:1: error: use of undeclared identifier 'EVENT__SIZEOF_TIME_T'
+# ac_add_options --with-system-libevent
 ac_add_options --with-system-libvpx
 ac_add_options --with-system-nspr
 ac_add_options --with-system-nss
 ac_add_options --enable-system-pixman
 # # system-png does not work with gcc builds
-ac_add_options --with-system-png
+# # system-png lacks APNG support on arch
+# ac_add_options --with-system-png
 # # system-sqlite does not work with gcc builds
-ac_add_options --enable-system-sqlite
+# system-sqlite is no longer a thing
+# ac_add_options --enable-system-sqlite
 ac_add_options --with-system-webp
 ac_add_options --with-system-zlib
 ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
+# ac_add_options --without-wasm-sandboxed-libraries
 
 # Features
 ac_add_options --enable-alsa
@@ -57,7 +63,8 @@ ac_add_options --enable-jack
 # Disables
 ac_add_options --disable-accessibility
 ac_add_options --disable-bootstrap
-ac_add_options --disable-cdp
+# # disable-cdp is no longer a thing
+# ac_add_options --disable-cdp
 ac_add_options --disable-crashreporter
 ac_add_options --disable-debug
 ac_add_options --disable-debug-symbols
@@ -66,8 +73,8 @@ ac_add_options --disable-eme
 # ac_add_options --disable-marionette
 ac_add_options --disable-necko-wifi
 ac_add_options --disable-parental-controls
-# # precompiled-startupcache must be disabled to optimize for a newer
-# # instruction set target
+# # precompiled-startupcache must be disabled to cpu optimize for a 
+# # target that has instructions the build host lacks
 # ac_add_options --disable-precompiled-startupcache
 ac_add_options --disable-synth-speechd
 ac_add_options --disable-tests
-- 
cgit v1.2.1