PKGBUILD 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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=84.0.4147.105
  10. pkgrel=1
  11. _pkgname=$pkgname
  12. _pkgver=$pkgver
  13. # sometimes an ungoogled patches can be combined with a new chromium release
  14. # only if the release only includes security fixes
  15. _ungoogled_ver=84.0.4147.105-1
  16. _uc_url="$_pkgname-$_ungoogled_ver.tar.gz::https://github.com/Eloston/ungoogled-chromium/archive/$_ungoogled_ver.tar.gz"
  17. _uc_sum="af7999a71db3236eaa1d514cf901fb65db37dac40b65c1089a786c3f913ecb0e"
  18. _launcher_ver=6
  19. _gcc_patchset=3
  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. remove-NotifyError-calls-and-just-send-a-normal-message.patch
  45. avoid-calling-DeleteForCurrentDocument-from-destructor.patch
  46. force-mp3-files-to-have-a-start-time-of-zero.patch
  47. chromium-ffmpeg-4.3.patch
  48. intel-vp9-quirk.patch
  49. wayland-egl.patch
  50. nvidia-vdpau.patch
  51. chromium-skia-harmony.patch)
  52. sha256sums=('caf4ebeb2a2333454c3067a2534aeecaab5029aa78fc0d8b27f79ad3b9c5ccac'
  53. $_uc_sum
  54. '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
  55. 'babda4f5c1179825797496898d77334ac067149cac03d797ab27ac69671a7feb'
  56. 'f77088dd59b170b767ba91c6b410abb778ff2e68553433b24124d398fa4d3ce7'
  57. '3b10917f646f88ae988ca18be9cbef82025abb6a6e5cb00b77a11077192ce32c'
  58. '4e41cb637e96bcef98c119ed052ba1aeab45fca5b89d65955583dab002de783e'
  59. 'abc3fad113408332c3b187b083bf33eba59eb5c87fa3ce859023984b5804623c'
  60. '5390304b5f544868985ce00a3ec082d4ece2dacb1c73cdb35dd4facfea12449a'
  61. 'a25fc6fccb84fd0a58a799661cd9c4ffeb2731fa49268f43aa7108f1542c5af6'
  62. '34d08ea93cb4762cb33c7cffe931358008af32265fc720f2762f0179c3973574'
  63. '8095bf73afbca7c2b07306c5b4dd8f79b66e1053fa4e58b07f71ef938be603f1'
  64. '771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1')
  65. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  66. # Keys are the names in the above script; values are the dependencies in Arch
  67. declare -gA _system_libs=(
  68. [ffmpeg]=ffmpeg
  69. [flac]=flac
  70. [fontconfig]=fontconfig
  71. [freetype]=freetype2
  72. [harfbuzz-ng]=harfbuzz
  73. [icu]=icu
  74. [libdrm]=
  75. [libjpeg]=libjpeg
  76. [libpng]=libpng
  77. [libvpx]=libvpx
  78. [libwebp]=libwebp
  79. [libxml]=libxml2
  80. [libxslt]=libxslt
  81. [opus]=opus
  82. [re2]=re2
  83. [snappy]=snappy
  84. [zlib]=minizip
  85. )
  86. _unwanted_bundled_libs=(
  87. $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
  88. )
  89. depends+=(${_system_libs[@]})
  90. prepare() {
  91. cd "$srcdir/chromium-$_pkgver"
  92. # Allow building against system libraries in official builds
  93. sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
  94. tools/generate_shim_headers/generate_shim_headers.py
  95. # https://crbug.com/893950
  96. sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
  97. third_party/blink/renderer/core/xml/*.cc \
  98. third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
  99. third_party/libxml/chromium/*.cc
  100. # https://chromium-review.googlesource.com/c/chromium/src/+/2223010
  101. patch -Np1 -i ../remove-NotifyError-calls-and-just-send-a-normal-message.patch
  102. # https://chromium-review.googlesource.com/c/chromium/src/+/2224737
  103. patch -Np1 -i ../avoid-calling-DeleteForCurrentDocument-from-destructor.patch
  104. # https://chromium-review.googlesource.com/c/chromium/src/+/2268221
  105. patch -Np1 -i ../force-mp3-files-to-have-a-start-time-of-zero.patch
  106. # Fixes for building with libstdc++ instead of libc++
  107. patch -Np1 -i ../patches/chromium-84-AXObject-stl-iterator.patch
  108. patch -Np1 -i ../patches/chromium-84-ListContainerHelper-include-cstring.patch
  109. patch -Np1 -i ../patches/chromium-84-crashpad-include-cstring.patch
  110. patch -Np1 -i ../patches/chromium-84-gcc-10-include-stddef.patch
  111. patch -Np1 -i ../patches/chromium-84-gcc-10-webrtc-include-stddef.patch
  112. patch -Np1 -i ../patches/chromium-84-gcc-DCHECK_EQ-unique_ptr.patch
  113. patch -Np1 -i ../patches/chromium-84-std-vector-const.patch
  114. # https://crbug.com/1095962
  115. patch -Np1 -i ../chromium-ffmpeg-4.3.patch
  116. # https://crbug.com/skia/6663#c10
  117. patch -Np0 -i ../chromium-skia-harmony.patch
  118. # Intel KabyLake/GeminiLake VP9 quirk
  119. patch -Np1 -i ../intel-vp9-quirk.patch
  120. # Wayland/EGL regression (crbug #1071528 #1071550)
  121. patch -Np1 -i ../wayland-egl.patch
  122. # NVIDIA vdpau-wrapper
  123. patch -Np1 -i ../nvidia-vdpau.patch
  124. # Ungoogled Chromium changes
  125. _ungoogled_repo="$srcdir/$_pkgname-$_ungoogled_ver"
  126. _utils="${_ungoogled_repo}/utils"
  127. msg2 'Pruning binaries'
  128. python "$_utils/prune_binaries.py" ./ "$_ungoogled_repo/pruning.list"
  129. msg2 'Applying patches'
  130. python "$_utils/patches.py" apply ./ "$_ungoogled_repo/patches"
  131. msg2 'Applying domain substitution'
  132. python "$_utils/domain_substitution.py" apply -r "$_ungoogled_repo/domain_regex.list" \
  133. -f "$_ungoogled_repo/domain_substitution.list" -c domainsubcache.tar.gz ./
  134. # Force script incompatible with Python 3 to use /usr/bin/python2
  135. sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py
  136. # Make xcbgen available to ui/gfx/x/gen_xproto.py running under Python 2
  137. ln -s /usr/lib/python3.*/site-packages/xcbgen "$srcdir/"
  138. mkdir -p third_party/node/linux/node-linux-x64/bin
  139. ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
  140. # Remove bundled libraries for which we will use the system copies; this
  141. # *should* do what the remove_bundled_libraries.py script does, with the
  142. # added benefit of not having to list all the remaining libraries
  143. local _lib
  144. for _lib in ${_unwanted_bundled_libs[@]}; do
  145. find "third_party/$_lib" -type f \
  146. \! -path "third_party/$_lib/chromium/*" \
  147. \! -path "third_party/$_lib/google/*" \
  148. \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
  149. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  150. -delete
  151. done
  152. python2 build/linux/unbundle/replace_gn_files.py \
  153. --system-libraries "${!_system_libs[@]}"
  154. }
  155. build() {
  156. make -C chromium-launcher-$_launcher_ver
  157. cd "$srcdir/chromium-$_pkgver"
  158. if check_buildoption ccache y; then
  159. # Avoid falling back to preprocessor mode when sources contain time macros
  160. export CCACHE_SLOPPINESS=time_macros
  161. fi
  162. # ui/gfx/x/gen_xproto.py needs xcbgen
  163. export PYTHONPATH=$srcdir
  164. export CC=clang
  165. export CXX=clang++
  166. export AR=ar
  167. export NM=nm
  168. local _flags=(
  169. 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
  170. 'host_toolchain="//build/toolchain/linux/unbundle:default"'
  171. 'is_official_build=true' # implies is_cfi=true on x86_64
  172. 'ffmpeg_branding="Chrome"'
  173. 'proprietary_codecs=true'
  174. 'rtc_use_pipewire=true'
  175. 'link_pulseaudio=true'
  176. 'use_gnome_keyring=false'
  177. 'use_sysroot=false'
  178. 'use_custom_libcxx=false'
  179. 'use_vaapi=true'
  180. 'enable_swiftshader=false'
  181. )
  182. if [[ -n ${_system_libs[icu]+set} ]]; then
  183. _flags+=('icu_use_data_file=false')
  184. fi
  185. if check_option strip y; then
  186. _flags+=('symbol_level=0')
  187. fi
  188. # Append ungoogled chromium flags to _flags array
  189. _ungoogled_repo="$srcdir/$_pkgname-$_ungoogled_ver"
  190. readarray -t -O ${#_flags[@]} _flags < "${_ungoogled_repo}/flags.gn"
  191. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  192. CFLAGS+=' -Wno-builtin-macro-redefined'
  193. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  194. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  195. # Do not warn about unknown warning options
  196. CFLAGS+=' -Wno-unknown-warning-option'
  197. CXXFLAGS+=' -Wno-unknown-warning-option'
  198. msg2 'Configuring Chromium'
  199. gn gen out/Release --args="${_flags[*]}" --script-executable=/usr/bin/python2
  200. msg2 'Building Chromium'
  201. ninja -C out/Release chrome chrome_sandbox chromedriver
  202. }
  203. package() {
  204. cd chromium-launcher-$_launcher_ver
  205. make PREFIX=/usr DESTDIR="$pkgdir" install
  206. install -Dm644 LICENSE \
  207. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  208. cd "$srcdir/chromium-$_pkgver"
  209. install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
  210. install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  211. ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver"
  212. install -Dm644 ../chromium-drirc-disable-10bpc-color-configs.conf \
  213. "$pkgdir/usr/share/drirc.d/10-$pkgname.conf"
  214. install -Dm644 chrome/installer/linux/common/desktop.template \
  215. "$pkgdir/usr/share/applications/chromium.desktop"
  216. install -Dm644 chrome/app/resources/manpage.1.in \
  217. "$pkgdir/usr/share/man/man1/chromium.1"
  218. sed -i \
  219. -e 's/@@MENUNAME@@/Chromium/g' \
  220. -e 's/@@PACKAGE@@/chromium/g' \
  221. -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium/g' \
  222. "$pkgdir/usr/share/applications/chromium.desktop" \
  223. "$pkgdir/usr/share/man/man1/chromium.1"
  224. install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \
  225. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  226. sed -ni \
  227. -e 's/chromium-browser\.desktop/chromium.desktop/' \
  228. -e '/<update_contact>/d' \
  229. -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
  230. -e '/^<?xml/,$p' \
  231. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  232. local toplevel_files=(
  233. chrome_100_percent.pak
  234. chrome_200_percent.pak
  235. resources.pak
  236. v8_context_snapshot.bin
  237. chromedriver
  238. )
  239. if [[ -z ${_system_libs[icu]+set} ]]; then
  240. toplevel_files+=(icudtl.dat)
  241. fi
  242. cp "${toplevel_files[@]/#/out/Release/}" "$pkgdir/usr/lib/chromium/"
  243. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
  244. for size in 24 48 64 128 256; do
  245. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  246. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  247. done
  248. for size in 16 32; do
  249. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  250. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  251. done
  252. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  253. }
  254. # vim:set ts=2 sw=2 et ft=sh: