|
Boost-Build : |
Subject: [Boost-build] Generating an archive with both release and debug variants
From: longraider Gazeta.pl (longraider_at_[hidden])
Date: 2011-05-19 11:06:28
Hi
I'm using built-in install rules to produce a zip archive with devel
versions of libraries that I build:
#######################################################
rule define-install-target-dirs ( name : base )
{
bin-dir = [ path.join $(base) $(bin-subdir) ] ;
shared-dir = [ path.join $(base) $(shared-subdir) ] ;
static-dir = [ path.join $(base) $(static-subdir) ] ;
headers-dir = [ path.join $(base) $(headers-subdir) ] ;
}
rule register-install ( name : targets * : headers * : header-source-root ? )
{
...
#TODO make this path-mangling nicer somehow
local package-dir-dev = [ path.join [ path.pwd ] [ $(c).build-dir ] ] ;
package-dir-dev = [ MATCH (.*/)my-build(/.*) : $(package-dir-dev) ] ;
package-dir-dev = $(package-dir-dev:J=my-build-packages)/build-package ;
define-install-target-dirs $(name) : $(package-dir-dev) ;
install package-dev-prepare-bin : $(targets) :
<location>$(bin-dir) <install-type>EXE ;
install package-dev-prepare-shared : $(targets) :
<location>$(shared-dir) <install-type>SHARED_LIB ;
install package-dev-prepare-static : $(targets) :
<location>$(static-dir) <install-type>STATIC_LIB ;
install package-dev-prepare-headers : $(headers) :
<location>$(headers-dir) <install-source-root>$(header-source-root) ;
alias package-dev-prepare-r : package-dev-prepare-bin
package-dev-prepare-shared package-dev-prepare-static
package-dev-prepare-headers : <variant>release ;
alias package-dev-prepare-d : package-dev-prepare-bin
package-dev-prepare-shared package-dev-prepare-static
package-dev-prepare-headers : <variant>debug ;
make $(name)-dev-release.zip : package-dev-prepare-r :
@make-zip-package : <location>$(package-dir-dev) : <variant>release ;
make $(name)-dev-debug.zip : package-dev-prepare-d :
@make-zip-package : <location>$(package-dir-dev) : <variant>debug ;
make $(name)-dev.zip : package-dev-prepare-r
package-dev-prepare-d : @make-zip-package :
<location>$(package-dir-dev) ;
install package-dev-release : $(name)-dev-release.zip :
<location>$(packages-dir) ;
install package-dev-debug : $(name)-dev-debug.zip :
<location>$(packages-dir) ;
install package-dev : $(name)-dev.zip :
<location>$(packages-dir) ;
local project-module = [ $(c).project-module ] ;
module $(project-module)
{
...
explicit package-dev-prepare-bin package-dev-prepare-shared
package-dev-prepare-static package-dev-prepare-headers ;
explicit package-dev-prepare-r package-dev-prepare-d ;
explicit $(1)-dev-release.zip $(1)-dev-debug.zip $(1)-dev.zip ;
explicit package-dev-release package-dev-debug package-dev ;
}
}
rule make-zip-package ( targets * : sources * : properties * )
{
LOCATION on $(targets) = [ path.make [ MATCH <location>(.*) :
$(properties) ] ] ;
for s in $(sources)
{
local foo = [ path.make $(s) ] ;
foo = [ MATCH .*/build-package/(.*)>(.*) : $(foo) ] ;
new-sources on $(targets) += $(foo:J=/) ;
}
}
actions make-zip-package
{
cd $(LOCATION) && zip $(<) $(new-sources)
}
#######################################################
Everything works fine, the $(name)-dev-release.zip contains only the
release version of libraries, $(name)-dev-debug.zip - only the debug,
and $(name)-dev.zip - both.
However the problem is when I call the bjam with both release and
debug variants - the $(name)-dev.zip targets are obviously duplicate:
#error: Duplicate name of actual target:
<p/home/mati/docs/repos/filters/my-packages>foo-dev-debug.zip
This is of course a minor inconvenience, however a frustrating one.
Either I'm missing something or I have an error in the design.
Ideally I would want to generate a $(name)-dev-release.zip when
package-dev is called with release variant, a $(name)-dev-debug.zip
with debug variant and $(name)-dev.zip when both debug and release
variants are present.
Any help appreciated,
M.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk