aports/testing/bazel4/APKBUILD
Oleg Titov ae45bd42f2 testing/bazel4: upgrade to 4.2.0
- Ref https://github.com/bazelbuild/bazel/releases/tag/4.2.0
- patch_TEMP_FAILURE_RETRY.patch is backported by upstream as
  9d38cb0cdf
2021-08-20 05:22:16 +00:00

129 lines
4.9 KiB
Plaintext

# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Contributor: Jesse Chan <jc@linux.com>
# Maintainer: Jesse Chan <jc@linux.com>
pkgname=bazel4
pkgver=4.2.0
pkgrel=0
pkgdesc="A fast, scalable, multi-language and extensible build system"
url="https://bazel.build/"
arch="all"
arch="$arch !x86 !armhf !armv7 !mips !mips64" # JDK dropped support
arch="$arch !riscv64" # JDK not yet bootstrapped
arch="$arch !ppc64le" # absl: Must implement UnscaledCycleClock::Frequency()
arch="$arch !s390x" # aborted: SIGFPE (0x8) at pc=0x000003ffb1f18462 (sent by kill)
license="Apache-2.0"
depends="bash java-jdk libarchive unzip zip"
makedepends="coreutils linux-headers protobuf python3 coreutils"
options="!strip"
provides="bazel"
subpackages="
$pkgname-doc
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
"
source="https://github.com/bazelbuild/bazel/releases/download/$pkgver/bazel-$pkgver-dist.zip
patch_do_not_use_glibc_prebuilt.patch
patch_default_system_java_toolchain.patch
patch_fix_jdk_13.patch
patch_stop_hardcoding_verify_none_1.patch
patch_stop_hardcoding_verify_none_2.patch
patch_go_back_to_pre16_permit.patch"
build() {
export JAVA_HOME="/usr/lib/jvm/default-jvm"
# 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
# Stage 1: build Bazel with bootstrap script
# based on
# https://github.com/vbatts/copr-build-bazel/blob/master/bazel.spec
# EXTRA_BAZEL_ARGS is used by bootstrap script only
export EXTRA_BAZEL_ARGS="--sandbox_debug --verbose_failures"
mkdir tmphome-stage1
env HOME="$(pwd)/tmphome-stage1" bash ./compile.sh
env HOME="$(pwd)/tmphome-stage1" ./output/bazel shutdown
# Stage 2: use Bazel to build Bazel in optimized mode
mkdir tmphome-stage2
# We can't use embedded JDK, as there is no alpine support
echo startup --server_javabase=$JAVA_HOME \
>> tmphome-stage2/.bazelrc
env HOME="$(pwd)/tmphome-stage2" ./output/bazel build \
-c opt \
--stamp \
--embed_label $pkgver \
--distdir=derived/distdir \
$EXTRA_BAZEL_ARGS \
//scripts/packages:without-jdk/install.sh
env HOME="$(pwd)/tmphome-stage2" ./output/bazel shutdown
# Copy outputs
rm -rf output && mkdir output
cp bazel-bin/scripts/packages/without-jdk/bazel output
cp bazel-bin/scripts/packages/without-jdk/bazel-real output
cp bazel-bin/scripts/bazel-complete.bash output
cp bazel-bin/scripts/bazel.fish output
cp scripts/zsh_completion/_bazel output
cp tmphome-stage2/.bazelrc output/bazel.bazelrc
}
check() {
mkdir tmphome-check
cp output/bazel.bazelrc tmphome-check/.bazelrc
env HOME="$(pwd)/tmphome-check" ./output/bazel test \
--distdir=derived/distdir \
--spawn_strategy=standalone \
--genrule_strategy=standalone \
--verbose_failures \
--verbose_test_summary \
--test_verbose_timeout_warnings \
examples/cpp:hello-success_test \
examples/py_native:test \
examples/java-starlark/src/test/java/com/example/myproject:pass \
examples/java-native/src/test/java/com/example/myproject:hello
env HOME="$(pwd)/tmphome-check" ./output/bazel shutdown
}
package() {
install -Dm755 output/bazel "$pkgdir"/usr/bin/bazel
install -Dm755 output/bazel-real "$pkgdir"/usr/bin/bazel-real
install -Dm644 output/bazel.bazelrc \
"$pkgdir"/etc/bazel.bazelrc
install -m644 -D -t "$pkgdir"/usr/share/doc/$pkgname README.md
install -Dm644 output/bazel-complete.bash \
"$pkgdir"/usr/share/bash-completion/completions/"$pkgname"
install -Dm644 output/bazel.fish \
"$pkgdir"/usr/share/fish/completions/"$pkgname".fish
install -Dm644 output/_bazel \
"$pkgdir"/usr/share/zsh/site-functions/_"$pkgname"
}
unpack() {
mkdir -p "$builddir"
unzip "$srcdir"/bazel-$pkgver-dist.zip -d "$builddir" > /dev/null
}
sha512sums="
0ce338cbe10be3e26f63afa46d66d49c2b234dfdf9d8b766230cfba1cac6f8570973d5d26072420186e0514e3f3e64faddfed04df523a7154a8bc898d860882a bazel-4.2.0-dist.zip
b8858494f7c600145610d44d2ca81d2cf0e58924b5d876361043b395c88b1166bf9a17de2864ee718e6dce723b7f0c4d71cf8fb9c2ab316eb9013eb5e450ddbe patch_do_not_use_glibc_prebuilt.patch
fe1862bbd392f8a2d7af5f7c5e08fa6cf6dab0ba7b88280c28c4b072241613480e861af60212ceee1aebc10eb629f964c5def2b3e0a75c48453da8c397f4e93b patch_default_system_java_toolchain.patch
0b4b3e541eaa496253e83d6fd88ba98d14c2a53324b7438f57d240b45f2c3c63b659038224e2b66706d4420eccb7c17c834260839f2fd39e3c6b3dea2613b735 patch_fix_jdk_13.patch
f8456643419ac108a7cd72eaccd931e9c269c828611b0a62a79ad80a4f542b83cf5fa69af026e04bfb8d9f2c70527b5b25f9af56edb0a5a696ce66b3032df48d patch_stop_hardcoding_verify_none_1.patch
c5ad25926e5672cd86b27c791c7347b21b57777296cc26d92d2bd9ae6eb39ee81d48008edb666285432135082e91daa9162ea67c719625bcede8f2d5647c9633 patch_stop_hardcoding_verify_none_2.patch
94840b77904cabbaff4d2b011b79699f9b6114e9893af4f8649e397f34ffb0e8c2d9c6d481f9a0cdab39fd00d13c8c76efa8a8fe781c0d3162421764a0a1d6d5 patch_go_back_to_pre16_permit.patch
"