Add stage_dir config option
This option stages "installed" files in a local directory which can then be used to generate installation packages while $prefix still references the final installed location.
This commit is contained in:
parent
ccaf3f5e08
commit
4b114f020e
9 changed files with 69 additions and 41 deletions
|
|
@ -9,12 +9,12 @@ if localenv['OS'] == 'Windows':
|
|||
source=mglob(localenv, 'src', 'cpp'),
|
||||
LIBS=env['cantera_libs'])
|
||||
env['clib_shared'] = lib
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
inst = localenv.Install('$inst_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
else:
|
||||
static_lib = localenv.Library(pjoin('../../lib', 'clib'),
|
||||
source=mglob(localenv, 'src', 'cpp'))
|
||||
inst_static = localenv.Install('$ct_libdir', static_lib)
|
||||
inst_static = localenv.Install('$inst_libdir', static_lib)
|
||||
buildTargets.extend(static_lib)
|
||||
installTargets.extend(inst_static)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ localenv = env.Clone()
|
|||
|
||||
lib = localenv.Library(pjoin('../../lib', 'ctcxx'),
|
||||
source=mglob(localenv, 'src', 'cpp'))
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
inst = localenv.Install('$inst_libdir', lib)
|
||||
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
|
@ -29,7 +29,7 @@ for subdir, name, extensions in demos:
|
|||
LIBS=env['cantera_libs'])
|
||||
demoTargets.extend(prog)
|
||||
|
||||
inst = localenv.Install(pjoin('$ct_demodir', 'cxx', subdir),
|
||||
inst = localenv.Install(pjoin('$inst_demodir', 'cxx', subdir),
|
||||
mglob(localenv, pjoin('demos', subdir),
|
||||
'csv','txt','cpp','h','^runtest'))
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ objs = [o for o in artifacts if not o.path.endswith('.mod')]
|
|||
lib = localenv.Library(target=pjoin('..','..','lib','fct'),
|
||||
source=objs)
|
||||
buildTargets.extend(lib)
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
inst = localenv.Install('$inst_libdir', lib)
|
||||
installTargets.extend(inst)
|
||||
|
||||
installTargets.extend(localenv.Install('$ct_incdir', mods))
|
||||
installTargets.extend(localenv.Install('$inst_incdir', mods))
|
||||
|
||||
# Copy the mod files to the include directory
|
||||
for mod in mods:
|
||||
|
|
@ -38,7 +38,7 @@ for subdir, name, extensions in demos:
|
|||
LINK='$F77')
|
||||
demoTargets.extend(prog)
|
||||
|
||||
inst = localenv.Install(pjoin('$ct_demodir', 'f77'),
|
||||
inst = localenv.Install(pjoin('$inst_demodir', 'f77'),
|
||||
mglob(localenv, 'f77demos',
|
||||
'csv','txt','cpp','f','^runtest'))
|
||||
|
||||
|
|
|
|||
|
|
@ -54,16 +54,15 @@ target = localenv.Command(mexFile,
|
|||
buildTargets.extend(target)
|
||||
|
||||
### Install the Matlab toolbox ###
|
||||
inst = localenv.RecursiveInstall(pjoin('$prefix', 'matlab','toolbox'), 'cantera')
|
||||
inst = localenv.RecursiveInstall('$inst_matlab_dir', 'cantera')
|
||||
installTargets.extend(inst)
|
||||
|
||||
inst = localenv.RecursiveInstall(pjoin('$ct_tutdir', 'matlab'), 'tutorial')
|
||||
inst = localenv.RecursiveInstall(pjoin('$inst_tutdir', 'matlab'), 'tutorial')
|
||||
installTargets.extend(inst)
|
||||
|
||||
inst = localenv.RecursiveInstall(pjoin('$ct_demodir', 'matlab'), 'examples')
|
||||
inst = localenv.RecursiveInstall(pjoin('$inst_demodir', 'matlab'), 'examples')
|
||||
installTargets.extend(inst)
|
||||
|
||||
if os.name == 'nt':
|
||||
inst = localenv.Install(pjoin('$prefix', 'matlab', 'toolbox'),
|
||||
localenv['clib_shared'])
|
||||
inst = localenv.Install('$inst_matlab_dir', localenv['clib_shared'])
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ installTargets.extend(inst)
|
|||
|
||||
if env['python_package'] == 'full':
|
||||
# Copy tutorials
|
||||
inst = localenv.Install('$ct_tutdir', mglob(localenv, 'tutorial', 'py'))
|
||||
inst = localenv.Install('$inst_tutdir', mglob(localenv, 'tutorial', 'py'))
|
||||
installTargets.extend(inst)
|
||||
|
||||
# Copy examples
|
||||
|
|
@ -61,4 +61,4 @@ if env['python_package'] == 'full':
|
|||
for name in ['runtest', 'cleanup', '*.txt', '*.py', '*.csv']], [])
|
||||
for f in exampleFiles:
|
||||
subdir1, subdir2 = psplit(f.path)[3:5]
|
||||
installTargets.extend(localenv.Install(pjoin('$ct_demodir','python',subdir1,subdir2), f))
|
||||
installTargets.extend(localenv.Install(pjoin('$inst_demodir','python',subdir1,subdir2), f))
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ for subdir, libname, extensions, setup in libs:
|
|||
h = localenv.Command('../include/cantera/kernel/%s' % header.name, header,
|
||||
Copy('$TARGET', '$SOURCE'))
|
||||
buildTargets.extend(h)
|
||||
inst = localenv.Install(pjoin('$ct_incdir', 'kernel'), h)
|
||||
inst = localenv.Install(pjoin('$inst_incdir', 'kernel'), h)
|
||||
installTargets.extend(inst)
|
||||
|
||||
lib = localenv.Library(pjoin('../lib', libname),
|
||||
source=source)
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
inst = localenv.Install('$inst_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
57
SConstruct
57
SConstruct
|
|
@ -379,14 +379,24 @@ opts.AddVariables(
|
|||
flags must be set to produce object code compatible with the
|
||||
C/C++ compiler you are using.""",
|
||||
'-O3'),
|
||||
PathVariable('graphvisdir',
|
||||
"""The directory location of the graphviz program, dot. dot is
|
||||
used for creating the documentation, and for making reaction
|
||||
path diagrams. If "dot" is in your path, you can leave this
|
||||
unspecified. NOTE: Matlab comes with a stripped-down version
|
||||
of 'dot'. If 'dot' is on your path, make sure it is not the
|
||||
Matlab version!""",
|
||||
'', PathVariable.PathAccept),
|
||||
PathVariable(
|
||||
'stage_dir',
|
||||
""" Directory relative to the Cantera source directory to be
|
||||
used as a staging area for building e.g. a Debian
|
||||
package. If specified, 'scons install' will install files
|
||||
to 'stage_dir/prefix/...' instead of installing into the
|
||||
local filesystem.""",
|
||||
'',
|
||||
PathVariable.PathAccept),
|
||||
PathVariable(
|
||||
'graphvisdir',
|
||||
"""The directory location of the graphviz program, dot. dot is
|
||||
used for creating the documentation, and for making
|
||||
reaction path diagrams. If "dot" is in your path, you can
|
||||
leave this unspecified. NOTE: Matlab comes with a
|
||||
stripped-down version of 'dot'. If 'dot' is on your path,
|
||||
make sure it is not the Matlab version!""",
|
||||
'', PathVariable.PathAccept),
|
||||
('ct_shared_lib',
|
||||
'',
|
||||
'clib'),
|
||||
|
|
@ -582,6 +592,9 @@ if env['blas_lapack_libs'] == '':
|
|||
else:
|
||||
ens['blas_lapack_libs'] = ','.split(env['blas_lapack_libs'])
|
||||
|
||||
# Directories where things will be after actually being installed
|
||||
# These variables are the ones that are used to populate header files,
|
||||
# scripts, etc.
|
||||
env['ct_libdir'] = pjoin(env['prefix'], 'lib')
|
||||
env['ct_bindir'] = pjoin(env['prefix'], 'bin')
|
||||
env['ct_incdir'] = pjoin(env['prefix'], 'include', 'cantera')
|
||||
|
|
@ -593,6 +606,25 @@ env['ct_tutdir'] = pjoin(env['prefix'], 'tutorials')
|
|||
env['ct_mandir'] = pjoin(env['prefix'], 'man1')
|
||||
env['ct_matlab_dir'] = pjoin(env['prefix'], 'matlab', 'toolbox')
|
||||
|
||||
# Directories where things will be staged for package creation. These
|
||||
# variables should always be used by the Install(...) targets
|
||||
if env['stage_dir']:
|
||||
instRoot = pjoin(os.getcwd(), env['stage_dir'], env['prefix'].strip('/'))
|
||||
env['python_prefix'] = instRoot
|
||||
else:
|
||||
instRoot = env['prefix']
|
||||
|
||||
env['inst_libdir'] = pjoin(instRoot, 'lib')
|
||||
env['inst_bindir'] = pjoin(instRoot, 'bin')
|
||||
env['inst_incdir'] = pjoin(instRoot, 'include', 'cantera')
|
||||
env['inst_incroot'] = pjoin(instRoot, 'include')
|
||||
env['inst_datadir'] = pjoin(instRoot, 'data')
|
||||
env['inst_demodir'] = pjoin(instRoot, 'demos')
|
||||
env['inst_templdir'] = pjoin(instRoot, 'templates')
|
||||
env['inst_tutdir'] = pjoin(instRoot, 'tutorials')
|
||||
env['inst_mandir'] = pjoin(instRoot, 'man1')
|
||||
env['inst_matlab_dir'] = pjoin(instRoot, 'matlab', 'toolbox')
|
||||
|
||||
env['CXXFLAGS'] = listify(env['cxx_flags'])
|
||||
if env['optimize']:
|
||||
env['CCFLAGS'] = listify(env['cc_flags']) + listify(env['release_flags'])
|
||||
|
|
@ -697,14 +729,14 @@ for header in mglob(env, 'Cantera/cxx/include', 'h'):
|
|||
header = env.Command('build/include/cantera/%s' % header.name, header,
|
||||
Copy('$TARGET', '$SOURCE'))
|
||||
buildTargets.extend(header)
|
||||
inst = env.Install('$ct_incdir', header)
|
||||
inst = env.Install('$inst_incdir', header)
|
||||
installTargets.extend(inst)
|
||||
|
||||
for header in mglob(env, 'Cantera/clib/src', 'h'):
|
||||
hcopy = env.Command('build/include/cantera/clib/%s' % header.name, header,
|
||||
Copy('$TARGET', '$SOURCE'))
|
||||
buildTargets.append(header)
|
||||
inst = env.Install(pjoin('$ct_incdir','clib'), header)
|
||||
inst = env.Install(pjoin('$inst_incdir','clib'), header)
|
||||
installTargets.extend(inst)
|
||||
|
||||
### List of libraries needed to link to Cantera ###
|
||||
|
|
@ -726,9 +758,6 @@ else:
|
|||
|
||||
env['cantera_libs'] = linkLibs
|
||||
|
||||
#inst = env.Install('$ct_incdir/kernel', 'build/include/cantera/kernel/config.h')
|
||||
#installTargets.extend(inst)
|
||||
|
||||
# Add targets from the SConscript files in the various subdirectories
|
||||
Export('env', 'buildDir', 'buildTargets', 'installTargets', 'demoTargets')
|
||||
|
||||
|
|
@ -758,7 +787,7 @@ VariantDir('build/tools', 'tools', duplicate=0)
|
|||
SConscript('build/tools/SConscript')
|
||||
|
||||
# Data files
|
||||
inst = env.Install('$ct_datadir', mglob(env, pjoin('data','inputs'), 'cti', 'xml'))
|
||||
inst = env.Install('$inst_datadir', mglob(env, pjoin('data','inputs'), 'cti', 'xml'))
|
||||
installTargets.extend(inst)
|
||||
|
||||
### Meta-targets ###
|
||||
|
|
|
|||
|
|
@ -51,6 +51,6 @@ if env['use_sundials'] == 'n':
|
|||
for subdir, libname, extensions in libs:
|
||||
lib = localenv.Library(pjoin('../lib', libname),
|
||||
source=mglob(localenv, subdir, *extensions))
|
||||
inst = localenv.Install('$ct_libdir', lib)
|
||||
inst = localenv.Install('$inst_libdir', lib)
|
||||
buildTargets.extend(lib)
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
|
|
@ -11,21 +11,21 @@ for name, src, libs in programs:
|
|||
prog = localenv.Program(target=pjoin('..', 'bin', name),
|
||||
source=src,
|
||||
LIBS=libs)
|
||||
inst = localenv.Install('$ct_bindir', prog)
|
||||
inst = localenv.Install('$inst_bindir', prog)
|
||||
buildTargets.extend(prog)
|
||||
installTargets.extend(inst)
|
||||
|
||||
# Copy application templates
|
||||
installTargets.extend(
|
||||
localenv.Install(pjoin('$ct_templdir','cxx'),
|
||||
localenv.Install(pjoin('$inst_templdir','cxx'),
|
||||
mglob(localenv, pjoin('templates','cxx'), '*')) +
|
||||
localenv.Install(pjoin('$ct_templdir','f90'),
|
||||
localenv.Install(pjoin('$inst_templdir','f90'),
|
||||
mglob(localenv, pjoin('templates','f90'), '*')) +
|
||||
localenv.Install(pjoin('$ct_templdir','f77'),
|
||||
localenv.Install(pjoin('$inst_templdir','f77'),
|
||||
mglob(localenv, pjoin('templates','f77'), '*')))
|
||||
|
||||
# Copy man pages
|
||||
inst = localenv.Install('$ct_mandir', mglob(localenv, 'man', '*'))
|
||||
inst = localenv.Install('$inst_mandir', mglob(localenv, 'man', '*'))
|
||||
installTargets.extend(inst)
|
||||
|
||||
### Generate customized scripts ###
|
||||
|
|
@ -35,21 +35,21 @@ v = sys.version_info
|
|||
localenv['python_module_loc'] = pjoin(localenv['prefix'], 'lib', 'python%i.%i' % v[:2], 'site-packages')
|
||||
target = localenv.SubstFile('setup_cantera', 'setup_cantera.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$ct_bindir','setup_cantera')
|
||||
inst = localenv.Install('$inst_bindir','setup_cantera')
|
||||
installTargets.append(inst)
|
||||
|
||||
# 'mixmaster'
|
||||
if env['python_package'] == 'full':
|
||||
target = localenv.SubstFile('mixmaster', 'mixmaster.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$ct_bindir', 'mixmaster')
|
||||
inst = localenv.Install('$inst_bindir', 'mixmaster')
|
||||
localenv.AddPostAction(inst, Chmod('$TARGET', 0755))
|
||||
installTargets.extend(inst)
|
||||
|
||||
# 'ctnew'
|
||||
target = localenv.SubstFile('ctnew', 'ctnew.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install('$ct_bindir', 'ctnew')
|
||||
inst = localenv.Install('$inst_bindir', 'ctnew')
|
||||
localenv.AddPostAction(inst, Chmod('$TARGET', 0755))
|
||||
installTargets.extend(inst)
|
||||
|
||||
|
|
@ -57,8 +57,8 @@ installTargets.extend(inst)
|
|||
if env['matlab_toolbox'] == 'y':
|
||||
target = localenv.SubstFile('ctpath.m', 'ctpath.m.in')
|
||||
buildTargets.extend(target)
|
||||
inst = localenv.Install(pjoin('$prefix','matlab'), target)
|
||||
inst = localenv.Install('$inst_matlab_dir', target)
|
||||
installTargets.extend(inst)
|
||||
|
||||
inst = localenv.Install(pjoin('$prefix','matlab'), 'cantera_demos.m')
|
||||
inst = localenv.Install('$inst_matlab_dir', 'cantera_demos.m')
|
||||
installTargets.extend(inst)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue