source: trunk/SConstruct@ 1158

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

fix for 64bit path replacement

File size: 3.9 KB
RevLine 
[1125]1import os
2import sys
[1082]3import distutils.sysconfig
4import platform
[1125]5# scons plug-ins
[1130]6#from installtree import InstallTree
[1082]7
[1125]8moduledir = distutils.sysconfig.get_python_lib()
[1136]9if platform.architecture()[0] == '64bit':
10 # hack to install into /usr/lib64 if scons is in the 32bit /usr/lib/
11 if moduledir.startswith("/usr/lib/"):
[1155]12 moduledir = moduledir.replace("lib", "lib64")
[1082]13
[1120]14opts = Options("userconfig.py")
[1130]15opts.AddOptions(PathOption("prefix",
16 "The root installation path",
17 distutils.sysconfig.PREFIX),
[1120]18 PathOption("moduledir",
19 "The python module path (site-packages))",
20 moduledir),
[1130]21 ("rpfitsdir", "Alternative rpfits location.", ""),
[1138]22 ("cfitsioincdir", "Alternative cfitsio include dir", ""),
[1135]23 ("casadir", "Alternative casa location", ""),
[1120]24 EnumOption("mode", "The type of build.", "debug",
[1135]25 ["release","debug"], ignorecase=1),
26 BoolOption("staticlink",
27 "Should extrenal libs be linked in statically",
28 False)
[1130]29 )
[1082]30
[1135]31env = Environment( toolpath = ['./scons'],
32 tools = ["default", "disttar", "installtree", "casa",
33 "utils"],
34 ENV = { 'PATH' : os.environ[ 'PATH' ],
[1120]35 'HOME' : os.environ[ 'HOME' ] },
[1135]36 options = opts)
[1082]37
[1120]38Help(opts.GenerateHelpText(env))
39env.SConsignFile()
[1135]40env.Append(CASAARCH = '', CASAROOT = '')
[1138]41if (os.path.exists(env["cfitsioincdir"])):
42 env.Append(CPPPATH=[env["cfitsioincdir"]])
43env.AddCustomPath(env["rpfitsdir"])
[1082]44if not env.GetOption('clean'):
[1130]45 conf = Configure(env)
46 # import Custom tests
[1135]47 env.AddCasaTest(conf)
[1130]48 pylib = 'python'+distutils.sysconfig.get_python_version()
49 pyinc = "Python.h"
50 if env['PLATFORM'] == "darwin":
51 pylib = "Python"
52 if not conf.CheckLib(library=pylib, language='c'): Exit(1)
53 conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()])
54 if not conf.CheckHeader("Python.h", language='c'):
55 Exit(1)
56 if not conf.CheckLibWithHeader('boost_python', 'boost/python.hpp', 'c++'): Exit(1)
57 conf.env.AddCustomPath(env["rpfitsdir"])
[1090]58 if not conf.CheckLib('rpfits'): Exit(1)
[1138]59 # cfitsio is either in include/ or /include/cfitsio
60 # handle this
61 if not conf.CheckLib(library='cfitsio', language='c'): Exit(1)
62 if not conf.CheckHeader('fitsio.h', language='c'):
63 if not conf.CheckHeader('cfitsio/fitsio.h', language='c'):
64 Exit(1)
65 else:
66 conf.env.Append(CPPPATH=['/usr/include/cfitsio'])
[1130]67 if (sys.platform == "darwin"):
68 conf.env.Append(LIBS = ['-framework vecLib'])
69 else:
70 if not conf.CheckLib('lapack'): Exit(1)
71 if not conf.CheckLib('blas'): Exit(1)
[1105]72 if not conf.CheckLib('g2c'): Exit(1)
[1130]73 if not conf.CheckLib('stdc++', language='c++'): Exit(1)
[1127]74 if not conf.CheckCasa(env["casadir"]): Exit(1)
[1082]75 env = conf.Finish()
[1120]76
[1135]77env["stage_dir"] = Dir("#/stage/asap")
78
[1090]79# general CPPFLAGS
[1135]80env.Append(CPPFLAGS=['-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-O3'])
[1136]81
[1090]82# 64bit flags
[1082]83if platform.architecture()[0] == '64bit':
[1135]84 env.Append(CPPFLAGS=['-fPIC', '-D__x86_64__', '-DAIPS_64B'])
[1136]85
[1135]86if env["PLATFORM"] == "darwin":
87 env['SHLINKFLAGS'] = '$LINKFLAGS -bundle'
88 #env['SHLIBSUFFIX'] = '.dylib'
[1130]89
[1120]90if env['mode'] == 'release':
91 env.Append(LINKFLAGS=['-Wl,-O1'])
[1135]92Export("env")
[1082]93
94so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
[1135]95env.Install(env["stage_dir"], so )
[1120]96
97pys = env.SConscript("python/SConscript")
[1130]98asapmod = env.InstallTree(dest_dir = os.path.join(env["moduledir"], "asap"),
[1135]99 src_dir = "stage/asap",
100 includes = ['*.py', '*.so'],
101 excludes = [])
[1130]102asapbin = env.Install(os.path.join(env["prefix"], "bin"), "bin/asap")
[1127]103env.Alias('install', [asapmod, asapbin])
Note: See TracBrowser for help on using the repository browser.