diff --git a/SOURCES/ldflags-env.patch b/SOURCES/ldflags-env.patch new file mode 100644 index 0000000..4f3d848 --- /dev/null +++ b/SOURCES/ldflags-env.patch @@ -0,0 +1,12 @@ +diff -urN rhc-0.2.0.orig/Makefile rhc-0.2.0/Makefile +--- rhc-0.2.0.orig/Makefile 2021-06-28 14:38:47.000000000 -0400 ++++ rhc-0.2.0/Makefile 2021-11-16 13:34:20.741700621 -0500 +@@ -42,7 +42,7 @@ + SYSTEMD_SYSTEM_UNIT_DIR := $(shell pkg-config --variable systemdsystemunitdir systemd) + + # Build flags +-LDFLAGS := ++LDFLAGS ?= + LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.Version=$(VERSION)' + LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.ShortName=$(SHORTNAME)' + LDFLAGS += -X 'github.com/redhatinsights/yggdrasil.LongName=$(LONGNAME)' diff --git a/SPECS/rhc.spec b/SPECS/rhc.spec index 086e921..41f7116 100644 --- a/SPECS/rhc.spec +++ b/SPECS/rhc.spec @@ -1,8 +1,11 @@ %define debug_package %{nil} +%global buildflags -buildmode pie -compiler gc -a -v -x +%global goldflags %{expand:-linkmode=external -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'} + Name: rhc Version: 0.2.0 -Release: 3%{?dist} +Release: 5%{?dist} Epoch: 1 Summary: Message dispatch agent for cloud-connected systems License: GPLv3 @@ -15,6 +18,7 @@ Source1: config.toml Patch0: 0001-fix-Improve-output-during-disconnect.patch Patch1: 0002-feat-Include-Description-in-help-output.patch Patch2: 0003-fix-report-active-dispatchers-when-connecting-to-bro.patch +Patch3: ldflags-env.patch ExclusiveArch: %{go_arches} @@ -33,6 +37,9 @@ a receiving queue for instructions to be sent to the system via a broker. %build +%set_build_flags +export BUILDFLAGS="%{buildflags}" +export LDFLAGS="%{goldflags}" make PREFIX=%{_prefix} \ SYSCONFDIR=%{_sysconfdir} \ LOCALSTATEDIR=%{_localstatedir} \ @@ -47,6 +54,9 @@ make PREFIX=%{_prefix} \ %install +%set_build_flags +export BUILDFLAGS="%{buildflags}" +export LDFLAGS="%{goldflags}" make PREFIX=%{_prefix} \ SYSCONFDIR=%{_sysconfdir} \ LOCALSTATEDIR=%{_localstatedir} \ @@ -76,8 +86,11 @@ make PREFIX=%{_prefix} \ %changelog -* Fri Sep 24 2021 Link Dupont - 0.2.0-3 -- Fix an issue reporting workers on reconnect (Resolves: RHBZ#2007667) +* Tue Nov 16 2021 Link Dupont - 0.2.0-5 +- Enable building with PIE and other build flags (Resolves: RHBZ#2023489) + +* Fri Sep 24 2021 Link Dupont - 0.2.0-4 +- Fix an issue reporting workers on reconnect (Resolves: RHBZ#2009641) * Thu Jul 1 2021 Link Dupont - 0.2.0-2 - Add two patches that fix some UX issues