Changeset 1184 for trunk/SConstruct


Ignore:
Timestamp:
08/25/06 16:34:59 (18 years ago)
Author:
mar637
Message:

complete rework of install target, added data install, and also building a distribution archive

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r1182 r1184  
    33import distutils.sysconfig
    44import platform
     5import SCons
    56# scons plug-ins
    67#from installtree import InstallTree
    78
    8 version = "2.1.0b"
    99moduledir = distutils.sysconfig.get_python_lib()
    1010if  platform.architecture()[0] == '64bit':
     
    3131
    3232env = Environment( toolpath = ['./scons'],
    33                    tools = ["default", "installtree", "casa",
    34                             "utils"],
     33                   tools = ["default", "casa", "archiver", "utils",
     34                            "quietinstall"],
    3535                   ENV = { 'PATH' : os.environ[ 'PATH' ],
    3636                          'HOME' : os.environ[ 'HOME' ] },
     
    7676    env = conf.Finish()
    7777
    78 env["stage_dir"] = Dir("#/stage/asap")
     78env["version"] = "2.1.0b"
    7979
    8080# general CPPFLAGS
     
    8585    env.Append(CPPFLAGS=['-fPIC', '-D__x86_64__', '-DAIPS_64B'])
    8686
    87 if env["PLATFORM"] == "darwin":
    88     env['SHLINKFLAGS'] = '$LINKFLAGS -bundle'
    89     #env['SHLIBSUFFIX'] = '.dylib'
    90 
    9187if env['mode'] == 'release':
    9288    env.Append(LINKFLAGS=['-Wl,-O1'])
     89
     90# Export for SConscript files
    9391Export("env")
    9492
     93# build library
    9594so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
    96 stagebuild = env.Install(env["stage_dir"], so )
    97 stagedoc = env.Install("stage", ["doc/README", "doc/CHANGELOG"] )
    98 stagepys = env.SConscript("python/SConscript")
    99 stage0 = env.Install("stage", "bin/install")
    100 stage1 = env.Install("stage/bin", ["bin/asap", "bin/asap_update_data"])
    101 stage2 = env.Install("stage/data", "share/ipythonrc-asap")
    102 env.Alias('stage', [stagebuild,stagedoc,stagepys, stage0, stage1, stage2])
    103 # install locally
    104 asapmod = env.InstallTree(dest_dir = os.path.join(env["moduledir"], "asap"),
    105                           src_dir  = "stage",
    106                           includes = ['asap','data'],
    107                           excludes = [])
    108 asapbin = env.Install(os.path.join(env["prefix"], "bin"), "bin/asap")
    109 env.Alias('install', [asapmod, asapbin])
     95
     96# install targets
     97somod = env.Install("$moduledir/asap", so )
     98pymods = env.Install("$moduledir/asap", env.SGlob("python/*.py"))
     99bins = env.Install("$prefix/bin", ["bin/asap", "bin/asap_update_data"])
     100shares = env.Install("$moduledir/data", "share/ipythonrc-asap")
     101env.Alias('install', [somod, pymods, bins, shares])
     102
     103# install aips++ data repos
     104rootdir=None
     105outdir =  os.path.join(env["moduledir"],'asap','data')
     106sources = ['ephemerides','geodetic']
     107if os.path.exists("/nfs/aips++/data"):
     108    rootdir = "/nfs/aips++/data"
     109elif os.path.exists("data"):
     110    rootdir = "data"
     111if rootdir is not None:
     112    ofiles, ifiles = env.WalkDirTree(outdir, rootdir, sources)
     113    data =  env.InstallAs(ofiles, ifiles)
     114    env.Alias('install', data)
     115   
    110116# make binary distribution
    111117if len(env["makedist"]):
    112     md =env.CreateDist("dist/asap-%s-%s" % (version, env["makedist"]),
    113                    ["install", "README", "CHANGELOG", "asap", "data",
    114                     "bin"],
    115                    "stage")
     118    env["stagedir"] = "asap-%s-%s" % (env["version"], env["makedist"])
     119    env.Command('Staging distribution for archive in %s' % env["stagedir"],
     120                '', env.MessageAction)
     121    env.QInstall("$stagedir/asap", [so,  pymods] )
     122    env.QInstall("$stagedir/bin", ["bin/asap", "bin/asap_update_data"])
     123    env.QInstall("$stagedir/install", ["bin/install"])
     124    env.QInstall("$stagedir/data", "share/ipythonrc-asap")
     125    if os.path.exists("/nfs/aips++/data"):
     126        rootdir = "/nfs/aips++/data"
     127        sources = ['ephemerides','geodetic']
     128        outdir =  os.path.join(env["stagedir"],'asap','data')
     129        ofiles, ifiles = env.WalkDirTree(outdir, rootdir, sources)
     130        env.QInstallAs(ofiles, ifiles)
     131    arch = env.Archiver(os.path.join("dist",env["stagedir"]),
     132                        env["stagedir"])
     133    env.AddPostAction(arch, Delete("$stagedir"))
     134   
Note: See TracChangeset for help on using the changeset viewer.