source: trunk/SConstruct@ 1128

Last change on this file since 1128 was 1128, checked in by mar637, 18 years ago

more fixes to 64bit install

File size: 3.2 KB
RevLine 
[1125]1import os
2import sys
3import glob
[1082]4import distutils.sysconfig
5import platform
[1125]6# scons plug-ins
[1120]7sys.path.append("scons")
8from casa import checkCasa
[1125]9from installtree import InstallTree
[1082]10
[1125]11moduledir = distutils.sysconfig.get_python_lib()
[1082]12
[1120]13opts = Options("userconfig.py")
14opts.AddOptions(PathOption("prefix", "The root installation path",
15 distutils.sysconfig.PREFIX),
16 PathOption("moduledir",
17 "The python module path (site-packages))",
18 moduledir),
[1127]19 ("casadir", "Where casa lives. Default is to autodetect", ""),
[1120]20 EnumOption("mode", "The type of build.", "debug",
21 ["release","debug"], ignorecase=1))
[1082]22
[1105]23def SGlob(pattern):
24 path = GetBuildPath('SConscript').replace('SConscript', '')
25 return [ i.replace(path, '') for i in glob.glob(path + pattern) ]
26
27
[1120]28env = Environment( toolpath = ['./scons'], tools = ["default", "disttar"],
29 ENV = { 'PATH' : os.environ[ 'PATH' ],
30 'HOME' : os.environ[ 'HOME' ] },
31 options = opts)
[1082]32
[1120]33Help(opts.GenerateHelpText(env))
34env.SConsignFile()
[1082]35env.Append(CASAARCH = '')
36env.Append(CASAROOT = '')
37if not env.GetOption('clean'):
38 conf = Configure(env,custom_tests = {'CheckCasa': checkCasa} )
39 pyvers = 'python'+distutils.sysconfig.get_python_version()
40 if not conf.CheckLib(library=pyvers, language='c'): Exit(1)
41 if not conf.CheckHeader(pyvers+'/Python.h', language='c'): Exit(1)
42 else: conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()])
[1090]43 if not conf.CheckHeader(['boost/python.hpp'], language="C++"): Exit(1)
[1082]44 if not conf.CheckLib(library='boost_python', language='c++'): Exit(1)
[1090]45 if not conf.CheckLib('rpfits'): Exit(1)
[1120]46 if not conf.CheckHeader('cfitsio/fitsio.h', language='c++'): Exit(1)
[1090]47 if not conf.CheckLib('cfitsio'): Exit(1)
48 if not conf.CheckLib('lapack'): Exit(1)
49 if not conf.CheckLib('blas'): Exit(1)
[1105]50 if not conf.CheckLib('g2c'): Exit(1)
[1090]51 if not conf.CheckLib('stdc++',language='c++'): Exit(1)
[1127]52 if not conf.CheckCasa(env["casadir"]): Exit(1)
[1082]53 env = conf.Finish()
[1120]54
55env["dist_dir"] = "dist/asap"
[1090]56# general CPPFLAGS
[1082]57env.Append(CPPFLAGS='-O3 -Wno-long-long'.split())
[1090]58# 64bit flags
[1082]59if platform.architecture()[0] == '64bit':
[1123]60 env.Append(CPPFLAGS='-fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B'.split())
[1128]61 # hack to install into /usr/lib64 if scons isn't installed there
62 if moduledir.startswith("/usr/lib/"):
63 moduledir.replace("lib","lib64")
[1120]64if env['mode'] == 'release':
65 env.Append(LINKFLAGS=['-Wl,-O1'])
66Export("env","SGlob")
[1082]67
68so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
[1120]69
70env.Install(env["dist_dir"], so )
71pys = env.SConscript("python/SConscript")
[1125]72asapmod = InstallTree(env,
73 dest_dir = os.path.join(moduledir, "asap"),
[1128]74 src_dir = "dist/asap",
[1125]75 includes = ['*.py', '*.so'],
76 excludes = [])
[1127]77asapbin = env.Install(os.path.join(distutils.sysconfig.PREFIX, "bin"),"bin/asap")
78env.Alias('install', [asapmod, asapbin])
[1120]79
80#if env['mode'] == "release":
81# env.DistTar("dist/asap", ["README", "INSTALL", Dir(env["dist_dir"])])
Note: See TracBrowser for help on using the repository browser.