Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: bazel
@ 2024-03-10 16:07 sgn
  2024-05-08 16:19 ` [PR PATCH] [Closed]: " sgn
  2024-05-08 16:19 ` sgn
  0 siblings, 2 replies; 3+ messages in thread
From: sgn @ 2024-03-10 16:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]

There is a new pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages bazel
https://github.com/void-linux/void-packages/pull/49221

New package: bazel
<!-- Uncomment relevant sections and delete options which are not applicable -->

Needs bazel for mozc.
Only tested by using bazel to build bazel.

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/49221.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-bazel-49221.patch --]
[-- Type: text/x-diff, Size: 12424 bytes --]

From da1413b29efa94275f2e17a2d8bc2299c90563db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Sun, 10 Mar 2024 23:02:12 +0700
Subject: [PATCH 1/2] New package: bazel-bootstrap-7.0.2

---
 srcpkgs/bazel-bootstrap/patches/gettid.patch  | 29 +++++++++
 srcpkgs/bazel-bootstrap/patches/java.patch    | 12 ++++
 .../bazel-bootstrap/patches/python-3.12.patch | 22 +++++++
 srcpkgs/bazel-bootstrap/template              | 65 +++++++++++++++++++
 4 files changed, 128 insertions(+)
 create mode 100644 srcpkgs/bazel-bootstrap/patches/gettid.patch
 create mode 100644 srcpkgs/bazel-bootstrap/patches/java.patch
 create mode 100644 srcpkgs/bazel-bootstrap/patches/python-3.12.patch
 create mode 100644 srcpkgs/bazel-bootstrap/template

