aboutsummaryrefslogtreecommitdiffstats
path: root/testing/bazel
diff options
context:
space:
mode:
authorOleg Titov <oleg.titov@gmail.com>2019-05-12 14:22:35 -0500
committerRasmus Thomsen <oss@cogitri.dev>2019-12-30 17:49:54 +0100
commita47e956de4896ec3ee053ddbc144568444ac35a0 (patch)
treecb442bbafc503d4c3b186ee2477276dcfc4347df /testing/bazel
parent1d2aa57717d54e74db0787fa44d83685c88b7079 (diff)
downloadaports-a47e956de4896ec3ee053ddbc144568444ac35a0.tar.bz2
aports-a47e956de4896ec3ee053ddbc144568444ac35a0.tar.xz
testing/bazel: new aport
https://bazel.build A fast, scalable, multi-language and extensible build system
Diffstat (limited to 'testing/bazel')
-rw-r--r--testing/bazel/APKBUILD73
-rw-r--r--testing/bazel/python3.patch36
2 files changed, 109 insertions, 0 deletions
diff --git a/testing/bazel/APKBUILD b/testing/bazel/APKBUILD
new file mode 100644
index 0000000000..81c7e12a84
--- /dev/null
+++ b/testing/bazel/APKBUILD
@@ -0,0 +1,73 @@
+# Contributor: Oleg Titov <oleg.titov@gmail.com>
+# Maintainer: Oleg Titov <oleg.titov@gmail.com>
+pkgname=bazel
+pkgver=2.0.0
+pkgrel=0
+pkgdesc="A fast, scalable, multi-language and extensible build system"
+url="https://bazel.build"
+arch="x86_64"
+license="Apache-2.0"
+depends="libarchive zip unzip"
+# openjdk8 is a must, python3 is a must
+makedepends="bash openjdk8 python3 linux-headers protobuf"
+subpackages="
+ $pkgname-doc
+ $pkgname-zsh-completion:zshcomp:noarch
+ $pkgname-examples::noarch
+ "
+source="https://github.com/bazelbuild/bazel/releases/download/$pkgver/bazel-$pkgver-dist.zip
+ python3.patch"
+
+build() {
+ export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
+ export PYTHON_BIN_PATH=/usr/bin/python3
+
+ env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" \
+ bash ./compile.sh
+
+ ./output/bazel shutdown
+}
+
+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 -m644 -D -t "$pkgdir"/usr/share/doc/$pkgname README.md
+}
+
+zshcomp() {
+ depends=""
+ pkgdesc="Zsh completion for $pkgname"
+ install_if="$pkgname=$pkgver-r$pkgrel zsh"
+
+ mkdir -p "$subpkgdir"/usr/share/zsh/site-functions
+ mv "$builddir"/scripts/zsh_completion/_bazel \
+ "$subpkgdir"/usr/share/zsh/site-functions/_bazel
+}
+
+examples() {
+ mkdir -p "$subpkgdir"/usr/share/doc/"$pkgname"
+ for d in examples third_party tools; do
+ mv "$builddir/$d" "$subpkgdir/usr/share/doc/$pkgname"
+ done
+}
+
+unpack() {
+ mkdir -p "$builddir"
+ unzip "$srcdir"/bazel-$pkgver-dist.zip -d "$builddir" > /dev/null
+}
+
+sha512sums="db609e9d0ee0cdbfb999de850db17907af02dc26e605f4617dfeb2fbac5c30c4c0a9f48c6ba3673ffe8babb5b9e157cc51c32832015b85ed279b6b160506cdae bazel-2.0.0-dist.zip
+0f8fddb7a43f6382a003037e1ba0cfc0e7f510f341a4a29c73e13cc7f64862d6156e14111005f300b0dad22815bd95b3670f8e0d33ce3f4388b0990bbbc5c5e6 python3.patch"
diff --git a/testing/bazel/python3.patch b/testing/bazel/python3.patch
new file mode 100644
index 0000000000..e427ba83ad
--- /dev/null
+++ b/testing/bazel/python3.patch
@@ -0,0 +1,36 @@
+Some scripts rely on /usr/bin/pyhton.
+
+python2 package provides /usr/bin/python as a link to /usr/bin/python2
+so there is no any issue here, but we do not want python2.
+
+python3 package do not provide /usr/bin/python, only /usr/bin/python3.
+
+To make things work we need to change shebang '#!/usr/bin/env python' to
+'#!/usr/bin/env python3'.
+
+This is a longstanding issue, one of the first traces to it could be seen
+here [1] and here [2].
+
+[1] https://github.com/bazelbuild/bazel/issues/544
+[2] https://github.com/bazelbuild/bazel/issues/8446
+
+
+--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt.orig
++++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+
+ from __future__ import absolute_import
+ from __future__ import division
+--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java.orig
++++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java
+@@ -241,7 +241,7 @@
+ .addOutput(executable)
+ .setShellCommand(
+ shExecutable,
+- "echo '#!/usr/bin/env python' | cat - "
++ "echo '#!/usr/bin/env python3' | cat - "
+ + zipFile.getExecPathString()
+ + " > "
+ + executable.getExecPathString())