git: 57741b1593b2 - main - devel/electron{34,36,37,38}: Fix build when rust is not installed in time
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 08 Nov 2025 04:10:11 UTC
The branch main has been updated by tagattie:
URL: https://cgit.FreeBSD.org/ports/commit/?id=57741b1593b29deed43b0e0f3bf79b4a1a2e2ce1
commit 57741b1593b29deed43b0e0f3bf79b4a1a2e2ce1
Author: Hiroki Tagato <tagattie@FreeBSD.org>
AuthorDate: 2025-11-08 04:07:46 +0000
Commit: Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2025-11-08 04:10:00 +0000
devel/electron{34,36,37,38}: Fix build when rust is not installed in time
VAR!= gets expanded on the first make invocation and because rust is a
build dependency, it might not be installed at that time, so getting
the version of rustc was erratic.
Use gn to get the version instead.
Reported by: mikael (via private email)
Obtained from: https://cgit.freebsd.org/ports/commit/?id=ee86324cade722c6cb8013545e6b8a8c6b05cf82
---
devel/electron34/Makefile | 5 ++---
devel/electron34/files/patch-build_config_rust.gni | 26 +++++++++++++++-------
devel/electron36/Makefile | 5 ++---
devel/electron36/files/patch-build_config_rust.gni | 26 +++++++++++++++-------
devel/electron37/Makefile | 5 ++---
devel/electron37/files/patch-build_config_rust.gni | 14 ++++++++++--
.../files/patch-build_dotfile__settings.gni | 10 +++++++++
devel/electron38/Makefile | 5 ++---
devel/electron38/files/patch-build_config_rust.gni | 14 ++++++++++--
.../files/patch-build_dotfile__settings.gni | 10 +++++++++
10 files changed, 88 insertions(+), 32 deletions(-)
diff --git a/devel/electron34/Makefile b/devel/electron34/Makefile
index 47c2cd95212b..43ae1b09a022 100644
--- a/devel/electron34/Makefile
+++ b/devel/electron34/Makefile
@@ -291,11 +291,9 @@ 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}"
+ rust_sysroot_absolute="${LOCALBASE}"
pre-everything::
@${ECHO_MSG}
@@ -380,6 +378,7 @@ pre-configure:
.endfor
touch ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/pulseaudio-${PULSEV}/src/pulse/version.h
@${REINPLACE_CMD} -e 's|$${LOCALBASE}|${LOCALBASE}|;s|$${MODCLANG_VERSION}|${LLVM_DEFAULT}|' \
+ ${WRKSRC}/build/config/rust.gni \
${WRKSRC}/build/rust/rust_bindgen.gni \
${WRKSRC}/build/rust/rust_bindgen_generator.gni
diff --git a/devel/electron34/files/patch-build_config_rust.gni b/devel/electron34/files/patch-build_config_rust.gni
index 693d21f030d8..c4b8cb874d33 100644
--- a/devel/electron34/files/patch-build_config_rust.gni
+++ b/devel/electron34/files/patch-build_config_rust.gni
@@ -1,13 +1,23 @@
---- build/config/rust.gni.orig 2025-01-27 17:37:37 UTC
+--- build/config/rust.gni.orig 2025-02-24 19:59:26 UTC
+++ build/config/rust.gni
-@@ -298,6 +298,10 @@ if (is_linux || is_chromeos) {
- }
- }
+@@ -69,7 +69,8 @@ declare_args() {
+ # set this to the output of `rustc -V`. Changing this string will cause all
+ # Rust targets to be rebuilt, which allows you to update your toolchain and
+ # not break incremental builds.
+- rustc_version = ""
++ rustc_version = exec_script("//build/gn_run_binary.py",
++ [ "${LOCALBASE}/bin/rustc", "-V" ], "trim string")
-+if (is_bsd) {
-+ rust_abi_target = string_replace(rust_abi_target, "linux-gnu", current_os)
+ # If you're using a Rust toolchain as specified by rust_sysroot_absolute,
+ # you can specify whether it supports nacl here.
+@@ -296,6 +297,10 @@ if (is_linux || is_chromeos) {
+ } else {
+ assert(false, "Architecture not supported")
+ }
+}
+
- assert(!toolchain_has_rust || rust_abi_target != "")
++if (is_bsd) {
++ rust_abi_target = string_replace(rust_abi_target, "linux-gnu", current_os)
+ }
- # This variable is passed to the Rust libstd build.
+ assert(!toolchain_has_rust || rust_abi_target != "")
diff --git a/devel/electron36/Makefile b/devel/electron36/Makefile
index 18efc64ae1a2..3365ecc32fd1 100644
--- a/devel/electron36/Makefile
+++ b/devel/electron36/Makefile
@@ -289,11 +289,9 @@ 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}"
+ rust_sysroot_absolute="${LOCALBASE}"
pre-everything::
@${ECHO_MSG}
@@ -378,6 +376,7 @@ pre-configure:
.endfor
touch ${WRKDIR}/${PORTNAME}-${ELECTRON_VER}/pulseaudio-${PULSEV}/src/pulse/version.h
@${REINPLACE_CMD} -e 's|$${LOCALBASE}|${LOCALBASE}|;s|$${MODCLANG_VERSION}|${LLVM_DEFAULT}|' \
+ ${WRKSRC}/build/config/rust.gni \
${WRKSRC}/build/rust/rust_bindgen.gni \
${WRKSRC}/build/rust/rust_bindgen_generator.gni
diff --git a/devel/electron36/files/patch-build_config_rust.gni b/devel/electron36/files/patch-build_config_rust.gni
index f4a09c1206c3..ce4c4bfe1255 100644
--- a/devel/electron36/files/patch-build_config_rust.gni
+++ b/devel/electron36/files/patch-build_config_rust.gni
@@ -1,13 +1,23 @@
---- build/config/rust.gni.orig 2025-04-22 20:15:27 UTC
+--- build/config/rust.gni.orig 2025-06-16 18:02:10 UTC
+++ build/config/rust.gni
-@@ -346,6 +346,10 @@ if (is_linux || is_chromeos) {
- }
- }
+@@ -69,7 +69,8 @@ declare_args() {
+ # set this to the output of `rustc -V`. Changing this string will cause all
+ # Rust targets to be rebuilt, which allows you to update your toolchain and
+ # not break incremental builds.
+- rustc_version = ""
++ rustc_version = exec_script("//build/gn_run_binary.py",
++ [ "${LOCALBASE}/bin/rustc", "-V" ], "trim string")
-+if (is_bsd) {
-+ rust_abi_target = string_replace(rust_abi_target, "linux-gnu", current_os)
+ # If you're using a Rust toolchain as specified by rust_sysroot_absolute,
+ # you can specify whether it supports nacl here.
+@@ -344,6 +345,10 @@ if (is_linux || is_chromeos) {
+ } else {
+ assert(false, "Architecture not supported")
+ }
+}
+
- assert(!toolchain_has_rust || rust_abi_target != "")
++if (is_bsd) {
++ rust_abi_target = string_replace(rust_abi_target, "linux-gnu", current_os)
+ }
- # This variable is passed to the Rust libstd build.
+ assert(!toolchain_has_rust || rust_abi_target != "")
diff --git a/devel/electron37/Makefile b/devel/electron37/Makefile
index 37125353aec4..545c3015d38c 100644
--- a/devel/electron37/Makefile
+++ b/devel/electron37/Makefile
@@ -291,11 +291,9 @@ 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}"
+ rust_sysroot_absolute="${LOCALBASE}"
pre-everything::
@${ECHO_MSG}
@@ -382,6 +380,7 @@ pre-configure:
.endfor
touch ${WRKSRC:H}/pulseaudio-${PULSEV}/src/pulse/version.h
@${REINPLACE_CMD} -e 's|$${LOCALBASE}|${LOCALBASE}|;s|$${MODCLANG_VERSION}|${LLVM_DEFAULT}|' \
+ ${WRKSRC}/build/config/rust.gni \
${WRKSRC}/build/rust/rust_bindgen.gni \
${WRKSRC}/build/rust/rust_bindgen_generator.gni
diff --git a/devel/electron37/files/patch-build_config_rust.gni b/devel/electron37/files/patch-build_config_rust.gni
index 89d904a80fe9..9d4c1b2ff8ed 100644
--- a/devel/electron37/files/patch-build_config_rust.gni
+++ b/devel/electron37/files/patch-build_config_rust.gni
@@ -1,6 +1,16 @@
---- build/config/rust.gni.orig 2025-06-30 07:04:30 UTC
+--- build/config/rust.gni.orig 2025-08-25 14:15:51 UTC
+++ build/config/rust.gni
-@@ -373,7 +373,11 @@ if (is_linux || is_chromeos) {
+@@ -62,7 +62,8 @@ declare_args() {
+ # set this to the output of `rustc -V`. Changing this string will cause all
+ # Rust targets to be rebuilt, which allows you to update your toolchain and
+ # not break incremental builds.
+- rustc_version = ""
++ rustc_version = exec_script("//build/gn_run_binary.py",
++ [ "${LOCALBASE}/bin/rustc", "-V" ], "trim string")
+
+ # If you're using a Rust toolchain as specified by rust_sysroot_absolute,
+ # you can specify whether it supports nacl here.
+@@ -373,7 +374,11 @@ if (is_linux || is_chromeos) {
}
}
diff --git a/devel/electron37/files/patch-build_dotfile__settings.gni b/devel/electron37/files/patch-build_dotfile__settings.gni
new file mode 100644
index 000000000000..db6058d93cd8
--- /dev/null
+++ b/devel/electron37/files/patch-build_dotfile__settings.gni
@@ -0,0 +1,10 @@
+--- build/dotfile_settings.gni.orig 2025-08-25 14:15:51 UTC
++++ build/dotfile_settings.gni
+@@ -24,6 +24,7 @@ build_dotfile_settings = {
+ "//build/config/mac/mac_sdk.gni",
+ "//build/config/mac/rules.gni",
+ "//build/config/posix/BUILD.gn",
++ "//build/config/rust.gni",
+ "//build/config/win/BUILD.gn",
+ "//build/config/win/visual_studio_version.gni",
+ "//build/rust/analyze.gni",
diff --git a/devel/electron38/Makefile b/devel/electron38/Makefile
index bf7df41832a0..a673d1c30849 100644
--- a/devel/electron38/Makefile
+++ b/devel/electron38/Makefile
@@ -290,11 +290,9 @@ 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}"
+ rust_sysroot_absolute="${LOCALBASE}"
pre-everything::
@${ECHO_MSG}
@@ -381,6 +379,7 @@ pre-configure:
.endfor
touch ${WRKSRC:H}/pulseaudio-${PULSEV}/src/pulse/version.h
@${REINPLACE_CMD} -e 's|$${LOCALBASE}|${LOCALBASE}|;s|$${MODCLANG_VERSION}|${LLVM_DEFAULT}|' \
+ ${WRKSRC}/build/config/rust.gni \
${WRKSRC}/build/rust/rust_bindgen.gni \
${WRKSRC}/build/rust/rust_bindgen_generator.gni
diff --git a/devel/electron38/files/patch-build_config_rust.gni b/devel/electron38/files/patch-build_config_rust.gni
index b9a27a5bae7e..9babc55bcfe1 100644
--- a/devel/electron38/files/patch-build_config_rust.gni
+++ b/devel/electron38/files/patch-build_config_rust.gni
@@ -1,6 +1,16 @@
---- build/config/rust.gni.orig 2025-08-26 20:49:50 UTC
+--- build/config/rust.gni.orig 2025-10-13 21:25:57 UTC
+++ build/config/rust.gni
-@@ -369,7 +369,11 @@ if (is_linux || is_chromeos) {
+@@ -62,7 +62,8 @@ declare_args() {
+ # set this to the output of `rustc -V`. Changing this string will cause all
+ # Rust targets to be rebuilt, which allows you to update your toolchain and
+ # not break incremental builds.
+- rustc_version = ""
++ rustc_version = exec_script("//build/gn_run_binary.py",
++ [ "${LOCALBASE}/bin/rustc", "-V" ], "trim string")
+
+ # Whether artifacts produced by the Rust compiler can participate in ThinLTO.
+ #
+@@ -369,7 +370,11 @@ if (is_linux || is_chromeos) {
}
}
diff --git a/devel/electron38/files/patch-build_dotfile__settings.gni b/devel/electron38/files/patch-build_dotfile__settings.gni
new file mode 100644
index 000000000000..25291df0cb79
--- /dev/null
+++ b/devel/electron38/files/patch-build_dotfile__settings.gni
@@ -0,0 +1,10 @@
+--- build/dotfile_settings.gni.orig 2025-10-13 21:25:57 UTC
++++ build/dotfile_settings.gni
+@@ -24,6 +24,7 @@ build_dotfile_settings = {
+ "//build/config/mac/mac_sdk.gni",
+ "//build/config/mac/rules.gni",
+ "//build/config/posix/BUILD.gn",
++ "//build/config/rust.gni",
+ "//build/config/win/BUILD.gn",
+ "//build/config/win/visual_studio_version.gni",
+ "//build/rust/analyze.gni",