diff --git a/srcpkgs/bazel-bootstrap/patches/gettid.patch b/srcpkgs/bazel-bootstrap/patches/gettid.patch
new file mode 100644
index 00000000000000..a680d831a54b3a
--- /dev/null
+++ b/srcpkgs/bazel-bootstrap/patches/gettid.patch
@@ -0,0 +1,29 @@
+--- a/src/main/java/net/starlark/java/eval/cpu_profiler_posix.cc
++++ b/src/main/java/net/starlark/java/eval/cpu_profiler_posix.cc
+@@ -41,7 +41,7 @@ Java_net_starlark_java_eval_CpuProfiler_
+ 
+ static int fd;  // the write end of the profile event pipe
+ 
+-pid_t gettid(void) {
++pid_t sys_gettid(void) {
+ #ifdef __linux__
+   return (pid_t)syscall(SYS_gettid);
+ #else  // darwin
+@@ -63,7 +63,7 @@ void onsigprof(int sig) {
+   }
+ 
+   // Send an event containing the int32be-encoded OS thread ID.
+-  pid_t tid = gettid();
++  pid_t tid = sys_gettid();
+   uint32_t tid_be = htonl(tid);
+   int r = write(fd, (void *)&tid_be, sizeof tid_be);
+   if (r < 0) {
+@@ -100,7 +100,7 @@ void onsigprof(int sig) {
+ // static native jint gettid();
+ extern "C" JNIEXPORT jint JNICALL
+ Java_net_starlark_java_eval_CpuProfiler_gettid(JNIEnv *env, jclass clazz) {
+-  return gettid();
++  return sys_gettid();
+ }
+ 
+ // makeFD: return new FileDescriptor(fd)
diff --git a/srcpkgs/bazel-bootstrap/patches/java.patch b/srcpkgs/bazel-bootstrap/patches/java.patch
new file mode 100644
index 00000000000000..a1ce8033f68f09
--- /dev/null
+++ b/srcpkgs/bazel-bootstrap/patches/java.patch
@@ -0,0 +1,12 @@
+--- a/scripts/packages/bazel.sh
++++ b/scripts/packages/bazel.sh
+@@ -104,7 +104,8 @@ function get_workspace_root() {
+ 
+ get_workspace_root
+ 
+-readonly wrapper_dir="$(dirname "$(get_realpath "${BASH_SOURCE[0]}")")"
++export JAVA_HOME=/usr/lib/jvm/openjdk11
++readonly wrapper_dir="/usr/libexec/bazel"
+ readonly os_arch_suffix="$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)"
+ 
+ function get_bazel_version() {
diff --git a/srcpkgs/bazel-bootstrap/patches/python-3.12.patch b/srcpkgs/bazel-bootstrap/patches/python-3.12.patch
new file mode 100644
index 00000000000000..a195555040d7b9
--- /dev/null
+++ b/srcpkgs/bazel-bootstrap/patches/python-3.12.patch
@@ -0,0 +1,22 @@
+--- a/tools/build_defs/pkg/path_test.py
++++ b/tools/build_defs/pkg/path_test.py
+@@ -14,9 +14,18 @@
+ """Testing for helper functions."""
+ 
+ import imp
++import importlib.util
++import importlib.machinery
+ import unittest
+ 
+-pkg_bzl = imp.load_source(
++def load_source(modname, filename):
++    loader = importlib.machinery.SourceFileLoader(modname, filename)
++    spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
++    module = importlib.util.module_from_spec(spec)
++    loader.exec_module(module)
++    return module
++
++pkg_bzl = load_source(
+     'pkg_bzl',
+     'tools/build_defs/pkg/path.bzl')
+ 
diff --git a/srcpkgs/bazel-bootstrap/template b/srcpkgs/bazel-bootstrap/template
new file mode 100644
index 00000000000000..8643ce13c030cc
--- /dev/null
+++ b/srcpkgs/bazel-bootstrap/template
@@ -0,0 +1,65 @@
+# Template file for 'bazel-bootstrap'
+pkgname=bazel-bootstrap
+version=7.0.2
+revision=1
+hostmakedepends="protobuf python3 unzip openjdk11 which perl grpc zip tar"
+makedepends="protobuf-devel libprotoc-devel grpc-devel libarchive-devel
+ zlib-devel"
+depends="openjdk11"
+short_desc="Fast, scalable, multi-language and extensible build system"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="Apache-2.0"
+homepage="https://bazel.build/"
+distfiles="https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip"
+checksum=dea2b90575d43ef3e41c402f64c2481844ecbf0b40f8548b75a204a4d504e035
+nostrip=yes
+python_version=3
+
+nocross=yes
+
+case "$XBPS_TARGET_MACHINE" in
+	aarch64*) _cpu=aarch64 ;;
+	armv7*) _cpu=armv7 ;;
+	arm*) _cpu=arm ;;
+	x86_64*) _cpu=x86_64 ;;
+	i686*) _cpu=i386 ;;
+	ppc64le*) _cpu=ppc64le ;;
+	ppc64*) _cpu=ppc ;;
+	ppc*) _cpu=ppc32 ;;
+	riscv64*) _cpu=riscv64 ;;
+	*) broken="not supported" ;;
+esac
+
+do_build() {
+	local flag
+	local _bazel_opts="-s --verbose_failures"
+	for flag in $CFLAGS; do
+		_bazel_opts+=" --conlyopt=$flag"
+		# For -fstack-protector ...
+		_bazel_opts+=" --linkopt=$flag"
+	done
+	for flag in $CXXFLAGS; do
+		_bazel_opts+=" --cxxopt=$flag"
+		_bazel_opts+=" --linkopt=$flag"
+	done
+	for flag in $LDFLAGS; do
+		_bazel_opts+=" --linkopt=$flag"
+	done
+
+	_bazel_opts+=" --define=enable_distributions=debian"
+	_bazel_opts+=" --compilation_mode=opt"
+	_bazel_opts+=" --action_env=PATH"
+	_bazel_opts+=" --java_runtime_version=local_jdk"
+	_bazel_opts+=" --tool_java_runtime_version=local_jdk"
+
+	export JAVA_HOME="/usr/lib/jvm/openjdk11"
+
+	EMBED_LABEL=${version} \
+	EXTRA_BAZEL_ARGS="$_bazel_opts" \
+	./compile.sh
+	chmod -R u+rwX /tmp
+}
+
+do_install() {
+	vbin output/bazel
+}

From 9a0004a4668ac504da445246ff51c05e984612d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Sun, 10 Mar 2024 23:06:01 +0700
Subject: [PATCH 2/2] New package: bazel-7.0.2

---
 srcpkgs/bazel/patches/gettid.patch        | 29 +++++++++
 srcpkgs/bazel/patches/java.patch          | 12 ++++
 srcpkgs/bazel/patches/javac-version.patch | 13 ++++
 srcpkgs/bazel/patches/python-3.12.patch   | 22 +++++++
 srcpkgs/bazel/template                    | 77 +++++++++++++++++++++++
 5 files changed, 153 insertions(+)
 create mode 100644 srcpkgs/bazel/patches/gettid.patch
 create mode 100644 srcpkgs/bazel/patches/java.patch
 create mode 100644 srcpkgs/bazel/patches/javac-version.patch
 create mode 100644 srcpkgs/bazel/patches/python-3.12.patch
 create mode 100644 srcpkgs/bazel/template

