PKGBUILD 21 KB

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