import commands, re, sys, os, pickle, string, popen2
from makeversion import radiant_makeversion, get_version
-from osx_setup import do_osx_setup
# to access some internal stuff
import SCons
conf_filename='site.conf'
# there is a default hardcoded value, you can override on command line, those are saved between runs
# we only handle strings
-serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'SETUP']
+serialized=['CC', 'CXX', 'JOBS', 'BUILD']
# help -------------------------------------------
BUILD
Use debug/release to select build settings
ex: BUILD="release" - default is debug
- OSX: use BUILD="info" to generate the set of release files
-
-SETUP
- Build a setup - default 0
"""
)
JOBS='1'
BUILD='debug'
INSTALL='#install'
-SETUP='0'
g_build_root = 'build'
# end default settings ---------------------------
# sanity check -----------------------------------
-if (SETUP == '1' and BUILD != 'release' and BUILD != 'info'):
- print 'Forcing release build for setup'
- BUILD = 'release'
def GetGCCVersion(name):
ret = commands.getstatusoutput('%s -dumpversion' % name)
# common flags
warningFlags = '-W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter '
warningFlagsCXX = '-Wno-non-virtual-dtor -Wreorder ' # -Wold-style-cast
-CCFLAGS = '' + warningFlags
-CXXFLAGS = '-pipe -DQ_NO_STLPORT ' + warningFlags + warningFlagsCXX
+# POSIX macro: platform supports posix IEEE Std 1003.1:2001
+# XWINDOWS macro: platform supports X-Windows API
+CCFLAGS = '-DPOSIX -DXWINDOWS ' + warningFlags
+CXXFLAGS = '-pipe -DPOSIX -DXWINDOWS ' + warningFlags + warningFlagsCXX
CPPPATH = []
if (BUILD == 'debug'):
- CXXFLAGS += '-g -D_DEBUG '
- CCFLAGS += '-g -D_DEBUG '
-elif (BUILD == 'release'):
+ CXXFLAGS += '-g3 -D_DEBUG '
+ CCFLAGS += '-g3 -D_DEBUG '
+elif (BUILD == 'release' or BUILD == 'final'):
CXXFLAGS += '-O2 '
CCFLAGS += '-O2 '
-elif ( BUILD == 'info' ):
- print 'Preparing OSX release'
- ( line, major, minor ) = get_version()
- do_osx_setup( major, minor, 'osx-radiant-%s.run' % line )
- sys.exit( 0 )
else:
print 'Unknown build configuration ' + BUILD
sys.exit( 0 )
LINKFLAGS = ''
if ( OS == 'Linux' ):
- # static
- # 2112833 /opt/gtkradiant/radiant.x86
- # 35282 /opt/gtkradiant/modules/archivezip.so
- # 600099 /opt/gtkradiant/modules/entity.so
+ if ( BUILD == 'final' ):
+ # static
+ # 2112833 /opt/gtkradiant/radiant.x86
+ # 35282 /opt/gtkradiant/modules/archivezip.so
+ # 600099 /opt/gtkradiant/modules/entity.so
- # dynamic
- # 2237060 /opt/gtkradiant/radiant.x86
- # 110605 /opt/gtkradiant/modules/archivezip.so
- # 730222 /opt/gtkradiant/modules/entity.so
+ # dynamic
+ # 2237060 /opt/gtkradiant/radiant.x86
+ # 110605 /opt/gtkradiant/modules/archivezip.so
+ # 730222 /opt/gtkradiant/modules/entity.so
- # EVIL HACK - force static-linking for libstdc++ - create a symbolic link to the static libstdc++ in the root
- os.system("ln -s `g++ -print-file-name=libstdc++.a`")
+ # EVIL HACK - force static-linking for libstdc++ - create a symbolic link to the static libstdc++ in the root
+ os.system("ln -s `g++ -print-file-name=libstdc++.a`")
- #if not os.path.exists("./install"):
- # os.mkdir("./install")
- #os.system("cp `g++ -print-file-name=libstdc++.so` ./install")
+ #if not os.path.exists("./install"):
+ # os.mkdir("./install")
+ #os.system("cp `g++ -print-file-name=libstdc++.so` ./install")
- CXXFLAGS += '-fno-exceptions -fno-rtti '
- LINKFLAGS += '-Wl,-fini,fini_stub -L. -static-libgcc '
+ # -fPIC might be worth removing when building for 32-bit x86
+ CCFLAGS += '-fPIC '
+ CXXFLAGS += '-fPIC -fno-exceptions -fno-rtti '
+ LINKFLAGS += '-fPIC -Wl,-fini,fini_stub -L. -static-libgcc '
+
if ( OS == 'Darwin' ):
CCFLAGS += '-force_cpusubtype_ALL -fPIC '
CXXFLAGS += '-force_cpusubtype_ALL -fPIC -fno-exceptions -fno-rtti '
def useGlib2(self):
self['CXXFLAGS'] += '`pkg-config glib-2.0 --cflags` '
self['CCFLAGS'] += '`pkg-config glib-2.0 --cflags` '
- self['LINKFLAGS'] += '-lglib-2.0 '
+ if BUILD == 'final':
+ self['LINKFLAGS'] += '-lglib-2.0 '
+ else:
+ self['LINKFLAGS'] += '`pkg-config glib-2.0 --libs` '
+
def useXML2(self):
self['CXXFLAGS'] += '`xml2-config --cflags` '
self['CCFLAGS'] += '`xml2-config --cflags` '
- self['LINKFLAGS'] += '-lxml2 '
+ if BUILD == 'final':
+ self['LINKFLAGS'] += '-lxml2 '
+ else:
+ self['LINKFLAGS'] += '`xml2-config --libs` '
def useGtk2(self):
self['CXXFLAGS'] += '`pkg-config gtk+-2.0 --cflags` '
self['CCFLAGS'] += '`pkg-config gtk+-2.0 --cflags` '
- self['LINKFLAGS'] += '-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpango-1.0 -lgdk_pixbuf-2.0 '
+ if BUILD == 'final':
+ self['LINKFLAGS'] += '-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpango-1.0 -lgdk_pixbuf-2.0 '
+ else:
+ self['LINKFLAGS'] += '`pkg-config gtk+-2.0 --libs-only-L` `pkg-config gtk+-2.0 --libs-only-l` '
def useGtkGLExt(self):
self['CXXFLAGS'] += '`pkg-config gtkglext-1.0 --cflags` '
self['CCFLAGS'] += '`pkg-config gtkglext-1.0 --cflags` '
- self['LINKFLAGS'] += '-lgtkglext-x11-1.0 -lgdkglext-x11-1.0 '
+ #if BUILD == 'final':
+ self['LINKFLAGS'] += '-lgtkglext-x11-1.0 -lgdkglext-x11-1.0 '
+ # apparently pkg-config for gtkglext includes --export-dynamic, which b0rks everything.
+ #else:
+ # self['LINKFLAGS'] += 'pkg-config gtkglext-1.0 --libs-only-L` `pkg-config gtkglext-1.0 --libs-only-l` '
def usePNG(self):
self['CXXFLAGS'] += '`libpng-config --cflags` '
g_env = idEnvironment()
# export the globals
-GLOBALS = 'g_env INSTALL SETUP g_cpu'
+GLOBALS = 'g_env INSTALL g_cpu'
radiant_makeversion('\\ngcc version: %s.%s.%s' % ( ver_cc[0], ver_cc[1], ver_cc[2] ) )