Guest User

Untitled

a guest
May 25th, 2020
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 12.72 KB | None | 0 0
  1. # Maintainer: Maxim Baz <$pkgname at maximbaz dot com>
  2. # Contributor: Kien Dang Tran loganeast257@gmail.com
  3. # Contributor: Samantha McVey samantham@posteo.net
  4.  
  5. # Based on extra/chromium, but with a patch to enable VA-API
  6.  
  7. # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
  8. # Contributor: Pierre Schmitz <pierre@archlinux.de>
  9. # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
  10. # Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
  11.  
  12. pkgname=chromium-vaapi
  13. pkgver=83.0.4103.61
  14. pkgrel=1
  15. _launcher_ver=6
  16. pkgdesc="Chromium with VA-API support to enable hardware acceleration"
  17. arch=('x86_64')
  18. url="https://www.chromium.org/Home"
  19. license=('BSD')
  20. depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt'
  21.          'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'json-glib' 'libva'
  22.          'desktop-file-utils' 'hicolor-icon-theme')
  23. makedepends=('python' 'python2' 'gperf' 'yasm' 'mesa' 'ninja' 'nodejs' 'git'
  24.              'libpipewire02' 'clang' 'lld' 'gn' 'java-runtime-headless'
  25.              'python2-setuptools')
  26. optdepends=('pepper-flash: support for Flash content'
  27.             'libpipewire02: WebRTC desktop sharing under Wayland'
  28.             'kdialog: needed for file dialogs in KDE'
  29.             'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
  30.             'kwallet: for storing passwords in KWallet on KDE desktops')
  31. provides=('chromium')
  32. conflicts=('chromium')
  33. install=chromium.install
  34. source=(https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz
  35.         chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
  36.         chromium-drirc-disable-10bpc-color-configs.conf
  37.         vdpau-support.patch
  38.         clean-up-a-call-to-set_utf8.patch
  39.         iwyu-std-numeric_limits-is-defined-in-limits.patch
  40.         add-missing-algorithm-header-in-crx_install_error.cc.patch
  41.         libstdc-fix-incomplete-type-in-AXTree-for-NodeSetSiz.patch
  42.         include-memory-header-to-get-the-definition-of-std-u.patch
  43.         make-some-of-blink-custom-iterators-STL-compatible.patch
  44.         avoid-double-destruction-of-ServiceWorkerObjectHost.patch
  45.         v8-remove-soon-to-be-removed-getAllFieldPositions.patch
  46.         chromium-83-gcc-10.patch
  47.         chromium-skia-harmony.patch
  48.         enable-chromecast-by-default.patch::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/enable-chromecast-by-default.patch
  49.         enable-vaapi-on-linux.diff::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/enable-vaapi-on-linux.diff
  50.         notifications-nicer.patch::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/notifications-nicer
  51.         gn-link-with-libc.patch::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/gn-link-with-libc.patch
  52.         widevine-allow-on-linux.patch::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/widevine-allow-on-linux.patch
  53.         fix-build-errors.patch::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/fix-build-errors.patch
  54.         widevine-other-locations.patch::https://raw.githubusercontent.com/saiarcot895/chromium-ubuntu-build/master/debian/patches/widevine-other-locations
  55.         chromium-fix-vaapi-on-intel.patch::https://raw.githubusercontent.com/akarshanbiswas/chromium-freeworld/master/chromium-fix-vaapi-on-intel.patch
  56.         )
  57. sha256sums=('4961f20c4ee6a94490e823f1b1c4128147068f1ce9cfc509e81815f2101405bc'
  58.             '04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
  59.             'babda4f5c1179825797496898d77334ac067149cac03d797ab27ac69671a7feb'
  60.             '0ec6ee49113cc8cc5036fa008519b94137df6987bf1f9fbffb2d42d298af868a'
  61.             '58c41713eb6fb33b6eef120f4324fa1fb8123b1fbc4ecbe5662f1f9779b9b6af'
  62.             '675fb3d6276cce569a641436465f58d5709d1d4a5f62b7052989479fd4aaea24'
  63.             '0e2a78e4aa7272ab0ff4a4c467750e01bad692a026ad9828aaf06d2a9418b9d8'
  64.             '50687079426094f2056d1f4806dc30fc8d6bad16190520e57ba087ec5db1d778'
  65.             '071326135bc25226aa165639dff80a03670a17548f2d2ff5cc4f40982b39c52a'
  66.             '3d7f20e1d2ee7d73ed25e708c0d59a0cb215fcce10a379e3d48a856533c4b0b7'
  67.             'd793842e9584bf75e3779918297ba0ffa6dd05394ef5b2bf5fb73aa9c86a7e2f'
  68.             'e042024423027ad3ef729a7e4709bdf9714aea49d64cfbbf46a645a05703abc2'
  69.             '3e5ba8c0a70a4bc673deec0c61eb2b58f05a4c784cbdb7c8118be1eb6580db6d'
  70.             '771292942c0901092a402cc60ee883877a99fb804cb54d568c8c6c94565a48e1'
  71.             'SKIP'
  72.             'SKIP'
  73.             'SKIP'
  74.             'SKIP'
  75.             'SKIP'
  76.             'SKIP'
  77.             'SKIP'
  78.             'SKIP'
  79.             )
  80.  
  81. # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
  82. # Keys are the names in the above script; values are the dependencies in Arch
  83. declare -gA _system_libs=(
  84.   [ffmpeg]=ffmpeg
  85.   [flac]=flac
  86.   [fontconfig]=fontconfig
  87.   [freetype]=freetype2
  88.   [harfbuzz-ng]=harfbuzz
  89.   [icu]=icu
  90.   [libdrm]=
  91.   [libjpeg]=libjpeg
  92.   #[libpng]=libpng    # https://crbug.com/752403#c10
  93.   [libvpx]=libvpx
  94.   [libwebp]=libwebp
  95.   [libxml]=libxml2
  96.   [libxslt]=libxslt
  97.   [opus]=opus
  98.   [re2]=re2
  99.   [snappy]=snappy
  100.   [yasm]=
  101.   [zlib]=minizip
  102. )
  103. _unwanted_bundled_libs=(
  104.   $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
  105. )
  106. depends+=(${_system_libs[@]})
  107.  
  108. # Google API keys (see https://www.chromium.org/developers/how-tos/api-keys)
  109. # Note: These are for Arch Linux use ONLY. For your own distribution, please
  110. # get your own set of keys.
  111. _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM
  112. _google_default_client_id=413772536636.apps.googleusercontent.com
  113. _google_default_client_secret=0ZChLK6AxeA3Isu96MkwqDR4
  114.  
  115. prepare() {
  116.   cd "$srcdir/chromium-$pkgver"
  117.  
  118.   # Allow building against system libraries in official builds
  119.   sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
  120.     tools/generate_shim_headers/generate_shim_headers.py
  121.  
  122.   # https://crbug.com/893950
  123.   sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
  124.     third_party/blink/renderer/core/xml/*.cc \
  125.     third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
  126.     third_party/libxml/chromium/*.cc
  127.  
  128.  # https://chromium-review.googlesource.com/c/chromium/src/+/2145261
  129.   patch -Np1 -i ../clean-up-a-call-to-set_utf8.patch
  130.  
  131.   # https://chromium-review.googlesource.com/c/chromium/src/+/2153111
  132.   patch -Np1 -F3 -i ../iwyu-std-numeric_limits-is-defined-in-limits.patch
  133.  
  134.   # https://chromium-review.googlesource.com/c/chromium/src/+/2152333
  135.   patch -Np1 -i ../add-missing-algorithm-header-in-crx_install_error.cc.patch
  136.  
  137.   # https://chromium-review.googlesource.com/c/chromium/src/+/2132403
  138.   patch -Np1 -i ../libstdc-fix-incomplete-type-in-AXTree-for-NodeSetSiz.patch
  139.  
  140.   # https://chromium-review.googlesource.com/c/chromium/src/+/2164645
  141.   patch -Np1 -i ../include-memory-header-to-get-the-definition-of-std-u.patch
  142.  
  143.   # https://chromium-review.googlesource.com/c/chromium/src/+/2174199
  144.   patch -Np1 -i ../make-some-of-blink-custom-iterators-STL-compatible.patch
  145.  
  146.   # https://chromium-review.googlesource.com/c/chromium/src/+/2094496
  147.   patch -Np1 -i ../avoid-double-destruction-of-ServiceWorkerObjectHost.patch
  148.  
  149.   # https://crbug.com/v8/10393
  150.   patch -Np1 -d v8 <../v8-remove-soon-to-be-removed-getAllFieldPositions.patch
  151.  
  152.   # https://crbug.com/skia/6663#c10
  153.   patch -Np0 -i ../chromium-skia-harmony.patch
  154.  
  155.   # Fixes from Gentoo
  156.   patch -Np1 -i ../chromium-83-gcc-10.patch
  157.  
  158.   # Fix VA-API on Nvidia
  159.   patch -Np1 -i ../vdpau-support.patch
  160.  
  161.   patch -Np1 -i ../enable-chromecast-by-default.patch
  162.   patch -Np1 -i ../enable-vaapi-on-linux.diff
  163.   patch -Np1 -i ../notifications-nicer.patch
  164.   patch -Np1 -i ../gn-link-with-libc.patch
  165.   patch -Np1 -i ../widevine-allow-on-linux.patch
  166.   patch -Np1 -i ../fix-build-errors.patch
  167.   patch -Np1 -i ../widevine-other-locations.patch
  168.  
  169.   patch -Np1 -i ../chromium-fix-vaapi-on-intel.patch
  170.  
  171.   # Force script incompatible with Python 3 to use /usr/bin/python2
  172.   sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py
  173.  
  174.   mkdir -p third_party/node/linux/node-linux-x64/bin
  175.   ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
  176.  
  177.   # Remove bundled libraries for which we will use the system copies; this
  178.   # *should* do what the remove_bundled_libraries.py script does, with the
  179.   # added benefit of not having to list all the remaining libraries
  180.   local _lib
  181.   for _lib in ${_unwanted_bundled_libs[@]}; do
  182.     find "third_party/$_lib" -type f \
  183.       \! -path "third_party/$_lib/chromium/*" \
  184.       \! -path "third_party/$_lib/google/*" \
  185.       \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
  186.       \! -path 'third_party/yasm/run_yasm.py' \
  187.       \! -regex '.*\.\(gn\|gni\|isolate\)' \
  188.       -delete
  189.   done
  190.  
  191.   python2 build/linux/unbundle/replace_gn_files.py \
  192.     --system-libraries "${!_system_libs[@]}"
  193. }
  194.  
  195. build() {
  196.   make -C chromium-launcher-$_launcher_ver
  197.  
  198.   cd "$srcdir/chromium-$pkgver"
  199.  
  200.   if check_buildoption ccache y; then
  201.     # Avoid falling back to preprocessor mode when sources contain time macros
  202.     export CCACHE_SLOPPINESS=time_macros
  203.   fi
  204.  
  205.   export CC=clang
  206.   export CXX=clang++
  207.   export AR=ar
  208.   export NM=nm
  209.  
  210.   local _flags=(
  211.     'custom_toolchain="//build/toolchain/linux/unbundle:default"'
  212.     'host_toolchain="//build/toolchain/linux/unbundle:default"'
  213.     'clang_use_chrome_plugins=false'
  214.     'is_official_build=true' # implies is_cfi=true on x86_64
  215.     'treat_warnings_as_errors=false'
  216.     'fieldtrial_testing_like_official_build=true'
  217.     'ffmpeg_branding="Chrome"'
  218.     'proprietary_codecs=true'
  219.     'rtc_use_pipewire=true'
  220.     'link_pulseaudio=true'
  221.     'use_gnome_keyring=false'
  222.     'use_sysroot=false'
  223.     'linux_use_bundled_binutils=false'
  224.     'use_custom_libcxx=false'
  225.     'enable_hangout_services_extension=true'
  226.     'enable_widevine=true'
  227.     'use_vaapi=true'
  228.     'enable_nacl=false'
  229.     'enable_swiftshader=false'
  230.     "google_api_key=\"${_google_api_key}\""
  231.     "google_default_client_id=\"${_google_default_client_id}\""
  232.     "google_default_client_secret=\"${_google_default_client_secret}\""
  233.   )
  234.  
  235.   if [[ -n ${_system_libs[icu]+set} ]]; then
  236.     _flags+=('icu_use_data_file=false')
  237.   fi
  238.  
  239.   if check_option strip y; then
  240.     _flags+=('symbol_level=0')
  241.   fi
  242.  
  243.   # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
  244.   CFLAGS+='   -Wno-builtin-macro-redefined'
  245.   CXXFLAGS+=' -Wno-builtin-macro-redefined'
  246.   CPPFLAGS+=' -D__DATE__=  -D__TIME__=  -D__TIMESTAMP__='
  247.  
  248.   # Do not warn about unknown warning options
  249.   CFLAGS+='   -Wno-unknown-warning-option'
  250.   CXXFLAGS+=' -Wno-unknown-warning-option'
  251.  
  252.   gn gen out/Release --args="${_flags[*]}" --script-executable=/usr/bin/python2
  253.   ninja  -C out/Release chrome chrome_sandbox chromedriver
  254. }
  255.  
  256. package() {
  257.   cd chromium-launcher-$_launcher_ver
  258.   make PREFIX=/usr DESTDIR="$pkgdir" install
  259.   install -Dm644 LICENSE \
  260.     "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher"
  261.  
  262.   cd "$srcdir/chromium-$pkgver"
  263.  
  264.   install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"
  265.   install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox"
  266.   ln -s /usr/lib/chromium/chromedriver "$pkgdir/usr/bin/chromedriver"
  267.  
  268.   install -Dm644 ../chromium-drirc-disable-10bpc-color-configs.conf \
  269.     "$pkgdir/usr/share/drirc.d/10-$pkgname.conf"
  270.  
  271.   install -Dm644 chrome/installer/linux/common/desktop.template \
  272.     "$pkgdir/usr/share/applications/chromium.desktop"
  273.   install -Dm644 chrome/app/resources/manpage.1.in \
  274.     "$pkgdir/usr/share/man/man1/chromium.1"
  275.   sed -i \
  276.     -e "s/@@MENUNAME@@/Chromium/g" \
  277.     -e "s/@@PACKAGE@@/chromium/g" \
  278.     -e "s/@@USR_BIN_SYMLINK_NAME@@/chromium/g" \
  279.     "$pkgdir/usr/share/applications/chromium.desktop" \
  280.     "$pkgdir/usr/share/man/man1/chromium.1"
  281.  
  282.   cp \
  283.     out/Release/{chrome_{100,200}_percent,resources}.pak \
  284.     out/Release/{*.bin,chromedriver} \
  285.     "$pkgdir/usr/lib/chromium/"
  286.   install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
  287.  
  288.   if [[ -z ${_system_libs[icu]+set} ]]; then
  289.     cp out/Release/icudtl.dat "$pkgdir/usr/lib/chromium/"
  290.   fi
  291.  
  292.   for size in 24 48 64 128 256; do
  293.     install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
  294.       "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  295.   done
  296.  
  297.   for size in 16 32; do
  298.     install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
  299.       "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
  300.   done
  301.  
  302.   install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
  303. }
  304.  
  305. # vim:set ts=2 sw=2 et:
Add Comment
Please, Sign In to add comment