PKGBUILD 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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=83.0.4103.116
  6. pkgrel=2
  7. # sometimes an ungoogled patches can be combined with a new chromium release
  8. # only if the release only includes security fixes
  9. _ungoogled_ver=83.0.4103.116-1
  10. _launcher_ver=6
  11. pkgdesc="A lightweight approach to removing Google web service dependency"
  12. arch=('x86_64')
  13. url="https://github.com/Eloston/ungoogled-chromium"
  14. license=('BSD')
  15. depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
  16. 'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'json-glib'
  17. 'desktop-file-utils' 'hicolor-icon-theme')
  18. makedepends=('python' 'python2' 'gperf' 'yasm' 'mesa' 'ninja' 'nodejs' 'git'
  19. 'libpipewire02' 'libva' 'clang' 'lld' 'gn' 'java-runtime-headless'
  20. 'python2-setuptools')
  21. optdepends=('pepper-flash: support for Flash content'
  22. 'libpipewire02: WebRTC desktop sharing under Wayland'
  23. 'libva: hardware-accelerated video decode (experimental)'
  24. 'kdialog: needed for file dialogs in KDE'
  25. 'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
  26. 'kwallet: for storing passwords in KWallet on KDE desktops')
  27. provides=('chromium')
  28. conflicts=('chromium')
  29. install=chromium.install
  30. source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
  31. https://github.com/Eloston/ungoogled-chromium/archive/$_ungoogled_ver.tar.gz
  32. chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
  33. chromium-drirc-disable-10bpc-color-configs.conf
  34. clean-up-a-call-to-set_utf8.patch
  35. iwyu-std-numeric_limits-is-defined-in-limits.patch
  36. add-missing-algorithm-header-in-crx_install_error.cc.patch
  37. libstdc-fix-incomplete-type-in-AXTree-for-NodeSetSiz.patch
  38. include-memory-header-to-get-the-definition-of-std-u.patch
  39. make-some-of-blink-custom-iterators-STL-compatible.patch
  40. avoid-double-destruction-of-ServiceWorkerObjectHost.patch
  41. force-mp3-files-to-have-a-start-time-of-zero.patch
  42. v8-remove-soon-to-be-removed-getAllFieldPositions.patch
  43. intel-vp9-quirk.patch
  44. wayland-egl.patch
  45. nvidia-vdpau.patch
  46. chromium-83-gcc-10.patch
  47. chromium-skia-harmony.patch)
  48. sha256sums=('bb0c7e8dfee9f3a5e30eca7f34fc9f21caefa82a86c058c552f52b1ae2da2ac3'
  49. 'a8cff01fae3bc0823841c242c85746346619f684aff7968ebeb4886345395f24'
  50. '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
  51. 'babda4f5c1179825797496898d77334ac067149cac03d797ab27ac69671a7feb'
  52. '58c41713eb6fb33b6eef120f4324fa1fb8123b1fbc4ecbe5662f1f9779b9b6af'
  53. '675fb3d6276cce569a641436465f58d5709d1d4a5f62b7052989479fd4aaea24'
  54. '0e2a78e4aa7272ab0ff4a4c467750e01bad692a026ad9828aaf06d2a9418b9d8'
  55. '50687079426094f2056d1f4806dc30fc8d6bad16190520e57ba087ec5db1d778'
  56. '071326135bc25226aa165639dff80a03670a17548f2d2ff5cc4f40982b39c52a'
  57. '3d7f20e1d2ee7d73ed25e708c0d59a0cb215fcce10a379e3d48a856533c4b0b7'
  58. 'd793842e9584bf75e3779918297ba0ffa6dd05394ef5b2bf5fb73aa9c86a7e2f'
  59. 'abc3fad113408332c3b187b083bf33eba59eb5c87fa3ce859023984b5804623c'
  60. 'e042024423027ad3ef729a7e4709bdf9714aea49d64cfbbf46a645a05703abc2'
  61. '326b8ad8f1100ad11213ee916effab43dfd7b0229ee8bed2c1c8c3132866bcae'
  62. '34d08ea93cb4762cb33c7cffe931358008af32265fc720f2762f0179c3973574'
  63. '8095bf73afbca7c2b07306c5b4dd8f79b66e1053fa4e58b07f71ef938be603f1'
  64. '3e5ba8c0a70a4bc673deec0c61eb2b58f05a4c784cbdb7c8118be1eb6580db6d'
  65. '771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1')
  66. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  67. # Keys are the names in the above script; values are the dependencies in Arch
  68. declare -gA _system_libs=(
  69. [ffmpeg]=ffmpeg
  70. [flac]=flac
  71. [fontconfig]=fontconfig
  72. [freetype]=freetype2
  73. [harfbuzz-ng]=harfbuzz
  74. [icu]=icu
  75. [libdrm]=
  76. [libjpeg]=libjpeg
  77. #[libpng]=libpng # https://crbug.com/752403#c10
  78. [libvpx]=libvpx
  79. [libwebp]=libwebp
  80. [libxml]=libxml2
  81. [libxslt]=libxslt
  82. [opus]=opus
  83. [re2]=re2
  84. [snappy]=snappy
  85. [yasm]=
  86. [zlib]=minizip
  87. )
  88. _unwanted_bundled_libs=(
  89. $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
  90. )
  91. depends+=(${_system_libs[@]})
  92. prepare() {
  93. cd "$srcdir/chromium-$pkgver"
  94. # Allow building against system libraries in official builds
  95. sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
  96. tools/generate_shim_headers/generate_shim_headers.py
  97. # https://crbug.com/893950
  98. sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
  99. third_party/blink/renderer/core/xml/*.cc \
  100. third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
  101. third_party/libxml/chromium/*.cc
  102. # https://chromium-review.googlesource.com/c/chromium/src/+/2145261
  103. patch -Np1 -i ../clean-up-a-call-to-set_utf8.patch
  104. # https://chromium-review.googlesource.com/c/chromium/src/+/2153111
  105. patch -Np1 -F3 -i ../iwyu-std-numeric_limits-is-defined-in-limits.patch
  106. # https://chromium-review.googlesource.com/c/chromium/src/+/2152333
  107. patch -Np1 -i ../add-missing-algorithm-header-in-crx_install_error.cc.patch
  108. # https://chromium-review.googlesource.com/c/chromium/src/+/2132403
  109. patch -Np1 -i ../libstdc-fix-incomplete-type-in-AXTree-for-NodeSetSiz.patch
  110. # https://chromium-review.googlesource.com/c/chromium/src/+/2164645
  111. patch -Np1 -i ../include-memory-header-to-get-the-definition-of-std-u.patch
  112. # https://chromium-review.googlesource.com/c/chromium/src/+/2174199
  113. patch -Np1 -i ../make-some-of-blink-custom-iterators-STL-compatible.patch
  114. # https://chromium-review.googlesource.com/c/chromium/src/+/2094496
  115. patch -Np1 -i ../avoid-double-destruction-of-ServiceWorkerObjectHost.patch
  116. # https://chromium-review.googlesource.com/c/chromium/src/+/2268221
  117. patch -Np1 -i ../force-mp3-files-to-have-a-start-time-of-zero.patch
  118. # https://crbug.com/v8/10393
  119. patch -Np1 -d v8 <../v8-remove-soon-to-be-removed-getAllFieldPositions.patch
  120. # https://crbug.com/skia/6663#c10
  121. patch -Np0 -i ../chromium-skia-harmony.patch
  122. # Fixes from Gentoo
  123. patch -Np1 -i ../chromium-83-gcc-10.patch
  124. # Intel KabyLake/GeminiLake VP9 quirk
  125. patch -Np1 -i ../intel-vp9-quirk.patch
  126. # Wayland/EGL regression (crbug #1071528 #1071550)
  127. patch -Np1 -i ../wayland-egl.patch
  128. # NVIDIA vdpau-wrapper
  129. patch -Np1 -i ../nvidia-vdpau.patch
  130. # Ungoogled Chromium changes
  131. _ungoogled_repo="$srcdir/$pkgname-$_ungoogled_ver"
  132. _utils="${_ungoogled_repo}/utils"
  133. msg2 'Pruning binaries'
  134. python "$_utils/prune_binaries.py" ./ "$_ungoogled_repo/pruning.list"
  135. msg2 'Applying patches'
  136. python "$_utils/patches.py" apply ./ "$_ungoogled_repo/patches"
  137. msg2 'Applying domain substitution'
  138. python "$_utils/domain_substitution.py" apply -r "$_ungoogled_repo/domain_regex.list" \
  139. -f "$_ungoogled_repo/domain_substitution.list" -c domainsubcache.tar.gz ./
  140. # Force script incompatible with Python 3 to use /usr/bin/python2
  141. sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py
  142. mkdir -p third_party/node/linux/node-linux-x64/bin
  143. ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
  144. # Remove bundled libraries for which we will use the system copies; this
  145. # *should* do what the remove_bundled_libraries.py script does, with the
  146. # added benefit of not having to list all the remaining libraries
  147. local _lib
  148. for _lib in ${_unwanted_bundled_libs[@]}; do
  149. find "third_party/$_lib" -type f \
  150. \! -path "third_party/$_lib/chromium/*" \
  151. \! -path "third_party/$_lib/google/*" \
  152. \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
  153. \! -path 'third_party/yasm/run_yasm.py' \
  154. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  155. -delete
  156. done
  157. python2 build/linux/unbundle/replace_gn_files.py \
  158. --system-libraries "${!_system_libs[@]}"
  159. }
  160. build() {
  161. make -C chromium-launcher-$_launcher_ver
  162. cd "$srcdir/chromium-$pkgver"
  163. if check_buildoption ccache y; then
  164. # Avoid falling back to preprocessor mode when sources contain time macros
  165. export CCACHE_SLOPPINESS=time_macros
  166. fi
  167. export CC=clang
  168. export CXX=clang++
  169. export AR=ar
  170. export NM=nm
  171. local _flags=(
  172. 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
  173. 'host_toolchain="//build/toolchain/linux/unbundle:default"'
  174. 'is_official_build=true' # implies is_cfi=true on x86_64
  175. 'ffmpeg_branding="Chrome"'
  176. 'proprietary_codecs=true'
  177. 'rtc_use_pipewire=true'
  178. 'link_pulseaudio=true'
  179. 'use_gnome_keyring=false'
  180. 'use_sysroot=false'
  181. 'linux_use_bundled_binutils=false'
  182. 'use_custom_libcxx=false'
  183. 'use_vaapi=true'
  184. )
  185. if [[ -n ${_system_libs[icu]+set} ]]; then
  186. _flags+=('icu_use_data_file=false')
  187. fi
  188. if check_option strip y; then
  189. _flags+=('symbol_level=0')
  190. fi
  191. # Append ungoogled chromium flags to _flags array
  192. _ungoogled_repo="$srcdir/$pkgname-$_ungoogled_ver"
  193. readarray -t -O ${#_flags[@]} _flags < "${_ungoogled_repo}/flags.gn"
  194. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  195. CFLAGS+=' -Wno-builtin-macro-redefined'
  196. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  197. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  198. # Do not warn about unknown warning options
  199. CFLAGS+=' -Wno-unknown-warning-option'
  200. CXXFLAGS+=' -Wno-unknown-warning-option'
  201. msg2 'Configuring Chromium'
  202. gn gen out/Release --args="${_flags[*]}" --script-executable=/usr/bin/python2
  203. msg2 'Building Chromium'
  204. ninja -C out/Release chrome chrome_sandbox chromedriver
  205. }
  206. package() {
  207. cd chromium-launcher-$_launcher_ver
  208. make PREFIX=/usr DESTDIR="$pkgdir" install
  209. install -Dm644 LICENSE \
  210. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  211. cd "$srcdir/chromium-$pkgver"
  212. install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
  213. install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  214. ln -s /usr/lib/${pkgname#ungoogled-}/chromedriver "$pkgdir/usr/bin/chromedriver"
  215. install -Dm644 ../chromium-drirc-disable-10bpc-color-configs.conf \
  216. "$pkgdir/usr/share/drirc.d/10-$pkgname.conf"
  217. install -Dm644 chrome/installer/linux/common/desktop.template \
  218. "$pkgdir/usr/share/applications/chromium.desktop"
  219. install -Dm644 chrome/app/resources/manpage.1.in \
  220. "$pkgdir/usr/share/man/man1/chromium.1"
  221. sed -i \
  222. -e 's/@@MENUNAME@@/Chromium/g' \
  223. -e 's/@@PACKAGE@@/chromium/g' \
  224. -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium/g' \
  225. "$pkgdir/usr/share/applications/chromium.desktop" \
  226. "$pkgdir/usr/share/man/man1/chromium.1"
  227. install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \
  228. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  229. sed -ni \
  230. -e 's/chromium-browser\.desktop/chromium.desktop/' \
  231. -e '/<update_contact>/d' \
  232. -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
  233. -e '/^<?xml/,$p' \
  234. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  235. local toplevel_files=(
  236. chrome_100_percent.pak
  237. chrome_200_percent.pak
  238. resources.pak
  239. v8_context_snapshot.bin
  240. # ANGLE
  241. libEGL.so
  242. libGLESv2.so
  243. chromedriver
  244. )
  245. if [[ -z ${_system_libs[icu]+set} ]]; then
  246. toplevel_files+=(icudtl.dat)
  247. fi
  248. cp "${toplevel_files[@]/#/out/Release/}" "$pkgdir/usr/lib/chromium/"
  249. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
  250. install -Dm755 -t "$pkgdir/usr/lib/chromium/swiftshader" out/Release/swiftshader/*.so
  251. for size in 24 48 64 128 256; do
  252. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  253. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  254. done
  255. for size in 16 32; do
  256. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  257. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  258. done
  259. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  260. }
  261. # vim:set ts=2 sw=2 et ft=sh: