~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to SConstruct

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
 
# $Id: SConstruct,v 1.163 2007/02/15 17:00:21 aphex Exp $
 
2
# $Id: SConstruct,v 1.168 2007/05/06 22:12:14 jesterking Exp $
3
3
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4
4
#
5
5
# This program is free software; you can redistribute it and/or
275
275
    
276
276
def NSIS_Installer():
277
277
 
278
 
        if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
279
 
                print "NSIS installer is only available on Windows."
280
 
                Exit()
281
 
                
282
 
        install_base_dir = os.getcwd() + "\\"
283
 
        
284
 
        os.chdir("release")
285
 
        v = open("VERSION")
286
 
        version = v.read()[:-1]
287
 
        shortver = version.split('.')[0] + version.split('.')[1]
288
 
        v.close()
289
 
        
290
 
        #### change to suit install dir ####
291
 
        inst_dir = install_base_dir + env['BF_INSTALLDIR']
292
 
 
293
 
        os.chdir("windows/installer")
294
 
        
295
 
        ns = open("00.sconsblender.nsi","r")
296
 
        
297
 
        ns_cnt = str(ns.read())
298
 
        ns.close()
299
 
        
300
 
        # do root
301
 
        rootlist = []
302
 
        rootdir = os.listdir(inst_dir+"\\")
303
 
        for rootitem in rootdir:
304
 
                if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
305
 
                        rootlist.append("File " + inst_dir + "\\" + rootitem)
306
 
        rootstring = string.join(rootlist, "\n  ")
307
 
        rootstring += "\n\n"
308
 
        ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
309
 
        
310
 
        # do delete items
311
 
        delrootlist = []
312
 
        for rootitem in rootdir:
313
 
                if os.path.isdir(inst_dir + rootitem) == 0:
314
 
                        delrootlist.append("Delete $INSTDIR\\" + rootitem)
315
 
        delrootstring = string.join(delrootlist, "\n ")
316
 
        delrootstring += "\n"
317
 
        ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
318
 
        
319
 
        # do scripts
320
 
        scriptlist = []
321
 
        scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
322
 
        scriptdir = os.listdir(scriptpath)
323
 
        for scriptitem in scriptdir:
324
 
                scriptfile = "%s\\%s" % (scriptpath, scriptitem)
325
 
                if os.path.isdir(scriptfile) == 0:
326
 
                        scriptlist.append("File %s" % scriptfile)
327
 
        scriptstring = string.join(scriptlist, "\n  ")
328
 
        scriptstring += "\n\n"
329
 
        ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
330
 
        
331
 
        # do scripts\bpymodules
332
 
        bpymodlist = []
333
 
        bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
334
 
        bpymoddir = os.listdir(bpymodpath)
335
 
        
336
 
        for bpymoditem in bpymoddir:
337
 
                bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
338
 
                if os.path.isdir(bpymodfile) == 0:
339
 
                        bpymodlist.append("File %s" % bpymodfile)
340
 
        bpymodstring = string.join(bpymodlist, "\n  ")
341
 
        bpymodstring += "\n\n"
342
 
        ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
343
 
        
344
 
        # do scripts\bpymodules\colladaimex
345
 
        colladalist = []
346
 
        bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
347
 
        bpymoddir = os.listdir(bpymodpath)
348
 
        
349
 
        for bpymoditem in bpymoddir:
350
 
                bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
351
 
                if os.path.isdir(bpymodfile) == 0:
352
 
                        colladalist.append("File %s" % bpymodfile)
353
 
        bpymodstring = string.join(colladalist, "\n  ")
354
 
        bpymodstring += "\n\n"
355
 
        ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
356
 
        
357
 
        # do scripts\bpydata
358
 
        bpydatalist = []
359
 
        bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
360
 
        bpydatadir = os.listdir(bpydatapath)
361
 
        for bpydataitem in bpydatadir:
362
 
                bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
363
 
                if os.path.isdir(bpydatafile) == 0:
364
 
                        bpydatalist.append("File %s" % bpydatafile)
365
 
        bpydatastring = string.join(bpydatalist, "\n  ")
366
 
        bpydatastring += "\n\n"
367
 
        ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
368
 
        
369
 
        # do plugins\include
370
 
        plugincludelist = []
371
 
        plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
372
 
        plugincludedir = os.listdir(plugincludepath)
373
 
        for plugincludeitem in plugincludedir:
374
 
                plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
375
 
                if os.path.isdir(plugincludefile) == 0:
376
 
                        if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
377
 
                                plugincludelist.append("File %s" % plugincludefile)
378
 
        plugincludestring = string.join(plugincludelist, "\n  ")
379
 
        plugincludestring += "\n\n"
380
 
        ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
381
 
        
382
 
        # do scripts\bpydata\config
383
 
        cfglist = []
384
 
        cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
385
 
        cfgdir = os.listdir(cfgpath)
386
 
        for cfgitem in cfgdir:
387
 
                cfgfile = "%s\\%s" % (cfgpath, cfgitem)
388
 
                if os.path.isdir(cfgfile) == 0:
389
 
                        cfglist.append("File %s" % cfgfile)
390
 
        cfgstring = string.join(cfglist, "\n  ")
391
 
        cfgstring += "\n\n"
392
 
        ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
393
 
        
394
 
        # do dotblender
395
 
        dotblendlist = []
396
 
        dotblenddir = os.listdir(inst_dir+"\\.blender")
397
 
        for dotblenditem in dotblenddir:
398
 
                if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
399
 
                        dotblendlist.append("File " + inst_dir + "\\.blender\\" + dotblenditem)
400
 
        dotblendstring = string.join(dotblendlist, "\n  ")
401
 
        dotblendstring += "\n\n"
402
 
        ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
403
 
        
404
 
        # do language files
405
 
        langlist = []
406
 
        langfiles = []
407
 
        langdir = os.listdir(inst_dir + "\\.blender\\locale")
408
 
        for langitem in langdir:
409
 
                if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
410
 
                        langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
411
 
                        langfiles.append("File " + inst_dir + "\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
412
 
        langstring = string.join(langfiles, "\n  ")
413
 
        langstring += "\n\n"
414
 
        ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
415
 
        
416
 
        # var replacements
417
 
        ns_cnt = string.replace(ns_cnt, "DISTDIR", inst_dir+"\\")
418
 
        ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
419
 
        ns_cnt = string.replace(ns_cnt, "VERSION", version)
420
 
        
421
 
        new_nsis = open("00.blender_tmp.nsi", 'w')
422
 
        new_nsis.write(ns_cnt)
423
 
        new_nsis.close()
424
 
        
425
 
        sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w')
 
278
    if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw':
 
279
        print "NSIS installer is only available on Windows."
 
280
        Exit()
 
281
        
 
282
    install_base_dir = os.getcwd() + "\\"
 
283
 
 
284
    os.chdir("release")
 
285
    v = open("VERSION")
 
286
    version = v.read()[:-1]
 
287
    shortver = version.split('.')[0] + version.split('.')[1]
 
288
    v.close()
 
289
 
 
290
    #### change to suit install dir ####
 
291
    inst_dir = install_base_dir + env['BF_INSTALLDIR']
 
292
 
 
293
    os.chdir("windows/installer")
 
294
 
 
295
    ns = open("00.sconsblender.nsi","r")
 
296
 
 
297
    ns_cnt = str(ns.read())
 
298
    ns.close()
 
299
 
 
300
    # do root
 
301
    rootlist = []
 
302
    rootdir = os.listdir(inst_dir+"\\")
 
303
    for rootitem in rootdir:
 
304
        if os.path.isdir(inst_dir+"\\"+ rootitem) == 0:
 
305
            rootlist.append("File " + inst_dir + "\\" + rootitem)
 
306
    rootstring = string.join(rootlist, "\n  ")
 
307
    rootstring += "\n\n"
 
308
    ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring)
 
309
 
 
310
    # do delete items
 
311
    delrootlist = []
 
312
    for rootitem in rootdir:
 
313
        if os.path.isdir(inst_dir + rootitem) == 0:
 
314
            delrootlist.append("Delete $INSTDIR\\" + rootitem)
 
315
    delrootstring = string.join(delrootlist, "\n ")
 
316
    delrootstring += "\n"
 
317
    ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring)
 
318
 
 
319
    # do scripts
 
320
    scriptlist = []
 
321
    scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts")
 
322
    scriptdir = os.listdir(scriptpath)
 
323
    for scriptitem in scriptdir:
 
324
        scriptfile = "%s\\%s" % (scriptpath, scriptitem)
 
325
        if os.path.isdir(scriptfile) == 0:
 
326
            scriptlist.append("File %s" % scriptfile)
 
327
    scriptstring = string.join(scriptlist, "\n  ")
 
328
    scriptstring += "\n\n"
 
329
    ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring)
 
330
 
 
331
    # do scripts\bpymodules
 
332
    bpymodlist = []
 
333
    bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules")
 
334
    bpymoddir = os.listdir(bpymodpath)
 
335
 
 
336
    for bpymoditem in bpymoddir:
 
337
        bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
 
338
        if os.path.isdir(bpymodfile) == 0:
 
339
            bpymodlist.append("File %s" % bpymodfile)
 
340
    bpymodstring = string.join(bpymodlist, "\n  ")
 
341
    bpymodstring += "\n\n"
 
342
    ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring)
 
343
 
 
344
    # do scripts\bpymodules\colladaimex
 
345
    colladalist = []
 
346
    bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx")
 
347
    bpymoddir = os.listdir(bpymodpath)
 
348
 
 
349
    for bpymoditem in bpymoddir:
 
350
        bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem)
 
351
        if os.path.isdir(bpymodfile) == 0:
 
352
            colladalist.append("File %s" % bpymodfile)
 
353
    bpymodstring = string.join(colladalist, "\n  ")
 
354
    bpymodstring += "\n\n"
 
355
    ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring)
 
356
 
 
357
    # do scripts\bpydata
 
358
    bpydatalist = []
 
359
    bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata")
 
360
    bpydatadir = os.listdir(bpydatapath)
 
361
    for bpydataitem in bpydatadir:
 
362
        bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem)
 
363
        if os.path.isdir(bpydatafile) == 0:
 
364
            bpydatalist.append("File %s" % bpydatafile)
 
365
    bpydatastring = string.join(bpydatalist, "\n  ")
 
366
    bpydatastring += "\n\n"
 
367
    ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring)
 
368
 
 
369
    # do plugins\include
 
370
    plugincludelist = []
 
371
    plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include")
 
372
    plugincludedir = os.listdir(plugincludepath)
 
373
    for plugincludeitem in plugincludedir:
 
374
        plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem)
 
375
        if os.path.isdir(plugincludefile) == 0:
 
376
            if plugincludefile.find('.h') or plugincludefile.find('.DEF'):
 
377
                plugincludelist.append("File %s" % plugincludefile)
 
378
    plugincludestring = string.join(plugincludelist, "\n  ")
 
379
    plugincludestring += "\n\n"
 
380
    ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring)
 
381
 
 
382
    # do scripts\bpydata\config
 
383
    cfglist = []
 
384
    cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config")
 
385
    cfgdir = os.listdir(cfgpath)
 
386
    for cfgitem in cfgdir:
 
387
        cfgfile = "%s\\%s" % (cfgpath, cfgitem)
 
388
        if os.path.isdir(cfgfile) == 0:
 
389
            cfglist.append("File %s" % cfgfile)
 
390
    cfgstring = string.join(cfglist, "\n  ")
 
391
    cfgstring += "\n\n"
 
392
    ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring)
 
393
 
 
394
    # do dotblender
 
395
    dotblendlist = []
 
396
    dotblenddir = os.listdir(inst_dir+"\\.blender")
 
397
    for dotblenditem in dotblenddir:
 
398
        if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0:
 
399
            dotblendlist.append("File " + inst_dir + "\\.blender\\" + dotblenditem)
 
400
    dotblendstring = string.join(dotblendlist, "\n  ")
 
401
    dotblendstring += "\n\n"
 
402
    ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring)
 
403
 
 
404
    # do language files
 
405
    langlist = []
 
406
    langfiles = []
 
