PKGBUILD 6.6 KB

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