Ticket #5508: AddExpanderRules.patch

File AddExpanderRules.patch, 2.1 KB (added by mmadia, 10 years ago)

updated per comment 6

  • build/jam/ImageRules

     
    856856    AddEntryToHaikuImageUserGroupFile <haiku-image>group : $(entry) ;
    857857}
    858858
     859rule AddEntryToHaikuImageExpanderRuleFile file : entry
     860{
     861    local allEntries
     862        = [ on $(file) return $(HAIKU_IMAGE_EXPANDER_RULES_ENTRIES) ] ;
     863
     864    if $(allEntries) {
     865        allEntries = $(allEntries)!$(entry) ;
     866    } else {
     867        allEntries = $(entry) ;
     868
     869        Always $(file) ;
     870        MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ;
     871        BuildHaikuImageExpanderRules $(file) ;
     872        AddFilesToHaikuImage common etc : $(file) ;
     873    }
     874
     875    HAIKU_IMAGE_EXPANDER_RULES_ENTRIES on $(file) = $(allEntries) ;
     876}
     877
     878actions BuildHaikuImageExpanderRules
     879{
     880    echo -e "$(HAIKU_IMAGE_EXPANDER_RULES_ENTRIES)" | tr '!' '\n' > $(1)
     881}
     882
     883rule AddExpanderRuleToHaikuImage mimetype : extension : list : extract
     884{
     885    #AddExpanderRuleToHaikuImage <mimetype> : <extension> : <list> : <extract>
     886
     887    if ! $(mimetype) || ! $(extension) || ! $(list) || ! $(extract) {
     888        Exit "Invalid expander rule specification passed to AddExpanderRule." ;
     889    }
     890
     891    local entry = "\\\"$(mimetype)\\\"\\\t$(extension)\\\t\\\"$(list)\\\"\\\t\\\"$(extract)\\\"" ;
     892    AddEntryToHaikuImageExpanderRuleFile <haiku-image>expander.rules
     893        : $(entry) ;
     894}
     895
    859896rule AddOptionalPackageDescriptionToHaikuImage file : searchPath
    860897{
    861898    if $(searchPath) {
  • build/jam/OptionalPackages

     
    823823                :
    824824            ;
    825825        }
     826        AddExpanderRuleToHaikuImage "application/x-7z-compressed" : .7z
     827            : "7za l \\0045s"
     828            : "7za x -y \\0045s"
     829        ;
    826830
    827         actions BuildHaikuImageExpanderRules
    828         {
    829             echo -e "\"application/x-7z-compressed\"\t.7z\t\"7za l \0045s\"\t\"7za x -y \0045s\"" > $(1)
    830         }
    831 
    832         Always expander.rules ;
    833         MakeLocate expander.rules : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ;
    834         BuildHaikuImageExpanderRules expander.rules ;
    835         AddFilesToHaikuImage home config etc : expander.rules ;
    836831    }
    837832}
    838833