Move MIME DB creation from build_haiku_image to jam build system
* build_haiku_image: Remove MIME DB creation code. * Rename beos_mime source directory to mime_db. * Add rules to build the MIME DB in the source directory's jamfile. * Add MIME DB directory to haiku.hpkg in data/mime_db.
This commit is contained in:
@@ -352,6 +352,10 @@ AddFilesToPackage add-ons disk_systems
|
||||
: <disk_system>intel <disk_system>gpt <disk_system>bfs <disk_system>ntfs ;
|
||||
|
||||
|
||||
# the MIME DB
|
||||
CopyDirectoryToPackage data : <mimedb>mime_db : : : isTarget ;
|
||||
|
||||
|
||||
# optional
|
||||
# TODO: We should probably build another package (including the data files
|
||||
# above) that can be installed, if desired.
|
||||
|
||||
@@ -295,59 +295,6 @@ for packageFile in $packages; do
|
||||
done
|
||||
|
||||
|
||||
# install MIME database
|
||||
# TODO: It should be possible to do that in the build system too.
|
||||
|
||||
if [ ! $updateOnly ]; then
|
||||
mimeDBSource=$sourceDir/src/data/beos_mime
|
||||
mimeDBDest=${tPrefix}home/config/settings/beos_mime
|
||||
|
||||
echo "Deleting old MIME database ..."
|
||||
|
||||
$rm -rf $mimeDBDest
|
||||
$mkdir -p $mimeDBDest
|
||||
mimeTmpDir=$tmpDir/mime
|
||||
mimeDBTmpDir=$tmpDir/mime/db
|
||||
mimeTmpIndex=0
|
||||
mimeTmpFile=$mimeTmpDir/mimedb$$.rsrc
|
||||
|
||||
# create tmp dir for the MIME conversion stuff
|
||||
mkdir -p $mimeDBTmpDir
|
||||
|
||||
echo "Installing MIME database ..."
|
||||
|
||||
for inSuperFile in $mimeDBSource/*.super; do
|
||||
superType=$(basename $inSuperFile .super)
|
||||
tmpSuperDir=$mimeDBTmpDir/$superType
|
||||
|
||||
# compile rdef to rsrc file and the rsrc file to attributes
|
||||
$rc -o $mimeTmpFile $inSuperFile
|
||||
mkdir -p $tmpSuperDir
|
||||
$resattr -O -o $tmpSuperDir $mimeTmpFile
|
||||
$rmAttrs $mimeTmpFile
|
||||
|
||||
# iterate through the sub types
|
||||
for inSubFile in $mimeDBSource/$superType/*; do
|
||||
# check, if the type exists
|
||||
if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then
|
||||
subType=$(basename $inSubFile)
|
||||
tmpSubFile=$mimeDBTmpDir/$superType/$subType
|
||||
|
||||
# compile rdef to rsrc file and the rsrc file to attributes
|
||||
$rc -o $mimeTmpFile $inSubFile
|
||||
$resattr -O -o $tmpSubFile $mimeTmpFile
|
||||
$rmAttrs $mimeTmpFile
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
$cp -r ${sPrefix}$mimeDBTmpDir/. $mimeDBDest
|
||||
|
||||
# cleanup tmp dir
|
||||
$rmAttrs -rf $mimeTmpDir
|
||||
fi # ! updateOnly
|
||||
|
||||
|
||||
# add the concatenated copyrights as an attribute to AboutSystem
|
||||
# TODO: That might not be necessary, when all third-party software everything
|
||||
# is packaged. Though we might not package everything.
|
||||
|
||||
@@ -2,4 +2,5 @@ SubDir HAIKU_TOP src data ;
|
||||
|
||||
HaikuSubInclude etc ;
|
||||
HaikuSubInclude keymaps ;
|
||||
HaikuSubInclude mime_db ;
|
||||
HaikuSubInclude settings ;
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
SubDir HAIKU_TOP src data mime_db ;
|
||||
|
||||
|
||||
rule BuildMimeDB superTypes
|
||||
{
|
||||
local mimeDB = <mimedb>mime_db ;
|
||||
MakeLocateCommonPlatform $(mimeDB) ;
|
||||
|
||||
# make the supertypes
|
||||
local compiledSuperTypes ;
|
||||
local superType ;
|
||||
for superType in $(superTypes) {
|
||||
local compiledSuperType = $(superType:S=.rsrc:G=mimedb-super) ;
|
||||
ResComp $(compiledSuperType) : $(superType) ;
|
||||
compiledSuperTypes += $(compiledSuperType) ;
|
||||
}
|
||||
|
||||
Depends $(mimeDB) : <build>resattr $(compiledSuperTypes) ;
|
||||
BuildMimeDBSuperTypes $(mimeDB) : <build>resattr $(compiledSuperTypes) ;
|
||||
|
||||
# make the subtypes for each supertype
|
||||
for superType in $(superTypes) {
|
||||
local subTypes = [ on $(superType) return $(HAIKU_MIMEDB_SUBTYPES) ] ;
|
||||
local compiledSubTypes ;
|
||||
for subType in $(subTypes) {
|
||||
local compiledSubType = $(subType:BS).rsrc ;
|
||||
# Note: The subtype name may contain '.'s. Hence we cannot use
|
||||
# ":S=.rsrc".
|
||||
compiledSubType = $(compiledSubType:G=mimedb-sub-$(superType:B)) ;
|
||||
ResComp $(compiledSubType) : $(subType) ;
|
||||
MakeLocate $(compiledSubType)
|
||||
: [ FDirName $(COMMON_PLATFORM_LOCATE_TARGET) $(superType:B) ] ;
|
||||
# need to relocate to avoid clashes between equally named
|
||||
# subtypes of different supertypes
|
||||
compiledSubTypes += $(compiledSubType) ;
|
||||
}
|
||||
|
||||
if $(compiledSubTypes) {
|
||||
Depends $(mimeDB) : $(superType) $(compiledSubTypes) ;
|
||||
BuildMimeDBSubTypes $(mimeDB)
|
||||
: <build>resattr $(superType) $(compiledSubTypes) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
actions BuildMimeDBSuperTypes
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
|
||||
# remove and re-create the directory
|
||||
baseDirectory="$(1)"
|
||||
$(RM) -rf "$baseDirectory"
|
||||
mkdir "$baseDirectory"
|
||||
|
||||
resattr="$(2[1])"
|
||||
|
||||
for sourceFile in "$(2[2-])" ; do
|
||||
type=`basename "$sourceFile" .rsrc`
|
||||
targetDirectory="$baseDirectory/$type"
|
||||
mkdir "$targetDirectory"
|
||||
"$resattr" -O -o "$targetDirectory" "$sourceFile"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
actions BuildMimeDBSubTypes
|
||||
{
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
|
||||
resattr="$(2[1])"
|
||||
superType=`basename "$(2[2])" .super`
|
||||
superTypeDirectory="$(1)/$superType"
|
||||
|
||||
for sourceFile in "$(2[3-])" ; do
|
||||
type=`basename "$sourceFile" .rsrc`
|
||||
targetFile="$superTypeDirectory/$type"
|
||||
"$resattr" -O -o "$targetFile" "$sourceFile"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# glob the supertype source files
|
||||
local superTypeFiles = [ Glob $(SUBDIR) : *.super ] ;
|
||||
superTypeFiles = $(superTypeFiles:BSG=mimedb) ;
|
||||
SEARCH on $(superTypeFiles) = $(SUBDIR) ;
|
||||
|
||||
# for each supertype glob the subtype source files
|
||||
local superType ;
|
||||
for superTypeFile in $(superTypeFiles) {
|
||||
local superTypeDirectory = [ FDirName $(SUBDIR) $(superTypeFile:B) ] ;
|
||||
local subTypeFiles = [ Glob $(superTypeDirectory) : * ] ;
|
||||
|
||||
local subTypes ;
|
||||
local subType ;
|
||||
for subType in $(subTypeFiles:BS) {
|
||||
if $(subType) != "." && $(subType) != ".." {
|
||||
subType = $(subType:G=mimedb-sub) ;
|
||||
SEARCH on $(subType) = $(superTypeDirectory) ;
|
||||
subTypes += $(subType) ;
|
||||
}
|
||||
}
|
||||
|
||||
HAIKU_MIMEDB_SUBTYPES on $(superTypeFile) = $(subTypes) ;
|
||||
}
|
||||
|
||||
BuildMimeDB $(superTypeFiles) ;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user