* DoCatalogs:

- Cleaned up and prepared automatic globbing of the catkeys files.
    Currently commented out as it breaks the build.
  - Removed the AddFilesToHaikuImage invocation, which doesn't belong there.
    Instead we set the variable HAIKU_CATALOG_FILES on the target and
    automatically add the catalogs of a target in AddFilesToContainer.
* LinkApplicationCatalog: Pass the language name to the actions via variable.
  Fixes the "independent target" warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36002 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-03-29 21:36:00 +00:00
parent 063bb8051e
commit f29f258224
2 changed files with 58 additions and 36 deletions
+49 -36
View File
@@ -187,7 +187,7 @@ rule ResComp
local cc ; local cc ;
local defines ; local defines ;
local localIncludesOption ; local localIncludesOption ;
on $(1) { # use on $(1) variable values on $(1) { # use on $(1) variable values
defines = $(DEFINES) ; defines = $(DEFINES) ;
@@ -204,9 +204,9 @@ rule ResComp
DEFINES on $(1) = $(defines) ; DEFINES on $(1) = $(defines) ;
CCDEFS on $(1) = [ FDefines $(defines) ] ; CCDEFS on $(1) = [ FDefines $(defines) ] ;
HDRS on $(1) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) HDRS on $(1) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS)
: $(localIncludesOption) ] ; : $(localIncludesOption) ] ;
RCHDRS on $(1) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) RCHDRS on $(1) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS)
: "-I " ] ; : "-I " ] ;
CC on $(1) = $(cc) ; CC on $(1) = $(cc) ;
@@ -319,7 +319,7 @@ rule ExtractCatalogEntries target : source : signature
[ FSysIncludes $(sysHeaders) : $(systemIncludesOption) ] ; [ FSysIncludes $(sysHeaders) : $(systemIncludesOption) ] ;
CC on $(target) = $(cc) ; CC on $(target) = $(cc) ;
LOCALE_KIT_SIGNATURE on $(target) = $(signature) ; HAIKU_CATALOG_SIGNATURE on $(target) = $(signature) ;
SEARCH on $(source) += $(SEARCH_SOURCE) ; SEARCH on $(source) += $(SEARCH_SOURCE) ;
@@ -333,54 +333,67 @@ actions ExtractCatalogEntries1
{ {
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
cat "$(2[2-])" | $(CC) -E $(CCDEFS) $(HDRS) - > "$(1)".pre cat "$(2[2-])" | $(CC) -E $(CCDEFS) $(HDRS) - > "$(1)".pre
$(2[1]) -s $(LOCALE_KIT_SIGNATURE) -w -o "$(1)" "$(1)".pre $(2[1]) -s $(HAIKU_CATALOG_SIGNATURE) -w -o "$(1)" "$(1)".pre
} }
# Link catalog entries from given catkey file into output compiled catalog file.
# Compiled catalog file will then be copied into the image, but only if the
# fingerprint matches the one from the untranslated catalog for the same file.
rule LinkApplicationCatalog target : sources : signature : language rule LinkApplicationCatalog target : sources : signature : language
{ {
# Link catalog entries from given catkey file into output compiled catalog
# file. Compiled catalog file will then be copied into the image, but only
# if the fingerprint matches the one from the untranslated catalog for the
# same file.
MakeLocateArch $(target) ; MakeLocateArch $(target) ;
LOCALE_KIT_SIGNATURE on $(target) = $(signature) ;
Depends $(target) : $(sources) <build>linkcatkeys ; Depends $(target) : $(sources) <build>linkcatkeys ;
LocalClean clean : $(target) ; LocalClean clean : $(target) ;
LinkApplicationCatalog1 $(target)
: <build>linkcatkeys $(language) $(sources) ; HAIKU_CATALOG_SIGNATURE on $(target) = $(signature) ;
HAIKU_CATALOG_LANGUAGE on $(target) = $(language) ;
LinkApplicationCatalog1 $(target) : <build>linkcatkeys $(sources) ;
} }
actions LinkApplicationCatalog1 actions LinkApplicationCatalog1
{ {
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
$(2[1]) "$(2[3-])" -l $(2[2]:B) -v -s $(LOCALE_KIT_SIGNATURE) -o "$(1)" $(2[1]) "$(2[2-])" -l $(HAIKU_CATALOG_LANGUAGE) -v \
-s $(HAIKU_CATALOG_SIGNATURE) -o "$(1)"
} }
# General rules to invoke from jamfiles and that do (almost) everything related rule DoCatalogs appName : signature : sources : generatedCatalog
# to localization : translations
rule DoCatalogs appName # Application name # TODO: Remove when linkcatkeys works!
: signature # Application MIME signature (must match the one
# declared in the sourcecode)
: sources # List of cpp files where to search keys
: generatedCatalog # Name of the generated catalog (most probably
# en.catalog)
: translatedCatalogs # List of available translations
{ {
genCat = [ FGristFiles $(generatedCatalog) ] ; # General rules to invoke from jamfiles and that do (almost) everything related
trans = [ FGristFiles $(translatedCatalogs) ] ; # to localization
srcs = [ FGristFiles $(sources) ] ; #
SEARCH on $(trans) += [ FDirName $(HAIKU_TOP) data catalogs $(SUBDIR_TOKENS[2-]) ] ; # appName: Application name.
# signature: Application MIME signature (must match the one
# declared in the sourcecode).
# sources: List of cpp files where to search keys.
# generatedCatalog: Name of the generated catalog (most probably
# en.catalog).
ExtractCatalogEntries $(genCat:S=.catkeys) : $(srcs) : $(signature) ; generatedCatalog = [ FGristFiles $(generatedCatalog) ] ;
LinkApplicationCatalog $(genCat) : $(genCat:S=.catkeys) # generate catkeys file from sources
: $(signature) : $(genCat:B) ; ExtractCatalogEntries $(generatedCatalog:S=.catkeys)
: [ FGristFiles $(sources) ] : $(signature) ;
for catalog in $(trans)
{ # find translations
LinkApplicationCatalog $(catalog:S=.catalog) : $(catalog) local translationsDir
: $(signature) : $(catalog:B) ; = [ FDirName $(HAIKU_TOP) data catalogs $(SUBDIR_TOKENS[2-]) ] ;
# local translations = [ Glob $(translationsDir) : *.catkeys ] ;
# TODO: Enable when linkcatkeys works.
translations = [ FGristFiles $(translations:BS) ] ;
SEARCH on $(translations) += $(translationsDir) ;
# generate catalogs from all catkeys files
local catkeysFiles = $(generatedCatalog:S=.catkeys) $(translations) ;
for catkeysFile in $(catkeysFiles) {
LinkApplicationCatalog $(catkeysFile:S=.catalog) : $(catkeysFile)
: $(signature) : $(catkeysFile:B) ;
} }
AddFilesToHaikuImage system data locale catalogs $(signature) : HAIKU_CATALOG_FILES on $(appName) = $(catkeysFiles:S=.catalog) ;
$(genCat) $(trans:S=.catalog) ; HAIKU_CATALOG_SIGNATURE on $(appName) = $(signature) ;
} }
+9
View File
@@ -189,6 +189,15 @@ rule AddFilesToContainer container : directoryTokens : targets : destName
INSTALL_DIR on $(destTarget) = $(directory) ; INSTALL_DIR on $(destTarget) = $(directory) ;
$(installTargetsVar) on $(target) += $(destTarget) ; $(installTargetsVar) on $(target) += $(destTarget) ;
TARGETS_TO_INSTALL on $(directory) += $(destTarget) ; TARGETS_TO_INSTALL on $(directory) += $(destTarget) ;
# If the target is associated with catalog files, add those, too.
local catalogs = [ on $(target) return $(HAIKU_CATALOG_FILES) ] ;
if $(catalogs) {
local signature
= [ on $(target) return $(HAIKU_CATALOG_SIGNATURE) ] ;
AddFilesToHaikuImage system data locale catalogs $(signature)
: $(catalogs) ;
}
} }
} }