Changeset 2503 for trunk/SConstruct
- Timestamp:
- 05/14/12 11:56:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SConstruct
r2501 r2503 22 22 return "" 23 23 24 def get_moduledir(prefix="/usr/local"):25 moduledir = distutils.sysconfig.get_python_lib(1,0, prefix)26 if sys.platform.startswith('linux') \27 and platform.architecture()[0] == '64bit' \28 and platform.dist()[0].lower() not in ['debian', 'ubuntu']:29 # hack to install into /usr/lib64 if scons is in the 32bit /usr/lib/30 if moduledir.startswith("/usr"):31 moduledir = moduledir.replace("lib", "lib64")32 return moduledir33 34 24 EnsureSConsVersion(1,0,0) 35 25 36 opts = Variables("options.c fg")26 opts = Variables("options.cache") 37 27 opts.AddVariables( 38 28 ("FORTRAN", "The fortran compiler", None), 39 29 ("f2clib", "The fortran to c library", None), 40 PathVariable("prefix",41 "The root installation path",42 distutils.sysconfig.PREFIX),43 ("moduledir",44 "The python module path (site-packages))",45 None),46 30 PathVariable("casacoreroot", "The location of casacore", 47 31 "/usr/local"), … … 76 60 "The root directory where rpfits is installed", None), 77 61 ("rpfitslibdir", "The rpfits library location", None), 62 78 63 ("pyraproot", "The root directory where libpyrap is installed", 79 64 None), 80 65 ("numpyincdir", "numpy header file directory", 81 66 get_numpy_incdir()), 67 BoolVariable("enable_pyrap", 68 "Use pyrap conversion library from system", 69 False), 82 70 ("pyraplib", "The name of the pyrap library", "pyrap"), 83 71 ("pyraplibdir", "The directory where libpyrap is installed", … … 85 73 ("pyrapincdir", "The pyrap include location", 86 74 None), 87 BoolVariable("enable_pyrap", "Use pyrap conversion library",88 False),89 90 75 EnumVariable("mode", "The type of build.", "release", 91 76 ["release","debug"], ignorecase=1), 92 EnumVariable("makedoc", "Build the userguide in specified format", 93 "none", 94 ["none", "pdf", "html"], ignorecase=1), 77 EnumVariable("makedoc", 78 "Build the userguide in specified format", 79 "none", 80 ["none", "pdf", "html"], ignorecase=1), 95 81 BoolVariable("apps", "Build cpp apps", True), 96 82 BoolVariable("alma", "Enable alma specific functionality", … … 99 85 100 86 env = Environment( toolpath = ['./scons'], 101 tools = ["default", " archiver", "utils",102 " quietinstall", "casaoptions", "casa"],87 tools = ["default", "utils", 88 "casaoptions", "casa"], 103 89 ENV = { 'PATH' : os.environ[ 'PATH' ], 104 90 'HOME' : os.environ[ 'HOME' ] }, 105 91 options = opts) 106 92 107 Help(opts.GenerateHelpText(env))93 env.Help(opts.GenerateHelpText(env)) 108 94 env.SConsignFile() 109 110 if not env.GetOption('clean'): 95 if not ( env.GetOption('clean') or env.GetOption('help') ): 96 111 97 conf = Configure(env) 112 98 … … 135 121 Exit(1) 136 122 137 # conf.env.AddCustomPackage('pyrap') 138 if False and conf.CheckLib(conf.env["pyraplib"], language='c++', autoadd=0): 139 conf.env.Append(CPPFLAGS=['-DHAVE_LIBPYRAP']) 140 # conf.env.PrependUnique(LIBS=env['pyraplib']) 123 if env["enable_pyrap"]: 124 conf.env.AddCustomPackage('pyrap') 125 if conf.CheckLib(conf.env["pyraplib"], language='c++', autoadd=0): 126 conf.env.PrependUnique(LIBS=env['pyraplib']) 127 else: 128 Exit(1) 141 129 else: 142 130 conf.env.AppendUnique(CPPPATH=[conf.env["numpyincdir"]]) 143 131 # numpy 1.0 uses config.h; numpy >= 1.1 uses numpyconfig.h 144 if conf.CheckHeader("numpy/config.h") or \ 145 conf.CheckHeader("numpy/numpyconfig.h"): 132 if conf.CheckHeader("numpy/numpyconfig.h"): 146 133 conf.env.Append(CPPDEFINES=["-DAIPS_USENUMPY"]) 147 134 else: 148 135 conf.env.Exit(1) 149 conf.env.Append(CPPFLAGS=['-DHAVE_LIBPYRAP']) 150 # compile in pyrap here... 136 # compile in pyrap from here... 151 137 conf.env["pyrapint"] = "#/external/libpyrap/pyrap-0.3.2" 138 conf.env.Append(CPPFLAGS=['-DHAVE_LIBPYRAP']) 139 152 140 # test for cfitsio 153 141 if not conf.CheckLib("m"): Exit(1) … … 175 163 if conf.env["alma"]: 176 164 conf.env.Append(CPPFLAGS=['-DUSE_CASAPY']) 177 if not conf.env.get("moduledir"):178 mdir = get_moduledir(conf.env.get("prefix"))179 if env["PLATFORM"] == "darwin":180 mdir = distutils.sysconfig.get_python_lib(1,0)181 conf.env["moduledir"] = mdir182 165 env = conf.Finish() 166 167 opts.Save('options.cache', env) 183 168 184 169 env["version"] = "4.1.x" … … 195 180 196 181 # build externals 197 env.SConscript("external-alma/SConscript") 182 ext = env.SConscript("external-alma/SConscript") 183 198 184 # build library 199 185 so = env.SConscript("src/SConscript", variant_dir="build", duplicate=0) 186 187 apps = env.SConscript("apps/SConscript") 188 200 189 # test module import, to see if there are unresolved symbols 201 190 def test_module(target,source,env): … … 206 195 print "ok" 207 196 return 0 197 208 198 def test_str(target, source, env): 209 199 return "Testing module..." … … 212 202 env.AddPostAction(so, taction) 213 203 214 # Need this to make makedist work215 dummy = env.Install()216 env.Alias('install', dummy)217 218 # make binary distribution219 env["stagedir"] = "asap-%s" % (env["version"])220 env.Command('Staging distribution for archive in %s' % env["stagedir"],221 '', env.MessageAction)222 env.QInstall("$stagedir/asap", [so, env.SGlob("python/*.py")] )223 env.QInstall("$stagedir/bin", ["bin/asap", "bin/asap_update_data"])224 env.QInstall("$stagedir", ["packaging/setup.py"])225 env.QInstall("$stagedir/debian", env.SGlob("packaging/debian/*") )226 227 if env["apps"]:228 env.SConscript("apps/SConscript")229 230 204 if env.GetOption("clean"): 231 205 Execute(Delete(".sconf_temp")) 206 Execute(Delete("options.cache")) 232 207 233 208 if env["makedoc"].lower() != "none":
Note:
See TracChangeset
for help on using the changeset viewer.