Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Apr 2026 18:37:15 +0000
From:      Xin LI <delphij@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 48ea19d50090 - main - devel/bazel7: Upgrade to 7.7.1.
Message-ID:  <69d2abdb.255a5.7567958f@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by delphij:

URL: https://cgit.FreeBSD.org/ports/commit/?id=48ea19d5009027127df9fbabaa88b96f52674886

commit 48ea19d5009027127df9fbabaa88b96f52674886
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2026-04-05 05:33:39 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2026-04-05 18:36:22 +0000

    devel/bazel7: Upgrade to 7.7.1.
    
    PR:             ports/294256
    Approved by:    yuri (maintainer)
---
 devel/bazel7/Makefile                              |  46 ++++---
 devel/bazel7/distinfo                              |   6 +-
 ...il-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965 | 140 +++++++++++++++++++++
 .../files/extra-patch-grpc_bazel_grpc__deps.bzl    |  20 +++
 .../files/extra-patch-upb_bazel_build__defs.bzl    |  10 ++
 devel/bazel7/files/patch-MODULE.bazel              |  15 +++
 devel/bazel7/files/patch-distdir_deps.bzl          |  20 +++
 ...tools_build_lib_rules_python_PyRuntimeInfo.java |  11 ++
 ...rlark_builtins__bzl_common_python_providers.bzl |  11 ++
 ...ns__bzl_common_python_py__executable__bazel.bzl |  11 ++
 ...llowlists_function__transition__allowlist_BUILD |  14 +++
 ...atch-tools_python_python_bootstrap_template.txt |  11 ++
 .../bazel7/files/patch-tools_python_toolchain.bzl  |  20 +++
 devel/bazel7/files/rules_python_freebsd.patch.in   |  23 ++++
 devel/bazel7/files/toolchain_local-BUILD           |  43 +++++++
 15 files changed, 384 insertions(+), 17 deletions(-)

diff --git a/devel/bazel7/Makefile b/devel/bazel7/Makefile
index 850c6f718113..429f9746da45 100644
--- a/devel/bazel7/Makefile
+++ b/devel/bazel7/Makefile
@@ -1,13 +1,12 @@
 PORTNAME=	bazel
-DISTVERSION=	7.7.0
-PORTREVISION=	1
+DISTVERSION=	7.7.1
 CATEGORIES=	devel java
 MASTER_SITES=	https://github.com/bazelbuild/${PORTNAME}/releases/download/${DISTVERSION}/
 PKGNAMESUFFIX=	7
 DISTNAME=	bazel-${DISTVERSION}-dist
 
 MAINTAINER=	yuri@FreeBSD.org
-COMMENT=	Fast and correct build system
+COMMENT=	Fast and correct build system (LTS 7)
 WWW=		https://bazel.build/
 
 LICENSE=	APACHE20
@@ -38,7 +37,13 @@ NO_WRKSUBDIR=	YES
 BAZEL_JAVAC_OPTS+=	"-J-Xmx1g -J-Xms128m"
 .endif
 
-BINARY_ALIAS=	python3=${PYTHON_CMD}
+pre-patch:
+	@${CP} ${FILESDIR}/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965 \
+		${WRKSRC}/third_party/py/abseil/
+	@${CP} ${FILESDIR}/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965 \
+		${FILESDIR}/extra-patch-grpc_bazel_grpc__deps.bzl \
+		${FILESDIR}/extra-patch-upb_bazel_build__defs.bzl \
+		${WRKSRC}/third_party/grpc/
 
 # Have the location of the system-wide rc file reside ${ETCDIR}.
 # Also adapt the sample file to disable persistent java workers as they
@@ -47,13 +52,28 @@ post-patch:
 	@${REINPLACE_CMD} -e "s|/etc/bazel.bazelrc|${ETCDIR}/bazel.bazelrc|" \
 		${WRKSRC}/src/main/cpp/BUILD
 	@${ECHO_CMD} build --strategy=Javac=standalone >> ${WRKSRC}/scripts/packages/bazel.bazelrc
-	@${ECHO_CMD} build --java_runtime_version=${JAVA_VERSION} >> ${WRKSRC}/scripts/packages/bazel.bazelrc
-	@${ECHO_CMD} build --tool_java_runtime_version=${JAVA_VERSION} >> ${WRKSRC}/scripts/packages/bazel.bazelrc
+	@${ECHO_CMD} build --java_runtime_version=${JAVA_PORT_VERSION} >> ${WRKSRC}/scripts/packages/bazel.bazelrc
+	@${ECHO_CMD} build --tool_java_runtime_version=${JAVA_PORT_VERSION} >> ${WRKSRC}/scripts/packages/bazel.bazelrc
 	@${ECHO_CMD} build --action_env=PATH=/bin:/usr/bin/:${LOCALBASE}/bin >> ${WRKSRC}/scripts/packages/bazel.bazelrc
-	@${REINPLACE_CMD} -e 's|--action_env=PATH \\|--action_env=PATH=${WRKDIR}/.bin:${LOCALBASE}/bin:/usr/bin:/usr/sbin:/bin:/sbin \\|' \
-		${WRKSRC}/compile.sh
+	@${REINPLACE_CMD} \
+		-e 's|^\(PYTHON_BIN=.*\)|if [ "%VERSION%" = "3" ] ; then PYTHON_BIN=${PYTHON_CMD}; else \1 ; fi|' \
+		${WRKSRC}/tools/python/pywrapper_template.txt
+	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' \
+		${WRKSRC}/tools/python/python_bootstrap_template.txt
 	@${REINPLACE_CMD} -e 's|%%JAVA_HOME%%|${JAVA_HOME}|' \
 		${WRKSRC}/src/main/cpp/blaze_util_bsd.cc
+	@${REINPLACE_CMD} -e 's|%%PYTHON_CMD%%|${PYTHON_CMD}|' \
+		${WRKSRC}/src/main/starlark/builtins_bzl/common/python/providers.bzl \
+		${WRKSRC}/src/main/starlark/builtins_bzl/common/python/py_executable_bazel.bzl \
+		${WRKSRC}/src/main/java/com/google/devtools/build/lib/rules/python/PyRuntimeInfo.java \
+		${WRKSRC}/tools/python/toolchain.bzl
+	@${MKDIR} ${WRKSRC}/toolchain_local
+	@${CP} ${FILESDIR}/toolchain_local-BUILD ${WRKSRC}/toolchain_local/BUILD
+	@${CP} ${FILESDIR}/rules_python_freebsd.patch.in \
+		${WRKSRC}/toolchain_local/rules_python_freebsd.patch
+	@${REINPLACE_CMD} -e 's|%%PYTHON_CMD%%|${PYTHON_CMD}|' \
+		${WRKSRC}/toolchain_local/BUILD \
+		${WRKSRC}/toolchain_local/rules_python_freebsd.patch
 
 do-build:
 	@${MKDIR} ${WRKDIR}/bazel_tmp
