radiant_env.Depends(radiant_prog, gtkutil_lib)
radiant_env.Install(INSTALL, radiant_prog)
-# setup -------------------------------------------------------------------------------------------
-
-class setup_builder:
-
- g_dryrun = 0
-
- def system(self, cmd):
- if (self.g_dryrun):
- print cmd
- else:
- sys.stdout.write(cmd)
- ret = commands.getstatusoutput(cmd)
- print ret[1]
- if (ret[0] != 0):
- raise 'command failed'
-
- def copy_core(self):
- # binaries and misc
- self.system('mkdir -p %s/modules' % self.SETUP_BIN_DIR)
- self.system('mkdir -p %s/plugins' % self.SETUP_BIN_DIR)
- self.system('cp install/%s %s' % (self.EDITOR_BIN, self.SETUP_BIN_DIR))
- self.system('cp install/modules/*.so %s/modules' % self.SETUP_BIN_DIR )
-# self.system('cp install/plugins/*.so %s/plugins' % self.SETUP_BIN_DIR )
- self.system('cp install/q3map2.%s %s' % ( g_cpu, self.SETUP_BIN_DIR ) )
- self.M4_STDC = ''
- if (not self.g_darwin):
- # fugly
- # copy libgcc_s and stdc++ over to distribute it and reduce potential ABI fuckups
- ret = commands.getstatusoutput('ldd -r install/' + self.EDITOR_BIN + ' 2>/dev/null | grep libgcc_s | sed -e \'s/.* => \\([^ ]*\\) .*/\\1/\'')
- if (ret[0] != 0):
- raise 'ldd command failed'
- self.system('cp ' + ret[1] + ' ' + self.SETUP_BIN_DIR)
- ret = commands.getstatusoutput('ldd -r install/' + self.EDITOR_BIN + ' 2>/dev/null | grep libstdc++ | sed -e \'s/.* => \\([^ ]*\\) .*/\\1/\'')
- if (ret[0] != 0):
- raise 'ldd command failed'
- lines = string.split(ret[1], '\n')
- self.M4_STDC = '"'
- for i in lines:
- self.system('cp ' + i + ' ' + self.SETUP_BIN_DIR)
- self.M4_STDC += os.path.basename(i) + ' \n'
- self.M4_STDC += '"'
- # hack for symlink
- # setup process generates the wrapper at install time
- # but we need a dummy executable for symlink in loki_setup
- self.system('echo -n "#!/bin/sh\necho If you read this then there was a bug during setup. Report the bug and try running %s directly from it\'s installation directory.\n" > %s/radiant' % (self.EDITOR_BIN, self.SETUP_BIN_DIR));
- self.system('echo -n "#!/bin/sh\necho If you read this then there was a bug during setup. Report the bug and try running %s directly from it\'s installation directory.\n" > %s/q3map2' % (self.EDITOR_BIN, self.SETUP_BIN_DIR));
- ## this goes to the core install directory
- DEST = self.SETUP_DIR + '/core'
- self.system('mkdir -p ' + DEST + '/modules/bitmaps')
- # general content stuff
- self.system('cp -R plugins/model/bitmaps/* ' + DEST + '/modules/bitmaps')
- self.system('cp setup/data/tools/credits.html ' + DEST)
- self.system('cp setup/data/tools/links.htm ' + DEST)
- self.system('cp setup/data/tools/q3data.qdt ' + DEST)
- self.system('cp setup/data/tools/global.xlink ' + DEST)
- self.system('cp -R radiant/bitmaps ' + DEST)
- self.system('cp setup/changelog.txt ' + DEST)
- self.system('cp setup/openurl.sh ' + DEST)
- self.system('cp tools/quake3/q3map2/changelog.q3map2.txt ' + DEST)
- # documentation
- self.system('cp -R docs/manual/Q3Rad_Manual ' + DEST)
- self.system('cp -R docs/manual/quake3/Compile_Manual ' + DEST)
- self.system('cp -R docs/manual/quake3/Model_Manual ' + DEST)
- self.system('cp -R docs/manual/quake3/Terrain_Manual ' + DEST)
- # copy plugins media
- #self.system('mkdir -p ' + DEST + '/plugins/bitmaps')
- #self.system('cp -R contrib/bobtoolz/bitmaps/* ' + DEST + '/plugins/bitmaps')
- #self.system('cp -R contrib/bobtoolz/bt ' + DEST + '/plugins')
- #self.system('cp -R contrib/camera/bitmaps/* ' + DEST + '/plugins/bitmaps' )
- #self.system('cp -R contrib/bkgrnd2d/bitmaps/* ' + DEST + '/plugins/bitmaps' )
- # games files
- self.system('mkdir -p ' + self.SETUP_DIR + '/games')
-
- def copy_q3(self):
- # binaries
- self.system('mkdir -p ' + self.SETUP_BIN_DIR + '/q3')
- if ( self.g_darwin == 0 ):
- self.system('cp setup/linux/bspc ' + self.SETUP_BIN_DIR + '/q3')
-
- # goes in core
- DEST = self.SETUP_DIR + '/core/q3.game'
- self.system('mkdir -p ' + DEST)
- self.system('cp -R games/Q3Pack/tools/q3.game/* ' + DEST)
- self.system('cp -R docs/manual/quake3/Team_Arena_Mapping_Help ' + DEST)
- self.system('cp -R docs/manual/quake3/New_Teams_For_Q3TA ' + DEST)
- self.system('cp -R docs/manual/quake3/Q3AShader_Manual ' + DEST)
-
- # goes in the game install path
- DEST = self.SETUP_DIR + '/q3'
- self.system('mkdir -p ' + DEST)
- self.system('cp -R games/Q3Pack/baseq3 ' + DEST)
- self.system('cp -R games/Q3Pack/missionpack ' + DEST)
-
- # game file
- self.system('cp -R games/Q3Pack/tools/games/q3.game ' + self.SETUP_DIR + '/games')
-
- def copy_wolf(self):
- # binaries
- self.system('mkdir -p ' + self.SETUP_BIN_DIR + '/wolf')
- if ( self.g_darwin == 0 ):
- self.system('cp games/WolfPack/bin/wolf.game/bspc ' + self.SETUP_BIN_DIR + '/wolf')
-
- # goes in core
- DEST = self.SETUP_DIR + '/core/wolf.game'
- self.system('mkdir -p ' + DEST)
- self.system('cp -R games/WolfPack/docs ' + DEST)
- self.system('cp -R games/WolfPack/bin/wolf.game/* ' + DEST)
-
- # goes in the game install path
- DEST = self.SETUP_DIR + '/wolf/main'
- self.system('mkdir -p ' + DEST)
- self.system('cp games/WolfPack/astro-skies.pk3 ' + DEST)
- self.system('cp games/WolfPack/common-astro-spog.pk3 ' + DEST)
- self.system('cp games/WolfPack/lights.pk3 ' + DEST)
- self.system('cp -R games/WolfPack/scripts ' + DEST)
- self.system('cp -R games/WolfPack/maps ' + DEST)
- self.system('cp -R games/WolfPack/models ' + DEST)
-
- # game file
- self.system('cp -R games/WolfPack/bin/games/wolf.game ' + self.SETUP_DIR + '/games')
-
- def copy_et(self):
- # goes in core
- DEST = self.SETUP_DIR + '/core/et.game'
- self.system('mkdir -p ' + DEST)
- self.system('cp -R games/ETPack/docs ' + DEST)
- self.system('cp -R games/ETPack/et.game/* ' + DEST)
-
- # goes in game install path
- DEST = self.SETUP_DIR + '/et/etmain'
- self.system('mkdir -p ' + DEST)
- self.system('cp games/ETPack/astro-skies.pk3 ' + DEST)
- self.system('cp games/ETPack/common.pk3 ' + DEST)
- self.system('cp games/ETPack/goldrush.pcx ' + DEST)
- self.system('cp games/ETPack/lights.pk3 ' + DEST)
- self.system('cp games/ETPack/mapmedia.pk3 ' + DEST)
- self.system('cp -R games/ETPack/scripts ' + DEST)
- self.system('cp -R games/ETPack/maps ' + DEST)
- self.system('cp -R games/ETPack/models ' + DEST)
-
- # game file
- self.system('cp -R games/ETPack/games/et.game ' + self.SETUP_DIR + '/games')
-
- def copy_doom3(self):
- # goes in core
- DEST = self.SETUP_DIR + '/core/doom3.game'
- self.system('mkdir -p ' + DEST)
- self.system('cp -R games/Doom3Pack/tools/doom3.game/* ' + DEST)
-
- # game file
- self.system('cp -R games/Doom3Pack/tools/games/doom3.game ' + self.SETUP_DIR + '/games')
-
- def copy_q2(self):
- # binaries
- self.system('cp -R install/q2 %s' % (self.SETUP_BIN_DIR))
-
- # goes in core
- DEST = self.SETUP_DIR + '/core/q2.game'
- self.system('mkdir -p ' + DEST + '/modules')
- self.system('cp -R games/Q2Pack/q2.game/* ' + DEST)
- self.system('cp install/q2/q2map install/q2/qdata3 ' + DEST)
-# self.system('cp -R install/q2/modules ' + DEST )
-
- # goes in game install path
- DEST = self.SETUP_DIR + '/q2'
- self.system('mkdir -p ' + DEST + '/baseq2')
- self.system('cp -R games/Q2Pack/baseq2/* ' + DEST + '/baseq2')
-
- # game file
- self.system('cp -R games/Q2Pack/games/q2.game ' + self.SETUP_DIR + '/games')
-
- def copy_her2(self):
- # binaries
- self.system('cp -R install/heretic2 %s' % (self.SETUP_BIN_DIR))
-
- # goes in core
- DEST = self.SETUP_DIR + '/core/heretic2.game'
- self.system('mkdir -p ' + DEST + '/modules')
- self.system('cp -R games/Her2Pack/heretic2.game/* ' + DEST)
- self.system('cp install/q2/q2map install/heretic2/qdata3 ' + DEST)
-# self.system('cp -R install/heretic2/modules ' + DEST )
-
- # goes in game install path
- DEST = self.SETUP_DIR + '/heretic2'
- self.system('mkdir -p ' + DEST + '/base')
- self.system('cp -R games/Her2Pack/base/* ' + DEST + '/base')
-
- # game file
- self.system('cp -R games/Her2Pack/games/heretic2.game ' + self.SETUP_DIR + '/games')
-
- def build_setup(self):
- self.system( 'cp -R ' + self.SETUP_IMAGE_OS + '/* ' + self.SETUP_DIR )
- self.system( 'cp -fR ' + self.SETUP_IMAGE + '/* ' + self.SETUP_DIR )
- self.system('cp setup/license.txt ' + self.SETUP_DIR)
- self.system('cp setup/linux/README ' + self.SETUP_DIR)
- OS_DEFS=''
- if (self.g_darwin):
- OS_DEFS='--define=M4_OSX'
- M4_LINE = OS_DEFS + ' --define=M4_VER_MAJOR=' + self.major + ' --define=M4_VER_MINOR=' + self.minor + ' --define=M4_VER=' + self.line
- M4_LINE += ' --define=M4_GAME_ET=%d' % self.DO_GAME_ET
- M4_LINE += ' --define=M4_GAME_DOOM3=%d' % self.DO_GAME_DOOM3
- M4_LINE += ' --define=M4_GAME_Q2=%d' % self.DO_GAME_Q2
- if ( self.M4_STDC != '' ):
- M4_LINE += ' --define=M4_STDC=' + self.M4_STDC
- # setup.xml
- self.system('m4 ' + M4_LINE + ' ' + self.SETUP_DIR + '/setup.data/setup.xml.in > ' + self.SETUP_DIR + '/setup.data/setup.xml')
- # postinstall.sh
- self.system('m4 ' + M4_LINE + ' ' + self.SETUP_DIR + '/setup.data/postinstall.sh.in > ' + self.SETUP_DIR + '/setup.data/postinstall.sh')
- # config.sh
- self.system('m4 ' + M4_LINE + ' ' + self.SETUP_DIR + '/setup.data/config.sh.in > ' + self.SETUP_DIR + '/setup.data/config.sh')
- # setup.sh
- self.system('m4 ' + M4_LINE + ' ' + self.SETUP_DIR + '/setup.sh.in > ' + self.SETUP_DIR + '/setup.sh')
- self.system('chmod +x ' +self.SETUP_DIR + '/setup.sh')
- self.system('find ' + self.SETUP_DIR + ' -name .svn | while read i ; do rm -r "$i" ; done')
- # pack it up
- self.system('setup/linux/makeself/makeself.sh ' + self.SETUP_DIR + ' ' + self.SETUP_TARGET + ' "GtkRadiant ' + self.line + ' setup" ./setup.sh')
- if (self.g_darwin):
- def build_fink_deb(self):
- print "Building installer .deb\n"
- self.F_REV = '1'
- self.FINKINFO_DIR = '/sw/fink/10.2/unstable/main/finkinfo/games'
- self.TARBALL_DIR='radiant-' + self.F_REV + '.' + self.major
- self.TARBALL_NAME='radiant-' + self.F_REV + '.' + self.major + '.tar.gz'
- self.TARBALL_DEST='/sw/src'
-
- # prepare package description
- self.system('mkdir -p ' + self.FINKINFO_DIR)
- self.system('m4 ' + M4_LINE + ' --define=M4_SETUP_TARGET=' + self.SETUP_TARGET + ' --define=M4_F_REV=' + self.F_REV + ' ' + 'setup/osx/radiant.info.m4 > ' + self.FINKINFO_DIR + '/radiant-' + self.TARBALL_DIR + '.info')
-
- # build the tarball
- self.system('if [ -r /tmp/' + self.TARBALL_DIR + ' ] ; then rm -r ' '/tmp/' + self.TARBALL_DIR + ' ; fi')
- self.system('mkdir -p ' '/tmp/' + self.TARBALL_DIR)
- self.system('cp ' + self.SETUP_TARGET + ' ' + '/tmp/' + self.TARBALL_DIR)
- self.system('cd /tmp ; tar -cvzf ' + self.TARBALL_NAME + ' ' + self.TARBALL_DIR + ' ; cp ' + self.TARBALL_NAME + ' ' + self.TARBALL_DEST + '/')
- self.system('/sw/bin/fink rebuild radiant')
-
- build_fink_deb(self)
-
- def spawn_setup(self, env, target, source):
- if ( OS == 'Darwin' ):
- self.g_darwin = 1
- else:
- self.g_darwin = 0
- (self.line, self.major, self.minor) = get_version()
- print 'Setup: GtkRadiant %s' % self.line
- if ( self.g_darwin ):
- self.SETUP_IMAGE_OS = '../loki_setup/image'
- else:
- self.SETUP_IMAGE_OS = 'setup/linux/setup_image.Linux'
- self.SETUP_IMAGE = 'setup/linux/setup_image'
- self.SETUP_DIR = '/tmp/radiant-setup.%d' % os.getpid()
- self.EDITOR_BIN='radiant.' + g_cpu
- if ( self.g_darwin ):
- self.SETUP_BIN_DIR = self.SETUP_DIR + '/bin/Darwin/ppc'
- self.SETUP_TARGET = 'osx-radiant-%s.run' % self.line
- else:
- self.SETUP_BIN_DIR = self.SETUP_DIR + '/bin/Linux/x86'
- self.SETUP_TARGET = 'linux-radiant-%s.run' % self.line
- # TODO: eval a conf file instead
- self.DO_CORE=1
- self.DO_GAME_Q3=1
- self.DO_GAME_WOLF=1
- self.DO_GAME_ET=1
- self.DO_GAME_DOOM3=1
- self.DO_GAME_Q2=1
- self.DO_GAME_HER2=1
- if ( self.g_darwin ):
- self.DO_GAME_Q2=0
- self.DO_GAME_ET=0
- self.DO_GAME_HER2=0
- # verbose a bit
- print 'version: %s major: %s minor: %s\neditor core: %d\nq3: %d\nwolf: %d\net: %d\ndoom3: %d\nq2: %d\nher2: %d' % (self.line, self.major, self.minor, self.DO_CORE, self.DO_GAME_Q3, self.DO_GAME_WOLF, self.DO_GAME_ET, self.DO_GAME_DOOM3, self.DO_GAME_Q2, self.DO_GAME_HER2)
- if (self.DO_CORE):
- self.copy_core()
- if (self.DO_GAME_Q3):
- self.copy_q3()
- if (self.DO_GAME_WOLF):
- self.copy_wolf()
- if (self.DO_GAME_ET):
- self.copy_et()
- if (self.DO_GAME_DOOM3):
- self.copy_doom3()
- if ( OS != 'Darwin' ):
- if (self.DO_GAME_Q2):
- self.copy_q2()
- if (self.DO_GAME_HER2):
- self.copy_her2()
- self.build_setup()
- return 0
-
-def spawn_setup(env, target, source):
- setup = setup_builder()
- setup.spawn_setup(env, target, source)
-
-# NOTE: could modify g_env to add the deps auto when calling SharedLibrarySafe ..
-if (SETUP == '1'):
- g_env.Command('foo', INSTALL + '/radiant.' + g_cpu, [ spawn_setup ] )
- depends_list = [
- INSTALL + '/modules/archivepak.so',
- INSTALL + '/modules/archivewad.so',
- INSTALL + '/modules/archivezip.so',
- INSTALL + '/modules/entity.so',
-# INSTALL + '/modules/fgd.so',
- INSTALL + '/modules/imagehl.so',
- INSTALL + '/modules/imageq2.so',
- INSTALL + '/modules/image.so',
- INSTALL + '/modules/imagepng.so',
- INSTALL + '/modules/mapq3.so',
- INSTALL + '/modules/mapxml.so',
- INSTALL + '/modules/model.so',
- INSTALL + '/modules/md3model.so',
- INSTALL + '/modules/shaders.so',
- INSTALL + '/modules/vfspk3.so',
-# INSTALL + '/modules/vfswad.so',
-# INSTALL + '/plugins/bobtoolz.so',
-# INSTALL + '/plugins/camera.so',
-# INSTALL + '/plugins/prtview.so',
-# INSTALL + '/plugins/gensurf.so',
-# INSTALL + '/plugins/bkgrnd2d.so',
- INSTALL + '/q3map2.' + g_cpu,
- INSTALL + '/radiant.' + g_cpu,
- INSTALL + '/q3data.' + g_cpu ]
- if ( OS != 'Darwin' ):
- depends_list += [
- INSTALL + '/q2/q2map',
- INSTALL + '/q2/qdata3',
- INSTALL + '/heretic2/qdata3',
- INSTALL + '/heretic2/q2map' ]
- g_env.Depends( 'foo', depends_list )
# end setup ---------------------------------------------------------------------------------------
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 -------------------------------------------
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)
if (BUILD == 'debug'):
CXXFLAGS += '-g -D_DEBUG '
CCFLAGS += '-g -D_DEBUG '
-elif (BUILD == 'release'):
+elif (BUILD == 'release' or BUILD == 'final'):
CXXFLAGS += '-O2 '
CCFLAGS += '-O2 '
else:
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 '
+ 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] ) )