~widelands-dev/widelands/bug-1654989-fuzzy-terrain-images

« back to all changes in this revision

Viewing changes to SConstruct

  • Committer: bedouin
  • Date: 2007-01-26 20:08:48 UTC
  • Revision ID: git-v1:9b00883558b9b9d42bf3e8d42a9a1ccb36327ef7
- enable in-place compression inside distribution tarballs (eg. for campaigns)


git-svn-id: https://widelands.svn.sourceforge.net/svnroot/widelands/trunk@1966 37b2a8de-5219-0410-9f54-a31bc463ab9c

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
import sys
11
11
sys.path.append("build/scons-tools")
12
12
from scons_configure import *
 
13
from Distribute import *
13
14
 
14
15
#Speedup. If you have problems with inconsistent or wrong builds, look here first
15
16
SetOption('max_drift', 1)
51
52
 
52
53
        return filenames
53
54
 
54
 
########################################################################### find $ROOT -name $GLOB
 
55
######################################################### find $ROOT -name $GLOB
55
56
 
56
57
def find(root, glob):
57
58
        files=[]
63
64
                        files+=find(file, glob)
64
65
        return files
65
66
 
66
 
########################################################################### Create a phony target (not (yet) a feature of scons)
 
67
########################### Create a phony target (not (yet) a feature of scons)
67
68
 
68
69
# taken from scons' wiki
69
70
def PhonyTarget(alias, action):
79
80
        phony_file = normpath(mktemp(prefix="phony_%s_" % alias, dir="."))
80
81
        return Alias(alias, Command(target=phony_file, source=None, action=action))
81
82
 
82
 
########################################################################### Functions for setting permissions when installing
 
83
############################## Functions for setting permissions when installing
83
84
# don't forget to set umask
84
85
try:
85
86
        os.umask(022)
145
146
env.Tool("ctags", toolpath=['build/scons-tools'])
146
147
env.Tool("PNGShrink", toolpath=['build/scons-tools'])
147
148
env.Tool("astyle", toolpath=['build/scons-tools'])
148
 
env.Tool("disttar", toolpath=['build/scons-tools'])
 
149
env.Tool("Distribute", toolpath=['build/scons-tools'])
149
150
 
150
151
################################################################################
151
152
# Environment setup
259
260
 
260
261
################################################################################
261
262
 
262
 
opts.Save('build/scons-config.py',env) #build_id must be saved *before* it might be set to a fixed date
 
263
#build_id must be saved *before* it might be set to a fixed date
 
264
opts.Save('build/scons-config.py',env)
263
265
 
264
 
#This is just a default, do not change it here. Use the option 'build_id' instead.
 
266
#This is just a default, don't change it here. Use the option 'build_id' instead
265
267
if (env['build_id']=='') or (env['build_id']=='date'):
266
268
        env['build_id']=time.strftime("%Y.%m.%d-%H%M%S", time.gmtime())
267
269
print 'Build ID:          '+env['build_id']
276
278
# Pretty output
277
279
print
278
280
 
279
 
########################################################################### Use distcc if available
 
281
######################################################## Use distcc if available
280
282
 
281
283
# not finished yet
282
284
#if os.path.exists('/usr/lib/distcc/bin'):
284
286
#       env['ENV']['PATH'] = '/usr/lib/distcc/bin:'+env['ENV']['PATH']
285
287
#       env['ENV']['HOME'] = os.environ['HOME']
286
288
 
287
 
############################################################################ Build things
288
 
 
289
 
############### Build setup
 
289
################################################################### Build things
290
290
 
291
291
SConsignFile('build/scons-signatures')
292
292
BUILDDIR='build/'+TARGET+'-'+env['build']
293
293
Export('env', 'Glob', 'BUILDDIR', 'PhonyTarget')
294
294
 
295
 
############### buildcat
 
295
####################################################################### buildcat
296
296
 
297
297
buildcat=SConscript('locale/SConscript')
298
298
 
299
 
############### The binary
 
299
##################################################################### The binary
300
300
 
301
301
thebinary=SConscript('src/SConscript', build_dir=BUILDDIR, duplicate=0)
302
302
Default(thebinary)
303
303
 
304
 
############### tags
 
304
####################################################################### the rest
 
305
 
 
306
SConscript('build/SConscript')
 
307
SConscript('campaigns/SConscript')
 
308
SConscript('doc/SConscript')
 
309
SConscript('maps/SConscript')
 
310
SConscript('utils/SConscript')
 
311
 
 
312
########################################################################### tags
305
313
 
