From 718b806498c3754df6661c669afb4c1b2513f1e4 Mon Sep 17 00:00:00 2001 From: FiliusPatris Date: Wed, 9 Jun 2021 23:40:15 +0200 Subject: [PATCH] New package: bazel-4.1.0 --- ...6dd026e90336e80616a8c1004a79a2f8640c.patch | 40 +++++++++++++++++++ ...6e90336e80616a8c1004a79a2f8640c.patch.args | 1 + srcpkgs/bazel/template | 30 ++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 srcpkgs/bazel/patches/bcce6dd026e90336e80616a8c1004a79a2f8640c.patch create mode 100644 srcpkgs/bazel/patches/bcce6dd026e90336e80616a8c1004a79a2f8640c.patch.args create mode 100644 srcpkgs/bazel/template diff --git a/srcpkgs/bazel/patches/bcce6dd026e90336e80616a8c1004a79a2f8640c.patch b/srcpkgs/bazel/patches/bcce6dd026e90336e80616a8c1004a79a2f8640c.patch new file mode 100644 index 000000000000..88f69b76def9 --- /dev/null +++ b/srcpkgs/bazel/patches/bcce6dd026e90336e80616a8c1004a79a2f8640c.patch @@ -0,0 +1,40 @@ +From bcce6dd026e90336e80616a8c1004a79a2f8640c Mon Sep 17 00:00:00 2001 +From: philwo +Date: Thu, 20 May 2021 08:13:09 -0700 +Subject: [PATCH] Add the TEMP_FAILURE_RETRY macro to linux-sandbox-pid1.cc. + +This allows us to build Bazel on Linux systems which use a C standard library that does not include this macro, like Alpine Linux (which uses musl). + +Fixes #12460. + +PiperOrigin-RevId: 374873483 +--- + src/main/tools/linux-sandbox-pid1.cc | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/src/main/tools/linux-sandbox-pid1.cc b/src/main/tools/linux-sandbox-pid1.cc +index 5c9c53cb9cd2..5e7c64a7ac7b 100644 +--- a/src/main/tools/linux-sandbox-pid1.cc ++++ b/src/main/tools/linux-sandbox-pid1.cc +@@ -49,6 +49,19 @@ + #include + #endif + ++#ifndef TEMP_FAILURE_RETRY ++// Some C standard libraries like musl do not define this macro, so we'll ++// include our own version for compatibility. ++#define TEMP_FAILURE_RETRY(exp) \ ++ ({ \ ++ decltype(exp) _rc; \ ++ do { \ ++ _rc = (exp); \ ++ } while (_rc == -1 && errno == EINTR); \ ++ _rc; \ ++ }) ++#endif // TEMP_FAILURE_RETRY ++ + #include "src/main/tools/linux-sandbox-options.h" + #include "src/main/tools/linux-sandbox.h" + #include "src/main/tools/logging.h" + + diff --git a/srcpkgs/bazel/patches/bcce6dd026e90336e80616a8c1004a79a2f8640c.patch.args b/srcpkgs/bazel/patches/bcce6dd026e90336e80616a8c1004a79a2f8640c.patch.args new file mode 100644 index 000000000000..daa0cbeb2c76 --- /dev/null +++ b/srcpkgs/bazel/patches/bcce6dd026e90336e80616a8c1004a79a2f8640c.patch.args @@ -0,0 +1 @@ +-p1 diff --git a/srcpkgs/bazel/template b/srcpkgs/bazel/template new file mode 100644 index 000000000000..984ccdb91841 --- /dev/null +++ b/srcpkgs/bazel/template @@ -0,0 +1,30 @@ +# Template file for 'bazel' +pkgname=bazel +version=4.1.0 +revision=3 +#archs="i686 x86_64" +#wrksrc= +create_wrksrc=yes +#build_style= +hostmakedepends="" +makedepends="which zip unzip openjdk11 python3" +depends="" +short_desc="A fast, scalable, multi-language and extensible build system" +maintainer="TobTobXX " +license="Apache-2.0" +homepage="https://bazel.build/" +distfiles="https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip" +checksum=f377d755c96a50f6bd2f423562598d822f43356783330a0b780ad442864d6eeb + +# Stripping breaks the binary: +# https://github.com/bazelbuild/bazel/issues/600#issuecomment-156456154 +nostrip=yes + +# Instructions for bootstrapping bazel are here: +# https://docs.bazel.build/versions/4.1.0/install-compile-source.html#bootstrap-bazel +do_build() { + env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh +} +do_install() { + vbin output/bazel +}