Description: Fix upstream SConstruct to install correctly the files
             and add GCC hardening.
Author: Giovani Augusto Ferreira <giovani@riseup.net>
Last-Update: 2016-09-28
Index: reglookup-1.0.1+svn287/SConstruct
===================================================================
--- reglookup-1.0.1+svn287.orig/SConstruct
+++ reglookup-1.0.1+svn287/SConstruct
@@ -8,11 +8,13 @@ ABI_VERSION=REGFI_VERSION.rsplit('.',1)[
 
 # Package Maintainers: should any of these options in the first line be omitted during
 # package build, instead relying on CFLAGS/LDFLAGS to specify them when appropriate?
-cflags = '-std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -fvisibility=hidden'
+cflags = '-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -fvisibility=hidden'
 cflags += ' -DREGFI_VERSION=\'"%s"\' ' % REGFI_VERSION
-cflags += os.environ.get('CFLAGS','-fPIE -pie -fstack-protector -D_FORTIFY_SOURCE=2')
+cflags += ' -ggdb'
+cflags += ' -D_FORTIFY_SOURCE=2'
+cflags += ' -fPIE'
 
-linkflags = "-fPIC " + os.environ.get('LDFLAGS',"-Wl,-z,relro,-z,now")
+linkflags = "-fPIE -pie " + os.environ.get('LDFLAGS','-z relro -z now')
 
 lib_src = ['lib/regfi.c',
            'lib/winsec.c',
@@ -25,8 +27,8 @@ env = Environment(ENV=os.environ,
                   CC=cc,
                   CFLAGS=cflags,
                   LINKFLAGS=linkflags,
-                  CPPPATH=['include', '/usr/local/include'],
-                  LIBPATH=['lib', '/usr/local/lib'],
+                  CPPPATH=['include', '/usr/include'],
+                  LIBPATH=['lib', '/usr/lib'],
                   LIBS=['m', 'pthread', 'regfi', 'talloc'])
 
 
@@ -63,7 +65,6 @@ includedir = os.environ.get('INCLUDEDIR'
 mandir     = os.environ.get('MANDIR', prefix + 'man')
 
 install_bin = [destdir + bindir, destdir + mandir]
-install_lib = [destdir + libdir, destdir + includedir + '/regfi']
 
 env.Install(destdir+bindir, [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
 libinstall = env.InstallVersionedLib(destdir+libdir, [libregfi, libregfi_static], SHLIBVERSION=ABI_VERSION)
@@ -99,7 +100,7 @@ pyregfi_doc = env.Command('doc/devel/pyr
                           Glob('python/pyregfi/*.py')+['doc/devel/Doxyfile.pyregfi', regfi_doc],
                           'doxygen doc/devel/Doxyfile.pyregfi')
 
-install_items = install_bin + install_lib + install_pyregfi
+install_items = install_bin + install_pyregfi
 
 # User Friendly Targets
 env.Alias('libregfi', libregfi)
@@ -109,7 +110,6 @@ env.Alias('bin', [reglookup_recover, reg
 env.Alias('doc', [man_reglookup,man_reglookup_recover,man_reglookup_timeline])
 env.Alias('doc-devel', [regfi_doc, pyregfi_doc])
 env.Alias('install_bin', install_bin)
-env.Alias('install_lib', install_lib)
 env.Alias('install_pyregfi', install_pyregfi)
 env.Alias('install', install_items)
 