306
314
S=find('src', '*.h')
307
315
S+=find('src', '*.cc')
309
317
if env['build'] == 'release':
310
318
        Default('tags')
311
319
 
312
 
############### PNG shrinking
 
320
################################################################## PNG shrinking
313
321
 
314
322
# findfiles takes quite long, so don't execute it if it's unneccessary
315
323
if ('shrink' in BUILD_TARGETS):
317
325
        shrink=env.PNGShrink(find('.', '*.png'))
318
326
        Alias("shrink", shrink)
319
327
 
320
 
############### Install and uninstall
 
328
########################################################## Install and uninstall
321
329
 
322
330
INSTDIRS=[
323
331
        'campaigns',
367
375
install=PhonyTarget("install", do_inst)
368
376
uninstall=PhonyTarget("uninstall", do_uninst)
369
377
 
370
 
############### Distribute
371
 
 
372
 
DISTFILES=[
373
 
        'ChangeLog',
374
 
        'COPYING',
375
 
        'CREDITS',
376
 
        'Doxyfile',
377
 
        'Makefile',
378
 
        'README-compiling.txt',
379
 
        'README.developers',
380
 
        'SConstruct',
381
 
        'build-widelands.sh',
382
 
        'build/build1.sh',
383
 
        'build/build.txt',
384
 
        'build/build-with-cross.sh',
385
 
        'build/debian-crossbuild',
386
 
        'build/scons-config.py',
387
 
        env.Dir('build/scons-tools'),
388
 
        env.Dir('build/win32'),
389
 
        'build/win32-vctoolkit.bat',
390
 
        env.Dir('campaigns'),
391
 
        env.Dir('doc'),
392
 
        env.Dir('fonts'),
393
 
        env.Dir('game_server'),
394
 
        env.Dir('locale'),
395
 
        env.Dir('macos'),
396
 
        env.Dir('maps'),
397
 
        env.Dir('music'),
398
 
        env.Dir('pics'),
399
 
        env.Dir('sound'),
400
 
        env.Dir('src'),
401
 
        env.Dir('tribes'),
402
 
        env.Dir('txts'),
403
 
        env.Dir('utils'),
404
 
        env.Dir('worlds'),
405
 
        ]
406
 
env['DISTTAR_FORMAT']='bz2'
407
 
env.Append(
408
 
        DISTTAR_EXCLUDEEXTS=['.o','.so','.a','.dll','.cache','.pyc','.cvsignore','.dblite','.log'],
409
 
        DISTTAR_EXCLUDEDIRS=['CVS','.svn','sourcecode']
410
 
        )
411
 
 
412
 
if 'dist' in BUILD_TARGETS:
413
 
        print "Assembling file list for distribution tarball..."
414
 
        dist=env.DistTar('widelands-'+env['build_id']+'.tar.bz2', DISTFILES)
415
 
        Alias("dist", dist)
416
 
 
417
 
############### longlines
 
378
##################################################################### Distribute
 
379
 
 
380
distadd(env, 'ChangeLog')
 
381
distadd(env, 'COPYING')
 
382
distadd(env, 'CREDITS')
 
383
distadd(env, 'Doxyfile')
 
384
distadd(env, 'Makefile')
 
385
distadd(env, 'README-compiling.txt')
 
386
distadd(env, 'README.developers')
 
387
distadd(env, 'SConstruct')
 
388
distadd(env, 'build-widelands.sh')
 
389
distadd(env, 'fonts')
 
390
distadd(env, 'game_server')
 
391
distadd(env, 'locale')
 
392
distadd(env, 'macos')
 
393
distadd(env, 'music')
 
394
distadd(env, 'pics')
 
395
distadd(env, 'sound')
 
396
distadd(env, 'src')
 
397
distadd(env, 'tribes')
 
398
distadd(env, 'txts')
 
399
distadd(env, 'utils')
 
400
distadd(env, 'worlds')
 
401
 
 
402
dist=env.DistPackage('widelands.tar.bz2', '')
 
403
Alias('dist', dist)
 
404
AlwaysBuild(dist)
 
405
 
 
406
###################################################################### longlines
418
407
 
419
408
longlines=PhonyTarget("longlines", 'utils/count-longlines.py')
420
409
 
421
 
############### precommit
 
410
###################################################################### precommit
422
411
 
423
412
#Alias('precommit', 'indent')
424
413
Alias('precommit', buildcat)
425
414
Alias('precommit', 'longlines')
426
415
 
427
 
############### Documentation
 
416
################################################################## Documentation
428
417
 
429
418
PhonyTarget('doc', 'doxygen Doxyfile')
430
419