PKGBUILD 11 KB

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