BPicture: Fix archive constructor.
[haiku.git] / src / data / mime_db / Jamfile
bloba2bbb8564774792cd9276bf3b76a8e887b12ace7
1 SubDir HAIKU_TOP src data mime_db ;
4 rule BuildMimeDB superTypes
6         local mimeDB = <mimedb>mime_db ;
7         MakeLocateCommonPlatform $(mimeDB) ;
9         # make the supertypes
10         local compiledSuperTypes ;
11         local superType ;
12         for superType in $(superTypes) {
13                 local compiledSuperType = $(superType:S=.rsrc:G=mimedb-super) ;
14                 ResComp $(compiledSuperType) : $(superType) ;
15                 compiledSuperTypes += $(compiledSuperType) ;
16         }
18         Depends $(mimeDB) : <build>resattr $(compiledSuperTypes) ;
19         BuildMimeDBSuperTypes $(mimeDB) : <build>resattr $(compiledSuperTypes) ;
21         # make the subtypes for each supertype
22         for superType in $(superTypes) {
23                 local subTypes = [ on $(superType) return $(HAIKU_MIMEDB_SUBTYPES) ] ;
24                 local compiledSubTypes ;
25                 for subType in $(subTypes) {
26                         local compiledSubType = $(subType:BS).rsrc ;
27                                 # Note: The subtype name may contain '.'s. Hence we cannot use
28                                 # ":S=.rsrc".
29                         compiledSubType = $(compiledSubType:G=mimedb-sub-$(superType:B)) ;
30                         MakeLocate $(compiledSubType)
31                                 : [ FDirName $(COMMON_PLATFORM_LOCATE_TARGET) $(superType:B) ] ;
32                                 # Need to locate explicitly to avoid clashes between equally
33                                 # named subtypes of different supertypes.
34                         ResComp $(compiledSubType) : $(subType) ;
35                         compiledSubTypes += $(compiledSubType) ;
36                 }
38                 if $(compiledSubTypes) {
39                         Depends $(mimeDB) : $(superType) $(compiledSubTypes) ;
40                         BuildMimeDBSubTypes $(mimeDB)
41                                 : <build>resattr $(superType) $(compiledSubTypes) ;
42                 }
43         }
47 actions BuildMimeDBSuperTypes
49         $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
51         # remove and re-create the directory
52         baseDirectory="$(1)"
53         $(RM) -rf "$baseDirectory"
54         mkdir "$baseDirectory"
56         resattr="$(2[1])"
58         for sourceFile in "$(2[2-])" ; do
59                 type=`basename "$sourceFile" .rsrc`
60                 targetDirectory="$baseDirectory/$type"
61                 mkdir "$targetDirectory"
62                 "$resattr" -O -o "$targetDirectory" "$sourceFile"
63         done
67 actions BuildMimeDBSubTypes
69         $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
71         resattr="$(2[1])"
72         superType=`basename "$(2[2])" .super`
73         superTypeDirectory="$(1)/$superType"
75         for sourceFile in "$(2[3-])" ; do
76                 type=`basename "$sourceFile" .rsrc`
77                 targetFile="$superTypeDirectory/$type"
78                 "$resattr" -O -o "$targetFile" "$sourceFile"
79         done
83 # glob the supertype source files
84 local superTypeFiles = [ Glob $(SUBDIR) : *.super ] ;
85 superTypeFiles = $(superTypeFiles:BSG=mimedb) ;
86 SEARCH on $(superTypeFiles) = $(SUBDIR) ;
88 # for each supertype glob the subtype source files
89 local superTypeFile ;
90 for superTypeFile in $(superTypeFiles) {
91         local superTypeDirectory = [ FDirName $(SUBDIR) $(superTypeFile:B) ] ;
92         local subTypeFiles = [ Glob $(superTypeDirectory) : * ] ;
94         local subTypes ;
95         local subType ;
96         for subType in $(subTypeFiles:BS) {
97                 if $(subType) != "." && $(subType) != ".." {
98                         subType = $(subType:G=mimedb-sub-$(superTypeFile:B)) ;
99                         SEARCH on $(subType) = $(superTypeDirectory) ;
100                         subTypes += $(subType) ;
101                 }
102         }
104         HAIKU_MIMEDB_SUBTYPES on $(superTypeFile) = $(subTypes) ;
107 BuildMimeDB $(superTypeFiles) ;