PKGBUILD 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. # Maintainer: Noah Vogt (noahvogt) <noah@noahvogt.com>
  2. # Maintainer: Seppia <seppia@seppio.fish>
  3. # Maintainer: JustKidding <jk@vin.ovh>
  4. # Based on aur/chromium-vaapi, with ungoogled-chromium patches
  5. # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
  6. # Contributor: Pierre Schmitz <pierre@archlinux.de>
  7. # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
  8. # Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
  9. pkgname=ungoogled-chromium-xdg
  10. pkgver=95.0.4638.69
  11. pkgrel=1
  12. _launcher_ver=8
  13. _gcc_patchset=4
  14. pkgdesc="A lightweight approach to removing Google web service dependency - without creating a useless ~/.pki directory"
  15. arch=('x86_64')
  16. url="https://github.com/Eloston/ungoogled-chromium"
  17. license=('BSD')
  18. depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
  19. 'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'libva'
  20. 'desktop-file-utils' 'hicolor-icon-theme')
  21. makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire'
  22. 'java-runtime-headless')
  23. optdepends=('pipewire: WebRTC desktop sharing under Wayland'
  24. 'kdialog: support for native dialogs in Plasma'
  25. 'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
  26. 'kwallet: support for storing passwords in KWallet on Plasma')
  27. source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
  28. https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz
  29. https://github.com/stha09/chromium-patches/releases/download/chromium-${pkgver%%.*}-patchset-$_gcc_patchset/chromium-${pkgver%%.*}-patchset-$_gcc_patchset.tar.xz
  30. maldoca-depend-on-zlib-instead-of-headers-only.patch
  31. ozone-x11-fix-VA-API.patch
  32. chromium-95-harfbuzz-3.patch
  33. replace-blacklist-with-ignorelist.patch
  34. add-a-TODO-about-a-missing-pnacl-flag.patch
  35. use-ffile-compilation-dir.patch
  36. pipewire-do-not-typecheck-the-portal-session_handle.patch
  37. sql-make-VirtualCursor-standard-layout-type.patch
  38. chromium-93-ffmpeg-4.4.patch
  39. chromium-94-ffmpeg-roll.patch
  40. unexpire-accelerated-video-decode-flag.patch
  41. use-oauth2-client-switches-as-default.patch
  42. xdg-basedir.patch)
  43. sha256sums=('38a37d737c6c9a7198402ca614746b2dbb7abbb793bb2cb02dc796b62a22efe7'
  44. '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a'
  45. 'bc6373f2470a9e6d947a4deaee0612f730112f69552b933c54bb6e60b82dd6f1'
  46. '074b32078b9e53fd9b33709ce5785c120eb0346b015a93921897caed4f95f7b6'
  47. '3af6dfe5c4e6ed1be52a292c30bc0c447cc8498bb108f7973adb438239961474'
  48. 'd9002f1e33390c3e770637773c81be6731584b18f68f086e955bcc3f66f4510d'
  49. 'd3344ba39b8c6ed202334ba7f441c70d81ddf8cdb15af1aa8c16e9a3a75fbb35'
  50. 'd53da216538f2e741a6e048ed103964a91a98e9a3c10c27fdfa34d4692fdc455'
  51. '921010cd8fab5f30be76c68b68c9b39fac9e21f4c4133bb709879592bbdf606e'
  52. '1889d890ff512a8b82a0f88972e78c78131177d8034750ff53577dfad99b3e3e'
  53. 'dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150'
  54. '1a9e074f417f8ffd78bcd6874d8e2e74a239905bf662f76a7755fa40dc476b57'
  55. '56acb6e743d2ab1ed9f3eb01700ade02521769978d03ac43226dec94659b3ace'
  56. '2a97b26c3d6821b15ef4ef1369905c6fa3e9c8da4877eb9af4361452a425290b'
  57. 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711'
  58. 'c332af43f4afb120c749319f3f2b1bcb38715ac5d9dbb376475702bd9ef95686')
  59. provides=('chromium')
  60. conflicts=('chromium')
  61. source=(${source[@]}
  62. $pkgname-$pkgver-1.tar.gz::https://github.com/Eloston/ungoogled-chromium/archive/$pkgver-1.tar.gz
  63. chromium-drirc-disable-10bpc-color-configs.conf
  64. wayland-egl.patch)
  65. sha256sums=(${sha256sums[@]}
  66. '35debe7f407a4749d4454fc78f52c18955f1d8400750fdc20b179f528106c658'
  67. 'babda4f5c1179825797496898d77334ac067149cac03d797ab27ac69671a7feb'
  68. '34d08ea93cb4762cb33c7cffe931358008af32265fc720f2762f0179c3973574')
  69. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  70. # Keys are the names in the above script; values are the dependencies in Arch
  71. declare -gA _system_libs=(
  72. [ffmpeg]=ffmpeg
  73. [flac]=flac
  74. [fontconfig]=fontconfig
  75. [freetype]=freetype2
  76. [harfbuzz-ng]=harfbuzz
  77. [icu]=icu
  78. [libdrm]=
  79. [libjpeg]=libjpeg
  80. [libpng]=libpng
  81. #[libvpx]=libvpx
  82. [libwebp]=libwebp
  83. [libxml]=libxml2
  84. [libxslt]=libxslt
  85. [opus]=opus
  86. [re2]=re2
  87. [snappy]=snappy
  88. [zlib]=minizip
  89. )
  90. _unwanted_bundled_libs=(
  91. $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
  92. )
  93. depends+=(${_system_libs[@]})
  94. prepare() {
  95. cd "$srcdir/chromium-$pkgver"
  96. # Allow building against system libraries in official builds
  97. sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
  98. tools/generate_shim_headers/generate_shim_headers.py
  99. # https://crbug.com/893950
  100. sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
  101. third_party/blink/renderer/core/xml/*.cc \
  102. third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
  103. third_party/libxml/chromium/*.cc
  104. # Use the --oauth2-client-id= and --oauth2-client-secret= switches for
  105. # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
  106. # runtime -- this allows signing into Chromium without baked-in values
  107. patch -Np1 -i ../use-oauth2-client-switches-as-default.patch
  108. # Fix build with older ffmpeg
  109. patch -Np1 -i ../chromium-93-ffmpeg-4.4.patch
  110. # Revert change to custom function av_stream_get_first_dts; will need to
  111. # switch to bundled ffmpeg when we're no longer using ffmpeg 4.4 in Arch
  112. # Upstream commit that made first_dts internal causing Chromium to add a
  113. # custom function: https://github.com/FFmpeg/FFmpeg/commit/591b88e6787c4
  114. # https://crbug.com/1251779
  115. patch -Rp1 -i ../chromium-94-ffmpeg-roll.patch
  116. patch -p1 -i ../xdg-basedir.patch
  117. # https://crbug.com/1207478
  118. patch -Np0 -i ../unexpire-accelerated-video-decode-flag.patch
  119. # Upstream fixes
  120. patch -Np1 -i ../maldoca-depend-on-zlib-instead-of-headers-only.patch
  121. patch -Np1 -i ../ozone-x11-fix-VA-API.patch
  122. patch -Np1 -i ../chromium-95-harfbuzz-3.patch
  123. # Revert transition to -fsanitize-ignorelist (needs newer clang)
  124. patch -Rp1 -i ../replace-blacklist-with-ignorelist.patch
  125. # Revert addition of -ffile-compilation-dir= (needs newer clang)
  126. patch -Rp1 -i ../add-a-TODO-about-a-missing-pnacl-flag.patch
  127. patch -Rp1 -i ../use-ffile-compilation-dir.patch
  128. # Fix desktop sharing via Pipewire with xdg-desktop-portal 1.10
  129. patch -Np1 -d third_party/webrtc <../pipewire-do-not-typecheck-the-portal-session_handle.patch
  130. # https://chromium-review.googlesource.com/c/chromium/src/+/2862724
  131. patch -Np1 -i ../sql-make-VirtualCursor-standard-layout-type.patch
  132. # Fixes for building with libstdc++ instead of libc++
  133. patch -Np1 -i ../patches/chromium-95-quiche-include.patch
  134. # Wayland/EGL regression (crbug #1071528 #1071550)
  135. patch -Np1 -i ../wayland-egl.patch
  136. # Ungoogled Chromium changes
  137. _ungoogled_repo="$srcdir/${pkgname%xdg*}$pkgver-1"
  138. _utils="${_ungoogled_repo}/utils"
  139. python "$_utils/prune_binaries.py" ./ "$_ungoogled_repo/pruning.list"
  140. python "$_utils/patches.py" apply ./ "$_ungoogled_repo/patches"
  141. python "$_utils/domain_substitution.py" apply -r "$_ungoogled_repo/domain_regex.list" \
  142. -f "$_ungoogled_repo/domain_substitution.list" -c domainsubcache.tar.gz ./
  143. # Link to system tools required by the build
  144. mkdir -p third_party/node/linux/node-linux-x64/bin
  145. ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
  146. ln -s /usr/bin/java third_party/jdk/current/bin/
  147. # Remove bundled libraries for which we will use the system copies; this
  148. # *should* do what the remove_bundled_libraries.py script does, with the
  149. # added benefit of not having to list all the remaining libraries
  150. local _lib
  151. for _lib in ${_unwanted_bundled_libs[@]}; do
  152. find "third_party/$_lib" -type f \
  153. \! -path "third_party/$_lib/chromium/*" \
  154. \! -path "third_party/$_lib/google/*" \
  155. \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
  156. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  157. -delete
  158. done
  159. ./build/linux/unbundle/replace_gn_files.py \
  160. --system-libraries "${!_system_libs[@]}"
  161. }
  162. build() {
  163. make -C chromium-launcher-$_launcher_ver
  164. cd "$srcdir/chromium-$pkgver"
  165. export CC=clang
  166. export CXX=clang++
  167. export AR=ar
  168. export NM=nm
  169. local _flags=(
  170. 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
  171. 'host_toolchain="//build/toolchain/linux/unbundle:default"'
  172. 'is_official_build=true' # implies is_cfi=true on x86_64
  173. 'disable_fieldtrial_testing_config=true'
  174. 'blink_enable_generated_code_formatting=false'
  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. 'use_custom_libcxx=false'
  182. 'enable_widevine=true'
  183. )
  184. if [[ -n ${_system_libs[icu]+set} ]]; then
  185. _flags+=('icu_use_data_file=false')
  186. fi
  187. if check_option strip y; then
  188. _flags+=('symbol_level=0')
  189. fi
  190. # Append ungoogled chromium flags to _flags array
  191. _ungoogled_repo="$srcdir/${pkgname%xdg*}$pkgver-1"
  192. readarray -t -O ${#_flags[@]} _flags < "${_ungoogled_repo}/flags.gn"
  193. # use fixed flags as system flags break build
  194. CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
  195. CXXFLAGS="$CFLAGS"
  196. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  197. CFLAGS+=' -Wno-builtin-macro-redefined'
  198. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  199. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  200. # Do not warn about unknown warning options
  201. CFLAGS+=' -Wno-unknown-warning-option'
  202. CXXFLAGS+=' -Wno-unknown-warning-option'
  203. gn gen out/Release --args="${_flags[*]}"
  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/chromium/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. chrome_crashpad_handler
  245. )
  246. if [[ -z ${_system_libs[icu]+set} ]]; then
  247. toplevel_files+=(icudtl.dat)
  248. fi
  249. cp "${toplevel_files[@]/#/out/Release/}" "$pkgdir/usr/lib/chromium/"
  250. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
  251. install -Dm755 -t "$pkgdir/usr/lib/chromium/swiftshader" out/Release/swiftshader/*.so
  252. for size in 24 48 64 128 256; do
  253. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  254. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  255. done
  256. for size in 16 32; do
  257. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  258. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  259. done
  260. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  261. }
  262. # vim:set ts=2 sw=2 et: