[12] | 1 | # |
---|
| 2 | # This is Boost Jamfile for Boost.Build V2. |
---|
| 3 | # |
---|
| 4 | # Pass --v2 option to bjam to use this file. For example: |
---|
| 5 | # |
---|
| 6 | # bjam --v2 link=static |
---|
| 7 | # |
---|
| 8 | |
---|
| 9 | # TODO: |
---|
| 10 | # - handle boost version |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | import modules ; |
---|
| 14 | import set ; |
---|
| 15 | import stage ; |
---|
| 16 | import package ; |
---|
| 17 | |
---|
| 18 | constant BOOST_VERSION : 1.33.1 ; |
---|
| 19 | |
---|
| 20 | project boost |
---|
| 21 | : requirements <include>. |
---|
| 22 | # disable auto-linking for all targets here, |
---|
| 23 | # primarily because it caused troubles with V2 |
---|
| 24 | <define>BOOST_ALL_NO_LIB=1 |
---|
| 25 | # Used to encode variant in target name. See the |
---|
| 26 | # 'tag' rule below. |
---|
| 27 | <tag>@$(__name__).tag |
---|
| 28 | : usage-requirements <include>. |
---|
| 29 | : build-dir bin.v2 |
---|
| 30 | ; |
---|
| 31 | |
---|
| 32 | # Decides which libraries are to be installed by looking at --with-<library> |
---|
| 33 | # --without-<library> arguments. Returns the list of directories under "libs" |
---|
| 34 | # which must be built at installed. |
---|
| 35 | rule libraries-to-install ( existing-libraries * ) |
---|
| 36 | { |
---|
| 37 | local argv = [ modules.peek : ARGV ] ; |
---|
| 38 | local with-parameter = [ MATCH --with-(.*) : $(argv) ] ; |
---|
| 39 | local without-parameter = [ MATCH --without-(.*) : $(argv) ] ; |
---|
| 40 | |
---|
| 41 | # Do some checks |
---|
| 42 | if $(with-parameter) && $(without-parameter) |
---|
| 43 | { |
---|
| 44 | ECHO "error: both --with-<library> and --without-<library> specified" ; |
---|
| 45 | EXIT ; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | local wrong = [ set.difference $(with-parameter) : $(existing-libraries) ] ; |
---|
| 49 | if $(wrong) |
---|
| 50 | { |
---|
| 51 | ECHO "error: wrong library name '$(wrong[1])' in the --with-<library> option." ; |
---|
| 52 | EXIT ; |
---|
| 53 | } |
---|
| 54 | local wrong = [ set.difference $(without-parameter) : $(existing-libraries) ] ; |
---|
| 55 | if $(wrong) |
---|
| 56 | { |
---|
| 57 | ECHO "error: wrong library name '$(wrong[1])' in the --without-<library> option." ; |
---|
| 58 | EXIT ; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | if $(with-parameter) |
---|
| 62 | { |
---|
| 63 | return [ set.intersection $(existing-libraries) : $(with-parameter) ] ; |
---|
| 64 | } |
---|
| 65 | else |
---|
| 66 | { |
---|
| 67 | return [ set.difference $(existing-libraries) : $(without-parameter) ] ; |
---|
| 68 | } |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | # what kind of layout are we doing? |
---|
| 72 | layout = [ MATCH "^--layout=(.*)" : $(ARGV) ] ; |
---|
| 73 | layout ?= versioned ; |
---|
| 74 | layout-$(layout) = true ; |
---|
| 75 | |
---|
| 76 | # possible stage only location |
---|
| 77 | local stage-locate = [ MATCH "^--stagedir=(.*)" : $(ARGV) ] ; |
---|
| 78 | stage-locate ?= stage ; |
---|
| 79 | |
---|
| 80 | path-constant BOOST_STAGE_LOCATE : $(stage-locate) ; |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | # location of python |
---|
| 84 | local python-root = [ MATCH "^--with-python-root=(.*)" : $(ARGV) ] ; |
---|
| 85 | PYTHON_ROOT ?= $(python-root) ; |
---|
| 86 | |
---|
| 87 | # Select the libraries to install. |
---|
| 88 | libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ] ] ; |
---|
| 89 | libraries = [ libraries-to-install $(libraries) ] ; |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | # This rule is called by Boost.Build to determine the name of |
---|
| 93 | # target. We use it to encode build variant, compiler name and |
---|
| 94 | # boost version in the target name |
---|
| 95 | rule tag ( name : type ? : property-set ) |
---|
| 96 | { |
---|
| 97 | if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB |
---|
| 98 | { |
---|
| 99 | if $(layout) = versioned |
---|
| 100 | { |
---|
| 101 | name = [ stage.add-variant-and-compiler $(name) |
---|
| 102 | : $(type) : $(property-set) ] ; |
---|
| 103 | |
---|
| 104 | local version-tag = [ MATCH "^([^.]+)[.]([^.]+)" : $(BOOST_VERSION[1]) ] ; |
---|
| 105 | version-tag = $(version-tag:J="_") ; |
---|
| 106 | |
---|
| 107 | # On NT, library with version suffix won't be recognized |
---|
| 108 | # by linkers. On CYGWIN, we get strage duplicate symbol |
---|
| 109 | # errors when library is generated with version suffix. |
---|
| 110 | # On OSX, version suffix is not needed -- the linker expets |
---|
| 111 | # libFoo.1.2.3.dylib format. |
---|
| 112 | # AIX linkers don't accept version suffixes either. |
---|
| 113 | if [ $(property-set).get <os> ] in NT CYGWIN MACOSX AIX |
---|
| 114 | { |
---|
| 115 | return $(name:B)-$(version-tag)$(name:S) ; |
---|
| 116 | } |
---|
| 117 | else |
---|
| 118 | { |
---|
| 119 | return $(name:B)-$(version-tag)$(name:S).$(BOOST_VERSION) ; |
---|
| 120 | } |
---|
| 121 | } |
---|
| 122 | else |
---|
| 123 | { |
---|
| 124 | return [ stage.add-variant-and-compiler $(name) |
---|
| 125 | : $(type) : $(property-set) ] ; |
---|
| 126 | } |
---|
| 127 | } |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | # Install to system location. |
---|
| 131 | |
---|
| 132 | local patterns = *.hpp *.ipp *.h *.inc ; |
---|
| 133 | local dirs = boost boost/* boost/*/* ; |
---|
| 134 | |
---|
| 135 | # Complete install |
---|
| 136 | package.install install |
---|
| 137 | : <install-source-root>. # No specific requirements |
---|
| 138 | : # No binaries |
---|
| 139 | : libs/$(libraries)/build |
---|
| 140 | : [ glob $(dirs)/$(patterns) ] |
---|
| 141 | ; |
---|
| 142 | |
---|
| 143 | # Install just library. |
---|
| 144 | install stage : libs/$(libraries)/build |
---|
| 145 | : <location>$(stage-locate) |
---|
| 146 | ; |
---|
| 147 | |
---|
| 148 | # Just build the libraries, don't install them anywhere. |
---|
| 149 | # This is what happend with just "bjam --v2". |
---|
| 150 | alias build_all : libs/$(libraries)/build ; |
---|
| 151 | |
---|
| 152 | # This rule should be called from libraries' Jamfiles and will |
---|
| 153 | # create two targets, "install" and "stage", that will install |
---|
| 154 | # or stage that library. The --prefix option is respected, by |
---|
| 155 | # --with and --without options, naturally, are ignored. |
---|
| 156 | # |
---|
| 157 | # - libraries -- list of library targets to install. |
---|
| 158 | rule boost-install ( libraries * ) |
---|
| 159 | { |
---|
| 160 | package.install install |
---|
| 161 | : <dependency>/boost//install-headers |
---|
| 162 | : # No binaries |
---|
| 163 | : $(libraries) |
---|
| 164 | : # No headers, it's handled by the dependency |
---|
| 165 | ; |
---|
| 166 | |
---|
| 167 | install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ; |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | # Make project ids of all libraries known. |
---|
| 173 | for local l in $(libraries) |
---|
| 174 | { |
---|
| 175 | use-project /boost/$(l) : libs/$(l)/build ; |
---|
| 176 | } |
---|
| 177 | |
---|