Commit ccc5f7c6 authored by Oleg Titov's avatar Oleg Titov

testing/bazel4: new aport

https://bazel.build/
A fast, scalable, multi-language and extensible build system
parent 2e68211f
Pipeline #75951 passed with stages
in 14 minutes and 57 seconds
# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=bazel4
pkgver=4.0.0
pkgrel=0
pkgdesc="A fast, scalable, multi-language and extensible build system"
url="https://bazel.build/"
arch="all"
arch="$arch !x86 !s390x" # fatal error: jni_md.h: No such file or directory
arch="$arch !armhf !armv7" # java virtual machine runs out of resources
arch="$arch !ppc64le" # build timeouts in CI
arch="$arch !mips !mips64" # no jvm
license="Apache-2.0"
depends="bash libarchive openjdk8 zip unzip"
makedepends="python3 linux-headers protobuf coreutils"
options="!strip"
subpackages="
$pkgname-doc
$pkgname-bash-completion
$pkgname-zsh-completion
"
source="https://github.com/bazelbuild/bazel/releases/download/$pkgver/bazel-$pkgver-dist.zip
patch_TEMP_FAILURE_RETRY.patch"
build() {
# based on
# https://github.com/vbatts/copr-build-bazel/blob/master/bazel.spec
export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
export EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk --sandbox_debug --verbose_failures"
case "$CARCH" in
aarch64)
export EXTRA_BAZEL_ARGS="$EXTRA_BAZEL_ARGS --nokeep_state_after_build --notrack_incremental_state --nokeep_state_after_build" ;;
arm*)
# increase heap size to addess arm* build failures
export BAZEL_JAVAC_OPTS="-J-Xmx2g -J-Xms512m" ;;
s390x)
# increase heap size to addess s390x build failures
export BAZEL_JAVAC_OPTS="-J-Xmx4g -J-Xms512m" ;;
esac
# horrible of horribles, just to have python in the PATH
# https://github.com/bazelbuild/bazel/issues/8665
mkdir -p ./bin-hack
ln -s /usr/bin/python3 ./bin-hack/python
export PATH=$(pwd)/bin-hack:$PATH
bash ./compile.sh
./output/bazel shutdown
./scripts/generate_bash_completion.sh \
--bazel=output/bazel \
--output=output/bazel-complete.bash \
--prepend=scripts/bazel-complete-header.bash \
--prepend=scripts/bazel-complete-template.bash
echo startup --server_javabase=$JAVA_HOME \
>> scripts/packages/bazel.bazelrc
}
check() {
./output/bazel test \
--verbose_failures \
--spawn_strategy=standalone \
--genrule_strategy=standalone \
--verbose_test_summary \
--test_verbose_timeout_warnings \
examples/cpp:hello-success_test
./output/bazel shutdown
}
package() {
install -Dm755 ./scripts/packages/bazel.sh "$pkgdir"/usr/bin/bazel
install -Dm755 ./output/bazel "$pkgdir"/usr/bin/bazel-real
install -Dm755 ./scripts/packages/bazel.bazelrc \
"$pkgdir"/etc/bazel.bazelrc
install -m644 -D -t "$pkgdir"/usr/share/doc/$pkgname README.md
mkdir -p "$pkgdir"/usr/share/bash-completion/completions
mv "$builddir"/output/bazel-complete.bash \
"$pkgdir"/usr/share/bash-completion/completions/bazel
mkdir -p "$pkgdir"/usr/share/zsh/site-functions
mv "$builddir"/scripts/zsh_completion/_bazel \
"$pkgdir"/usr/share/zsh/site-functions/_bazel
}
unpack() {
mkdir -p "$builddir"
unzip "$srcdir"/bazel-$pkgver-dist.zip -d "$builddir" > /dev/null
}
sha512sums="7e89a26b78b0c18bd570618c7610d8de4f6beddbc751efdb5b9357d0309afbf5c83da6b6a367435ce1360361bd010b0987addb4270ba49737ba6b7e8d1f2bb98 bazel-4.0.0-dist.zip
b9e54443431fd0523831a777ab193515151402e61fd74bb2bbf5362136c5bf0fdc3072609a6b52d43b3ff3778759250d81c888c4e158d3d54f78f5a7ff6337c7 patch_TEMP_FAILURE_RETRY.patch"
--- a/src/main/tools/linux-sandbox-pid1.cc.old
+++ b/src/main/tools/linux-sandbox-pid1.cc
@@ -54,6 +54,17 @@
#include "src/main/tools/logging.h"
#include "src/main/tools/process-tools.h"
+// TEPM_FAILURE_RETRY is glibc specific and is not available on e.g. musl
+// Taken from glibc unistd.h
+#ifndef TEMP_FAILURE_RETRY
+# define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+#endif
+
static int global_child_pid;
static void SetupSelfDestruction(int *sync_pipe) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment