Skip to content

Commit

Permalink
Merge pull request #5938 from lsm5/rpm-gobuild-macro
Browse files Browse the repository at this point in the history
[skip-ci] RPM: use default gobuild macro on RHEL
  • Loading branch information
openshift-merge-bot[bot] authored Jan 24, 2025
2 parents a7fe479 + ca957c4 commit 865427c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions rpm/buildah.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@
%global debug_package %{nil}
%endif

# RHEL's default %%gobuild macro doesn't account for the BUILDTAGS variable, so we
# set it separately here and do not depend on RHEL's go-[s]rpm-macros package
# until that's fixed.
# c9s bz: https://bugzilla.redhat.com/show_bug.cgi?id=2227328
# c8s bz: https://bugzilla.redhat.com/show_bug.cgi?id=2227331
%if %{defined rhel}
%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};
%endif

%global gomodulesmode GO111MODULE=on

%if 0%{defined fedora}
%if %{defined fedora}
%define build_with_btrfs 1
%endif

%if %{defined rhel}
%define fips 1
%endif

%global git0 https://github.com/containers/%{name}

Name: buildah
Expand Down Expand Up @@ -129,6 +124,10 @@ export BUILDTAGS="seccomp $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)"
export BUILDTAGS+=" btrfs_noversion exclude_graphdriver_btrfs"
%endif

%if %{defined fips}
export BUILDTAGS+=" libtrust_openssl"
%endif

%gobuild -o bin/%{name} ./cmd/%{name}
%gobuild -o bin/imgtype ./tests/imgtype
%gobuild -o bin/copy ./tests/copy
Expand All @@ -151,6 +150,9 @@ rm %{buildroot}%{_datadir}/%{name}/test/system/tools/build/*
#define license tag if not already defined
%{!?_licensedir:%global license %doc}

# Include check to silence rpmlint.
%check

%files
%license LICENSE vendor/modules.txt
%doc README.md
Expand Down

0 comments on commit 865427c

Please sign in to comment.