Guest User

Untitled

a guest
Oct 30th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.40 KB | None | 0 0
  1. # $Id$
  2. # Maintainer: Frederic Bezies <fredbezies at gmail dot com>
  3. # Contributor: Felix Golatofski <contact@xdfr.de>
  4. # Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
  5. # Contributor: Ionut Biru <ibiru@archlinux.org>
  6. # Contributor: Jakub Schmidtke <sjakub@gmail.com>
  7. # Contributor: Luna Jernberg <droidbittin@gmail.com>
  8.  
  9. ##
  10. ## The following variables can be customized at build time. Use env or export to change at your wish
  11. ##
  12. ## Example: env enable_pgo=y makepkg -sc
  13. ##
  14. ## Optimized build: env enable_pgo=y enable_lto=y makepkg -sc
  15. ## Optimized build, less RAM required: env enable_pgo=y enable_lto=y enable_no_keep_memory=y makepkg -sc
  16. ## Less optimization enabled, faster compilation: env enable_pgo=n enable_lto=n makepkg -sc
  17. ##
  18. ## Enable PGO, increasing performances but makes the compilation slower.
  19. ## It builds Firefox a first time without LTO, runs the test suite to generate
  20. ## a PGO profile, then builds Firefox again (with optional LTO) using this
  21. ## profile.
  22. ## Set variable "enable_pgo" to: y to enable (increase performance, default in official firefox-beta)
  23. ## n to disable (less optimized, but faster compilation, as it will skip the profile generation)
  24. if [ -z ${enable_pgo+x} ]; then
  25. enable_pgo=y
  26. fi
  27.  
  28. ## Enable LTO, increasing performances but makes the compilation slower and
  29. ## requires more RAM to build. Only affects clang, rust has LTO enabled by
  30. ## default.
  31. ## Disable it if the compilation runs out-of-memory.
  32. ## Set variable "enable_lto" to: y to enable (increase performance, default in official firefox-beta, but slower to compile)
  33. ## n to disable (less optimized, but faster to compile)
  34. if [ -z ${enable_lto+x} ]; then
  35. enable_lto=y
  36. fi
  37.  
  38. ## Enable --no-keep-memory in LD when compiling with LTO enabled. Useful when
  39. ## running OOM during the compilation, as LD will consume less memory when ##
  40. ## linking. Doesn't impact the performance of the generated binary, but makes
  41. ## the compilation a bit slower.
  42. ## Set variable "enable_no_keep_memory" to: n to disable (default)
  43. ## y to enable (slower compilation, but compilation requires less memory)
  44. if [ -z ${enable_no_keep_memory+x} ]; then
  45. enable_no_keep_memory=n
  46. fi
  47.  
  48. ### IMPORTANT: Do no edit below this line unless you know what you're doing
  49.  
  50. pkgname=firefox-beta
  51. _pkgname=firefox
  52. pkgver=83.0b6
  53. _major=${pkgver/rc*}
  54. _build=${pkgver/*rc}
  55. _pkgver=83.0
  56. pkgrel=1
  57. pkgdesc="Standalone web browser from mozilla.org - Beta"
  58. arch=(i686 x86_64)
  59. license=(MPL GPL LGPL)
  60. url="https://www.mozilla.org/en-US/firefox/channel/#beta"
  61. depends=(gtk3 libxt mime-types dbus-glib ffmpeg 'nss>=3.55' ttf-font libpulse)
  62. makedepends=(unzip zip diffutils yasm mesa imake inetutils xorg-server-xvfb
  63. autoconf2.13 rust clang llvm jack gtk2 nodejs cbindgen nasm
  64. python-setuptools python-psutil lld)
  65. optdepends=('networkmanager: Location detection via available WiFi networks'
  66. 'libnotify: Notification integration'
  67. 'pulseaudio: Audio support'
  68. 'speech-dispatcher: Text-to-Speech'
  69. 'hunspell-en_US: Spell checking, American English')
  70. provides=("firefox=$pkgver")
  71. conflicts=('firefox-beta-bin')
  72. options=(!emptydirs !makeflags !strip)
  73. source=(https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/$_pkgname-$pkgver.source.tar.xz{,.asc}
  74. 0001-Use-remoting-name-for-GDK-application-names.patch
  75. $pkgname.desktop)
  76. sha256sums=('ebe60fe341599e73bd5efe3ecfab56d5e992b340b798fd474f7d17954a4bad42'
  77. 'SKIP'
  78. '3bb7463471fb43b2163a705a79a13a3003d70fff4bbe44f467807ca056de9a75'
  79. '54d93249fedc9c4cdc5eb82da498b08f08bcb089f85a138b457f3251a0913ad1')
  80. validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases <release@mozilla.com>
  81.  
  82. # RC
  83. if [[ $_build = ? ]]; then
  84. source[0]="firefox-$pkgver.source.tar.xz::https://ftp.mozilla.org/pub/firefox/candidates/$_major-candidates/build$_build/source/firefox-$_major.source.tar.xz"
  85. source[1]="firefox-$pkgver.source.tar.xz.asc::https://ftp.mozilla.org/pub/firefox/candidates/$_major-candidates/build$_build/source/firefox-$_major.source.tar.xz.asc"
  86. fi
  87.  
  88. # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
  89. # Note: These are for Arch Linux use ONLY. For your own distribution, please
  90. # get your own set of keys. Feel free to contact foutrelis@archlinux.org for
  91. # more information.
  92. _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM
  93.  
  94. # Mozilla API keys (see https://location.services.mozilla.com/api)
  95. # Note: These are for Arch Linux use ONLY. For your own distribution, please
  96. # get your own set of keys. Feel free to contact heftig@archlinux.org for
  97. # more information.
  98. _mozilla_api_key=e05d56db0a694edc8b5aaebda3f2db6a
  99.  
  100.  
  101. prepare() {
  102. mkdir mozbuild
  103. cd firefox-$_pkgver
  104.  
  105. # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
  106. patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch
  107.  
  108. echo -n "$_google_api_key" >google-api-key
  109. echo -n "$_mozilla_api_key" >mozilla-api-key
  110.  
  111. cat >../mozconfig <<END
  112. ac_add_options --enable-application=browser
  113. mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
  114.  
  115. ac_add_options --prefix=/usr
  116. ac_add_options --enable-release
  117. ac_add_options --enable-hardening
  118. ac_add_options --enable-optimize
  119. ac_add_options --enable-rust-simd
  120. ac_add_options --enable-linker=lld
  121. ac_add_options --disable-elf-hack
  122. export CC='clang --target=x86_64-unknown-linux-gnu'
  123. export CXX='clang++ --target=x86_64-unknown-linux-gnu'
  124. export AR=llvm-ar
  125. export NM=llvm-nm
  126. export RANLIB=llvm-ranlib
  127.  
  128. # Branding
  129. ac_add_options --enable-official-branding
  130. ac_add_options --enable-update-channel=beta
  131. ac_add_options --with-distribution-id=org.archlinux
  132. ac_add_options --with-unsigned-addon-scopes=app,system
  133. ac_add_options --allow-addon-sideload
  134. export MOZILLA_OFFICIAL=1
  135. export MOZ_APP_REMOTINGNAME=${pkgname//-/}
  136. export MOZ_TELEMETRY_REPORTING=1
  137. export MOZ_REQUIRE_SIGNING=1
  138.  
  139. # Keys
  140. ac_add_options --with-google-location-service-api-keyfile=${PWD@Q}/google-api-key
  141. ac_add_options --with-google-safebrowsing-api-keyfile=${PWD@Q}/google-api-key
  142. ac_add_options --with-mozilla-api-keyfile=${PWD@Q}/mozilla-api-key
  143.  
  144. # System libraries
  145. ac_add_options --with-system-nspr
  146. ac_add_options --with-system-nss
  147.  
  148. # Features
  149. ac_add_options --enable-alsa
  150. ac_add_options --enable-jack
  151. ac_add_options --enable-crashreporter
  152. ac_add_options --disable-updater
  153. ac_add_options --disable-tests
  154. END
  155. }
  156.  
  157. build() {
  158. cd firefox-$_pkgver
  159.  
  160. export MOZ_NOSPAM=1
  161. export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
  162. export MOZ_ENABLE_FULL_SYMBOLS=1
  163. export MACH_USE_SYSTEM_PYTHON=1
  164.  
  165. # LTO needs more open files
  166. ulimit -n 4096
  167.  
  168. if [ "$enable_pgo" = "y" ]; then
  169. # Do 3-tier PGO
  170. echo "Building instrumented browser..."
  171. cat >.mozconfig ../mozconfig - <<END
  172. ac_add_options --enable-profile-generate=cross
  173. END
  174. ./mach build
  175.  
  176. echo "Profiling instrumented browser..."
  177. ./mach package
  178. LLVM_PROFDATA=llvm-profdata \
  179. JARLOG_FILE="$PWD/jarlog" \
  180. xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
  181. ./mach python build/pgo/profileserver.py
  182.  
  183. stat -c "Profile data found (%s bytes)" merged.profdata
  184. test -s merged.profdata
  185.  
  186. stat -c "Jar log found (%s bytes)" jarlog
  187. test -s jarlog
  188.  
  189. echo "Removing instrumented browser..."
  190. ./mach clobber
  191.  
  192. echo "Building optimized browser..."
  193. cat >.mozconfig ../mozconfig - <<END
  194. ac_add_options --enable-profile-use=cross
  195. ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
  196. ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog
  197. END
  198. else
  199. cat >.mozconfig ../mozconfig
  200. fi
  201.  
  202. if [ "$enable_lto" = "y" ]; then
  203. echo "ac_add_options --enable-lto=cross" >> .mozconfig
  204. if [ "$enable_no_keep_memory" = "y" ]; then
  205. LDFLAGS="$LDFLAGS,--no-keep-memory"
  206. fi
  207. fi
  208. ./mach build
  209.  
  210. echo "Building symbol archive..."
  211. ./mach buildsymbols
  212. }
  213.  
  214. package() {
  215. cd firefox-$_pkgver
  216. DESTDIR="$pkgdir" ./mach install
  217. mv "$pkgdir"/usr/lib/{firefox,$pkgname}
  218. rm "$pkgdir"/usr/bin/firefox
  219.  
  220. local vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
  221. install -Dvm644 /dev/stdin "$vendorjs" <<END
  222. // Use LANG environment variable to choose locale
  223. pref("intl.locale.requested", "");
  224.  
  225. // Use system-provided dictionaries
  226. pref("spellchecker.dictionary_path", "/usr/share/hunspell");
  227.  
  228. // Disable default browser checking.
  229. pref("browser.shell.checkDefaultBrowser", false);
  230.  
  231. // Don't disable our bundled extensions in the application directory
  232. pref("extensions.autoDisableScopes", 11);
  233. END
  234.  
  235. local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  236. install -Dm644 /dev/stdin "$distini" <<END
  237. [Global]
  238. id=archlinux
  239. version=1.0
  240. about=Mozilla Firefox for Arch Linux
  241.  
  242. [Preferences]
  243. app.distributor=archlinux
  244. app.distributor.channel=$pkgname
  245. app.partner.archlinux=archlinux
  246. END
  247.  
  248. local i theme=official
  249. for i in 16 22 24 32 48 64 128 256; do
  250. install -Dvm644 browser/branding/$theme/default$i.png \
  251. "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
  252. done
  253. install -Dvm644 browser/branding/$theme/content/about-logo.png \
  254. "$pkgdir/usr/share/icons/hicolor/192x192/apps/$pkgname.png"
  255. install -Dvm644 browser/branding/$theme/content/about-logo@2x.png \
  256. "$pkgdir/usr/share/icons/hicolor/384x384/apps/$pkgname.png"
  257. install -Dvm644 browser/branding/$theme/content/identity-icons-brand.svg \
  258. "$pkgdir/usr/share/icons/hicolor/symbolic/apps/$pkgname-symbolic.svg"
  259.  
  260. install -Dvm644 ../$pkgname.desktop \
  261. "$pkgdir/usr/share/applications/$pkgname.desktop"
  262.  
  263. # Install a wrapper to avoid confusion about binary path
  264. install -Dvm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" <<END
  265. #!/bin/sh
  266. exec /usr/lib/$pkgname/firefox "\$@"
  267. END
  268.  
  269. # Replace duplicate binary with wrapper
  270. # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
  271. ln -srfv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/lib/$pkgname/firefox-bin"
  272.  
  273. # Use system certificates
  274. local nssckbi="$pkgdir/usr/lib/$pkgname/libnssckbi.so"
  275. if [[ -e $nssckbi ]]; then
  276. ln -srfv "$pkgdir/usr/lib/libnssckbi.so" "$nssckbi"
  277. fi
  278.  
  279. export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE="$startdir/.crash-stats-api.token"
  280. if [[ -f $SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE ]]; then
  281. make -C obj uploadsymbols
  282. else
  283. cp -fvt "$startdir" obj/dist/*crashreporter-symbols-full.tar.zst
  284. fi
  285. }
  286.  
Add Comment
Please, Sign In to add comment