123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- # Maintainer: Noah Vogt (noahvogt) <noah@noahvogt.com>
- # Maintainer: Bruno Pagani <archange@archlinux.org>
- # Maintainer: Caleb Maclennan <caleb@alerque.com>
- # Contributor: Pascal Ernster <archlinux@hardfalcon.net>
- # Contributor: loqs <bugs-archlinux@entropy-collector.net>
- # https://releases.electronjs.org/
- # https://github.com/stha09/chromium-patches/releases
- pkgver=25.9.6
- _chromiumver=114.0.5735.289
- pkgrel=1
- _major_ver=${pkgver%%.*}
- pkgname="electron${_major_ver}"
- pkgdesc='Build cross platform desktop apps with web technologies - without creating a useless ~/.pki directory'
- arch=('x86_64')
- url='https://electronjs.org/'
- license=(MIT custom)
- depends=(c-ares
- gtk3
- libevent
- nss
- libffi)
- makedepends=(clang
- git
- gn
- gperf
- harfbuzz-icu
- http-parser
- java-runtime-headless
- libnotify
- lld
- llvm
- ninja
- npm
- pciutils
- pipewire
- python
- python-httplib2
- python-pyparsing
- python-requests
- python-six
- qt5-base
- wget
- yarn)
- optdepends=('kde-cli-tools: file deletion support (kioclient5)'
- 'pipewire: WebRTC desktop sharing under Wayland'
- 'qt5-base: enable Qt5 with --enable-features=AllowQt'
- 'trash-cli: file deletion support (trash-put)'
- 'xdg-utils: open URLs with desktop’s default (xdg-email, xdg-open)')
- conflicts=("electron${_major_ver}")
- provides=("electron${_major_ver}")
- replaces=("electron${_major_ver}")
- options=('!lto') # Electron adds its own flags for ThinLTO
- source=("git+https://github.com/electron/electron.git#tag=v$pkgver"
- 'git+https://chromium.googlesource.com/chromium/tools/depot_tools.git#branch=main'
- "chromium-mirror::git+https://github.com/chromium/chromium.git#tag=$_chromiumver"
- "electron-launcher.sh"
- "electron.desktop"
- 'default_app-icon.patch'
- 'jinja-python-3.10.patch'
- 'use-system-libraries-in-node.patch'
- 'std-vector-non-const.patch'
- 'libxml2-2.12.patch'
- 'icu-74.patch'
- 'add-some-typename-s-that-are-required-in-C-17.patch'
- 'REVERT-disable-autoupgrading-debug-info.patch'
- 'random-fixes-for-gcc13.patch'
- )
- sha256sums=('SKIP'
- 'SKIP'
- 'SKIP'
- 'b0ac3422a6ab04859b40d4d7c0fd5f703c893c9ec145c9894c468fbc0a4d457c'
- '4484200d90b76830b69eea3a471c103999a3ce86bb2c29e6c14c945bf4102bae'
- 'dd2d248831dd4944d385ebf008426e66efe61d6fdf66f8932c963a12167947b4'
- '55dbe71dbc1f3ab60bf1fa79f7aea7ef1fe76436b1d7df48728a1f8227d2134e'
- 'ff588a8a4fd2f79eb8a4f11cf1aa151298ffb895be566c57cc355d47f161f53f'
- '893bc04c7fceba2f0a7195ed48551d55f066bbc530ec934c89c55768e6f3949c'
- 'bfae9e773edfd0ddbc617777fdd4c0609cba2b048be7afe40f97768e4eb6117e'
- '547e092f6a20ebd15e486b31111145bc94b8709ec230da89c591963001378845'
- '621ed210d75d0e846192c1571bb30db988721224a41572c27769c0288d361c11'
- '1b782b0f6d4f645e4e0daa8a4852d63f0c972aa0473319216ff04613a0592a69'
- 'ba4dd0a25a4fc3267ed19ccb39f28b28176ca3f97f53a4e9f5e9215280040ea0')
- # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
- # Keys are the names in the above script; values are the dependencies in Arch
- declare -gA _system_libs=(
- [brotli]=brotli
- [dav1d]=dav1d
- [ffmpeg]=ffmpeg
- [flac]=flac
- [fontconfig]=fontconfig
- [freetype]=freetype2
- [harfbuzz-ng]=harfbuzz
- [icu]=icu
- [jsoncpp]=jsoncpp
- # [libaom]=aom
- #[libavif]=libavif # https://github.com/AOMediaCodec/libavif/commit/4d2776a3
- [libdrm]=
- [libjpeg]=libjpeg
- [libpng]=libpng
- #[libvpx]=libvpx
- [libwebp]=libwebp
- [libxml]=libxml2
- [libxslt]=libxslt
- [opus]=opus
- #[re2]=re2
- [snappy]=snappy
- [woff2]=woff2
- [zlib]=minizip
- )
- _unwanted_bundled_libs=(
- $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
- )
- depends+=(${_system_libs[@]})
- # add custom patches by extending the bash array, as this is both cleaner
- # and easier to maintain
- source=(${source[@]}
- xdg-basedir.patch)
- sha256sums=(${sha256sums[@]}
- 'a7d9c117e713e8fc68c777fcc046da5dcae7706055d6d1af7555687086ff4266')
- prepare() {
- sed -i "s|@ELECTRON@|${pkgname%-*}|" electron-launcher.sh
- sed -i "s|@ELECTRON@|${pkgname%-*}|" electron.desktop
- sed -i "s|@ELECTRON_NAME@|Electron ${_major_ver}|" electron.desktop
- sed --in-place "/'chromium_version':/{n;s/'[0-9.]\+',/'${_chromiumver}',/}" "${srcdir}/electron/DEPS"
- cat >.gclient <<EOF
- solutions = [
- {
- "name": "src/electron",
- "url": "file://${srcdir}/electron@v$pkgver",
- "deps_file": "DEPS",
- "managed": False,
- "custom_deps": {
- "src": None,
- },
- "custom_vars": {},
- },
- ]
- EOF
- export PATH+=":$PWD/depot_tools" DEPOT_TOOLS_UPDATE=0
- export VPYTHON_BYPASS='manually managed python not supported by chrome operations'
- echo "Linking chromium from sources..."
- ln -s chromium-mirror src
- depot_tools/gclient.py sync -D \
- --nohooks \
- --with_branch_heads \
- --with_tags
- pushd src/electron
- patch -Np1 -i ../../std-vector-non-const.patch
- popd
- echo "Running hooks..."
- # python "${srcdir}/depot_tools/gclient.py" runhooks
- src/build/landmines.py
- src/build/util/lastchange.py -o src/build/util/LASTCHANGE
- src/build/util/lastchange.py -m GPU_LISTS_VERSION \
- --revision-id-only --header src/gpu/config/gpu_lists_version.h
- src/build/util/lastchange.py -m SKIA_COMMIT_HASH \
- -s src/third_party/skia --header src/skia/ext/skia_commit_hash.h
- src/build/util/lastchange.py \
- -s src/third_party/dawn --revision src/gpu/webgpu/DAWN_VERSION
- src/tools/update_pgo_profiles.py --target=linux update \
- --gs-url-base=chromium-optimization-profiles/pgo_profiles
- depot_tools/download_from_google_storage.py --no_resume --extract --no_auth \
- --bucket chromium-nodejs -s src/third_party/node/node_modules.tar.gz.sha1
- # Create sysmlink to system clang-format
- ln -s /usr/bin/clang-format src/buildtools/linux64
- # Create sysmlink to system Node.js
- mkdir -p src/third_party/node/linux/node-linux-x64/bin
- ln -sf /usr/bin/node src/third_party/node/linux/node-linux-x64/bin
- src/electron/script/apply_all_patches.py \
- src/electron/patches/config.json
- pushd src/electron
- yarn install --frozen-lockfile
- pushd ..
- echo "Applying local patches..."
- # move ~/.pki directory to ${XDG_DATA_HOME:-$HOME/.local}/share/pki
- patch -p1 -i ../xdg-basedir.patch
- # Upstream fixes
- patch -Np1 -i "${srcdir}/add-some-typename-s-that-are-required-in-C-17.patch"
- # Revert addition of compiler flag that needs newer clang
- patch -Rp1 -i "${srcdir}/REVERT-disable-autoupgrading-debug-info.patch"
- # GCC13 patches for chromium (https://github.com/archlinux/svntogit-packages/commit/470e5cbc7b58b4955664cdae386161d22c17d980)
- patch -Np1 -i "${srcdir}/random-fixes-for-gcc13.patch"
- # Electron specific fixes
- patch -Np1 -i "${srcdir}/jinja-python-3.10.patch" -d "third_party/electron_node/tools/inspector_protocol/jinja2"
- patch -Np1 -i "${srcdir}/use-system-libraries-in-node.patch"
- patch -Np1 -i "${srcdir}/default_app-icon.patch" # Icon from .desktop file
- # Fix build with libxml2 2.12
- patch -Np1 -i ../libxml2-2.12.patch
- # Fix build with ICU 74
- patch -Np1 -i ../icu-74.patch
- # Allow building against system libraries in official builds
- echo "Patching Chromium for using system libraries..."
- sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
- tools/generate_shim_headers/generate_shim_headers.py
- # Remove bundled libraries for which we will use the system copies; this
- # *should* do what the remove_bundled_libraries.py script does, with the
- # added benefit of not having to list all the remaining libraries
- local _lib
- for _lib in ${_unwanted_bundled_libs[@]}; do
- third_party_dir="third_party/$_lib"
- if [ ! -d "${third_party_dir}" ]; then
- third_party_dir="base/${third_party_dir}"
- fi
- find "${third_party_dir}" -type f \
- \! -path "${third_party_dir}/chromium/*" \
- \! -path "${third_party_dir}/google/*" \
- \! -path 'third_party/harfbuzz-ng/utils/hb_scoped.h' \
- \! -regex '.*\.\(gn\|gni\|isolate\)' \
- -delete
- done
- ./build/linux/unbundle/replace_gn_files.py \
- --system-libraries "${!_system_libs[@]}"
- }
- build() {
- export CC=clang
- export CXX=clang++
- export AR=ar
- export NM=nm
- # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
- CFLAGS+=' -Wno-builtin-macro-redefined'
- CXXFLAGS+=' -Wno-builtin-macro-redefined'
- CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
- # Let Chromium set its own symbol level
- CFLAGS=${CFLAGS/-g }
- CXXFLAGS=${CXXFLAGS/-g }
- # https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123
- CFLAGS=${CFLAGS/-fexceptions}
- CFLAGS=${CFLAGS/-fcf-protection}
- CXXFLAGS=${CXXFLAGS/-fexceptions}
- CXXFLAGS=${CXXFLAGS/-fcf-protection}
- # This appears to cause random segfaults when combined with ThinLTO
- # https://bugs.archlinux.org/task/73518
- CFLAGS=${CFLAGS/-fstack-clash-protection}
- CXXFLAGS=${CXXFLAGS/-fstack-clash-protection}
- # https://crbug.com/957519#c122
- CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}
- # Do not warn about unknown warning options
- CFLAGS+=' -Wno-unknown-warning-option'
- CXXFLAGS+=' -Wno-unknown-warning-option'
- pushd src
- export CHROMIUM_BUILDTOOLS_PATH="${PWD}/buildtools"
- GN_EXTRA_ARGS='
- custom_toolchain = "//build/toolchain/linux/unbundle:default"
- host_toolchain = "//build/toolchain/linux/unbundle:default"
- clang_base_path = "/usr"
- clang_use_chrome_plugins = false
- symbol_level = 0 # sufficient for backtraces on x86(_64)
- chrome_pgo_phase = 0
- treat_warnings_as_errors = false
- disable_fieldtrial_testing_config = true
- blink_enable_generated_code_formatting = false
- ffmpeg_branding = "Chrome"
- rtc_use_pipewire = true
- link_pulseaudio = true
- use_custom_libcxx = false
- use_gnome_keyring = false
- use_sysroot = false
- use_system_libffi = true
- icu_use_data_file = false
- is_component_ffmpeg = false
- '
- gn gen out/Release \
- --args="import(\"//electron/build/args/release.gn\") ${GN_EXTRA_ARGS}"
- ninja -C out/Release electron
- ninja -C out/Release electron_dist_zip
- # ninja -C out/Release third_party/electron_node:headers
- }
- package() {
- install -dm755 "${pkgdir:?}/usr/lib/${pkgname%-*}"
- bsdtar -xf src/out/Release/dist.zip -C "${pkgdir}/usr/lib/${pkgname%-*}"
- chmod u+s "${pkgdir}/usr/lib/${pkgname%-*}/chrome-sandbox"
- install -dm755 "${pkgdir}/usr/share/licenses/${pkgname%-*}"
- for l in "${pkgdir}/usr/lib/${pkgname%-*}"/{LICENSE,LICENSES.chromium.html}; do
- ln -s \
- "$(realpath --relative-to="${pkgdir}/usr/share/licenses/${pkgname%-*}" "${l}")" \
- "${pkgdir}/usr/share/licenses/${pkgname%-*}"
- done
- install -Dm755 "${srcdir}/electron-launcher.sh" \
- "${pkgdir}/usr/bin/${pkgname%-*}"
- # Install .desktop and icon file (see default_app-icon.patch)
- install -Dm644 electron.desktop \
- "${pkgdir}/usr/share/applications/${pkgname%-*}.desktop"
- install -Dm644 src/electron/default_app/icon.png \
- "${pkgdir}/usr/share/pixmaps/${pkgname%-*}.png" # hicolor has no 1024x1024
- }
|