Guest User

Experimental PKGBUILD for chromium-dev AUR package

a guest
May 5th, 2021
648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 30.68 KB | None | 0 0
  1. # Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com>
  2. # Contributor: Mikhail Vorozhtsov <mikhail.vorozhtsov@gmail.com>
  3. # Contributor: Nagisa <simonas@kazlauskas.me>
  4. # Contributor: Misc <andreas.reis@gmail.com>
  5. # Contributor: Jeagoss <jgoliver@jeago.com>
  6. # Contributor: Saikrishna Arcot <saiarcot895@gmail.com> and Steven Newbury <steve@snewbury.org.uk> (First Authors of VAAPI patch)
  7.  
  8. #########################
  9. ## -- Build options -- ##
  10. #########################
  11.  
  12. _use_wayland=0           # Build Wayland NOTE: extremely experimental and don't work at this moment
  13.  
  14. ##############################################
  15. ## -- Package and components information -- ##
  16. ##############################################
  17. pkgname=chromium-dev
  18. pkgver=92.0.4498.0
  19. pkgrel=1
  20. pkgdesc="The open-source project behind Google Chrome (Dev Channel)"
  21. arch=('x86_64')
  22. url='http://www.chromium.org'
  23. license=('BSD')
  24. depends=(
  25. #          'libsrtp'
  26.          'libxslt'
  27.          'libxss'
  28. #          'minizip'
  29.          'nss'
  30.          'pciutils'
  31.          're2'
  32.          'snappy'
  33.          'xdg-utils'
  34. #          'protobuf'
  35. #          'libevent'
  36. #          'ffmpeg'
  37.          'icu'       # https://crbug.com/678661.
  38.          'gtk3'
  39.          'openh264'
  40.          'vulkan-icd-loader'
  41.          'libpulse'
  42.          'libwebp'
  43. #          'libvpx'
  44.          'libva'
  45.          'opus'
  46.          'bluez-libs'
  47.          'libnet'
  48.          )
  49. if [ "${_use_wayland}" = "1" ]; then
  50.   depends+=('pipewire')
  51. fi
  52. makedepends=(
  53.              'gperf'
  54.              'ninja'
  55.              'python-protobuf'
  56.              'python-setuptools'
  57.              'python'
  58.              'python2' # for Nacl
  59.              'yasm'
  60.              'nasm'
  61.              'git'
  62.              'hwids'
  63.              'nodejs'
  64.              'java-runtime-headless'
  65.              )
  66. optdepends=(
  67.             'pepper-flash: PPAPI Flash Player'
  68.             'chromium-widevine: Widevine plugin (eg: Netflix)'
  69.             #
  70.             'kdialog: Needed for file dialogs in KF5'
  71.             'kwalletmanager: Needed for storing passwords in KWallet5'
  72.             'org.freedesktop.secrets: password storage backend on GNOME / Xfce'
  73.             #
  74.             'ttf-font: For some typography'
  75.             )
  76. source=(
  77.         #"https://gsdview.appspot.com/chromium-browser-official/chromium-${pkgver}.tar.xz"
  78.         "https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${pkgver}.tar.xz"
  79.         # "chromium-browser-official/chromium-${pkgver}.tar.xz"
  80.         'git+https://github.com/foutrelis/chromium-launcher.git'
  81.         'chromium-dev.svg'
  82.         # Patch from Gentoo.
  83.         'https://raw.githubusercontent.com/gentoo/gentoo/master/www-client/chromium/files/chromium-89-EnumTable-crash.patch'
  84.         'https://raw.githubusercontent.com/gentoo/gentoo/master/www-client/chromium/files/chromium-shim_headers.patch'
  85.         # Misc Patches.
  86.         'fix_hevc_in_non_cromeos_r1.patch'
  87.         # Patch from crbug.com (chromium bugtracker), chromium-review.googlesource.com / Gerrit or Arch chromium package.
  88.         'https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/chromium/trunk/use-oauth2-client-switches-as-default.patch'
  89.         )
  90. sha256sums=(
  91.             #"$(curl -sL https://gsdview.appspot.com/chromium-browser-official/chromium-${pkgver}.tar.xz.hashes | grep sha256 | cut -d ' ' -f3)"
  92.             "$(curl -sL https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${pkgver}.tar.xz.hashes | grep sha256 | cut -d ' ' -f3)"
  93.             'SKIP'
  94.             'dd2b5c4191e468972b5ea8ddb4fa2e2fa3c2c94c79fc06645d0efc0e63ce7ee1'
  95.             # Namespace Patch
  96.             # '1d6e9c9d6d4e9f68e0f8f4472d29695f28d8f321f53ab20ba72a7bd0178cde25'
  97.             # WebRTC patch
  98.             # '47f73ea6a3c75ca43c72d90c8de25786950b932afaf0ea4a9323d39150a2a4d9'
  99.             # Patch from Gentoo
  100.             '61066e638ee795e888d12cc2c4af42c8cf3fe9f473b1dc0b78c9e87faf5eacda'
  101.             'fabf66cfb15449011a20e377d600573b6338cc4c52e3f28f80e0541772659e8b'
  102.             # Misc Patches
  103.              '70f7a1736aabd63bbdf5060c015b220ede7d5d19837408eb4a5172099aecd862'
  104.             # 9d685d75c9384ebd4a0976796db607b36d8500c97fb5f1fb572b0356a3b39987
  105.             # Patch from crbug (chromium bugtracker) or Arch chromium package
  106.             'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711'
  107.             )
  108. install=chromium-dev.install
  109.  
  110. ################################################
  111. ## -- Don't touch anything below this line -- ##
  112. ################################################
  113.  
  114. # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
  115. # NOTE: These are for Arch Linux use ONLY. For your own distribution, please
  116. # get your own set of keys. Feel free to contact foutrelis@archlinux.org for
  117. # more information.
  118. #
  119. _google_api_key="AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM"
  120. #_google_default_client_id="413772536636.apps.googleusercontent.com"
  121. #_google_default_client_secret="0ZChLK6AxeA3Isu96MkwqDR4"
  122. #
  123. # from https://gist.github.com/foutrelis/14e339596b89813aa9c37fd1b4e5d9d5
  124. _google_default_client_id="77185425430.apps.googleusercontent.com"
  125. _google_default_client_secret="OTJgUOQcT7lO7GsGZq2G4IlT"
  126. #
  127.  
  128. # List of third-party components needed for building chromium. The rest is removed by remove_bundled_libraries script in prepare().
  129. _keeplibs=(
  130.            'base/third_party/cityhash'
  131.            'base/third_party/double_conversion'
  132.            'base/third_party/dynamic_annotations'
  133. #           'base/third_party/icu'
  134.            'base/third_party/nspr'
  135.            'base/third_party/superfasthash'
  136.            'base/third_party/symbolize'
  137.            'base/third_party/valgrind'
  138.            'base/third_party/xdg_mime'
  139.            'base/third_party/xdg_user_dirs'
  140.            'buildtools/third_party/eu-strip' #neeeded for Chromium 92.0.4493.0
  141.            'buildtools/third_party/libc++'
  142.            'buildtools/third_party/libc++abi'
  143.            'chrome/third_party/mozilla_security_manager'
  144.            'courgette/third_party'
  145.            'native_client/src/third_party/dlmalloc'
  146.            'native_client_sdk/src/libraries/third_party/newlib-extras'
  147.            'net/third_party/mozilla_security_manager'
  148.            'net/third_party/nss'
  149.            'net/third_party/quic'
  150.            'net/third_party/uri_template'
  151.            'third_party/abseil-cpp'
  152.            'third_party/angle'
  153.            'third_party/angle/src/common/third_party/base'
  154.            'third_party/angle/src/common/third_party/smhasher'
  155.            'third_party/angle/src/common/third_party/xxhash'
  156.            'third_party/angle/src/third_party/compiler'
  157.            'third_party/angle/src/third_party/libXNVCtrl'
  158.            'third_party/angle/src/third_party/trace_event'
  159.            'third_party/angle/src/third_party/volk'
  160.            'third_party/apple_apsl'
  161.            'third_party/axe-core'
  162.            'third_party/blink'
  163.            'third_party/boringssl'
  164.            'third_party/boringssl/src/third_party/fiat'
  165.            'third_party/breakpad'
  166.            'third_party/breakpad/breakpad/src/third_party/curl'
  167.            'third_party/brotli'
  168.            'third_party/catapult'
  169.            'third_party/catapult/common/py_vulcanize/third_party/rcssmin'
  170.            'third_party/catapult/common/py_vulcanize/third_party/rjsmin'
  171.            'third_party/catapult/third_party/beautifulsoup4'
  172.            'third_party/catapult/third_party/html5lib-python'
  173.            'third_party/catapult/third_party/polymer'
  174.            'third_party/catapult/third_party/six'
  175.            'third_party/catapult/tracing/third_party/d3'
  176.            'third_party/catapult/tracing/third_party/gl-matrix'
  177.            'third_party/catapult/tracing/third_party/jpeg-js'
  178.            'third_party/catapult/tracing/third_party/jszip'
  179.            'third_party/catapult/tracing/third_party/mannwhitneyu'
  180.            'third_party/catapult/tracing/third_party/oboe'
  181.            'third_party/catapult/tracing/third_party/pako'
  182.            'third_party/ced'
  183.            'third_party/cld_3'
  184.            'third_party/closure_compiler'
  185.            'third_party/crashpad'
  186.            'third_party/crashpad/crashpad/third_party/lss'
  187.            'third_party/crashpad/crashpad/third_party/zlib'
  188.            'third_party/crc32c'
  189.            'third_party/cros_system_api'
  190.            'third_party/dav1d'
  191.            'third_party/dawn'
  192.            'third_party/dawn/third_party/khronos'
  193.            'third_party/dawn/third_party/tint'  # new in Chromium 92
  194.            'third_party/depot_tools'
  195.            'third_party/devscripts'
  196.            'third_party/devtools-frontend'
  197.            'third_party/devtools-frontend/src/front_end/third_party/acorn'
  198.            'third_party/devtools-frontend/src/front_end/third_party/axe-core'
  199.            'third_party/devtools-frontend/src/front_end/third_party/chromium'
  200.            'third_party/devtools-frontend/src/front_end/third_party/codemirror'
  201.            'third_party/devtools-frontend/src/front_end/third_party/diff' # new in Chromium 92
  202.            'third_party/devtools-frontend/src/front_end/third_party/fabricjs'
  203.            'third_party/devtools-frontend/src/front_end/third_party/i18n'
  204.            'third_party/devtools-frontend/src/front_end/third_party/intl-messageformat'
  205.            'third_party/devtools-frontend/src/front_end/third_party/lighthouse'
  206.            'third_party/devtools-frontend/src/front_end/third_party/lit-html'
  207.            'third_party/devtools-frontend/src/front_end/third_party/lodash-isequal'
  208.            'third_party/devtools-frontend/src/front_end/third_party/marked'
  209.            'third_party/devtools-frontend/src/front_end/third_party/puppeteer'
  210.            'third_party/devtools-frontend/src/third_party/typescript' # new in Chromium 92
  211.            'third_party/devtools-frontend/src/front_end/third_party/wasmparser'
  212.            'third_party/devtools-frontend/src/third_party'
  213.            'third_party/devtools-frontend/src/inspector_overlay' # new in Chromium 92
  214.            'third_party/dom_distiller_js'
  215.            'third_party/eigen3'
  216.            'third_party/emoji-segmenter'
  217.            'third_party/farmhash'
  218.            'third_party/fdlibm'
  219.            'third_party/fft2d'
  220.            'third_party/ffmpeg'
  221.            'third_party/flatbuffers'
  222.            'third_party/fontconfig' # to be enabled when using the bundled fontconfig
  223.            'third_party/fusejs'
  224.            'third_party/gemmlowp'
  225.            'third_party/google_input_tools'
  226.            'third_party/google_input_tools/third_party/closure_library'
  227.            'third_party/google_input_tools/third_party/closure_library/third_party/closure'
  228.            'third_party/googletest'
  229.            'third_party/harfbuzz-ng/utils'
  230.            'third_party/highway'
  231.            'third_party/hunspell'
  232.            'third_party/iccjpeg'
  233.            'third_party/inspector_protocol'
  234.            'third_party/jinja2'
  235.            'third_party/jsoncpp'
  236.            'third_party/jstemplate'
  237.            'third_party/khronos'
  238.            'third_party/leveldatabase'
  239.            'third_party/libXNVCtrl'
  240.            'third_party/libaddressinput'
  241.            'third_party/libaom'
  242.            'third_party/libaom/source/libaom/third_party/fastfeat'
  243.            'third_party/libaom/source/libaom/third_party/vector'
  244.            'third_party/libaom/source/libaom/third_party/x86inc'
  245.            'third_party/libavif'
  246.            'third_party/libgav1'
  247.            'third_party/libgifcodec'
  248.            'third_party/libjingle'
  249.            'third_party/libjxl'
  250.            'third_party/libphonenumber'
  251.            'third_party/libsecret'
  252.            'third_party/libsrtp'
  253.            'third_party/libsync'
  254.            'third_party/libudev'
  255.            'third_party/liburlpattern'
  256.            'third_party/libva_protected_content'
  257.            'third_party/libvpx'
  258.            'third_party/libvpx/source/libvpx/third_party/x86inc'
  259.            'third_party/libwebm'
  260.            'third_party/libx11'
  261.            'third_party/libxcb-keysyms'
  262.            'third_party/libxml/chromium'
  263.            'third_party/libyuv'
  264.            'third_party/libzip'
  265.            'third_party/llvm'
  266.            'third_party/lottie'
  267.            'third_party/lss'
  268.            'third_party/lzma_sdk'
  269.            'third_party/mako'
  270.            'third_party/markupsafe'
  271.            'third_party/mesa'
  272.            'third_party/metrics_proto'
  273.            'third_party/minigbm'
  274.            'third_party/modp_b64'
  275.            'third_party/nasm'
  276.            'third_party/nearby'
  277.            'third_party/neon_2_sse'
  278.            'third_party/node'
  279.            'third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2'
  280.            'third_party/one_euro_filter'
  281.            'third_party/opencv'
  282.            'third_party/openscreen'
  283.            'third_party/openscreen/src/third_party/mozilla'
  284.            'third_party/openscreen/src/third_party/tinycbor/src/src'
  285.            'third_party/ots'
  286.            'third_party/pdfium'
  287.            'third_party/pdfium/third_party/agg23'
  288.            'third_party/pdfium/third_party/base'
  289.            'third_party/pdfium/third_party/bigint'
  290.            'third_party/pdfium/third_party/freetype'
  291.            'third_party/pdfium/third_party/lcms'
  292.            'third_party/pdfium/third_party/libopenjpeg20'
  293.            'third_party/pdfium/third_party/libpng16'
  294.            'third_party/pdfium/third_party/libtiff'
  295.            'third_party/pdfium/third_party/skia_shared'
  296.            'third_party/perfetto'
  297.            'third_party/perfetto/protos/third_party/chromium'
  298.            'third_party/pffft'
  299.            'third_party/ply'
  300.            'third_party/polymer'
  301.            'third_party/private-join-and-compute'
  302.            'third_party/private_membership'
  303.            'third_party/protobuf'
  304.            'third_party/protobuf/third_party/six'
  305.            'third_party/pyjson5'
  306.            'third_party/qcms'
  307.            'third_party/re2'
  308.            'third_party/rnnoise'
  309.            'third_party/s2cellid'
  310.            'third_party/securemessage'
  311.            'third_party/shell-encryption'
  312.            'third_party/simplejson'
  313.            'third_party/skia'
  314.            'third_party/skia/include/third_party/skcms'
  315.            'third_party/skia/include/third_party/vulkan'
  316.            'third_party/skia/third_party/skcms'
  317.            'third_party/skia/third_party/vulkan'
  318.            'third_party/smhasher'
  319.            'third_party/sqlite'
  320.            'third_party/swiftshader'
  321.            'third_party/swiftshader/third_party/astc-encoder'
  322.            'third_party/swiftshader/third_party/llvm-subzero'
  323.            'third_party/swiftshader/third_party/marl'
  324.            'third_party/swiftshader/third_party/subzero'
  325.            'third_party/swiftshader/third_party/SPIRV-Headers/include/spirv/unified1'
  326.            'third_party/tensorflow-text'
  327.            'third_party/tflite'
  328.            'third_party/tflite/src/third_party/eigen3'
  329.            'third_party/tflite/src/third_party/fft2d'
  330.            'third_party/tflite-support'
  331.            'third_party/tcmalloc'
  332. #           'third_party/tint'
  333.            'third_party/ruy'
  334.            'third_party/ukey2'
  335.            'third_party/unrar'
  336.            'third_party/usrsctp'
  337.            'third_party/utf'
  338.            'third_party/vulkan'
  339.            'third_party/wayland'
  340.            'third_party/web-animations-js'
  341.            'third_party/webdriver'
  342.            'third_party/webgpu-cts'
  343.            'third_party/webrtc'
  344.            'third_party/webrtc/call'      # needed for Chromium 92.0.4496.0
  345.            'third_party/webrtc/common_audio/third_party/ooura'
  346.            'third_party/webrtc/common_audio/third_party/spl_sqrt_floor'
  347.            'third_party/webrtc/modules/third_party/fft'
  348.            'third_party/webrtc/modules/third_party/g711'
  349.            'third_party/webrtc/modules/third_party/g722'
  350.            'third_party/webrtc/rtc_base/third_party/base64'
  351.            'third_party/webrtc/rtc_base/third_party/sigslot'
  352.            'third_party/widevine'
  353.            'third_party/woff2'
  354.            'third_party/wuffs'
  355.            'third_party/x11proto'
  356.            'third_party/xcbproto'
  357.            'third_party/zxcvbn-cpp'       # causes compile errors
  358.            'third_party/zlib' # /google
  359.            'tools/grit/third_party/six'
  360.            'url/third_party/mozilla'
  361.            'v8/src/third_party/siphash'
  362.            'v8/src/third_party/valgrind'
  363.            'v8/src/third_party/utf8-decoder'
  364.            'v8/third_party/inspector_protocol'
  365.            'v8/third_party/v8'
  366.  
  367.            # gyp -> gn leftovers.
  368.            'base/third_party/libevent'
  369.            'third_party/speech-dispatcher'
  370.            'third_party/usb_ids'
  371.            'third_party/xdg-utils'
  372. #           'third_party/xstream'
  373.            )
  374.  
  375. #_keeplibs+=(
  376. #            'third_party/icu' # https://crbug.com/678661.
  377. #            )
  378.  
  379. if [ "${_use_wayland}" = "1" ]; then
  380.   _keeplibs+=(
  381.               'third_party/minigbm'
  382.              )
  383. fi
  384.  
  385. # Set build flags.
  386. _flags=(
  387.         "custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
  388.         "host_toolchain=\"//build/toolchain/linux/unbundle:default\""
  389.         "target_os=\"linux\""
  390.         'is_debug=false'
  391.         'is_official_build=false'
  392.         'is_component_build=true'
  393.         'enable_widevine=true'
  394.         'enable_hangout_services_extension=true'
  395.         "ffmpeg_branding=\"ChromeOS\""
  396.         'proprietary_codecs=true'
  397.         "google_api_key=\"${_google_api_key}\""
  398.         "google_default_client_id=\"${_google_default_client_id}\""
  399.         "google_default_client_secret=\"${_google_default_client_secret}\""
  400.         'fieldtrial_testing_like_official_build=true'
  401.         'blink_symbol_level=0'
  402.         'use_aura=true'
  403.         'use_gio=false'
  404.         'use_gnome_keyring=false'
  405.         'link_pulseaudio=true'
  406.         'use_sysroot=false'
  407.         'treat_warnings_as_errors=false'
  408.         'enable_nacl=true'
  409.         'enable_nacl_nonsfi=true'
  410. # Most developers don't normally need to test Native Client capabilities and can speed up the build by disabling it.
  411. #        'enable_nacl=false'
  412. #        'enable_nacl_nonsfi=false'
  413.         'use_custom_libcxx=false' # use true if you want use bundled RE2
  414.         'use_vaapi=true'
  415.         'enable_platform_hevc=true'
  416.         'enable_platform_ac3_eac3_audio=true'
  417.         'enable_platform_mpeg_h_audio=true'
  418.         'enable_platform_dolby_vision=true'
  419.         'enable_mse_mpeg2ts_stream_parser=true'
  420.         'clang_use_chrome_plugins=true'
  421.         'use_gold=false'
  422.         'use_dbus=true'
  423.         'use_ozone=true'
  424.         'ozone_auto_platforms=false'
  425.         'ozone_platform_headless=true'
  426.         'use_thin_lto=false'
  427.         )
  428.  
  429. if [ "${_use_wayland}" = "1" ]; then
  430.   _flags+=(
  431.            'ozone_platform_wayland=true'
  432.            'use_xkbcommon=true'
  433.            'use_system_libdrm=true'
  434.            'use_system_libwayland=true'
  435.            'use_v4l2_codec=true'
  436.            "ozone_platform=\"wayland\""
  437.            'rtc_use_pipewire=true'
  438.            'rtc_link_pipewire=true'
  439.            'rtc_pipewire_version="0.3"' # will be the default in Chromium 90
  440.            )
  441. fi
  442.  
  443. # Set the bundled/external components.
  444. # TODO: need ported to GN as GYP doing before. see status page: https://crbug.com/551343.
  445. _use_system=(
  446.              'ffmpeg'        # I'm not sure why, but all videos stop playback if use system ffmpeg.
  447.              'flac'
  448. #             'fontconfig'   # no fonts when default sandbox is used.
  449.              'freetype'
  450.              'harfbuzz-ng'
  451.              'icu'          # use bundled version if compile fails: https://crbug.com/678661.
  452.              'libdrm'
  453. #             'libevent'     # Use the bundled version if there are segfaults and other problems https://bugs.gentoo.org/593458.
  454.              'libjpeg'
  455.              'libpng'
  456. #             'libvpx'       # Use bundled version in case of compile errors
  457.              'libwebp'
  458.              'libxml'
  459.              'libxslt'
  460.              'openh264'
  461.              'opus'
  462.              're2'
  463.              'snappy'
  464. #              'yasm'
  465. #              'zlib'         # NaCL needs it
  466.              )
  467.  
  468. # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn).
  469. CFLAGS+=' -Wno-builtin-macro-redefined'
  470. CXXFLAGS+=' -Wno-builtin-macro-redefined'
  471. CPPFLAGS+=' -D__DATE__=  -D__TIME__=  -D__TIMESTAMP__='
  472.  
  473. # Conditionals.
  474. if check_option strip y; then
  475.   _flags+=(
  476.            'symbol_level=0'
  477.            )
  478. fi
  479.  
  480. if check_buildoption ccache y; then
  481.   # Avoid falling back to preprocessor mode when sources contain time macros.
  482.   export CCACHE_CPP2=yes
  483.   export CCACHE_SLOPPINESS=time_macros
  484. fi
  485.  
  486. if [ ! -f "${BUILDDIR}/PKGBUILD" ]; then
  487.   _builddir="/${pkgname}"
  488. fi
  489.  
  490. _clang_path="${BUILDDIR}${_builddir}/src/chromium-${pkgver}/third_party/llvm-build/Release+Asserts/bin/"
  491.  
  492. export FC_CONFIG_FILE="/etc/fonts/fonts.conf"
  493. export FC_CONFIG_DIR="/etc/fonts"
  494. export CC="${_clang_path}clang"
  495. export CXX="${_clang_path}clang++"
  496. export AR="${_clang_path}llvm-ar"
  497. export NM=nm
  498. export RANLIB=/usr/bin/true
  499. _lld="ld.lld"
  500.  
  501.  
  502. ################################################
  503.  
  504. prepare() {
  505.   cd "${srcdir}/chromium-${pkgver}"
  506.  
  507.   # Force script incompatible with Python 3 to use /usr/bin/python2.
  508.    sed -e '1s|python$|&2|' \
  509.      -i third_party/ffmpeg/chromium/scripts/generate_gn.py \
  510.      -i third_party/dom_distiller_js/protoc_plugins/json_values_converter.py \
  511.      -i third_party/dom_distiller_js/protoc_plugins/json_values_converter_tests.py
  512.  
  513.   # Py3toniced.
  514.   2to3 -w --no-diff build/linux/unbundle/remove_bundled_libraries.py
  515.   2to3 -w --no-diff third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
  516.  
  517.   # Remove most bundled libraries. Some are still needed.
  518.   echo "Removing unnecessary components to save disk space: "
  519.   build/linux/unbundle/remove_bundled_libraries.py ${_keeplibs[@]} --do-remove
  520.  
  521.   echo "Changing bundle libraries to system ones."
  522.   build/linux/unbundle/replace_gn_files.py --system-libraries ${_use_system[@]}
  523.  
  524.   echo "Setup NaCl/PNaCl SDK: Download and install toolchains"
  525.   build/download_nacl_toolchains.py --packages nacl_x86_newlib,pnacl_newlib,pnacl_translator sync --extract
  526.  
  527.   echo "Download prebuild clang from Google"
  528.   tools/clang/scripts/update.py
  529.  
  530.   # Use chromium-dev as brand name.
  531.   sed -e 's|=Chromium|&-dev|g' \
  532.       -i chrome/app/theme/chromium/BRANDING
  533.   sed -e '0,/output_name = "chrome"/s/= "chrome"/= "chromium-dev"/' \
  534.       -e 's|root_out_dir/chrome"|root_out_dir/chromium-dev"|g' \
  535.       -i chrome/BUILD.gn
  536.   sed -e 's|"chromium-browser"|"chromium-dev"|g' \
  537.       -i media/audio/pulse/pulse_util.cc
  538.   sed -e 's|"Chromium|&-dev|g' \
  539.       -i chrome/common/chrome_constants.cc
  540.   sed -e 's|chromium-browser|chromium-dev|g' \
  541.       -i chrome/browser/shell_integration_linux.cc \
  542.       -i ui/gtk/gtk_util.cc
  543.   sed -e 's|chromium|&-dev|' \
  544.       -i chrome/common/chrome_paths_linux.cc
  545.   sed -e 's|/etc/chromium|&-dev|' \
  546.       -e 's|/usr/share/chromium|&-dev|' \
  547.       -i chrome/common/chrome_paths.cc
  548.   sed -e 's|/etc/chromium|&-dev|' \
  549.       -e "s|'app_name': 'Chromium|&-dev|g" \
  550.       -i components/policy/tools/template_writers/writer_configuration.py
  551.  
  552. # Fix(?) the name of the sandbox.
  553. #  sed -e 's|chrome-sandbox|chrome_sandbox|g'\
  554. #      -i sandbox/linux/suid/client/setuid_sandbox_host.cc
  555.  
  556.   # If use ccache, set it.
  557.   if check_buildoption ccache y; then
  558.     sed '36s|""|'ccache'|g' -i build/toolchain/cc_wrapper.gni
  559.   fi
  560.  
  561.   echo "Patching the sources"
  562.  
  563.   # Misc patches.
  564.  
  565.   # Patch to chromium dev's about why always they forget add/remove missing build rules.
  566.   # Not this time (?).
  567.  
  568.   # Allow building against system libraries in official builds.
  569.   sed 's|OFFICIAL_BUILD|GOOGLE_CHROME_BUILD|' \
  570.     -i tools/generate_shim_headers/generate_shim_headers.py
  571.  
  572.   # https://crbug.com/893950.
  573.   sed -e 's/\<xmlMalloc\>/malloc/' \
  574.       -e 's/\<xmlFree\>/free/' \
  575.       -i third_party/blink/renderer/core/xml/*.cc \
  576.       -i third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
  577.       -i third_party/libxml/chromium/libxml_utils.cc
  578.  
  579.   # Fix Java assertion (https://groups.google.com/a/chromium.org/g/chromium-checkins/c/gEBqCY8Bqrc?pli=1)
  580.   ln -sf /usr/bin/java third_party/jdk/current/bin/java
  581.  
  582.   # Fix build if enable HEVC in non-chromeOS system
  583.   echo "Fix HEVC in non-ChromeOS"
  584.   patch -p1 -i "${srcdir}/fix_hevc_in_non_cromeos_r1.patch"
  585.  
  586.   # # Patch from Gentoo
  587.   echo "Patches from Gentoo:"
  588.   echo "1. EnumTable Crash"
  589.   patch -p1 -i "${srcdir}/chromium-89-EnumTable-crash.patch"
  590.   echo "2. Shim Headers"
  591.   patch -p1 -i "${srcdir}/chromium-shim_headers.patch"
  592.  
  593.   # # Patch from crbug.com (chromium bugtracker), chromium-review.googlesource.com / Gerrit or Arch chromium package.
  594.   # Use the --oauth2-client-id= and --oauth2-client-secret= switches for
  595.   # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
  596.   # runtime -- this allows signing into Chromium without baked-in values
  597.   echo "Use OAuth2 client switches as default"
  598.   patch -p1 -i "${srcdir}/use-oauth2-client-switches-as-default.patch"
  599.  
  600.   # Setup nodejs dependency.
  601.   mkdir -p third_party/node/linux/node-linux-x64/bin/
  602.   ln -sf /usr/bin/node third_party/node/linux/node-linux-x64/bin/node
  603.  
  604.   # Use the file at run time instead of effectively compiling it in.
  605.   sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' -i services/device/usb/BUILD.gn
  606.  
  607.   # Setup the linker in chromium.
  608.   sed "s|-fuse-ld=lld|-fuse-ld=${_clang_path}${_lld}|g" \
  609.     -i third_party/ffmpeg/chromium/scripts/build_ffmpeg.py \
  610.     -i build/config/compiler/BUILD.gn
  611.  
  612.   # Setup bundled ffmpeg.
  613.   # Add build verbose output.
  614.   # setup all cores
  615.   sed -e "s|'make', '-j|'make', 'V=1', '-j|g" \
  616.       -e "s|parallel_jobs = 8|parallel_jobs = $(nproc)|g" \
  617.       -i third_party/ffmpeg/chromium/scripts/build_ffmpeg.py
  618.   # Use system opus.
  619.   rm -fr third_party/opus/src/include
  620.   ln -sf /usr/include/opus/ third_party/opus/src/include
  621. }
  622.  
  623. build() {
  624.   # set python 2 for build pnacl.
  625.   export PNACLPYTHON=/usr/bin/python2
  626.  
  627.   echo "Build the Launcher"
  628.   make -C chromium-launcher \
  629.     CHROMIUM_SUFFIX="-dev"
  630.  
  631.   cd "chromium-${pkgver}"
  632.  
  633.   #echo ${_flags[@]}
  634.  
  635.   echo "Build bundled ffmpeg"
  636.   pushd third_party/ffmpeg &> /dev/null
  637.   # Disable lto.
  638.   # NOTE: This avoid messages like:
  639.   # bfd plugin: LLVM gold plugin has failed to create LTO module: Unknown attribute kind (60) (Producer: 'LLVM9.0.0svn' Reader: 'LLVM 8.0.0')
  640.   # when you have installed clang in the system.
  641.   # Use bundled clang
  642.   chromium/scripts/build_ffmpeg.py linux x64 --branding ChromeOS -- \
  643.     --disable-lto \
  644.     --cc="${_clang_path}clang" \
  645.     --cxx="${_clang_path}clang++" \
  646.     --ld="${_clang_path}clang" \
  647.     --ar="${_clang_path}llvm-ar" \
  648. #     --disable-asm
  649.  
  650.   chromium/scripts/copy_config.sh
  651.   chromium/scripts/generate_gn.py
  652.   popd &> /dev/null
  653.  
  654.   # new chromium seems not like this flag. see base/allocator/allocator_shim.cc:408
  655.   CFLAGS="${CFLAGS/-fexceptions/}"
  656.   CXXFLAGS="${CXXFLAGS/-fexceptions/}"
  657.  
  658.   echo "Starting building Chromium..."
  659.   LC_ALL=C buildtools/linux64/gn gen out/Release -v --args="${_flags[*]}" --script-executable=/usr/bin/python
  660.  
  661.   # Build all.
  662.   LC_ALL=C ninja -C out/Release -v chrome chrome_sandbox chromedriver
  663. }
  664.  
  665. package() {
  666.   options=('!strip')
  667.  
  668.   # Install launcher.
  669.   make -C chromium-launcher \
  670.     PREFIX=/usr \
  671.     CHROMIUM_SUFFIX="-dev" \
  672.     DESTDIR="${pkgdir}" \
  673.     install
  674.   install -Dm644 "chromium-launcher/LICENSE" "${pkgdir}/usr/share/licenses/chromium-dev/LICENSE.launcher"
  675.   strip $STRIP_BINARIES "${pkgdir}/usr/bin/chromium-dev"
  676.  
  677.   pushd "chromium-${pkgver}/out/Release" &> /dev/null
  678.  
  679.   # Install binaries.
  680.   _bin=(
  681.         'chromium-dev'
  682.         'chrome_sandbox'
  683.         'chromedriver'
  684.         'crashpad_handler'
  685.         )
  686.   for i in "${_bin[@]}"; do
  687.     case "$i" in
  688.       chrome_sandbox)
  689.         install -Dm4755 "${i}" "${pkgdir}/usr/lib/chromium-dev/${i}"
  690.         ;;
  691.       *)
  692.         install -Dm755 "${i}" "${pkgdir}/usr/lib/chromium-dev/${i}"
  693.         ;;
  694.     esac
  695.   strip $STRIP_BINARIES "${pkgdir}/usr/lib/chromium-dev/${i}"
  696.   done
  697.  
  698.   ln -sf /usr/lib/chromium-dev/chromedriver "${pkgdir}/usr/bin/chromedriver-dev"
  699.  
  700.   # Install libs.
  701.   for i in lib*.so swiftshader/lib*.so; do
  702.     install -Dm755 "${i}" "${pkgdir}/usr/lib/chromium-dev/${i}"
  703.     strip $STRIP_SHARED "${pkgdir}/usr/lib/chromium-dev/${i}"
  704.   done
  705.  
  706.   _blobs=(
  707.           'snapshot_blob.bin'
  708.           'v8_context_snapshot.bin'
  709.           'icudtl.dat' # https://crbug.com/678661.
  710.           'MEIPreload/manifest.json'
  711.           'MEIPreload/preloaded_data.pb'
  712.           'vk_swiftshader_icd.json'
  713.           )
  714.  
  715.   if [ "${_use_wayland}" = "0" ]; then
  716.     _blobs+=(
  717.              'angledata/VkICD_mock_icd.json'
  718.              )
  719.   fi
  720.  
  721.   for i in "${_blobs[@]}"; do
  722.     install -Dm644 "${i}" "${pkgdir}/usr/lib/chromium-dev/${i}"
  723.   done
  724.  
  725.   # Install NaCL.
  726.   _nacl_libs=(
  727.               'nacl_helper'
  728.               'nacl_helper_bootstrap'
  729.               'nacl_helper_nonsfi'
  730.               'nacl_irt_x86_64.nexe'
  731.               )
  732.   for i in "${_nacl_libs[@]}"; do
  733.     install -Dm755 "${i}" "${pkgdir}/usr/lib/chromium-dev/${i}"
  734.     case "$i" in
  735.       nacl_irt_x86_64.nexe)
  736.         ;;
  737.       *)
  738.         strip $STRIP_BINARIES "${pkgdir}/usr/lib/chromium-dev/${i}"
  739.         ;;
  740.     esac
  741.   done
  742.  
  743.   # Install Resources.
  744.   _resources=(
  745.               'chrome_100_percent.pak'
  746.               'chrome_200_percent.pak'
  747.               'headless_lib.pak'
  748.               'resources.pak'
  749.               )
  750.   for i in "${_resources[@]}"; do
  751.     install -Dm644 "${i}" "${pkgdir}/usr/lib/chromium-dev/${i}"
  752.   done
  753.  
  754.   # Set info.
  755.   source "${srcdir}/chromium-${pkgver}/chrome/installer/linux/common/installer.include"
  756.   PACKAGE=chromium-dev
  757.   PROGNAME=chromium-dev
  758.   MENUNAME="Chromium-dev Web Browser"
  759.   USR_BIN_SYMLINK_NAME=chromium-dev
  760.   # Install .desktop and manpages.
  761.   process_template "${srcdir}/chromium-${pkgver}/chrome/app/resources/manpage.1.in" chromium-dev.1
  762.   install -Dm644 chromium-dev.1 "${pkgdir}/usr/share/man/man1/chromium-dev.1"
  763.   process_template "${srcdir}/chromium-${pkgver}/chrome/installer/linux/common/desktop.template" chromium-dev.desktop
  764.   install -Dm644 chromium-dev.desktop "${pkgdir}/usr/share/applications/chromium-dev.desktop"
  765.  
  766.   # Install locales.
  767.   install -Dm644 locales/*.pak -t "${pkgdir}/usr/lib/chromium-dev/locales"
  768.  
  769.   # Install icons.
  770.   for _size in 16 24 32 48 64 128 256; do
  771.     case "${_size}" in
  772.       16|32) _branding="${srcdir}/chromium-${pkgver}/chrome/app/theme/default_100_percent/chromium" ;;
  773.       *) _branding="${srcdir}/chromium-${pkgver}/chrome/app/theme/chromium" ;;
  774.     esac
  775.     install -Dm644 "${_branding}/product_logo_${_size}.png" "${pkgdir}/usr/share/icons/hicolor/${_size}x${_size}/apps/chromium-dev.png"
  776.   done
  777.   install -Dm644 "${srcdir}/chromium-dev.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/chromium-dev.svg"
  778.  
  779.   popd &> /dev/null
  780.  
  781.   # Install License.
  782.   install -Dm644 "chromium-${pkgver}/LICENSE" "${pkgdir}/usr/share/licenses/chromium-dev/LICENSE"
  783. }
  784.  
Add Comment
Please, Sign In to add comment