enable hardened build (#1000643)

This commit is contained in:
Miroslav Lichvar 2013-11-22 17:18:27 +01:00
parent 1146328540
commit 9260ac1fc3
2 changed files with 37 additions and 0 deletions

30
gpsd-linkflags.patch Normal file
View File

@ -0,0 +1,30 @@
commit 0583730e98906f9c779f8705138adb2572d305c2
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Fri Nov 22 18:19:40 2013 +0100
Allow multiple options in LINKFLAGS.
Signed-off-by: Eric S. Raymond <esr@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)]})

View File

@ -1,3 +1,5 @@
%global _hardened_build 1
Name: gpsd Name: gpsd
Version: 3.10 Version: 3.10
Release: 2%{?dist} Release: 2%{?dist}
@ -11,6 +13,8 @@ Source10: gpsd.service
Source11: gpsd.sysconfig Source11: gpsd.sysconfig
# PPS seems to be working without cap_sys_time # PPS seems to be working without cap_sys_time
Patch1: gpsd-nolibcap.patch 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: dbus-devel dbus-glib-devel ncurses-devel xmlto python-devel
BuildRequires: scons desktop-file-utils bluez-libs-devel pps-tools-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 %prep
%setup -q %setup -q
%patch1 -p1 -b .nolibcap %patch1 -p1 -b .nolibcap
%patch2 -p1 -b .linkflags
%build %build
export CCFLAGS="%{optflags}" export CCFLAGS="%{optflags}"
export LINKFLAGS="%{__global_ldflags}"
# breaks with %{_smp_mflags} # breaks with %{_smp_mflags}
scons \ scons \
dbus=yes \ dbus=yes \
@ -99,6 +105,7 @@ scons \
%install %install
# avoid rebuilding # avoid rebuilding
export CCFLAGS="%{optflags}" export CCFLAGS="%{optflags}"
export LINKFLAGS="%{__global_ldflags}"
DESTDIR=%{buildroot} scons install DESTDIR=%{buildroot} scons install
# service files # service files