From 20428742adcee5706c14f2cbd77079d39f0912ce Mon Sep 17 00:00:00 2001 From: Wangjunqi123 Date: Fri, 3 Mar 2023 18:06:25 +0800 Subject: [PATCH] =?UTF-8?q?promu=E5=AD=98=E5=9C=A8=E4=B8=8D=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E7=9A=84=E7=BC=96=E8=AF=91=E9=80=89=E9=A1=B9PIE?= =?UTF-8?q?=E3=80=81STRIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit ab29e9dead5ff5595090bd90245c7ede849a104c) --- add-parameters-to-solve-the-strip.patch | 20 ++++++++++++++++++++ promu.spec | 12 ++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 add-parameters-to-solve-the-strip.patch diff --git a/add-parameters-to-solve-the-strip.patch b/add-parameters-to-solve-the-strip.patch new file mode 100644 index 0000000..6536a52 --- /dev/null +++ b/add-parameters-to-solve-the-strip.patch @@ -0,0 +1,20 @@ +--- c/.promu.yml 2023-03-07 11:30:19.037256381 +0800 ++++ a/.promu.yml 2023-03-07 11:32:48.661260604 +0800 +@@ -7,12 +7,11 @@ repository: + build: + flags: -mod=vendor -a -tags 'netgo static_build' + ldflags: | +- -s +- -X github.com/prometheus/common/version.Version={{.Version}} +- -X github.com/prometheus/common/version.Revision={{.Revision}} +- -X github.com/prometheus/common/version.Branch={{.Branch}} +- -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}} +- -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.Version={{.Version}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.Revision={{.Revision}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.Branch={{.Branch}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}} ++ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} + tarball: + files: + - LICENSE diff --git a/promu.spec b/promu.spec index d8e0ca3..4b07de2 100644 --- a/promu.spec +++ b/promu.spec @@ -2,14 +2,17 @@ Name: promu Version: 0.7.0 -Release: 1 +Release: 2 Summary: Prometheus Utility Tool License: ASL 2.0 URL: https://github.com/prometheus/promu Source0: https://github.com/prometheus/promu/archive/v%{version}.tar.gz +Patch0: add-parameters-to-solve-the-strip.patch + BuildRequires: golang >= 1.13 +BuildRequires: gcc Conflicts: promu Provides: %{name} = %{version} @@ -19,9 +22,11 @@ promu is the utility tool for building and releasing Prometheus projects %prep %setup -q -T -n %{name}-%{version} -b 0 +%patch0 -p1 %build -GOFLAGS=-mod=vendor make build +export GOFLAGS="-mod=vendor -buildmode=pie" +make build %install install -D -m 755 %{name}-%{version} %{buildroot}%{_bindir}/promu @@ -31,5 +36,8 @@ install -D -m 755 %{name}-%{version} %{buildroot}%{_bindir}/promu %{_bindir}/promu %changelog +* Fri Mar 03 2023 wangjunqi - 0.7.0-2 +- add strip and pie + * Wed Dec 16 2020 yangzhao - 0.7.0-1 - Init project promu -- Gitee