From fa98e5148a93481cf659fadc4339839004f92147 Mon Sep 17 00:00:00 2001 From: Dmitry Arkhipov Date: Thu, 16 May 2024 23:08:36 +0300 Subject: [PATCH 1/3] use install- features instead of package module --- Jamfile | 4 +- boost-install-dirs.jam | 55 +-------- boost-install.jam | 252 +++++++++++++++-------------------------- 3 files changed, 95 insertions(+), 216 deletions(-) diff --git a/Jamfile b/Jamfile index 7d25aae..7ad3e6a 100644 --- a/Jamfile +++ b/Jamfile @@ -2,9 +2,11 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) +import make ; + project /boost/tools/boost_install ; # BoostConfigVersion.cmake -generate BoostConfigVersion.cmake : : @boost-install%generate-cmake-config-version Boost $(BOOST_VERSION) ; +make BoostConfigVersion.cmake : : @boost-install%make-cmake-config-version : $(BOOST_VERSION) ; explicit BoostConfigVersion.cmake ; diff --git a/boost-install-dirs.jam b/boost-install-dirs.jam index 5c9f3d4..5985152 100644 --- a/boost-install-dirs.jam +++ b/boost-install-dirs.jam @@ -6,60 +6,9 @@ import modules ; import boostcpp ; import package ; import path ; +import stage ; -# includedir - -rule includedir -{ - if ! $(.includedir) - { - local paths = [ package.paths Boost ] ; - .includedir = [ $(paths).includedir ] ; - } - - return $(.includedir) ; -} - -# bindir - -rule bindir -{ - if ! $(.bindir) - { - local paths = [ package.paths Boost ] ; - .bindir = [ $(paths).bindir ] ; - } - - return $(.bindir) ; -} - -# libdir - -rule libdir -{ - if ! $(.libdir) - { - local paths = [ package.paths Boost ] ; - .libdir = [ $(paths).libdir ] ; - } - - return $(.libdir) ; -} - -# cmakedir - -rule cmakedir -{ - if ! $(.cmakedir) - { - package.add-path-option cmakedir : cmake : libdir ; - - local paths = [ package.paths Boost ] ; - .cmakedir = [ $(paths).get cmakedir ] ; - } - - return $(.cmakedir) ; -} +stage.add-install-dir cmakedir : cmake : libdir ; # header-subdir diff --git a/boost-install.jam b/boost-install.jam index d2c645c..c939527 100644 --- a/boost-install.jam +++ b/boost-install.jam @@ -2,6 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) +import make ; import modules ; import boostcpp ; import property-set ; @@ -10,23 +11,17 @@ import project ; import common ; import print ; import os ; +import property ; import feature ; import package ; import sequence ; import set ; +import stage ; import type ; import path ; import regex ; import ./boost-install-dirs ; -feature.feature library-type : : free ; -feature.feature boost-install.dependency : : free ; -feature.feature boost-install.cmakedir : : free ; -feature.feature boost-install.includedir : : free ; -feature.feature boost-install.libdir : : free ; -feature.feature boost-install.lib-target-type : : free ; -feature.feature boost-install.dll-target : : free ; - if "--verbose" in [ modules.peek : ARGV ] { .info-enabled = 1 ; @@ -53,6 +48,19 @@ local rule .debug ( messages * ) } } +local rule flags-to-vars ( ps ) +{ + for local opt in [ $(ps).get ] + { + local match = [ MATCH (.*)=(.*) : $(opt) ] ; + if $(match) + { + # assigns to variables which assumed to exist in outside scope + $(match[1]) += $(match[2-]) ; + } + } +} + # generate-cmake-variant- local rule remap-library ( lib ) @@ -116,12 +124,19 @@ rule generate-cmake-variant- ( target : sources * : properties * ) local ps = [ property-set.create $(properties) ] ; + local project ; + local name ; + local library-type ; + local lib-target-type ; + local dll-target ; + local dependency ; + flags-to-vars $(ps) ; + print.output $(target) ; local version = [ $(ps).get ] ; .info " version=" $(version) ; - local name = [ $(ps).get ] ; .info " name=" $(name) ; local variant = [ $(ps).get ] ; @@ -433,7 +448,6 @@ rule generate-cmake-variant- ( target : sources * : properties * ) print.text "# Target file name: $(fname)" "" : true ; - local lib-target-type = [ $(ps).get ] ; .info " lib-target-type=" $(lib-target-type) ; local loc-prop = LOCATION ; @@ -445,8 +459,6 @@ rule generate-cmake-variant- ( target : sources * : properties * ) .info " loc-prop=" $(loc-prop) ; - local dll-target = [ $(ps).get ] ; - local dll-name ; if $(dll-target) @@ -507,7 +519,7 @@ rule generate-cmake-variant- ( target : sources * : properties * ) : true ; } - local deps = [ MATCH "boost_(.*)" : [ $(ps).get ] ] headers ; + local deps = [ MATCH "boost_(.*)" : $(dependency) ] headers ; .info " deps=" $(deps) ; if $(deps) @@ -519,7 +531,7 @@ rule generate-cmake-variant- ( target : sources * : properties * ) : true ; } - local deps2 = [ set.difference [ $(ps).get ] : boost_$(deps) ] ; + local deps2 = [ set.difference $(dependency) : boost_$(deps) ] ; .info " deps2=" $(deps2) ; local deps3 ; @@ -547,10 +559,6 @@ rule generate-cmake-variant- ( target : sources * : properties * ) } } -actions generate-cmake-variant- -{ -} - # tag local rule tag ( name : type ? : property-set ) @@ -655,7 +663,7 @@ rule generate-cmake-variant ( project name : property-set : sources * ) local dll-target = [ get-dll-target $(sources) ] ; local other-names = [ get-dependency-names $(sources) ] ; - property-set = [ $(property-set).add-raw $(other-names) ] ; + property-set = [ $(property-set).add-raw dependency=$(other-names) ] ; local result ; @@ -672,13 +680,13 @@ rule generate-cmake-variant ( project name : property-set : sources * ) .debug " dll-target=" [ $(dll-target).name ] ; } - local tag = [ tag $(name) : : $(property-set) ] ; - - property-set = [ $(property-set).add-raw $(lib-target-type) ] ; - property-set = [ $(property-set).add-raw $(dll-target) ] ; + property-set = [ $(property-set).add-raw lib-target-type=$(lib-target-type) ] ; + property-set = [ $(property-set).add-raw dll-target=$(dll-target) ] ; local a = [ new non-scanning-action $(lib-target) : boost-install.generate-cmake-variant- : $(property-set) ] ; + local tag = [ tag $(name) : : $(property-set) ] ; + result += [ new file-target $(tag) : : $(project) : $(a) ] ; } @@ -725,30 +733,38 @@ local rule get-dir ( name : dir ) } } -rule generate-cmake-config- ( target : sources * : properties * ) +# make-cmake-config + +rule make-cmake-config ( target : sources * : properties * ) { - .info generate-cmake-config- $(target) ":" $(sources) ; + .info make-cmake-config $(target) ":" $(sources) ; local ps = [ property-set.create $(properties) ] ; + local name ; + local library-type ; + local header-subdir ; + flags-to-vars $(ps) ; + print.output $(target) ; local version = [ $(ps).get ] ; .info " version=" $(version) ; - local name = [ $(ps).get ] ; .info " name=" $(name) ; - local library-type = [ $(ps).get ] ; .info " library-type=" $(library-type) ; - local cmakedir = [ $(ps).get ] ; + local cmakedir = [ stage.get-dir cmakedir : $(ps) : Boost ] ; .info " cmakedir=" $(cmakedir) ; - local includedir = [ $(ps).get ] ; + local includedir = [ stage.get-dir includedir : $(ps) : Boost ] ; + includedir = [ path.join $(includedir) $(header-subdir) ] ; + includedir = [ path.relative-to $(cmakedir) $(includedir) ] ; .info " includedir=" $(includedir) ; - local libdir = [ $(ps).get ] ; + local libdir = [ stage.get-dir libdir : $(ps) : Boost ] ; + libdir = [ path.relative-to $(cmakedir) $(libdir) ] ; .info " libdir=" $(libdir) ; local lname = [ MATCH boost_(.*) : $(name) ] ; @@ -952,51 +968,14 @@ rule generate-cmake-config- ( target : sources * : properties * ) } } -actions generate-cmake-config- +# make-cmake-config-version + +rule make-cmake-config-version ( target : sources * : properties * ) { -} + .info make-cmake-config-version $(target) ":" $(sources) ; -# generate-cmake-config - -rule generate-cmake-config ( project name : property-set : sources * ) -{ - .debug generate-cmake-config $(name) ; - - local pname = [ $(property-set).get ] ; - local version = [ $(property-set).get ] ; - local location = [ $(property-set).get ] ; - local library-type = [ $(property-set).get ] ; - local cmakedir = [ $(property-set).get ] ; - local includedir = [ $(property-set).get ] ; - local libdir = [ $(property-set).get ] ; - - local ps = [ property-set.create - $(pname) $(version) $(location) - $(library-type) - $(cmakedir) - $(includedir) - $(libdir) ] ; - - local result ; - - local a = [ new non-scanning-action : boost-install.generate-cmake-config- : $(ps) ] ; - - result += [ new file-target $(name) : : $(project) : $(a) ] ; - - return $(result) ; -} - -# generate-cmake-config-version- - -rule generate-cmake-config-version- ( target : sources * : properties * ) -{ - .info generate-cmake-config-version- $(target) ":" $(sources) ; - - local ps = [ property-set.create $(properties) ] ; - - print.output $(target) ; - - local version = [ $(ps).get ] ; + local version = [ property.select : $(properties) ] ; + local version = $(version:G=) ; .info " version=" $(version) ; print.output $(target) ; @@ -1019,34 +998,9 @@ rule generate-cmake-config-version- ( target : sources * : properties * ) : true ; } -actions generate-cmake-config-version- -{ -} - -# generate-cmake-config-version - -rule generate-cmake-config-version ( project name : property-set : sources * ) -{ - .debug generate-cmake-config-version $(name) ; - - local pname = [ $(property-set).get ] ; - local version = [ $(property-set).get ] ; - local location = [ $(property-set).get ] ; - - local ps = [ property-set.create $(pname) $(version) $(location) ] ; - - local result ; - - local a = [ new non-scanning-action : boost-install.generate-cmake-config-version- : $(ps) ] ; - - result += [ new file-target $(name) : : $(project) : $(a) ] ; - - return $(result) ; -} - # install-cmake-config- -local rule install-cmake-config- ( install-or-stage : location : includedir : libdir : version : name ) +local rule install-cmake-config- ( install-or-stage : version : name : requirements * ) { #.debug install-cmake-config- $(name) ; @@ -1054,7 +1008,7 @@ local rule install-cmake-config- ( install-or-stage : location : includedir : li if [ MATCH boost_(.*) : $(name) ] { - local loc = $(location)/$(name)-$(version) ; + local loc = (cmakedir)/$(name)-$(version) ; local library-type = UNKNOWN ; @@ -1063,19 +1017,18 @@ local rule install-cmake-config- ( install-or-stage : location : includedir : li library-type = INTERFACE ; } - local reqs = $(name) $(version) $(library-type) $(location) $(includedir) $(libdir) ; + local reqs = $(version) library-type=$(library-type) name=$(name) ; - r += [ generate $(install-or-stage)/$(name)-config.cmake : $(name) : @boost-install%generate-cmake-config $(reqs) ] ; - r += [ install $(install-or-stage)-$(name)-config.cmake : $(install-or-stage)/$(name)-config.cmake : $(loc) ] ; + r += [ make $(install-or-stage)/$(name)-config.cmake : $(name) : @boost-install%make-cmake-config : $(reqs) $(requirements) ] ; + r += [ install $(install-or-stage)-$(name)-config.cmake : $(install-or-stage)/$(name)-config.cmake : $(loc) $(requirements) ] ; - r += [ generate $(install-or-stage)/$(name)-config-version.cmake : $(name) : @boost-install%generate-cmake-config-version $(reqs) ] ; - r += [ install $(install-or-stage)-$(name)-config-version.cmake : $(install-or-stage)/$(name)-config-version.cmake : $(loc) ] ; + r += [ make $(install-or-stage)/$(name)-config-version.cmake : $(name) : @boost-install%make-cmake-config-version : $(reqs) $(requirements) ] ; + r += [ install $(install-or-stage)-$(name)-config-version.cmake : $(install-or-stage)/$(name)-config-version.cmake : $(loc) $(requirements) ] ; if $(library-type) != INTERFACE { - local v = [ generate $(install-or-stage)/$(name)-variant.cmake : $(name) : @boost-install%generate-cmake-variant $(reqs) ] ; - r += $(v) ; - r += [ install $(install-or-stage)-$(name)-config-variant.cmake : $(v) : $(loc) ] ; + r += [ generate $(install-or-stage)/$(name)-variant.cmake : $(name) : @boost-install%generate-cmake-variant $(reqs) ] ; + r += [ install $(install-or-stage)-$(name)-config-variant.cmake : $(install-or-stage)/$(name)-variant.cmake : $(loc) $(requirements) ] ; } } else @@ -1088,9 +1041,8 @@ local rule install-cmake-config- ( install-or-stage : location : includedir : li # install-or-stage-cmake-config # -# includedir, libdir, cmakedir should be in canonical path.make format -rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : libdir : cmakedir ) +rule install-or-stage-cmake-config ( name * : install-or-stage ) { local p = [ project.current ] ; @@ -1101,8 +1053,18 @@ rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : li } else { - includedir = [ path.relative-to $(cmakedir) $(includedir) ] ; - libdir = [ path.relative-to $(cmakedir) $(libdir) ] ; + local reqs ; + if $(install-or-stage) = stage + { + local libdir = [ boost-install-dirs.stage-libdir ] ; + local includedir = [ path.make [ modules.peek boostcpp : BOOST_ROOT ] ] ; + reqs = $(libdir) $(includedir) ; + } + else + { + local subdir = [ boost-install-dirs.header-subdir ] ; + reqs = header-subdir=$(subdir) ; + } local BOOST_VERSION = [ modules.peek boostcpp : BOOST_VERSION ] ; @@ -1110,7 +1072,7 @@ rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : li for local nm in $(name) { - configs += [ install-cmake-config- $(install-or-stage) : $(cmakedir) : $(includedir) : $(libdir) : $(BOOST_VERSION) : $(nm) ] ; + configs += [ install-cmake-config- $(install-or-stage) : $(BOOST_VERSION) : $(nm) : $(reqs) ] ; } # Target install/stage-detect-toolset @@ -1118,19 +1080,19 @@ rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : li local boost-install-dir = [ modules.binding $(__name__) ] ; boost-install-dir = $(boost-install-dir:D) ; - install $(install-or-stage)-detect-toolset : $(boost-install-dir)/BoostDetectToolset.cmake : $(cmakedir) BoostDetectToolset-$(BOOST_VERSION).cmake ; + install $(install-or-stage)-detect-toolset : $(boost-install-dir)/BoostDetectToolset.cmake : (cmakedir) BoostDetectToolset-$(BOOST_VERSION).cmake $(reqs) ; $(p).mark-target-as-explicit $(install-or-stage)-detect-toolset ; # Target install/stage-boost-config - install $(install-or-stage)-boost-config : $(boost-install-dir)/BoostConfig.cmake : $(cmakedir)/Boost-$(BOOST_VERSION) ; + install $(install-or-stage)-boost-config : $(boost-install-dir)/BoostConfig.cmake : (cmakedir)/Boost-$(BOOST_VERSION) $(reqs) ; $(p).mark-target-as-explicit $(install-or-stage)-boost-config ; # Target install/stage-boost-config-version project.load [ path.make $(boost-install-dir) ] ; - install $(install-or-stage)-boost-config-version : /boost/tools/boost_install//BoostConfigVersion.cmake : $(cmakedir)/Boost-$(BOOST_VERSION) ; + install $(install-or-stage)-boost-config-version : /boost/tools/boost_install//BoostConfigVersion.cmake : (cmakedir)/Boost-$(BOOST_VERSION) $(reqs) ; $(p).mark-target-as-explicit $(install-or-stage)-boost-config-version ; # Target install/stage-cmake-config @@ -1146,26 +1108,12 @@ rule install-cmake-config ( name * ) { #.debug install-cmake-config $(name) ; - local includedir = [ boost-install-dirs.includedir ] ; - local libdir = [ boost-install-dirs.libdir ] ; - local cmakedir = [ boost-install-dirs.cmakedir ] ; - local header-subdir = [ boost-install-dirs.header-subdir ] ; - - if $(header-subdir) - { - includedir = $(includedir)/$(header-subdir) ; - } - - install-or-stage-cmake-config $(name) : install : $(includedir) : $(libdir) : $(cmakedir) ; + install-or-stage-cmake-config $(name) : install ; } rule stage-cmake-config ( name * ) { - local includedir = [ path.make [ modules.peek boostcpp : BOOST_ROOT ] ] ; - local libdir = [ boost-install-dirs.stage-libdir ] ; - local cmakedir = $(libdir)/cmake ; - - install-or-stage-cmake-config $(name) : stage : $(includedir) : $(libdir) : $(cmakedir) ; + install-or-stage-cmake-config $(name) : stage ; } # stage-cmake-config @@ -1244,7 +1192,7 @@ rule generate-dependencies ( project name ? : property-set : sources * ) # boost-install -local rule install-stage-subdir ( properties * ) +rule install-subdir ( properties * ) { local ps = [ property-set.create $(properties) ] ; @@ -1262,25 +1210,7 @@ local rule install-stage-subdir ( properties * ) r = $(r:B=$(r:B)-python$(python)) ; } - return $(r) ; -} - -rule stage-subdir ( properties * ) -{ - local r = [ install-stage-subdir $(properties) ] ; - - local libdir = [ boost-install-dirs.stage-libdir ] ; - - return $(libdir)/$(r) ; -} - -rule install-subdir ( properties * ) -{ - local r = [ install-stage-subdir $(properties) ] ; - - local libdir = [ boost-install-dirs.libdir ] ; - - return $(libdir)/$(r) ; + return (libdir)/$(r:E=) ; } rule boost-install ( libraries * ) @@ -1308,20 +1238,17 @@ rule boost-install ( libraries * ) local p = [ project.current ] ; - local libdir = [ boost-install-dirs.libdir ] ; - local bindir = [ boost-install-dirs.bindir ] ; - - install install-libraries-static : $(libraries) : $(libdir) on STATIC_LIB ; + install install-libraries-static : $(libraries) : (libdir) on STATIC_LIB ; $(p).mark-target-as-explicit install-libraries-static ; alias install-libraries-shared : install-libraries-shared- ; alias install-libraries-shared : install-libraries-shared-cygwin : cygwin ; $(p).mark-target-as-explicit install-libraries-shared ; - install install-libraries-shared- : $(libraries) : $(libdir) SHARED_LIB PDB on on ; + install install-libraries-shared- : $(libraries) : (libdir) SHARED_LIB PDB on on ; $(p).mark-target-as-explicit install-libraries-shared- ; - install install-libraries-shared-cygwin : $(libraries) : $(bindir) SHARED_LIB PDB on on ; + install install-libraries-shared-cygwin : $(libraries) : (bindir) SHARED_LIB PDB on on ; $(p).mark-target-as-explicit install-libraries-shared-cygwin ; install install-unprefixed-static : $(unprefixed) : STATIC_LIB @boost-install%install-subdir ; @@ -1341,19 +1268,20 @@ rule boost-install ( libraries * ) # Target stage local stage-libdir = [ boost-install-dirs.stage-libdir ] ; + local reqs = $(stage-libdir) ; stage-cmake-config $(libraries) ; - install stage-libraries-static : $(libraries) : $(stage-libdir) on STATIC_LIB ; + install stage-libraries-static : $(libraries) : (libdir) $(reqs) on STATIC_LIB ; $(p).mark-target-as-explicit stage-libraries-static ; - install stage-libraries-shared : $(libraries) : $(stage-libdir) on SHARED_LIB PDB on ; + install stage-libraries-shared : $(libraries) : (libdir) $(reqs) on SHARED_LIB PDB on ; $(p).mark-target-as-explicit stage-libraries-shared ; - install stage-unprefixed-static : $(unprefixed) : STATIC_LIB @boost-install%stage-subdir ; + install stage-unprefixed-static : $(unprefixed) : STATIC_LIB $(reqs) @boost-install%install-subdir ; $(p).mark-target-as-explicit stage-unprefixed-static ; - install stage-unprefixed-shared : $(unprefixed) : SHARED_LIB PDB on @boost-install%stage-subdir ; + install stage-unprefixed-shared : $(unprefixed) : SHARED_LIB $(reqs) PDB on @boost-install%install-subdir ; $(p).mark-target-as-explicit stage-unprefixed-shared ; generate stage-dependencies : $(libraries) : @boost-install%generate-dependencies stage ; From ca36fca59d56bad07acbc0f0837bfccb45763791 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 12 Jun 2024 16:12:49 +0300 Subject: [PATCH 2/3] Revert "use install- features instead of package module" --- Jamfile | 4 +- boost-install-dirs.jam | 55 ++++++++- boost-install.jam | 252 ++++++++++++++++++++++++++--------------- 3 files changed, 216 insertions(+), 95 deletions(-) diff --git a/Jamfile b/Jamfile index 7ad3e6a..7d25aae 100644 --- a/Jamfile +++ b/Jamfile @@ -2,11 +2,9 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) -import make ; - project /boost/tools/boost_install ; # BoostConfigVersion.cmake -make BoostConfigVersion.cmake : : @boost-install%make-cmake-config-version : $(BOOST_VERSION) ; +generate BoostConfigVersion.cmake : : @boost-install%generate-cmake-config-version Boost $(BOOST_VERSION) ; explicit BoostConfigVersion.cmake ; diff --git a/boost-install-dirs.jam b/boost-install-dirs.jam index 5985152..5c9f3d4 100644 --- a/boost-install-dirs.jam +++ b/boost-install-dirs.jam @@ -6,9 +6,60 @@ import modules ; import boostcpp ; import package ; import path ; -import stage ; -stage.add-install-dir cmakedir : cmake : libdir ; +# includedir + +rule includedir +{ + if ! $(.includedir) + { + local paths = [ package.paths Boost ] ; + .includedir = [ $(paths).includedir ] ; + } + + return $(.includedir) ; +} + +# bindir + +rule bindir +{ + if ! $(.bindir) + { + local paths = [ package.paths Boost ] ; + .bindir = [ $(paths).bindir ] ; + } + + return $(.bindir) ; +} + +# libdir + +rule libdir +{ + if ! $(.libdir) + { + local paths = [ package.paths Boost ] ; + .libdir = [ $(paths).libdir ] ; + } + + return $(.libdir) ; +} + +# cmakedir + +rule cmakedir +{ + if ! $(.cmakedir) + { + package.add-path-option cmakedir : cmake : libdir ; + + local paths = [ package.paths Boost ] ; + .cmakedir = [ $(paths).get cmakedir ] ; + } + + return $(.cmakedir) ; +} # header-subdir diff --git a/boost-install.jam b/boost-install.jam index c939527..d2c645c 100644 --- a/boost-install.jam +++ b/boost-install.jam @@ -2,7 +2,6 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) -import make ; import modules ; import boostcpp ; import property-set ; @@ -11,17 +10,23 @@ import project ; import common ; import print ; import os ; -import property ; import feature ; import package ; import sequence ; import set ; -import stage ; import type ; import path ; import regex ; import ./boost-install-dirs ; +feature.feature library-type : : free ; +feature.feature boost-install.dependency : : free ; +feature.feature boost-install.cmakedir : : free ; +feature.feature boost-install.includedir : : free ; +feature.feature boost-install.libdir : : free ; +feature.feature boost-install.lib-target-type : : free ; +feature.feature boost-install.dll-target : : free ; + if "--verbose" in [ modules.peek : ARGV ] { .info-enabled = 1 ; @@ -48,19 +53,6 @@ local rule .debug ( messages * ) } } -local rule flags-to-vars ( ps ) -{ - for local opt in [ $(ps).get ] - { - local match = [ MATCH (.*)=(.*) : $(opt) ] ; - if $(match) - { - # assigns to variables which assumed to exist in outside scope - $(match[1]) += $(match[2-]) ; - } - } -} - # generate-cmake-variant- local rule remap-library ( lib ) @@ -124,19 +116,12 @@ rule generate-cmake-variant- ( target : sources * : properties * ) local ps = [ property-set.create $(properties) ] ; - local project ; - local name ; - local library-type ; - local lib-target-type ; - local dll-target ; - local dependency ; - flags-to-vars $(ps) ; - print.output $(target) ; local version = [ $(ps).get ] ; .info " version=" $(version) ; + local name = [ $(ps).get ] ; .info " name=" $(name) ; local variant = [ $(ps).get ] ; @@ -448,6 +433,7 @@ rule generate-cmake-variant- ( target : sources * : properties * ) print.text "# Target file name: $(fname)" "" : true ; + local lib-target-type = [ $(ps).get ] ; .info " lib-target-type=" $(lib-target-type) ; local loc-prop = LOCATION ; @@ -459,6 +445,8 @@ rule generate-cmake-variant- ( target : sources * : properties * ) .info " loc-prop=" $(loc-prop) ; + local dll-target = [ $(ps).get ] ; + local dll-name ; if $(dll-target) @@ -519,7 +507,7 @@ rule generate-cmake-variant- ( target : sources * : properties * ) : true ; } - local deps = [ MATCH "boost_(.*)" : $(dependency) ] headers ; + local deps = [ MATCH "boost_(.*)" : [ $(ps).get ] ] headers ; .info " deps=" $(deps) ; if $(deps) @@ -531,7 +519,7 @@ rule generate-cmake-variant- ( target : sources * : properties * ) : true ; } - local deps2 = [ set.difference $(dependency) : boost_$(deps) ] ; + local deps2 = [ set.difference [ $(ps).get ] : boost_$(deps) ] ; .info " deps2=" $(deps2) ; local deps3 ; @@ -559,6 +547,10 @@ rule generate-cmake-variant- ( target : sources * : properties * ) } } +actions generate-cmake-variant- +{ +} + # tag local rule tag ( name : type ? : property-set ) @@ -663,7 +655,7 @@ rule generate-cmake-variant ( project name : property-set : sources * ) local dll-target = [ get-dll-target $(sources) ] ; local other-names = [ get-dependency-names $(sources) ] ; - property-set = [ $(property-set).add-raw dependency=$(other-names) ] ; + property-set = [ $(property-set).add-raw $(other-names) ] ; local result ; @@ -680,13 +672,13 @@ rule generate-cmake-variant ( project name : property-set : sources * ) .debug " dll-target=" [ $(dll-target).name ] ; } - property-set = [ $(property-set).add-raw lib-target-type=$(lib-target-type) ] ; - property-set = [ $(property-set).add-raw dll-target=$(dll-target) ] ; + local tag = [ tag $(name) : : $(property-set) ] ; + + property-set = [ $(property-set).add-raw $(lib-target-type) ] ; + property-set = [ $(property-set).add-raw $(dll-target) ] ; local a = [ new non-scanning-action $(lib-target) : boost-install.generate-cmake-variant- : $(property-set) ] ; - local tag = [ tag $(name) : : $(property-set) ] ; - result += [ new file-target $(tag) : : $(project) : $(a) ] ; } @@ -733,38 +725,30 @@ local rule get-dir ( name : dir ) } } -# make-cmake-config - -rule make-cmake-config ( target : sources * : properties * ) +rule generate-cmake-config- ( target : sources * : properties * ) { - .info make-cmake-config $(target) ":" $(sources) ; + .info generate-cmake-config- $(target) ":" $(sources) ; local ps = [ property-set.create $(properties) ] ; - local name ; - local library-type ; - local header-subdir ; - flags-to-vars $(ps) ; - print.output $(target) ; local version = [ $(ps).get ] ; .info " version=" $(version) ; + local name = [ $(ps).get ] ; .info " name=" $(name) ; + local library-type = [ $(ps).get ] ; .info " library-type=" $(library-type) ; - local cmakedir = [ stage.get-dir cmakedir : $(ps) : Boost ] ; + local cmakedir = [ $(ps).get ] ; .info " cmakedir=" $(cmakedir) ; - local includedir = [ stage.get-dir includedir : $(ps) : Boost ] ; - includedir = [ path.join $(includedir) $(header-subdir) ] ; - includedir = [ path.relative-to $(cmakedir) $(includedir) ] ; + local includedir = [ $(ps).get ] ; .info " includedir=" $(includedir) ; - local libdir = [ stage.get-dir libdir : $(ps) : Boost ] ; - libdir = [ path.relative-to $(cmakedir) $(libdir) ] ; + local libdir = [ $(ps).get ] ; .info " libdir=" $(libdir) ; local lname = [ MATCH boost_(.*) : $(name) ] ; @@ -968,14 +952,51 @@ rule make-cmake-config ( target : sources * : properties * ) } } -# make-cmake-config-version - -rule make-cmake-config-version ( target : sources * : properties * ) +actions generate-cmake-config- { - .info make-cmake-config-version $(target) ":" $(sources) ; +} - local version = [ property.select : $(properties) ] ; - local version = $(version:G=) ; +# generate-cmake-config + +rule generate-cmake-config ( project name : property-set : sources * ) +{ + .debug generate-cmake-config $(name) ; + + local pname = [ $(property-set).get ] ; + local version = [ $(property-set).get ] ; + local location = [ $(property-set).get ] ; + local library-type = [ $(property-set).get ] ; + local cmakedir = [ $(property-set).get ] ; + local includedir = [ $(property-set).get ] ; + local libdir = [ $(property-set).get ] ; + + local ps = [ property-set.create + $(pname) $(version) $(location) + $(library-type) + $(cmakedir) + $(includedir) + $(libdir) ] ; + + local result ; + + local a = [ new non-scanning-action : boost-install.generate-cmake-config- : $(ps) ] ; + + result += [ new file-target $(name) : : $(project) : $(a) ] ; + + return $(result) ; +} + +# generate-cmake-config-version- + +rule generate-cmake-config-version- ( target : sources * : properties * ) +{ + .info generate-cmake-config-version- $(target) ":" $(sources) ; + + local ps = [ property-set.create $(properties) ] ; + + print.output $(target) ; + + local version = [ $(ps).get ] ; .info " version=" $(version) ; print.output $(target) ; @@ -998,9 +1019,34 @@ rule make-cmake-config-version ( target : sources * : properties * ) : true ; } +actions generate-cmake-config-version- +{ +} + +# generate-cmake-config-version + +rule generate-cmake-config-version ( project name : property-set : sources * ) +{ + .debug generate-cmake-config-version $(name) ; + + local pname = [ $(property-set).get ] ; + local version = [ $(property-set).get ] ; + local location = [ $(property-set).get ] ; + + local ps = [ property-set.create $(pname) $(version) $(location) ] ; + + local result ; + + local a = [ new non-scanning-action : boost-install.generate-cmake-config-version- : $(ps) ] ; + + result += [ new file-target $(name) : : $(project) : $(a) ] ; + + return $(result) ; +} + # install-cmake-config- -local rule install-cmake-config- ( install-or-stage : version : name : requirements * ) +local rule install-cmake-config- ( install-or-stage : location : includedir : libdir : version : name ) { #.debug install-cmake-config- $(name) ; @@ -1008,7 +1054,7 @@ local rule install-cmake-config- ( install-or-stage : version : name : requireme if [ MATCH boost_(.*) : $(name) ] { - local loc = (cmakedir)/$(name)-$(version) ; + local loc = $(location)/$(name)-$(version) ; local library-type = UNKNOWN ; @@ -1017,18 +1063,19 @@ local rule install-cmake-config- ( install-or-stage : version : name : requireme library-type = INTERFACE ; } - local reqs = $(version) library-type=$(library-type) name=$(name) ; + local reqs = $(name) $(version) $(library-type) $(location) $(includedir) $(libdir) ; - r += [ make $(install-or-stage)/$(name)-config.cmake : $(name) : @boost-install%make-cmake-config : $(reqs) $(requirements) ] ; - r += [ install $(install-or-stage)-$(name)-config.cmake : $(install-or-stage)/$(name)-config.cmake : $(loc) $(requirements) ] ; + r += [ generate $(install-or-stage)/$(name)-config.cmake : $(name) : @boost-install%generate-cmake-config $(reqs) ] ; + r += [ install $(install-or-stage)-$(name)-config.cmake : $(install-or-stage)/$(name)-config.cmake : $(loc) ] ; - r += [ make $(install-or-stage)/$(name)-config-version.cmake : $(name) : @boost-install%make-cmake-config-version : $(reqs) $(requirements) ] ; - r += [ install $(install-or-stage)-$(name)-config-version.cmake : $(install-or-stage)/$(name)-config-version.cmake : $(loc) $(requirements) ] ; + r += [ generate $(install-or-stage)/$(name)-config-version.cmake : $(name) : @boost-install%generate-cmake-config-version $(reqs) ] ; + r += [ install $(install-or-stage)-$(name)-config-version.cmake : $(install-or-stage)/$(name)-config-version.cmake : $(loc) ] ; if $(library-type) != INTERFACE { - r += [ generate $(install-or-stage)/$(name)-variant.cmake : $(name) : @boost-install%generate-cmake-variant $(reqs) ] ; - r += [ install $(install-or-stage)-$(name)-config-variant.cmake : $(install-or-stage)/$(name)-variant.cmake : $(loc) $(requirements) ] ; + local v = [ generate $(install-or-stage)/$(name)-variant.cmake : $(name) : @boost-install%generate-cmake-variant $(reqs) ] ; + r += $(v) ; + r += [ install $(install-or-stage)-$(name)-config-variant.cmake : $(v) : $(loc) ] ; } } else @@ -1041,8 +1088,9 @@ local rule install-cmake-config- ( install-or-stage : version : name : requireme # install-or-stage-cmake-config # +# includedir, libdir, cmakedir should be in canonical path.make format -rule install-or-stage-cmake-config ( name * : install-or-stage ) +rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : libdir : cmakedir ) { local p = [ project.current ] ; @@ -1053,18 +1101,8 @@ rule install-or-stage-cmake-config ( name * : install-or-stage ) } else { - local reqs ; - if $(install-or-stage) = stage - { - local libdir = [ boost-install-dirs.stage-libdir ] ; - local includedir = [ path.make [ modules.peek boostcpp : BOOST_ROOT ] ] ; - reqs = $(libdir) $(includedir) ; - } - else - { - local subdir = [ boost-install-dirs.header-subdir ] ; - reqs = header-subdir=$(subdir) ; - } + includedir = [ path.relative-to $(cmakedir) $(includedir) ] ; + libdir = [ path.relative-to $(cmakedir) $(libdir) ] ; local BOOST_VERSION = [ modules.peek boostcpp : BOOST_VERSION ] ; @@ -1072,7 +1110,7 @@ rule install-or-stage-cmake-config ( name * : install-or-stage ) for local nm in $(name) { - configs += [ install-cmake-config- $(install-or-stage) : $(BOOST_VERSION) : $(nm) : $(reqs) ] ; + configs += [ install-cmake-config- $(install-or-stage) : $(cmakedir) : $(includedir) : $(libdir) : $(BOOST_VERSION) : $(nm) ] ; } # Target install/stage-detect-toolset @@ -1080,19 +1118,19 @@ rule install-or-stage-cmake-config ( name * : install-or-stage ) local boost-install-dir = [ modules.binding $(__name__) ] ; boost-install-dir = $(boost-install-dir:D) ; - install $(install-or-stage)-detect-toolset : $(boost-install-dir)/BoostDetectToolset.cmake : (cmakedir) BoostDetectToolset-$(BOOST_VERSION).cmake $(reqs) ; + install $(install-or-stage)-detect-toolset : $(boost-install-dir)/BoostDetectToolset.cmake : $(cmakedir) BoostDetectToolset-$(BOOST_VERSION).cmake ; $(p).mark-target-as-explicit $(install-or-stage)-detect-toolset ; # Target install/stage-boost-config - install $(install-or-stage)-boost-config : $(boost-install-dir)/BoostConfig.cmake : (cmakedir)/Boost-$(BOOST_VERSION) $(reqs) ; + install $(install-or-stage)-boost-config : $(boost-install-dir)/BoostConfig.cmake : $(cmakedir)/Boost-$(BOOST_VERSION) ; $(p).mark-target-as-explicit $(install-or-stage)-boost-config ; # Target install/stage-boost-config-version project.load [ path.make $(boost-install-dir) ] ; - install $(install-or-stage)-boost-config-version : /boost/tools/boost_install//BoostConfigVersion.cmake : (cmakedir)/Boost-$(BOOST_VERSION) $(reqs) ; + install $(install-or-stage)-boost-config-version : /boost/tools/boost_install//BoostConfigVersion.cmake : $(cmakedir)/Boost-$(BOOST_VERSION) ; $(p).mark-target-as-explicit $(install-or-stage)-boost-config-version ; # Target install/stage-cmake-config @@ -1108,12 +1146,26 @@ rule install-cmake-config ( name * ) { #.debug install-cmake-config $(name) ; - install-or-stage-cmake-config $(name) : install ; + local includedir = [ boost-install-dirs.includedir ] ; + local libdir = [ boost-install-dirs.libdir ] ; + local cmakedir = [ boost-install-dirs.cmakedir ] ; + local header-subdir = [ boost-install-dirs.header-subdir ] ; + + if $(header-subdir) + { + includedir = $(includedir)/$(header-subdir) ; + } + + install-or-stage-cmake-config $(name) : install : $(includedir) : $(libdir) : $(cmakedir) ; } rule stage-cmake-config ( name * ) { - install-or-stage-cmake-config $(name) : stage ; + local includedir = [ path.make [ modules.peek boostcpp : BOOST_ROOT ] ] ; + local libdir = [ boost-install-dirs.stage-libdir ] ; + local cmakedir = $(libdir)/cmake ; + + install-or-stage-cmake-config $(name) : stage : $(includedir) : $(libdir) : $(cmakedir) ; } # stage-cmake-config @@ -1192,7 +1244,7 @@ rule generate-dependencies ( project name ? : property-set : sources * ) # boost-install -rule install-subdir ( properties * ) +local rule install-stage-subdir ( properties * ) { local ps = [ property-set.create $(properties) ] ; @@ -1210,7 +1262,25 @@ rule install-subdir ( properties * ) r = $(r:B=$(r:B)-python$(python)) ; } - return (libdir)/$(r:E=) ; + return $(r) ; +} + +rule stage-subdir ( properties * ) +{ + local r = [ install-stage-subdir $(properties) ] ; + + local libdir = [ boost-install-dirs.stage-libdir ] ; + + return $(libdir)/$(r) ; +} + +rule install-subdir ( properties * ) +{ + local r = [ install-stage-subdir $(properties) ] ; + + local libdir = [ boost-install-dirs.libdir ] ; + + return $(libdir)/$(r) ; } rule boost-install ( libraries * ) @@ -1238,17 +1308,20 @@ rule boost-install ( libraries * ) local p = [ project.current ] ; - install install-libraries-static : $(libraries) : (libdir) on STATIC_LIB ; + local libdir = [ boost-install-dirs.libdir ] ; + local bindir = [ boost-install-dirs.bindir ] ; + + install install-libraries-static : $(libraries) : $(libdir) on STATIC_LIB ; $(p).mark-target-as-explicit install-libraries-static ; alias install-libraries-shared : install-libraries-shared- ; alias install-libraries-shared : install-libraries-shared-cygwin : cygwin ; $(p).mark-target-as-explicit install-libraries-shared ; - install install-libraries-shared- : $(libraries) : (libdir) SHARED_LIB PDB on on ; + install install-libraries-shared- : $(libraries) : $(libdir) SHARED_LIB PDB on on ; $(p).mark-target-as-explicit install-libraries-shared- ; - install install-libraries-shared-cygwin : $(libraries) : (bindir) SHARED_LIB PDB on on ; + install install-libraries-shared-cygwin : $(libraries) : $(bindir) SHARED_LIB PDB on on ; $(p).mark-target-as-explicit install-libraries-shared-cygwin ; install install-unprefixed-static : $(unprefixed) : STATIC_LIB @boost-install%install-subdir ; @@ -1268,20 +1341,19 @@ rule boost-install ( libraries * ) # Target stage local stage-libdir = [ boost-install-dirs.stage-libdir ] ; - local reqs = $(stage-libdir) ; stage-cmake-config $(libraries) ; - install stage-libraries-static : $(libraries) : (libdir) $(reqs) on STATIC_LIB ; + install stage-libraries-static : $(libraries) : $(stage-libdir) on STATIC_LIB ; $(p).mark-target-as-explicit stage-libraries-static ; - install stage-libraries-shared : $(libraries) : (libdir) $(reqs) on SHARED_LIB PDB on ; + install stage-libraries-shared : $(libraries) : $(stage-libdir) on SHARED_LIB PDB on ; $(p).mark-target-as-explicit stage-libraries-shared ; - install stage-unprefixed-static : $(unprefixed) : STATIC_LIB $(reqs) @boost-install%install-subdir ; + install stage-unprefixed-static : $(unprefixed) : STATIC_LIB @boost-install%stage-subdir ; $(p).mark-target-as-explicit stage-unprefixed-static ; - install stage-unprefixed-shared : $(unprefixed) : SHARED_LIB $(reqs) PDB on @boost-install%install-subdir ; + install stage-unprefixed-shared : $(unprefixed) : SHARED_LIB PDB on @boost-install%stage-subdir ; $(p).mark-target-as-explicit stage-unprefixed-shared ; generate stage-dependencies : $(libraries) : @boost-install%generate-dependencies stage ; From 3feb1aa8f6fbae660b5e9bdf2564c814fe534ce6 Mon Sep 17 00:00:00 2001 From: Dmitry Arkhipov Date: Thu, 16 May 2024 23:08:36 +0300 Subject: [PATCH 3/3] use install- features instead of package module --- Jamfile | 4 +- boost-install-dirs.jam | 55 +------- boost-install.jam | 283 +++++++++++++++++------------------------ 3 files changed, 125 insertions(+), 217 deletions(-) diff --git a/Jamfile b/Jamfile index 7d25aae..7ad3e6a 100644 --- a/Jamfile +++ b/Jamfile @@ -2,9 +2,11 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) +import make ; + project /boost/tools/boost_install ; # BoostConfigVersion.cmake -generate BoostConfigVersion.cmake : : @boost-install%generate-cmake-config-version Boost $(BOOST_VERSION) ; +make BoostConfigVersion.cmake : : @boost-install%make-cmake-config-version : $(BOOST_VERSION) ; explicit BoostConfigVersion.cmake ; diff --git a/boost-install-dirs.jam b/boost-install-dirs.jam index 5c9f3d4..5985152 100644 --- a/boost-install-dirs.jam +++ b/boost-install-dirs.jam @@ -6,60 +6,9 @@ import modules ; import boostcpp ; import package ; import path ; +import stage ; -# includedir - -rule includedir -{ - if ! $(.includedir) - { - local paths = [ package.paths Boost ] ; - .includedir = [ $(paths).includedir ] ; - } - - return $(.includedir) ; -} - -# bindir - -rule bindir -{ - if ! $(.bindir) - { - local paths = [ package.paths Boost ] ; - .bindir = [ $(paths).bindir ] ; - } - - return $(.bindir) ; -} - -# libdir - -rule libdir -{ - if ! $(.libdir) - { - local paths = [ package.paths Boost ] ; - .libdir = [ $(paths).libdir ] ; - } - - return $(.libdir) ; -} - -# cmakedir - -rule cmakedir -{ - if ! $(.cmakedir) - { - package.add-path-option cmakedir : cmake : libdir ; - - local paths = [ package.paths Boost ] ; - .cmakedir = [ $(paths).get cmakedir ] ; - } - - return $(.cmakedir) ; -} +stage.add-install-dir cmakedir : cmake : libdir ; # header-subdir diff --git a/boost-install.jam b/boost-install.jam index d2c645c..0808ae1 100644 --- a/boost-install.jam +++ b/boost-install.jam @@ -2,6 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) +import make ; import modules ; import boostcpp ; import property-set ; @@ -10,23 +11,16 @@ import project ; import common ; import print ; import os ; +import property ; import feature ; -import package ; import sequence ; import set ; +import stage ; import type ; import path ; import regex ; import ./boost-install-dirs ; -feature.feature library-type : : free ; -feature.feature boost-install.dependency : : free ; -feature.feature boost-install.cmakedir : : free ; -feature.feature boost-install.includedir : : free ; -feature.feature boost-install.libdir : : free ; -feature.feature boost-install.lib-target-type : : free ; -feature.feature boost-install.dll-target : : free ; - if "--verbose" in [ modules.peek : ARGV ] { .info-enabled = 1 ; @@ -53,6 +47,19 @@ local rule .debug ( messages * ) } } +local rule flags-to-vars ( ps ) +{ + for local opt in [ $(ps).get ] + { + local match = [ MATCH (.*)=(.*) : $(opt) ] ; + if $(match) + { + # assigns to variables which assumed to exist in outside scope + $(match[1]) += $(match[2-]) ; + } + } +} + # generate-cmake-variant- local rule remap-library ( lib ) @@ -116,12 +123,19 @@ rule generate-cmake-variant- ( target : sources * : properties * ) local ps = [ property-set.create $(properties) ] ; + local project ; + local name ; + local library-type ; + local lib-target-type ; + local dll-target ; + local dependency ; + flags-to-vars $(ps) ; + print.output $(target) ; local version = [ $(ps).get ] ; .info " version=" $(version) ; - local name = [ $(ps).get ] ; .info " name=" $(name) ; local variant = [ $(ps).get ] ; @@ -433,7 +447,6 @@ rule generate-cmake-variant- ( target : sources * : properties * ) print.text "# Target file name: $(fname)" "" : true ; - local lib-target-type = [ $(ps).get ] ; .info " lib-target-type=" $(lib-target-type) ; local loc-prop = LOCATION ; @@ -445,8 +458,6 @@ rule generate-cmake-variant- ( target : sources * : properties * ) .info " loc-prop=" $(loc-prop) ; - local dll-target = [ $(ps).get ] ; - local dll-name ; if $(dll-target) @@ -507,7 +518,7 @@ rule generate-cmake-variant- ( target : sources * : properties * ) : true ; } - local deps = [ MATCH "boost_(.*)" : [ $(ps).get ] ] headers ; + local deps = [ MATCH "boost_(.*)" : $(dependency) ] headers ; .info " deps=" $(deps) ; if $(deps) @@ -519,7 +530,7 @@ rule generate-cmake-variant- ( target : sources * : properties * ) : true ; } - local deps2 = [ set.difference [ $(ps).get ] : boost_$(deps) ] ; + local deps2 = [ set.difference $(dependency) : boost_$(deps) ] ; .info " deps2=" $(deps2) ; local deps3 ; @@ -547,10 +558,6 @@ rule generate-cmake-variant- ( target : sources * : properties * ) } } -actions generate-cmake-variant- -{ -} - # tag local rule tag ( name : type ? : property-set ) @@ -655,7 +662,7 @@ rule generate-cmake-variant ( project name : property-set : sources * ) local dll-target = [ get-dll-target $(sources) ] ; local other-names = [ get-dependency-names $(sources) ] ; - property-set = [ $(property-set).add-raw $(other-names) ] ; + property-set = [ $(property-set).add-raw dependency=$(other-names) ] ; local result ; @@ -672,13 +679,13 @@ rule generate-cmake-variant ( project name : property-set : sources * ) .debug " dll-target=" [ $(dll-target).name ] ; } - local tag = [ tag $(name) : : $(property-set) ] ; - - property-set = [ $(property-set).add-raw $(lib-target-type) ] ; - property-set = [ $(property-set).add-raw $(dll-target) ] ; + property-set = [ $(property-set).add-raw lib-target-type=$(lib-target-type) ] ; + property-set = [ $(property-set).add-raw dll-target=$(dll-target) ] ; local a = [ new non-scanning-action $(lib-target) : boost-install.generate-cmake-variant- : $(property-set) ] ; + local tag = [ tag $(name) : : $(property-set) ] ; + result += [ new file-target $(tag) : : $(project) : $(a) ] ; } @@ -725,30 +732,41 @@ local rule get-dir ( name : dir ) } } -rule generate-cmake-config- ( target : sources * : properties * ) +# make-cmake-config + +rule make-cmake-config ( target : sources * : properties * ) { - .info generate-cmake-config- $(target) ":" $(sources) ; + .info make-cmake-config $(target) ":" $(sources) ; local ps = [ property-set.create $(properties) ] ; + local name ; + local library-type ; + local header-subdir ; + flags-to-vars $(ps) ; + print.output $(target) ; local version = [ $(ps).get ] ; .info " version=" $(version) ; - local name = [ $(ps).get ] ; .info " name=" $(name) ; - local library-type = [ $(ps).get ] ; .info " library-type=" $(library-type) ; - local cmakedir = [ $(ps).get ] ; + local cmakedir = [ stage.get-dir cmakedir : $(ps) : Boost ] ; + .info " prefix=" [ stage.get-dir prefix : $(ps) : Boost ] ; + .info " exec-prefix=" [ stage.get-dir exec-prefix : $(ps) : Boost ] ; + .info " libdir=" [ stage.get-dir libdir : $(ps) : Boost ] ; .info " cmakedir=" $(cmakedir) ; - local includedir = [ $(ps).get ] ; + local includedir = [ stage.get-dir includedir : $(ps) : Boost ] ; + includedir = [ path.join $(includedir) $(header-subdir) ] ; + includedir = [ path.relative-to $(cmakedir) $(includedir) ] ; .info " includedir=" $(includedir) ; - local libdir = [ $(ps).get ] ; + local libdir = [ stage.get-dir libdir : $(ps) : Boost ] ; + libdir = [ path.relative-to $(cmakedir) $(libdir) ] ; .info " libdir=" $(libdir) ; local lname = [ MATCH boost_(.*) : $(name) ] ; @@ -952,51 +970,14 @@ rule generate-cmake-config- ( target : sources * : properties * ) } } -actions generate-cmake-config- +# make-cmake-config-version + +rule make-cmake-config-version ( target : sources * : properties * ) { -} + .info make-cmake-config-version $(target) ":" $(sources) ; -# generate-cmake-config - -rule generate-cmake-config ( project name : property-set : sources * ) -{ - .debug generate-cmake-config $(name) ; - - local pname = [ $(property-set).get ] ; - local version = [ $(property-set).get ] ; - local location = [ $(property-set).get ] ; - local library-type = [ $(property-set).get ] ; - local cmakedir = [ $(property-set).get ] ; - local includedir = [ $(property-set).get ] ; - local libdir = [ $(property-set).get ] ; - - local ps = [ property-set.create - $(pname) $(version) $(location) - $(library-type) - $(cmakedir) - $(includedir) - $(libdir) ] ; - - local result ; - - local a = [ new non-scanning-action : boost-install.generate-cmake-config- : $(ps) ] ; - - result += [ new file-target $(name) : : $(project) : $(a) ] ; - - return $(result) ; -} - -# generate-cmake-config-version- - -rule generate-cmake-config-version- ( target : sources * : properties * ) -{ - .info generate-cmake-config-version- $(target) ":" $(sources) ; - - local ps = [ property-set.create $(properties) ] ; - - print.output $(target) ; - - local version = [ $(ps).get ] ; + local version = [ property.select : $(properties) ] ; + local version = $(version:G=) ; .info " version=" $(version) ; print.output $(target) ; @@ -1019,34 +1000,9 @@ rule generate-cmake-config-version- ( target : sources * : properties * ) : true ; } -actions generate-cmake-config-version- -{ -} - -# generate-cmake-config-version - -rule generate-cmake-config-version ( project name : property-set : sources * ) -{ - .debug generate-cmake-config-version $(name) ; - - local pname = [ $(property-set).get ] ; - local version = [ $(property-set).get ] ; - local location = [ $(property-set).get ] ; - - local ps = [ property-set.create $(pname) $(version) $(location) ] ; - - local result ; - - local a = [ new non-scanning-action : boost-install.generate-cmake-config-version- : $(ps) ] ; - - result += [ new file-target $(name) : : $(project) : $(a) ] ; - - return $(result) ; -} - # install-cmake-config- -local rule install-cmake-config- ( install-or-stage : location : includedir : libdir : version : name ) +local rule install-cmake-config- ( install-or-stage : version : name : requirements * ) { #.debug install-cmake-config- $(name) ; @@ -1054,7 +1010,7 @@ local rule install-cmake-config- ( install-or-stage : location : includedir : li if [ MATCH boost_(.*) : $(name) ] { - local loc = $(location)/$(name)-$(version) ; + local loc = (cmakedir)/$(name)-$(version) ; local library-type = UNKNOWN ; @@ -1063,19 +1019,18 @@ local rule install-cmake-config- ( install-or-stage : location : includedir : li library-type = INTERFACE ; } - local reqs = $(name) $(version) $(library-type) $(location) $(includedir) $(libdir) ; + local reqs = $(version) library-type=$(library-type) name=$(name) ; - r += [ generate $(install-or-stage)/$(name)-config.cmake : $(name) : @boost-install%generate-cmake-config $(reqs) ] ; - r += [ install $(install-or-stage)-$(name)-config.cmake : $(install-or-stage)/$(name)-config.cmake : $(loc) ] ; + r += [ make $(install-or-stage)/$(name)-config.cmake : $(name) : @boost-install%make-cmake-config : $(reqs) $(requirements) ] ; + r += [ install $(install-or-stage)-$(name)-config.cmake : $(install-or-stage)/$(name)-config.cmake : $(loc) $(requirements) ] ; - r += [ generate $(install-or-stage)/$(name)-config-version.cmake : $(name) : @boost-install%generate-cmake-config-version $(reqs) ] ; - r += [ install $(install-or-stage)-$(name)-config-version.cmake : $(install-or-stage)/$(name)-config-version.cmake : $(loc) ] ; + r += [ make $(install-or-stage)/$(name)-config-version.cmake : $(name) : @boost-install%make-cmake-config-version : $(reqs) $(requirements) ] ; + r += [ install $(install-or-stage)-$(name)-config-version.cmake : $(install-or-stage)/$(name)-config-version.cmake : $(loc) $(requirements) ] ; if $(library-type) != INTERFACE { - local v = [ generate $(install-or-stage)/$(name)-variant.cmake : $(name) : @boost-install%generate-cmake-variant $(reqs) ] ; - r += $(v) ; - r += [ install $(install-or-stage)-$(name)-config-variant.cmake : $(v) : $(loc) ] ; + r += [ generate $(install-or-stage)/$(name)-variant.cmake : $(name) : @boost-install%generate-cmake-variant $(reqs) ] ; + r += [ install $(install-or-stage)-$(name)-config-variant.cmake : $(install-or-stage)/$(name)-variant.cmake : $(loc) $(requirements) ] ; } } else @@ -1088,9 +1043,8 @@ local rule install-cmake-config- ( install-or-stage : location : includedir : li # install-or-stage-cmake-config # -# includedir, libdir, cmakedir should be in canonical path.make format -rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : libdir : cmakedir ) +rule install-or-stage-cmake-config ( name * : install-or-stage ) { local p = [ project.current ] ; @@ -1101,8 +1055,18 @@ rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : li } else { - includedir = [ path.relative-to $(cmakedir) $(includedir) ] ; - libdir = [ path.relative-to $(cmakedir) $(libdir) ] ; + local reqs ; + if $(install-or-stage) = stage + { + local libdir = [ boost-install-dirs.stage-libdir ] ; + local includedir = [ path.make [ modules.peek boostcpp : BOOST_ROOT ] ] ; + reqs = $(libdir) $(includedir) ; + } + else + { + local subdir = [ boost-install-dirs.header-subdir ] ; + reqs = header-subdir=$(subdir) ; + } local BOOST_VERSION = [ modules.peek boostcpp : BOOST_VERSION ] ; @@ -1110,7 +1074,7 @@ rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : li for local nm in $(name) { - configs += [ install-cmake-config- $(install-or-stage) : $(cmakedir) : $(includedir) : $(libdir) : $(BOOST_VERSION) : $(nm) ] ; + configs += [ install-cmake-config- $(install-or-stage) : $(BOOST_VERSION) : $(nm) : $(reqs) ] ; } # Target install/stage-detect-toolset @@ -1118,19 +1082,19 @@ rule install-or-stage-cmake-config ( name * : install-or-stage : includedir : li local boost-install-dir = [ modules.binding $(__name__) ] ; boost-install-dir = $(boost-install-dir:D) ; - install $(install-or-stage)-detect-toolset : $(boost-install-dir)/BoostDetectToolset.cmake : $(cmakedir) BoostDetectToolset-$(BOOST_VERSION).cmake ; + install $(install-or-stage)-detect-toolset : $(boost-install-dir)/BoostDetectToolset.cmake : (cmakedir) BoostDetectToolset-$(BOOST_VERSION).cmake $(reqs) ; $(p).mark-target-as-explicit $(install-or-stage)-detect-toolset ; # Target install/stage-boost-config - install $(install-or-stage)-boost-config : $(boost-install-dir)/BoostConfig.cmake : $(cmakedir)/Boost-$(BOOST_VERSION) ; + install $(install-or-stage)-boost-config : $(boost-install-dir)/BoostConfig.cmake : (cmakedir)/Boost-$(BOOST_VERSION) $(reqs) ; $(p).mark-target-as-explicit $(install-or-stage)-boost-config ; # Target install/stage-boost-config-version project.load [ path.make $(boost-install-dir) ] ; - install $(install-or-stage)-boost-config-version : /boost/tools/boost_install//BoostConfigVersion.cmake : $(cmakedir)/Boost-$(BOOST_VERSION) ; + install $(install-or-stage)-boost-config-version : /boost/tools/boost_install//BoostConfigVersion.cmake : (cmakedir)/Boost-$(BOOST_VERSION) $(reqs) ; $(p).mark-target-as-explicit $(install-or-stage)-boost-config-version ; # Target install/stage-cmake-config @@ -1146,26 +1110,12 @@ rule install-cmake-config ( name * ) { #.debug install-cmake-config $(name) ; - local includedir = [ boost-install-dirs.includedir ] ; - local libdir = [ boost-install-dirs.libdir ] ; - local cmakedir = [ boost-install-dirs.cmakedir ] ; - local header-subdir = [ boost-install-dirs.header-subdir ] ; - - if $(header-subdir) - { - includedir = $(includedir)/$(header-subdir) ; - } - - install-or-stage-cmake-config $(name) : install : $(includedir) : $(libdir) : $(cmakedir) ; + install-or-stage-cmake-config $(name) : install ; } rule stage-cmake-config ( name * ) { - local includedir = [ path.make [ modules.peek boostcpp : BOOST_ROOT ] ] ; - local libdir = [ boost-install-dirs.stage-libdir ] ; - local cmakedir = $(libdir)/cmake ; - - install-or-stage-cmake-config $(name) : stage : $(includedir) : $(libdir) : $(cmakedir) ; + install-or-stage-cmake-config $(name) : stage ; } # stage-cmake-config @@ -1244,7 +1194,7 @@ rule generate-dependencies ( project name ? : property-set : sources * ) # boost-install -local rule install-stage-subdir ( properties * ) +rule install-subdir ( properties * ) { local ps = [ property-set.create $(properties) ] ; @@ -1262,25 +1212,7 @@ local rule install-stage-subdir ( properties * ) r = $(r:B=$(r:B)-python$(python)) ; } - return $(r) ; -} - -rule stage-subdir ( properties * ) -{ - local r = [ install-stage-subdir $(properties) ] ; - - local libdir = [ boost-install-dirs.stage-libdir ] ; - - return $(libdir)/$(r) ; -} - -rule install-subdir ( properties * ) -{ - local r = [ install-stage-subdir $(properties) ] ; - - local libdir = [ boost-install-dirs.libdir ] ; - - return $(libdir)/$(r) ; + return (libdir)/$(r:E=) ; } rule boost-install ( libraries * ) @@ -1308,20 +1240,17 @@ rule boost-install ( libraries * ) local p = [ project.current ] ; - local libdir = [ boost-install-dirs.libdir ] ; - local bindir = [ boost-install-dirs.bindir ] ; - - install install-libraries-static : $(libraries) : $(libdir) on STATIC_LIB ; + install install-libraries-static : $(libraries) : (libdir) on STATIC_LIB ; $(p).mark-target-as-explicit install-libraries-static ; alias install-libraries-shared : install-libraries-shared- ; alias install-libraries-shared : install-libraries-shared-cygwin : cygwin ; $(p).mark-target-as-explicit install-libraries-shared ; - install install-libraries-shared- : $(libraries) : $(libdir) SHARED_LIB PDB on on ; + install install-libraries-shared- : $(libraries) : (libdir) SHARED_LIB PDB on on ; $(p).mark-target-as-explicit install-libraries-shared- ; - install install-libraries-shared-cygwin : $(libraries) : $(bindir) SHARED_LIB PDB on on ; + install install-libraries-shared-cygwin : $(libraries) : (bindir) SHARED_LIB PDB on on ; $(p).mark-target-as-explicit install-libraries-shared-cygwin ; install install-unprefixed-static : $(unprefixed) : STATIC_LIB @boost-install%install-subdir ; @@ -1341,19 +1270,20 @@ rule boost-install ( libraries * ) # Target stage local stage-libdir = [ boost-install-dirs.stage-libdir ] ; + local reqs = $(stage-libdir) ; stage-cmake-config $(libraries) ; - install stage-libraries-static : $(libraries) : $(stage-libdir) on STATIC_LIB ; + install stage-libraries-static : $(libraries) : (libdir) $(reqs) on STATIC_LIB ; $(p).mark-target-as-explicit stage-libraries-static ; - install stage-libraries-shared : $(libraries) : $(stage-libdir) on SHARED_LIB PDB on ; + install stage-libraries-shared : $(libraries) : (libdir) $(reqs) on SHARED_LIB PDB on ; $(p).mark-target-as-explicit stage-libraries-shared ; - install stage-unprefixed-static : $(unprefixed) : STATIC_LIB @boost-install%stage-subdir ; + install stage-unprefixed-static : $(unprefixed) : STATIC_LIB $(reqs) @boost-install%install-subdir ; $(p).mark-target-as-explicit stage-unprefixed-static ; - install stage-unprefixed-shared : $(unprefixed) : SHARED_LIB PDB on @boost-install%stage-subdir ; + install stage-unprefixed-shared : $(unprefixed) : SHARED_LIB $(reqs) PDB on @boost-install%install-subdir ; $(p).mark-target-as-explicit stage-unprefixed-shared ; generate stage-dependencies : $(libraries) : @boost-install%generate-dependencies stage ; @@ -1362,3 +1292,30 @@ rule boost-install ( libraries * ) alias stage : stage-libraries-static stage-libraries-shared stage-unprefixed-static stage-unprefixed-shared stage-cmake-config stage-dependencies ; $(p).mark-target-as-explicit stage ; } + +# If --{parent} is explicitly specified on the command line, then we need to +# clear every dir setting in config files that depends on it +if [ MATCH --prefix=(.*) : [ modules.peek : ARGV ] ] +{ + option.set exec-prefix : ; + option.set bindir : ; + option.set libdir : ; + option.set includedir : ; + option.set datadir : ; + option.set datarootdir : ; + option.set cmakedir : ; +} +if [ MATCH --exec-prefix=(.*) : [ modules.peek : ARGV ] ] +{ + option.set bindir : ; + option.set libdir : ; + option.set cmakedir : ; +} +if [ MATCH --libdir-prefix=(.*) : [ modules.peek : ARGV ] ] +{ + option.set cmakedir : ; +} +if [ MATCH --dataroot-prefix=(.*) : [ modules.peek : ARGV ] ] +{ + option.set datadir : ; +}