Source
b.do("", "scons -j ", threads, " --extra-root=", prefix, "/../", third, " --prefix=", prefix, "/", builddir, " --extra-cppflags=\"-g -DCASA_USECASAPATH -DCASACORE_NEEDS_RETHROW -DCASACORE_NOEXIT -DCASA_NOTAPE -fopenmp\" --data-dir=", prefix, "/../data --wcs-root=", prefix, "/../", third, " --cfitsio-libdir=", prefix, "/../", third, "/lib --cfitsio-incdir=", prefix, "/../", third, "/include --fftw3-root=", prefix, "/../", third, " --extra-linkflags=\"-headerpad_max_install_names -arch x86_64\" --extra-fflags=\"-g -arch x86_64\" --extra-libs=\"-lfftw3f_threads -lfftw3_threads -lfftw3f -lfftw3 -lgomp\" --enable-shared --disable-static install")
#!/usr/bin/python
#
# Usage: build.py URL REVISION TYPE [dry]
#
# This script builds CASA and creates documentation of the build procedure.
#
# The documentation is written to $HOME/documentation/
#
# Possible values for TYPE are full/incremental/test.
#
# Examples:
# Build from scratch and generate documentation:
#
# $ build.py https://svn.cv.nrao.edu/svn/casa/active 10809 full
#
# Dry run, just generate the documentation:
#
# $ build.py https://svn.cv.nrao.edu/svn/casa/active 10809 full dry
#
#
# Supported platforms: RH5.3 32bit, RH5.3 64bit, OSX 10.5, 10.6
#
import subprocess
import time
import commands
import sys
import os
import string
# string that depends on OS
class platform:
def __init__(self, n, val):
self.value = val
self.name = n
# string that depends on concrete machine
class machine:
def __init__(self, n, val):
self.value = val
self.name = n
# Base class for build methods (documentation, execute)
class builder:
def __init__(self):
self.temp = False
def chdir(self, *texts):
self.do("", "cd ", *texts)
def set_env(self, env, *texts):
self.do("", "export ", env, '="', self._transform(texts), '"')
def svn_exe(self, repository, revision, local_dir):
# if os.uname()[0] == "Linux":
# os.system("sudo /sbin/route add default gw 192.168.158.2") # internet dies often...
if self.type == "full":
if not self.temp:
self.comment("svn might prompt you to accept a fingerprint; in that case answer t(emporarily). Or you can send a 't' to the standard input of svn")
self.temp = True
self.do("", "echo t | svn checkout -r %s %s %s" % (revision, repository, local_dir))
else:
self.do("", "echo t | svn update -r %s %s" % (revision, local_dir))
# Write sh script
class sh_builder(builder):
def __init__(self, file, type):
builder.__init__(self);
self.type = type
self.file = open(file, 'w')
# Do not write to the script immediately.
# First accumulate all commands and variable definitions,
# then finally (in __del__) write the variable definitons
# before the commands.
self.commands = []
self.definitions = {}
self.file.write("#!/bin/bash\n")
self.file.write("#\n")
self.file.write("# This Bourne Shell script does a " + type + " build of CASA. It was generated from the command\n")
self.file.write("#\n")
self.file.write("# " + string.join(sys.argv) + "\n")
self.file.write("#\n")
self.file.write("\n")
def __del__(self):
# Time to flush
# First define variables