# Maintainer: lauren n. liberda pkgname=electron pkgver=26.1.0 pkgrel=0 _chromium=116.0.5845.97 _depot_tools=b5509953468edd0906f2dc297886939abbd2bed5 _extra_patches=chromium-116-patchset-2 pkgdesc="Electron cross-platform desktop toolkit" url="https://github.com/electron/electron" # aarch64 build failure arch="!aarch64 x86_64" # same as chromium license="MIT" depends="gtk+3.0 so:libudev.so.1 xdg-utils" makedepends=" alsa-lib-dev aom-dev bash brotli-dev bsd-compat-headers bzip2-dev c-ares-dev cairo-dev clang-dev clang-extra-tools compiler-rt cups-dev curl-dev dav1d-dev dbus-glib-dev eudev-dev ffmpeg-dev findutils flac-dev flex freetype-dev gperf gtk+3.0-dev gn gzip harfbuzz-dev hunspell-dev http-parser-dev hwdata-dev java-jdk jpeg-dev jsoncpp-dev krb5-dev lcms2-dev libarchive-tools libavif-dev libbsd-dev libcap-dev libevent-dev libexif-dev libgcrypt-dev libjpeg-turbo-dev libnotify-dev libusb-dev libva-dev libwebp-dev libxcomposite-dev libxcursor-dev libxinerama-dev libxml2-dev libxrandr-dev libxscrnsaver-dev libxslt-dev linux-headers lld llvm mesa-dev minizip-dev nghttp2-dev nodejs npm nss-dev opus-dev pciutils-dev perl pipewire-dev pulseaudio-dev py3-httplib2 py3-parsing py3-six python3 qt5-qtbase-dev re2-dev rsync samurai snappy-dev speex-dev sqlite-dev woff2-dev xcb-proto yarn zlib-dev zstd " subpackages="$pkgname-lang $pkgname-dev" # the lower patches are specific to electron, the top ones are from the equivalent chromium version source="https://s3.sakamoto.pl/lnl-aports-snapshots/electron-$pkgver.tar.zst chromium-patches-$_extra_patches.tar.gz::https://github.com/stha09/chromium-patches/archive/refs/tags/$_extra_patches.tar.gz chromium-revert-drop-of-system-java.patch chromium-use-alpine-target.patch fix-missing-cstdint-include-musl.patch gdbinit.patch import-version.patch libstdc++13.patch mman.patch musl-sandbox.patch musl-tid-caching.patch musl-v8-monotonic-pthread-cont_timedwait.patch no-execinfo.patch no-mallinfo.patch no-res-ninit-nclose.patch no-sandbox-settls.patch revert-llvm16-linker-flag.patch tagging-ifuncs.patch temp-failure-retry.patch icon.patch python-jinja-3.10.patch vector-const.patch webpack-hash.patch default.conf electron.desktop electron-launcher.sh " # tests are todo for some base checks options="!check net suid" # creates a dist tarball that does not need to git clone everything at build time. snapshot() { deps # vpython3 execs system python3 with this set export VPYTHON_BYPASS="manually managed python not supported by chrome operations" export CHROMIUM_BUILDTOOLS_PATH="$srcdir/src/buildtools" mkdir -p "$srcdir" cd "$srcdir" if ! [ -d src ]; then git clone --branch=$_chromium --depth=1 \ https://chromium.googlesource.com/chromium/src.git fi if ! [ -d electron ]; then git clone https://github.com/electron/electron.git fi if ! [ -d depot_tools ]; then ( git clone --depth 1 -b main https://chromium.googlesource.com/chromium/tools/depot_tools.git cd depot_tools git fetch --depth 1 origin $_depot_tools git checkout $_depot_tools ) fi export PATH="$PATH:$srcdir/depot_tools" echo "solutions = [ { \"name\": \"src/electron\", \"url\": \"file://$srcdir/electron@v$pkgver\", \"deps_file\": \"DEPS\", \"managed\": False, \"custom_deps\": { \"src\": None, }, \"custom_vars\": {}, }, ]" > .gclient python3 depot_tools/gclient.py sync \ --with_branch_heads \ --with_tags \ --nohooks python3 src/build/landmines.py python3 src/build/util/lastchange.py -o src/build/util/LASTCHANGE python3 src/build/util/lastchange.py -s src/third_party/dawn \ --revision src/gpu/webgpu/DAWN_VERSION python3 src/build/util/lastchange.py -m GPU_LISTS_VERSION \ --revision-id-only --header src/gpu/config/gpu_lists_version.h python3 src/build/util/lastchange.py -m SKIA_COMMIT_HASH \ -s src/third_party/skia --header src/skia/ext/skia_commit_hash.h # why? cp -r electron/patches/ffmpeg src/electron/patches/ python3 electron/script/apply_all_patches.py \ electron/patches/config.json python3 src/tools/update_pgo_profiles.py \ --target=linux \ update \ --gs-url-base=chromium-optimization-profiles/pgo_profiles python3 src/tools/download_optimization_profile.py \ --newest_state=src/chrome/android/profiles/newest.txt \ --local_state=src/chrome/android/profiles/local.txt \ --output_name=src/chrome/android/profiles/afdo.prof \ --gs_url_base=chromeos-prebuilt/afdo-job/llvm mv src $pkgname-$pkgver # extra binaries are most likely things we don't want, so nuke them all for elf in $(scanelf -RA -F "%F" $pkgname-$pkgver); do rm -f "$elf" done msg "generating tarball.. (this takes a while)" tar -cf $pkgname-$pkgver.tar \ --exclude="ChangeLog*" \ --exclude="testdata/*" \ --exclude="test_data/*" \ --exclude="android_rust_toolchain/*" \ --exclude-backups \ --exclude-caches-all \ --exclude-vcs \ $pkgname-$pkgver zstd --auto-threads=logical --ultra --long -22 -T0 -vv $pkgname-$pkgver.tar } _extra_patch() { msg chromium-"$1".patch patch -Np1 < "$srcdir"/chromium-patches-"$_extra_patches"/chromium-"$1".patch } prepare() { dos2unix third_party/vulkan_memory_allocator/include/vk_mem_alloc.h default_prepare _extra_patch 116-object_paint_properties_sparse-include _extra_patch 116-abseil-arm64 git init -q . # link to system tools ln -sfv /usr/bin/clang-format buildtools/linux64/clang-format mkdir -p third_party/node/linux/node-linux-x64/bin ln -sfv /usr/bin/node third_party/node/linux/node-linux-x64/bin/node ln -sfv /usr/bin/java third_party/jdk/current/bin/java ( cd electron git init -q . git config user.email "example@example.com" git config user.name "example" git config commit.gpgsign false git add LICENSE git commit -m "init" git tag "v$pkgver" git pack-refs yarn install --frozen-lockfile --no-scripts ) ( cd third_party/node ./update_npm_deps ) # re2 - 2023.06 port # libavif - https://github.com/AOMediaCodec/libavif/commit/4d2776a3 # libaom - https://aomedia.googlesource.com/aom/+/706ee36dcc82%5E%21/ local use_system=" dav1d ffmpeg flac fontconfig freetype harfbuzz-ng icu jsoncpp libdrm libevent libjpeg libwebp libxml libxslt opus snappy woff2 zlib " for _lib in $use_system libjpeg_turbo; do msg "Removing buildscripts for system provided $_lib" find . -type f -path "*third_party/$_lib/*" \ \! -path "*third_party/$_lib/chromium/*" \ \! -path "*third_party/$_lib/google/*" \ \! -path './base/third_party/icu/*' \ \! -path './third_party/libxml/*' \ \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \ \! -path './third_party/harfbuzz-ng/utils/hb_scoped.h' \ \! -path './third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h' \ \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ -delete done # https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion touch chrome/test/data/webui/i18n_process_css_test.html # Use the file at run time instead of effectively compiling it in sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' \ -i services/device/public/cpp/usb/BUILD.gn msg "Running debundle script" python3 build/linux/unbundle/replace_gn_files.py --system-libraries \ $use_system python3 third_party/libaddressinput/chromium/tools/update-strings.py # prevent annoying errors when regenerating gni sed -i 's,^update_readme$,#update_readme,' \ third_party/libvpx/generate_gni.sh # allow system dependencies in "official builds" sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ tools/generate_shim_headers/generate_shim_headers.py # https://crbug.com/893950 sed -i -e 's/\/malloc/' -e 's/\/free/' \ third_party/blink/renderer/core/xml/*.cc \ third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \ third_party/libxml/chromium/*.cc \ third_party/maldoca/src/maldoca/ole/oss_utils.h _configure } _configure() { cd "$builddir" msg "Configuring build" export PATH="$PATH:/usr/lib/qt5/bin" # clang uses much less memory (and this doesn't support gcc) export CC=clang export CXX=clang++ # required to find the tools export AR=llvm-ar export NM=llvm-nm export LD=clang++ # less log spam, reproducible export CFLAGS="${CFLAGS/-g/} -O2 -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations" export CXXFLAGS="${CXXFLAGS/-g/} -O2 -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations" export CPPFLAGS="${CPPFLAGS/-g/} -D__DATE__= -D__TIME__= -D__TIMESTAMP__=" # breaks chromium-based stuff export CXXFLAGS="${CXXFLAGS/-D_GLIBCXX_ASSERTIONS=1}" # shellcheck disable=2089 local gn_config=" clang_base_path=\"/usr\" custom_toolchain=\"//build/toolchain/linux/unbundle:default\" host_toolchain=\"//build/toolchain/linux/unbundle:default\" import(\"//electron/build/args/release.gn\") blink_enable_generated_code_formatting=false chrome_pgo_phase=0 clang_use_chrome_plugins=false fatal_linker_warnings=false ffmpeg_branding=\"Chrome\" icu_use_data_file=true is_cfi=false is_clang=true is_component_ffmpeg=true is_debug=false is_official_build=true symbol_level=0 treat_warnings_as_errors=false angle_enable_gl_null=false build_tflite_with_xnnpack=false build_with_tflite_lib=false disable_fieldtrial_testing_config=true enable_hangout_services_extension=true enable_library_cdms=false enable_media_remoting=false enable_nacl=false enable_paint_preview=false enable_reading_list=false enable_remoting=false enable_reporting=false enable_rust=false enable_screen_ai_service=false enable_service_discovery=false enable_stripping=false enable_vr=false ozone_platform_headless=false link_pulseaudio=true proprietary_codecs=true rtc_link_pipewire=true rtc_use_pipewire=true use_custom_libcxx=false use_dawn=false use_gnome_keyring=false use_pulseaudio=true use_sysroot=false use_system_cares=true use_system_freetype=true use_system_harfbuzz=true use_system_lcms2=true use_system_libdrm=true use_system_libffi=true use_system_libjpeg=true use_system_nghttp2=true use_system_zlib=true use_vaapi=true " # shellcheck disable=2086,2090,2116 gn gen out/Release --args="$(echo $gn_config)" \ --export-compile-commands } build() { export PATH="$PATH:/usr/lib/qt5/bin" ninja -C out/Release \ electron_dist_zip \ node_gypi_headers \ node_version_header \ tar_headers } package() { mkdir -p "$pkgdir"/usr/lib/electron "$pkgdir"/usr/bin bsdtar -xf out/Release/dist.zip -C "$pkgdir"/usr/lib/electron chmod u+s "$pkgdir"/usr/lib/electron/chrome-sandbox install -Dm755 "$srcdir"/electron-launcher.sh "$pkgdir"/usr/bin/electron install -Dm755 "$srcdir"/default.conf "$pkgdir"/etc/electron/default.conf mkdir -p "$pkgdir"/usr/include/electron mv -v "$builddir"/out/Release/gen/node_headers "$pkgdir"/usr/include/electron ln -sv /usr/include/electron/node_headers/include/node "$pkgdir"/usr/include/electron/node mkdir -p "$pkgdir"/usr/include/electron/node_headers/include/nan cp -v "$builddir"/third_party/nan/*.h "$pkgdir"/usr/include/electron/node_headers/include/nan ln -sv /usr/include/electron/node_headers/include/nan "$pkgdir"/usr/include/electron/nan install -Dm644 electron/default_app/icon.png \ "$pkgdir"/usr/share/icons/hicolor/1024x1024/apps/electron.png install -Dm644 "$srcdir"/electron.desktop \ -t "$pkgdir"/usr/share/applications/ } lang() { pkgdesc="$pkgdesc (translations)" install_if="$pkgname=$pkgver-r$pkgrel lang" mkdir -p "$subpkgdir"/usr/lib/electron/locales mv "$pkgdir"/usr/lib/electron/locales/*.pak \ "$subpkgdir"/usr/lib/electron/locales mv "$subpkgdir"/usr/lib/electron/locales/en-US.pak \ "$pkgdir"/usr/lib/electron/locales } sha512sums=" ddeb2b1ed6d0cf4d47cac2b9dce004811b9839be121ec06b6838563e71132b542464e117299d3f4dade336469407372f6f584590c23c0fa5337135c1357d6f47 electron-26.1.0.tar.zst bc81489d37186790ee1b423ada5d8275fe9c408d1be8635792f7d2984dfe847913b2c8847dd95caa2a7d388fc0914813ceb7f57b9ee2a4c417410f10f944e1a8 chromium-patches-chromium-116-patchset-2.tar.gz 29bb685e03356a77df5fd347cdf55194cc8b3265c421cc76e54d64edefc329dbcb052deb26b22e8f587ce68456876c071de1b7d258dd0fcc6ee66c875ec4a020 chromium-revert-drop-of-system-java.patch fa291e941076146d0edd5b96c088240a44a6e0aca3dfc744929655607182d2dc47e6c35ecb419f7c623fcf7f26dc3c4dd924dbf5ed10c3b986283f5ef2f72573 chromium-use-alpine-target.patch 9200f78bad70e95c648a5e8392d50642190600f655c6baa366ff6467ebad52d3b3f305dad58f3610da67136f4b723557653b174ec5c25be8d8737ee04d9ee09f fix-missing-cstdint-include-musl.patch 33ee60863cc438ef57ffef92ba4cf67a856a5ffc16138bce241bcf87e47b15154aa86918e793c26f7ec4dc62a445257ad5673ed7001daf22c4043cf6cc57da7f gdbinit.patch 8de65109ece27ea63bd469f2220c56b8c752ba0a50fdf390082a2d5ae74b8e010199126175569f6d5084270dd4e0571e68aec32c0bca8211a6699925b3a09124 import-version.patch 8c458c76991131e54898e25346cd1798179726d6ea6ee7507f9474141f1d90155a750f2c208a513dd6846b429b38a26da9fbcae61e4888163c0d34ec79de4166 libstdc++13.patch 0e991842e23a4b9133898125eeb39e45e3f86f886eef5d2f0d9a72ee143a3e124b3b4f60be94edd57ce4185bcd69704edb51f76d08fdb6207f5559a08dd41ab0 mman.patch 50c274a420bb8a7f14fcb56e40920dac8f708792a4520789b4987facea459bef88113d5a2b60fa8c57bee6e92bff3617d6b73fa305c8c44614c638971cffd440 musl-sandbox.patch e7163ac5810ac85366cef2447412287c856e3d67c6b77f219a6e5a418b1965b98e449c409424ad0704a5bded9355dd0aec3dc4585918ce5a2ab36c079707afe2 musl-tid-caching.patch 92eb002718026611f5542362ad69b67f0a398ff71b3fca5c05d55cb5c6f9f29334e5e127bb4860cfaa3fba0f0d4c901e2b98808217e7dc02e254a64a5c9521aa musl-v8-monotonic-pthread-cont_timedwait.patch 8cc774e8d84e434960222c0497ad8193ae35c0732f98d3282d5fd4b4930f914809eec97832c199517ca89ca6b9d1d011db5ce533c40c68ce5fa464609d131a23 no-execinfo.patch b5479874d125ee95a311295f227f8881a83023ec34fded7a6160b3ae32ea3ba0f2b833a9fb264c57f3d22746b6d8b00bdc8eb2ff86c43c412d6d3b55ae15b16b no-mallinfo.patch e4c4e5bc6f828f9c883dd418c0ba01887949c29c311f76206a1ec29f620b0c0ba0452949dc2778a9c46ea066405857536964a36436a68eecf7da7952736333cf no-res-ninit-nclose.patch 6dc4d8dc92e685dace62265a1ddb3aebc558aed54d20ff6d36b030be0c48d7e84662326c31363612492574d9a03c62653cdc21a60995b97dee1d75cae86a9f9b no-sandbox-settls.patch b7f45dfbb3ddd186514b0e45f0d6c170b2c46e4e09d633e8a86ec80ae31f386ed02ffa1a18db2c49e324653941b72f09ca71b2c7478e6ef04d3875ec1909554b revert-llvm16-linker-flag.patch 3cffb9ea335e4696260366175e79ececb648087bbb6b484ea65029c0298369aab29c30704eadae889a3c8e5112abf03f5a5e49a1574192c32e98cab8e9197026 tagging-ifuncs.patch e48693e6b7aeebf69a5acbf80d9a35defe4c23835121dfeb58b051ac7c527e758a41004f4d193274fe1b01c0bfb1dbc77b09cb6a404a3fdee507a2918afb0edb temp-failure-retry.patch 905565c10f5e5600e7d4db965c892cc45009a258e9995da958974d838ace469e1db1019195307e8807860d5b55ba6bfeea478b1f39a9b99e82c619b2816a1a22 icon.patch e05180199ee1d559e4e577cedd3e589844ecf40d98a86321bf1bea5607b02eeb5feb486deddae40e1005b644550331f6b8500177aa7e79bcb3750d3c1ceb76c3 python-jinja-3.10.patch 71571b15cf8bd6259b7fd22bea0e46b64890f3db776365de33fe539f26ce9ef99459e05c3dde9434c3657225bc67160abc915acd93033cb487c770c6a2a5975f vector-const.patch 2aa340854316f1284217c0ca17cbf44953684ad6c7da90815117df30928612eb9fb9ffb734b948dfc309cd25d1a67cd57f77aac2d052a3dd9aca07a3a58cbb30 webpack-hash.patch 738b0314e6fc9d73766d4d10709bc9063fea7de6a9da9b332fae5214d727d7e89ee669a3eca853ade69134404f57ba778cf1bada5a25042633720c5d71bb6889 default.conf 191559fc7aa1ea0353c6fb0cc321ee1d5803a0e44848c8be941cfab96277b0de6a59962d373e2a2a1686c8f9be2bcf2d2f33706759a339a959e297d3f7fda463 electron.desktop ff1844036c8ae0a0a57a16211a816bc0ad550ccf6ea1cf718e228b8c95b9c4f5c9772d1a1a23638c0e140703a7b52874371e27a0d9d54a7b9468e5c384759be5 electron-launcher.sh "