def option(self, name, value):
        name = name[0]
        if not name in ["site-config", "user-config", "project-config"]:
            get_manager().errors()(
                "The 'option' rule may be used only in site-config or user-config")

        option.set(name, value[0])
Exemple #2
0
    def option(self, name, value):
        assert is_iterable(name) and isinstance(name[0], basestring)
        assert is_iterable(value) and isinstance(value[0], basestring)
        name = name[0]
        if not name in ["site-config", "user-config", "project-config"]:
            get_manager().errors()("The 'option' rule may be used only in site-config or user-config")

        option.set(name, value[0])
Exemple #3
0
def install_data(target_name, package_name, data, requirements):
    if not package_name:
        package_name = target_name

    if option.get("prefix"):
        # If --prefix is explicitly specified on the command line,
        # then we need wipe away any settings of datarootdir
        option.set("datarootdir", None)
    
    prefix = get_prefix(package_name, requirements)
    datadir = option.get("datarootdir", os.path.join(prefix, "share"))

    stage.install(target_name, data,
                  requirements + ["<location>" + os.path.join(datadir, package_name)])

    get_manager().projects().current().mark_targets_as_explicit([target_name])
Exemple #4
0
def install_data(target_name, package_name, data, requirements):
    if not package_name:
        package_name = target_name

    if option.get("prefix"):
        # If --prefix is explicitly specified on the command line,
        # then we need wipe away any settings of datarootdir
        option.set("datarootdir", None)

    prefix = get_prefix(package_name, requirements)
    datadir = option.get("datarootdir", os.path.join(prefix, "share"))

    stage.install(
        target_name, data,
        requirements + ["<location>" + os.path.join(datadir, package_name)])

    get_manager().projects().current().mark_targets_as_explicit([target_name])
Exemple #5
0
    def option(self, name, value):
        name = name[0]
        if not name in ["site-config", "user-config", "project-config"]:
            get_manager().errors()("The 'option' rule may be used only in site-config or user-config")

        option.set(name, value[0])
Exemple #6
0
def install(name, package_name=None, requirements=[], binaries=[], libraries=[], headers=[]):

    requirements = requirements[:]
    binaries = binaries[:]
    libraries

    if not package_name:
        package_name = name

    if option.get("prefix"):
        # If --prefix is explicitly specified on the command line,
        # then we need wipe away any settings of libdir/includir that
        # is specified via options in config files.
        option.set("bindir", None)
        option.set("libdir", None)
        option.set("includedir", None)
            
    # If <install-source-root> is not specified, all headers are installed to
    # prefix/include, no matter what their relative path is. Sometimes that is
    # what is needed.
    install_source_root = property.select('install-source-root', requirements)
    if install_source_root:
        requirements = property.change(requirements, 'install-source-root', None)
            
    install_header_subdir = property.select('install-header-subdir', requirements)
    if install_header_subdir:
        install_header_subdir = ungrist(install_header_subdir[0])
        requirements = property.change(requirements, 'install-header-subdir', None)

    # First, figure out all locations. Use the default if no prefix option
    # given.
    prefix = get_prefix(name, requirements)

    # Architecture dependent files.
    exec_locate = option.get("exec-prefix", prefix)

    # Binaries.
    bin_locate = option.get("bindir", os.path.join(prefix, "bin"))

    # Object code libraries.
    lib_locate = option.get("libdir", os.path.join(prefix, "lib"))

    # Source header files.
    include_locate = option.get("includedir", os.path.join(prefix, "include"))

    stage.install(name + "-bin", binaries, requirements + ["<location>" + bin_locate])
    
    alias(name + "-lib", [name + "-lib-shared", name + "-lib-static"])
    
    # Since the install location of shared libraries differs on universe
    # and cygwin, use target alternatives to make different targets.
    # We should have used indirection conditioanl requirements, but it's
    # awkward to pass bin-locate and lib-locate from there to another rule.
    alias(name + "-lib-shared", [name + "-lib-shared-universe"])
    alias(name + "-lib-shared", [name + "-lib-shared-cygwin"], ["<target-os>cygwin"])
    
    # For shared libraries, we install both explicitly specified one and the
    # shared libraries that the installed executables depend on.
    stage.install(name + "-lib-shared-universe", binaries + libraries,
                  requirements + ["<location>" + lib_locate, "<install-dependencies>on",
                                  "<install-type>SHARED_LIB"])
    stage.install(name + "-lib-shared-cygwin", binaries + libraries,
                  requirements + ["<location>" + bin_locate, "<install-dependencies>on",
                                  "<install-type>SHARED_LIB"])

    # For static libraries, we do not care about executable dependencies, since
    # static libraries are already incorporated into them.
    stage.install(name + "-lib-static", libraries, requirements +
                  ["<location>" + lib_locate, "<install-dependencies>on", "<install-type>STATIC_LIB"])
    stage.install(name + "-headers", headers, requirements \
                  + ["<location>" + os.path.join(include_locate, s) for s in install_header_subdir]
                  + install_source_root)

    alias(name, [name + "-bin", name + "-lib", name + "-headers"])

    pt = get_manager().projects().current()

    for subname in ["bin", "lib", "headers", "lib-shared", "lib-static", "lib-shared-universe", "lib-shared-cygwin"]:
        pt.mark_targets_as_explicit([name + "-" + subname])
