Merge branch 'yaspoon-master'

This commit is contained in:
Timothee 'TTimo' Besset 2020-07-04 16:09:03 -05:00
commit 45e99c1241
11 changed files with 143 additions and 133 deletions

View file

@ -26,6 +26,18 @@ How to build
You can find more complete instructions to build on Windows [there](https://icculus.org/gtkradiant/documentation/windows_compile_guide/) and to build on Mac OS [there](apple/README.md).
```sh
# install build dependancies
# Ubuntu 18.04
apt install git scons python-urllib3 libxml2 libxml2-dev libgtk2.0 libgtk2.0-dev libgtkgl2.0-1 libgtkgl2.0-dev libglu1-mesa libglu1-mesa-dev libgtkglext1 libgtkglext1-dev subversion libjpeg8 libjpeg8-dev
# Ubuntu 20.04
apt install git scons libxml2 libxml2-dev libgtkgl2.0-1 libgtkgl2.0-dev libglu1-mesa libglu1-mesa-dev libgtkglext1 libgtkglext1-dev subversion libjpeg8 libjpeg8-dev
# ArchLinux
pacman -S git scons python-urllib3 libxml2 gtk2 freeglut gtkglext subversion libjpeg-turbo
```
```sh
# get the source
git clone "https://github.com/TTimo/GtkRadiant.git"

View file

@ -9,7 +9,6 @@ Import( [ 'utils', 'config', 'settings', 'project' ] )
( libpath, libname ) = os.path.split( project )
libname = os.path.splitext( libname )[0]
env = Environment( ENV = os.environ )
settings.SetupEnvironment( env, config['name'] )
proj = utils.vcxproj( os.path.join( GetLaunchDir(), project ) )
@ -29,6 +28,5 @@ except:
objects = []
for i in files + add_sources:
objects.append( emit_func( os.path.join( libpath, i ) ) )
objects.append( emit_func( source=os.path.join( libpath, i ) ) )
Return( 'objects' )

View file

@ -1,68 +1,68 @@
# -*- mode: python -*-
# GtkRadiant build scripts
# TTimo <ttimo@ttimo.net>
# http://scons.org/
import sys, os, platform, cPickle
import utils, config
conf_filename = 'site.sconf'
try:
sys.argv.index( '-h' )
except:
pass
else:
Help(
"""
======================================================================
GtkRadiant build system quick help
You need scons v0.97.0d20070918.r2446 or newer
Default build (release), just run scons at the toplevel
debug build:
$ scons config=debug
build using 8 parallel build jobs
but do not download any game packs
$ scons -j8 --no-packs
======================================================================
""" )
Return()
AddOption('--no-packs',
dest='no_packs',
action='store_true',
help="don't fetch game packs")
active_configs = []
# load up configurations from the save file
if ( os.path.exists( conf_filename ) ):
f = open( conf_filename )
print 'reading saved configuration from site.conf'
try:
while ( True ):
c = cPickle.load( f )
active_configs.append( c )
except:
pass
# read the command line and build configs
config_statements = sys.argv[1:]
active_configs = config.ConfigParser().parseStatements( active_configs, config_statements )
assert( len( active_configs ) >= 1 )
# save the config
print 'saving updated configuration'
f = open( conf_filename, 'wb' )
for c in active_configs:
cPickle.dump( c, f, -1 )
print 'emit build rules'
for c in active_configs:
print 'emit configuration: %s' % repr( c )
c.emit()
# -*- mode: python -*-
# GtkRadiant build scripts
# TTimo <ttimo@ttimo.net>
# http://scons.org/
import sys, os, platform, pickle
import utils, config
conf_filename = 'site.sconf'
try:
sys.argv.index( '-h' )
except:
pass
else:
Help(
"""
======================================================================
GtkRadiant build system quick help
You need scons v0.97.0d20070918.r2446 or newer
Default build (release), just run scons at the toplevel
debug build:
$ scons config=debug
build using 8 parallel build jobs
but do not download any game packs
$ scons -j8 --no-packs
======================================================================
""" )
Return()
AddOption('--no-packs',
dest='no_packs',
action='store_true',
help="don't fetch game packs")
active_configs = []
# load up configurations from the save file
if ( os.path.exists( conf_filename ) ):
f = open( conf_filename )
print( 'reading saved configuration from site.conf' )
try:
while ( True ):
c = pickle.load( f )
active_configs.append( c )
except:
pass
# read the command line and build configs
config_statements = sys.argv[1:]
active_configs = config.ConfigParser().parseStatements( active_configs, config_statements )
assert( len( active_configs ) >= 1 )
# save the config
print( 'saving updated configuration' )
f = open( conf_filename, 'wb' )
for c in active_configs:
pickle.dump( c, f, -1 )
print( 'emit build rules' )
for c in active_configs:
print( 'emit configuration: %s' % repr( c ) )
c.emit()

View file

@ -1,5 +1,5 @@
import sys, os, traceback, platform, re, commands, platform, subprocess
import urllib2, zipfile, shutil, pprint
import sys, os, traceback, platform, re, subprocess, platform
import urllib3, zipfile, shutil, pprint
if __name__ != '__main__':
from SCons.Script import *
@ -218,13 +218,14 @@ class Config:
def SetupEnvironment( self, env, config, useGtk = False, useGtkGL = False, useJPEG = False, useZ = False, usePNG = False ):
env['CC'] = self.cc
env['CXX'] = self.cxx
( ret, xml2 ) = commands.getstatusoutput( 'xml2-config --cflags' )
if ( ret != 0 ):
print 'xml2-config failed'
try:
xml2 = subprocess.check_output( ['xml2-config', '--cflags'] ).decode( 'utf-8' )
except subprocess.CalledProcessError as cpe:
print( 'xml2-config failed with error code {} and output:{}'.format( cpe.returncode, cpe.output ) )
assert( False )
xml2libs = commands.getoutput( 'xml2-config --libs' )
env.ParseConfig( 'xml2-config --libs' )
baseflags = [ '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.split( ' ' ) ]
#Need to strip on xml2-config output. It has a stray \n and that completely screws up scons calling g++
baseflags = [ '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.strip().split( ' ' ) ]
if ( useGtk ):
env.ParseConfig( 'pkg-config gtk+-2.0 --cflags --libs' )
@ -409,24 +410,28 @@ class Config:
print( 'Lookup and bundle the PNG and JPEG libraries' )
# radiant.bin doesn't link to jpeg lib directly, grab that from a module
# Python 2.7 only!
#module_ldd = subprocess.check_output( 'ldd -r install/modules/image.so', shell = True )
p = subprocess.Popen( 'ldd -r install/modules/image.so', shell = True, stdout = subprocess.PIPE )
module_ldd = p.communicate()[0]
# print( module_ldd )
try:
module_ldd = subprocess.check_output( ['ldd', '-r', 'install/modules/image.so'] ).decode( 'utf-8' )
except subprocess.CalledProcessError as cpe:
print( 'ldd failed with error code {} and output:{}'.format(cpe.returncode, cpe.output ))
assert( False )
def find_library( output, libname ):
print output
print libname
match = filter( lambda l : l.find( libname ) != -1, output.split( '\n' ) )[0]
return re.split( '.*=> (.*) .*', match )[1]
for line in output.split( '\n' ):
if libname in line:
return re.split( '.*=> (.*) .*', line)[1]
return ""
jpeg_path = find_library( module_ldd, 'libjpeg' )
print( 'JPEG library: %s' % repr( jpeg_path ) )
p = subprocess.Popen( 'ldd -r install/modules/imagepng.so', shell = True, stdout = subprocess.PIPE )
module_ldd = p.communicate()[0]
try:
module_ldd = subprocess.check_output( ['ldd', '-r', 'install/modules/imagepng.so'] ).decode( 'utf-8' )
except subprocess.CalledProcessError as cpe:
print( 'ldd failed with error code {} and output:{}'.format(cpe.returncode, cpe.output ))
assert( False )
png_path = find_library( module_ldd, 'libpng' )
print( 'PNG library: %s' % repr( png_path ) )
shutil.copy( jpeg_path, 'install' )
@ -460,16 +465,16 @@ class ConfigParser:
statement_re = re.compile( '(.*)=(.*)' )
value_list_re = re.compile( '([^,]*),?' )
if ( not statement_re.match( s ) ):
print 'syntax error (statement match): %s' % repr( s )
print( 'syntax error (statement match): %s' % repr( s ) )
return
statement_split = statement_re.split( s )
if ( len( statement_split ) != 4 ):
print 'syntax error (statement split): %s' % repr( s )
print( 'syntax error (statement split): %s' % repr( s ) )
return
( foo, name, value, bar ) = statement_split
value_split = value_list_re.split( value )
if ( len( value_split ) < 2 or len( value_split ) % 2 != 1 ):
print 'syntax error (value split): %s' % ( repr( value_split ) )
print( 'syntax error (value split): %s' % ( repr( value_split ) ) )
return
try:
value_array = []
@ -479,8 +484,8 @@ class ConfigParser:
value_array.append( value_split.pop() )
value_split.pop()
except:
print traceback.print_exception( sys.exc_type, sys.exc_value, sys.exc_traceback )
print 'syntax error (value to array): %s' % ( repr( value_split ) )
print( traceback.print_exception( sys.exc_type, sys.exc_value, sys.exc_traceback ) )
print( 'syntax error (value to array): %s' % ( repr( value_split ) ) )
return
return ( name, value_array )
@ -504,13 +509,13 @@ class ConfigParser:
ret = self._parseStatement( s )
if ( ret is None ):
print 'stop statement parse at %s' % repr( s )
print( 'stop statement parse at %s' % repr( s ) )
break
( name, value_array ) = ret
try:
processor = self.operators[name]
except:
print 'unknown operator %s - stop statement parse at %s' % ( repr( name ), repr( s ) )
print( 'unknown operator %s - stop statement parse at %s' % ( repr( name ), repr( s ) ) )
break
processor( value_array )
@ -518,7 +523,7 @@ class ConfigParser:
self.configs.append( self.current_config )
# make sure there is at least one config
if ( len( self.configs ) == 0 ):
print 'pushing a default config'
print( 'pushing a default config' )
self.configs.append( Config() )
return self.configs
@ -533,17 +538,17 @@ class TestConfigParse( unittest.TestCase ):
# test basic config parsing
# needs to cleanly stop at the first config statement that is not recognized
configs = self.parser.parseStatements( None, [ 'game=missionpack', 'config=qvm', 'foobar' ] )
print repr( configs )
print( repr( configs ) )
def testMultiParse( self ):
# multiple configs seperated by commas
configs = self.parser.parseStatements( None, [ 'target=server,game,cgame' ] )
print repr( configs )
print( repr( configs ) )
def testOp( self ):
# test the operator for multiple configs
configs = self.parser.parseStatements( None, [ 'target=core', 'config=release', 'op=push', 'target=game,cgame,ui', 'config=debug' ] )
print repr( configs )
print( repr( configs ) )
if __name__ == '__main__':
unittest.main()

View file

@ -58,8 +58,6 @@ UINT wm_BroadcastCommand = -1;
socket_t *brdcst_socket;
netmessage_t msg;
qboolean verbose = qfalse;
// our main document
// is streamed through the network to Radiant
// possibly written to disk at the end of the run

View file

@ -22,11 +22,13 @@
#ifdef WIN32
#include <io.h>
#endif
#include "q3data.h"
#include "md3lib.h"
#include "vfs.h"
qboolean verbose;
qboolean g_verbose;
qboolean g_stripify = qtrue;
qboolean g_release; // don't grab, copy output data to new tree
@ -37,8 +39,6 @@ qboolean g_skipmodel; // set true when a cd is not g_only
// bogus externs for some TA hacks (common/ using them against q3map)
char *moddir = NULL;
// some old defined that was in cmdlib lost during merge
char writedir[1024];
#if defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __APPLE__ )
#define strlwr strlower

View file

@ -978,10 +978,8 @@ typedef enum
}
surfaceType_t;
#ifdef MAIN_C
char *surfaceTypes[ NUM_SURFACE_TYPES ]
#ifndef MAIN_C
;
#else
=
{
"SURFACE_BAD",
@ -996,6 +994,8 @@ char *surfaceTypes[ NUM_SURFACE_TYPES ]
"SURFACE_DECAL",
"SURFACE_SHADER"
};
#else
extern char *surfaceTypes[ NUM_SURFACE_TYPES ];
#endif

View file

@ -72,8 +72,6 @@ int CountBits( byte *bits, int numbits ){
}
int c_fullskip;
int c_portalskip, c_leafskip;
int c_vistest, c_mighttest;
int c_chop, c_nochop;

View file

@ -945,10 +945,8 @@ typedef enum
}
surfaceType_t;
#ifdef MAIN_C
char *surfaceTypes[ NUM_SURFACE_TYPES ]
#ifndef MAIN_C
;
#else
=
{
"SURFACE_BAD",
@ -963,6 +961,8 @@ char *surfaceTypes[ NUM_SURFACE_TYPES ]
"SURFACE_DECAL",
"SURFACE_SHADER"
};
#else
extern char *surfaceTypes[ NUM_SURFACE_TYPES ];
#endif

View file

@ -72,8 +72,6 @@ int CountBits( byte *bits, int numbits ){
}
int c_fullskip;
int c_portalskip, c_leafskip;
int c_vistest, c_mighttest;
int c_chop, c_nochop;

View file

@ -3,14 +3,14 @@
# TTimo <ttimo@ttimo.net>
# http://scons.org/
import os, commands, platform, xml.sax, re, string, platform
import os, subprocess, platform, xml.sax, re, string, platform
class vcxproj( xml.sax.handler.ContentHandler ):
def __init__( self, filepath ):
self.source_files = []
self.misc_files = []
self._files = []
print 'parse %s' % filepath
print( 'parse %s' % filepath )
xml.sax.parse( filepath, self )
def getSourceFiles( self ):
@ -30,8 +30,8 @@ class vcxproj( xml.sax.handler.ContentHandler ):
def startElement( self, name, attrs ):
if ( name == 'ClCompile' ):
if ( attrs.has_key('Include') ):
self._files.append( attrs.getValue('Include') )
if ( 'Include' in attrs.getNames() ):
self._files.append( attrs.getValue('Include') )
def endDocument( self ):
# split into source and headers, remap path seperator to the platform
@ -39,10 +39,10 @@ class vcxproj( xml.sax.handler.ContentHandler ):
if ( platform.system() != 'Windows' ):
f = f.replace( '\\', '/' )
if ( f[-2:] == '.c' or f[-4:] == '.cpp' ):
self.source_files.append( f.encode('ascii') )
self.source_files.append( f )
else:
self.misc_files.append( f )
print '%d source files' % len( self.source_files )
print( '%d source files' % len( self.source_files ) )
# action uses LDD to verify that the source doesn't hold unresolved symbols
# setup as an AddPostAction of a regular SharedLibrary call
@ -50,19 +50,20 @@ def CheckUnresolved( source, target, env ):
# TODO: implement this for OSX
if ( platform.system() == 'Darwin' ):
return None
# TODO: implement this for FreeBSD
if ( platform.system() == 'FreeBSD' ):
return None
print 'CheckUnresolved %s' % target[0].abspath
# TODO: implement this for FreeBSD
if ( platform.system() == 'FreeBSD' ):
return None
print( 'CheckUnresolved %s' % target[0].abspath )
if ( not os.path.isfile( target[0].abspath ) ):
print 'CheckUnresolved: %s does not exist' % target[0]
print( 'CheckUnresolved: %s does not exist' % target[0] )
return 1 # fail
( status, output ) = commands.getstatusoutput( 'ldd -r %s' % target[0] )
if ( status != 0 ):
print 'CheckUnresolved: ldd command failed (exit code %d)' % status
os.system( 'rm %s' % target[ 0 ] )
return 1 # fail
lines = string.split( output, '\n' )
try:
stdout = subprocess.check_output( ['ldd', '-r', str(target[0])] ).decode( 'utf-8' )
except subprocess.CalledProcessError as cpe:
print( 'CheckUnresolved: ldd command failed (exit code {})'.format( cpe.returncode ) )
os.system( 'rm %s' % target[ 0 ] )
return 1 # fail
lines = stdout.split( '\n' )
have_undef = 0
for i_line in lines:
regex = re.compile('undefined symbol: (.*)\t\\((.*)\\)')
@ -73,8 +74,8 @@ def CheckUnresolved( source, target, env ):
except:
have_undef = 1
if ( have_undef ):
print output
print "CheckUnresolved: undefined symbols"
print( output )
print( "CheckUnresolved: undefined symbols" )
os.system('rm %s' % target[0])
return 1