From 4c21413df3b4d480d9dbc844c23b6c44fb7cf049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Olav=20Sel=C3=A5sdal?= Date: Thu, 17 Jan 2013 16:40:02 +0100 Subject: [PATCH] Allow to build with stack protection support --- SConstruct | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 3cf2fb6..695afbe 100644 --- a/SConstruct +++ b/SConstruct @@ -12,11 +12,12 @@ version_info = { AddOption('--build_type', dest = 'build_type', - type = 'string', + type = 'choice', nargs = 1, action='store', default='debug', metavar='TYPE', + choices = ['debug', 'release'], help = 'debug|release - Build a Debug (default) or Release variant' ) AddOption('--prefix', @@ -35,6 +36,13 @@ AddOption('--test_xml', help='Create a result.xml when running the testsuite' ) +AddOption('--stack-protection', + dest = 'stack_protection', + action='store_true', + default=False, + help = 'Build with stack protection support' +) + build_type = GetOption('build_type') test_xml = GetOption('test_xml') @@ -68,6 +76,11 @@ if build_type == 'release': elif build_type == 'debug': env.Append(CPPDEFINES = ['DEBUG']) +if GetOption('stack_protection'): + env.Append(CFLAGS = ['-fstack-protector', '--param=ssp-buffer-size=4']) + env.Append(CPPDEFINES = ['_FORTIFY_SOURCE=2']) + + #put all .sconsign files in one place env.SConsignFile()