Exemple #7
0
def install(name,
            package_name=None,
            requirements=[],
            binaries=[],
            libraries=[],
            headers=[]):

    requirements = requirements[:]
    binaries = binaries[:]
    libraries

    if not package_name:
        package_name = name

    if option.get("prefix"):
        # If --prefix is explicitly specified on the command line,
        # then we need wipe away any settings of libdir/includir that
        # is specified via options in config files.
        option.set("bindir", None)
        option.set("libdir", None)
        option.set("includedir", None)

    # If <install-source-root> is not specified, all headers are installed to
    # prefix/include, no matter what their relative path is. Sometimes that is
    # what is needed.
    install_source_root = property.select('install-source-root', requirements)
    if install_source_root:
        requirements = property.change(requirements, 'install-source-root',
                                       None)

    install_header_subdir = property.select('install-header-subdir',
                                            requirements)
    if install_header_subdir:
        install_header_subdir = ungrist(install_header_subdir[0])
        requirements = property.change(requirements, 'install-header-subdir',
                                       None)

    # First, figure out all locations. Use the default if no prefix option
    # given.
    prefix = get_prefix(name, requirements)

    # Architecture dependent files.
    exec_locate = option.get("exec-prefix", prefix)

    # Binaries.
    bin_locate = option.get("bindir", os.path.join(prefix, "bin"))

    # Object code libraries.
    lib_locate = option.get("libdir", os.path.join(prefix, "lib"))

    # Source header files.
    include_locate = option.get("includedir", os.path.join(prefix, "include"))

    stage.install(name + "-bin", binaries,
                  requirements + ["<location>" + bin_locate])

    alias(name + "-lib", [name + "-lib-shared", name + "-lib-static"])

    # Since the install location of shared libraries differs on universe
    # and cygwin, use target alternatives to make different targets.
    # We should have used indirection conditioanl requirements, but it's
    # awkward to pass bin-locate and lib-locate from there to another rule.
    alias(name + "-lib-shared", [name + "-lib-shared-universe"])
    alias(name + "-lib-shared", [name + "-lib-shared-cygwin"],
          ["<target-os>cygwin"])

    # For shared libraries, we install both explicitly specified one and the
    # shared libraries that the installed executables depend on.
    stage.install(
        name + "-lib-shared-universe", binaries + libraries, requirements + [
            "<location>" + lib_locate, "<install-dependencies>on",
            "<install-type>SHARED_LIB"
        ])
    stage.install(
        name + "-lib-shared-cygwin", binaries + libraries, requirements + [
            "<location>" + bin_locate, "<install-dependencies>on",
            "<install-type>SHARED_LIB"
        ])

    # For static libraries, we do not care about executable dependencies, since
    # static libraries are already incorporated into them.
    stage.install(
        name + "-lib-static", libraries, requirements + [
            "<location>" + lib_locate, "<install-dependencies>on",
            "<install-type>STATIC_LIB"
        ])
    stage.install(name + "-headers", headers, requirements \
                  + ["<location>" + os.path.join(include_locate, s) for s in install_header_subdir]
                  + install_source_root)

    alias(name, [name + "-bin", name + "-lib", name + "-headers"])

    pt = get_manager().projects().current()

    for subname in [
            "bin", "lib", "headers", "lib-shared", "lib-static",
            "lib-shared-universe", "lib-shared-cygwin"
    ]:
        pt.mark_targets_as_explicit([name + "-" + subname])