2009-10-18 09:17:26 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2010-01-09 14:49:36 +00:00
|
|
|
# Copyright (c) 2008-2010 Juan Romero Pardines.
|
2009-10-18 09:17:26 +00:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#-
|
|
|
|
: ${XBPS_CONFIG_FILE:=@@XBPS_INSTALL_ETCDIR@@/xbps-src.conf}
|
|
|
|
|
|
|
|
: ${progname:=$(basename $0)}
|
2010-05-11 13:03:36 +00:00
|
|
|
: ${fakeroot_cmd:=/usr/bin/fakeroot}
|
2010-01-16 01:11:44 +00:00
|
|
|
: ${fakeroot_cmd_args:=--}
|
|
|
|
: ${sudo_cmd:=sudo}
|
|
|
|
: ${chroot_cmd:=chroot}
|
2009-10-18 09:17:26 +00:00
|
|
|
: ${xbps_machine:=$(uname -m)}
|
2010-05-11 13:03:36 +00:00
|
|
|
: ${XBPS_UTILS_REQVER:=20100511}
|
2009-10-18 09:17:26 +00:00
|
|
|
|
2010-05-14 13:25:07 +00:00
|
|
|
trap '_MASTERDIR=${XBPS_MASTERDIR} sighandler_exit $?' 0 INT QUIT
|
2010-05-14 12:48:55 +00:00
|
|
|
|
|
|
|
sighandler_exit()
|
|
|
|
{
|
2010-10-30 16:25:04 +00:00
|
|
|
# Always unmount in case we failed before!
|
2010-05-14 12:48:55 +00:00
|
|
|
if [ -z "$in_chroot" ]; then
|
2010-12-15 23:27:42 +00:00
|
|
|
cd ${_MASTERDIR} && \
|
|
|
|
env MASTERDIR="${_MASTERDIR}" \
|
2010-05-14 13:25:07 +00:00
|
|
|
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount
|
2010-05-14 12:48:55 +00:00
|
|
|
fi
|
|
|
|
[ -n "$1" ] && exit $1
|
|
|
|
exit $?
|
|
|
|
}
|
|
|
|
|
2010-05-17 20:23:52 +00:00
|
|
|
check_reqhost_utils()
|
|
|
|
{
|
|
|
|
[ -n "$in_chroot" ] && return 0
|
|
|
|
|
2010-05-17 20:26:58 +00:00
|
|
|
for f in awk bash sed gcc msgfmt patch makeinfo perl fakeroot \
|
|
|
|
xbps-bin.static xbps-repo.static xbps-uhelper.static; do
|
2010-05-17 20:23:52 +00:00
|
|
|
if ! command -v ${f} 2>&1 >/dev/null; then
|
|
|
|
echo "${f} is missing in your system, can't continue! exiting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2009-10-18 09:17:26 +00:00
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat << _EOF
|
2010-10-30 16:25:04 +00:00
|
|
|
$progname: [-Ch] [-c <file>] [-m <dir>] [-p <dir>] [-s <dir>] <target>
|
2009-10-18 09:17:26 +00:00
|
|
|
|
|
|
|
Targets:
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
bootstrap Build and install the bootstrap packages into <masterdir>.
|
|
|
|
build [pkgname] Build a package (fetch + extract + configure + build).
|
|
|
|
build-pkg [pkgname|all]
|
|
|
|
Build a binary package from <pkg>.
|
|
|
|
Package must be installed into destdir. If the <all>
|
|
|
|
keyword is used all packages currently installed in
|
|
|
|
<masterdir>/<destdir> will be used. Otherwise <pkgname>
|
|
|
|
if specified, or the one in cwd.
|
|
|
|
checkvers Checks installed package versions against srcpkgs
|
|
|
|
for new available versions.
|
|
|
|
chroot Enter to the chroot in <masterdir>.
|
|
|
|
clean [pkgname] Remove <pkg> 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
|
|
|
|
<masterdir>/pkg-builddir/<pkg>.
|
|
|
|
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 <masterdir>.
|
|
|
|
listfiles <pkgname> List installed files from <pkg>.
|
|
|
|
make-repoidx Build a package index for the local repository associated
|
|
|
|
with the master directory <masterdir> or <pkgdir>,
|
|
|
|
or updates it.
|
|
|
|
remove [pkgname] Remove package completely (destdir + masterdir).
|
|
|
|
stow [pkgname] Stow <pkg> files from <destdir> into <masterdir> and
|
|
|
|
register package in database.
|
|
|
|
unstow [pkgname] Remove <pkg> files from <masterdir> and unregister
|
|
|
|
package from database.
|
2009-10-18 09:17:26 +00:00
|
|
|
|
|
|
|
Options:
|
|
|
|
-C Do not remove build directory after successful installation.
|
|
|
|
-c Path to global configuration file:
|
|
|
|
if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used.
|
2010-04-27 12:23:53 +00:00
|
|
|
-h Usage output.
|
2010-04-26 23:34:19 +00:00
|
|
|
-m Master directory, overwritting the value set in the configuration
|
|
|
|
file at @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf.
|
|
|
|
-p Package directory, overwritting default path at
|
2010-05-19 01:00:52 +00:00
|
|
|
<masterdir>/pkg-binpkgs.
|
2010-10-30 16:25:04 +00:00
|
|
|
-s Source distribution files directory, overwritting default path at
|
|
|
|
<masterdir>/pkg-srcdistdir.
|
2010-03-30 15:01:59 +00:00
|
|
|
|
2009-10-18 09:17:26 +00:00
|
|
|
_EOF
|
|
|
|
}
|
|
|
|
|
2009-11-22 07:31:44 +00:00
|
|
|
basename_cwd()
|
|
|
|
{
|
|
|
|
echo $(basename $(pwd))
|
|
|
|
}
|
|
|
|
|
2009-10-18 09:17:26 +00:00
|
|
|
check_path()
|
|
|
|
{
|
|
|
|
eval local orig="$1"
|
|
|
|
|
|
|
|
case "$orig" in
|
|
|
|
/) ;;
|
|
|
|
/*) orig="${orig%/}" ;;
|
|
|
|
*) orig="$(pwd)/${orig%/}" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
path_fixed="$orig"
|
|
|
|
}
|
|
|
|
|
|
|
|
run_file()
|
|
|
|
{
|
|
|
|
local file="$1"
|
|
|
|
|
|
|
|
check_path "$file"
|
|
|
|
. $path_fixed
|
|
|
|
}
|
|
|
|
|
|
|
|
check_config_vars()
|
|
|
|
{
|
2010-05-26 13:41:26 +00:00
|
|
|
local val cffound f cfpaths cf="xbps-src.conf"
|
2009-10-18 09:17:26 +00:00
|
|
|
|
2010-05-26 13:41:26 +00:00
|
|
|
if [ -z "$XBPS_CONFIG_FILE" ]; then
|
|
|
|
cfpaths="@@XBPS_INSTALL_PREFIX@@/etc/${cf} ./etc/${cf}"
|
|
|
|
for f in $cfpaths; do
|
|
|
|
if [ -f ${f} ]; then
|
|
|
|
XBPS_CONFIG_FILE=${f}
|
|
|
|
cffound=yes
|
|
|
|
break
|
|
|
|
fi
|
2009-10-18 09:17:26 +00:00
|
|
|
done
|
2010-12-19 23:22:12 +00:00
|
|
|
[ -z "$cffound" ] && msg_error "cannot find a config file\n"
|
2009-10-18 09:17:26 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
run_file ${XBPS_CONFIG_FILE}
|
2010-05-26 13:41:26 +00:00
|
|
|
export XBPS_CONFIG_FILE=$path_fixed
|
2009-10-18 09:17:26 +00:00
|
|
|
|
|
|
|
if [ ! -f "$XBPS_CONFIG_FILE" ]; then
|
2010-12-19 23:22:12 +00:00
|
|
|
msg_error "cannot find configuration file: $XBPS_CONFIG_FILE\n"
|
2009-10-18 09:17:26 +00:00
|
|
|
fi
|
|
|
|
|
2010-05-26 13:41:26 +00:00
|
|
|
for f in XBPS_DISTRIBUTIONDIR XBPS_MASTERDIR; do
|
|
|
|
eval val="\$${f}"
|
|
|
|
if [ -z "$val" ]; then
|
2010-12-19 23:22:12 +00:00
|
|
|
msg_error "'${f}' not set in configuration file!\n"
|
2010-05-26 13:41:26 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ ! -d "$XBPS_MASTERDIR" ]; then
|
|
|
|
mkdir -p "$val"
|
|
|
|
if [ $? -ne 0 ]; then
|
2010-12-19 23:22:12 +00:00
|
|
|
msg_error "couldn't create 'XBPS_MASTERDIR' directory\n"
|
2010-05-26 13:41:26 +00:00
|
|
|
fi
|
2010-04-26 00:51:48 +00:00
|
|
|
fi
|
2010-06-02 23:49:33 +00:00
|
|
|
[ -z "${_MASTERDIR_FLAG}" ] && export _MASTERDIR="$XBPS_MASTERDIR"
|
2009-10-18 09:17:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# main()
|
|
|
|
#
|
2010-10-30 16:25:04 +00:00
|
|
|
while getopts "Cc:hm:p:s:" opt; do
|
2009-10-18 09:17:26 +00:00
|
|
|
case $opt in
|
2010-01-09 14:49:36 +00:00
|
|
|
C) export dontrm_builddir=yes;;
|
2010-05-26 13:41:26 +00:00
|
|
|
c) XBPS_CONFIG_FILE="$OPTARG";;
|
2010-04-27 12:23:53 +00:00
|
|
|
h) usage && exit 0;;
|
2010-04-26 23:34:19 +00:00
|
|
|
m)
|
2010-06-02 23:49:33 +00:00
|
|
|
_MASTERDIR_FLAG=1
|
2010-04-26 23:34:19 +00:00
|
|
|
_MASTERDIR="$OPTARG"
|
|
|
|
if [ ! -d ${_MASTERDIR} ]; then
|
|
|
|
mkdir -p ${_MASTERDIR}
|
|
|
|
fi
|
|
|
|
;;
|
2010-03-30 15:01:59 +00:00
|
|
|
p)
|
|
|
|
_PACKAGEDIR="$OPTARG"
|
|
|
|
if [ ! -d ${_PACKAGEDIR} ]; then
|
|
|
|
mkdir -p ${_PACKAGEDIR}/${xbps_machine}
|
|
|
|
mkdir -p ${_PACKAGEDIR}/noarch
|
|
|
|
fi
|
|
|
|
;;
|
2010-10-30 16:25:04 +00:00
|
|
|
s) export XBPS_SRCDISTDIR="$OPTARG";;
|
2009-10-18 09:17:26 +00:00
|
|
|
--) shift; break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
2010-04-27 12:23:53 +00:00
|
|
|
[ $# -eq 0 -o $# -gt 2 ] && usage && exit 1
|
2009-10-18 09:17:26 +00:00
|
|
|
|
|
|
|
target="$1"
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
_pkgname="$2"
|
2009-10-18 09:17:26 +00:00
|
|
|
if [ -z "$target" ]; then
|
|
|
|
echo "=> ERROR: missing target."
|
2010-04-27 12:23:53 +00:00
|
|
|
usage && exit 1
|
2009-10-18 09:17:26 +00:00
|
|
|
fi
|
|
|
|
|
2010-05-17 20:23:52 +00:00
|
|
|
#
|
|
|
|
# Check for required utilities in host system.
|
|
|
|
#
|
|
|
|
check_reqhost_utils
|
|
|
|
|
2010-05-26 13:41:26 +00:00
|
|
|
if [ -n "$in_chroot" ]; then
|
|
|
|
XBPS_CONFIG_FILE="/usr/local/etc/xbps-src.conf"
|
|
|
|
fi
|
|
|
|
|
2009-10-18 09:17:26 +00:00
|
|
|
#
|
|
|
|
# Check configuration vars before anyting else, and set defaults vars.
|
|
|
|
#
|
|
|
|
check_config_vars
|
2010-04-26 23:34:19 +00:00
|
|
|
if [ -n "${_MASTERDIR}" ]; then
|
|
|
|
export XBPS_MASTERDIR=${_MASTERDIR}
|
|
|
|
fi
|
2010-01-16 01:11:44 +00:00
|
|
|
. @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh
|
2009-10-18 09:17:26 +00:00
|
|
|
set_defvars
|
2010-01-16 01:11:44 +00:00
|
|
|
|
2009-10-18 09:17:26 +00:00
|
|
|
. $XBPS_SHUTILSDIR/common_funcs.sh
|
|
|
|
|
2010-05-26 13:41:26 +00:00
|
|
|
#
|
|
|
|
# Fix up some vars when XBPS_USE_CAPABILITIES is set.
|
|
|
|
#
|
2010-04-26 12:54:06 +00:00
|
|
|
if [ -n "$XBPS_USE_CAPABILITIES" ]; then
|
2010-04-26 12:15:49 +00:00
|
|
|
chroot_cmd="@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-capchroot"
|
|
|
|
unset sudo_cmd
|
|
|
|
fi
|
|
|
|
|
2010-01-16 01:11:44 +00:00
|
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
|
|
# disable sudo and fakeroot if uid==0
|
2010-04-26 12:15:49 +00:00
|
|
|
chroot_cmd="chroot"
|
2010-01-16 01:11:44 +00:00
|
|
|
unset sudo_cmd
|
|
|
|
if [ -n "$in_chroot" ]; then
|
|
|
|
unset fakeroot_cmd
|
|
|
|
unset fakeroot_cmd_args
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-05-13 20:21:08 +00:00
|
|
|
[ -z "$dontrm_builddir" ] && dontrm_builddir=no
|
|
|
|
|
2010-05-26 13:41:26 +00:00
|
|
|
#
|
|
|
|
# Sanitize PATH.
|
|
|
|
#
|
|
|
|
if [ -z "$in_chroot" ]; then
|
|
|
|
# In non chroot case always prefer host tools.
|
2010-10-21 15:21:23 +00:00
|
|
|
MYPATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/usr/bin:$PATH"
|
2010-05-26 13:41:26 +00:00
|
|
|
MYPATH="$XBPS_MASTERDIR/usr/local/bin:$MYPATH"
|
|
|
|
MYPATH="$XBPS_MASTERDIR/usr/local/sbin:$MYPATH"
|
|
|
|
else
|
|
|
|
# In chroot always prefer tools from bootstrap.
|
|
|
|
MYPATH="/tools/bin:/usr/local/sbin:/usr/local/bin"
|
|
|
|
MYPATH="/bin:/sbin:/usr/bin:/usr/sbin:$MYPATH"
|
|
|
|
fi
|
|
|
|
export PATH="$MYPATH"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Main switch.
|
|
|
|
#
|
2009-10-18 09:17:26 +00:00
|
|
|
case "$target" in
|
2010-05-04 20:23:54 +00:00
|
|
|
bootstrap)
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
|
|
|
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
|
|
|
[ ! -d $XBPS_SRCPKGDIR/xbps-base-chroot ] && \
|
2010-12-19 23:22:12 +00:00
|
|
|
msg_error "Cannot find $XBPS_SRCPKGDIR/xbps-base-chroot directory!\n"
|
2010-05-13 22:07:47 +00:00
|
|
|
cd $XBPS_SRCPKGDIR/xbps-base-chroot && _ORIGINPKG="$(basename_cwd)"
|
|
|
|
setup_tmpl ${_ORIGINPKG} && install_pkg $pkgname
|
2010-05-04 20:23:54 +00:00
|
|
|
;;
|
2009-10-18 09:17:26 +00:00
|
|
|
build|configure)
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
if [ -z "${_pkgname}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
. ./template
|
|
|
|
_pkgname=$(basename_cwd)
|
|
|
|
fi
|
2009-10-18 09:17:26 +00:00
|
|
|
|
|
|
|
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
|
|
|
. $XBPS_SHUTILSDIR/chroot.sh
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
xbps_chroot_handler $target ${_pkgname}
|
2009-10-18 09:17:26 +00:00
|
|
|
else
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
_ORIGINPKG="${_pkgname}"
|
2010-05-13 22:07:47 +00:00
|
|
|
setup_tmpl ${_ORIGINPKG}
|
2010-05-13 20:21:08 +00:00
|
|
|
# If pkg has dependencies, install them first.
|
|
|
|
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
|
|
|
. $XBPS_SHUTILSDIR/builddep_funcs.sh
|
|
|
|
install_dependencies_pkg "$pkgname-$version"
|
|
|
|
if [ $? -ne 0 ]; then
|
2010-12-19 23:22:12 +00:00
|
|
|
msg_red "cannot install required deps for $pkgname.\n"
|
2010-05-13 20:21:08 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# All deps were installed, continue with the origin pkg...
|
2010-05-13 22:07:47 +00:00
|
|
|
setup_tmpl ${_ORIGINPKG}
|
2009-10-18 09:17:26 +00:00
|
|
|
. $XBPS_SHUTILSDIR/fetch_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
fetch_distfiles
|
2009-10-18 09:17:26 +00:00
|
|
|
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
|
|
|
|
. $XBPS_SHUTILSDIR/extract_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
extract_distfiles
|
2009-10-18 09:17:26 +00:00
|
|
|
fi
|
|
|
|
if [ "$target" = "configure" ]; then
|
|
|
|
. $XBPS_SHUTILSDIR/configure_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
configure_src_phase
|
2009-10-18 09:17:26 +00:00
|
|
|
else
|
|
|
|
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
|
|
|
|
. $XBPS_SHUTILSDIR/configure_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
configure_src_phase
|
2009-10-18 09:17:26 +00:00
|
|
|
fi
|
|
|
|
. $XBPS_SHUTILSDIR/build_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
build_src_phase
|
2009-10-18 09:17:26 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
build-pkg)
|
|
|
|
. $XBPS_SHUTILSDIR/make-binpkg.sh
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
2010-03-30 15:01:59 +00:00
|
|
|
if [ -n "${_PACKAGEDIR}" ]; then
|
|
|
|
export XBPS_PACKAGESDIR=${_PACKAGEDIR}
|
|
|
|
fi
|
2009-10-18 09:17:26 +00:00
|
|
|
if [ "$2" = "all" ]; then
|
|
|
|
for f in $($XBPS_BIN_CMD list|awk '{print $1}'); do
|
2009-10-30 21:14:09 +00:00
|
|
|
pkg=$(${XBPS_PKGDB_CMD} getpkgname $f)
|
2009-11-22 07:31:44 +00:00
|
|
|
setup_tmpl $pkg
|
|
|
|
if [ "${pkg}" = "${sourcepkg}" ]; then
|
|
|
|
xbps_make_binpkg
|
2009-10-20 08:49:41 +00:00
|
|
|
fi
|
2009-10-18 09:17:26 +00:00
|
|
|
done
|
|
|
|
else
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
if [ -z "${_pkgname}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
_pkgname=$(basename_cwd)
|
|
|
|
fi
|
|
|
|
setup_tmpl ${_pkgname}
|
2009-11-22 07:31:44 +00:00
|
|
|
xbps_make_binpkg
|
2009-10-18 09:17:26 +00:00
|
|
|
fi
|
|
|
|
;;
|
2010-05-19 01:00:52 +00:00
|
|
|
checkvers)
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
|
|
|
. $XBPS_SHUTILSDIR/check_installed_packages.sh
|
|
|
|
check_installed_packages
|
|
|
|
;;
|
2009-10-18 09:17:26 +00:00
|
|
|
chroot)
|
|
|
|
. $XBPS_SHUTILSDIR/chroot.sh
|
|
|
|
xbps_chroot_handler chroot dummy
|
|
|
|
;;
|
2010-05-20 02:05:35 +00:00
|
|
|
clean)
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
if [ -z "${_pkgname}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
_pkgname=$(basename_cwd)
|
|
|
|
fi
|
|
|
|
setup_tmpl ${_pkgname}
|
2010-05-20 02:05:35 +00:00
|
|
|
remove_tmpl_wrksrc $wrksrc
|
|
|
|
;;
|
2009-10-18 09:17:26 +00:00
|
|
|
extract|fetch|info)
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
if [ -z "${_pkgname}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
_pkgname=$(basename_cwd)
|
|
|
|
fi
|
|
|
|
setup_tmpl ${_pkgname}
|
2009-10-18 09:17:26 +00:00
|
|
|
if [ "$target" = "info" ]; then
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
info_tmpl
|
2009-10-18 09:17:26 +00:00
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
if [ "$target" = "fetch" ]; then
|
|
|
|
. $XBPS_SHUTILSDIR/fetch_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
fetch_distfiles $update_checksum
|
2009-10-18 09:17:26 +00:00
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
. $XBPS_SHUTILSDIR/extract_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
extract_distfiles
|
2009-10-18 09:17:26 +00:00
|
|
|
;;
|
|
|
|
install|install-destdir)
|
2010-01-16 01:11:44 +00:00
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
if [ -z "${_pkgname}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
_pkgname=$(basename_cwd)
|
|
|
|
fi
|
|
|
|
setup_tmpl ${_pkgname}
|
2010-05-07 10:25:24 +00:00
|
|
|
install_destdir_target=no
|
2009-10-18 09:17:26 +00:00
|
|
|
[ "$target" = "install-destdir" ] && install_destdir_target=yes
|
2010-05-07 10:25:24 +00:00
|
|
|
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
_ORIGINPKG="${_pkgname}"
|
2010-01-16 01:11:44 +00:00
|
|
|
if [ -z "$in_chroot" -a -z "$base_chroot" ]; then
|
|
|
|
. $XBPS_SHUTILSDIR/chroot.sh
|
2010-05-13 22:07:47 +00:00
|
|
|
xbps_chroot_handler $target ${_ORIGINPKG} $dontrm_builddir
|
2010-01-16 01:11:44 +00:00
|
|
|
else
|
|
|
|
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
2010-05-13 22:07:47 +00:00
|
|
|
setup_tmpl ${_ORIGINPKG}
|
2010-01-16 01:11:44 +00:00
|
|
|
install_pkg $pkgname
|
|
|
|
fi
|
2009-10-18 09:17:26 +00:00
|
|
|
;;
|
|
|
|
list|listfiles)
|
|
|
|
if [ "$target" = "list" ]; then
|
|
|
|
$XBPS_BIN_CMD list
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
|
|
|
list_pkg_files $2
|
|
|
|
;;
|
2010-04-26 23:34:19 +00:00
|
|
|
make-repoidx)
|
2010-05-03 20:33:52 +00:00
|
|
|
if [ -n "${_PACKAGEDIR}" ]; then
|
|
|
|
export XBPS_PACKAGESDIR=${_PACKAGEDIR}
|
|
|
|
fi
|
2010-04-26 23:34:19 +00:00
|
|
|
echo "=> Updating package index for local repository at"
|
|
|
|
echo " $XBPS_PACKAGESDIR..."
|
|
|
|
${XBPS_REPO_CMD} genindex ${XBPS_PACKAGESDIR} 2>/dev/null
|
|
|
|
[ $? -eq 0 ] && echo "=> done."
|
|
|
|
;;
|
2009-10-18 09:17:26 +00:00
|
|
|
remove)
|
|
|
|
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
if [ -z "${_pkgname}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
_pkgname=$(basename_cwd)
|
|
|
|
fi
|
|
|
|
setup_tmpl ${_pkgname}
|
2009-11-22 07:31:44 +00:00
|
|
|
remove_pkg
|
2009-10-18 09:17:26 +00:00
|
|
|
;;
|
|
|
|
stow)
|
|
|
|
stow_flag=yes
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
if [ -z "${_pkgname}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
_pkgname=$(basename_cwd)
|
|
|
|
fi
|
|
|
|
setup_tmpl ${_pkgname}
|
2009-10-18 09:17:26 +00:00
|
|
|
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
stow_pkg_handler stow
|
2009-10-18 09:17:26 +00:00
|
|
|
;;
|
|
|
|
unstow)
|
|
|
|
. $XBPS_SHUTILSDIR/tmpl_funcs.sh
|
xbps-src: make some targets work by specifying its pkgname.
There are now two ways to use the following targets:
build, build-pkg, clean, configure, extract, fetch, info, install,
install-destdir, remove, stow, unstow.
1) The known way: 'cd srcpkgs/foo && xbps-src <target>"
2) The new way: 'xbps-src <target> foo'.
2010-12-21 17:45:39 +00:00
|
|
|
if [ -z "${_pkgname}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
_pkgname=$(basename_cwd)
|
|
|
|
fi
|
|
|
|
setup_tmpl ${_pkgname}
|
2009-10-18 09:17:26 +00:00
|
|
|
. $XBPS_SHUTILSDIR/stow_funcs.sh
|
2009-11-22 07:31:44 +00:00
|
|
|
stow_pkg_handler unstow
|
2009-10-18 09:17:26 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "=> ERROR: invalid target: $target."
|
2010-04-27 12:23:53 +00:00
|
|
|
usage && exit 1
|
2009-10-18 09:17:26 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Agur
|
|
|
|
exit $?
|