PKGBUILD 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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=76.0.3809.87
  6. _rev=1
  7. _archver=a32f86d7e4969e5f1ed63136e6568de79d1d2a46
  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' '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=('215ca6acee7b4fd3c95fe796260af4dc5454dbba3b701aa43afeb98a06dc4194'
  33. '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
  34. 'e448af101cc559cadf7d22dd1a198ab788f96fd46f5749b25c51ff607e871fa6'
  35. 'b1d19efd9e234abab9404e66484d99736be778f8507cdb311bff68f6f4255324')
  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. # Remove bundled libraries for which we will use the system copies; this
  78. # *should* do what the remove_bundled_libraries.py script does, with the
  79. # added benefit of not having to list all the remaining libraries
  80. local _lib
  81. for _lib in ${_unwanted_bundled_libs[@]}; do
  82. find -type f -path "*third_party/$_lib/*" \
  83. \! -path "*third_party/$_lib/chromium/*" \
  84. \! -path "*third_party/$_lib/google/*" \
  85. \! -path './base/third_party/icu/*' \
  86. \! -path './third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h' \
  87. \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
  88. \! -path './third_party/yasm/run_yasm.py' \
  89. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  90. -delete
  91. done
  92. python2 build/linux/unbundle/replace_gn_files.py \
  93. --system-libraries "${!_system_libs[@]}"
  94. }
  95. build() {
  96. _ungoogled_archlinux_repo="$srcdir/$pkgname-archlinux-${_archver}"
  97. _ungoogled_repo="$srcdir/$pkgname-$pkgver-$pkgrel"
  98. make -C chromium-launcher-$_launcher_ver
  99. cd "$srcdir/chromium-$pkgver"
  100. if check_buildoption ccache y; then
  101. # Avoid falling back to preprocessor mode when sources contain time macros
  102. export CCACHE_SLOPPINESS=time_macros
  103. fi
  104. export CC=clang
  105. export CXX=clang++
  106. export AR=llvm-ar
  107. export NM=llvm-nm
  108. mkdir -p out/Default
  109. # Assemble GN flags
  110. cp "$_ungoogled_repo/flags.gn" "out/Default/args.gn"
  111. printf '\n' >> "out/Default/args.gn"
  112. cat "$_ungoogled_archlinux_repo/flags.archlinux.gn" >> "out/Default/args.gn"
  113. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  114. CFLAGS+=' -Wno-builtin-macro-redefined'
  115. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  116. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  117. msg2 'Configuring Chromium'
  118. gn gen out/Default --script-executable=/usr/bin/python2 --fail-on-unused-args
  119. msg2 'Building Chromium'
  120. ninja -C out/Default chrome chrome_sandbox chromedriver
  121. }
  122. package() {
  123. cd chromium-launcher-$_launcher_ver
  124. make PREFIX=/usr DESTDIR="$pkgdir" install
  125. install -Dm644 LICENSE \
  126. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  127. cd "$srcdir/chromium-$pkgver"
  128. install -D out/Default/chrome "$pkgdir/usr/lib/chromium/chromium"
  129. install -Dm4755 out/Default/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  130. ln -s /usr/lib/${pkgname#ungoogled-}/chromedriver "$pkgdir/usr/bin/chromedriver"
  131. install -Dm644 chrome/installer/linux/common/desktop.template \
  132. "$pkgdir/usr/share/applications/chromium.desktop"
  133. install -Dm644 chrome/app/resources/manpage.1.in \
  134. "$pkgdir/usr/share/man/man1/chromium.1"
  135. sed -i \
  136. -e "s/@@MENUNAME@@/Chromium/g" \
  137. -e "s/@@PACKAGE@@/chromium/g" \
  138. -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
  139. "$pkgdir/usr/share/applications/chromium.desktop" \
  140. "$pkgdir/usr/share/man/man1/chromium.1"
  141. cp \
  142. out/Default/{chrome_{100,200}_percent,resources}.pak \
  143. out/Default/{*.bin,chromedriver} \
  144. "$pkgdir/usr/lib/chromium/"
  145. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Default/locales/*.pak
  146. if [[ -z ${_system_libs[icu]+set} ]]; then
  147. cp out/Default/icudtl.dat "$pkgdir/usr/lib/chromium/"
  148. fi
  149. for size in 22 24 48 64 128 256; do
  150. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  151. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  152. done
  153. for size in 16 32; do
  154. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  155. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  156. done
  157. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  158. }
  159. # vim:set ts=2 sw=2 et: