(name, package_name=None, requirements=[], binaries=[], libraries=[], headers=[])
| 53 | @bjam_signature((["name", "package_name", "?"], ["requirements", "*"], |
| 54 | ["binaries", "*"], ["libraries", "*"], ["headers", "*"])) |
| 55 | def install(name, package_name=None, requirements=[], binaries=[], libraries=[], headers=[]): |
| 56 | |
| 57 | requirements = requirements[:] |
| 58 | binaries = binaries[:] |
| 59 | libraries |
| 60 | |
| 61 | if not package_name: |
| 62 | package_name = name |
| 63 | |
| 64 | if option.get("prefix"): |
| 65 | # If --prefix is explicitly specified on the command line, |
| 66 | # then we need wipe away any settings of libdir/includir that |
| 67 | # is specified via options in config files. |
| 68 | option.set("bindir", None) |
| 69 | option.set("libdir", None) |
| 70 | option.set("includedir", None) |
| 71 | |
| 72 | # If <install-source-root> is not specified, all headers are installed to |
| 73 | # prefix/include, no matter what their relative path is. Sometimes that is |
| 74 | # what is needed. |
| 75 | install_source_root = property.select('install-source-root', requirements) |
| 76 | if install_source_root: |
| 77 | requirements = property.change(requirements, 'install-source-root', None) |
| 78 | |
| 79 | install_header_subdir = property.select('install-header-subdir', requirements) |
| 80 | if install_header_subdir: |
| 81 | install_header_subdir = ungrist(install_header_subdir[0]) |
| 82 | requirements = property.change(requirements, 'install-header-subdir', None) |
| 83 | |
| 84 | # First, figure out all locations. Use the default if no prefix option |
| 85 | # given. |
| 86 | prefix = get_prefix(name, requirements) |
| 87 | |
| 88 | # Architecture dependent files. |
| 89 | exec_locate = option.get("exec-prefix", prefix) |
| 90 | |
| 91 | # Binaries. |
| 92 | bin_locate = option.get("bindir", os.path.join(prefix, "bin")) |
| 93 | |
| 94 | # Object code libraries. |
| 95 | lib_locate = option.get("libdir", os.path.join(prefix, "lib")) |
| 96 | |
| 97 | # Source header files. |
| 98 | include_locate = option.get("includedir", os.path.join(prefix, "include")) |
| 99 | |
| 100 | stage.install(name + "-bin", binaries, requirements + ["<location>" + bin_locate]) |
| 101 | |
| 102 | alias(name + "-lib", [name + "-lib-shared", name + "-lib-static"]) |
| 103 | |
| 104 | # Since the install location of shared libraries differs on universe |
| 105 | # and cygwin, use target alternatives to make different targets. |
| 106 | # We should have used indirection conditioanl requirements, but it's |
| 107 | # awkward to pass bin-locate and lib-locate from there to another rule. |
| 108 | alias(name + "-lib-shared", [name + "-lib-shared-universe"]) |
| 109 | alias(name + "-lib-shared", [name + "-lib-shared-cygwin"], ["<target-os>cygwin"]) |
| 110 | |
| 111 | # For shared libraries, we install both explicitly specified one and the |
| 112 | # shared libraries that the installed executables depend on. |
nothing calls this directly
no test coverage detected