PKGBUILD 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. # Maintainer: Seppia <seppia@seppio.fish>
  2. # Contributors: Eloston
  3. # Derived from official Chromium and Inox PKGBUILDS and ungoogled-chromium buildkit
  4. pkgname=ungoogled-chromium
  5. pkgver=81.0.4044.138
  6. _rev=1
  7. _archver=7356fdd4d45890afa748888fd3533c3f5e49b08e
  8. pkgrel=${_rev}
  9. _launcher_ver=6
  10. pkgdesc="A lightweight approach to removing Google web service dependency"
  11. arch=('x86_64')
  12. url="https://github.com/Eloston/ungoogled-chromium"
  13. license=('BSD')
  14. depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
  15. 'ttf-font' 'systemd' 'dbus' 'libpulse' 'pciutils' 'json-glib' 'libva'
  16. 'desktop-file-utils' 'hicolor-icon-theme' 'jsoncpp' 'openjpeg2')
  17. makedepends=('python' 'python2' 'gperf' 'yasm' 'mesa' 'ninja' 'nodejs' 'git'
  18. 'clang' 'lld' 'gn' 'llvm' 'quilt')
  19. optdepends=('pepper-flash: support for Flash content'
  20. 'kdialog: needed for file dialogs in KDE'
  21. 'gnome-keyring: for storing passwords in GNOME keyring'
  22. 'kwallet: for storing passwords in KWallet'
  23. 'libva-intel-driver: for hardware video acceleration with Intel GPUs'
  24. 'libva-mesa-driver: for hardware video acceleration with AMD/ATI GPUs'
  25. 'libva-vdpau-driver: for hardware video acceleration with NVIDIA GPUs')
  26. provides=('chromium')
  27. conflicts=('chromium')
  28. source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
  29. chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
  30. https://github.com/Eloston/ungoogled-chromium/archive/$pkgver-$pkgrel.tar.gz
  31. https://github.com/ungoogled-software/ungoogled-chromium-archlinux/archive/${_archver}.tar.gz)
  32. sha256sums=('f478f28b8111cb70231df4c36e754d812ad7a94b7c844e9d0515345a71fd77a6'
  33. '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
  34. 'a01a35454dcd3c789e4e536751ecd655959b544b56ffd241a7942d9912749da1'
  35. 'b8d6a63fc93e010276ca039c4141b1a05029841b3e218afaf9462645470e407e')
  36. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  37. # Keys are the names in the above script; values are the dependencies in Arch
  38. declare -gA _system_libs=(
  39. [ffmpeg]=ffmpeg
  40. [flac]=flac
  41. [fontconfig]=fontconfig
  42. [freetype]=freetype2
  43. [harfbuzz-ng]=harfbuzz
  44. [icu]=icu
  45. [libdrm]=
  46. [libevent]=libevent
  47. [libjpeg]=libjpeg
  48. #[libpng]=libpng # https://crbug.com/752403#c10
  49. [libvpx]=libvpx
  50. [libwebp]=libwebp
  51. [libxml]=libxml2
  52. [libxslt]=libxslt
  53. [opus]=opus
  54. [re2]=re2
  55. [snappy]=snappy
  56. [yasm]=
  57. [zlib]=minizip
  58. )
  59. _unwanted_bundled_libs=(
  60. ${!_system_libs[@]}
  61. ${_system_libs[libjpeg]+libjpeg_turbo}
  62. )
  63. depends+=(${_system_libs[@]})
  64. prepare() {
  65. _ungoogled_archlinux_repo="$srcdir/$pkgname-archlinux-${_archver}"
  66. _ungoogled_repo="$srcdir/$pkgname-$pkgver-$pkgrel"
  67. _utils="${_ungoogled_repo}/utils"
  68. cd "$srcdir/chromium-$pkgver"
  69. msg2 'Pruning binaries'
  70. python "$_utils/prune_binaries.py" ./ "$_ungoogled_repo/pruning.list"
  71. msg2 'Applying patches'
  72. python "$_utils/patches.py" apply ./ "$_ungoogled_repo/patches" "$_ungoogled_archlinux_repo/patches"
  73. msg2 'Applying domain substitution'
  74. python "$_utils/domain_substitution.py" apply -r "$_ungoogled_repo/domain_regex.list" -f "$_ungoogled_repo/domain_substitution.list" -c domainsubcache.tar.gz ./
  75. # Force script incompatible with Python 3 to use /usr/bin/python2
  76. sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py
  77. mkdir -p third_party/node/linux/node-linux-x64/bin
  78. ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
  79. # Remove bundled libraries for which we will use the system copies; this
  80. # *should* do what the remove_bundled_libraries.py script does, with the
  81. # added benefit of not having to list all the remaining libraries
  82. local _lib
  83. for _lib in ${_unwanted_bundled_libs[@]}; do
  84. find -type f -path "*third_party/$_lib/*" \
  85. \! -path "*third_party/$_lib/chromium/*" \
  86. \! -path "*third_party/$_lib/google/*" \
  87. \! -path './base/third_party/icu/*' \
  88. \! -path './third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h' \
  89. \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
  90. \! -path './third_party/yasm/run_yasm.py' \
  91. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  92. -delete
  93. done
  94. python2 build/linux/unbundle/replace_gn_files.py \
  95. --system-libraries "${!_system_libs[@]}"
  96. }
  97. build() {
  98. _ungoogled_archlinux_repo="$srcdir/$pkgname-archlinux-${_archver}"
  99. _ungoogled_repo="$srcdir/$pkgname-$pkgver-$pkgrel"
  100. make -C chromium-launcher-$_launcher_ver
  101. cd "$srcdir/chromium-$pkgver"
  102. if check_buildoption ccache y; then
  103. # Avoid falling back to preprocessor mode when sources contain time macros
  104. export CCACHE_SLOPPINESS=time_macros
  105. fi
  106. export CC=clang
  107. export CXX=clang++
  108. export AR=llvm-ar
  109. export NM=llvm-nm
  110. mkdir -p out/Default
  111. # Assemble GN flags
  112. cp "$_ungoogled_repo/flags.gn" "out/Default/args.gn"
  113. printf '\n' >> "out/Default/args.gn"
  114. cat "$_ungoogled_archlinux_repo/flags.archlinux.gn" >> "out/Default/args.gn"
  115. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  116. CFLAGS+=' -Wno-builtin-macro-redefined'
  117. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  118. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  119. # Do not warn about unknown warning options
  120. CFLAGS+=' -Wno-unknown-warning-option'
  121. CXXFLAGS+=' -Wno-unknown-warning-option'
  122. msg2 'Configuring Chromium'
  123. gn gen out/Default --script-executable=/usr/bin/python2 --fail-on-unused-args
  124. msg2 'Building Chromium'
  125. ninja -C out/Default chrome chrome_sandbox chromedriver
  126. }
  127. package() {
  128. cd chromium-launcher-$_launcher_ver
  129. make PREFIX=/usr DESTDIR="$pkgdir" install
  130. install -Dm644 LICENSE \
  131. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  132. cd "$srcdir/chromium-$pkgver"
  133. install -D out/Default/chrome "$pkgdir/usr/lib/chromium/chromium"
  134. install -Dm4755 out/Default/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  135. ln -s /usr/lib/${pkgname#ungoogled-}/chromedriver "$pkgdir/usr/bin/chromedriver"
  136. install -Dm644 chrome/installer/linux/common/desktop.template \
  137. "$pkgdir/usr/share/applications/chromium.desktop"
  138. install -Dm644 chrome/app/resources/manpage.1.in \
  139. "$pkgdir/usr/share/man/man1/chromium.1"
  140. sed -i \
  141. -e "s/@@MENUNAME@@/Chromium/g" \
  142. -e "s/@@PACKAGE@@/chromium/g" \
  143. -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
  144. "$pkgdir/usr/share/applications/chromium.desktop" \
  145. "$pkgdir/usr/share/man/man1/chromium.1"
  146. cp \
  147. out/Default/{chrome_{100,200}_percent,resources}.pak \
  148. out/Default/{*.bin,chromedriver} \
  149. "$pkgdir/usr/lib/chromium/"
  150. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Default/locales/*.pak
  151. if [[ -z ${_system_libs[icu]+set} ]]; then
  152. cp out/Default/icudtl.dat "$pkgdir/usr/lib/chromium/"
  153. fi
  154. for size in 24 48 64 128 256; do
  155. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  156. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  157. done
  158. for size in 16 32; do
  159. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  160. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  161. done
  162. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  163. }
  164. # vim:set ts=2 sw=2 et: