diff --git a/devel/electron30/Makefile b/devel/electron30/Makefile index f12a4f415275..f2cc8a789c57 100644 --- a/devel/electron30/Makefile +++ b/devel/electron30/Makefile @@ -1,464 +1,463 @@ PORTNAME= electron DISTVERSIONPREFIX= v DISTVERSION= ${ELECTRON_VER:S/-beta./.b/} -PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= https://github.com/tagattie/FreeBSD-Electron/releases/download/v30.1.1/:chromium \ https://commondatastorage.googleapis.com/chromium-nodejs/:chromium_node \ https://commondatastorage.googleapis.com/chromium-fonts/:chromium_testfonts PKGNAMESUFFIX= ${ELECTRON_VER_MAJOR} DISTFILES= chromium-${CHROMIUM_VER}${EXTRACT_SUFX}:chromium \ ${CHROMIUM_NODE_MODULES_HASH}:chromium_node \ ${CHROMIUM_TEST_FONTS_HASH}:chromium_testfonts \ electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX}:prefetch DIST_SUBDIR= ${PORTNAME} MAINTAINER= tagattie@FreeBSD.org COMMENT= Build cross-platform desktop apps with JavaScript, HTML, and CSS WWW= https://electronjs.org/ LICENSE= BSD3CLAUSE LGPL21 MPL11 MIT LICENSE_COMB= multi LICENSE_FILE= ${WRKSRC}/electron/LICENSE ONLY_FOR_ARCHS= aarch64 amd64 i386 FETCH_DEPENDS= yarn${NODEJS_SUFFIX}>0:www/yarn${NODEJS_SUFFIX} EXTRACT_DEPENDS=yarn${NODEJS_SUFFIX}>0:www/yarn${NODEJS_SUFFIX} PATCH_DEPENDS= git:devel/git \ jq:textproc/jq BUILD_DEPENDS= gperf:devel/gperf \ yasm:devel/yasm \ ${LOCALBASE}/libdata/pkgconfig/dri.pc:graphics/mesa-dri \ rustc:lang/rust \ ${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat \ node${NODEJS_VERSION}>0:www/node${NODEJS_VERSION} \ npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX} LIB_DEPENDS= libatk-bridge-2.0.so:accessibility/at-spi2-core \ libatspi.so:accessibility/at-spi2-core \ libFLAC.so:audio/flac \ libopus.so:audio/opus \ libdbus-1.so:devel/dbus \ libicuuc.so:devel/icu \ libepoll-shim.so:devel/libepoll-shim \ libevent.so:devel/libevent \ libffi.so:devel/libffi \ libnotify.so:devel/libnotify \ libpci.so:devel/libpci \ libnspr4.so:devel/nspr \ libre2.so:devel/re2 \ libdrm.so:graphics/libdrm \ libpng.so:graphics/png \ libwayland-client.so:graphics/wayland \ libwebp.so:graphics/webp \ libdav1d.so:multimedia/dav1d \ libva.so:multimedia/libva \ libopenh264.so:multimedia/openh264 \ libfreetype.so:print/freetype2 \ libharfbuzz.so:print/harfbuzz \ libsecret-1.so:security/libsecret \ libnss3.so:security/nss \ libexpat.so:textproc/expat2 \ libxkbcommon.so:x11/libxkbcommon \ libxshmfence.so:x11/libxshmfence \ libfontconfig.so:x11-fonts/fontconfig RUN_DEPENDS= xdg-open:devel/xdg-utils TEST_DEPENDS= git:devel/git \ ${PYTHON_PKGNAMEPREFIX}python-dbusmock>0:devel/py-python-dbusmock@${PY_FLAVOR} \ npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX} USES= bison compiler:c++17-lang cpe gettext-tools gl gmake gnome \ iconv:wchar_t jpeg localbase:ldflags ninja nodejs:20,build \ pkgconfig python:build,test shebangfix tar:xz xorg CPE_VENDOR= electronjs USE_GITHUB= yes GH_TAGNAME= ${DISTVERSIONPREFIX}${ELECTRON_VER} GH_TUPLE= nodejs:node:v${NODE_VER}:node \ nodejs:nan:${NAN_VER}:nan \ Squirrel:Squirrel.Mac:${SQUIRREL_MAC_VER}:squirrel_mac \ ReactiveCocoa:ReactiveObjC:${REACTIVEOBJC_VER}:reactiveobjc \ Mantle:Mantle:${MANTLE_VER}:mantle \ EngFlow:reclient-configs:${ENGFLOW_RECLIENT_CONFIGS_VER}:reclient_configs USE_GL= gbm gl glesv2 USE_GNOME= atk cairo gdkpixbuf2 gtk30 libxml2 libxslt pango USE_LDCONFIG= ${DATADIR} USE_XORG= x11 xcb xcomposite xcursor xdamage xext xfixes xi xrandr \ xrender xscrnsaver xtst SHEBANG_FILES= chrome/tools/build/linux/chrome-wrapper buildtools/linux64/clang-format MAKE_ARGS= -C out/${BUILDTYPE} MAKE_ENV+= C_INCLUDE_PATH=${LOCALBASE}/include \ CPLUS_INCLUDE_PATH=${LOCALBASE}/include ALL_TARGET= electron electron:node_headers POST_BUILD_TARGETS= licenses version POST_BUILD_DIST_TARGETS=electron_dist_zip electron_chromedriver_zip \ electron_mksnapshot_zip DATADIR= ${PREFIX}/share/${PORTNAME}${PKGNAMESUFFIX} BINARY_ALIAS= python3=${PYTHON_CMD} NO_WRKSUBDIR= yes WRKSRC_SUBDIR= src GN_ARGS+= clang_use_chrome_plugins=false \ enable_backup_ref_ptr_support=false \ enable_hangout_services_extension=true \ enable_log_error_not_reached=true \ enable_nacl=false \ enable_remoting=false \ fatal_linker_warnings=false \ icu_use_data_file=false \ is_clang=true \ optimize_webui=true \ toolkit_views=true \ treat_warnings_as_errors=false \ use_allocator_shim=false \ use_aura=true \ use_custom_libcxx=true \ use_custom_libunwind=true \ use_lld=true \ use_partition_alloc=true \ use_partition_alloc_as_malloc=false \ use_sysroot=false \ use_system_freetype=false \ use_system_harfbuzz=true \ use_system_libffi=true \ use_system_libjpeg=true \ use_udev=false \ chrome_pgo_phase=0 \ extra_cflags="${CFLAGS}" \ extra_cxxflags="${CXXFLAGS}" \ extra_ldflags="${LDFLAGS}" \ ffmpeg_branding="${FFMPEG_BRAND}" \ override_electron_version="${ELECTRON_VER}" # TODO: investigate building with these options: # use_system_minigbm GN_BOOTSTRAP_FLAGS= --no-clean --no-rebuild --skip-generate-buildfiles PLIST_SUB= ELECTRON_VER=${ELECTRON_VER} \ ELECTRON_VER_MAJOR=${ELECTRON_VER_MAJOR} OPTIONS_DEFINE= CODECS CUPS DEBUG DIST DRIVER KERBEROS LTO PIPEWIRE OPTIONS_DEFAULT= CODECS CUPS DRIVER KERBEROS PIPEWIRE SNDIO OPTIONS_EXCLUDE_aarch64=LTO OPTIONS_GROUP= AUDIO OPTIONS_GROUP_AUDIO= ALSA PULSEAUDIO SNDIO OPTIONS_RADIO= KERBEROS OPTIONS_RADIO_KERBEROS= HEIMDAL HEIMDAL_BASE MIT OPTIONS_SUB= yes CODECS_DESC= Compile and enable patented codecs like H.264 DIST_DESC= Build distribution zip files DRIVER_DESC= Install chromedriver HEIMDAL_BASE_DESC= Heimdal Kerberos (base) HEIMDAL_DESC= Heimdal Kerberos (security/heimdal) MIT_DESC= MIT Kerberos (security/krb5) PIPEWIRE_DESC= Screen capture via PipeWire ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib ALSA_RUN_DEPENDS= ${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:audio/alsa-plugins \ alsa-lib>=1.1.1_1:audio/alsa-lib ALSA_VARS= GN_ARGS+=use_alsa=true ALSA_VARS_OFF= GN_ARGS+=use_alsa=false CODECS_VARS= GN_ARGS+=proprietary_codecs=true \ FFMPEG_BRAND="Chrome" CODECS_VARS_OFF= GN_ARGS+=proprietary_codecs=false \ FFMPEG_BRAND="Chromium" CUPS_LIB_DEPENDS= libcups.so:print/cups CUPS_VARS= GN_ARGS+=use_cups=true CUPS_VARS_OFF= GN_ARGS+=use_cups=false DEBUG_BUILD_DEPENDS= esbuild:devel/esbuild DEBUG_VARS= BUILDTYPE=Debug \ GN_FILE=testing.gn \ GN_ARGS+=is_debug=true \ GN_ARGS+=is_component_build=false \ GN_ARGS+=symbol_level=1 \ GN_BOOTSTRAP_FLAGS+=--debug \ WANTSPACE="21 GB" DEBUG_VARS_OFF= BUILDTYPE=Release \ GN_FILE=release.gn \ GN_ARGS+=blink_symbol_level=0 \ GN_ARGS+=is_debug=false \ GN_ARGS+=is_official_build=true \ GN_ARGS+=symbol_level=0 \ WANTSPACE="14 GB" DIST_IMPLIES= DRIVER DRIVER_MAKE_ARGS= chromedriver HEIMDAL_LIB_DEPENDS= libkrb5.so.26:security/heimdal KERBEROS_VARS= GN_ARGS+=use_kerberos=true KERBEROS_VARS_OFF= GN_ARGS+=use_kerberos=false LTO_VARS= GN_ARGS+=use_thin_lto=true \ GN_ARGS+=thin_lto_enable_optimizations=true \ WANTSPACE="14 GB" LTO_VARS_OFF= GN_ARGS+=use_thin_lto=false MIT_LIB_DEPENDS= libkrb5.so.3:security/krb5 PIPEWIRE_LIB_DEPENDS= libpipewire-0.3.so:multimedia/pipewire PIPEWIRE_VARS= GN_ARGS+=rtc_use_pipewire=true \ GN_ARGS+=rtc_link_pipewire=true PIPEWIRE_VARS_OFF= GN_ARGS+=rtc_use_pipewire=false \ GN_ARGS+=rtc_link_pipewire=false PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio PULSEAUDIO_VARS= GN_ARGS+=use_pulseaudio=true PULSEAUDIO_VARS_OFF= GN_ARGS+=use_pulseaudio=false # With SNDIO=on we exclude audio_manager_linux from the build (see # media/audio/BUILD.gn) and use audio_manager_openbsd which does not # support falling back to ALSA or PulseAudio. SNDIO_PREVENTS= ALSA PULSEAUDIO SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio SNDIO_VARS= GN_ARGS+=use_sndio=true SNDIO_VARS_OFF= GN_ARGS+=use_sndio=false # See ${WRKSRC}/electron/DEPS for CHROMIUM_VER CHROMIUM_VER= 124.0.6367.243 # See ${WRKSRC}/third_party/node/node_modules.tar.gz.sha1 for CHROMIUM_NODE_MODULES_HASH CHROMIUM_NODE_MODULES_HASH= 97a0b3c4c39cf05de1eafb6ffdec0fddd643f0a2 # See ${WRKSRC}/third_party/test_fonts/test_fonts.tar.gz.sha1 for CHROMIUM_TEST_FONTS_HASH CHROMIUM_TEST_FONTS_HASH= 336e775eec536b2d785cc80eff6ac39051931286 # See ${WRKSRC}/electron/DEPS for NODE_VER NODE_VER= 20.14.0 # See ${WRKSRC}/electron/DEPS for NAN_VER NAN_VER= e14bdcd1f72d62bca1d541b66da43130384ec213 # See ${WRKSRC}/electron/DEPS for SQUIRREL_MAC_VER SQUIRREL_MAC_VER= 0e5d146ba13101a1302d59ea6e6e0b3cace4ae38 # See ${WRKSRC}/electron/DEPS for REACTIVEOBJC_VER REACTIVEOBJC_VER= 74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76 # See ${WRKSRC}/electron/DEPS for MANTLE_VER MANTLE_VER= 78d3966b3c331292ea29ec38661b25df0a245948 # See ${WRKSRC}/electron/DEPS for ENGFLOW_RECLIENT_CONFIGS_VER ENGFLOW_RECLIENT_CONFIGS_VER= 955335c30a752e9ef7bff375baab5e0819b6c00d YARN_TIMESTAMP= 61171200 .include "Makefile.version" .include # libc++ < 16 needs these extra patches .if ${OPSYS} == FreeBSD && ${OSVERSION} < 1302507 EXTRA_PATCHES= ${PATCHDIR}/extra-patch-electron_shell_browser_electron__browser__context.h \ ${PATCHDIR}/extra-patch-electron_shell_browser_ui_gtk_menu__gtk.h \ ${PATCHDIR}/extra-patch-electron_shell_browser_ui_status__icon__gtk.h .endif .if ${PORT_OPTIONS:MHEIMDAL_BASE} && !exists(/usr/lib/libkrb5.so) IGNORE= you have selected HEIMDAL_BASE but do not have Heimdal installed in base .endif .if ${COMPILER_VERSION} < 170 LLVM_DEFAULT= 17 BUILD_DEPENDS+= clang${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT} BINARY_ALIAS+= cpp=${LOCALBASE}/bin/clang-cpp${LLVM_DEFAULT} \ cc=${LOCALBASE}/bin/clang${LLVM_DEFAULT} \ c++=${LOCALBASE}/bin/clang++${LLVM_DEFAULT} \ ar=${LOCALBASE}/bin/llvm-ar${LLVM_DEFAULT} \ nm=${LOCALBASE}/bin/llvm-nm${LLVM_DEFAULT} \ ld=${LOCALBASE}/bin/ld.lld${LLVM_DEFAULT} .else BINARY_ALIAS+= ar=/usr/bin/llvm-ar \ nm=/usr/bin/llvm-nm .endif CFLAGS+= -Wno-error=implicit-function-declaration .if ${ARCH} == "aarch64" PLIST_SUB+= AARCH64="" \ AMD64="@comment " \ I386="@comment " \ NOT_AARCH64="@comment " FFMPEG_TARGET= arm64 .elif ${ARCH} == "amd64" BUILD_DEPENDS+= nasm:devel/nasm PLIST_SUB+= AARCH64="@comment " \ AMD64="" \ I386="@comment " \ NOT_AARCH64="" FFMPEG_TARGET= x64 .elif ${ARCH} == "i386" BUILD_DEPENDS+= nasm:devel/nasm PLIST_SUB+= AARCH64="@comment " \ AMD64="@comment " \ I386="" \ NOT_AARCH64="" FFMPEG_TARGET= ia32 .endif FFMPEG_BDIR= ${WRKSRC}/build.${FFMPEG_TARGET}.freebsd/${FFMPEG_BRAND} FFMPEG_CDIR= ${WRKSRC}/third_party/ffmpeg/chromium/config/${FFMPEG_BRAND}/freebsd/${FFMPEG_TARGET} # Allow relocations against read-only segments (override lld default) LDFLAGS_i386= -Wl,-znotext # TODO: -isystem, would be just as ugly as this approach, but more reliably # build would fail without C_INCLUDE_PATH/CPLUS_INCLUDE_PATH env var set. MAKE_ENV+= C_INCLUDE_PATH=${LOCALBASE}/include \ CPLUS_INCLUDE_PATH=${LOCALBASE}/include # rust RUSTC_VERSION!= rustc -V 2>/dev/null || true MAKE_ENV+= RUSTC_BOOTSTRAP=1 GN_ARGS+= enable_rust=true \ rust_sysroot_absolute="${LOCALBASE}" \ rustc_version="${RUSTC_VERSION}" pre-everything:: @${ECHO_MSG} @${ECHO_MSG} "To build electron, you should have around 2GB of memory" @${ECHO_MSG} "and around ${WANTSPACE} of free disk space." @${ECHO_MSG} pre-fetch: @${MKDIR} ${DISTDIR}/${DIST_SUBDIR} if [ ! -f ${DISTDIR}/${DIST_SUBDIR}/electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX} ]; \ then ${MKDIR} ${WRKDIR}; \ ${ECHO_CMD} 'yarn-offline-mirror "./yarn-offline-cache"' >> \ ${WRKDIR}/.yarnrc; \ ${CP} ${FILESDIR}/package.json ${FILESDIR}/yarn.lock ${WRKDIR}; \ cd ${WRKDIR} && ${SETENV} HOME=${WRKDIR} XDG_CACHE_HOME=${WRKDIR}/.cache \ yarn --frozen-lockfile --ignore-scripts; \ ${MTREE_CMD} -cbnSp yarn-offline-cache | ${MTREE_CMD} -C | ${SED} \ -e 's:time=[0-9.]*:time=${YARN_TIMESTAMP}.000000000:' \ -e 's:\([gu]id\)=[0-9]*:\1=0:g' \ -e 's:mode=\([0-9]\)7[0-9][0-9]:mode=\1755:' \ -e 's:mode=\([0-9]\)6[0-9][0-9]:mode=\1644:' \ -e 's:flags=.*:flags=none:' \ -e 's:^\.:./yarn-offline-cache:' > yarn-offline-cache.mtree; \ ${TAR} cJf ${DISTDIR}/${DIST_SUBDIR}/electron-yarn-cache-${ELECTRON_VER}${EXTRACT_SUFX} \ @yarn-offline-cache.mtree; \ ${RM} -r ${WRKDIR}; \ fi post-extract: # Move extracted sources to appropriate locations ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/chromium-${CHROMIUM_VER} ${WRKSRC} ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${PORTNAME}-${ELECTRON_VER} ${WRKSRC}/electron ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_nan}-${NAN_VER} \ ${WRKSRC}/third_party/nan ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_node}-${NODE_VER} \ ${WRKSRC}/third_party/electron_node ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_squirrel_mac}-${SQUIRREL_MAC_VER} \ ${WRKSRC}/third_party/squirrel.mac ${MKDIR} ${WRKSRC}/third_party/squirrel.mac/vendor ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_reactiveobjc}-${REACTIVEOBJC_VER} \ ${WRKSRC}/third_party/squirrel.mac/vendor/ReactiveObjC ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_mantle}-${MANTLE_VER} \ ${WRKSRC}/third_party/squirrel.mac/vendor/Mantle ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/${GH_PROJECT_reclient_configs}-${ENGFLOW_RECLIENT_CONFIGS_VER} \ ${WRKSRC}/third_party/engflow-reclient-configs ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/node_modules ${WRKSRC}/third_party/node ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/test_fonts ${WRKSRC}/third_party/test_fonts # Install node modules for electron ${MV} ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/yarn-offline-cache ${WRKDIR} ${ECHO_CMD} 'yarn-offline-mirror "../../../yarn-offline-cache"' >> ${WRKSRC}/electron/.yarnrc ${MV} ${WRKSRC}/electron/package.json ${WRKSRC}/electron/package.json.bak ${CP} ${FILESDIR}/package.json ${WRKSRC}/electron cd ${WRKSRC}/electron && \ ${SETENV} HOME=${WRKDIR} XDG_CACHE_HOME=${WRKDIR}/.cache yarn --frozen-lockfile --offline pre-patch: ${SH} ${FILESDIR}/apply-electron-patches.sh ${WRKSRC} # ${FIND} ${WRKSRC} -type f -name '*.orig' -print -delete # ${FIND} ${WRKSRC} -type f -name '*~' -print -delete pre-configure: # We used to remove bundled libraries to be sure that chromium uses # system libraries and not shipped ones. # cd ${WRKSRC} && ${PYTHON_CMD} \ #./build/linux/unbundle/remove_bundled_libraries.py [list of preserved] cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${PYTHON_CMD} \ ./build/linux/unbundle/replace_gn_files.py --system-libraries \ dav1d flac fontconfig freetype harfbuzz-ng icu libdrm libevent \ libpng libusb libwebp libxml libxslt openh264 opus || ${FALSE} # Chromium uses an unreleased version of FFmpeg, so configure it cd ${WRKSRC}/third_party/ffmpeg && \ ${PYTHON_CMD} chromium/scripts/build_ffmpeg.py freebsd ${FFMPEG_TARGET} \ --config-only --branding=${FFMPEG_BRAND} cd ${FFMPEG_BDIR} && ${GMAKE} ffversion.h ${MKDIR} ${FFMPEG_CDIR} .for _e in config.h config.asm config_components.h libavcodec libavformat libavutil -${CP} -pR ${FFMPEG_BDIR}/${_e} ${FFMPEG_CDIR} .endfor do-configure: # GN generator bootstrapping and generating ninja files cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} CC=${CC} CXX=${CXX} LD=${CXX} \ READELF=${READELF} AR=${AR} NM=${NM} ${PYTHON_CMD} \ ./tools/gn/bootstrap/bootstrap.py ${GN_BOOTSTRAP_FLAGS} cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ./out/${BUILDTYPE}/gn gen out/${BUILDTYPE} \ --args='import("//electron/build/args/${GN_FILE}") ${GN_ARGS}' # Setup nodejs dependency @${MKDIR} ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin ${LN} -sf ${LOCALBASE}/bin/node ${WRKSRC}/third_party/node/freebsd/node-freebsd/bin/node # Setup buildtools/freebsd @${MKDIR} ${WRKSRC}/buildtools/freebsd ${LN} -sf ${WRKSRC}/buildtools/linux64/clang-format ${WRKSRC}/buildtools/freebsd ${LN} -sf ${WRKSRC}/out/${BUILDTYPE}/gn ${WRKSRC}/buildtools/freebsd ${LN} -sf /usr/bin/strip ${WRKSRC}/buildtools/freebsd/strip post-build: cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \ ${MAKE_CMD} ${MAKE_ARGS} ${POST_BUILD_TARGETS} post-build-DIST-on: cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \ ${MAKE_CMD} ${MAKE_ARGS} ${POST_BUILD_DIST_TARGETS} cd ${WRKSRC}/out/${BUILDTYPE} && \ ${CP} chromedriver.zip chromedriver-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \ ${CP} dist.zip electron-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \ ${CP} mksnapshot.zip mksnapshot-v${ELECTRON_VER}-freebsd-${ARCH:S/amd64/x64/:S/i386/ia32/}.zip && \ ${SHA256} -r *-v${ELECTRON_VER}-freebsd-*.zip | ${SED} -e 's/ / */' > SHASUMS256.txt do-install: ${MKDIR} ${STAGEDIR}${DATADIR} .for f in electron mksnapshot v8_context_snapshot_generator ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR} .endfor .for f in libEGL.so libGLESv2.so libffmpeg.so libvk_swiftshader.so ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR} .endfor ${INSTALL_LIB} ${WRKSRC}/out/${BUILDTYPE}/libvulkan.so.1 ${STAGEDIR}${DATADIR}/libvulkan.so .for f in LICENSE LICENSES.chromium.html snapshot_blob.bin v8_context_snapshot.bin version vk_swiftshader_icd.json ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR} .endfor .for f in chrome_100_percent.pak chrome_200_percent.pak resources.pak ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/${f} ${STAGEDIR}${DATADIR} .endfor ${MKDIR} ${STAGEDIR}${DATADIR}/locales ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/locales/*.pak ${STAGEDIR}${DATADIR}/locales ${MKDIR} ${STAGEDIR}${DATADIR}/resources .for f in default_app.asar ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/resources/${f} ${STAGEDIR}${DATADIR}/resources .endfor cd ${WRKSRC}/out/${BUILDTYPE}/gen && ${COPYTREE_SHARE} node_headers ${STAGEDIR}${DATADIR} cd ${WRKSRC}/out/${BUILDTYPE} && ${COPYTREE_SHARE} gen/electron/buildflags ${STAGEDIR}${DATADIR} cd ${WRKSRC}/out/${BUILDTYPE} && ${COPYTREE_SHARE} gen/v8/embedded.S ${STAGEDIR}${DATADIR} ${RLN} ${STAGEDIR}${DATADIR}/electron ${STAGEDIR}${PREFIX}/bin/electron${PKGNAMESUFFIX} post-install-DIST-on: ${MKDIR} ${STAGEDIR}${DATADIR}/releases ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/SHASUMS256.txt ${STAGEDIR}${DATADIR}/releases ${INSTALL_DATA} ${WRKSRC}/out/${BUILDTYPE}/*-v${ELECTRON_VER}-freebsd-*.zip ${STAGEDIR}${DATADIR}/releases post-install-DRIVER-on: ${INSTALL_PROGRAM} ${WRKSRC}/out/${BUILDTYPE}/chromedriver.unstripped \ ${STAGEDIR}${DATADIR}/chromedriver do-test: # Note 1: "npm install" will run before actual tests are executed # Note 2: Xvfb or something similar is necessary for headless testing cd ${WRKSRC}/electron && \ ${SETENV} ${TEST_ENV} ELECTRON_OUT_DIR=${BUILDTYPE} LOCAL_GIT_DIRECTORY=${LOCALBASE} \ npm run test -- --ci .include diff --git a/devel/electron30/Makefile.version b/devel/electron30/Makefile.version index 00169e9e8531..9826f7b9496c 100644 --- a/devel/electron30/Makefile.version +++ b/devel/electron30/Makefile.version @@ -1,2 +1,2 @@ -ELECTRON_VER= 30.1.1 +ELECTRON_VER= 30.1.2 ELECTRON_VER_MAJOR= ${ELECTRON_VER:C/\..*//} diff --git a/devel/electron30/distinfo b/devel/electron30/distinfo index c1c02b6f190e..adca7b880442 100644 --- a/devel/electron30/distinfo +++ b/devel/electron30/distinfo @@ -1,23 +1,23 @@ -TIMESTAMP = 1718267333 +TIMESTAMP = 1719227841 SHA256 (electron/chromium-124.0.6367.243.tar.xz) = 53ed2f29769fe105ae884e37fd9fd9d9756931cf1d6d16c6a252f5982b8496cb SIZE (electron/chromium-124.0.6367.243.tar.xz) = 1633060772 SHA256 (electron/97a0b3c4c39cf05de1eafb6ffdec0fddd643f0a2) = dcfaea4d353d1df3d4ac2d245ea7e32ad177d4bea1351f363714c9c22ca5c4f8 SIZE (electron/97a0b3c4c39cf05de1eafb6ffdec0fddd643f0a2) = 9761601 SHA256 (electron/336e775eec536b2d785cc80eff6ac39051931286) = a2ca2962daf482a8f943163541e1c73ba4b2694fabcd2510981f2db4eda493c8 SIZE (electron/336e775eec536b2d785cc80eff6ac39051931286) = 32624734 -SHA256 (electron/electron-yarn-cache-30.1.1.tar.xz) = 7bf31c8b9c55ee317c217cd6605eb85ed015cef96246188be0ab3b2681200368 -SIZE (electron/electron-yarn-cache-30.1.1.tar.xz) = 29229388 -SHA256 (electron/electron-electron-v30.1.1_GH0.tar.gz) = 6ddee025d5b530dd3fe0c5e6a96046a3a8ae9488209a8f9c6412092cad5dbfe7 -SIZE (electron/electron-electron-v30.1.1_GH0.tar.gz) = 13351289 +SHA256 (electron/electron-yarn-cache-30.1.2.tar.xz) = 7bf31c8b9c55ee317c217cd6605eb85ed015cef96246188be0ab3b2681200368 +SIZE (electron/electron-yarn-cache-30.1.2.tar.xz) = 29229388 +SHA256 (electron/electron-electron-v30.1.2_GH0.tar.gz) = bb072f7e438da61f9844246fa7d7afce0e9c1121732cce915c2f1c632e33efbd +SIZE (electron/electron-electron-v30.1.2_GH0.tar.gz) = 13351488 SHA256 (electron/nodejs-node-v20.14.0_GH0.tar.gz) = 69c7e7cdd95580e74d7f8dbe8a408652db09a9099c4f97c196d056279e7f523c SIZE (electron/nodejs-node-v20.14.0_GH0.tar.gz) = 115425089 SHA256 (electron/nodejs-nan-e14bdcd1f72d62bca1d541b66da43130384ec213_GH0.tar.gz) = 02edf8d5b3fef9af94d8a1355da60564a57e7f2c99cb422bce042400607ed2eb SIZE (electron/nodejs-nan-e14bdcd1f72d62bca1d541b66da43130384ec213_GH0.tar.gz) = 180646 SHA256 (electron/Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38_GH0.tar.gz) = f4ebb40a8d85dbb7ef02aa0571b2f8e22182c6d73b6992484a53c90047779d01 SIZE (electron/Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38_GH0.tar.gz) = 2112918 SHA256 (electron/ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76_GH0.tar.gz) = 88e65f116c7a06fccedb43970fba63080a57a4e5dc29147d2cdfe1ee58dd0546 SIZE (electron/ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76_GH0.tar.gz) = 1136238 SHA256 (electron/Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948_GH0.tar.gz) = a365df6d83e0be3cc000b70bd39734d80c28f0d9983ebe44698337a2ca464bb1 SIZE (electron/Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948_GH0.tar.gz) = 62962 SHA256 (electron/EngFlow-reclient-configs-955335c30a752e9ef7bff375baab5e0819b6c00d_GH0.tar.gz) = c148f76220fc41a89ffeaf370c2cc175577be184688b12aa6fec5f8ac6c714c4 SIZE (electron/EngFlow-reclient-configs-955335c30a752e9ef7bff375baab5e0819b6c00d_GH0.tar.gz) = 13014 diff --git a/devel/electron30/files/patch-electron_spec_api-utility-process-spec.ts b/devel/electron30/files/patch-electron_spec_api-utility-process-spec.ts index fcfaf8a6916b..721e60ea6c8d 100644 --- a/devel/electron30/files/patch-electron_spec_api-utility-process-spec.ts +++ b/devel/electron30/files/patch-electron_spec_api-utility-process-spec.ts @@ -1,11 +1,11 @@ ---- electron/spec/api-utility-process-spec.ts.orig 2024-01-23 19:02:02 UTC +--- electron/spec/api-utility-process-spec.ts.orig 2024-06-19 14:24:29 UTC +++ electron/spec/api-utility-process-spec.ts -@@ -400,7 +400,7 @@ describe('utilityProcess module', () => { +@@ -411,7 +411,7 @@ describe('utilityProcess module', () => { await closeWindow(w); }); - ifit(process.platform === 'linux')('allows executing a setuid binary with child_process', async () => { + ifit(process.platform === 'linux' || process.platform === 'freebsd')('allows executing a setuid binary with child_process', async () => { const child = utilityProcess.fork(path.join(fixturesPath, 'suid.js')); await once(child, 'spawn'); const [data] = await once(child, 'message'); diff --git a/devel/electron30/files/patch-ui_base_x_x11__display__util.cc b/devel/electron30/files/patch-ui_base_x_x11__display__util.cc index 765d959c3b52..ac263fec387b 100644 --- a/devel/electron30/files/patch-ui_base_x_x11__display__util.cc +++ b/devel/electron30/files/patch-ui_base_x_x11__display__util.cc @@ -1,365 +1,365 @@ ---- ui/base/x/x11_display_util.cc.orig 2024-04-15 20:34:29 UTC +--- ui/base/x/x11_display_util.cc.orig 2024-06-24 11:27:31 UTC +++ ui/base/x/x11_display_util.cc @@ -14,7 +14,6 @@ #include "base/bits.h" #include "base/command_line.h" -#include "base/containers/flat_map.h" #include "base/logging.h" #include "base/numerics/clamped_math.h" #include "base/ranges/algorithm.h" @@ -28,7 +27,6 @@ #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/rect_f.h" -#include "ui/gfx/switches.h" #include "ui/gfx/x/atom_cache.h" #include "ui/gfx/x/connection.h" #include "ui/gfx/x/randr.h" @@ -43,89 +41,42 @@ constexpr const char kRandrEdidProperty[] = "EDID"; constexpr const char kRandrEdidProperty[] = "EDID"; -std::map GetMonitors( - const x11::Response& reply) { - std::map output_to_monitor; - if (!reply) { - return output_to_monitor; - } - for (size_t monitor = 0; monitor < reply->monitors.size(); monitor++) { - for (x11::RandR::Output output : reply->monitors[monitor].outputs) { - output_to_monitor[output] = monitor; +std::map GetMonitors( + std::pair version, + x11::RandR* randr, + x11::Window window) { + std::map output_to_monitor; + if (version >= std::pair{1, 5}) { + if (auto reply = randr->GetMonitors({window}).Sync()) { + for (size_t monitor = 0; monitor < reply->monitors.size(); monitor++) { + for (x11::RandR::Output output : reply->monitors[monitor].outputs) { + output_to_monitor[output] = monitor; + } + } } } return output_to_monitor; } -x11::Future GetWorkAreaFuture( - x11::Connection* connection) { - return connection->GetProperty({ - .window = connection->default_root(), - .property = connection->GetAtom("_NET_WORKAREA"), - .long_length = 4, - }); -} - -gfx::Rect GetWorkAreaSync(x11::Future future) { - auto response = future.Sync(); - if (!response || response->format != 32 || response->value_len != 4) { - return gfx::Rect(); - } - const uint32_t* value = response->value->front_as(); - return gfx::Rect(value[0], value[1], value[2], value[3]); -} - -x11::Future GetIccProfileFuture( - x11::Connection* connection, - size_t monitor) { - std::string atom_name = monitor == 0 - ? "_ICC_PROFILE" - : base::StringPrintf("_ICC_PROFILE_%zu", monitor); - auto future = connection->GetProperty({ - .window = connection->default_root(), - .property = x11::GetAtom(atom_name.c_str()), - .long_length = std::numeric_limits::max(), - }); - future.IgnoreError(); - return future; -} - -gfx::ICCProfile GetIccProfileSync(x11::Future future) { - auto response = future.Sync(); - if (!response || !response->value->size()) { - return gfx::ICCProfile(); - } - return gfx::ICCProfile::FromData(response->value->data(), - response->value->size()); -} - -x11::Future GetEdidFuture( - x11::Connection* connection, - x11::RandR::Output output) { - auto future = connection->randr().GetOutputProperty({ - .output = output, - .property = x11::GetAtom(kRandrEdidProperty), - .long_length = 128, - }); - future.IgnoreError(); - return future; -} - // Sets the work area on a list of displays. The work area for each display // must already be initialized to the display bounds. At most one display out // of |displays| will be affected. void ClipWorkArea(std::vector* displays, - size_t primary_display_index, - const gfx::Rect& net_workarea) { - if (net_workarea.IsEmpty()) { + size_t primary_display_index) { + x11::Window x_root_window = ui::GetX11RootWindow(); + + std::vector value; + if (!x11::Connection::Get()->GetArrayProperty( + x_root_window, x11::GetAtom("_NET_WORKAREA"), &value) || + value.size() < 4) { return; } - auto get_work_area = [&](const display::Display& display) { float scale = display::Display::HasForceDeviceScaleFactor() ? display::Display::GetForcedDeviceScaleFactor() : display.device_scale_factor(); - return gfx::ScaleToEnclosingRect(net_workarea, 1.0f / scale); + return gfx::ScaleToEnclosingRect( + gfx::Rect(value[0], value[1], value[2], value[3]), 1.0f / scale); }; // If the work area entirely contains exactly one display, assume it's meant @@ -207,9 +158,14 @@ int DefaultBitsPerComponent() { return visual.bits_per_rgb_value; } -// Get the EDID data from the `output` and stores to `edid`. -std::vector GetEdidProperty( - x11::Response response) { +// Get the EDID data from the |output| and stores to |edid|. +std::vector GetEDIDProperty(x11::RandR* randr, + x11::RandR::Output output) { + auto future = randr->GetOutputProperty(x11::RandR::GetOutputPropertyRequest{ + .output = output, + .property = x11::GetAtom(kRandrEdidProperty), + .long_length = 128}); + auto response = future.Sync(); std::vector edid; if (response && response->format == 8 && response->type != x11::Atom::None) { edid = std::move(response->data); @@ -261,8 +217,7 @@ std::vector GetFallbackDisplayList( std::vector GetFallbackDisplayList( float scale, size_t* primary_display_index_out) { - auto* connection = x11::Connection::Get(); - const auto& screen = connection->default_screen(); + const auto& screen = x11::Connection::Get()->default_screen(); gfx::Size physical_size(screen.width_in_millimeters, screen.height_in_millimeters); @@ -289,9 +244,7 @@ std::vector GetFallbackDisplayList( std::vector displays{gfx_display}; *primary_display_index_out = 0; - ClipWorkArea(&displays, *primary_display_index_out, - GetWorkAreaSync(GetWorkAreaFuture(connection))); - + ClipWorkArea(&displays, *primary_display_index_out); return displays; } -@@ -307,16 +260,7 @@ std::vector BuildDisplaysFromXRandRI +@@ -308,16 +261,7 @@ std::vector BuildDisplaysFromXRandRI auto x_root_window = ui::GetX11RootWindow(); std::vector displays; - auto resources_future = randr.GetScreenResourcesCurrent({x_root_window}); - auto output_primary_future = randr.GetOutputPrimary({x_root_window}); - x11::Future monitors_future; - if (connection->randr_version() >= std::pair{1, 5}) { - monitors_future = randr.GetMonitors(x_root_window); - } - auto work_area_future = GetWorkAreaFuture(connection); - connection->Flush(); - - auto resources = resources_future.Sync(); + auto resources = randr.GetScreenResourcesCurrent({x_root_window}).Sync(); if (!resources) { LOG(ERROR) << "XRandR returned no displays; falling back to root window"; return GetFallbackDisplayList(primary_scale, primary_display_index_out); -@@ -325,65 +269,21 @@ std::vector BuildDisplaysFromXRandRI +@@ -326,65 +270,21 @@ std::vector BuildDisplaysFromXRandRI const int depth = connection->default_screen().root_depth; const int bits_per_component = DefaultBitsPerComponent(); - auto output_primary = output_primary_future.Sync(); + std::map output_to_monitor = + GetMonitors(connection->randr_version(), &randr, x_root_window); + auto output_primary = randr.GetOutputPrimary({x_root_window}).Sync(); if (!output_primary) { return GetFallbackDisplayList(primary_scale, primary_display_index_out); } x11::RandR::Output primary_display_id = output_primary->output; - const auto monitors_reply = monitors_future.Sync(); - const auto output_to_monitor = GetMonitors(monitors_reply); - const size_t n_iccs = - monitors_reply ? std::max(1, monitors_reply->monitors.size()) : 1; - int explicit_primary_display_index = -1; int monitor_order_primary_display_index = -1; - std::vector> crtc_futures{}; - crtc_futures.reserve(resources->crtcs.size()); - for (auto crtc : resources->crtcs) { - crtc_futures.push_back( - randr.GetCrtcInfo({crtc, resources->config_timestamp})); - } - connection->Flush(); - - std::vector> icc_futures{n_iccs}; -- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) { +- if (!command_line->HasSwitch(switches::kHeadless)) { - for (size_t monitor = 0; monitor < n_iccs; ++monitor) { - icc_futures[monitor] = GetIccProfileFuture(connection, monitor); - } - connection->Flush(); - } - - std::vector> output_futures{}; - output_futures.reserve(resources->outputs.size()); - for (auto output : resources->outputs) { - output_futures.push_back( - randr.GetOutputInfo({output, resources->config_timestamp})); - } - connection->Flush(); - - std::vector> edid_futures{}; - edid_futures.reserve(resources->outputs.size()); - for (auto output : resources->outputs) { - edid_futures.push_back(GetEdidFuture(connection, output)); - } - connection->Flush(); - - base::flat_map crtcs; - for (size_t i = 0; i < resources->crtcs.size(); ++i) { - crtcs.emplace(resources->crtcs[i], crtc_futures[i].Sync()); - } - - std::vector iccs; - iccs.reserve(n_iccs); - for (auto& future : icc_futures) { - iccs.push_back(GetIccProfileSync(std::move(future))); - } - for (size_t i = 0; i < resources->outputs.size(); i++) { x11::RandR::Output output_id = resources->outputs[i]; - auto output_info = output_futures[i].Sync(); + auto output_info = + randr.GetOutputInfo({output_id, resources->config_timestamp}).Sync(); if (!output_info) { continue; } -@@ -398,16 +298,15 @@ std::vector BuildDisplaysFromXRandRI +@@ -399,16 +299,15 @@ std::vector BuildDisplaysFromXRandRI continue; } - auto crtc_it = crtcs.find(output_info->crtc); - if (crtc_it == crtcs.end()) { - continue; - } - const auto& crtc = crtc_it->second; + auto crtc = + randr.GetCrtcInfo({output_info->crtc, resources->config_timestamp}) + .Sync(); if (!crtc) { continue; } - display::EdidParser edid_parser(GetEdidProperty(edid_futures[i].Sync())); + display::EdidParser edid_parser( + GetEDIDProperty(&randr, static_cast(output_id))); auto output_32 = static_cast(output_id); int64_t display_id = output_32 > 0xff ? 0 : edid_parser.GetIndexBasedDisplayId(output_32); -@@ -462,9 +361,8 @@ std::vector BuildDisplaysFromXRandRI +@@ -470,9 +369,8 @@ std::vector BuildDisplaysFromXRandRI } if (!display::HasForceDisplayColorProfile()) { - const size_t monitor = - monitor_iter == output_to_monitor.end() ? 0 : monitor_iter->second; - const auto& icc_profile = iccs[monitor < iccs.size() ? monitor : 0]; + gfx::ICCProfile icc_profile = ui::GetICCProfileForMonitor( + monitor_iter == output_to_monitor.end() ? 0 : monitor_iter->second); gfx::ColorSpace color_space = icc_profile.GetPrimariesOnlyColorSpace(); // Most folks do not have an ICC profile set up, but we still want to -@@ -509,24 +407,63 @@ std::vector BuildDisplaysFromXRandRI +@@ -517,24 +415,63 @@ std::vector BuildDisplaysFromXRandRI ConvertDisplayBoundsToDips(&displays, *primary_display_index_out); } - ClipWorkArea(&displays, *primary_display_index_out, - GetWorkAreaSync(std::move(work_area_future))); + ClipWorkArea(&displays, *primary_display_index_out); return displays; } base::TimeDelta GetPrimaryDisplayRefreshIntervalFromXrandr() { constexpr base::TimeDelta kDefaultInterval = base::Seconds(1. / 60); - - size_t primary_display_index = 0; - auto displays = BuildDisplaysFromXRandRInfo(display::DisplayConfig(), - &primary_display_index); - CHECK_LT(primary_display_index, displays.size()); - + x11::RandR randr = x11::Connection::Get()->randr(); + auto root = ui::GetX11RootWindow(); + auto resources = randr.GetScreenResourcesCurrent({root}).Sync(); + if (!resources) { + return kDefaultInterval; + } // TODO(crbug.com/726842): It might make sense here to pick the output that // the window is on. On the other hand, if compositing is enabled, all drawing // might be synced to the primary output anyway. Needs investigation. - auto frequency = displays[primary_display_index].display_frequency(); - return frequency > 0 ? base::Seconds(1. / frequency) : kDefaultInterval; + auto output_primary = randr.GetOutputPrimary({root}).Sync(); + if (!output_primary) { + return kDefaultInterval; + } + x11::RandR::Output primary_output = output_primary->output; + bool disconnected_primary = false; + for (size_t i = 0; i < resources->outputs.size(); i++) { + if (!disconnected_primary && resources->outputs[i] != primary_output) { + continue; + } + + auto output_info = + randr.GetOutputInfo({primary_output, resources->config_timestamp}) + .Sync(); + if (!output_info) { + continue; + } + + if (output_info->connection != x11::RandR::RandRConnection::Connected) { + // If the primary monitor is disconnected, then start over and choose the + // first connected monitor instead. + if (!disconnected_primary) { + disconnected_primary = true; + i = -1; + } + continue; + } + auto crtc = + randr.GetCrtcInfo({output_info->crtc, resources->config_timestamp}) + .Sync(); + if (!crtc) { + continue; + } + float refresh_rate = + GetRefreshRateFromXRRModeInfo(resources->modes, crtc->mode); + if (refresh_rate == 0) { + continue; + } + + return base::Seconds(1. / refresh_rate); + } + return kDefaultInterval; } int RangeDistance(int min1, int max1, int min2, int max2) {