PKGBUILD 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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=80.0.3987.149
  6. _rev=1
  7. _archver=7ce267da626a5a178d60aad2c11638b62042bd23
  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=('50bedde7932921e375b521ceab8989be134a8d937751847e9d9287f7e0a02c1e'
  33. '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
  34. '309522e2c6bb615bc8dd20b96939d9f5c18830d173e26818bcdff10f2d420218'
  35. '41fd58307cc83f35dc133204b8e99a76e7e2d7711cf44893010478b0edc18aa4')
  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. sed -i '/use_system_libopenjpeg2=true/d' "out/Default/args.gn"
  116. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  117. CFLAGS+=' -Wno-builtin-macro-redefined'
  118. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  119. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  120. # Do not warn about unknown warning options
  121. CFLAGS+=' -Wno-unknown-warning-option'
  122. CXXFLAGS+=' -Wno-unknown-warning-option'
  123. msg2 'Configuring Chromium'
  124. gn gen out/Default --script-executable=/usr/bin/python2 --fail-on-unused-args
  125. msg2 'Building Chromium'
  126. ninja -C out/Default chrome chrome_sandbox chromedriver
  127. }
  128. package() {
  129. cd chromium-launcher-$_launcher_ver
  130. make PREFIX=/usr DESTDIR="$pkgdir" install
  131. install -Dm644 LICENSE \
  132. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  133. cd "$srcdir/chromium-$pkgver"
  134. install -D out/Default/chrome "$pkgdir/usr/lib/chromium/chromium"
  135. install -Dm4755 out/Default/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  136. ln -s /usr/lib/${pkgname#ungoogled-}/chromedriver "$pkgdir/usr/bin/chromedriver"
  137. install -Dm644 chrome/installer/linux/common/desktop.template \
  138. "$pkgdir/usr/share/applications/chromium.desktop"
  139. install -Dm644 chrome/app/resources/manpage.1.in \
  140. "$pkgdir/usr/share/man/man1/chromium.1"
  141. sed -i \
  142. -e "s/@@MENUNAME@@/Chromium/g" \
  143. -e "s/@@PACKAGE@@/chromium/g" \
  144. -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
  145. "$pkgdir/usr/share/applications/chromium.desktop" \
  146. "$pkgdir/usr/share/man/man1/chromium.1"
  147. cp \
  148. out/Default/{chrome_{100,200}_percent,resources}.pak \
  149. out/Default/{*.bin,chromedriver} \
  150. "$pkgdir/usr/lib/chromium/"
  151. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Default/locales/*.pak
  152. if [[ -z ${_system_libs[icu]+set} ]]; then
  153. cp out/Default/icudtl.dat "$pkgdir/usr/lib/chromium/"
  154. fi
  155. for size in 24 48 64 128 256; do
  156. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  157. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  158. done
  159. for size in 16 32; do
  160. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  161. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  162. done
  163. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  164. }
  165. # vim:set ts=2 sw=2 et: