PKGBUILD 6.8 KB

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