PKGBUILD 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. # Maintainer (arch): Jan Alexander Steffens (heftig) <heftig@archlinux.org>
  2. # Contributor: Ionut Biru <ibiru@archlinux.org>
  3. # Contributor: Jakub Schmidtke <sjakub@gmail.com>
  4. # Contributor: Henry Jensen <hjensen@connochaetos.org>
  5. # Maintainer (archarm): Kevin Mihelich <kevin@archlinuxarm.org>
  6. # Maintainer (arch32): Andreas Baumann <mail@andreasbaumann.cc>
  7. # Contributor: Erich Eckner <git@eckner.net>
  8. # Contributor: Andreas Grapentin <andreas@grapentin.org>
  9. # Contributor: Luke Shumaker <lukeshu@parabola.nu>
  10. # Contributor: André Silva <emulatorman@hyperbola.info>
  11. # Contributor: Márcio Silva <coadde@hyperbola.info>
  12. # Contributor: fauno <fauno@kiwwwi.com.ar>
  13. # Contributor: vando <facundo@esdebian.org>
  14. # Contributor: Figue <ffigue at gmail>
  15. # Contributor: evr <evanroman at gmail>
  16. # Contributor: Muhammad 'MJ' Jassim <UnbreakableMJ@gmail.com>
  17. # Contributor: taro-k <taro-k@movasense_com>
  18. # Contributor: Michał Masłowski <mtjm@mtjm.eu>
  19. # Contributor: Luke R. <g4jc@openmailbox.org>
  20. # Contributor: Isaac David <isacdaavid@isacdaavid.info>
  21. # Contributor: bill-auger <bill-auger@programmer.net>
  22. # Contributor: grizzlyuser <grizzlyuser@protonmail.com>
  23. # parabola changes and rationale
  24. # FSDG:
  25. # - Modify the addons pages to use GNU IceCat plugins sources, rather
  26. # than addons.mozilla.org, which hosts non-free addons
  27. # - Disable EME, which is implemented via the non-free libWideVine CDM
  28. # - Disable Normandy that let Mozilla push messages with recommendations
  29. # of nonfree software
  30. # - Make Remote Settings work completely offline using local data
  31. # - Rebrand to Iceweasel, per the mozilla trademark policy,
  32. # due to these FSDG changes
  33. #
  34. # technical:
  35. # - build i686 with GCC instead of clang
  36. # - disable rust-SIMD, LTO, PGO, and skip profiling build for armv7h and i686
  37. # - allow skipping profiling build for x86_64 (_x86_64_skip_pgo)
  38. # - prefer as many system libs as possible, over their vendored couterparts
  39. #
  40. # privacy:
  41. # - Remove Google API keys and usage
  42. # - Disable Mozilla telemetry and crash reporting (good manners
  43. # because of all of the other patching we're doing)
  44. pkgname=iceweasel
  45. epoch=1
  46. pkgver=90.0
  47. pkgrel=1
  48. pkgrel+=.parabola1
  49. _brandingver=87.0-1
  50. pkgdesc="Standalone web browser derived from Mozilla Firefox"
  51. arch=(x86_64)
  52. arch+=(i686 armv7h)
  53. license=(MPL GPL LGPL)
  54. url="https://wiki.parabola.nu/Iceweasel"
  55. depends=(gtk3 libxt mime-types dbus-glib ffmpeg nss ttf-font libpulse)
  56. makedepends=(unzip zip diffutils yasm mesa imake inetutils xorg-server-xvfb
  57. autoconf2.13 rust clang llvm jack nodejs cbindgen nasm
  58. python-setuptools python-psutil python-zstandard lld dump_syms)
  59. makedepends+=(quilt libxslt imagemagick git jq python-jsonschema)
  60. if [[ "${CARCH}" == 'i686' ]]
  61. then makedepends=(${makedepends[*]/llvm/llvm10}) # FIXME: i686 configure fails with LLVM11
  62. makedepends=(${makedepends[*]/clang/clang10}) # rustup: error while loading shared libraries: libLLVM-10.so
  63. # makedepends=(${makedepends[*]/rust/rust=1:1.49.0})
  64. # makedepends=(${makedepends[*]/gcc/gcc10})
  65. fi
  66. optdepends=('networkmanager: Location detection via available WiFi networks'
  67. 'libnotify: Notification integration'
  68. 'pulseaudio: Audio support'
  69. 'speech-dispatcher: Text-to-Speech'
  70. 'hunspell-en_US: Spell checking, American English'
  71. 'xdg-desktop-portal: Screensharing with Wayland')
  72. replaces=('firefox')
  73. options=(!emptydirs !makeflags !strip)
  74. source=(https://archive.mozilla.org/pub/firefox/releases/${pkgver}/source/firefox-${pkgver}.source.tar.xz{,.asc}
  75. 0001-Use-remoting-name-for-GDK-application-names.patch
  76. $pkgname.desktop)
  77. source+=(https://repo.parabola.nu/other/iceweasel/${pkgname}_${_brandingver}.branding.tar.xz{,.sig}
  78. 9001-always-sync-remote-settings-with-local-dump.patch
  79. 9002-preference-defaults.patch
  80. 9003-misc-libre.patch
  81. process-json-files.py
  82. vendor.js.in)
  83. source_armv7h=(arm.patch
  84. build-arm-libopus.patch)
  85. source_i686=('avoid-libxul-OOM-python-check.patch'
  86. 'rust-static-disable-network-test-on-static-libraries.patch')
  87. sha256sums=('43a943e7d7660c6d7f5b41c95b344b7fd6a4a88ad0bb45dbd844b372ea60d58b'
  88. 'SKIP'
  89. '7e7435e8171426e87a84cecf9eb017cb969c9c85d973feb78c1e05771972b6e9'
  90. '9cdc2602661717712092d28bb494e5b48e518cb930898aca85eaf21f91f7ef58')
  91. sha256sums+=('e0a0c7434a057dffdce49bb3e5f53fa190aef24f2666cdc50262170df8fec94f'
  92. 'SKIP'
  93. '798d5d167ff4c8030aebd9dbc931df80c34f08a6aed718b878b064e47e4b4f16'
  94. 'f6114bfe02716442658874e80e553d1cd5fadf4626b461fb94cfb2623cd34b7b'
  95. '39e3a5e1ad137e21f842a44d7e3bd24050292d2b41fe59b4e7c7dfed52a195dd'
  96. '90e710662f06c619de8752b088ce56bf3779f24168387b1c18e733391bedd143'
  97. '4e4ef3f5643da6a23b05de9266c1b2c5310483638b23670944374e12aa446a35')
  98. sha256sums_i686=('2f0c81a38c4578f68f5456b618fe84a78974072821488173eb55e0e72287e353'
  99. '10c5276eab2e87f400a6ec15d7ffbef3b0407ee888dea36f1128927ca55b9041')
  100. sha256sums_armv7h=('bc00516032330760444939c516a60c78f868631e1b37f075f0fe71a53737b966'
  101. '2d4d91f7e35d0860225084e37ec320ca6cae669f6c9c8fe7735cdbd542e3a7c9')
  102. validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases <release@mozilla.com>
  103. validpgpkeys+=('BFA8008A8265677063B11BF47171986E4B745536') # Andreas Grapentin
  104. validpgpkeys+=('3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40') # bill-auger
  105. # PGO requires networking
  106. _should_skip_pgo_armv7h=1 # disable for armv7h - always
  107. _should_skip_pgo_i686=1 # disable for i686 - always
  108. _should_skip_pgo_x86_64=0 # disable for x86_64 - libremakepkg
  109. eval "_should_skip_pgo=\$_should_skip_pgo_${CARCH}"
  110. _check_build_config() {
  111. pushd "$srcdir/firefox-${pkgver%_*}" > /dev/null
  112. echo "Checking build configuration..."
  113. # Configure produces mozinfo.json that reflects current configuration.
  114. # See build/docs/mozinfo.rst
  115. ./mach configure
  116. # In this test, jq collects values of the following keys of mozinfo.json into array,
  117. # and checks if any of them are not equal to false, in which case it returns "true".
  118. # E.g. if the value of any key is true or null (in case the key is missing from mozinfo.json),
  119. # that means the build configuration has to be reworked.
  120. local obj_directory=$(./mach environment | sed -En '/object directory:/{n;s/^\s+//;p;}')
  121. local antifeature_keys=(.crashreporter .datareporting .healthreport .normandy .telemetry .updater)
  122. local antifeatures=()
  123. echo "obj_directory is: ${obj_directory}"
  124. for key in ${antifeature_keys[@]}
  125. do jq -e "${key} != false" "${obj_directory}"/mozinfo.json && antifeatures+=(${key})
  126. done
  127. if (( ${#antifeatures[@]} ))
  128. then echo "Some anti-features are not disabled in build configuration files, aborting:"
  129. for key in ${antifeatures[@]} ; do echo " - ${key} is enabled" ; done ;
  130. return 1
  131. fi
  132. popd > /dev/null
  133. }
  134. prepare() {
  135. mkdir mozbuild
  136. cd firefox-$pkgver
  137. # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
  138. patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch
  139. cat >../mozconfig <<END
  140. ac_add_options --enable-application=browser
  141. mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
  142. ac_add_options --prefix=/usr
  143. ac_add_options --enable-release
  144. ac_add_options --enable-hardening
  145. ac_add_options --enable-optimize
  146. ac_add_options --enable-rust-simd
  147. ac_add_options --enable-linker=lld
  148. ac_add_options --disable-elf-hack
  149. ac_add_options --disable-bootstrap
  150. # Branding
  151. ac_add_options --disable-official-branding
  152. ac_add_options --with-branding=browser/branding/iceweasel
  153. ac_add_options --enable-update-channel=release
  154. ac_add_options --with-distribution-id=nu.parabola
  155. ac_add_options --with-unsigned-addon-scopes=app,system
  156. ac_add_options --allow-addon-sideload
  157. export MOZ_APP_NAME=$pkgname
  158. export MOZ_APP_REMOTINGNAME=${pkgname}
  159. export MOZ_TELEMETRY_REPORTING=
  160. export MOZ_REQUIRE_SIGNING=
  161. # System libraries
  162. ac_add_options --with-system-nspr
  163. ac_add_options --with-system-nss
  164. # Features
  165. ac_add_options --enable-alsa
  166. ac_add_options --enable-jack
  167. ac_add_options --disable-crashreporter
  168. ac_add_options --disable-updater
  169. ac_add_options --disable-tests
  170. ac_add_options --disable-eme
  171. END
  172. ## [ARCH-SPECIFIC CONFIG] ##
  173. case ${CARCH} in
  174. armv7h)
  175. sed -i '
  176. /--enable-hardening/d
  177. /--enable-optimize/d
  178. /--enable-rust-simd/d
  179. ' ../mozconfig
  180. cat >>../mozconfig <<END
  181. export CC=clang
  182. export CXX=clang++
  183. ac_add_options --disable-webrtc
  184. ac_add_options --disable-elf-hack
  185. # https://bugzilla.redhat.com/show_bug.cgi?id=1641623
  186. ac_add_options --disable-av1
  187. ac_add_options --enable-optimize="-g0 -O2"
  188. mk_add_options MOZ_MAKE_FLAGS='-j2'
  189. END
  190. # mozbuild.configure.options.InvalidOptionError: --disable-eme is not available in this configuration
  191. # EME is disabled anyway in the built package, but better check if it exists for ARM each new release.
  192. sed -i 's|ac_add_options --disable-eme||' ../mozconfig
  193. echo "applying arm.patch"
  194. patch -p1 -i ../arm.patch
  195. echo "applying build-arm-libopus.patch"
  196. patch -p1 -i ../build-arm-libopus.patch
  197. ;;
  198. i686)
  199. # disable LTO and use gcc toolchain (clang has issues on IA32)
  200. # disable SIMD (SSE2 for i686)
  201. export MOZ_SOURCE_CHANGESET="DEVEDITION_${pkgver//./_}_RELEASE"
  202. cat >>../mozconfig <<END
  203. ac_add_options --disable-linker=lld
  204. ac_add_options --enable-linker=bfd
  205. ac_add_options --disable-lto
  206. ac_add_options --disable-rust-simd
  207. export CC=gcc
  208. export CXX=g++
  209. export AR=gcc-ar
  210. export NM=gcc-nm
  211. export RANLIB=gcc-ranlib
  212. END
  213. # readelf: Error: Unable to seek to 0x801db328 for section headers
  214. echo "applying avoid-libxul-OOM-python-check.patch"
  215. patch -p1 -i ../avoid-libxul-OOM-python-check.patch
  216. # test failure in rust code (complaining about network functions) when PGO is used,
  217. # see https://bugzilla.mozilla.org/show_bug.cgi?id=1565757
  218. echo "applying rust-static-disable-network-test-on-static-libraries.patch"
  219. patch -p1 -i ../rust-static-disable-network-test-on-static-libraries.patch
  220. ;;
  221. x86_64)
  222. ;;
  223. *) echo "no [ARCH-SPECIFIC CONFIG] for arch: ${CARCH}" ; return 1 ;
  224. ;;
  225. esac
  226. ## branding ##
  227. echo "applying parabola branding"
  228. local brandingsrcdir="${srcdir}"/${pkgname}-${_brandingver/-*}
  229. local brandingdestdir=browser/branding/${pkgname}
  230. rm -rf -- ${brandingdestdir}
  231. cp -aT -- ${brandingsrcdir}/branding ${brandingdestdir}
  232. cp "${brandingdestdir}"/iceweasel_logo.svg "${brandingdestdir}"/content/aboutlogins.svg
  233. cp "${brandingdestdir}"/iceweasel_logo.svg "${brandingdestdir}"/content/about-logo.svg
  234. # produce icons
  235. for i in 16 22 24 32 48 64 128 192 256 384; do
  236. rsvg-convert -w ${i} -h ${i} "${brandingsrcdir}"/branding/${pkgname}_icon.svg \
  237. -o "${brandingdestdir}"/default${i}.png
  238. done
  239. # custom new tab page
  240. # FIXME: the newtab page (aka "Start Page") has changed significantly
  241. # the new upstream start page ('activity-streams') is an add-on now
  242. # it must be forked and customized externally, then copied into the browser tree
  243. # see: the branding-dev-build/ dir on the '68.0' branch of the branding git repo
  244. # some of the branding components above and commented out below may no longer be used
  245. # the following section aims to restore something similar
  246. # to the previous parabola-branded "start page"
  247. # once it is working well, all of these comments should be removed
  248. # and any unused branding components may be deleted from the branding package
  249. # Put "Start Page" branding images in the source code
  250. #install -m644 -t browser/base/content/abouthome -- \
  251. # "${brandingsrcdir}/branding"/{drm-free,gnu_headshadow,parabola-banner}.png
  252. #install -m644 -t browser/extensions/onboarding/content/img -- \
  253. # "${brandingsrcdir}/branding/watermark.svg"
  254. # process default Top Sites and their icons
  255. local tippytopdir=browser/components/newtab/data/content/tippytop
  256. find ${tippytopdir} -type f \
  257. -not -name 'wikipedia-org*' \
  258. -not -name 'top_sites.json' \
  259. -exec rm -v {} \;
  260. for image in "${brandingsrcdir}"/tippytop/*.svg; do
  261. local outname=$(basename -s .svg "${image}")
  262. local size=$(identify -format '%wx%h' ${tippytopdir}/images/wikipedia-org@2x.png)
  263. local background=$( [[ "${outname}" == 'gnu' ]] && echo 'white' || echo 'none' )
  264. magick -density 300 ${image} \
  265. -gravity center -resize ${size} -extent ${size} \
  266. "${tippytopdir}/images/${outname}@2x.png"
  267. size=256x256
  268. magick -density 300 -background ${background} ${image} \
  269. -gravity center -resize ${size} -extent ${size} \
  270. -define icon:auto-resize=64,48,32,16 \
  271. "${tippytopdir}/favicons/${outname}.ico"
  272. done
  273. # apply branding patches
  274. export QUILT_PATCHES="${brandingsrcdir}"/patches
  275. export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
  276. export QUILT_DIFF_ARGS='--no-timestamps'
  277. export QUILT_PC="${srcdir}"/.pc
  278. quilt push -av
  279. ## searchengines ##
  280. pushd browser/components/search/extensions
  281. # Patch search-engines configs
  282. sed -i 's|https://duckduckgo.com/|https://html.duckduckgo.com/html/|' ddg/manifest.json
  283. # Removing URL parameters that let DuckDuckGo know the place in UI
  284. # the search was ran from (like address bar, context menu, etc.)
  285. local jq_cmd='del(.chrome_settings_overrides.search_provider.params)'
  286. jq "${jq_cmd}" ddg/manifest.json > manifest.json.tmp
  287. ! diff manifest.json.tmp ddg/manifest.json > /dev/null
  288. mv manifest.json.tmp ddg/manifest.json
  289. # Delete unused search engine configs
  290. find -mindepth 1 -maxdepth 1 \
  291. -not -name ddg \
  292. -not -name wikipedia \
  293. -exec rm -frv {} \;
  294. popd
  295. ## libre patching ##
  296. # Upstream tarball can contain some ignored cruft,
  297. # including binaries (for example, python3).
  298. echo 'Removing files specified in .gitignore...'
  299. git init && git clean -dfX \
  300. -e '!ipc/chromium/src/third_party/libevent/evconfig-private.h' \
  301. -e '!toolkit/crashreporter/google-breakpad/src/third_party/lss/' \
  302. -e '!third_party/python/**/*.egg-info/'
  303. rm -rf .git
  304. # Remove test-related networking dumps, because they contain code from
  305. # some Amazon webpage with no clear licensing, thus nonfree.
  306. # Also they interfere with checking of Remote Settings patching done later,
  307. # because communication with RS server has been captured in them too.
  308. rm python/mozperftest/mozperftest/system/example.zip
  309. rm testing/mozbase/mozproxy/tests/files/mitm5-linux-firefox-amazon.zip
  310. # Disable/neutralize Remote Settings (as best we can)
  311. echo "applying 9001-always-sync-remote-settings-with-local-dump.patch"
  312. patch -Np1 --no-backup-if-mismatch -i ../9001-always-sync-remote-settings-with-local-dump.patch
  313. # Verify Remote Settings patching
  314. local settings_server='firefox.settings.services.mozilla.com'
  315. ! grep -qr $settings_server || { echo 'Remote Settings patching needs rework'; return 1; }
  316. # Disable various components at the source level
  317. sed -i 's/;1/;0/' toolkit/components/telemetry/components.conf
  318. sed -Ei 's/((MOZ_SERVICES_HEALTHREPORT|MOZ_NORMANDY).+)True/\1False/' browser/moz.configure
  319. #sed -i 's/;1/;0/' browser/experiments/Experiments.manifest
  320. #sed -i '/pocket/d' browser/extensions/moz.build
  321. #sed -i '/activity-stream/d' browser/extensions/moz.build
  322. python ../process-json-files.py "${srcdir}"/firefox-${pkgver} "${brandingsrcdir}"
  323. echo "applying 9002-preference-defaults.patch"
  324. patch -Np1 --no-backup-if-mismatch -i "${srcdir}"/9002-preference-defaults.patch
  325. # Remove remaining non-free bits
  326. echo "applying 9003-misc-libre.patch"
  327. patch -Np1 --no-backup-if-mismatch -i "${srcdir}"/9003-misc-libre.patch
  328. }
  329. build() {
  330. cd firefox-$pkgver
  331. ## build env ##
  332. export MOZ_NOSPAM=1
  333. export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
  334. export MACH_USE_SYSTEM_PYTHON=1
  335. # LTO needs more open files
  336. ulimit -n 4096
  337. # clang-{9,10,11} -> error: unknown argument: '-fvar-tracking-assignments'
  338. CFLAGS="${CFLAGS/-fvar-tracking-assignments/}"
  339. CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}"
  340. ## [ARCH-SPECIFIC BUILD ENV] ##
  341. case ${CARCH} in
  342. armv7h)
  343. export MOZ_DEBUG_FLAGS=" "
  344. export CFLAGS+=" -g0"
  345. export CXXFLAGS+=" -g0"
  346. export LDFLAGS+=" -Wl,--no-keep-memory"
  347. export RUSTFLAGS="-Cdebuginfo=0"
  348. ;;
  349. i686)
  350. # -fno-plt with cross-LTO -> LLVM ERROR: Function Import: link error
  351. CFLAGS="${CFLAGS/-fno-plt/}"
  352. CXXFLAGS="${CXXFLAGS/-fno-plt/}"
  353. # disable LTO (clang has issues on IA32)
  354. export RUSTFLAGS+=" -Cdebuginfo=0 -Clto=off"
  355. export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
  356. # libvpx has some hard-coded compiler flags for MMX, SSE, SSE2, use the correct one
  357. # per CARCH (75.0 uses an intrisic _mm_empty now, which required the corresponding
  358. # architecture flag to be preset - before it was merely embedding some assembly
  359. # code with EMMS
  360. export CFLAGS+=" -mmmx"
  361. export CXXFLAGS+=" -mmmx"
  362. ;;
  363. x86_64)
  364. ;;
  365. *) echo "no [ARCH-SPECIFIC BUILD ENV] for arch: ${CARCH}" ; return 1 ;
  366. ;;
  367. esac
  368. export CFLAGS
  369. export CXXFLAGS
  370. ## [ARCH-SPECIFIC BUILD CONFIG] ##
  371. case ${CARCH} in
  372. armv7h)
  373. ;;
  374. i686)
  375. # avoid excessive debug symbols in rust leading to out-of-memory situations
  376. sed -i "s/debug_info = '\''2'\''/debug_info = '\''0'\''/" build/moz.configure/toolchain.configure
  377. ;;
  378. x86_64)
  379. ;;
  380. *) echo "no [ARCH-SPECIFIC BUILD CONFIG] for arch: ${CARCH}" ; return 1 ;
  381. ;;
  382. esac
  383. ## PGO build ##
  384. if (( $_should_skip_pgo ))
  385. then
  386. # skipping "3-tier PGO" "instrumented browser", to avoid OOM problems;
  387. # so we have the final .mozconfig now
  388. cp ../mozconfig .mozconfig
  389. else
  390. # Do 3-tier PGO
  391. echo "Building instrumented browser..."
  392. cat >.mozconfig ../mozconfig - <<END
  393. ac_add_options --enable-profile-generate=cross
  394. END
  395. _check_build_config
  396. ./mach build
  397. echo "Profiling instrumented browser..."
  398. ./mach package
  399. LLVM_PROFDATA=llvm-profdata \
  400. JARLOG_FILE="$PWD/jarlog" \
  401. xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
  402. ./mach python build/pgo/profileserver.py
  403. if [[ ! -s merged.profdata ]]; then
  404. echo "No profile data produced."
  405. return 1
  406. fi
  407. if [[ ! -s jarlog ]]; then
  408. echo "No jar log produced."
  409. return 1
  410. fi
  411. echo "Removing instrumented browser..."
  412. ./mach clobber
  413. cat >.mozconfig ../mozconfig - <<END
  414. ac_add_options --enable-lto=cross
  415. ac_add_options --enable-profile-use=cross
  416. ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
  417. ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog
  418. END
  419. fi # $_should_skip_pgo
  420. ## sanity checks ##
  421. # each of the [ARCH-SPECIFIC BUILD CONFIG] branches above should have created .mozconfig
  422. [[ ! -f .mozconfig ]] && echo ".mozconfig file not found in source root" && return 1
  423. _check_build_config
  424. ## main build ##
  425. echo "Building optimized browser..."
  426. ./mach build
  427. }
  428. package() {
  429. cd firefox-$pkgver
  430. DESTDIR="$pkgdir" ./mach install
  431. local vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
  432. install -Dvm644 /dev/stdin "$vendorjs" <<END
  433. // Use LANG environment variable to choose locale
  434. pref("intl.locale.requested", "");
  435. // Use system-provided dictionaries
  436. pref("spellchecker.dictionary_path", "/usr/share/hunspell");
  437. // Disable default browser checking.
  438. pref("browser.shell.checkDefaultBrowser", false);
  439. // Don't disable extensions in the application directory
  440. pref("extensions.autoDisableScopes", 11);
  441. END
  442. # Parabola additions to vendor.js
  443. cat "${srcdir}"/vendor.js.in >> "${vendorjs}"
  444. local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  445. install -Dvm644 /dev/stdin "$distini" <<END
  446. [Global]
  447. id=parabola
  448. version=1.0
  449. about=Iceweasel for Parabola GNU/Linux-libre
  450. [Preferences]
  451. app.distributor=parabola
  452. app.distributor.channel=$pkgname
  453. app.partner.parabola=parabola
  454. END
  455. local i
  456. for i in 16 22 24 32 48 64 128 192 256 384; do
  457. install -Dvm644 browser/branding/$pkgname/default$i.png \
  458. "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
  459. done
  460. install -Dvm644 "browser/branding/$pkgname/${pkgname}_icon.svg" \
  461. "$pkgdir/usr/share/icons/hicolor/scalable/apps/$pkgname.svg"
  462. install -Dvm644 ../$pkgname.desktop \
  463. "$pkgdir/usr/share/applications/$pkgname.desktop"
  464. # Install a wrapper to avoid confusion about binary path
  465. install -Dvm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" <<END
  466. #!/bin/sh
  467. exec /usr/lib/$pkgname/$pkgname "\$@"
  468. END
  469. ## [ARCH-SPECIFIC INSTALL] ##
  470. case ${CARCH} in
  471. armv7h)
  472. ;;
  473. i686)
  474. # libxul.so cannot find it's libraries
  475. install -dm 755 "${pkgdir}"/etc/ld.so.conf.d
  476. echo "/usr/lib/${pkgname}" > "${pkgdir}"/etc/ld.so.conf.d/${pkgname}.conf
  477. ;;
  478. x86_64)
  479. ;;
  480. *) echo "no [ARCH-SPECIFIC INSTALL] for arch: ${CARCH}" ; return 1 ;
  481. ;;
  482. esac
  483. # Replace duplicate binary with wrapper
  484. # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
  485. ln -srfv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/lib/$pkgname/$pkgname-bin"
  486. # Use system certificates
  487. local nssckbi="$pkgdir/usr/lib/$pkgname/libnssckbi.so"
  488. if [[ -e $nssckbi ]]; then
  489. ln -srfv "$pkgdir/usr/lib/libnssckbi.so" "$nssckbi"
  490. fi
  491. }