Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2021
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.83 KB | None | 0 0
  1. # Maintainer : Figue <ffigue@gmail.com>
  2. # Contributor : Ionut Biru <ibiru@archlinux.org>
  3. # Contributor: Jakub Schmidtke <sjakub@gmail.com>
  4.  
  5. pkgname=firefox-esr
  6. pkgver=78.9.0
  7. pkgrel=1
  8. pkgdesc="Standalone web browser from mozilla.org, Extended Support Release"
  9. arch=(x86_64)
  10. license=(MPL GPL LGPL)
  11. url="https://www.mozilla.org/en-US/firefox/organizations/"
  12. depends=(gtk3 libxt mime-types dbus-glib ffmpeg nss ttf-font libpulse)
  13. makedepends=(unzip zip diffutils yasm mesa imake inetutils xorg-server-xvfb
  14. autoconf2.13 rust clang llvm jack gtk2 nodejs cbindgen nasm
  15. python-setuptools python-psutil lld)
  16. optdepends=('networkmanager: Location detection via available WiFi networks'
  17. 'libnotify: Notification integration'
  18. 'pulseaudio: Audio support'
  19. 'speech-dispatcher: Text-to-Speech'
  20. 'hunspell-en_US: Spell checking, American English')
  21. provides=(firefox=${pkgver})
  22. conflicts=(firefox)
  23. options=(!emptydirs !makeflags !strip)
  24. source=(https://archive.mozilla.org/pub/firefox/releases/${pkgver}esr/source/firefox-${pkgver}esr.source.tar.xz{,.asc}
  25. ${pkgname}.desktop 0001-Use-remoting-name-for-GDK-application-names.patch upload-symbol-archive
  26. rust_1.48.patch.gz)
  27. sha256sums=('8e03ac1dfc5ac804c8b13a529414a9387e0425e545bb2f4462d74c3175e64864
  28. 'SKIP'
  29. 'd86fe1636346ff003744b65e73cd3a7182618faedf3ee57023bb942e325cc726'
  30. '3bb7463471fb43b2163a705a79a13a3003d70fff4bbe44f467807ca056de9a75'
  31. 'eb9b9c058d1505e5b82526a8cad63f98e04fc17c4715f6b4cfc778e10fcfaf27'
  32. 'c7f867ccee684939c9f0a9c30ea69127077bbe43af545a03f09dfbbdc02545a9')
  33. validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases <release@mozilla.com>
  34.  
  35. # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
  36. # Note: These are for Arch Linux use ONLY. For your own distribution, please
  37. # get your own set of keys. Feel free to contact foutrelis@archlinux.org for
  38. # more information.
  39. _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM
  40.  
  41. # Mozilla API keys (see https://location.services.mozilla.com/api)
  42. # Note: These are for Arch Linux use ONLY. For your own distribution, please
  43. # get your own set of keys. Feel free to contact heftig@archlinux.org for
  44. # more information.
  45. _mozilla_api_key=e05d56db0a694edc8b5aaebda3f2db6a
  46.  
  47. prepare() {
  48. mkdir -p mozbuild
  49. cd firefox-$pkgver
  50.  
  51. # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
  52. patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch
  53.  
  54. # https://bugzilla.mozilla.org/show_bug.cgi?id=1667736
  55. patch -Np1 -i ../rust_1.48.patch
  56.  
  57. echo -n "$_google_api_key" >google-api-key
  58. echo -n "$_mozilla_api_key" >mozilla-api-key
  59.  
  60. cat >../mozconfig <<END
  61. ac_add_options --enable-application=browser
  62.  
  63. ac_add_options --prefix=/usr
  64. ac_add_options --enable-release
  65. ac_add_options --enable-hardening
  66. ac_add_options --enable-optimize
  67. ac_add_options --enable-rust-simd
  68. ac_add_options --enable-linker=lld
  69. ac_add_options --disable-elf-hack
  70. export CC='clang --target=x86_64-unknown-linux-gnu'
  71. export CXX='clang++ --target=x86_64-unknown-linux-gnu'
  72. export AR=llvm-ar
  73. export NM=llvm-nm
  74. export RANLIB=llvm-ranlib
  75.  
  76. # Branding
  77. ac_add_options --enable-official-branding
  78. ac_add_options --enable-update-channel=release
  79. ac_add_options --with-distribution-id=org.archlinux
  80. ac_add_options --with-unsigned-addon-scopes=app,system
  81. ac_add_options --allow-addon-sideload
  82. export MOZILLA_OFFICIAL=1
  83. export MOZ_APP_REMOTINGNAME=${pkgname//-/}
  84. export MOZ_TELEMETRY_REPORTING=1
  85. export MOZ_REQUIRE_SIGNING=1
  86.  
  87. # Keys
  88. ac_add_options --with-google-location-service-api-keyfile=${PWD@Q}/google-api-key
  89. ac_add_options --with-google-safebrowsing-api-keyfile=${PWD@Q}/google-api-key
  90. ac_add_options --with-mozilla-api-keyfile=${PWD@Q}/mozilla-api-key
  91.  
  92. # System libraries
  93. ac_add_options --with-system-nspr
  94. ac_add_options --with-system-nss
  95.  
  96. # Features
  97. ac_add_options --enable-alsa
  98. ac_add_options --enable-jack
  99. ac_add_options --disable-crashreporter
  100. ac_add_options --disable-updater
  101. ac_add_options --disable-tests
  102. END
  103. }
  104.  
  105. build() {
  106. cd firefox-$pkgver
  107.  
  108. export MOZ_NOSPAM=1
  109. export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
  110.  
  111. # LTO needs more open files
  112. ulimit -n 4096
  113.  
  114. # -fno-plt with cross-LTO causes obscure LLVM errors
  115. # LLVM ERROR: Function Import: link error
  116. CFLAGS="${CFLAGS/-fno-plt/}"
  117. CXXFLAGS="${CXXFLAGS/-fno-plt/}"
  118.  
  119. # Do 3-tier PGO
  120. echo "Building instrumented browser..."
  121. cat >.mozconfig ../mozconfig - <<END
  122. ac_add_options --enable-profile-generate=cross
  123. END
  124. ./mach build
  125.  
  126. echo "Profiling instrumented browser..."
  127. ./mach package
  128. LLVM_PROFDATA=llvm-profdata \
  129. JARLOG_FILE="$PWD/jarlog" \
  130. xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
  131. ./mach python build/pgo/profileserver.py
  132.  
  133. stat -c "Profile data found (%s bytes)" merged.profdata
  134. test -s merged.profdata
  135.  
  136. stat -c "Jar log found (%s bytes)" jarlog
  137. test -s jarlog
  138.  
  139. echo "Removing instrumented browser..."
  140. ./mach clobber
  141.  
  142. echo "Building optimized browser..."
  143. cat >.mozconfig ../mozconfig - <<END
  144. ac_add_options --enable-lto=cross
  145. ac_add_options --enable-profile-use=cross
  146. ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
  147. ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog
  148. END
  149. ./mach build
  150.  
  151. # echo "Building symbol archive..."
  152. # ./mach buildsymbols
  153. }
  154.  
  155. package() {
  156. cd firefox-$pkgver
  157. DESTDIR="$pkgdir" ./mach install
  158.  
  159. local vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
  160. install -Dvm644 /dev/stdin "$vendorjs" <<END
  161. // Use LANG environment variable to choose locale
  162. pref("intl.locale.requested", "");
  163.  
  164. // Use system-provided dictionaries
  165. pref("spellchecker.dictionary_path", "/usr/share/hunspell");
  166.  
  167. // Disable default browser checking.
  168. pref("browser.shell.checkDefaultBrowser", false);
  169.  
  170. // Don't disable extensions in the application directory
  171. pref("extensions.autoDisableScopes", 11);
  172. END
  173.  
  174. local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  175. install -Dvm644 /dev/stdin "$distini" <<END
  176. [Global]
  177. id=archlinux
  178. version=1.0
  179. about=Mozilla Firefox ESR for Arch Linux
  180.  
  181. [Preferences]
  182. app.distributor=archlinux
  183. app.distributor.channel=$pkgname
  184. app.partner.archlinux=archlinux
  185. END
  186.  
  187. local i theme=official
  188. for i in 16 22 24 32 48 64 128 256; do
  189. install -Dvm644 browser/branding/$theme/default$i.png \
  190. "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
  191. done
  192. install -Dvm644 browser/branding/$theme/content/about-logo.png \
  193. "$pkgdir/usr/share/icons/hicolor/192x192/apps/$pkgname.png"
  194. install -Dvm644 browser/branding/$theme/content/about-logo@2x.png \
  195. "$pkgdir/usr/share/icons/hicolor/384x384/apps/$pkgname.png"
  196. install -Dvm644 browser/branding/$theme/content/identity-icons-brand.svg \
  197. "$pkgdir/usr/share/icons/hicolor/symbolic/apps/$pkgname-symbolic.svg"
  198.  
  199. install -Dvm644 ../$pkgname.desktop \
  200. "$pkgdir/usr/share/applications/$pkgname.desktop"
  201.  
  202. # Install a wrapper to avoid confusion about binary path
  203. install -Dvm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" <<END
  204. #!/bin/sh
  205. exec /usr/lib/$pkgname/firefox "\$@"
  206. END
  207.  
  208. # Replace duplicate binary with wrapper
  209. # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
  210. ln -srfv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/lib/$pkgname/firefox-bin"
  211.  
  212. # Use system certificates
  213. local nssckbi="$pkgdir/usr/lib/$pkgname/libnssckbi.so"
  214. if [[ -e $nssckbi ]]; then
  215. ln -srfv "$pkgdir/usr/lib/libnssckbi.so" "$nssckbi"
  216. fi
  217.  
  218. # if [[ -f "$startdir/.crash-stats-api.token" ]]; then
  219. # find . -name '*crashreporter-symbols-full.zip' -exec \
  220. # "$startdir/upload-symbol-archive" "$startdir/.crash-stats-api.token" {} +
  221. # else
  222. # find . -name '*crashreporter-symbols-full.zip' -exec \
  223. # cp -fvt "$startdir" {} +
  224. # fi
  225. }
  226.  
  227. # vim:set sw=2 et:
  228.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement