Allow to build with stack protection support
This commit is contained in:
+14
-1
@@ -12,11 +12,12 @@ version_info = {
|
|||||||
|
|
||||||
AddOption('--build_type',
|
AddOption('--build_type',
|
||||||
dest = 'build_type',
|
dest = 'build_type',
|
||||||
type = 'string',
|
type = 'choice',
|
||||||
nargs = 1,
|
nargs = 1,
|
||||||
action='store',
|
action='store',
|
||||||
default='debug',
|
default='debug',
|
||||||
metavar='TYPE',
|
metavar='TYPE',
|
||||||
|
choices = ['debug', 'release'],
|
||||||
help = 'debug|release - Build a Debug (default) or Release variant'
|
help = 'debug|release - Build a Debug (default) or Release variant'
|
||||||
)
|
)
|
||||||
AddOption('--prefix',
|
AddOption('--prefix',
|
||||||
@@ -35,6 +36,13 @@ AddOption('--test_xml',
|
|||||||
help='Create a result.xml when running the testsuite'
|
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')
|
build_type = GetOption('build_type')
|
||||||
test_xml = GetOption('test_xml')
|
test_xml = GetOption('test_xml')
|
||||||
@@ -68,6 +76,11 @@ if build_type == 'release':
|
|||||||
elif build_type == 'debug':
|
elif build_type == 'debug':
|
||||||
env.Append(CPPDEFINES = ['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
|
#put all .sconsign files in one place
|
||||||
env.SConsignFile()
|
env.SConsignFile()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user