|
| 1 | +Index: SConstruct |
| 2 | +--- SConstruct.orig |
| 3 | ++++ SConstruct |
| 4 | +@@ -12,8 +12,8 @@ import scons_utils |
| 5 | + conf_filename='site.conf' |
| 6 | + # choose configuration variables which should be saved between runs |
| 7 | + # ( we handle all those as strings ) |
| 8 | +-serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'IDNET_HOST', 'DEDICATED', |
| 9 | +- 'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK', 'ALSA', |
| 10 | ++serialized=['CC', 'CXX', 'X86', 'JOBS', 'BUILD', 'IDNET_HOST', 'DEDICATED', |
| 11 | ++ 'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK', |
| 12 | + 'TARGET_CORE', 'TARGET_GAME', 'TARGET_D3XP', 'TARGET_MONO', 'TARGET_DEMO', 'NOCURL', |
| 13 | + 'TARGET_CDOOM', |
| 14 | + 'TARGET_D3LE', |
| 15 | +@@ -29,6 +29,13 @@ serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'IDNET_HOST' |
| 16 | + 'MULTITHREAD', 'OPENSLES' |
| 17 | + ] |
| 18 | + |
| 19 | ++ |
| 20 | ++# global build mode ------------------------------ |
| 21 | ++ |
| 22 | ++g_sdk = not os.path.exists( 'sys/scons/SConscript.core' ) |
| 23 | ++ |
| 24 | ++# ------------------------------------------------ |
| 25 | ++ |
| 26 | + # help ------------------------------------------- |
| 27 | + |
| 28 | + help_string = """ |
| 29 | +@@ -102,12 +109,18 @@ BUILD_GAMEPAK (default 0) |
| 30 | + BASEFLAGS (default '') |
| 31 | + Add compile flags |
| 32 | + |
| 33 | +-NOCONF (default 0, not saved) |
| 34 | +- ignore site configuration and use defaults + command line only |
| 35 | ++X86 (default 0) |
| 36 | ++ cross compile for x86 (only applicable on x86_64) |
| 37 | + |
| 38 | + SILENT ( default 0, saved ) |
| 39 | + hide the compiler output, unless error |
| 40 | + |
| 41 | ++NOCONF (default 0, not saved) |
| 42 | ++ ignore site configuration and use defaults + command line only |
| 43 | ++""" |
| 44 | ++ |
| 45 | ++if ( not g_sdk ): |
| 46 | ++ help_string += """ |
| 47 | + DEDICATED (default 0) |
| 48 | + Control regular / dedicated type of build: |
| 49 | + 0 - client |
| 50 | +@@ -155,9 +168,12 @@ ID_MCHECK (default 2) |
| 51 | + note that Doom has it's own block allocator/checking |
| 52 | + this should not be considered a replacement, but an additional tool |
| 53 | + |
| 54 | +-ALSA (default 1) |
| 55 | +- enable ALSA sound backend support |
| 56 | +- |
| 57 | ++SETUP (default 0, not saved) |
| 58 | ++ build a setup. implies release build |
| 59 | ++ |
| 60 | ++SDK (default 0, not saved) |
| 61 | ++ build an SDK release |
| 62 | ++ |
| 63 | + NOCURL (default 0) |
| 64 | + set to 1 to disable usage of libcurl and http/ftp downloads feature |
| 65 | + """ |
| 66 | +@@ -175,18 +191,27 @@ EnsureSConsVersion( 0, 96 ) |
| 67 | + # system detection ------------------------------- |
| 68 | + |
| 69 | + # CPU type |
| 70 | +-cpu = commands.getoutput('uname -m') |
| 71 | +-exp = re.compile('i?86') |
| 72 | +-if exp.match(cpu): |
| 73 | +- cpu = 'x86' |
| 74 | +-else: |
| 75 | +- if (commands.getoutput('uname -p') == 'powerpc'): |
| 76 | +- cpu = 'ppc' |
| 77 | +-g_os = 'Linux' |
| 78 | ++g_cpu = '' |
| 79 | + |
| 80 | +-if ARGUMENTS.has_key( 'ARCH' ): |
| 81 | +- cpu = ARGUMENTS['ARCH'] |
| 82 | ++uname = commands.getoutput('uname -m') |
| 83 | ++if uname == 'x86_64': |
| 84 | ++ g_cpu = 'x86_64' |
| 85 | + |
| 86 | ++if len(g_cpu) < 1: |
| 87 | ++ exp = re.compile('.*i?86.*') |
| 88 | ++ if exp.match(uname): |
| 89 | ++ g_cpu = 'x86' |
| 90 | ++ |
| 91 | ++if len(g_cpu) < 1: |
| 92 | ++ uname = commands.getoutput('uname -p') |
| 93 | ++ if (uname == 'powerpc'): |
| 94 | ++ g_cpu = 'ppc' |
| 95 | ++ |
| 96 | ++if len(g_cpu) < 1: |
| 97 | ++ g_cpu = 'cpu' |
| 98 | ++ |
| 99 | ++g_os = commands.getoutput('uname -s') |
| 100 | ++ |
| 101 | + # end system detection --------------------------- |
| 102 | + |
| 103 | + # default settings ------------------------------- |
| 104 | +@@ -195,6 +220,7 @@ CC = 'gcc' |
| 105 | + CXX = 'g++' |
| 106 | + JOBS = '16' |
| 107 | + BUILD = 'debug' |
| 108 | ++X86 = '0' |
| 109 | + DEDICATED = '0' |
| 110 | + TARGET_CORE = '1' |
| 111 | + TARGET_GAME = '1' |
| 112 | +@@ -218,7 +244,8 @@ LIBC_MALLOC = '1' |
| 113 | + ID_NOLANADDRESS = '0' |
| 114 | + ID_MCHECK = '2' |
| 115 | + BUILD_ROOT = 'build' |
| 116 | +-ALSA = '1' |
| 117 | ++SETUP = '0' |
| 118 | ++SDK = '0' |
| 119 | + NOCONF = '0' |
| 120 | + NOCURL = '0' |
| 121 | + BUILD_GAMEPAK = '0' |
| 122 | +@@ -271,6 +298,21 @@ if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['N |
| 123 | + |
| 124 | + # end save site configuration ------------------ |
| 125 | + |
| 126 | ++# configuration rules -------------------------- |
| 127 | ++ |
| 128 | ++if ( SETUP != '0' ): |
| 129 | ++ DEDICATED = '2' |
| 130 | ++ BUILD = 'release' |
| 131 | ++ |
| 132 | ++if ( g_sdk or SDK != '0' ): |
| 133 | ++ TARGET_CORE = '0' |
| 134 | ++ TARGET_GAME = '1' |
| 135 | ++ TARGET_D3XP = '1' |
| 136 | ++ TARGET_MONO = '0' |
| 137 | ++ TARGET_DEMO = '0' |
| 138 | ++ |
| 139 | ++# end configuration rules ---------------------- |
| 140 | ++ |
| 141 | + # general configuration, target selection -------- |
| 142 | + |
| 143 | + g_build = BUILD_ROOT + '/' + BUILD |
| 144 | +@@ -297,15 +339,31 @@ CORECPPPATH = [ ] |
| 145 | + CORELIBPATH = [ ] |
| 146 | + CORECPPFLAGS = [ ] |
| 147 | + GAMECPPFLAGS = [ ] |
| 148 | +-BASELINKFLAGS = [ '-Wl,--no-undefined' ] |
| 149 | +-CORELINKFLAGS = [ '-Wl,--no-undefined' ] |
| 150 | +-#//k BASELINKFLAGS = [ '-Wl,--no-undefined', '-static-libstdc++' ] |
| 151 | +-#//k CORELINKFLAGS = [ '-Wl,--no-undefined', '-static-libstdc++' ] |
| 152 | ++BASELINKFLAGS = [ ] |
| 153 | ++CORELINKFLAGS = [ ] |
| 154 | + |
| 155 | + # for release build, further optimisations that may not work on all files |
| 156 | + OPTCPPFLAGS = [ ] |
| 157 | + |
| 158 | +-BASECPPFLAGS.append( BASEFLAGS.split() ) |
| 159 | ++if (g_cpu == 'x86_64' and X86 == '1'): |
| 160 | ++ print('cross compiling for x86') |
| 161 | ++ g_cpu = 'x86' |
| 162 | ++ BASECPPFLAGS.append('-m32') |
| 163 | ++ BASELINKFLAGS.append('-m32') |
| 164 | ++ |
| 165 | ++g_build = '%s/%s-%s' % (BUILD_ROOT, g_cpu, BUILD) |
| 166 | ++ |
| 167 | ++SConsignFile( g_build + '/scons.signatures' ) |
| 168 | ++ |
| 169 | ++if ( DEBUG_MEMORY != '0' ): |
| 170 | ++ g_build += '-debugmem' |
| 171 | ++ |
| 172 | ++if ( LIBC_MALLOC != '1' ): |
| 173 | ++ g_build += '-nolibcmalloc' |
| 174 | ++ |
| 175 | ++LINK = CXX |
| 176 | ++ |
| 177 | ++BASECPPFLAGS.extend( BASEFLAGS.split(' ') ) |
| 178 | + BASECPPFLAGS.append( '-pipe' ) |
| 179 | + # warn all |
| 180 | + BASECPPFLAGS.append( '-Wall' ) # -w |
| 181 | +@@ -328,6 +386,13 @@ if ( g_os == 'Linux' ): |
| 182 | + #BASECPPFLAGS.append('-D__arm__') |
| 183 | + # //k |
| 184 | + |
| 185 | ++if ( "BSD" in g_os ): |
| 186 | ++ BASECPPFLAGS.append( '-I/usr/local/include' ) |
| 187 | ++ BASELINKFLAGS.append('-L/usr/local/lib') |
| 188 | ++ |
| 189 | ++if ( g_sdk or SDK != '0' ): |
| 190 | ++ BASECPPFLAGS.append( '-D_D3SDK' ) |
| 191 | ++ |
| 192 | + if ( TARGET_ANDROID == '1' ): |
| 193 | + BASECPPFLAGS.append( '-D__ANDROID__') |
| 194 | + g_os = 'Android' |
| 195 | +@@ -353,6 +418,10 @@ elif ( BUILD == 'release' ): |
| 196 | + OPTCPPFLAGS = [ '-O3', '-Wl,--no-undefined', '-ffast-math', '-fno-unsafe-math-optimizations', '-fomit-frame-pointer' ] |
| 197 | + else: |
| 198 | + OPTCPPFLAGS = [ '-O3', '-march=native', '-ffast-math', '-fno-unsafe-math-optimizations', '-fomit-frame-pointer' ] |
| 199 | ++ |
| 200 | ++ if (g_cpu == 'x86'): |
| 201 | ++ OPTCPPFLAGS.append('-march=pentium3') |
| 202 | ++ |
| 203 | + if ( ID_MCHECK == '0' ): |
| 204 | + ID_MCHECK = '2' |
| 205 | + else: |
| 206 | +@@ -373,7 +442,12 @@ if ( ID_NOLANADDRESS != '0' ): |
| 207 | + |
| 208 | + if ( ID_MCHECK == '1' ): |
| 209 | + BASECPPFLAGS.append( '-DID_MCHECK' ) |
| 210 | +- |
| 211 | ++ |
| 212 | ++# TODO fix these warnings |
| 213 | ++BASECPPFLAGS.append('-Wno-sign-compare') |
| 214 | ++BASECPPFLAGS.append('-Wno-switch') |
| 215 | ++BASECPPFLAGS.append('-Wno-format-security') |
| 216 | ++ |
| 217 | + # create the build environements |
| 218 | + g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH, NDK = NDK, MULTITHREAD = MULTITHREAD, OPENSLES = OPENSLES ) |
| 219 | + scons_utils.SetupUtils( g_base_env ) |
| 220 | +@@ -430,7 +504,7 @@ local_humanhead = 0 |
| 221 | + # OpenGL |
| 222 | + local_opengl = 0 |
| 223 | + |
| 224 | +-GLOBALS = 'g_env g_env_noopt g_game_env g_os ID_MCHECK ALSA idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp local_cdoom local_d3le local_rivensin local_hardcorps local_quake4 local_raven local_prey local_humanhead local_opengl OPTCPPFLAGS NDK MULTITHREAD OPENSLES' |
| 225 | ++GLOBALS = 'g_env g_env_noopt g_game_env g_os g_cpu g_build ID_MCHECK idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp local_cdoom local_d3le local_rivensin local_hardcorps local_quake4 local_raven local_prey local_humanhead local_opengl OPTCPPFLAGS NDK MULTITHREAD OPENSLES' |
| 226 | + |
| 227 | + # end general configuration ---------------------- |
| 228 | + |
0 commit comments