PKGBUILD 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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-xdg
  9. pkgver=95.0.4638.69
  10. pkgrel=1
  11. _launcher_ver=8
  12. _gcc_patchset=4
  13. pkgdesc="A lightweight approach to removing Google web service dependency - with Support for the XDG Base Directory Specification"
  14. arch=('x86_64')
  15. url="https://github.com/Eloston/ungoogled-chromium"
  16. license=('BSD')
  17. depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
  18. 'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'libva'
  19. 'desktop-file-utils' 'hicolor-icon-theme')
  20. makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire'
  21. 'java-runtime-headless')
  22. optdepends=('pipewire: WebRTC desktop sharing under Wayland'
  23. 'kdialog: support for native dialogs in Plasma'
  24. 'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
  25. 'kwallet: support for storing passwords in KWallet on Plasma')
  26. source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
  27. https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz
  28. https://github.com/stha09/chromium-patches/releases/download/chromium-${pkgver%%.*}-patchset-$_gcc_patchset/chromium-${pkgver%%.*}-patchset-$_gcc_patchset.tar.xz
  29. maldoca-depend-on-zlib-instead-of-headers-only.patch
  30. ozone-x11-fix-VA-API.patch
  31. chromium-95-harfbuzz-3.patch
  32. replace-blacklist-with-ignorelist.patch
  33. add-a-TODO-about-a-missing-pnacl-flag.patch
  34. use-ffile-compilation-dir.patch
  35. pipewire-do-not-typecheck-the-portal-session_handle.patch
  36. sql-make-VirtualCursor-standard-layout-type.patch
  37. chromium-93-ffmpeg-4.4.patch
  38. chromium-94-ffmpeg-roll.patch
  39. unexpire-accelerated-video-decode-flag.patch
  40. use-oauth2-client-switches-as-default.patch
  41. xdg-basedir.patch)
  42. sha256sums=('38a37d737c6c9a7198402ca614746b2dbb7abbb793bb2cb02dc796b62a22efe7'
  43. '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a'
  44. 'bc6373f2470a9e6d947a4deaee0612f730112f69552b933c54bb6e60b82dd6f1'
  45. '074b32078b9e53fd9b33709ce5785c120eb0346b015a93921897caed4f95f7b6'
  46. '3af6dfe5c4e6ed1be52a292c30bc0c447cc8498bb108f7973adb438239961474'
  47. 'd9002f1e33390c3e770637773c81be6731584b18f68f086e955bcc3f66f4510d'
  48. 'd3344ba39b8c6ed202334ba7f441c70d81ddf8cdb15af1aa8c16e9a3a75fbb35'
  49. 'd53da216538f2e741a6e048ed103964a91a98e9a3c10c27fdfa34d4692fdc455'
  50. '921010cd8fab5f30be76c68b68c9b39fac9e21f4c4133bb709879592bbdf606e'
  51. '1889d890ff512a8b82a0f88972e78c78131177d8034750ff53577dfad99b3e3e'
  52. 'dd317f85e5abfdcfc89c6f23f4c8edbcdebdd5e083dcec770e5da49ee647d150'
  53. '1a9e074f417f8ffd78bcd6874d8e2e74a239905bf662f76a7755fa40dc476b57'
  54. '56acb6e743d2ab1ed9f3eb01700ade02521769978d03ac43226dec94659b3ace'
  55. '2a97b26c3d6821b15ef4ef1369905c6fa3e9c8da4877eb9af4361452a425290b'
  56. 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711'
  57. 'c332af43f4afb120c749319f3f2b1bcb38715ac5d9dbb376475702bd9ef95686')
  58. provides=('chromium')
  59. conflicts=('chromium')
  60. source=(${source[@]}
  61. $pkgname-$pkgver-1.tar.gz::https://github.com/Eloston/ungoogled-chromium/archive/$pkgver-1.tar.gz
  62. chromium-drirc-disable-10bpc-color-configs.conf
  63. wayland-egl.patch)
  64. sha256sums=(${sha256sums[@]}
  65. '35debe7f407a4749d4454fc78f52c18955f1d8400750fdc20b179f528106c658'
  66. 'babda4f5c1179825797496898d77334ac067149cac03d797ab27ac69671a7feb'
  67. '34d08ea93cb4762cb33c7cffe931358008af32265fc720f2762f0179c3973574')
  68. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  69. # Keys are the names in the above script; values are the dependencies in Arch
  70. declare -gA _system_libs=(
  71. [ffmpeg]=ffmpeg
  72. [flac]=flac
  73. [fontconfig]=fontconfig
  74. [freetype]=freetype2
  75. [harfbuzz-ng]=harfbuzz
  76. [icu]=icu
  77. [libdrm]=
  78. [libjpeg]=libjpeg
  79. [libpng]=libpng
  80. #[libvpx]=libvpx
  81. [libwebp]=libwebp
  82. [libxml]=libxml2
  83. [libxslt]=libxslt
  84. [opus]=opus
  85. [re2]=re2
  86. [snappy]=snappy
  87. [zlib]=minizip
  88. )
  89. _unwanted_bundled_libs=(
  90. $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
  91. )
  92. depends+=(${_system_libs[@]})
  93. prepare() {
  94. cd "$srcdir/chromium-$pkgver"
  95. # Allow building against system libraries in official builds
  96. sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
  97. tools/generate_shim_headers/generate_shim_headers.py
  98. # https://crbug.com/893950
  99. sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
  100. third_party/blink/renderer/core/xml/*.cc \
  101. third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
  102. third_party/libxml/chromium/*.cc
  103. # Use the --oauth2-client-id= and --oauth2-client-secret= switches for
  104. # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
  105. # runtime -- this allows signing into Chromium without baked-in values
  106. patch -Np1 -i ../use-oauth2-client-switches-as-default.patch
  107. # Fix build with older ffmpeg
  108. patch -Np1 -i ../chromium-93-ffmpeg-4.4.patch
  109. # Revert change to custom function av_stream_get_first_dts; will need to
  110. # switch to bundled ffmpeg when we're no longer using ffmpeg 4.4 in Arch
  111. # Upstream commit that made first_dts internal causing Chromium to add a
  112. # custom function: https://github.com/FFmpeg/FFmpeg/commit/591b88e6787c4
  113. # https://crbug.com/1251779
  114. patch -Rp1 -i ../chromium-94-ffmpeg-roll.patch
  115. patch -p1 -i ../xdg-basedir.patch
  116. # https://crbug.com/1207478
  117. patch -Np0 -i ../unexpire-accelerated-video-decode-flag.patch
  118. # Upstream fixes
  119. patch -Np1 -i ../maldoca-depend-on-zlib-instead-of-headers-only.patch
  120. patch -Np1 -i ../ozone-x11-fix-VA-API.patch
  121. patch -Np1 -i ../chromium-95-harfbuzz-3.patch
  122. # Revert transition to -fsanitize-ignorelist (needs newer clang)
  123. patch -Rp1 -i ../replace-blacklist-with-ignorelist.patch
  124. # Revert addition of -ffile-compilation-dir= (needs newer clang)
  125. patch -Rp1 -i ../add-a-TODO-about-a-missing-pnacl-flag.patch
  126. patch -Rp1 -i ../use-ffile-compilation-dir.patch
  127. # Fix desktop sharing via Pipewire with xdg-desktop-portal 1.10
  128. patch -Np1 -d third_party/webrtc <../pipewire-do-not-typecheck-the-portal-session_handle.patch
  129. # https://chromium-review.googlesource.com/c/chromium/src/+/2862724
  130. patch -Np1 -i ../sql-make-VirtualCursor-standard-layout-type.patch
  131. # Fixes for building with libstdc++ instead of libc++
  132. patch -Np1 -i ../patches/chromium-95-quiche-include.patch
  133. # Wayland/EGL regression (crbug #1071528 #1071550)
  134. patch -Np1 -i ../wayland-egl.patch
  135. # Ungoogled Chromium changes
  136. _ungoogled_repo="$srcdir/${pkgname%xdg*}$pkgver-1"
  137. _utils="${_ungoogled_repo}/utils"
  138. python "$_utils/prune_binaries.py" ./ "$_ungoogled_repo/pruning.list"
  139. python "$_utils/patches.py" apply ./ "$_ungoogled_repo/patches"
  140. python "$_utils/domain_substitution.py" apply -r "$_ungoogled_repo/domain_regex.list" \
  141. -f "$_ungoogled_repo/domain_substitution.list" -c domainsubcache.tar.gz ./
  142. # Link to system tools required by the build
  143. mkdir -p third_party/node/linux/node-linux-x64/bin
  144. ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
  145. ln -s /usr/bin/java third_party/jdk/current/bin/
  146. # Remove bundled libraries for which we will use the system copies; this
  147. # *should* do what the remove_bundled_libraries.py script does, with the
  148. # added benefit of not having to list all the remaining libraries
  149. local _lib
  150. for _lib in ${_unwanted_bundled_libs[@]}; do
  151. find "third_party/$_lib" -type f \
  152. \! -path "third_party/$_lib/chromium/*" \
  153. \! -path "third_party/$_lib/google/*" \
  154. \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
  155. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  156. -delete
  157. done
  158. ./build/linux/unbundle/replace_gn_files.py \
  159. --system-libraries "${!_system_libs[@]}"
  160. }
  161. build() {
  162. make -C chromium-launcher-$_launcher_ver
  163. cd "$srcdir/chromium-$pkgver"
  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. 'disable_fieldtrial_testing_config=true'
  173. 'blink_enable_generated_code_formatting=false'
  174. 'ffmpeg_branding="Chrome"'
  175. 'proprietary_codecs=true'
  176. 'rtc_use_pipewire=true'
  177. 'link_pulseaudio=true'
  178. 'use_gnome_keyring=false'
  179. 'use_sysroot=false'
  180. 'use_custom_libcxx=false'
  181. 'enable_widevine=true'
  182. )
  183. if [[ -n ${_system_libs[icu]+set} ]]; then
  184. _flags+=('icu_use_data_file=false')
  185. fi
  186. if check_option strip y; then
  187. _flags+=('symbol_level=0')
  188. fi
  189. # Append ungoogled chromium flags to _flags array
  190. _ungoogled_repo="$srcdir/${pkgname%xdg*}$pkgver-1"
  191. readarray -t -O ${#_flags[@]} _flags < "${_ungoogled_repo}/flags.gn"
  192. # use fixed flags as system flags break build
  193. CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
  194. CXXFLAGS="$CFLAGS"
  195. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  196. CFLAGS+=' -Wno-builtin-macro-redefined'
  197. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  198. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  199. # Do not warn about unknown warning options
  200. CFLAGS+=' -Wno-unknown-warning-option'
  201. CXXFLAGS+=' -Wno-unknown-warning-option'
  202. gn gen out/Release --args="${_flags[*]}"
  203. ninja -C out/Release chrome chrome_sandbox chromedriver
  204. }
  205. package() {
  206. cd chromium-launcher-$_launcher_ver
  207. make PREFIX=/usr DESTDIR="$pkgdir" install
  208. install -Dm644 LICENSE \
  209. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  210. cd "$srcdir/chromium-$pkgver"
  211. install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
  212. install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  213. ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver"
  214. install -Dm644 ../chromium-drirc-disable-10bpc-color-configs.conf \
  215. "$pkgdir/usr/share/drirc.d/10-$pkgname.conf"
  216. install -Dm644 chrome/installer/linux/common/desktop.template \
  217. "$pkgdir/usr/share/applications/chromium.desktop"
  218. install -Dm644 chrome/app/resources/manpage.1.in \
  219. "$pkgdir/usr/share/man/man1/chromium.1"
  220. sed -i \
  221. -e 's/@@MENUNAME@@/Chromium/g' \
  222. -e 's/@@PACKAGE@@/chromium/g' \
  223. -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium/g' \
  224. "$pkgdir/usr/share/applications/chromium.desktop" \
  225. "$pkgdir/usr/share/man/man1/chromium.1"
  226. install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \
  227. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  228. sed -ni \
  229. -e 's/chromium-browser\.desktop/chromium.desktop/' \
  230. -e '/<update_contact>/d' \
  231. -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
  232. -e '/^<?xml/,$p' \
  233. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  234. local toplevel_files=(
  235. chrome_100_percent.pak
  236. chrome_200_percent.pak
  237. resources.pak
  238. v8_context_snapshot.bin
  239. # ANGLE
  240. libEGL.so
  241. libGLESv2.so
  242. chromedriver
  243. chrome_crashpad_handler
  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: