     case zip : zip += -9r ;
    }
    actions piecemeal [PACK] {
        "$(zip)" "$(<)" "$(>)"
    }
    actions piecemeal [ZIP] {
        "$(zip)" "$(<)" "$(>)"
    }
    actions piecemeal [COPY] {
        copy /Y "$(>)" "$(<)" >NUL:
    }
}
if $(UNIX) = true
{
    tar ?= [ GLOB $(PATH) : star bsdtar tar ] ;
    tar = $(tar[1]) ;
    switch $(tar:D=:S=)
    {
        case star : tar += -c artype=pax -D -d -to-stdout ;
        case * : tar += -c -f - ;
    }
    actions [PACK] {
        "$(tar)" "$(>)" | gzip -c9 > "$(<)"
    }
    #~ actions [PACK] {
    #~     tar cf "$(<:S=.tar)" "$(>)"
    #~ }
    actions [ZIP] {
    gzip -c9 "$(>)" > "$(<)"
    }
    actions [COPY] {
        cp -Rpf "$(>)" "$(<)"
    }
}

# The single binary, compressed.
rule .binary
{
    local zip ;
    if $(OS) = NT { zip = $($(<).exe:S=.zip) ; }
    if $(UNIX) = true { zip = $($(<).exe:S=.tgz) ; }
    zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ;
    DEPENDS $(zip) : $($(<).exe) ;
    DEPENDS dist : $(zip) ;
    #~ LOCATE on $(zip) = $(locate-target) ;
    if $(OS) = NT { [ZIP] $(zip) : $($(<).exe) ; }
    if $(UNIX) = true { [PACK] $(zip) : $($(<).exe) ; }
    .clean $(zip) ;
}

# Package some file.
rule .package ( dst-dir : src-files + )
{
    local dst-files ;
    local src-files-actual ;
    for local src-path in $(src-files)
    {
        if ! [ GLOB $(src-path:P) : $(src-path:B) ] || [ CHECK_IF_FILE $(src-path) ]
        {
            local src-subdir = $(src-path:D) ;
            local src-file = $(src-path) ;
            while $(src-subdir:D) { src-subdir = $(src-subdir:D) ; }
            if $(src-subdir) = ".."
            {
                src-file = $(src-file:D=) ;
            }
            dst-files += $(src-file:R=$(dst-dir)) ;
            src-files-actual += $(src-path) ;
        }
    }

    local pack ;
    if $(OS) = NT { pack = $(dst-dir).zip ; }
    if $(UNIX) = true { pack = $(dst-dir).tgz ; }

    DEPENDS dist : $(pack) ;
    DEPENDS $(pack) : $(dst-files) ;

    local dst-files-queue = $(dst-files)