From 4dfabbe888b91cfab20444a35656bf4fc1b368ea Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Fri, 13 Sep 2002 16:01:35 +0000 Subject: [PATCH] Implemented "better" copying by the stage rule. This makes it so that it copies additional targets generated by links. This is for getting better support of SONAMES in the stage directories. [SVN r15304] --- allyourbase.jam | 14 ++++++++++++++ boost-base.jam | 33 ++++++++++++++++++++++++++++----- gcc-tools.jam | 5 +++++ v1/allyourbase.jam | 14 ++++++++++++++ v1/boost-base.jam | 33 ++++++++++++++++++++++++++++----- v1/gcc-tools.jam | 5 +++++ 6 files changed, 94 insertions(+), 10 deletions(-) diff --git a/allyourbase.jam b/allyourbase.jam index e1477f493..130f23f07 100644 --- a/allyourbase.jam +++ b/allyourbase.jam @@ -417,6 +417,8 @@ AS ?= as ; ASFLAGS ?= ; AWK ?= awk ; BINDIR ?= /usr/local/bin ; +CLONE ?= $(CP) ; +CLONE ?= cp -fdp ; CP ?= cp -f ; CRELIB ?= ; DOT ?= . ; @@ -634,6 +636,13 @@ rule File Chmod $(<) ; } +rule FileClone +{ + type-DEPENDS files : $(<) ; + DEPENDS $(<) : $(>) ; + SEARCH on $(>) = $(SEARCH_SOURCE) ; +} + rule Fortran { DEPENDS $(<) : $(>) ; @@ -1971,6 +1980,11 @@ actions File $(CP) $(>) $(<) } +actions FileClone +{ + $(CLONE) $(>) $(<) +} + actions GenFile1 { $(>[1]) $(<) $(>[2-]) diff --git a/boost-base.jam b/boost-base.jam index 5bcfa4c87..1e85f7f1f 100644 --- a/boost-base.jam +++ b/boost-base.jam @@ -170,20 +170,28 @@ rule main-from-objects ( targets * : objects * : type ) MODE on $(<) = $($(type)MODE) ; local link-function = Link-$(type) ; - local ignored = [ $(link-function) $(<) : $(>) : $(3) ] ; + local extra-files = [ $(link-function) $(<) : $(>) : $(3) ] ; Chmod $(<[1]) ; DEPENDS $(<) : $(>) ; + + # locate and attach the extra files generated + MakeLocate $(extra-files) : $(LOCATE_TARGET) ; + DEPENDS $(<[2-]) $(extra-files) : $(<[1]) ; + + gFILES($(<[1])) = $(<) $(extra-files) ; } rule Link-EXE { # N.B. By the time this rule is invoked, we had better have gRUN_PATH completely set. - Link-action $(<) : $(>) : EXE ; + local extra-files = [ Link-action $(<) : $(>) : EXE ] ; RUN_PATH on $(<) = [ join [ unique $(gRUN_PATH($(<))) $(gTOOLSET_LIB_PATH) ] : $(SPLITPATH) ] ; if $(UNIX) { RUN_LD_LIBRARY_PATH on $(<) = [ join $(gRUN_LD_LIBRARY_PATH($(<))) : $(SPLITPATH) ] ; } + + return $(extra-files) ; } rule Link-DLL @@ -200,7 +208,7 @@ rule Link-DLL } } - Link-action $(<) : $(>) : DLL ; + return [ Link-action $(<) : $(>) : DLL ] ; } rule Aix-Implib-Action @@ -1961,7 +1969,15 @@ rule rename-target ( target + : subvariant * : tags * ) local postfix-tag = [ get-values : $(tag-values) $(TAG(postfix):G=postfix) ] ; tag-text = $(tag-text)$(postfix-tag[1]) ; - local renamed-target = $(target:B=$(target:B)$(tag-text)) ; + local renamed-target = ; + for t in $(target) + { + local B-S = [ MATCH ([^\\.]*)(.*) : $(t:G=) ] ; + local B = $(B-S[1]) ; B ?= "" ; + local S = $(B-S[2]) ; S ?= "" ; + local new-name = $(B)$(tag-text)$(S) ; new-name = $(new-name:G=$(t:G)) ; + renamed-target += $(new-name) ; + } return $(renamed-target) ; } @@ -2063,7 +2079,14 @@ rule stage ( name : sources + : requirements * : local-build * ) [ subvariant-target $(s-target) : $(s-properties) : $(s-toolset) $(s-variant) ] ; } + local sv-files = ; for local sv in $(target-subvariant) + { + local files = $(gFILES($(target-subvariant))) ; + files ?= $(target-subvariant) ; + sv-files += $(files) ; + } + for local sv in $(sv-files) { local renamed-target = [ rename-target $(sv) : [ split-path $(s-properties[1]) ] : $(tags) ] ; @@ -2094,7 +2117,7 @@ rule stage ( name : sources + : requirements * : local-build * ) if $(file-mode($(file))) { FILEMODE = $(file-mode($(file))) ; } MakeLocate $(destination-file) : [ FDirName [ split-path $(LOCATE_TARGET)/$(stage-dir) ] ] ; - File $(destination-file) : $(file) ; + FileClone $(destination-file) : $(file) ; } } declare-fake-targets $(stage-id) : $(destination-files) ; diff --git a/gcc-tools.jam b/gcc-tools.jam index 163cb32a8..948bafadc 100644 --- a/gcc-tools.jam +++ b/gcc-tools.jam @@ -322,6 +322,11 @@ rule Link-action } gcc-Link-action $(<) : $(>) ; + + if $(DLLVERSION) && $(TARGET_TYPE) in $(SHARED_TYPES) && $(OS) = LINUX && ! $(NO_GNU_LN) + { + return "$(<[1]).$(DLLVERSION)" ; + } } } diff --git a/v1/allyourbase.jam b/v1/allyourbase.jam index e1477f493..130f23f07 100644 --- a/v1/allyourbase.jam +++ b/v1/allyourbase.jam @@ -417,6 +417,8 @@ AS ?= as ; ASFLAGS ?= ; AWK ?= awk ; BINDIR ?= /usr/local/bin ; +CLONE ?= $(CP) ; +CLONE ?= cp -fdp ; CP ?= cp -f ; CRELIB ?= ; DOT ?= . ; @@ -634,6 +636,13 @@ rule File Chmod $(<) ; } +rule FileClone +{ + type-DEPENDS files : $(<) ; + DEPENDS $(<) : $(>) ; + SEARCH on $(>) = $(SEARCH_SOURCE) ; +} + rule Fortran { DEPENDS $(<) : $(>) ; @@ -1971,6 +1980,11 @@ actions File $(CP) $(>) $(<) } +actions FileClone +{ + $(CLONE) $(>) $(<) +} + actions GenFile1 { $(>[1]) $(<) $(>[2-]) diff --git a/v1/boost-base.jam b/v1/boost-base.jam index 5bcfa4c87..1e85f7f1f 100644 --- a/v1/boost-base.jam +++ b/v1/boost-base.jam @@ -170,20 +170,28 @@ rule main-from-objects ( targets * : objects * : type ) MODE on $(<) = $($(type)MODE) ; local link-function = Link-$(type) ; - local ignored = [ $(link-function) $(<) : $(>) : $(3) ] ; + local extra-files = [ $(link-function) $(<) : $(>) : $(3) ] ; Chmod $(<[1]) ; DEPENDS $(<) : $(>) ; + + # locate and attach the extra files generated + MakeLocate $(extra-files) : $(LOCATE_TARGET) ; + DEPENDS $(<[2-]) $(extra-files) : $(<[1]) ; + + gFILES($(<[1])) = $(<) $(extra-files) ; } rule Link-EXE { # N.B. By the time this rule is invoked, we had better have gRUN_PATH completely set. - Link-action $(<) : $(>) : EXE ; + local extra-files = [ Link-action $(<) : $(>) : EXE ] ; RUN_PATH on $(<) = [ join [ unique $(gRUN_PATH($(<))) $(gTOOLSET_LIB_PATH) ] : $(SPLITPATH) ] ; if $(UNIX) { RUN_LD_LIBRARY_PATH on $(<) = [ join $(gRUN_LD_LIBRARY_PATH($(<))) : $(SPLITPATH) ] ; } + + return $(extra-files) ; } rule Link-DLL @@ -200,7 +208,7 @@ rule Link-DLL } } - Link-action $(<) : $(>) : DLL ; + return [ Link-action $(<) : $(>) : DLL ] ; } rule Aix-Implib-Action @@ -1961,7 +1969,15 @@ rule rename-target ( target + : subvariant * : tags * ) local postfix-tag = [ get-values : $(tag-values) $(TAG(postfix):G=postfix) ] ; tag-text = $(tag-text)$(postfix-tag[1]) ; - local renamed-target = $(target:B=$(target:B)$(tag-text)) ; + local renamed-target = ; + for t in $(target) + { + local B-S = [ MATCH ([^\\.]*)(.*) : $(t:G=) ] ; + local B = $(B-S[1]) ; B ?= "" ; + local S = $(B-S[2]) ; S ?= "" ; + local new-name = $(B)$(tag-text)$(S) ; new-name = $(new-name:G=$(t:G)) ; + renamed-target += $(new-name) ; + } return $(renamed-target) ; } @@ -2063,7 +2079,14 @@ rule stage ( name : sources + : requirements * : local-build * ) [ subvariant-target $(s-target) : $(s-properties) : $(s-toolset) $(s-variant) ] ; } + local sv-files = ; for local sv in $(target-subvariant) + { + local files = $(gFILES($(target-subvariant))) ; + files ?= $(target-subvariant) ; + sv-files += $(files) ; + } + for local sv in $(sv-files) { local renamed-target = [ rename-target $(sv) : [ split-path $(s-properties[1]) ] : $(tags) ] ; @@ -2094,7 +2117,7 @@ rule stage ( name : sources + : requirements * : local-build * ) if $(file-mode($(file))) { FILEMODE = $(file-mode($(file))) ; } MakeLocate $(destination-file) : [ FDirName [ split-path $(LOCATE_TARGET)/$(stage-dir) ] ] ; - File $(destination-file) : $(file) ; + FileClone $(destination-file) : $(file) ; } } declare-fake-targets $(stage-id) : $(destination-files) ; diff --git a/v1/gcc-tools.jam b/v1/gcc-tools.jam index 163cb32a8..948bafadc 100644 --- a/v1/gcc-tools.jam +++ b/v1/gcc-tools.jam @@ -322,6 +322,11 @@ rule Link-action } gcc-Link-action $(<) : $(>) ; + + if $(DLLVERSION) && $(TARGET_TYPE) in $(SHARED_TYPES) && $(OS) = LINUX && ! $(NO_GNU_LN) + { + return "$(<[1]).$(DLLVERSION)" ; + } } }