PKGBUILD 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. # Maintainer: Noah Vogt (noahvogt) <noah@noahvogt.com>
  2. # Maintainer: Seppia <seppia@seppio.fish>
  3. # Maintainer: JustKidding <jk@vin.ovh>
  4. # Based on extra/chromium, 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=115.0.5790.110
  11. pkgrel=1
  12. _launcher_ver=8
  13. _manual_clone=0
  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/ungoogled-software/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. 'wayland' 'desktop-file-utils' 'hicolor-icon-theme')
  21. makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire'
  22. 'qt5-base' 'java-runtime-headless' 'git' 'dos2unix')
  23. optdepends=('pipewire: WebRTC desktop sharing under Wayland'
  24. 'kdialog: support for native dialogs in Plasma'
  25. 'qt5-base: enable Qt5 with --enable-features=AllowQt'
  26. 'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
  27. 'kwallet: support for storing passwords in KWallet on Plasma')
  28. options=('!lto') # Chromium adds its own flags for ThinLTO
  29. source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
  30. https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz
  31. https://gitlab.archlinux.org/archlinux/packaging/packages/chromium/-/raw/115.0.5790.90-1/random-build-fixes.patch
  32. REVERT-disable-autoupgrading-debug-info.patch
  33. webauthn-variant.patch
  34. random-fixes-for-gcc13.patch
  35. disable-GlobalMediaControlsCastStartStop.patch
  36. use-oauth2-client-switches-as-default.patch
  37. xdg-basedir.patch
  38. no-omnibox-suggestion-autocomplete.patch
  39. index.html)
  40. sha256sums=('e9d4bcae7bc812afc430188b48cdc86ab31c4a6d161c34a770b8d56d3121f771'
  41. '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a'
  42. 'fd472e8c2a68b2d13ce6cab1db99818d7043e49cecf807bf0c5fc931f0c036a3'
  43. '1b782b0f6d4f645e4e0daa8a4852d63f0c972aa0473319216ff04613a0592a69'
  44. '590fabbb26270947cb477378b53a9dcd17855739076b4af9983e1e54dfcab6d7'
  45. 'ba4dd0a25a4fc3267ed19ccb39f28b28176ca3f97f53a4e9f5e9215280040ea0'
  46. '7f3b1b22d6a271431c1f9fc92b6eb49c6d80b8b3f868bdee07a6a1a16630a302'
  47. 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711'
  48. 'f97e6cd3c4d2e04f5d9a0ea234fe768d6ba0fa9f4ecd5c7b2ca91030a1249078'
  49. 'ff1591fa38e0ede7e883dc7494b813641b7a1a7cb1ded00d9baaee987c1dbea8'
  50. 'a4cdd2b86f32d5302c2792be841ff40d982b19bb58a4e63df9d77f4c706b8665')
  51. if (( _manual_clone )); then
  52. source[0]=fetch-chromium-release
  53. makedepends+=('python-httplib2' 'python-pyparsing' 'python-six')
  54. fi
  55. provides=("chromium=${pkgver}" "chromedriver=${pkgver}")
  56. conflicts=('chromium' 'chromedriver')
  57. _uc_usr=ungoogled-software
  58. _uc_ver=$pkgver-1
  59. source=(${source[@]}
  60. ${pkgname%-*}-$_uc_ver.tar.gz::https://github.com/$_uc_usr/ungoogled-chromium/archive/refs/tags/$_uc_ver.tar.gz
  61. #${pkgname%-*}-$_uc_ver.zip::https://github.com/Ahrotahn/${pkgname%-*}/archive/refs/heads/update.zip
  62. ozone-add-va-api-support-to-wayland.patch
  63. vaapi-add-av1-support.patch
  64. remove-main-main10-profile-limit.patch
  65. chromium-112-gcc-13-0003-ruy.patch
  66. chromium-112-gcc-13-0005-tensorflow-tflite.patch
  67. chromium-112-gcc-13-0006-vulkanmemoryallocator.patch
  68. chromium-112-gcc-13-0007-misc.patch
  69. chromium-112-gcc-13-0014-maldoca.patch
  70. chromium-115-add-cmath-for-various-math-functions-in-skia.patch
  71. chromium-115-std-vector-used-in-verify_name_match.h-without-include.patch)
  72. sha256sums=(${sha256sums[@]}
  73. '39a8e3bb0cb4e3b40c0c657afa7baf4bef717b363b057a59cc379dcacc5ec142'
  74. 'e9e8d3a82da818f0a67d4a09be4ecff5680b0534d7f0198befb3654e9fab5b69'
  75. 'e742cc5227b6ad6c3e0c2026edd561c6d3151e7bf0afb618578ede181451b307'
  76. 'be8d3475427553feb5bd46665ead3086301ed93c9a41cf6cc2644811c5bda51c'
  77. '4c90e796fe2eaa5f07cfd01cf4527c0a42ed21c98777fe4bd7e7720f4c34efc9'
  78. 'ef6b52377a7e7590d1fe7e4029eccafbd44c0531abe78b12c05e9c2a08be8eb9'
  79. '3c719fff7777af4c43e752a747be42894d074dd8fd58199a4b105721d380ee6d'
  80. 'ca5fb041d53b144365b21927ec9d6becccbdaa8a8abda11fd587a1ec46983384'
  81. '7a68c0ea1e4e6edc823e330070c8182b50eaaab64d7630ffe1578658d188170a'
  82. '13d3fd50de87a6caf9252dbb7e32ecf00cc80b4ed0e56b1ac7d3179659ad9ce9'
  83. '3f16290112758e9a9dc1ac35ccc565b6411c3a3028703961ee0877e08af056f3')
  84. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  85. # Keys are the names in the above script; values are the dependencies in Arch
  86. declare -gA _system_libs=(
  87. [brotli]=brotli
  88. [dav1d]=dav1d
  89. [ffmpeg]=ffmpeg
  90. [flac]=flac
  91. [fontconfig]=fontconfig
  92. [freetype]=freetype2
  93. [harfbuzz-ng]=harfbuzz
  94. [icu]=icu
  95. [jsoncpp]=jsoncpp
  96. #[libaom]=aom # https://aomedia.googlesource.com/aom/+/706ee36dcc82
  97. #[libavif]=libavif # https://github.com/AOMediaCodec/libavif/commit/4d2776a3
  98. [libdrm]=
  99. [libjpeg]=libjpeg
  100. [libpng]=libpng
  101. #[libvpx]=libvpx
  102. [libwebp]=libwebp
  103. [libxml]=libxml2
  104. [libxslt]=libxslt
  105. [opus]=opus
  106. [re2]=re2
  107. [snappy]=snappy
  108. [woff2]=woff2
  109. #[zlib]=minizip # broken include from chrome/common/safe_browsing/zip_analyzer.h
  110. )
  111. _unwanted_bundled_libs=(
  112. $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
  113. )
  114. depends+=(${_system_libs[@]})
  115. # Google API keys (see https://www.chromium.org/developers/how-tos/api-keys)
  116. # Note: These are for Arch Linux use ONLY. For your own distribution, please
  117. # get your own set of keys.
  118. #
  119. # Starting with Chromium 89 (2021-03-02) the OAuth2 credentials have been left
  120. # out: https://archlinux.org/news/chromium-losing-sync-support-in-early-march/
  121. _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM
  122. prepare() {
  123. if (( _manual_clone )); then
  124. ./fetch-chromium-release $pkgver
  125. fi
  126. cd "$srcdir/chromium-$pkgver"
  127. # Allow building against system libraries in official builds
  128. sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
  129. tools/generate_shim_headers/generate_shim_headers.py
  130. # https://crbug.com/893950
  131. sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
  132. third_party/blink/renderer/core/xml/*.cc \
  133. third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
  134. third_party/libxml/chromium/*.cc \
  135. third_party/maldoca/src/maldoca/ole/oss_utils.h
  136. # Use the --oauth2-client-id= and --oauth2-client-secret= switches for
  137. # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
  138. # runtime -- this allows signing into Chromium without baked-in values
  139. patch -Np1 -i ../use-oauth2-client-switches-as-default.patch
  140. # Revert addition of compiler flag that needs newer clang
  141. patch -Rp1 -i ../REVERT-disable-autoupgrading-debug-info.patch
  142. # Disable kGlobalMediaControlsCastStartStop by default
  143. # https://crbug.com/1314342
  144. patch -Np1 -i ../disable-GlobalMediaControlsCastStartStop.patch
  145. # Build fixes
  146. patch -Np1 -i ../webauthn-variant.patch
  147. patch -Np1 -i ../random-build-fixes.patch
  148. patch -Np1 -i ../chromium-115-add-cmath-for-various-math-functions-in-skia.patch
  149. patch -Np1 -i ../chromium-115-std-vector-used-in-verify_name_match.h-without-include.patch
  150. # gcc 13 patches
  151. patch -Np1 -i ../chromium-112-gcc-13-0003-ruy.patch
  152. patch -Np1 -i ../chromium-112-gcc-13-0005-tensorflow-tflite.patch
  153. dos2unix third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
  154. patch -Np1 -i ../chromium-112-gcc-13-0006-vulkanmemoryallocator.patch
  155. patch -Np1 -i ../chromium-112-gcc-13-0007-misc.patch
  156. patch -Np1 -i ../chromium-112-gcc-13-0014-maldoca.patch
  157. # move ~/.pki directory to ${XDG_DATA_HOME:-$HOME/.local}/share/pki
  158. patch -p1 -i ../xdg-basedir.patch
  159. # You can now set '1' in the flag #omnibox-ui-max-autocomplete-matches to
  160. # effectively disable autocompletion in the url bar (and therefore the so-
  161. # called 'shoulder surfing').
  162. patch -p1 -i ../no-omnibox-suggestion-autocomplete.patch
  163. # Custom Patches
  164. patch -Np1 -i ../ozone-add-va-api-support-to-wayland.patch
  165. patch -Np1 -i ../vaapi-add-av1-support.patch
  166. sed -i '/^bool IsHevcProfileSupported(const VideoType& type) {$/{s++bool IsHevcProfileSupported(const VideoType\& type) { return true;+;h};${x;/./{x;q0};x;q1}' \
  167. media/base/supported_types.cc
  168. # Ungoogled Chromium changes
  169. if [[ -d "$srcdir/${pkgname%xdg*}$_uc_ver" ]]
  170. then
  171. _ungoogled_repo="$srcdir/${pkgname%xdg*}$_uc_ver"
  172. else
  173. _ungoogled_repo="$srcdir/${pkgname%xdg*}update"
  174. fi
  175. _utils="${_ungoogled_repo}/utils"
  176. msg2 'Pruning binaries'
  177. python "$_utils/prune_binaries.py" ./ "$_ungoogled_repo/pruning.list"
  178. msg2 'Applying patches'
  179. python "$_utils/patches.py" apply ./ "$_ungoogled_repo/patches"
  180. msg2 'Applying domain substitution'
  181. python "$_utils/domain_substitution.py" apply -r "$_ungoogled_repo/domain_regex.list" \
  182. -f "$_ungoogled_repo/domain_substitution.list" -c domainsubcache.tar.gz ./
  183. # Link to system tools required by the build
  184. mkdir -p third_party/node/linux/node-linux-x64/bin
  185. ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
  186. ln -s /usr/bin/java third_party/jdk/current/bin/
  187. # Remove bundled libraries for which we will use the system copies; this
  188. # *should* do what the remove_bundled_libraries.py script does, with the
  189. # added benefit of not having to list all the remaining libraries
  190. local _lib
  191. for _lib in ${_unwanted_bundled_libs[@]}; do
  192. find "third_party/$_lib" -type f \
  193. \! -path "third_party/$_lib/chromium/*" \
  194. \! -path "third_party/$_lib/google/*" \
  195. \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
  196. \! -regex '.*\.\(gn\|gni\|isolate\)' \
  197. -delete
  198. done
  199. ./build/linux/unbundle/replace_gn_files.py \
  200. --system-libraries "${!_system_libs[@]}"
  201. }
  202. build() {
  203. make -C chromium-launcher-$_launcher_ver
  204. cd "$srcdir/chromium-$pkgver"
  205. export CC=clang
  206. export CXX=clang++
  207. export AR=ar
  208. export NM=nm
  209. local _flags=(
  210. 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
  211. 'host_toolchain="//build/toolchain/linux/unbundle:default"'
  212. 'clang_base_path="/usr"'
  213. 'clang_use_chrome_plugins=false'
  214. 'is_official_build=true' # implies is_cfi=true on x86_64
  215. 'symbol_level=0' # sufficient for backtraces on x86(_64)
  216. 'chrome_pgo_phase=0' # needs newer clang to read the bundled PGO profile
  217. 'treat_warnings_as_errors=false'
  218. 'disable_fieldtrial_testing_config=true'
  219. 'blink_enable_generated_code_formatting=false'
  220. 'ffmpeg_branding="Chrome"'
  221. 'proprietary_codecs=true'
  222. 'rtc_use_pipewire=true'
  223. 'link_pulseaudio=true'
  224. 'use_custom_libcxx=false'
  225. 'use_gnome_keyring=false'
  226. 'use_sysroot=false'
  227. 'use_system_libffi=true'
  228. 'enable_hangout_services_extension=true'
  229. 'enable_widevine=true'
  230. 'enable_nacl=false'
  231. 'enable_rust=false'
  232. "google_api_key=\"$_google_api_key\""
  233. )
  234. if [[ -n ${_system_libs[icu]+set} ]]; then
  235. _flags+=('icu_use_data_file=false')
  236. fi
  237. # enable HEVC decoding
  238. _flags+=(
  239. 'enable_platform_hevc=true'
  240. 'enable_hevc_parser_and_hw_decoder=true'
  241. )
  242. # Append ungoogled chromium flags to _flags array
  243. if [[ -d "$srcdir/${pkgname%xdg*}$_uc_ver" ]]
  244. then
  245. _ungoogled_repo="$srcdir/${pkgname%xdg*}$_uc_ver"
  246. else
  247. _ungoogled_repo="$srcdir/${pkgname%xdg*}update"
  248. fi
  249. readarray -t -O ${#_flags[@]} _flags < "${_ungoogled_repo}/flags.gn"
  250. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  251. CFLAGS+=' -Wno-builtin-macro-redefined'
  252. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  253. CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
  254. # Do not warn about unknown warning options
  255. CFLAGS+=' -Wno-unknown-warning-option'
  256. CXXFLAGS+=' -Wno-unknown-warning-option'
  257. # Let Chromium set its own symbol level
  258. CFLAGS=${CFLAGS/-g }
  259. CXXFLAGS=${CXXFLAGS/-g }
  260. # https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123
  261. CFLAGS=${CFLAGS/-fexceptions}
  262. CFLAGS=${CFLAGS/-fcf-protection}
  263. CXXFLAGS=${CXXFLAGS/-fexceptions}
  264. CXXFLAGS=${CXXFLAGS/-fcf-protection}
  265. # This appears to cause random segfaults when combined with ThinLTO
  266. # https://bugs.archlinux.org/task/73518
  267. CFLAGS=${CFLAGS/-fstack-clash-protection}
  268. CXXFLAGS=${CXXFLAGS/-fstack-clash-protection}
  269. # https://crbug.com/957519#c122
  270. CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}
  271. gn gen out/Release --args="${_flags[*]}"
  272. ninja -C out/Release chrome chrome_sandbox chromedriver
  273. }
  274. package() {
  275. cd chromium-launcher-$_launcher_ver
  276. make PREFIX=/usr DESTDIR="$pkgdir" install
  277. install -Dm644 LICENSE \
  278. "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  279. cd "$srcdir/chromium-$pkgver"
  280. install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
  281. install -D out/Release/chromedriver "$pkgdir/usr/bin/chromedriver"
  282. install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  283. install -Dm644 chrome/installer/linux/common/desktop.template \
  284. "$pkgdir/usr/share/applications/chromium.desktop"
  285. install -Dm644 chrome/app/resources/manpage.1.in \
  286. "$pkgdir/usr/share/man/man1/chromium.1"
  287. sed -i \
  288. -e 's/@@MENUNAME@@/Chromium/g' \
  289. -e 's/@@PACKAGE@@/chromium/g' \
  290. -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium/g' \
  291. "$pkgdir/usr/share/applications/chromium.desktop" \
  292. "$pkgdir/usr/share/man/man1/chromium.1"
  293. install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \
  294. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  295. sed -ni \
  296. -e 's/chromium-browser\.desktop/chromium.desktop/' \
  297. -e '/<update_contact>/d' \
  298. -e '/<p>/N;/<p>\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \
  299. -e '/^<?xml/,$p' \
  300. "$pkgdir/usr/share/metainfo/chromium.appdata.xml"
  301. local toplevel_files=(
  302. chrome_100_percent.pak
  303. chrome_200_percent.pak
  304. chrome_crashpad_handler
  305. libqt5_shim.so
  306. resources.pak
  307. v8_context_snapshot.bin
  308. # ANGLE
  309. libEGL.so
  310. libGLESv2.so
  311. # SwiftShader ICD
  312. libvk_swiftshader.so
  313. vk_swiftshader_icd.json
  314. )
  315. if [[ -z ${_system_libs[icu]+set} ]]; then
  316. toplevel_files+=(icudtl.dat)
  317. fi
  318. cp "${toplevel_files[@]/#/out/Release/}" "$pkgdir/usr/lib/chromium/"
  319. install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
  320. for size in 24 48 64 128 256; do
  321. install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  322. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  323. done
  324. for size in 16 32; do
  325. install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  326. "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  327. done
  328. install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  329. install -Dm644 "${srcdir}/index.html" "$pkgdir/usr/share/ungoogled-chromium/index.html"
  330. }
  331. # vim:set ts=2 sw=2 et: