PKGBUILD 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. # Maintainer: Seppia <seppia@seppio.fish>
  2. # Maintainer: JustKidding <jk@vin.ovh>
  3. # Based on aur/chromium-vaapi, with ungoogled-chromium patches
  4. # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
  5. # Contributor: Pierre Schmitz <pierre@archlinux.de>
  6. # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
  7. # Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
  8. pkgname=ungoogled-chromium
  9. pkgver=86.0.4240.111
  10. pkgrel=2
  11. _launcher_ver=6
  12. _gcc_patchset=6
  13. _pkgname=$(echo $pkgname | cut -d\- -f1-2)
  14. _pkgver=$(echo $pkgver | cut -d\. -f1-4)
  15. # ungoogled chromium variables
  16. _uc_ver=$pkgver-1
  17. _uc_usr=Eloston
  18. _uc_sum='4364e8b1d68e4a9e0694f09d41c0458b18e5683f043e29015aacb1ceecd3fb4e'
  19. _uc_url="$_pkgname-$_uc_ver.tar.gz::https://github.com/$_uc_usr/ungoogled-chromium/archive/$_uc_ver.tar.gz"
  20. pkgdesc="A lightweight approach to removing Google web service dependency"
  21. arch=('x86_64')
  22. url="https://github.com/Eloston/ungoogled-chromium"
  23. license=('BSD')
  24. depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
  25. 'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'json-glib'
  26. 'desktop-file-utils' 'hicolor-icon-theme')
  27. makedepends=('python' 'python2' 'gperf' 'mesa' 'ninja' 'nodejs' 'git' 'libva'
  28. 'libpipewire02' 'clang' 'lld' 'gn' 'java-runtime-headless'
  29. 'python2-setuptools')
  30. optdepends=('pepper-flash: support for Flash content'
  31. 'libpipewire02: WebRTC desktop sharing under Wayland'
  32. 'libva: hardware-accelerated video decode [experimental]'
  33. 'kdialog: needed for file dialogs in KDE'
  34. 'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
  35. 'kwallet: for storing passwords in KWallet on KDE desktops')
  36. provides=('chromium')
  37. conflicts=('chromium')
  38. install=chromium.install
  39. source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$_pkgver.tar.xz
  40. $_uc_url
  41. chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
  42. chromium-drirc-disable-10bpc-color-configs.conf
  43. https://github.com/stha09/chromium-patches/releases/download/chromium-${pkgver%%.*}-patchset-$_gcc_patchset/chromium-${pkgver%%.*}-patchset-$_gcc_patchset.tar.xz
  44. fix-invalid-end-iterator-usage-in-CookieMonster.patch
  45. only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch
  46. remove-dead-reloc-in-nonalloc-LD-flags.patch
  47. check-for-enable-accelerated-video-decode-on-Linux.patch
  48. xproto-fix-underflow-in-Fp1616ToDouble.patch
  49. wayland-egl.patch
  50. chromium-skia-harmony.patch)
  51. sha256sums=('f27bdb02ebf3c48abe054c73f1ae57e22a22535ea34f5edf8693ab8432a7c717'
  52. $_uc_sum
  53. '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
  54. 'babda4f5c1179825797496898d77334ac067149cac03d797ab27ac69671a7feb'
  55. '6f9ab35fa2c9e6e34ec454b829b7b87adaebc10cacecd1ac1daa67035ee44aba'
  56. '69d8b7a439db1af4713245ddf5f44ca647283ba833a8733e848033ebdaf03cdc'
  57. '7514c6c81a64a5457b66494a366fbb39005563eecc48d1a39033dd06aec4e300'
  58. '7cace84d7494190e7882d3e637820646ec8d64808f0a2128c515bd44991a3790'
  59. '03d03a39b2afa40083eb8ccb9616a51619f71da92348effc8ee289cbda10128b'
  60. '1ec617b362bf97cce4254debd04d8396f17dec0ae1071b52ec8c1c3d86dbd322'
  61. 'bf86923eaee5529ab9fb6148bd6c33a73c8746ab1b4ade0cd3b761109bc55826'
  62. '771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1')
  63. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  64. # Keys are the names in the above script; values are the dependencies in Arch
  65. declare -gA _system_libs=(
  66. [ffmpeg]=ffmpeg
  67. [flac]=flac
  68. [fontconfig]=fontconfig
  69. [freetype]=freetype2
  70. [harfbuzz-ng]=harfbuzz
  71. [icu]=icu
  72. [libdrm]=
  73. [libjpeg]=libjpeg
  74. [libpng]=libpng
  75. #[libvpx]=libvpx
  76. [libwebp]=libwebp
  77. [libxml]=libxml2
  78. [libxslt]=libxslt
  79. [opus]=opus
  80. [re2]=re2
  81. [snappy]=snappy
  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. # Upstream fixes
  99. patch -Np1 -i ../fix-invalid-end-iterator-usage-in-CookieMonster.patch
  100. patch -Np1 -i ../only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch
  101. #patch -Np1 -i ../remove-dead-reloc-in-nonalloc-LD-flags.patch
  102. patch -Np1 -i ../check-for-enable-accelerated-video-decode-on-Linux.patch
  103. patch -Np1 -i ../xproto-fix-underflow-in-Fp1616ToDouble.patch
  104. # Fixes for building with libstdc++ instead of libc++
  105. patch -Np1 -i ../patches/chromium-86-nearby-include.patch
  106. # https://crbug.com/skia/6663#c10
  107. patch -Np0 -i ../chromium-skia-harmony.patch
  108. # Wayland/EGL regression (crbug #1071528 #1071550)
  109. patch -Np1 -i ../wayland-egl.patch
  110. # Ungoogled Chromium changes
  111. _ungoogled_repo="$srcdir/$_pkgname-$_uc_ver"
  112. _utils="${_ungoogled_repo}/utils"
  113. msg2 'Pruning binaries'
  114. python "$_utils/prune_binaries.py" ./ "$_ungoogled_repo/pruning.list"
  115. msg2 'Applying patches'
  116. python "$_utils/patches.py" apply ./ "$_ungoogled_repo/patches"
  117. msg2 'Applying domain substitution'
  118. python "$_utils/domain_substitution.py" apply -r "$_ungoogled_repo/domain_regex.list" \
  119. -f "$_ungoogled_repo/domain_substitution.list" -c domainsubcache.tar.gz ./
  120. # Force script incompatible with Python 3 to use /usr/bin/python2
  121. sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py
  122. mkdir -p third_party/node/linux/node-linux-x64/bin
  123. ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
  124. # Remove bundled libraries for which we will use the system copies; this
  125. # *should* do what the remove_bundled_libraries.py script does, with the
  126. # added benefit of not having to list all the remaining libraries
  127. local _lib
  128. for _lib in ${_unwanted_bundled_libs[@]}; do
  129. find "third_party/$_lib" -type f \
  130. \! -path "third_party/$_lib/chromium/*" \
  131. \! -path "third_party/$_lib/google/*" \
  132. \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
  133. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  134. -delete
  135. done
  136. python2 build/linux/unbundle/replace_gn_files.py \
  137. --system-libraries "${!_system_libs[@]}"
  138. }
  139. build() {
  140. make -C chromium-launcher-$_launcher_ver
  141. cd "$srcdir/chromium-$_pkgver"
  142. if check_buildoption ccache y; then
  143. # Avoid falling back to preprocessor mode when sources contain time macros
  144. export CCACHE_SLOPPINESS=time_macros
  145. fi
  146. export CC=clang
  147. export CXX=clang++
  148. export AR=ar
  149. export NM=nm
  150. local _flags=(
  151. 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
  152. 'host_toolchain="//build/toolchain/linux/unbundle:default"'
  153. 'is_official_build=true' # implies is_cfi=true on x86_64
  154. 'ffmpeg_branding="Chrome"'
  155. 'proprietary_codecs=true'
  156. 'rtc_use_pipewire=true'
  157. 'link_pulseaudio=true'
  158. 'use_gnome_keyring=false'
  159. 'use_sysroot=false'
  160. 'use_custom_libcxx=false'
  161. 'enable_widevine=true'
  162. 'use_vaapi=true'
  163. )
  164. if [[ -n ${_system_libs[icu]+set} ]]; then
  165. _flags+=('icu_use_data_file=false')
  166. fi
  167. if check_option strip y; then
  168. _flags+=('symbol_level=0')
  169. fi
  170. # Append ungoogled chromium flags to _flags array
  171. _ungoogled_repo="$srcdir/$_pkgname-$_uc_ver"
  172. readarray -t -O ${#_flags[@]} _flags < "${_ungoogled_repo}/flags.gn"
  173. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  174. CFLAGS+=' -Wno-builtin-macro-redefined'
  175. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  176. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  177. # Do not warn about unknown warning options
  178. CFLAGS+=' -Wno-unknown-warning-option'
  179. CXXFLAGS+=' -Wno-unknown-warning-option'
  180. msg2 'Configuring Chromium'
  181. gn gen out/Release --args="${_flags[*]}" --script-executable=/usr/bin/python2
  182. msg2 'Building Chromium'
  183. ninja -C out/Release chrome chrome_sandbox chromedriver
  184. }
  185. package() {
  186. cd chromium-launcher-$_launcher_ver
  187. make PREFIX=/usr DESTDIR="$pkgdir" install
  188. install -Dm644 LICENSE \
  189. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  190. cd "$srcdir/chromium-$_pkgver"
  191. install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
  192. install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  193. ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver"
  194. install -Dm644 ../chromium-drirc-disable-10bpc-color-configs.conf \
  195. "$pkgdir/usr/share/drirc.d/10-$pkgname.conf"
  196. install -Dm644 chrome/installer/linux/common/desktop.template \
  197. "$pkgdir/usr/share/applications/chromium.desktop"
  198. install -Dm644 chrome/app/resources/manpage.1.in \
  199. "$pkgdir/usr/share/man/man1/chromium.1"
  200. sed -i \
  201. -e 's/@@MENUNAME@@/Chromium/g' \
  202. -e 's/@@PACKAGE@@/chromium/g' \
  203. -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium/g' \
  204. "$pkgdir/usr/share/applications/chromium.desktop" \
  205. "$pkgdir/usr/share/man/man1/chromium.1"
  206. install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \
  207. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  208. sed -ni \
  209. -e 's/chromium-browser\.desktop/chromium.desktop/' \
  210. -e '/<update_contact>/d' \
  211. -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
  212. -e '/^<?xml/,$p' \
  213. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  214. local toplevel_files=(
  215. chrome_100_percent.pak
  216. chrome_200_percent.pak
  217. resources.pak
  218. v8_context_snapshot.bin
  219. # ANGLE
  220. libEGL.so
  221. libGLESv2.so
  222. chromedriver
  223. )
  224. if [[ -z ${_system_libs[icu]+set} ]]; then
  225. toplevel_files+=(icudtl.dat)
  226. fi
  227. cp "${toplevel_files[@]/#/out/Release/}" "$pkgdir/usr/lib/chromium/"
  228. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
  229. install -Dm755 -t "$pkgdir/usr/lib/chromium/swiftshader" out/Release/swiftshader/*.so
  230. for size in 24 48 64 128 256; do
  231. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  232. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  233. done
  234. for size in 16 32; do
  235. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  236. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  237. done
  238. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  239. }
  240. # vim:set ts=2 sw=2 et ft=sh: