#!/bin/sh
# Build a package

if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi

parser_definition() {
    setup REST help:usage -- "usage: ${0##*/} [pkg...]"
    msg -- '' 'Options:'
    flag CPT_TEST   -t --test export:1 init:@export -- "Run tests (if they exist)"
    global_options
}

eval "$(getoptions parser_definition parse "$0")"

parse "$@"
eval set -- "$REST"

[ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH

create_cache

pkg_build "$@"