%bcond_with check %define gobuild(o:) %{expand: %global _dwz_low_mem_die_limit 0 %ifnarch ppc64 go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now' -compressdwarf=false" -a -v -x %{?**}; %else go build -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now' -compressdwarf=false" -a -v -x %{?**}; %endif } # https://github.com/coreos/butane %global goipath github.com/coreos/butane %global gomodulesmode GO111MODULE=on %global common_description %{expand: Butane translates human-readable Butane Configs into machine-readable Ignition configs for provisioning operating systems that use Ignition.} %global golicenses LICENSE %global godocs docs README.md Name: butane Version: 0.17.0 Release: 1 Summary: Butane config transpiler # Upstream license specification: Apache-2.0 License: ASL 2.0 URL: https://github.com/coreos/butane Source0: butane-0.17.0.tar.gz BuildRequires: golang Provides: nestos-config-transpiler = %{version}-%{release} Obsoletes: nestos-config-transpiler < 0.10.0-2 Provides: fcct = %{version}-%{release} %description %{common_description} %package redistributable Summary: Statically built Butane for Linux, macOS and Windows License: ASL 2.0 BuildArch: noarch Obsoletes: butane-nonlinux < 0.13.1-3 %description redistributable %{common_description} This package contains statically linked Linux, macOS and Windows Butane binaries built through cross-compilation. %prep %autosetup -p1 -n %{name}-%{version} %build export LDFLAGS="-X github.com/coreos/butane/internal/version.Raw=%{version} " export GOFLAGS="-mod=vendor" echo "Building butane..." %gobuild -o ./butane internal/main.go %global gocrossbuild go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x echo "Building Linux Butane with static linking..." CGO_ENABLED=0 GOARCH=arm64 GOOS=linux %gocrossbuild -o butane-aarch64-unknown-linux-gnu-static internal/main.go CGO_ENABLED=0 GOARCH=amd64 GOOS=linux %gocrossbuild -o butane-x86_64-unknown-linux-gnu-static internal/main.go echo "Building macOS Butane..." GOARCH=amd64 GOOS=darwin %gocrossbuild -o butane-x86_64-apple-darwin internal/main.go echo "Building Windows Butane..." GOARCH=amd64 GOOS=windows %gocrossbuild -o butane-x86_64-pc-windows-gnu.exe internal/main.go %install install -d -p %{buildroot}%{_bindir} install -p -m 0755 ./butane %{buildroot}%{_bindir} ln -s butane %{buildroot}%{_bindir}/fcct install -d -p %{buildroot}%{_datadir}/butane install -p -m 0644 ./butane-aarch64-unknown-linux-gnu-static %{buildroot}%{_datadir}/butane install -p -m 0644 ./butane-x86_64-apple-darwin %{buildroot}%{_datadir}/butane install -p -m 0644 ./butane-x86_64-pc-windows-gnu.exe %{buildroot}%{_datadir}/butane install -p -m 0644 ./butane-x86_64-unknown-linux-gnu-static %{buildroot}%{_datadir}/butane %if %{with check} %check %gocheck %endif %files %license %{golicenses} %doc %{godocs} %{_bindir}/butane %{_bindir}/fcct %files redistributable %license %{golicenses} %dir %{_datadir}/butane %{_datadir}/butane/butane-aarch64-unknown-linux-gnu-static %{_datadir}/butane/butane-x86_64-apple-darwin %{_datadir}/butane/butane-x86_64-pc-windows-gnu.exe %{_datadir}/butane/butane-x86_64-unknown-linux-gnu-static %changelog * Thu Mar 28 2024 duyiwei - 0.17.0-1 - upgrade version to 0.17.0 * Fri Dec 01 2023 chendexi - 0.14.0-3 - Delete the compilation of ppc64 and s390 architecture * Wed Oct 26 2022 fushanqing - 0.14.0-2 - support nestos variant * Mon Jun 20 2022 fushanqing - 0.14.0-1 - Initial package