Name:           bazel 
Version:        8.1.1        
Release:        %autorelease
Summary:        Build and test software of any size, quickly and reliably. 
License:        Apache-2.0
URL:            https://github.com/bazelbuild/bazel 
Source:         https://github.com/bazelbuild/bazel/releases/download/%{version}/bazel-%{version}-dist.zip 
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  python
BuildRequires:  zip
BuildRequires:  unzip
BuildRequires:  java-21-openjdk-devel

# FIXME: should only disable stripping and keep everything else
%define __spec_install_post /bin/true

%description
Build and test software of any size, quickly and reliably.

%prep
unzip %{_sourcedir}/bazel-8.1.1-dist.zip

%build
env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh
./output/bazel build //src:bazel --compilation_mode=opt --stamp --embed_label=%{version}

%install
install -m 0755 -vd                      %{buildroot}%{_bindir}
install -m 0755 -v ./bazel-bin/src/bazel %{buildroot}%{_bindir}/bazel

%files
%{_bindir}/bazel
%doc 
%license LICENSE 

%changelog
%autochangelog