Esempio n. 1
0
    def __init__(self, silent=True, autobuild=False):
        ## The ASKAP top-level directory
        self.ASKAPROOT = os.environ.get("ASKAP_ROOT")
        if self.ASKAPROOT is None:
            msg = "ASKAP_ROOT environment variable is not defined"
            raise BuildError(msg)
        #
        self.DEPFILE = "dependencies"  # The basename of the dependency file
        self.INSTALL_SUBDIR = "install"
        self._deps = OrderedDict()
        #
        self._bindirs = []
        self._incdirs = []
        self._libdirs = []
        self._rootdirs = []
        #
        self._cppflags = []  # XXX "defs" in package.info. LOFAR/log4cxx
        #
        self._env = []
        self._jars = []
        self._libs = []
        self._packages = []
        #
        self._ldlibpath = ""
        self._pypath = ""
        #
        self._autobuild = autobuild
        self._silent = silent  # mimimal output
        self.selfupdate = False  # should object request updates from svn

        self._codename = utils.get_platform()['codename']
        self._system = utils.get_platform()['system'].lower()
        self._hostname = socket.gethostname().split(".")[0]
Esempio n. 2
0
    def _get_dependencies(self, package):
        codename = utils.get_platform()['codename']
        hostname = socket.gethostname().split(".")[0]

        for ext in ['default', codename, hostname]:
            if ext:
                depfile = '%s.%s' % (self.DEPFILE, ext)
                if package:
                    depfile = os.path.join(self.ASKAPROOT, package, depfile)
                if self.selfupdate:
                    # always update if it is the "root/target" package
                    basedir = os.path.split(depfile)[0] or "."
                    if not os.path.exists(basedir):
                        utils.update_tree(basedir)
                self._get_depfile(depfile)
Esempio n. 3
0
    def _get_dependencies(self, package):
        codename = utils.get_platform()['codename']
        hostname = socket.gethostname().split(".")[0]

        for ext in ['default', codename, hostname]:
            if ext:
                depfile = '%s.%s' % (self.DEPFILE, ext)
                if package:
                    depfile = os.path.join(self.ASKAPROOT, package, depfile)
                if self.selfupdate:
                    # always update if it is the "root/target" package
                    basedir = os.path.split(depfile)[0] or "."
                    if not os.path.exists(basedir):
                        utils.update_tree(basedir)
                self._get_depfile(depfile)
Esempio n. 4
0
    def _add_patches(self):
        p = utils.get_platform()
        top = 'files'
        self.add_patches_from_dir(top)

        d = top
        for k in ['architecture']:
            if p[k] != '':
                d = os.path.join(d, p[k])
                self.add_patches_from_dir(d)

        d = top
        for k in ['system', 'distribution', 'version', 'architecture']:
            if p[k] != '':
                d = os.path.join(d, p[k])
                self.add_patches_from_dir(d)
Esempio n. 5
0
package_name = "Healpix_3.31"
path = "{0}/src/cxx".format(package_name)

builder = Builder(archivename="Healpix_3.31_2016Aug26.tar.gz",
                  pkgname=package_name,
                  buildsubdir="src/cxx",
                  installcommand=None)

# Select the HEALPix target. The configure script ignores all the standard
# variables such as LDFLAGS and CXXFLAGS, so selecting the target is the only
# reliable way to influence the compilation flags.  At Healpix 3.31, relevant
# targets are: auto, basic_gcc, generic_gcc, linux_icc, optimized_gcc, osx, and
# osx_icc
# For new versions, the src/cxx/config directory should be checked for available
# targets
platform = utils.get_platform()
target = "osx" if platform['system'] == 'Darwin' else "generic_gcc"
os.putenv("HEALPIX_TARGET", target)
builder.add_option("HEALPIX_TARGET={0}".format(target))


def run_autoconf():
    "HealPix requires autoconf prior to configure"
    subprocess.call("autoconf", cwd=path)


def install():
    """HealPix C++ makefile does not provide an install target.
    It also ignores the standard --prefix option to configure :(
    So we copy the files manually, getting the source directory from the
    build target."""
Esempio n. 6
0
import os

from askapdev.rbuild.builders import Autotools as Builder
import askapdev.rbuild.utils as utils

platform = utils.get_platform()

builder = Builder()
builder.remote_archive = "mpe2-mpich2-1.5.tar.gz"

# Use MPI compiler wrapper (except on Cray where cc and c++ are wrappers)
if not os.environ.has_key("CRAYOS_VERSION"):
    builder.add_option("MPI_CC=mpicc")
    builder.add_option("MPI_F77=mpif77")

# MacOSX MPI is not necessarily built with f77 support,
# and on Linux we use gfortran
if platform['system'] == 'Darwin':
    builder.add_option("--disable-f77")
    java_home = os.getenv('JAVA_HOME')
    if java_home:
        builder.add_option("--with-java=%s" % java_home)
elif os.environ.has_key("CRAYOS_VERSION"):
    builder.add_option("F77=ftn")
else:
    builder.add_option("F77=gfortran")

builder.add_option("--disable-checkMPI")
builder.add_option("--disable-graphics")
builder.add_option("--disable-wrappers")
builder.add_option("--disable-collchk")
Esempio n. 7
0
    def __init__(self,
                 pkgname=None,
                 archivename=None,
                 extractdir=None,
                 buildsubdir=None,
                 buildcommand=None,
                 buildtargets=[],
                 confcommand=None,
                 installcommand=None,
                 options=sys.argv[1:]):
        '''
        The constructor sets up a package build "environment"

        :param pkgname:        The (optional) name of the package directory.
                               By default the current directory name is used.
        :param archivename:    The (optional) archive name minus suffix.
                               The default is based on package name.
        :param extractdir:     The (optional) directory into which the archive
                               is extracted. It is created if it does not exist.
        :param buildsubdir:    The (optional) directory in which to start the
                               build.
        :param buildtargets:   The (optional) additional build targets.
        :param buildcommand:   The (optional) build command.
                               The default is 'None'.
        :param installcommand: The (optional) install command.
                               The default is 'None'.
        :param confcommand:    The command to configure the package.
                               the default is 'None'.
                               Otherwise the default is None.
        :param installcommand: The command to install the package.
                               The default is 'None'.
        :param options:        The default is 'sys.argv[1:]'.
        '''
        self._bdir = os.path.abspath(os.curdir)
        self._package = pkgname or os.path.basename(self._bdir)
        self._tarname = None
        self._archive_name = archivename
        self._extractdir = extractdir
        if buildsubdir:
            self._builddir = os.path.join(self._package, buildsubdir)
        else:
            self._builddir = self._package
        self._bcom = buildcommand
        self._btargets = buildtargets
        self._ccom = confcommand
        self._icom = installcommand
        self._patches = []
        self._replacement_list = []
        self._askaproot = os.getenv('ASKAP_ROOT')
        self._infofile = 'package.info'
        self._installdir = "install"
        self._pkgsig = '.packagesig'
        self._prefix = os.path.join(self._bdir, self._installdir)
        self.parallel = True
        # filter out general builder options
        if "-noparallel" in options:
            options.remove("-noparallel")
            self.parallel = False

        # XXX stage_dir and release name is set in rbuild but define here
        # to allow for testing using:
        # python build.py [stage, release]
        self._releasename = 'release-%s' % utils.get_svn_revision()
        self._stagedir = os.path.join(self._askaproot, 'tmp',
                                      self._releasename)
        # Iterate backwards because we are changing options list.
        for i in range(len(options) - 1, -1, -1):
            if options[i].startswith('stage_dir'):
                self._stagedir = options[i].split('=')[1]
                options.pop(i)
            elif options[i].startswith('release_name'):
                self._releasename = options[i].split('=')[1]
                options.pop(i)

        self.create_signature = True
        self.version_string = ""
        self.remote_archive = None

        if utils.in_code_tree():
            self.create_signature = False
            self.version_string = utils.get_release_version()
        self._comopts = options
        self._opts = ""
        self._precallback = None
        self._postcallback = None
        self._files = []
        self._install_files = []
        self._clean_file = os.path.abspath(".clean_targets")
        self._clean_targets = self._load_clean_targets()
        self._buildfile = "build.py"  # XXX could be setup.py
        self.nowarnings = False  # enable or disable printing of warnings
        self._add_patches()
        self._platform = utils.get_platform()
        self._arch = self._platform['architecture']
        self._system = self._platform['system'].lower()
        self._hostname = self._platform['hostname'].lower()
        self._initscript_name = "init_package_env.sh"
        self.no_initscript = False
        self.add_extra_clean_targets(self._initscript_name)
        self.do_clean = True  # default is to clean before building.

        siglist = [self._buildfile] + utils.get_svn_files_list()
        self._siglist = list(set(siglist))

        self._init_dependencies()