diff --git a/srcpkgs/bazel/patches/gettid.patch b/srcpkgs/bazel/patches/gettid.patch
new file mode 100644
index 00000000000000..a680d831a54b3a
--- /dev/null
+++ b/srcpkgs/bazel/patches/gettid.patch
@@ -0,0 +1,29 @@
+--- a/src/main/java/net/starlark/java/eval/cpu_profiler_posix.cc
++++ b/src/main/java/net/starlark/java/eval/cpu_profiler_posix.cc
+@@ -41,7 +41,7 @@ Java_net_starlark_java_eval_CpuProfiler_
+ 
+ static int fd;  // the write end of the profile event pipe
+ 
+-pid_t gettid(void) {
++pid_t sys_gettid(void) {
+ #ifdef __linux__
+   return (pid_t)syscall(SYS_gettid);
+ #else  // darwin
+@@ -63,7 +63,7 @@ void onsigprof(int sig) {
+   }
+ 
+   // Send an event containing the int32be-encoded OS thread ID.
+-  pid_t tid = gettid();
++  pid_t tid = sys_gettid();
+   uint32_t tid_be = htonl(tid);
+   int r = write(fd, (void *)&tid_be, sizeof tid_be);
+   if (r < 0) {
+@@ -100,7 +100,7 @@ void onsigprof(int sig) {
+ // static native jint gettid();
+ extern "C" JNIEXPORT jint JNICALL
+ Java_net_starlark_java_eval_CpuProfiler_gettid(JNIEnv *env, jclass clazz) {
+-  return gettid();
++  return sys_gettid();
+ }
+ 
+ // makeFD: return new FileDescriptor(fd)
diff --git a/srcpkgs/bazel/patches/java.patch b/srcpkgs/bazel/patches/java.patch
new file mode 100644
index 00000000000000..a1ce8033f68f09
--- /dev/null
+++ b/srcpkgs/bazel/patches/java.patch
@@ -0,0 +1,12 @@
+--- a/scripts/packages/bazel.sh
++++ b/scripts/packages/bazel.sh
+@@ -104,7 +104,8 @@ function get_workspace_root() {
+ 
+ get_workspace_root
+ 
+-readonly wrapper_dir="$(dirname "$(get_realpath "${BASH_SOURCE[0]}")")"
++export JAVA_HOME=/usr/lib/jvm/openjdk11
++readonly wrapper_dir="/usr/libexec/bazel"
+ readonly os_arch_suffix="$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)"
+ 
+ function get_bazel_version() {
diff --git a/srcpkgs/bazel/patches/javac-version.patch b/srcpkgs/bazel/patches/javac-version.patch
new file mode 100644
index 00000000000000..8736b644e044b8
--- /dev/null
+++ b/srcpkgs/bazel/patches/javac-version.patch
@@ -0,0 +1,13 @@
+--- a/scripts/bootstrap/BUILD.bootstrap
++++ b/scripts/bootstrap/BUILD.bootstrap
+@@ -19,8 +19,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/srcpkgs/bazel/patches/python-3.12.patch b/srcpkgs/bazel/patches/python-3.12.patch
new file mode 100644
index 00000000000000..a195555040d7b9
--- /dev/null
+++ b/srcpkgs/bazel/patches/python-3.12.patch
@@ -0,0 +1,22 @@
+--- a/tools/build_defs/pkg/path_test.py
++++ b/tools/build_defs/pkg/path_test.py
+@@ -14,9 +14,18 @@
+ """Testing for helper functions."""
+ 
+ import imp
++import importlib.util
++import importlib.machinery
+ import unittest
+ 
+-pkg_bzl = imp.load_source(
++def load_source(modname, filename):
++    loader = importlib.machinery.SourceFileLoader(modname, filename)
++    spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
++    module = importlib.util.module_from_spec(spec)
++    loader.exec_module(module)
++    return module
++
++pkg_bzl = load_source(
+     'pkg_bzl',
+     'tools/build_defs/pkg/path.bzl')
+ 
diff --git a/srcpkgs/bazel/template b/srcpkgs/bazel/template
new file mode 100644
index 00000000000000..012007621071a2
--- /dev/null
+++ b/srcpkgs/bazel/template
@@ -0,0 +1,77 @@
+# Template file for 'bazel'
+pkgname=bazel
+version=7.0.2
+revision=1
+hostmakedepends="protobuf python3 unzip openjdk11 which perl grpc zip tar
+ bazel-bootstrap"
+makedepends="protobuf-devel libprotoc-devel grpc-devel libarchive-devel
+ zlib-devel"
+depends="openjdk11"
+short_desc="Fast, scalable, multi-language and extensible build system"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="Apache-2.0"
+homepage="https://bazel.build/"
+distfiles="https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip"
+checksum=477e54f6374001f439a9471ba1de9d7824daf129db95510849ecc5e19ce88170
+checksum=dea2b90575d43ef3e41c402f64c2481844ecbf0b40f8548b75a204a4d504e035
+nostrip=yes
+python_version=3
+
+nocross="not tried yet, unsure about ijar and protoc"
+
+do_configure() {
+	cp scripts/bootstrap/BUILD.bootstrap \
+		scripts/bootstrap/BUILD
+}
+
+do_build() {
+	local flag
+	local _bazel_opts="-s --verbose_failures"
+	for flag in $CFLAGS; do
+		_bazel_opts+=" --conlyopt=$flag"
+		# For -fstack-protector ...
+		_bazel_opts+=" --linkopt=$flag"
+	done
+	for flag in $CXXFLAGS; do
+		_bazel_opts+=" --cxxopt=$flag"
+		_bazel_opts+=" --linkopt=$flag"
+	done
+	for flag in $LDFLAGS; do
+		_bazel_opts+=" --linkopt=$flag"
+	done
+
+	_bazel_opts+=" --define=enable_distributions=debian"
+	_bazel_opts+=" --compilation_mode=opt"
+	_bazel_opts+=" --action_env=PATH"
+
+	export JAVA_HOME="/usr/lib/jvm/openjdk11"
+	bazel build $_bazel_opts \
+		--extra_toolchains=//scripts/bootstrap:all \
+		--javacopt="-g -source 11 -target 11" \
+		--java_runtime_version=local_jdk \
+		--tool_java_runtime_version=local_jdk \
+		--stamp --embed_label "$version" \
+		--strategy=Javac=worker --worker_quit_after_build \
+		--ignore_unsupported_sandboxing \
+		--nojava_header_compilation \
+		src:bazel_nojdk
+	# scripts:bazel-complete.bash and scripts:fish_completion
+	# seems to requires bazel_remotejdk which is problematic on musl
+	#
+	# ./output/bazel build //scripts:bazel-complete.bash
+	# ./output/bazel build //scripts:fish_completion
+	# ./output/bazel shutdown
+	chmod -R u+rwX /tmp
+}
+
+do_install() {
+	vbin scripts/packages/bazel.sh bazel
+	vinstall bazel-bin/src/bazel_nojdk 755 \
+		usr/libexec/bazel bazel-real
+	vcompletion scripts/zsh_completion/_bazel zsh
+	vmkdir usr/share/example/bazel
+	vcopy "examples/*" usr/share/example/bazel
+	vmkdir usr/share/bazel
+	vcopy third_party usr/share/bazel
+	vcopy tools usr/share/bazel
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: New package: bazel
  2024-03-10 16:07 [PR PATCH] New package: bazel sgn
  2024-05-08 16:19 ` [PR PATCH] [Closed]: " sgn
@ 2024-05-08 16:19 ` sgn
  1 sibling, 0 replies; 3+ messages in thread
From: sgn @ 2024-05-08 16:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 192 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/49221#issuecomment-2100942313

Comment:
https://github.com/void-linux/void-packages/pull/50246

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Closed]: New package: bazel
  2024-03-10 16:07 [PR PATCH] New package: bazel sgn
@ 2024-05-08 16:19 ` sgn
  2024-05-08 16:19 ` sgn
  1 sibling, 0 replies; 3+ messages in thread
From: sgn @ 2024-05-08 16:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]

There's a closed pull request on the void-packages repository

New package: bazel
https://github.com/void-linux/void-packages/pull/49221

Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->

Needs bazel for mozc.
Only tested by using bazel to build bazel.

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-08 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-10 16:07 [PR PATCH] New package: bazel sgn
2024-05-08 16:19 ` [PR PATCH] [Closed]: " sgn
2024-05-08 16:19 ` sgn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).