407
    langdir = os.listdir(inst_dir + "\\.blender\\locale")
 
408
    for langitem in langdir:
 
409
        if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1:
 
410
            langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES")
 
411
            langfiles.append("File " + inst_dir + "\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo")
 
412
    langstring = string.join(langfiles, "\n  ")
 
413
    langstring += "\n\n"
 
414
    ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring)
 
415
 
 
416
    # var replacements
 
417
    ns_cnt = string.replace(ns_cnt, "DISTDIR", inst_dir+"\\")
 
418
    ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver)
 
419
    ns_cnt = string.replace(ns_cnt, "VERSION", version)
 
420
 
 
421
    new_nsis = open("00.blender_tmp.nsi", 'w')
 
422
    new_nsis.write(ns_cnt)
 
423
    new_nsis.close()
 
424
 
 
425
    sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w')
426
426
    
427
427
nsis_build = None
428
428
if 'nsis' in B.targets:
506
506
 
507
507
#------------ INSTALL
508
508
 
509
 
blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
 
509
#-- binaries
 
510
blenderinstall = []
 
511
if  env['OURPLATFORM']=='darwin':
 
512
    for prg in B.program_list:
 
513
        bundle = '%s.app' % prg[0]
 
514
        bundledir = os.path.dirname(bundle)
 
515
        for dp, dn, df in os.walk(bundle):
 
516
            if 'CVS' in dn:
 
517
                dn.remove('CVS')
 
518
            dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
 
519
            source=[dp+os.sep+f for f in df]
 
520
            blenderinstall.append(env.Install(dir=dir,source=source))
 
521
else:
 
522
    blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
510
523
 
511
524
#-- .blender
512
525
dotblendlist = []
563
576
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
564
577
    dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
565
578
                        '${LCGDIR}/png/lib/libpng.dll',
566
 
                        '#release/windows/extra/python24.zip',
567
 
                        '#release/windows/extra/zlib.pyd',
 
579
#                        '#release/windows/extra/python24.zip',
 
580
#                        '#release/windows/extra/zlib.pyd',
568
581
                        '${LCGDIR}/sdl/lib/SDL.dll',
569
582
                        '${LCGDIR}/zlib/lib/zlib.dll',
570
583
                        '${LCGDIR}/tiff/lib/libtiff.dll']
571
584
    if env['BF_DEBUG']:
572
 
        dllsources.append('${LCGDIR}/python/lib/python24_d.dll')
 
585
        dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll')
573
586
    else:
574
 
        dllsources.append('${LCGDIR}/python/lib/python24.dll')
 
587
        dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll')
575
588
    if env['OURPLATFORM'] == 'win32-mingw':
576
589
        dllsources += ['${LCGDIR}/pthreads/lib/pthreadGC2.dll']
577
590
    else:
581
594
    if env['WITH_BF_FFMPEG']:
582
595
        dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
583
596
                        '${LCGDIR}/ffmpeg/lib/avformat-51.dll',
584
 
                        '${LCGDIR}/ffmpeg/lib/avutil-49.dll',
585
 
                        '${LCGDIR}/ffmpeg/lib/libdts.dll',
586
 
                        '${LCGDIR}/ffmpeg/lib/libfaac.dll',
587
 
                        '${LCGDIR}/ffmpeg/lib/libfaad.dll',
588
 
                        '${LCGDIR}/ffmpeg/lib/libgsm.dll',
589
 
                        '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
590
 
                        '${LCGDIR}/ffmpeg/lib/libogg-0.dll',
591
 
                        '${LCGDIR}/ffmpeg/lib/libvorbis-0.dll',
592
 
                        '${LCGDIR}/ffmpeg/lib/libvorbisenc-2.dll',
593
 
                        '${LCGDIR}/ffmpeg/lib/libx264-54.dll',
594
 
                        '${LCGDIR}/ffmpeg/lib/postproc-51.dll',
595
 
                        '${LCGDIR}/ffmpeg/lib/xvidcore.dll']
 
597
                        '${LCGDIR}/ffmpeg/lib/avutil-49.dll']
596
598
    windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
597
599
    allinstall += windlls
598
600