[gpsd] enable hardened build (#1000643)

Miroslav Lichvar mlichvar at fedoraproject.org
Mon Nov 25 13:40:58 UTC 2013


commit 9260ac1fc3bffb5b6d42c079b53d022795870618
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 9b36937..8e411aa 100644
--- a/gpsd.spec
+++ b/gpsd.spec
@@ -1,3 +1,5 @@
+%global _hardened_build 1
+
 Name: gpsd
 Version: 3.10
 Release: 2%{?dist}
@@ -11,6 +13,8 @@ Source10: gpsd.service
 Source11: gpsd.sysconfig
 # PPS seems to be working without cap_sys_time
 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
@@ -74,9 +78,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 \
@@ -99,6 +105,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