ImageRules: do not include catalogs from .so in dependencies

The rule to add an executable or shared library to the Haiku image
automatically also includes the corresponding locale catalogs and MIME
database entries.

The locale catalogs for .a files linked in the executable are also
included, since .a files are not themselves added to the same package.
This makes sure the executable has all the catalogs it needs.

The jam rule was written assuming that NEEDLIBS would only contain .a
files, but that is not the case when compiling Haiku. Libroot for
example is also in NEEDLIBS (this makes sure it is linked by absolute
file path, whereas LINKLIBS would instead use -lroot and may link the
host system one).

Rewrite the rule to include catalogs from the selected target and only
its .a dependencies.

Fixes #19721.

Change-Id: I0315476030d2e6e4dea574bb5f254ce9b442f556
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10563
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
PulkoMandy
2026-03-23 00:16:01 +00:00
committed by Adrien Destugues
parent 4660bcfbab
commit 30a96490a0
+18 -11
View File
@@ -271,19 +271,26 @@ rule AddFilesToContainer container : directoryTokens : targets : destName
$(installTargetsVar) on $(target) += $(destTarget) ;
TARGETS_TO_INSTALL on $(directory) += $(destTarget) ;
# If the target and its static libraries are associated with catalog
# files, add those, too.
local catalogTargets = $(target) + [ on $(target) return $(NEEDLIBS) ] ;
local catalogs = [ on $(target) return $(HAIKU_CATALOG_FILES) ] ;
if $(catalogs) {
local signature = [ on $(target) return $(HAIKU_CATALOG_SIGNATURE) ] ;
AddFilesToContainer $(container)
: $(systemDirTokens) data locale catalogs $(signature)
: $(catalogs) ;
}
# If the target static libraries are associated with catalog files, add those, too.
local catalogTargets = [ on $(target) return $(NEEDLIBS) ] ;
for catalogTarget in $(catalogTargets) {
local catalogs
= [ on $(catalogTarget) return $(HAIKU_CATALOG_FILES) ] ;
if $(catalogs) {
local signature
= [ on $(catalogTarget)
if $(catalogTarget:S) = .a {
local catalogs = [ on $(catalogTarget) return $(HAIKU_CATALOG_FILES) ] ;
if $(catalogs) {
local signature = [ on $(catalogTarget)
return $(HAIKU_CATALOG_SIGNATURE) ] ;
AddFilesToContainer $(container)
: $(systemDirTokens) data locale catalogs $(signature)
: $(catalogs) ;
AddFilesToContainer $(container)
: $(systemDirTokens) data locale catalogs $(signature)
: $(catalogs) ;
}
}
}