maintainer mode check in SConstruct externalised

This commit is contained in:
Radim Kolar 2009-07-24 21:21:31 +02:00
parent 27c86076da
commit 565258d9bb
2 changed files with 30 additions and 18 deletions

View File

@ -3,10 +3,13 @@
import os
# init Scons
EnsureSConsVersion(0,96)
EnsurePythonVersion(2,2)
# set defaults
PREFIX='/usr/local'
PACKAGE='fsp'
VERSION='2.8.1b25'
EFENCE=0
EFENCE=False
env = Environment(CPPPATH='#/include', LIBPATH=['/usr/lib','/usr/local/lib'])
# Turn CPPFLAGS to list
@ -55,21 +58,6 @@ void dummy(void) {}
conf.Result(rc)
return rc
# check for maintainer mode
def checkForMaintainerMode(conf):
global EFENCE
conf.Message("checking whether to enable maintainer mode... ")
if ARGUMENTS.get('maintainer-mode', 0) or \
ARGUMENTS.get('enable-maintainer-mode', 0):
conf.Result(1)
conf.env.Append(CCFLAGS = '-O0')
conf.env.Append(CPPFLAGS = '-DMAINTAINER_MODE')
EFENCE=1
else:
conf.Result(0)
conf.env.Append(CCFLAGS = '-O')
EFENCE=0
# check for user-supplied lock prefix
def checkForLockPrefix(conf):
conf.Message("checking for user supplied lockprefix... ")
@ -124,6 +112,9 @@ main ()
return rc
############ Start configuration ##############
from maintainer import checkForMaintainerMode
conf = Configure(env,{'checkForGCCOption':checkForGCCOption,
'MAINTAINER_MODE':checkForMaintainerMode,
'checkForLockPrefix':checkForLockPrefix,
@ -199,8 +190,8 @@ else:
conf.checkForLockPrefix()
conf.checkPrefix()
conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"')
conf.MAINTAINER_MODE()
if EFENCE == 1:
EFENCE = conf.MAINTAINER_MODE()
if EFENCE == True:
EFENCE=conf.CheckLib("efence","EF_Abort")
conf.Finish()

21
site_scons/maintainer.py Normal file
View File

@ -0,0 +1,21 @@
#
# SCons check for maintainer mode
#
# Version 1.1
# 24-Jul-2009
#
from SCons.Script import ARGUMENTS
def checkForMaintainerMode(conf):
"""Check if user wants to enable maintainer compilation mode."""
conf.Message("checking whether to enable maintainer mode... ")
if ARGUMENTS.get('maintainer-mode', 0) or \
ARGUMENTS.get('enable-maintainer-mode', 0):
conf.Result(1)
conf.env.Append(CCFLAGS = '-O0')
conf.env.Append(CPPFLAGS = '-DMAINTAINER_MODE')
return True
else:
conf.Result(0)
return False