[gpsd/f20] enable hardened build (#1000643)

Miroslav Lichvar mlichvar at fedoraproject.org
Fri Feb 14 13:16:44 UTC 2014


commit 4d089ebf9934378826041388cb10aca34c05ea83
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Fri Nov 22 17:18:27 2013 +0100

    enable hardened build (#1000643)

 gpsd-linkflags.patch |   30 ++++++++++++++++++++++++++++++
 gpsd.spec            |    7 +++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/gpsd-linkflags.patch b/gpsd-linkflags.patch
new file mode 100644
index 0000000..7bef9a1
--- /dev/null
+++ b/gpsd-linkflags.patch
@@ -0,0 +1,30 @@
+commit 0583730e98906f9c779f8705138adb2572d305c2
+Author: Miroslav Lichvar <mlichvar at redhat.com>
+Date:   Fri Nov 22 18:19:40 2013 +0100
+
+    Allow multiple options in LINKFLAGS.
+    
+    Signed-off-by: Eric S. Raymond <esr at thyrsus.com>
+
+diff --git a/SConstruct b/SConstruct
+index b7627e7..4332fe4 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -239,7 +239,7 @@ env['PYTHON'] = sys.executable
+ env['STRIP'] = "strip"
+ env['PKG_CONFIG'] = "pkg-config"
+ env['CHRPATH'] = 'chrpath'
+-for i in ["AR", "ARFLAGS", "CCFLAGS", "CFLAGS", "CC", "CXX", "CXXFLAGS", "STRIP", "PKG_CONFIG", "CHRPATH", "LD", "TAR"]:
++for i in ["AR", "ARFLAGS", "CCFLAGS", "CFLAGS", "CC", "CXX", "CXXFLAGS", "LINKFLAGS", "STRIP", "PKG_CONFIG", "CHRPATH", "LD", "TAR"]:
+     if os.environ.has_key(i):
+         j = i
+         if i == "LD":
+@@ -248,7 +248,7 @@ for i in ["AR", "ARFLAGS", "CCFLAGS", "CFLAGS", "CC", "CXX", "CXXFLAGS", "STRIP"
+             env.Replace(**{j: Split(os.getenv(i))})
+         else:
+             env.Replace(**{j: os.getenv(i)})
+-for flag in ["LDFLAGS", "LINKFLAGS", "SHLINKFLAGS", "CPPFLAGS"]:
++for flag in ["LDFLAGS", "SHLINKFLAGS", "CPPFLAGS"]:
+     if os.environ.has_key(flag):
+         env.MergeFlags({flag : [os.getenv(flag)]})
+ 
diff --git a/gpsd.spec b/gpsd.spec
index 710a785..3bd6771 100644
--- a/gpsd.spec
+++ b/gpsd.spec
@@ -1,3 +1,5 @@
+%global _hardened_build 1
+
 Name: gpsd
 Version: 3.9
 Release: 2%{?dist}
@@ -10,6 +12,8 @@ Source0: http://download.savannah.gnu.org/releases/gpsd/%{name}-%{version}.tar.g
 Source10: gpsd.service
 Source11: gpsd.sysconfig
 Patch1: gpsd-nolibcap.patch
+# allow multiple options in LINKFLAGS
+Patch2: gpsd-linkflags.patch
 
 BuildRequires: dbus-devel dbus-glib-devel ncurses-devel xmlto python-devel
 BuildRequires: scons desktop-file-utils bluez-libs-devel pps-tools-devel
@@ -73,9 +77,11 @@ can run on a serial terminal or terminal emulator.
 %prep
 %setup -q
 %patch1 -p1 -b .nolibcap
+%patch2 -p1 -b .linkflags
 
 %build
 export CCFLAGS="%{optflags}"
+export LINKFLAGS="%{__global_ldflags}"
 # breaks with %{_smp_mflags}
 scons \
 	dbus=yes \
@@ -97,6 +103,7 @@ scons \
 %install
 # avoid rebuilding
 export CCFLAGS="%{optflags}"
+export LINKFLAGS="%{__global_ldflags}"
 DESTDIR=%{buildroot} scons install
 
 # service files


More information about the scm-commits mailing list