Complete MIME related support for image/package creation

* Update MimeSet rule to use the MIME DB the build system creates.
* Add CreateAppMimeDBEntries rule and call it from Link for targets that
  might be applications that need to be registered with the MIME DB. For
  the target the rule is invoked with it creates a directory into which
  the entries for the types to be registered are written. The directory
  is associated with the target via the HAIKU_MIME_DB_ENTRIES variable.
* AddFilesToContainer: If a target is added that has MIME DB entries,
  also add those to the container.
* build_haiku_package: Call mimeset for the package contents.
This commit is contained in:
Ingo Weinhold
2013-05-09 03:38:10 +02:00
parent f666576f62
commit 518840e305
5 changed files with 70 additions and 9 deletions
+37 -5
View File
@@ -163,20 +163,52 @@ actions SetType1
$(2[1]) -t $(TARGET_EXECUTABLE_MIME_TYPE) "$(1)" ; $(2[1]) -t $(TARGET_EXECUTABLE_MIME_TYPE) "$(1)" ;
} }
rule MimeSet rule MimeSet target
{ {
# MimeSet <target> # MimeSet <target> ;
Depends $(1) : <build>mimeset ; Depends $(target) : <build>mimeset <mimedb>mime_db ;
MimeSet1 $(1) : <build>mimeset ; MimeSet1 $(target) : <build>mimeset <mimedb>mime_db ;
} }
actions MimeSet1 actions MimeSet1
{ {
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
$(2[1]) -f "$(1)" ; $(2[1]) -f --mimedb "$(2[2])" "$(1)"
} }
rule CreateAppMimeDBEntries target
{
# MimeSetApp <target> ;
# Create the app meta MIME DB entries for the given target. The
# HAIKU_MIME_DB_ENTRIES variable on <target> is set to the generated
# resulting target directory that contains the MIME DB entries.
local appGrist = $(target:G) ;
local appMimeDB = $(target:BS)_mimedb ;
appMimeDB = $(appMimeDB:G=mimedb-app-$(appGrist:E=)) ;
MakeLocateDebug $(appMimeDB) ;
Depends $(appMimeDB) : <build>mimeset $(target) <mimedb>mime_db ;
CreateAppMimeDBEntries1 $(appMimeDB)
: <build>mimeset $(target) <mimedb>mime_db ;
HAIKU_MIME_DB_ENTRIES on $(target) = $(appMimeDB) ;
}
actions CreateAppMimeDBEntries1
{
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
appMimeDB="$(1)"
$(RM) -rf "$appMimeDB"
$(MKDIR) "$appMimeDB"
$(2[1]) -f --apps --mimedb "$appMimeDB" --mimedb "$(2[3])" "$(2[2])"
}
rule ResComp rule ResComp
{ {
# ResComp <resource file> : <rdef file> ; # ResComp <resource file> : <rdef file> ;
+15
View File
@@ -257,6 +257,21 @@ rule AddFilesToContainer container : directoryTokens : targets : destName
: $(systemDirTokens) data locale catalogs $(signature) : $(systemDirTokens) data locale catalogs $(signature)
: $(catalogs) ; : $(catalogs) ;
} }
# If the target is associated with MIME DB entries, add those, too.
local mimeDBEntries = [ on $(target) return $(HAIKU_MIME_DB_ENTRIES) ] ;
if $(mimeDBEntries) {
# Make sure we add the entries only once by tracking the containers
# we have already added it to.
local containers = [ on $(mimeDBEntries)
return $(HAIKU_MIME_DB_ENTRIES_IN_CONTAINERS) ] ;
if ! $(container) in $(containers) {
HAIKU_MIME_DB_ENTRIES_IN_CONTAINERS on $(mimeDBEntries)
= $(containers) $(container) ;
CopyDirectoryToContainer $(container) : data
: $(mimeDBEntries) : mime_db : : alwaysUpdate isTarget ;
}
}
} }
} }
+7 -1
View File
@@ -34,9 +34,15 @@ rule Link
on $(1) XRes $(1) : $(RESFILES) ; on $(1) XRes $(1) : $(RESFILES) ;
if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] { if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
SetType $(1) ; SetType $(1) ;
MimeSet $(1) ; MimeSet $(1) : sharedObject ;
SetVersion $(1) ; SetVersion $(1) ;
# For applications for the target also generate the MIME DB entries.
if [ on $(1) return $(PLATFORM) ] != host
&& [ on $(1) return $(RESFILES) ] {
CreateAppMimeDBEntries $(1) ;
}
# If the generic attribute emulation is enabled, make sure the tool to # If the generic attribute emulation is enabled, make sure the tool to
# remove the attributes is built first. # remove the attributes is built first.
if $(HOST_RM_ATTRS_TARGET) { if $(HOST_RM_ATTRS_TARGET) {
+2
View File
@@ -314,6 +314,8 @@ rule BuildHaikuPackage package : packageInfo
: [ on $(package) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] ; : [ on $(package) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] ;
AddTargetVariableToScript $(script) : <build>addattr ; AddTargetVariableToScript $(script) : <build>addattr ;
AddTargetVariableToScript $(script) : <build>copyattr ; AddTargetVariableToScript $(script) : <build>copyattr ;
AddTargetVariableToScript $(script) : <mimedb>mime_db : mimeDB ;
AddTargetVariableToScript $(script) : <build>mimeset ;
AddTargetVariableToScript $(script) : <build>package ; AddTargetVariableToScript $(script) : <build>package ;
AddTargetVariableToScript $(script) : <build>rc ; AddTargetVariableToScript $(script) : <build>rc ;
AddTargetVariableToScript $(script) : <build>resattr ; AddTargetVariableToScript $(script) : <build>resattr ;
+9 -3
View File
@@ -2,14 +2,16 @@
set -o errexit set -o errexit
# The first argument is the shell script that initializes the variables: # The first argument is the shell script that initializes the variables:
# sourceDir
# outputDir
# tmpDir
# addBuildCompatibilityLibDir # addBuildCompatibilityLibDir
# mimeDB
# outputDir
# sourceDir
# tmpDir
# updateOnly # updateOnly
# #
# addattr # addattr
# copyattr # copyattr
# mimeset
# package # package
# rc # rc
# rmAttrs # rmAttrs
@@ -60,6 +62,10 @@ while [ $# -gt 0 ]; do
done done
# mimeset the whole package content
$mimeset --mimedb "$mimeDB" "$contentsDir"
# create the package # create the package
if [ ! $updateOnly ]; then if [ ! $updateOnly ]; then
rm -f "$packagePath" rm -f "$packagePath"