build: Make LinkAgainst recursive for static libraries.

That is, it will now pull in NEEDLIBS and LINKLIBS set by LinkAgainst
from static libraries also built by Jam. This allows specifying what
libraries other static libraries need only once (in most cases;
occasionally things are not evaluated in a sane order and then
this does not quite work.)

Use this for libnetservices.a, which needs libshared.a, so that
dependencies on it do not have to be declared within most in-tree
consumers of libnetservices (e.g. Package Kit, http_streamer, etc.)
This commit is contained in:
Augustin Cavalier
2021-09-08 15:03:06 -04:00
parent 0c69dde91f
commit 03980b1fb0
2 changed files with 17 additions and 5 deletions
+15 -5
View File
@@ -508,6 +508,9 @@ rule LinkAgainst
local libs = $(2) ;
local mapLibs = $(3:E=true) ;
local linkLibs ;
local needLibs ;
on $(target) {
local i ;
@@ -525,11 +528,7 @@ rule LinkAgainst
libs = $(mappedLibs) ;
}
local linkLibs ;
local needLibs ;
for i in $(libs)
{
for i in $(libs) {
local isfile = ;
if $(i:D) || $(i:G) {
isfile = true ;
@@ -556,7 +555,18 @@ rule LinkAgainst
linkLibs += $(i) ;
}
}
}
# Copy in the library dependencies from any static libraries first.
# (We have to do the [ on ... ] outside the on { } block. )
for i in $(needLibs) {
if $(i:S) = .a {
needLibs += [ on $(i) return $(NEEDLIBS) ] ;
linkLibs += [ on $(i) return $(LINKLIBS) ] ;
}
}
on $(target) {
NEEDLIBS on $(1) = $(NEEDLIBS) $(needLibs) ;
LINKLIBS on $(1) = $(LINKLIBS) -l$(linkLibs) ;
@@ -66,6 +66,8 @@ for architectureObject in [ MultiArchSubDirSetup ] {
Geolocation.cpp
UrlResult.cpp
;
LinkAgainst [ MultiArchDefaultGristFiles libnetservices.a ] :
<$(architecture)>libshared.a ;
}
SEARCH on [ FGristFiles $(sources) ]