aboutsummaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorCharlie Li <vishwin@FreeBSD.org>2023-05-26 00:50:15 +0000
committerCharlie Li <vishwin@FreeBSD.org>2023-05-26 00:52:29 +0000
commitabc5ed39ba226d707e7496c8a326309bf02a82ef (patch)
tree754824c263fc737e37daa123bd2576eb7e4a2f08 /devel
parenta3def2cf30f89b6fd6c36384a1364d13de89392a (diff)
downloadports-abc5ed39ba226d707e7496c8a326309bf02a82ef.tar.gz
ports-abc5ed39ba226d707e7496c8a326309bf02a82ef.zip
devel/bazel5: split from devel/bazel
Major versions harbour some incompatibilities. Main port to be updated to 6. Event: Kitchener-Waterloo Hackathon 202305
Diffstat (limited to 'devel')
-rw-r--r--devel/Makefile1
-rw-r--r--devel/bazel5/Makefile104
-rw-r--r--devel/bazel5/distinfo3
-rw-r--r--devel/bazel5/files/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965140
-rw-r--r--devel/bazel5/files/extra-patch-abseil-cpp_absl_base_internal_unscaledcycleclock.cc14
-rw-r--r--devel/bazel5/files/extra-patch-grpc_bazel_grpc__deps.bzl21
-rw-r--r--devel/bazel5/files/extra-patch-upb_bazel_build__defs.bzl10
-rw-r--r--devel/bazel5/files/patch-distdir_deps.bzl21
-rw-r--r--devel/bazel5/files/patch-scripts_bootstrap_BUILD.bootstrap13
-rw-r--r--devel/bazel5/files/patch-scripts_bootstrap_bootstrap.sh11
-rw-r--r--devel/bazel5/files/patch-scripts_bootstrap_buildenv.sh11
-rw-r--r--devel/bazel5/files/patch-src_main_cpp_blaze_util_bsd.cc11
-rw-r--r--devel/bazel5/files/patch-src_main_java_com_google_devtools_build_lib_bazel_rules_python_BazelPythonSemantics.java14
-rw-r--r--devel/bazel5/files/patch-src_main_java_com_google_devtools_build_lib_bazel_rules_python_python__stub__template.txt11
-rw-r--r--devel/bazel5/files/patch-src_main_tools_process-tools-linux.cc10
-rw-r--r--devel/bazel5/files/patch-src_tools_singlejar_port.h14
-rw-r--r--devel/bazel5/pkg-descr5
-rw-r--r--devel/bazel5/pkg-plist2
18 files changed, 416 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index fb34ebb77eb1..16172bbb0ca9 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -272,6 +272,7 @@
SUBDIR += bazel
SUBDIR += bazel-buildtools
SUBDIR += bazel029
+ SUBDIR += bazel5
SUBDIR += bbparse
SUBDIR += bcc
SUBDIR += bcpp
diff --git a/devel/bazel5/Makefile b/devel/bazel5/Makefile
new file mode 100644
index 000000000000..0d76ec1ef052
--- /dev/null
+++ b/devel/bazel5/Makefile
@@ -0,0 +1,104 @@
+PORTNAME= bazel
+DISTVERSION= 5.4.1 # please make sure that science/py-tensorflow builds before updating
+CATEGORIES= devel java
+MASTER_SITES= https://github.com/bazelbuild/${PORTNAME}/releases/download/${DISTVERSION}/
+DISTNAME= bazel-${DISTVERSION}-dist
+PKGNAMESUFFIX= 5
+
+MAINTAINER= vishwin@FreeBSD.org
+COMMENT= Fast and correct build system
+WWW= https://bazel.build/
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+NOT_FOR_ARCHS= i386
+BROKEN_armv6= fails to package: cp: bazel: No such file or directory
+BROKEN_armv7= fails to package: cp: bazel: No such file or directory
+BROKEN_FreeBSD_12_powerpc64= fails to compile: Action failed to execute: java.io.IOException: Cannot run program /usr/bin/clang
+
+BUILD_DEPENDS= bash:shells/bash \
+ zip:archivers/zip
+
+USES= cpe python shebangfix zip
+
+CPE_VENDOR= google
+
+USE_JAVA= yes
+JAVA_VERSION= 11
+JAVA_VENDOR= openjdk
+JAVA_BUILD= yes
+JAVA_RUN= yes
+
+SHEBANG_REGEX= .*(sh|txt|_stub|stub_.*|bazel|get_workspace_status|protobuf_support|_so)
+
+CONFLICTS_INSTALL= bazel[0-9]*
+
+# The bazel binary is also a zip archive (extracted by the elf part), it must not be stripped
+STRIP=
+
+NO_WRKSUBDIR= YES
+
+# In bazel, a release is always code-wise identical to the final release candidate.
+# Hence we can also download that one and so have a simple way to also test earlier release
+# candidates.
+FINALRC= 2
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "aarch64"
+BAZEL_JAVAC_OPTS+= "-J-Xmx1g -J-Xms128m"
+.endif
+
+pre-patch:
+ @${CP} ${FILESDIR}/extra-patch-abseil-cpp_absl_base_internal_unscaledcycleclock.cc \
+ ${FILESDIR}/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965 \
+ ${WRKSRC}/third_party/py/abseil/
+ @${CP} ${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
+# do not work reliably on FreeBSD.
+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 --action_env=PATH=/bin:/usr/bin/:${LOCALBASE}/bin >> ${WRKSRC}/scripts/packages/bazel.bazelrc
+ @${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|%%PYTHON_CMD%%|${PYTHON_CMD}|' \
+ ${WRKSRC}/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
+ @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' \
+ ${WRKSRC}/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt
+ @${REINPLACE_CMD} -e 's|%%JAVA_HOME%%|${JAVA_HOME}|' \
+ ${WRKSRC}/src/main/cpp/blaze_util_bsd.cc
+
+do-build:
+ @${MKDIR} ${WRKDIR}/bazel_tmp
+ (if [ -z "$${SOURCE_DATE_EPOCH}" ] ; \
+ then SOURCE_DATE_EPOCH=`grep TIMESTAMP ${DISTINFO_FILE} \
+ | ${SED} -e 's/[^0-9]//g'`; \
+ fi ; \
+ cd ${WRKSRC} && \
+ ${SETENV} BAZEL_SH=${LOCALBASE}/bin/bash \
+ JAVA_HOME=${JAVA_HOME} \
+ JAVA_VERSION=${JAVA_VERSION} \
+ TMPDIR=${WRKDIR}/bazel_tmp \
+ EMBED_LABEL='${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}' \
+ ${LOCALBASE}/bin/bash ./compile.sh)
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/output/bazel ${STAGEDIR}${PREFIX}/bin
+ @${MKDIR} ${STAGEDIR}${ETCDIR}
+ ${INSTALL_DATA} ${WRKSRC}/scripts/packages/bazel.bazelrc ${STAGEDIR}${ETCDIR}/bazel.bazelrc.sample
+
+.include <bsd.port.post.mk>
diff --git a/devel/bazel5/distinfo b/devel/bazel5/distinfo
new file mode 100644
index 000000000000..d0570c893561
--- /dev/null
+++ b/devel/bazel5/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1685049229
+SHA256 (bazel-5.4.1-dist.zip) = dcff6935756aa7aca4fc569bb2bd26e1537f0b1f6d1bda5f2b200fa835cc507f
+SIZE (bazel-5.4.1-dist.zip) = 235399305
diff --git a/devel/bazel5/files/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965 b/devel/bazel5/files/extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965
new file mode 100644
index 000000000000..211b3e1fc363
--- /dev/null
+++ b/devel/bazel5/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/bazel5/files/extra-patch-abseil-cpp_absl_base_internal_unscaledcycleclock.cc b/devel/bazel5/files/extra-patch-abseil-cpp_absl_base_internal_unscaledcycleclock.cc
new file mode 100644
index 000000000000..d13abc1bd9de
--- /dev/null
+++ b/devel/bazel5/files/extra-patch-abseil-cpp_absl_base_internal_unscaledcycleclock.cc
@@ -0,0 +1,14 @@
+--- absl/base/internal/unscaledcycleclock.cc.orig 2020-08-09 20:09:49 UTC
++++ absl/base/internal/unscaledcycleclock.cc
+@@ -24,8 +24,10 @@
+ #ifdef __GLIBC__
+ #include <sys/platform/ppc.h>
+ #elif defined(__FreeBSD__)
+-#include <sys/sysctl.h>
++#include "absl/base/call_once.h"
+ #include <sys/types.h>
++#include <sys/sysctl.h>
++#include <threads.h>
+ #endif
+ #endif
+
diff --git a/devel/bazel5/files/extra-patch-grpc_bazel_grpc__deps.bzl b/devel/bazel5/files/extra-patch-grpc_bazel_grpc__deps.bzl
new file mode 100644
index 000000000000..0f7c72c97089
--- /dev/null
+++ b/devel/bazel5/files/extra-patch-grpc_bazel_grpc__deps.bzl
@@ -0,0 +1,21 @@
+--- a/bazel/grpc_deps.bzl.orig 2021-09-25 02:33:41 UTC
++++ b/bazel/grpc_deps.bzl
+@@ -284,6 +284,10 @@ def grpc_deps():
+ http_archive(
+ name = "com_google_absl",
+ sha256 = "35f22ef5cb286f09954b7cc4c85b5a3f6221c9d4df6b8c4a1e9d399555b366ee",
++ patches = [
++ "//third_party/grpc:extra-patch-abseil-cpp_absl_base_internal_unscaledcycleclock.cc",
++ "//third_party/grpc:extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965",
++ ],
+ strip_prefix = "abseil-cpp-997aaf3a28308eba1b9156aa35ab7bca9688e9f6",
+ urls = [
+ "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
+@@ -339,6 +343,7 @@ def grpc_deps():
+ http_archive(
+ name = "upb",
+ sha256 = "6a5f67874af66b239b709c572ac1a5a00fdb1b29beaf13c3e6f79b1ba10dc7c4",
++ patches = ["//third_party/grpc:extra-patch-upb_bazel_build__defs.bzl"],
+ strip_prefix = "upb-2de300726a1ba2de9a468468dc5ff9ed17a3215f",
+ urls = [
+ "https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz",
diff --git a/devel/bazel5/files/extra-patch-upb_bazel_build__defs.bzl b/devel/bazel5/files/extra-patch-upb_bazel_build__defs.bzl
new file mode 100644
index 000000000000..2bcce02b3eae
--- /dev/null
+++ b/devel/bazel5/files/extra-patch-upb_bazel_build__defs.bzl
@@ -0,0 +1,10 @@
+--- bazel/build_defs.bzl.orig 2022-01-20 13:04:32.306692000 +0100
++++ bazel/build_defs.bzl 2022-01-20 13:05:02.002057000 +0100
+@@ -35,6 +35,7 @@
+ # "-Wshorten-64-to-32", # not in GCC (and my Kokoro images doesn't have Clang)
+ "-Werror",
+ "-Wno-long-long",
++ "-Wno-deprecated-copy",
+ # copybara:strip_end
+ ],
+ })
diff --git a/devel/bazel5/files/patch-distdir_deps.bzl b/devel/bazel5/files/patch-distdir_deps.bzl
new file mode 100644
index 000000000000..1716a9ed7db8
--- /dev/null
+++ b/devel/bazel5/files/patch-distdir_deps.bzl
@@ -0,0 +1,21 @@
+--- distdir_deps.bzl.orig 1980-01-01 05:00:00 UTC
++++ distdir_deps.bzl
+@@ -130,6 +130,7 @@ DIST_DEPS = {
+ "patch_args": ["-p1"],
+ "patches": [
+ "//third_party/grpc:grpc_1.41.0.patch",
++ "//third_party/grpc:extra-patch-grpc_bazel_grpc__deps.bzl",
+ "//third_party/grpc:grpc_1.41.0.win_arm64.patch",
+ ],
+ "used_in": [
+@@ -167,6 +168,10 @@ DIST_DEPS = {
+ "urls": [
+ "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
+ "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
++ ],
++ "patches": [
++ "//third_party/py/abseil:extra-patch-abseil-cpp_absl_base_internal_unscaledcycleclock.cc",
++ "//third_party/py/abseil:extra-patch-abseil-cpp-cfe27e79cfcbefb2b4479e04f80cbb299bc46965",
+ ],
+ "used_in": [
+ "additional_distfiles",
diff --git a/devel/bazel5/files/patch-scripts_bootstrap_BUILD.bootstrap b/devel/bazel5/files/patch-scripts_bootstrap_BUILD.bootstrap
new file mode 100644
index 000000000000..9b5836b099aa
--- /dev/null
+++ b/devel/bazel5/files/patch-scripts_bootstrap_BUILD.bootstrap
@@ -0,0 +1,13 @@
+--- scripts/bootstrap/BUILD.bootstrap.orig 1979-12-31 23:00:00 UTC
++++ scripts/bootstrap/BUILD.bootstrap
+@@ -16,8 +16,8 @@ default_java_toolchain(
+ "-XX:TieredStopAtLevel=1",
+ ],
+ singlejar = ["//src/tools/singlejar:singlejar"],
+- source_version = "8",
++ source_version = "11",
+ tags = ["manual"],
+- target_version = "8",
++ target_version = "11",
+ visibility = ["//visibility:public"],
+ )
diff --git a/devel/bazel5/files/patch-scripts_bootstrap_bootstrap.sh b/devel/bazel5/files/patch-scripts_bootstrap_bootstrap.sh
new file mode 100644
index 000000000000..76d7ca9ec5d6
--- /dev/null
+++ b/devel/bazel5/files/patch-scripts_bootstrap_bootstrap.sh
@@ -0,0 +1,11 @@
+--- scripts/bootstrap/bootstrap.sh.orig 2020-10-07 21:26:37 UTC
++++ scripts/bootstrap/bootstrap.sh
+@@ -33,7 +33,7 @@ fi
+
+ _BAZEL_ARGS="--spawn_strategy=standalone \
+ --nojava_header_compilation \
+- --strategy=Javac=worker --worker_quit_after_build --ignore_unsupported_sandboxing \
++ --strategy=Javac=standalone --ignore_unsupported_sandboxing --curses=no \
+ --compilation_mode=opt \
+ --distdir=derived/distdir \
+ --java_toolchain=//src/java_tools/buildjar:bootstrap_toolchain \
diff --git a/devel/bazel5/files/patch-scripts_bootstrap_buildenv.sh b/devel/bazel5/files/patch-scripts_bootstrap_buildenv.sh
new file mode 100644
index 000000000000..e7dbf357e0f4
--- /dev/null
+++ b/devel/bazel5/files/patch-scripts_bootstrap_buildenv.sh
@@ -0,0 +1,11 @@
+--- scripts/bootstrap/buildenv.sh.orig 2020-10-07 21:26:37 UTC
++++ scripts/bootstrap/buildenv.sh
+@@ -230,7 +230,7 @@ function clear_log() {
+ rm -f ${phasefile}
+ }
+
+-LEAVES="\xF0\x9F\x8D\x83"
++LEAVES="[LEAVES]"
+ INFO="\033[32mINFO\033[0m:"
+ WARNING="\033[31mWARN\033[0m:"
+
diff --git a/devel/bazel5/files/patch-src_main_cpp_blaze_util_bsd.cc b/devel/bazel5/files/patch-src_main_cpp_blaze_util_bsd.cc
new file mode 100644
index 000000000000..2effc8c23604
--- /dev/null
+++ b/devel/bazel5/files/patch-src_main_cpp_blaze_util_bsd.cc
@@ -0,0 +1,11 @@
+--- src/main/cpp/blaze_util_bsd.cc.orig 1979-12-31 23:00:00 UTC
++++ src/main/cpp/blaze_util_bsd.cc
+@@ -14,7 +14,7 @@
+
+ #if defined(__FreeBSD__)
+ # define HAVE_PROCSTAT
+-# define STANDARD_JAVABASE "/usr/local/openjdk8"
++# define STANDARD_JAVABASE "%%JAVA_HOME%%"
+ #elif defined(__OpenBSD__)
+ # define STANDARD_JAVABASE "/usr/local/jdk-1.8.0"
+ #else
diff --git a/devel/bazel5/files/patch-src_main_java_com_google_devtools_build_lib_bazel_rules_python_BazelPythonSemantics.java b/devel/bazel5/files/patch-src_main_java_com_google_devtools_build_lib_bazel_rules_python_BazelPythonSemantics.java
new file mode 100644
index 000000000000..cbbdd1a9c28b
--- /dev/null
+++ b/devel/bazel5/files/patch-src_main_java_com_google_devtools_build_lib_bazel_rules_python_BazelPythonSemantics.java
@@ -0,0 +1,14 @@
+--- src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java.orig 1979-12-31 23:00:00 UTC
++++ src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
+@@ -238,9 +238,8 @@
+
+ if (OS.getCurrent() != OS.WINDOWS) {
+ PathFragment shExecutable = ShToolchain.getPathOrError(ruleContext);
+- String pythonExecutableName = "python3";
+- // NOTE: keep the following line intact to support nix builds
+- String pythonShebang = "#!/usr/bin/env " + pythonExecutableName;
++ String pythonExecutableName = "%%PYTHON_CMD%%";
++ String pythonShebang = "#!" + pythonExecutableName;
+ ruleContext.registerAction(
+ new SpawnAction.Builder()
+ .addInput(zipFile)
diff --git a/devel/bazel5/files/patch-src_main_java_com_google_devtools_build_lib_bazel_rules_python_python__stub__template.txt b/devel/bazel5/files/patch-src_main_java_com_google_devtools_build_lib_bazel_rules_python_python__stub__template.txt
new file mode 100644
index 000000000000..48e356c4d8d3
--- /dev/null
+++ b/devel/bazel5/files/patch-src_main_java_com_google_devtools_build_lib_bazel_rules_python_python__stub__template.txt
@@ -0,0 +1,11 @@
+--- src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt.orig 1980-01-01 05:00:00 UTC
++++ src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt
+@@ -76,7 +76,7 @@ def SearchPath(name):
+
+ 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/bazel5/files/patch-src_main_tools_process-tools-linux.cc b/devel/bazel5/files/patch-src_main_tools_process-tools-linux.cc
new file mode 100644
index 000000000000..916ff8de5c2b
--- /dev/null
+++ b/devel/bazel5/files/patch-src_main_tools_process-tools-linux.cc
@@ -0,0 +1,10 @@
+--- src/main/tools/process-tools-linux.cc.orig 1979-12-31 23:00:00 UTC
++++ src/main/tools/process-tools-linux.cc
+@@ -17,6 +17,7 @@
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <unistd.h>
++#include <signal.h>
+
+ #include "src/main/tools/process-tools.h"
+
diff --git a/devel/bazel5/files/patch-src_tools_singlejar_port.h b/devel/bazel5/files/patch-src_tools_singlejar_port.h
new file mode 100644
index 000000000000..92fd5f40f22b
--- /dev/null
+++ b/devel/bazel5/files/patch-src_tools_singlejar_port.h
@@ -0,0 +1,14 @@
+--- src/tools/singlejar/port.h.orig 1979-12-31 23:00:00 UTC
++++ src/tools/singlejar/port.h
+@@ -28,6 +28,11 @@
+ #include <sys/types.h>
+ #include <time.h>
+
++#ifndef _OFF64_T_DECLARED
++typedef off_t off64_t;
++#define _OFF64_T_DECLARED
++#endif
++
+ #if defined(__APPLE__)
+ typedef off_t off64_t;
+ #elif defined(_WIN32)
diff --git a/devel/bazel5/pkg-descr b/devel/bazel5/pkg-descr
new file mode 100644
index 000000000000..af6e04cf3ec1
--- /dev/null
+++ b/devel/bazel5/pkg-descr
@@ -0,0 +1,5 @@
+Bazel is Google's own build tool, now publicly available in Beta.
+Bazel has built-in support for building both client and server
+software, including client applications for both Android and iOS
+platforms. It also provides an extensible framework that you can
+use to develop your own build rules.
diff --git a/devel/bazel5/pkg-plist b/devel/bazel5/pkg-plist
new file mode 100644
index 000000000000..d157c119f36f
--- /dev/null
+++ b/devel/bazel5/pkg-plist
@@ -0,0 +1,2 @@
+bin/bazel
+@sample %%ETCDIR%%/bazel.bazelrc.sample