diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index 53cbb393830..d4acafaf7bd 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -66,34 +66,36 @@ usage() $progname: [-Ch] [-c ] [-m ] [-p ] [-s ] Targets: - bootstrap Build and install the bootstrap packages into . - build Build a package (fetch + extract + configure + build). - build-pkg [all] Build a binary package from . - Package must be installed into destdir. If the - keyword is used all packages currently installed in - / will be used. - checkvers Checks installed package versions against srcpkgs - for new available versions. - chroot Enter to the chroot in . - clean Remove build directory. - configure Configure a package (fetch + extract + configure). - extract Extract distribution file(s) into build directory. - Build directory is always available in - /pkg-builddir/. - fetch Download distribution file(s). - info Show information for current pkg build template. - install-destdir build + install into destdir. - install install-destdir + stow. - list List installed packages in . - listfiles List installed files from . - make-repoidx Build a package index for the local repository associated - with the master directory or , - or updates it. - remove Remove package completely (destdir + masterdir). - stow Stow files from into and - register package in database. - unstow Remove files from and unregister - package from database. + bootstrap Build and install the bootstrap packages into . + build [pkgname] Build a package (fetch + extract + configure + build). + build-pkg [pkgname|all] + Build a binary package from . + Package must be installed into destdir. If the + keyword is used all packages currently installed in + / will be used. Otherwise + if specified, or the one in cwd. + checkvers Checks installed package versions against srcpkgs + for new available versions. + chroot Enter to the chroot in . + clean [pkgname] Remove build directory. + configure [pkgname] Configure a package (fetch + extract + configure). + extract [pkgname] Extract distribution file(s) into build directory. + Build directory is always available in + /pkg-builddir/. + fetch [pkgname] Download distribution file(s). + info [pkgname] Show information for current pkg build template. + install-destdir [pkgname] build + install into destdir. + install [pkgname] install-destdir + stow. + list List installed packages in . + listfiles List installed files from . + make-repoidx Build a package index for the local repository associated + with the master directory or , + or updates it. + remove [pkgname] Remove package completely (destdir + masterdir). + stow [pkgname] Stow files from into and + register package in database. + unstow [pkgname] Remove files from and unregister + package from database. Options: -C Do not remove build directory after successful installation. @@ -205,6 +207,7 @@ shift $(($OPTIND - 1)) [ $# -eq 0 -o $# -gt 2 ] && usage && exit 1 target="$1" +_pkgname="$2" if [ -z "$target" ]; then echo "=> ERROR: missing target." usage && exit 1 @@ -280,14 +283,17 @@ bootstrap) ;; build|configure) . $XBPS_SHUTILSDIR/tmpl_funcs.sh - [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" - . ./template + if [ -z "${_pkgname}" ]; then + [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" + . ./template + _pkgname=$(basename_cwd) + fi if [ -z "$base_chroot" -a -z "$in_chroot" ]; then . $XBPS_SHUTILSDIR/chroot.sh - xbps_chroot_handler $target $(basename_cwd) + xbps_chroot_handler $target ${_pkgname} else - _ORIGINPKG="$(basename_cwd)" + _ORIGINPKG="${_pkgname}" setup_tmpl ${_ORIGINPKG} # If pkg has dependencies, install them first. . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh @@ -333,8 +339,11 @@ build-pkg) fi done else - [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" - setup_tmpl $(basename_cwd) + if [ -z "${_pkgname}" ]; then + [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" + _pkgname=$(basename_cwd) + fi + setup_tmpl ${_pkgname} xbps_make_binpkg fi ;; @@ -349,14 +358,20 @@ chroot) ;; clean) . $XBPS_SHUTILSDIR/tmpl_funcs.sh - [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" - setup_tmpl $(basename_cwd) + if [ -z "${_pkgname}" ]; then + [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" + _pkgname=$(basename_cwd) + fi + setup_tmpl ${_pkgname} remove_tmpl_wrksrc $wrksrc ;; extract|fetch|info) . $XBPS_SHUTILSDIR/tmpl_funcs.sh - [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" - setup_tmpl $(basename_cwd) + if [ -z "${_pkgname}" ]; then + [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" + _pkgname=$(basename_cwd) + fi + setup_tmpl ${_pkgname} if [ "$target" = "info" ]; then . $XBPS_SHUTILSDIR/tmpl_funcs.sh info_tmpl @@ -372,13 +387,15 @@ extract|fetch|info) ;; install|install-destdir) . $XBPS_SHUTILSDIR/tmpl_funcs.sh - [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" - . ./template - + if [ -z "${_pkgname}" ]; then + [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" + _pkgname=$(basename_cwd) + fi + setup_tmpl ${_pkgname} install_destdir_target=no [ "$target" = "install-destdir" ] && install_destdir_target=yes - _ORIGINPKG="$(basename_cwd)" + _ORIGINPKG="${_pkgname}" if [ -z "$in_chroot" -a -z "$base_chroot" ]; then . $XBPS_SHUTILSDIR/chroot.sh xbps_chroot_handler $target ${_ORIGINPKG} $dontrm_builddir @@ -407,22 +424,31 @@ make-repoidx) ;; remove) . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh - [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" - setup_tmpl $(basename_cwd) + if [ -z "${_pkgname}" ]; then + [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" + _pkgname=$(basename_cwd) + fi + setup_tmpl ${_pkgname} remove_pkg ;; stow) stow_flag=yes . $XBPS_SHUTILSDIR/tmpl_funcs.sh - [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" - setup_tmpl $(basename_cwd) + if [ -z "${_pkgname}" ]; then + [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" + _pkgname=$(basename_cwd) + fi + setup_tmpl ${_pkgname} . $XBPS_SHUTILSDIR/stow_funcs.sh stow_pkg_handler stow ;; unstow) . $XBPS_SHUTILSDIR/tmpl_funcs.sh - [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" - setup_tmpl $(basename_cwd) + if [ -z "${_pkgname}" ]; then + [ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" + _pkgname=$(basename_cwd) + fi + setup_tmpl ${_pkgname} . $XBPS_SHUTILSDIR/stow_funcs.sh stow_pkg_handler unstow ;;