PKGBUILD 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. # Maintainer (aur): Figue <ffigue at gmail>
  2. # Contributor: fauno <fauno@kiwwwi.com.ar>
  3. # Thank you very much to the older contributors:
  4. # Contributor: evr <evanroman at gmail>
  5. # Contributor: Muhammad 'MJ' Jassim <UnbreakableMJ@gmail.com>
  6. # NOTE: icecat (60.7 < V <= 78.9) are not upstream releases
  7. # upstream releases would normally have '-gnu' appended to $_upstream_ver
  8. # this build is based on gnuzilla VCS developement sources
  9. # rev: 8b54aee6bd0c39f043bbba7a654870e032a910bc
  10. # NOTE: this PKGBUILD is a temporary WIP
  11. # it is based on the AUR PKGBUILD, which also runs makeicecat at build-time
  12. # makeicecat requires an active internet connection though, so that code was removed
  13. # this was introduced hastily, because 'icu' had changed,
  14. # and the 78.9.0 parabola PKGBUILD had "sandbox violation" problems at the time
  15. # eventually, the original parabola PKGBUILD should be restored/merged with this recipe
  16. # per rev: 04c332d29f362070a883baa3eab40df4a6f701d3
  17. # TODO: this PKGBUILD has several issues:
  18. # - it is adapted only for x86_64
  19. # - it has branding issues eg: missing "topsites", serach-engines, previous parabola patching
  20. # - it has two switchable implememtations (per '_make_srcball' - both work);
  21. # but preparing the upstream source-ball requires network access,
  22. # and the source-ball is only necessary becuase gnuzilla has not published one for v78
  23. pkgname=icecat
  24. _upstream_ver=78.9.0-pre # -gnu
  25. pkgver=${_upstream_ver//-/_}
  26. pkgrel=2
  27. _commit=8b54aee6bd0c39f043bbba7a654870e032a910bc
  28. pkgdesc="The GNU web browser, based on Mozilla Firefox ESR"
  29. arch=(x86_64)
  30. url="http://www.gnu.org/software/gnuzilla/"
  31. license=('GPL' 'MPL' 'LGPL')
  32. depends=(gtk3 libxt mime-types dbus-glib ffmpeg nss ttf-font libpulse)
  33. makedepends=(m4 unzip zip diffutils python2-setuptools yasm mesa imake inetutils
  34. xorg-server-xvfb autoconf2.13 rust clang llvm jack gtk2
  35. python nodejs python2-psutil cbindgen nasm wget mercurial git lld perl-file-rename)
  36. optdepends=('networkmanager: Location detection via available WiFi networks'
  37. 'libnotify: Notification integration'
  38. 'pulseaudio: Audio support'
  39. 'speech-dispatcher: Text-to-Speech'
  40. 'hunspell-en_US: Spell checking, American English')
  41. options=(!emptydirs !makeflags !strip)
  42. _make_srcball=0
  43. if (( _make_srcball ))
  44. then
  45. source=(https://git.savannah.gnu.org/cgit/gnuzilla.git/snapshot/gnuzilla-${_commit}.tar.gz
  46. icecat.desktop icecat-safe.desktop
  47. 0001-Use-remoting-name-for-GDK-application-names.patch
  48. rust_1.48.patch.gz)
  49. sha256sums=('5b248baaa61ece3f5b8077751638a42445c196df4e7d09e6d9b28e127b482e86'
  50. 'e00dbf01803cdd36fd9e1c0c018c19bb6f97e43016ea87062e6134bdc172bc7d'
  51. '33dd309eeb99ec730c97ba844bf6ce6c7840f7d27da19c82389cdefee8c20208'
  52. 'e0eaec8ddd24bbebf4956563ebc6d7a56f8dada5835975ee4d320dd3d0c9c442'
  53. 'c7f867ccee684939c9f0a9c30ea69127077bbe43af545a03f09dfbbdc02545a9')
  54. else
  55. source=(https://repo.parabola.nu/other/${pkgname}/${pkgname}-${_upstream_ver}.tar.bz2{,.sig}
  56. icecat.desktop icecat-safe.desktop
  57. 0001-Use-remoting-name-for-GDK-application-names.patch
  58. rust_1.48.patch.gz)
  59. sha256sums=('6f777cbea1066ba10db64967d55b9204e14bbea9a7836c4bf7e7a1e642f97716'
  60. 'SKIP'
  61. 'e00dbf01803cdd36fd9e1c0c018c19bb6f97e43016ea87062e6134bdc172bc7d'
  62. '33dd309eeb99ec730c97ba844bf6ce6c7840f7d27da19c82389cdefee8c20208'
  63. 'e0eaec8ddd24bbebf4956563ebc6d7a56f8dada5835975ee4d320dd3d0c9c442'
  64. 'c7f867ccee684939c9f0a9c30ea69127077bbe43af545a03f09dfbbdc02545a9')
  65. validpgpkeys=('3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40') # bill-auger
  66. fi
  67. _make_icecat() {
  68. cd "${srcdir}"/gnuzilla-${_commit}
  69. # Uncomment if you have issues with gpg download... WITH PROXY gpg doesn't work!!!!!!
  70. #sed -e 's/^verify_sources$//g' -i makeicecat
  71. mkdir output || rm -rf output/* # Clean output just in case is already an old build there
  72. if [ -f "${SRCDEST}/firefox-${pkgver}esr.source.tar.xz" ] && [ -f "${SRCDEST}/firefox-${pkgver}esr.source.tar.xz.asc" ]; then cp -f "${SRCDEST}"/firefox-${pkgver}esr.source.tar.xz{,.asc} output/ ; fi
  73. # Patches to avoid download sources if you have in your $startdir
  74. sed -e '/rm -rf output/d' -i makeicecat
  75. sed -e 's/wget -N/wget -nv -Nc/g' -i makeicecat
  76. # Other patches
  77. sed '/^finalize_sourceball$/d' -i makeicecat
  78. # If we want to avoid all locales, we can use variable _SPEED=y to build it with only 1 locale. Use variable _LOCALE to define it
  79. if [[ $_SPEED =~ [y|Y] ]]; then
  80. msg2 "Building without all locales..."
  81. sed -e 's/DEVEL=0/DEVEL=1/g' -i makeicecat
  82. # Also you can choose your locale using external variable _LOCALE. By default in upstream script this locale is es-ES
  83. [ -z "$_LOCALE" ] || sed -e "s/es-ES/$_LOCALE/g" -i makeicecat && echo "$_LOCALE" > custom-shipped-locales
  84. rm -rf data/files-to-append/l10n/*
  85. fi
  86. # Produce IceCat sources
  87. bash makeicecat
  88. }
  89. prepare() {
  90. if (( _make_srcball ))
  91. then
  92. make_icecat
  93. cd gnuzilla-${_commit}/output/icecat-${pkgver}
  94. else
  95. cd "${srcdir}"/$pkgname-${pkgver%_*}/
  96. fi
  97. # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
  98. patch -Np1 -i "${srcdir}"/0001-Use-remoting-name-for-GDK-application-names.patch
  99. # https://bugzilla.mozilla.org/show_bug.cgi?id=1667736
  100. patch -Np1 -i "${srcdir}"/rust_1.48.patch
  101. # Patch to move files directly to /usr/lib/icecat. No more symlinks.
  102. sed -e 's;$(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION);$(libdir)/$(MOZ_APP_NAME);g' -i config/baseconfig.mk
  103. sed -e 's;$(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION);$(libdir)/$(MOZ_APP_NAME)-devel;g' -i config/baseconfig.mk
  104. printf '%b' " \e[1;36m->\e[0m\033[1m Starting build...\n"
  105. cat >./mozconfig <<END
  106. ac_add_options --enable-application=browser
  107. ac_add_options --prefix=/usr
  108. ac_add_options --enable-release
  109. ac_add_options --enable-hardening
  110. ac_add_options --enable-optimize
  111. ac_add_options --enable-rust-simd
  112. ac_add_options --enable-linker=lld
  113. ac_add_options --disable-elf-hack
  114. export CC='clang --target=x86_64-unknown-linux-gnu'
  115. export CXX='clang++ --target=x86_64-unknown-linux-gnu'
  116. export AR=llvm-ar
  117. export NM=llvm-nm
  118. export RANLIB=llvm-ranlib
  119. # Branding
  120. ac_add_options --enable-official-branding
  121. ac_add_options --with-distribution-id=nu.parabola
  122. ac_add_options --with-unsigned-addon-scopes=app,system
  123. # System libraries
  124. ac_add_options --with-system-nspr
  125. ac_add_options --with-system-nss
  126. # Features
  127. ac_add_options --enable-alsa
  128. ac_add_options --enable-jack
  129. ac_add_options --disable-crashreporter
  130. ac_add_options --disable-updater
  131. ac_add_options --disable-tests
  132. ac_add_options --disable-eme
  133. ac_add_options --with-app-basename=icecat
  134. ac_add_options --with-app-name=icecat
  135. END
  136. }
  137. build() {
  138. if (( _make_srcball ))
  139. then
  140. cd gnuzilla-${_commit}/output/icecat-${pkgver}
  141. else
  142. cd "${srcdir}"/$pkgname-${pkgver%_*}/
  143. fi
  144. export MOZ_NOSPAM=1
  145. export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
  146. export MACH_USE_SYSTEM_PYTHON=1
  147. # LTO needs more open files
  148. ulimit -n 4096
  149. # clang-{9,10,11} -> error: unknown argument: '-fvar-tracking-assignments'
  150. CFLAGS="${CFLAGS/-fvar-tracking-assignments/}"
  151. CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}"
  152. # -fno-plt with cross-LTO causes obscure LLVM errors
  153. # LLVM ERROR: Function Import: link error
  154. CFLAGS="${CFLAGS/-fno-plt/}"
  155. CXXFLAGS="${CXXFLAGS/-fno-plt/}"
  156. ./mach build
  157. #./mach buildsymbols
  158. }
  159. package () {
  160. if (( _make_srcball ))
  161. then
  162. cd gnuzilla-${_commit}/output/icecat-${pkgver}
  163. else
  164. cd "${srcdir}"/$pkgname-${pkgver%_*}/
  165. fi
  166. # Remove cose.manifest and cose.sig cause march install fails
  167. find obj-x86_64-pc-linux-gnu/dist/bin/browser/extensions -name cose.manifest -delete
  168. find obj-x86_64-pc-linux-gnu/dist/bin/browser/extensions -name cose.sig -delete
  169. DESTDIR="$pkgdir" ./mach install
  170. local _vendorjs="$pkgdir/usr/lib/${pkgname}/browser/defaults/preferences/vendor.js"
  171. install -Dvm644 /dev/stdin "$_vendorjs" <<END
  172. // Use LANG environment variable to choose locale
  173. pref("intl.locale.requested", "");
  174. // Disable default browser checking.
  175. pref("browser.shell.checkDefaultBrowser", false);
  176. // Opt all of us into e10s, instead of just 50%
  177. pref("browser.tabs.remote.autostart", true);
  178. END
  179. local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  180. install -Dvm644 /dev/stdin "$distini" <<END
  181. [Global]
  182. id=parabola
  183. version=1.0
  184. about=Icecat for Parabola GNU/Linux-libre
  185. [Preferences]
  186. app.distributor=parabola
  187. app.distributor.channel=$pkgname
  188. app.partner.parabola=parabola
  189. END
  190. printf '%b' " \e[1;36m->\e[0m\033[1m Finishing...\n"
  191. install -m755 -d ${pkgdir}/usr/share/applications
  192. install -m755 -d ${pkgdir}/usr/share/pixmaps
  193. for i in 16 32 48; do
  194. install -Dm644 browser/branding/official/default${i}.png \
  195. "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/icecat.png"
  196. done
  197. install -Dm644 browser/branding/official/default48.png ${pkgdir}/usr/share/pixmaps/icecat.png
  198. install -Dm644 ${srcdir}/icecat.desktop ${pkgdir}/usr/share/applications/
  199. install -Dm644 ${srcdir}/icecat-safe.desktop ${pkgdir}/usr/share/applications/
  200. }