← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~linuxdcpp-team/linuxdcpp/trunk] Rev 393: Make CPPDEFINES more portable

 

------------------------------------------------------------
revno: 393
committer: Steven Sheehy <steven.sheehy@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-10-06 23:32:15 -0500
message:
  Make CPPDEFINES more portable
modified:
  SConstruct
  dcpp/SConscript
  linux/SConscript


--
lp:linuxdcpp
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk

Your team LinuxDC++ Team is subscribed to branch lp:linuxdcpp.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct	2010-04-18 04:11:04 +0000
+++ SConstruct	2010-10-07 04:32:15 +0000
@@ -136,7 +136,7 @@
 
 if not 'install' in COMMAND_LINE_TARGETS:
 
-	if not (conf.env.has_key('CXX') and conf.env['CXX']):
+	if not conf.env.get('CXX'):
 		print 'CXX env variable is not set, attempting to use g++'
 		conf.env['CXX'] = 'g++'
 
@@ -233,45 +233,48 @@
 	env['LDCPP_BZRREV'] = CheckBZRRevision()
 
 	# todo: remove -fpermissive and fix the errors
-	env.Append(CXXFLAGS = ['-I.', '-D_GNU_SOURCE', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_REENTRANT', '-fpermissive'])
+	env.Append(CXXFLAGS = ['-I.', '-fpermissive'])
+	env.Append(CPPDEFINES = ['_GNU_SOURCE', '_LARGEFILE_SOURCE', ('_FILE_OFFSET_BITS', '64'), '_REENTRANT'])
 
 	if os.sys.platform == 'linux2':
-		env.Append(LINKFLAGS = ['-Wl,--as-needed'])
+		env.Append(LINKFLAGS = '-Wl,--as-needed')
 
 	if os.name == 'mac' or os.sys.platform == 'darwin':
 		env['ICONV_CONST'] = ''
 
 	if os.sys.platform == 'sunos5':
 		env['ICONV_CONST'] = 'const'
-		env.Append(LINKFLAGS = ['-lsocket', '-lnsl'])
-
-	if env.has_key('ICONV_CONST') and env['ICONV_CONST']:
-		env.Append(CXXFLAGS = '-DICONV_CONST=' + env['ICONV_CONST'])
-
-	if env.has_key('HAVE_IFADDRS_H'):
-		env.Append(CXXFLAGS = '-DHAVE_IFADDRS_H')
+		env.Append(LIBS = ['socket', 'nsl'])
+
+	if env.get('ICONV_CONST'):
+		env.Append(CPPDEFINES = ('ICONV_CONST', env['ICONV_CONST']))
+
+	if env.get('HAVE_IFADDRS_H'):
+		env.Append(CPPDEFINES = 'HAVE_IFADDRS_H')
 
 	# TODO: Implement a plugin system so libnotify doesn't have compile-time dependencies
-	if env.has_key('HAVE_LIBNOTIFY') and env['HAVE_LIBNOTIFY']:
-		env.Append(CXXFLAGS = '-DHAVE_LIBNOTIFY')
+	if env.get('HAVE_LIBNOTIFY'):
+		env.Append(CPPDEFINES = 'HAVE_LIBNOTIFY')
 		env.ParseConfig('pkg-config --libs libnotify')
 
-	if env.has_key('debug') and env['debug']:
-		env.Append(CXXFLAGS = ['-g', '-ggdb', '-D_DEBUG', '-Wall'])
-		env.Append(LINKFLAGS = ['-g', '-ggdb' '-Wall'])
+	if env.get('debug'):
+		env.Append(CPPDEFINES = '_DEBUG')
+		env.Append(CXXFLAGS = ['-g', '-ggdb', '-Wall'])
+		env.Append(LINKFLAGS = ['-g', '-ggdb', '-Wall'])
 		BUILD_PATH = BUILD_PATH + 'debug/'
 
-	elif env.has_key('release') and env['release']:
-		env.Append(CXXFLAGS = ['-O3', '-fomit-frame-pointer', '-DNDEBUG'])
+	elif env.get('release'):
+		env.Append(CPPDEFINES = '_NDEBUG')
+		env.Append(CXXFLAGS = ['-O3', '-fomit-frame-pointer'])
 		BUILD_PATH = BUILD_PATH + 'release/'
 
-	if env.has_key('profile') and env['profile']:
+	if env.get('profile'):
 		env.Append(CXXFLAGS = '-pg')
 		env.Append(LINKFLAGS= '-pg')
 
-	if env.has_key('PREFIX') and env['PREFIX']:
-		data_dir = '-D_DATADIR=\'\"%s/share\"\'' % env['PREFIX']
-		env.Append(CXXFLAGS = [data_dir])
+	if env.get('PREFIX'):
+		data_dir = '\'\"%s/share\"\'' % env['PREFIX']
+		env.Append(CPPDEFINES = ('_DATADIR', data_dir))
 
 	env.ParseConfig('pkg-config --libs libglade-2.0')
 	env.ParseConfig('pkg-config --libs gthread-2.0')

=== modified file 'dcpp/SConscript'
--- dcpp/SConscript	2009-11-03 03:13:47 +0000
+++ dcpp/SConscript	2010-10-07 04:32:15 +0000
@@ -4,7 +4,7 @@
 
 # We don't want to add this CXXFLAG globally so we copy the env
 env = env.Clone()
-env.Append(CXXFLAGS = ['-DBUILDING_DCPP'])
+env.Append(CPPDEFINES = 'BUILDING_DCPP')
 
 dcpp_files = env.Glob('*.cpp')
 

=== modified file 'linux/SConscript'
--- linux/SConscript	2010-03-24 06:29:10 +0000
+++ linux/SConscript	2010-10-07 04:32:15 +0000
@@ -13,8 +13,8 @@
 for i, source in enumerate(gui_files):
 	#define LDCPP_BZRREV for linux/version.cc
 	if str(source).find("version.cc") != -1:
-		ldcpp_bzrrev = '-DLDCPP_BZRREV=\\"%s\\"' % env['LDCPP_BZRREV']
-		obj_files.append(env.Object(source, CPPDEFINES=ldcpp_bzrrev)) 
+		ldcpp_bzrrev = 'LDCPP_BZRREV=\\"%s\\"' % env['LDCPP_BZRREV']
+		obj_files.append(env.Object(source, CPPDEFINES = ldcpp_bzrrev)) 
 	else:
 		obj_files.append(env.Object(source))