mirror of
https://github.com/boostorg/build.git
synced 2026-02-17 13:42:14 +00:00
New convenience rule package.install.
Use that rule in top-level Jamfile.v2. Introduce new top-level Jamfile rule 'boost-install'. Use it in date_time, other libraries to follow soon. [SVN r29805]
This commit is contained in:
84
src/tools/package.jam
Normal file
84
src/tools/package.jam
Normal file
@@ -0,0 +1,84 @@
|
||||
# Copyright (c) 2005 Vladimir Prus.
|
||||
#
|
||||
# Use, modification and distribution is subject to the Boost Software
|
||||
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# Provides mechanism for installing whole packages into a specific
|
||||
# directory structure. This is opposed to the 'install' rule, that
|
||||
# installs a number of targets to a single directory, and does not
|
||||
# care about directory structure at all.
|
||||
|
||||
# Example usage:
|
||||
#
|
||||
# package.install boost : <properties>
|
||||
# : <binaries>
|
||||
# : <libraries>
|
||||
# : <headers>
|
||||
# ;
|
||||
#
|
||||
# This will install binaries, libraries and headers to the 'proper' location, given
|
||||
# by command line options --prefix, --exec-prefix, --bindir, --libdir and
|
||||
# --includedir.
|
||||
#
|
||||
# The rule is just a convenient wrapper, avoiding the need to define several
|
||||
# 'install' targets.
|
||||
#
|
||||
# The only install-related feature is <install-source-root>. It will apply to
|
||||
# headers only and if present, paths of headers relatively to source root will be
|
||||
# retained after installing. If it's not specified, then "." is assumed, so
|
||||
# relative paths in headers are always preserved.
|
||||
|
||||
import project ;
|
||||
import targets ;
|
||||
import "class" : new ;
|
||||
import option ;
|
||||
import errors ;
|
||||
import stage ;
|
||||
import property ;
|
||||
|
||||
rule install ( name : requirements * : binaries * : libraries * : headers * )
|
||||
{
|
||||
local install-source-root = [ property.select <install-source-root>
|
||||
: $(requirements) ] ;
|
||||
install-source-root ?= "." ;
|
||||
|
||||
|
||||
requirements = [ property.change $(requirements) : <install-source-root> ] ;
|
||||
|
||||
|
||||
# First, figure out all locations.
|
||||
local prefix = [ option.get prefix : "" ] ;
|
||||
|
||||
if ! $(prefix)
|
||||
{
|
||||
if [ modules.peek : NT ] { prefix = C:\\$(name) ; }
|
||||
else if [ modules.peek : UNIX ] { prefix = /usr/local ; }
|
||||
}
|
||||
|
||||
# architecture dependent files
|
||||
local exec-locate = [ option.get exec-prefix : $(prefix) ] ;
|
||||
|
||||
# binaries
|
||||
local bin-locate = [ option.get bindir : $(prefix)/bin ] ;
|
||||
|
||||
# object code libraries
|
||||
local lib-locate = [ option.get libdir : $(prefix)/lib ] ;
|
||||
|
||||
# source header files
|
||||
local include-locate = [ option.get includedir : $(prefix)/include ] ;
|
||||
|
||||
|
||||
stage.install $(name)-bin : $(binaries) : $(requirements) <location>$(bin-locate) ;
|
||||
stage.install $(name)-lib : $(libraries) : $(requirements) <location>$(lib-locate) ;
|
||||
stage.install $(name)-headers : $(headers) : $(requirements)
|
||||
<location>$(include-locate) <install-source-root>$(install-source-root) ;
|
||||
alias $(name) : $(name)-bin $(name)-lib $(name)-headers ;
|
||||
|
||||
local c = [ project.current ] ;
|
||||
local project-module = [ $(c).project-module ] ;
|
||||
module $(project-module)
|
||||
{
|
||||
explicit $(1)-bin $(1)-lib $(1)-headers $(1) ;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user