# Maintainer: psykose pkgname=electron pkgver=24.2.0 pkgrel=0 _chromium=112.0.5615.165 _depot_tools=dbcecc90179a25159dc62f6ed00ae244360297e8 pkgdesc="Electron cross-platform desktop toolkit" url="https://github.com/electron/electron" 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 hwids-usb 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="$pkgname-$pkgver-2.tar.zst::https://dev.alpinelinux.org/archive/electron/electron-$pkgver.tar.zst chromium-VirtualCursor-standard-layout.patch chromium-revert-drop-of-system-java.patch chromium-use-alpine-target.patch fix-missing-cstdint-include-musl.patch gdbinit.patch import-version.patch libcxx-muslmode.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 quiche-arena-size.patch scoped-file-no-close.patch temp-failure-retry.patch icon.patch python-jinja-3.10.patch webpack-hash.patch default.conf electron.desktop electron-launcher.sh " # chromium sandbox is suid # 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" git clone --branch=$_chromium --depth=1 \ https://chromium.googlesource.com/chromium/src.git git clone https://github.com/electron/electron.git ( 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 ) 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 --ultra --long -22 -T0 -vv $pkgname-$pkgver.tar } prepare() { default_prepare git init . # 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 . git config user.email "example@example.com" git config user.name "example" git add LICENSE git commit -m "init" git tag "v$pkgver" # jesus christ what the fuck is wrong with you? touch .git/packed-refs yarn install --frozen-lockfile --no-scripts ) ( cd third_party/node ./update_npm_deps ) # these are normally unbundled, but they can't be with custom_libcxx. # we use custom_libcxx as there are a few libstdc++ incompatibilities # that now cause segfaults with the wayland ozone platform since electron 22. # obviously, this is a FIXME. # --- # jsoncpp # re2 # woff2 # --- # libavif - https://github.com/AOMediaCodec/libavif/commit/4d2776a3 local use_system=" brotli dav1d ffmpeg flac fontconfig freetype harfbuzz-ng icu libaom libdrm libevent libjpeg libwebp libxml libxslt opus snappy 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__=" # 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 clang_use_chrome_plugins=false fatal_linker_warnings=false ffmpeg_branding=\"Chrome\" icu_use_data_file=true is_cfi=false 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_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=true 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=" 208cbaa48cd929c242dce6d7e4291655a625b84f44f7d5d3ef6b40d55f7ab2269457496afa8fff73bc6c5aa01be6d26e4bdf63371a407f1f888061fbfc778a6d electron-24.2.0-2.tar.zst f88adc643dacf7e7be1b9bb77ff2c172cd04de2a988d3cdca77313122ba3ea93e6781ee675f3d7daf337a2542c0cbf31ffb08413e9f85c287b3a5e950d7d8a31 chromium-VirtualCursor-standard-layout.patch 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 1bb1b31ee3057fb626a2d5eb44698946484e45017310d55026347f18f774453828802438ba14691d81edaad6c96c5df25c4aca772a30674a04feca3df11fccfb libcxx-muslmode.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 2bc334352cdf0e523003c882e1a29623896bf3f3543469b23a532cb5ff32a75e7f23dc94abfaed4a97e24d26bdc51b780728583f1e7e7860f00c49e4d91edfa9 quiche-arena-size.patch 8c33808ede31dd3b8eb951991e034751949756c4e6c2cd0e19823e95fddf5f9d94424bbd73ffe6dd965df2b0887fc5c42ab8a97c64b553d47662e90651b84f13 scoped-file-no-close.patch e48693e6b7aeebf69a5acbf80d9a35defe4c23835121dfeb58b051ac7c527e758a41004f4d193274fe1b01c0bfb1dbc77b09cb6a404a3fdee507a2918afb0edb temp-failure-retry.patch 905565c10f5e5600e7d4db965c892cc45009a258e9995da958974d838ace469e1db1019195307e8807860d5b55ba6bfeea478b1f39a9b99e82c619b2816a1a22 icon.patch e05180199ee1d559e4e577cedd3e589844ecf40d98a86321bf1bea5607b02eeb5feb486deddae40e1005b644550331f6b8500177aa7e79bcb3750d3c1ceb76c3 python-jinja-3.10.patch 2aa340854316f1284217c0ca17cbf44953684ad6c7da90815117df30928612eb9fb9ffb734b948dfc309cd25d1a67cd57f77aac2d052a3dd9aca07a3a58cbb30 webpack-hash.patch 08460b15037511a4e5469ceac6ae5dd4db4c8cb87c129aaaf40ba58b16c60b8a307ffdd85805efead235758abed09ec31db1ef4cf9159f7b9acdcee3031bc96c default.conf 191559fc7aa1ea0353c6fb0cc321ee1d5803a0e44848c8be941cfab96277b0de6a59962d373e2a2a1686c8f9be2bcf2d2f33706759a339a959e297d3f7fda463 electron.desktop 03750694e5e0b66f084c6e43135e60be15abb059e23486346ee4352dcc236984f2f35467b47f2b2ad46c98c22091cc2b978de8e73680febadba169d960f13f9f electron-launcher.sh "