@@ -62,18 +82,16 @@ do-build:
 	    | ${SED} -e 's/[^0-9]//g'`; \
 	fi ; \
 	cd ${WRKSRC} && \
-	${SETENV} \
-	PATH="${PATH}" \
-	BAZEL_SH=${LOCALBASE}/bin/bash \
+	${SETENV} BAZEL_SH=${LOCALBASE}/bin/bash \
 	JAVA_HOME=${JAVA_HOME} \
-	JAVA_VERSION=${JAVA_VERSION} \
+	JAVA_VERSION=${JAVA_PORT_VERSION} \
 	TMPDIR=${WRKDIR}/bazel_tmp \
 	EMBED_LABEL='${PORTVERSION}' \
+	BAZEL_DEV_VERSION_OVERRIDE='${PORTVERSION}' \
 	PATH=${LOCALBASE}/bin:$$PATH \
 	SOURCE_DATE_EPOCH=$${SOURCE_DATE_EPOCH} \
 	BAZEL_JAVAC_OPTS=${BAZEL_JAVAC_OPTS} \
-	EXTRA_BAZEL_ARGS='--host_javabase=@local_jdk//:jdk --tool_java_runtime_version=local_jdk   --java_language_version=${JAVA_VERSION}  --tool_java_language_version=${JAVA_VERSION}' \
-	BAZEL_DEV_VERSION_OVERRIDE=${PORTVERSION} \
+	EXTRA_BAZEL_ARGS='--host_javabase=@local_jdk//:jdk --tool_java_runtime_version=local_jdk --java_language_version=${JAVA_PORT_VERSION} --tool_java_language_version=${JAVA_PORT_VERSION} --extra_toolchains=//toolchain_local:freebsd_python3_toolchain,//toolchain_local:local_jdk_21_runtime,//toolchain_local:local_jdk_21_bootstrap --action_env=PATH=${LOCALBASE}/bin:/bin:/usr/bin:/sbin:/usr/sbin --host_linkopt=-lm' \
 	${LOCALBASE}/bin/bash ./compile.sh)
 
 do-install:
diff --git a/devel/bazel7/distinfo b/devel/bazel7/distinfo
index aaf1a11a9bdf..77c23d5ede47 100644
--- a/devel/bazel7/distinfo
+++ b/devel/bazel7/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1774224394
-SHA256 (bazel-7.7.0-dist.zip) = 277946818c77fff70be442864cecc41faac862b6f2d0d37033e2da0b1fee7e0f
-SIZE (bazel-7.7.0-dist.zip) = 257612181
+TIMESTAMP = 1731441600
+SHA256 (bazel-7.7.1-dist.zip) = 6181b3570c2f657d989b1141fb0c1a08eb5f08106ca577dc7dc52e7d0238379a
+SIZE (bazel-7.7.1-dist.zip) = 257613455
diff --git a/devel/bazel7/files/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965 b/devel/bazel7/files/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965
new file mode 100644
index 000000000000..211b3e1fc363
--- /dev/null
+++ b/devel/bazel7/files/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965
@@ -0,0 +1,140 @@
+From 1a6044c0ec33ea394c1258ae4e934f1fef3a710f Mon Sep 17 00:00:00 2001
+From: Abseil Team <absl-team@google.com>
+Date: Fri, 5 Aug 2022 06:56:05 -0700
+Subject: [PATCH] Map the absl::is_trivially_* functions to their std impl
+
+There's no point redefining these functions if they are supported by the compiler and the version of libstdc++. Also, some of the builtins used by the absl implementation of these functions (e.g. __has_trivial_destructor) have been deprecated in Clang 15.
+
+PiperOrigin-RevId: 465554125
+Change-Id: I8674c3a5270ce3c654cdf58ae7dbd9d2bda8faa5
+---
+ absl/base/config.h            | 18 ++++++++----------
+ absl/meta/type_traits.h       | 22 ++++++++++++++++++++++
+ absl/meta/type_traits_test.cc |  1 +
+ 3 files changed, 31 insertions(+), 10 deletions(-)
+
+diff --git absl/base/config.h absl/base/config.h
+index 585485c3..ab5791a5 100644
+--- absl/base/config.h
++++ absl/base/config.h
+@@ -259,17 +259,15 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
+ #define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
+ #endif
+ 
+-// ABSL_HAVE_SOURCE_LOCATION_CURRENT
++// ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE
+ //
+-// Indicates whether `absl::SourceLocation::current()` will return useful
+-// information in some contexts.
+-#ifndef ABSL_HAVE_SOURCE_LOCATION_CURRENT
+-#if ABSL_INTERNAL_HAS_KEYWORD(__builtin_LINE) && \
+-    ABSL_INTERNAL_HAS_KEYWORD(__builtin_FILE)
+-#define ABSL_HAVE_SOURCE_LOCATION_CURRENT 1
+-#elif ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(5, 0)
+-#define ABSL_HAVE_SOURCE_LOCATION_CURRENT 1
+-#endif
++// Checks whether `std::is_trivially_copyable<T>` is supported.
++//
++// Notes: Clang 15+ with libc++ supports these features, GCC hasn't been tested.
++#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE)
++#error ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE cannot be directly set
++#elif defined(__clang__) && (__clang_major__ >= 15)
++#define ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1
+ #endif
+ 
+ // ABSL_HAVE_THREAD_LOCAL
+diff --git absl/meta/type_traits.h absl/meta/type_traits.h
+index d886cb30..46b76906 100644
+--- absl/meta/type_traits.h
++++ absl/meta/type_traits.h
+@@ -298,8 +298,12 @@ struct is_function
+ // https://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html#Type-Traits.
+ template <typename T>
+ struct is_trivially_destructible
++#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
++    : std::is_trivially_destructible<T> {
++#else
+     : std::integral_constant<bool, __has_trivial_destructor(T) &&
+                                    std::is_destructible<T>::value> {
++#endif
+ #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
+  private:
+   static constexpr bool compliant = std::is_trivially_destructible<T>::value ==
+@@ -347,9 +351,13 @@ struct is_trivially_destructible
+ // Nontrivially destructible types will cause the expression to be nontrivial.
+ template <typename T>
+ struct is_trivially_default_constructible
++#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
++    : std::is_trivially_default_constructible<T> {
++#else
+     : std::integral_constant<bool, __has_trivial_constructor(T) &&
+                                    std::is_default_constructible<T>::value &&
+                                    is_trivially_destructible<T>::value> {
++#endif
+ #if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \
+     !defined(                                            \
+         ABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION)
+@@ -381,10 +389,14 @@ struct is_trivially_default_constructible
+ // expression to be nontrivial.
+ template <typename T>
+ struct is_trivially_move_constructible
++#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
++    : std::is_trivially_move_constructible<T> {
++#else
+     : std::conditional<
+           std::is_object<T>::value && !std::is_array<T>::value,
+           type_traits_internal::IsTriviallyMoveConstructibleObject<T>,
+           std::is_reference<T>>::type::type {
++#endif
+ #if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \
+     !defined(                                            \
+         ABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION)
+@@ -490,9 +502,13 @@ struct is_trivially_move_assignable
+ // `is_trivially_assignable<T&, const T&>`.
+ template <typename T>
+ struct is_trivially_copy_assignable
++#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
++    : std::is_trivially_copy_assignable<T> {
++#else
+     : std::integral_constant<
+           bool, __has_trivial_assign(typename std::remove_reference<T>::type) &&
+                     absl::is_copy_assignable<T>::value> {
++#endif
+ #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
+  private:
+   static constexpr bool compliant =
+@@ -544,6 +560,11 @@ namespace type_traits_internal {
+ // destructible. Arrays of trivially copyable types are trivially copyable.
+ //
+ // We expose this metafunction only for internal use within absl.
++
++#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE)
++template <typename T>
++struct is_trivially_copyable : std::is_trivially_copyable<T> {};
++#else
+ template <typename T>
+ class is_trivially_copyable_impl {
+   using ExtentsRemoved = typename std::remove_all_extents<T>::type;
+@@ -569,6 +590,7 @@ template <typename T>
+ struct is_trivially_copyable
+     : std::integral_constant<
+           bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
++#endif
+ }  // namespace type_traits_internal
+ 
+ // -----------------------------------------------------------------------------
+diff --git absl/meta/type_traits_test.cc absl/meta/type_traits_test.cc
+index 0ef5b665..fe96554d 100644
+--- absl/meta/type_traits_test.cc
++++ absl/meta/type_traits_test.cc
+@@ -336,6 +336,7 @@ struct MovableNonCopyable {
+ 
+ struct NonCopyableOrMovable {
+   NonCopyableOrMovable() = default;
++  virtual ~NonCopyableOrMovable() = default;
+   NonCopyableOrMovable(const NonCopyableOrMovable&) = delete;
+   NonCopyableOrMovable(NonCopyableOrMovable&&) = delete;
+   NonCopyableOrMovable& operator=(const NonCopyableOrMovable&) = delete;
+-- 
+2.40.1
+
diff --git a/devel/bazel7/files/extra-patch-grpc_bazel_grpc__deps.bzl b/devel/bazel7/files/extra-patch-grpc_bazel_grpc__deps.bzl
new file mode 100644
index 000000000000..9df6915ae780
--- /dev/null
+++ b/devel/bazel7/files/extra-patch-grpc_bazel_grpc__deps.bzl
@@ -0,0 +1,20 @@
+--- a/bazel/grpc_deps.bzl.orig	1980-01-01 00:00:00 UTC
++++ b/bazel/grpc_deps.bzl	2026-03-20 00:00:00 UTC
+@@ -295,6 +295,9 @@
+         http_archive(
+             name = "com_google_absl",
+             sha256 = "4208129b49006089ba1d6710845a45e31c59b0ab6bff9e5788a87f55c5abd602",
++            patches = [
++                "//third_party/grpc:extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965",
++            ],
+             strip_prefix = "abseil-cpp-20220623.0",
+             urls = [
+                 "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/20220623.0.tar.gz",
+@@ -350,6 +353,7 @@
+         http_archive(
+             name = "upb",
+             sha256 = "d0fe259d650bf9547e75896a1307bfc7034195e4ae89f5139814d295991ba681",
++            patches = ["//third_party/grpc:extra-patch-upb_bazel_build__defs.bzl"],
+             strip_prefix = "upb-bef53686ec702607971bd3ea4d4fefd80c6cc6e8",
+             urls = [
+                 "https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/upb/archive/bef53686ec702607971bd3ea4d4fefd80c6cc6e8.tar.gz",
diff --git a/devel/bazel7/files/extra-patch-upb_bazel_build__defs.bzl b/devel/bazel7/files/extra-patch-upb_bazel_build__defs.bzl
new file mode 100644
index 000000000000..f39653ce4f68
--- /dev/null
+++ b/devel/bazel7/files/extra-patch-upb_bazel_build__defs.bzl
@@ -0,0 +1,10 @@
+--- bazel/build_defs.bzl.orig	2022-06-21 20:39:47 UTC
++++ bazel/build_defs.bzl
+@@ -36,6 +36,7 @@ _DEFAULT_CPPOPTS.extend([
+     # "-Wshorten-64-to-32",  # not in GCC (and my Kokoro images doesn't have Clang)
+     "-Werror",
+     "-Wno-long-long",
++    "-Wno-deprecated-copy",
+ ])
+ _DEFAULT_COPTS.extend([
+     "-std=c99",
diff --git a/devel/bazel7/files/patch-MODULE.bazel b/devel/bazel7/files/patch-MODULE.bazel
new file mode 100644
index 000000000000..19e9de0e54e6
--- /dev/null
+++ b/devel/bazel7/files/patch-MODULE.bazel
@@ -0,0 +1,15 @@
+--- MODULE.bazel.orig	2026-03-24 07:09:07 UTC
++++ MODULE.bazel
+@@ -60,6 +60,12 @@ single_version_override(
+     ],
+ )
+ 
++single_version_override(
++    module_name = "rules_python",
++    patch_strip = 1,
++    patches = ["//toolchain_local:rules_python_freebsd.patch"],
++)
++
+ # The following Bazel modules are not direct dependencies for building Bazel,
+ # but are required for visibility from DIST_ARCHIVE_REPOS in repositories.bzl
+ bazel_dep(name = "apple_support", version = "1.23.1")
diff --git a/devel/bazel7/files/patch-distdir_deps.bzl b/devel/bazel7/files/patch-distdir_deps.bzl
new file mode 100644
index 000000000000..47a5c6171b59
--- /dev/null
+++ b/devel/bazel7/files/patch-distdir_deps.bzl
@@ -0,0 +1,20 @@
+--- distdir_deps.bzl.orig	1980-01-01 00:00:00 UTC
++++ distdir_deps.bzl
+@@ -167,6 +167,7 @@ DIST_DEPS = {
+         "patch_args": ["-p1"],
+         "patches": [
+             "//third_party/grpc:grpc_1.48.1.patch",
++            "//third_party/grpc:extra-patch-grpc_bazel_grpc__deps.bzl",
+             "//third_party/grpc:grpc_1.48.1.win_arm64.patch",
+         ],
+         "used_in": [
+@@ -278,6 +279,9 @@ DIST_DEPS = {
+         "urls": [
+             "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.tar.gz",
+             "https://github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.tar.gz",
++        ],
++        "patches": [
++            "//third_party/py/abseil:extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965",
+         ],
+         "used_in": [
+             "additional_distfiles",
diff --git a/devel/bazel7/files/patch-src_main_java_com_google_devtools_build_lib_rules_python_PyRuntimeInfo.java b/devel/bazel7/files/patch-src_main_java_com_google_devtools_build_lib_rules_python_PyRuntimeInfo.java
new file mode 100644
index 000000000000..1585d320b5c9
--- /dev/null
+++ b/devel/bazel7/files/patch-src_main_java_com_google_devtools_build_lib_rules_python_PyRuntimeInfo.java
@@ -0,0 +1,11 @@
+--- src/main/java/com/google/devtools/build/lib/rules/python/PyRuntimeInfo.java.orig	1980-01-01 00:00:00 UTC
++++ src/main/java/com/google/devtools/build/lib/rules/python/PyRuntimeInfo.java
+@@ -45,7 +45,7 @@ public final class PyRuntimeInfo {
+   public static final PyRuntimeInfoProvider PROVIDER = new PyRuntimeInfoProvider();
+ 
+   // Only present so PyRuntimeRule can reference it as a default.
+-  static final String DEFAULT_STUB_SHEBANG = "#!/usr/bin/env python3";
++  static final String DEFAULT_STUB_SHEBANG = "#!%%PYTHON_CMD%%";
+ 
+   // Only present so PyRuntimeRule can reference it as a default.
+   // Must call getToolsLabel() when using this.
diff --git a/devel/bazel7/files/patch-src_main_starlark_builtins__bzl_common_python_providers.bzl b/devel/bazel7/files/patch-src_main_starlark_builtins__bzl_common_python_providers.bzl
new file mode 100644
index 000000000000..000e41ef7dbd
--- /dev/null
+++ b/devel/bazel7/files/patch-src_main_starlark_builtins__bzl_common_python_providers.bzl
@@ -0,0 +1,11 @@
+--- src/main/starlark/builtins_bzl/common/python/providers.bzl.orig	1980-01-01 00:00:00 UTC
++++ src/main/starlark/builtins_bzl/common/python/providers.bzl
+@@ -18,7 +18,7 @@ _CcInfo = _builtins.toplevel.CcInfo
+ _CcInfo = _builtins.toplevel.CcInfo
+ 
+ # NOTE: This is copied to PyRuntimeInfo.java
+-DEFAULT_STUB_SHEBANG = "#!/usr/bin/env python3"
++DEFAULT_STUB_SHEBANG = "#!%%PYTHON_CMD%%"
+ 
+ # NOTE: This is copied to PyRuntimeInfo.java
+ DEFAULT_BOOTSTRAP_TEMPLATE = "@" + TOOLS_REPO + "//tools/python:python_bootstrap_template.txt"
diff --git a/devel/bazel7/files/patch-src_main_starlark_builtins__bzl_common_python_py__executable__bazel.bzl b/devel/bazel7/files/patch-src_main_starlark_builtins__bzl_common_python_py__executable__bazel.bzl
new file mode 100644
index 000000000000..1779775aaa35
--- /dev/null
+++ b/devel/bazel7/files/patch-src_main_starlark_builtins__bzl_common_python_py__executable__bazel.bzl
@@ -0,0 +1,11 @@
+--- src/main/starlark/builtins_bzl/common/python/py_executable_bazel.bzl.orig	1980-01-01 00:00:00 UTC
++++ src/main/starlark/builtins_bzl/common/python/py_executable_bazel.bzl
+@@ -431,7 +431,7 @@ def _create_executable_zip_file(ctx, *, output, zip_fi
+ def _create_executable_zip_file(ctx, *, output, zip_file):
+     ctx.actions.run_shell(
+         command = "echo '{shebang}' | cat - {zip} > {output}".format(
+-            shebang = "#!/usr/bin/env python3",
++            shebang = "#!%%PYTHON_CMD%%",
+             zip = zip_file.path,
+             output = output.path,
+         ),
diff --git a/devel/bazel7/files/patch-tools_allowlists_function__transition__allowlist_BUILD b/devel/bazel7/files/patch-tools_allowlists_function__transition__allowlist_BUILD
new file mode 100644
index 000000000000..8ebce3d8f6d7
--- /dev/null
+++ b/devel/bazel7/files/patch-tools_allowlists_function__transition__allowlist_BUILD
@@ -0,0 +1,14 @@
+--- tools/allowlists/function_transition_allowlist/BUILD.orig	1980-01-01 00:00:00 UTC
++++ tools/allowlists/function_transition_allowlist/BUILD
+@@ -1,6 +1,11 @@
+ # Description:
+ #   Package group restricting access to starlark-defined transitions
+ 
++package_group(
++    name = "function_transition_allowlist",
++    packages = ["public"],
++)
++
+ filegroup(
+     name = "srcs",
+     srcs = glob(["**"]),
diff --git a/devel/bazel7/files/patch-tools_python_python_bootstrap_template.txt b/devel/bazel7/files/patch-tools_python_python_bootstrap_template.txt
new file mode 100644
index 000000000000..e6f8ff567a22
--- /dev/null
+++ b/devel/bazel7/files/patch-tools_python_python_bootstrap_template.txt
@@ -0,0 +1,11 @@
+--- tools/python/python_bootstrap_template.txt.orig	1980-01-01 00:00:00 UTC
++++ tools/python/python_bootstrap_template.txt
+@@ -76,7 +76,7 @@
+
+ def SearchPath(name):
+   """Finds a file in a given search path."""
+-  search_path = os.getenv('PATH', os.defpath).split(os.pathsep)
++  search_path = os.getenv('PATH', os.defpath + ":%%PREFIX%%/bin").split(os.pathsep)
+   for directory in search_path:
+     if directory:
+       path = os.path.join(directory, name)
diff --git a/devel/bazel7/files/patch-tools_python_toolchain.bzl b/devel/bazel7/files/patch-tools_python_toolchain.bzl
new file mode 100644
index 000000000000..7332fb02c863
--- /dev/null
+++ b/devel/bazel7/files/patch-tools_python_toolchain.bzl
@@ -0,0 +1,20 @@
+--- tools/python/toolchain.bzl.orig	1980-01-01 00:00:00 UTC
++++ tools/python/toolchain.bzl
+@@ -191,7 +191,7 @@ def define_autodetecting_toolchain(
+         name = "_autodetecting_py3_runtime",
+         interpreter = ":py3wrapper.sh",
+         python_version = "PY3",
+-        stub_shebang = "#!/usr/bin/env python3",
++        stub_shebang = "#!%%PYTHON_CMD%%",
+         visibility = ["//visibility:private"],
+     )
+ 
+@@ -199,7 +199,7 @@ def define_autodetecting_toolchain(
+         name = "_autodetecting_py3_runtime_nonstrict",
+         interpreter = ":py3wrapper_nonstrict.sh",
+         python_version = "PY3",
+-        stub_shebang = "#!/usr/bin/env python3",
++        stub_shebang = "#!%%PYTHON_CMD%%",
+         visibility = ["//visibility:private"],
+     )
+ 
diff --git a/devel/bazel7/files/rules_python_freebsd.patch.in b/devel/bazel7/files/rules_python_freebsd.patch.in
new file mode 100644
index 000000000000..24bb619dc7fa
--- /dev/null
+++ b/devel/bazel7/files/rules_python_freebsd.patch.in
@@ -0,0 +1,23 @@
+--- a/python/private/autodetecting_toolchain.bzl
++++ b/python/private/autodetecting_toolchain.bzl
+@@ -34,7 +34,7 @@
+     py_runtime(
+         name = "_autodetecting_py3_runtime",
+         interpreter = "//python/private:autodetecting_toolchain_interpreter.sh",
+         python_version = "PY3",
+-        stub_shebang = "#!/usr/bin/env python3",
++        stub_shebang = "#!%%PYTHON_CMD%%",
+         visibility = ["//visibility:private"],
+     )
+
+--- a/python/private/common/py_executable_bazel.bzl
++++ b/python/private/common/py_executable_bazel.bzl
+@@ -535,7 +535,7 @@
+             runtime_details = runtime_details,
+             is_for_zip = True,
+         )
+     else:
+-        ctx.actions.write(prelude, "#!/usr/bin/env python3\n")
++        ctx.actions.write(prelude, "#!%%PYTHON_CMD%%\n")
+
+     ctx.actions.run_shell(
diff --git a/devel/bazel7/files/toolchain_local-BUILD b/devel/bazel7/files/toolchain_local-BUILD
new file mode 100644
index 000000000000..e03f8e6e66ea
--- /dev/null
+++ b/devel/bazel7/files/toolchain_local-BUILD
@@ -0,0 +1,43 @@
+load("@rules_python//python:py_runtime.bzl", "py_runtime")
+load("@rules_python//python:py_runtime_pair.bzl", "py_runtime_pair")
+
+package(default_visibility = ["//visibility:public"])
+
+exports_files(["rules_python_freebsd.patch"])
+
+config_setting(
+    name = "remotejdk_21_setting",
+    values = {"java_runtime_version": "remotejdk_21"},
+)
+
+toolchain(
+    name = "local_jdk_21_runtime",
+    target_settings = [":remotejdk_21_setting"],
+    toolchain_type = "@bazel_tools//tools/jdk:runtime_toolchain_type",
+    toolchain = "@local_jdk//:jdk",
+)
+
+toolchain(
+    name = "local_jdk_21_bootstrap",
+    target_settings = [":remotejdk_21_setting"],
+    toolchain_type = "@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type",
+    toolchain = "@local_jdk//:jdk",
+)
+
+py_runtime(
+    name = "freebsd_py3_runtime",
+    interpreter_path = "%%PYTHON_CMD%%",
+    python_version = "PY3",
+    stub_shebang = "#!%%PYTHON_CMD%%",
+)
+
+py_runtime_pair(
+    name = "freebsd_py_runtime_pair",
+    py3_runtime = ":freebsd_py3_runtime",
+)
+
+toolchain(
+    name = "freebsd_python3_toolchain",
+    toolchain = ":freebsd_py_runtime_pair",
+    toolchain_type = "@rules_python//python:toolchain_type",
+)


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69d2abdb.255a5.7567958f>