Ticket #5454: FileRules-Rule-UntarArchive-v4.patch

File FileRules-Rule-UntarArchive-v4.patch, 3.4 KB (added by mmadia, 14 years ago)

Updated to abstract UnzipArchive as ExtractArchive.

  • build/jam/FileRules

     
    190190}
    191191
    192192
    193 rule UnzipArchive directory : entries : zipFile : grist
     193rule ExtractArchive directory : entries : archiveFile : grist
    194194{
    195     # UnzipArchive <directory> : <entries> : <zipFile> [ : <grist> ]
     195    # ExtractArchive <directory> : <entries> : <archiveFile> [ : <grist> ]
    196196    #
    197     # Unzips the zip file target <zipFile> to directory <directory>. The rule
     197    # Extract the archive file target <archiveFile> to directory <directory>. The rule
    198198    # can be called multiple times for different <entries> for the same
    199     # <directory> and <zipFile> combo.
     199    # <directory> and <archiveFile> combo.
    200200    #
    201     # <directory> - The directory into which to unzip the zip file. The
     201    # <directory> - The directory into which to extract the archive file. The
    202202    #               directory is created is by this rule and it is the target
    203     #               that the unzip action is associated with.
     203    #               that the extract action is associated with.
    204204    # <entries>   - The entries of the zip file one is interested in. The rule
    205205    #               always unzips the complete zip file, from the given entries
    206206    #               the rule creates targets (using <grist>) representing the
    207207    #               unzipped entries. Those targets are returned by the rule.
    208     # <zipFile>   - The zip file target to unzip.
     208    # <archiveFile> - The archive file target to extract.
    209209    # <grist>     - The grist used to create targets from <entries>. Defaults to
    210     #               "unzipped".
     210    #               "extracted".
    211211
    212     grist ?= unzipped ;
     212    grist ?= extracted ;
    213213
    214214    # Turn the entries into targets to build.
    215215    local targets ;
     
    231231        MkDir $(parentDir) ;
    232232
    233233        NoUpdate $(directory) ;
    234         Depends $(directory) : $(zipFile) ;
    235         UnzipArchive1 $(directory) : $(zipFile) ;
     234        Depends $(directory) : $(archiveFile) ;
     235        switch $(archiveFile:S)
     236        {
     237            case .zip   : ExtractZipArchive1 $(directory) : $(archiveFile) ;
     238            case .tgz   : ExtractTarArchive1 $(directory) : $(archiveFile) ;
     239            case *      : Exit "ExtractArchive: Unhandled archive extension: $(archiveFile:S)" ;
     240        }
    236241        INITIALIZED on $(directory) = 1 ;
    237242    }
    238243
    239244    # Use a dummy rule so that it looks to jam like the targets are actually
    240245    # built from the directory target.
    241     UnzipArchiveDummy $(targets) : $(directory) ;
     246    ExtractArchiveDummy $(targets) : $(directory) ;
    242247
    243248    return $(targets) ;
    244249}
    245250
    246 actions UnzipArchive1
     251actions ExtractZipArchive1
    247252{
    248253    mkdir -p $(1[1])
    249254    unzip -q -u -o -d $(1[1]) $(2)
    250255}
    251256
    252 actions UnzipArchiveDummy
     257actions ExtractTarArchive1
    253258{
     259    mkdir -p $(1[1])
     260    tar -C $(1[1]) -xf $(2)
    254261}
    255262
     263actions ExtractArchiveDummy
     264{
     265}
    256266
    257267rule ObjectReference
    258268{
  • build/jam/OptionalBuildFeatures

     
    2929            $(HAIKU_OPENSSL_PACKAGE) ] ;
    3030
    3131        # unzip headers and libraries
    32         HAIKU_OPENSSL_HEADERS_DEPENDENCY = [ UnzipArchive $(HAIKU_OPENSSL_DIR)
     32        HAIKU_OPENSSL_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_OPENSSL_DIR)
    3333            : common/include/ : $(zipFile)
    3434        ] ;
    3535
    36         HAIKU_OPENSSL_LIBS = [ UnzipArchive $(HAIKU_OPENSSL_DIR)
     36        HAIKU_OPENSSL_LIBS = [ ExtractArchive $(HAIKU_OPENSSL_DIR)
    3737            :
    3838            common/lib/libcrypto.so
    3939            common/lib/libssl.so