2014-03-22 12:31:42 +01:00
|
|
|
#!/bin/bash
|
|
|
|
# vim: set ts=4 sw=4 et:
|
|
|
|
|
2015-07-14 12:07:15 +02:00
|
|
|
print_cross_targets() {
|
|
|
|
local f
|
|
|
|
for f in common/cross-profiles/*.sh; do
|
|
|
|
f=${f%.sh}; f=${f##*/}; printf "\t$f\n"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2014-03-22 12:31:42 +01:00
|
|
|
usage() {
|
2014-04-28 23:03:35 +02:00
|
|
|
cat << _EOF
|
2014-03-22 12:31:42 +01:00
|
|
|
$(basename $0): [options] <target> [arguments]
|
|
|
|
|
|
|
|
Targets: (only one may be specified)
|
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
binary-bootstrap [arch]
|
|
|
|
Install bootstrap packages from host repositories into <masterdir>.
|
|
|
|
If the optional 'arch' argument is set, it will install bootstrap packages
|
|
|
|
from this architecture, and its required xbps utilities. The <masterdir>
|
|
|
|
will be initialized for chroot operations.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
bootstrap
|
|
|
|
Build and install from source the bootstrap packages into <masterdir>.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
bootstrap-update
|
|
|
|
Updates bootstrap packages with latest versions available from registered
|
|
|
|
repositories in the XBPS configuration file.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
build <pkgname>
|
|
|
|
Build package source (fetch + extract + configure + build).
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
chroot
|
|
|
|
Enter to the chroot in <masterdir>.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-05-23 17:14:00 +02:00
|
|
|
clean [pkgname]
|
|
|
|
Removes auto dependencies, cleans up <masterdir>/builddir and <masterdir>/destdir.
|
2014-12-10 18:58:39 +01:00
|
|
|
If <pkgname> argument is specified, package files from <masterdir>/destdir and its
|
2014-12-10 18:57:11 +01:00
|
|
|
build directory in <masterdir>/buiddir are removed.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
configure <pkgname>
|
|
|
|
Configure a package (fetch + extract + configure).
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
extract <pkgname>
|
|
|
|
Extract package source distribution file(s) into the build directory.
|
|
|
|
By default set to <masterdir>/builddir.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
fetch <pkgname>
|
|
|
|
Download package source distribution file(s).
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
install <pkgname>
|
|
|
|
Install target package into <destdir> but not building the binary package
|
|
|
|
and not removing build directory for inspection purposes.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-05-20 10:02:09 +02:00
|
|
|
list
|
|
|
|
Lists installed packages in <masterdir>.
|
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
pkg <pkgname>
|
|
|
|
Build binary package for <pkgname> and all required dependencies.
|
2014-03-23 11:27:09 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
remove <pkgname>
|
|
|
|
Remove target package from <destdir>. If <pkgname>-<version> is not matched
|
|
|
|
from build template nothing is removed.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
remove-autodeps
|
|
|
|
Removes all package dependencies that were installed automatically.
|
2014-03-23 11:27:09 +01:00
|
|
|
|
2015-07-06 09:47:52 +02:00
|
|
|
purge-distfiles
|
|
|
|
Removes all obsolete distfiles in <hostdir>/sources.
|
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show <pkgname>
|
|
|
|
Show information for the specified package.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2015-04-16 08:38:32 +02:00
|
|
|
show-avail <pkgname>
|
|
|
|
Returns 0 if package can be built for the given architecture,
|
|
|
|
any other error otherwise.
|
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-build-deps <pkgname>
|
|
|
|
Show required build dependencies for <pkgname>.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-deps <pkgname>
|
|
|
|
Show required run-time dependencies for <pkgname>. Package must be
|
|
|
|
installed into destdir.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-files <pkgname>
|
|
|
|
Show files installed by <pkgname>. Package must be installed into destdir.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-options <pkgname>
|
|
|
|
Show available build options by <pkgname>.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-shlib-provides <pkgname>
|
|
|
|
Show list of provided shlibs for <pkgname>. Package must be installed into destdir.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-shlib-requires <pkgname>
|
|
|
|
Show list of required shlibs for <pkgname>. Package must be installed into destdir.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-var <var>
|
|
|
|
Prints the value of <var> if it's defined in xbps-src.
|
2014-04-09 09:52:48 +02:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-repo-updates
|
|
|
|
Prints the list of outdated packages in XBPS repositories.
|
2014-04-09 12:11:50 +02:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
show-sys-updates
|
|
|
|
Prints the list of oudated packages in your system.
|
2014-04-09 12:11:50 +02:00
|
|
|
|
2015-08-16 10:45:19 +02:00
|
|
|
sort-dependencies <pkg> <pkgN+1> ...
|
|
|
|
Given a list of packages specified as additional arguments, a sorted dependency
|
|
|
|
list will be returned to stdout.
|
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
update-bulk
|
|
|
|
Rebuilds all packages in the system repositories that are outdated.
|
2014-04-09 16:42:07 +02:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
update-sys
|
|
|
|
Rebuilds all packages in your system that are outdated and updates them.
|
2014-04-09 16:42:07 +02:00
|
|
|
|
2014-10-31 20:43:30 +01:00
|
|
|
update-check <pkgname>
|
|
|
|
Check upstream site of <pkgname> for new releases.
|
|
|
|
|
2015-07-03 18:30:34 +02:00
|
|
|
update-hash-cache
|
|
|
|
Update the hash cache with existing source distfiles.
|
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
zap
|
|
|
|
Removes a masterdir but preserving ccache, distcc and host directories.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
|
|
|
Options:
|
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-a <profile>
|
2015-07-14 12:07:15 +02:00
|
|
|
Cross compile packages for this profile. Supported targets:
|
|
|
|
|
|
|
|
$(print_cross_targets)
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-C Do not remove build directory, automatic dependencies and
|
|
|
|
package destdir after successful install.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2015-02-28 10:29:27 +01:00
|
|
|
-E If a binary package exists in a local repository for the target package,
|
|
|
|
do not try to build it, exit immediately.
|
|
|
|
|
2015-09-24 15:45:47 +02:00
|
|
|
-f Force running the specified stage (configure/build/install/pkg)
|
|
|
|
even if it ran successfully.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-07-01 10:33:54 +02:00
|
|
|
-G Enable XBPS_USE_GIT_REVS (see etc/defaults.conf for more information).
|
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-g Enable building -dbg packages with debugging symbols.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-H <hostdir>
|
|
|
|
Absolute path to a directory to be bind mounted at <masterdir>/host.
|
|
|
|
The host directory stores binary packages, sources and package dependencies
|
|
|
|
downloaded from remote repositories.
|
2014-10-11 11:15:02 +02:00
|
|
|
If unset defaults to void-packages/hostdir.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-h Usage output.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-I Ignore required dependencies, useful for extracting/fetching sources.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-j Number of parallel build jobs to use when building packages.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-L Disable ASCII colors.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-m <masterdir>
|
|
|
|
Absolute path to a directory to be used as masterdir.
|
|
|
|
The masterdir is the main directory to build/store/compile packages.
|
2014-10-11 11:15:02 +02:00
|
|
|
If unset defaults to void-packages/masterdir.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-N Disable use of remote repositories to resolve dependencies.
|
2014-03-22 12:31:42 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
-o <opt,~opt2,...>
|
2014-06-30 11:32:07 +02:00
|
|
|
Enable or disable (prefixed with ~) package build options. Note this overrides
|
|
|
|
options set via XBPS_PKG_OPTIONS from 'etc/conf'. This effectively has the same
|
|
|
|
effect than setting 'XBPS_PKG_OPTIONS_<pkgname>' in 'etc/conf'.
|
2014-04-28 23:03:35 +02:00
|
|
|
Supported options can be shown with the 'show-options' target.
|
|
|
|
|
|
|
|
-r <repo>
|
|
|
|
Use an alternative local repository to store generated binary packages.
|
|
|
|
If unset defaults to <hostdir>/binpkgs. If set the binpkgs will
|
|
|
|
be stored into <hostdir>/binpkgs/<repo>.
|
|
|
|
This alternative repository will also be used to resolve dependencies
|
|
|
|
with highest priority order than others.
|
2015-02-27 23:00:55 +01:00
|
|
|
|
|
|
|
-t Create a temporary masterdir to not pollute the current one. Note that
|
|
|
|
the existing masterdir must be fully populated with binary-bootstrap first.
|
|
|
|
Once the target has finished, this temporary masterdir will be removed.
|
|
|
|
|
2014-03-22 12:31:42 +01:00
|
|
|
_EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
check_reqhost_utils() {
|
2014-04-28 23:03:35 +02:00
|
|
|
local broken
|
|
|
|
|
|
|
|
[ -n "$IN_CHROOT" ] && return 0
|
|
|
|
|
|
|
|
for f in ${REQHOST_UTILS}; do
|
|
|
|
if ! command -v ${f} &>/dev/null; then
|
|
|
|
echo "${f} is missing in your system, can't continue!"
|
|
|
|
broken=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
[ -n "$broken" ] && exit 1
|
|
|
|
[ -z "$1" ] && return 0
|
|
|
|
|
|
|
|
for f in ${REQHOST_UTILS_BOOTSTRAP}; do
|
|
|
|
if ! command -v ${f} &>/dev/null; then
|
|
|
|
echo "${f} is missing in your system, can't continue!"
|
|
|
|
broken=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
[ -n "$broken" ] && exit 1
|
2014-03-22 12:31:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
check_config_vars() {
|
|
|
|
if [ -s "$XBPS_CONFIG_FILE" ]; then
|
|
|
|
. $XBPS_CONFIG_FILE &>/dev/null
|
|
|
|
fi
|
|
|
|
if [ -z "$XBPS_MASTERDIR" ]; then
|
|
|
|
export XBPS_MASTERDIR="${XBPS_DISTDIR}/masterdir"
|
2014-04-22 16:01:05 +02:00
|
|
|
fi
|
|
|
|
if [ -z "$XBPS_HOSTDIR" ]; then
|
|
|
|
export XBPS_HOSTDIR="${XBPS_DISTDIR}/hostdir"
|
|
|
|
[ ! -d $XBPS_HOSTDIR ] && mkdir -p $XBPS_HOSTDIR
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
2014-04-28 23:03:35 +02:00
|
|
|
if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then
|
|
|
|
echo "ERROR: not enough perms for masterdir $XBPS_MASTERDIR."
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
check_build_requirements() {
|
|
|
|
local found
|
|
|
|
|
|
|
|
for f in $XBPS_SHUTILSDIR/*.sh; do
|
2014-04-28 23:03:35 +02:00
|
|
|
[ -r $f ] && . $f
|
2014-03-22 12:31:42 +01:00
|
|
|
done
|
|
|
|
case "$XBPS_TARGET" in
|
|
|
|
*bootstrap*) found=1;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
if [ -z "$found" ]; then
|
2014-04-28 23:03:35 +02:00
|
|
|
xbps-uhelper cmpver "$XBPS_VERSION" "$XBPS_VERSION_REQ"
|
|
|
|
if [ $? -eq 255 ]; then
|
|
|
|
echo "ERROR: requires xbps>=${XBPS_VERSION_REQ}"
|
|
|
|
echo "Bootstrap packages must be updated with 'xbps-src bootstrap-update'"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
|
|
|
# Set XBPS_REPOSITORY to our current branch.
|
|
|
|
if [ -z "$XBPS_ALT_REPOSITORY" ]; then
|
2014-04-28 23:03:35 +02:00
|
|
|
pushd "$PWD" &>/dev/null
|
|
|
|
cd $XBPS_DISTDIR
|
2015-11-13 10:54:14 +01:00
|
|
|
if [ -n "$IN_CHROOT" ]; then
|
|
|
|
_gitbranch="$(chroot-git symbolic-ref --short HEAD 2>/dev/null)"
|
|
|
|
else
|
|
|
|
_gitbranch="$(git symbolic-ref --short HEAD 2>/dev/null)"
|
|
|
|
fi
|
2014-04-28 23:03:35 +02:00
|
|
|
if [ -n "${_gitbranch}" -a "${_gitbranch}" != "master" ]; then
|
2014-03-25 09:55:40 +01:00
|
|
|
export XBPS_ALT_REPOSITORY="${_gitbranch}"
|
2014-04-28 23:03:35 +02:00
|
|
|
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${_gitbranch}"
|
2015-03-14 07:50:05 +01:00
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
|
|
|
msg_normal "Using \`$XBPS_REPOSITORY\' as local repository.\n"
|
|
|
|
fi
|
2014-04-28 23:03:35 +02:00
|
|
|
fi
|
|
|
|
popd &>/dev/null
|
2014-03-22 12:31:42 +01:00
|
|
|
else
|
|
|
|
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${XBPS_ALT_REPOSITORY}"
|
2015-03-14 07:50:05 +01:00
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
|
|
|
msg_normal "Using \`$XBPS_REPOSITORY\' as local repository.\n"
|
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-08-26 10:50:48 +02:00
|
|
|
install_bbootstrap() {
|
2014-03-22 12:31:42 +01:00
|
|
|
[ -n "$CHROOT_READY" ] && return
|
2015-06-07 10:21:08 +02:00
|
|
|
if [ "$1" = "bootstrap" ]; then
|
2015-05-11 09:03:03 +02:00
|
|
|
unset XBPS_TARGET_PKG XBPS_INSTALL_ARGS
|
2015-06-07 10:21:08 +02:00
|
|
|
else
|
|
|
|
XBPS_TARGET_PKG="$1"
|
2015-05-11 09:03:03 +02:00
|
|
|
fi
|
|
|
|
if [ -n "$XBPS_SKIP_REMOTEREPOS" ]; then
|
2015-05-05 11:52:17 +02:00
|
|
|
unset XBPS_INSTALL_ARGS
|
|
|
|
fi
|
2014-04-28 23:03:35 +02:00
|
|
|
# binary bootstrap
|
|
|
|
msg_normal "Installing bootstrap from binary package repositories...\n"
|
|
|
|
# XBPS_TARGET_PKG == arch
|
|
|
|
if [ -n "$XBPS_TARGET_PKG" ]; then
|
|
|
|
_bootstrap_arch="env XBPS_TARGET_ARCH=$XBPS_TARGET_PKG"
|
2014-03-22 12:31:42 +01:00
|
|
|
if [ "${XBPS_TARGET_PKG}" != "${XBPS_TARGET_PKG#*-}" ]; then
|
|
|
|
_subarch="-${XBPS_TARGET_PKG#*-}"
|
|
|
|
fi
|
2014-04-28 23:03:35 +02:00
|
|
|
fi
|
2014-07-01 18:43:48 +02:00
|
|
|
mkdir -p $XBPS_MASTERDIR/var/db/xbps/keys
|
2014-08-26 10:33:15 +02:00
|
|
|
cd $XBPS_MASTERDIR
|
2014-07-01 18:43:48 +02:00
|
|
|
cp -f $XBPS_COMMONDIR/repo-keys/*.plist $XBPS_MASTERDIR/var/db/xbps/keys
|
2015-10-31 08:19:09 +01:00
|
|
|
${_bootstrap_arch} $XBPS_INSTALL_CMD ${XBPS_INSTALL_ARGS:+-S $XBPS_INSTALL_ARGS} -y base-chroot${_subarch}
|
2014-04-28 23:03:35 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
msg_error "Failed to install bootstrap packages!\n"
|
|
|
|
fi
|
2015-06-03 10:44:58 +02:00
|
|
|
# Reconfigure base-files to create dirs/symlinks.
|
2015-11-02 20:25:16 +01:00
|
|
|
if xbps-query -r $XBPS_MASTERDIR base-files &>/dev/null; then
|
2015-06-03 10:50:57 +02:00
|
|
|
XBPS_ARCH=$XBPS_TARGET_PKG xbps-reconfigure -r $XBPS_MASTERDIR -f base-files &>/dev/null
|
|
|
|
fi
|
2015-11-02 20:25:16 +01:00
|
|
|
|
2014-04-28 23:03:35 +02:00
|
|
|
msg_normal "Installed bootstrap successfully!\n"
|
|
|
|
chroot_prepare $XBPS_TARGET_PKG || msg_error "Failed to initialize chroot!\n"
|
2014-03-22 12:31:42 +01:00
|
|
|
}
|
|
|
|
|
2015-11-02 20:25:16 +01:00
|
|
|
reconfigure_bootstrap_pkgs() {
|
|
|
|
local statefile="$XBPS_MASTERDIR/.xbps_chroot_configured"
|
|
|
|
local pkgs="ca-certificates"
|
|
|
|
[ -z "$IN_CHROOT" -o -e $statefile ] && return 0
|
|
|
|
# Reconfigure ca-certificates.
|
|
|
|
msg_normal "Reconfiguring bootstrap packages...\n"
|
|
|
|
for f in ${pkgs}; do
|
|
|
|
if xbps-query $f &>/dev/null; then
|
|
|
|
xbps-reconfigure -f $f
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
touch -f $statefile
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-02 15:51:51 +01:00
|
|
|
bootstrap_update() {
|
2015-04-09 19:45:59 +02:00
|
|
|
if [ -z "$CHROOT_READY" ]; then
|
2015-03-02 15:51:51 +01:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
remove_pkg_autodeps
|
2015-04-09 19:52:21 +02:00
|
|
|
msg_normal "xbps-src: cleaning up masterdir...\n"
|
|
|
|
rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
|
|
|
|
msg_normal "xbps-src: updating $XBPS_MASTERDIR ...\n"
|
2015-06-09 09:23:06 +02:00
|
|
|
${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -Syu
|
2015-03-02 15:51:51 +01:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2014-03-22 12:31:42 +01:00
|
|
|
masterdir_zap() {
|
2014-04-28 23:03:35 +02:00
|
|
|
for f in bin boot builddir destdir dev etc home lib lib32 lib64 mnt \
|
2014-10-11 11:02:57 +02:00
|
|
|
opt proc root run sbin sys tmp usr var host media xbps \
|
2015-11-02 20:32:12 +01:00
|
|
|
void-packages .xbps_chroot_init .xbps_chroot_configured; do
|
2014-04-28 23:03:35 +02:00
|
|
|
if [ -d "$XBPS_MASTERDIR/$f" ]; then
|
|
|
|
echo "Removing directory $XBPS_MASTERDIR/$f ..."
|
|
|
|
rm -rf $XBPS_MASTERDIR/$f
|
|
|
|
elif [ -h "$XBPS_MASTERDIR/$f" ]; then
|
|
|
|
echo "Removing link $XBPS_MASTERDIR/$f ..."
|
|
|
|
rm -f $XBPS_MASTERDIR/$f
|
|
|
|
elif [ -f "$XBPS_MASTERDIR/$f" ]; then
|
|
|
|
echo "Removing file $XBPS_MASTERDIR/$f ..."
|
|
|
|
rm -f $XBPS_MASTERDIR/$f
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "$XBPS_MASTERDIR masterdir cleaned up."
|
2014-03-22 12:31:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
exit_func() {
|
2014-05-15 20:45:14 +02:00
|
|
|
wait
|
2014-03-22 12:31:42 +01:00
|
|
|
if [ -n "$sourcepkg" ]; then
|
2014-04-28 23:03:35 +02:00
|
|
|
remove_pkg $XBPS_CROSS_BUILD
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
2014-04-28 23:03:35 +02:00
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
|
|
|
msg_red "xbps-src: a failure has ocurred! exiting...\n"
|
|
|
|
fi
|
|
|
|
exit 2
|
2014-03-22 12:31:42 +01:00
|
|
|
}
|
|
|
|
|
2014-03-23 09:04:05 +01:00
|
|
|
basename_cwd() {
|
|
|
|
echo $(basename $(pwd))
|
|
|
|
}
|
|
|
|
|
|
|
|
read_pkg() {
|
|
|
|
if [ -z "${XBPS_TARGET_PKG}" ]; then
|
|
|
|
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
|
|
|
XBPS_TARGET_PKG=$(basename_cwd)
|
|
|
|
fi
|
|
|
|
setup_pkg $XBPS_TARGET_PKG $XBPS_CROSS_BUILD
|
|
|
|
}
|
|
|
|
|
2015-08-19 14:45:47 +02:00
|
|
|
setup_distfiles_mirror() {
|
|
|
|
local mirror scheme path
|
|
|
|
|
|
|
|
# Scheme file:// mirror locations only work with uchroot or proot
|
|
|
|
for mirror in $XBPS_DISTFILES_MIRROR; do
|
|
|
|
scheme="file"
|
|
|
|
if [[ "$mirror" == *://* ]]; then
|
|
|
|
scheme="${mirror%%://*}"
|
|
|
|
path="${mirror#${scheme}://}"
|
|
|
|
else
|
|
|
|
path="$mirror"
|
|
|
|
fi
|
|
|
|
[ "$scheme" != "file" ] && continue
|
|
|
|
if [ "$XBPS_CHROOT_CMD" == "uchroot" -o "$XBPS_CHROOT_CMD" == "proot" ]; then
|
|
|
|
if [ ! -d "$path" ]; then
|
|
|
|
msg_warn "Invalid path in XBPS_DISTFILES_MIRROR ($mirror)\n"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
mkdir -p "$XBPS_MASTERDIR/$path"
|
|
|
|
XBPS_CHROOT_CMD_ARGS+=" -b $path:$path"
|
|
|
|
else
|
|
|
|
msg_warn "File URLs ($mirror) don't work with '$XBPS_CHROOT_CMD'\n"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2015-07-12 10:05:39 +02:00
|
|
|
readonly XBPS_VERSION_REQ="0.46"
|
2014-03-23 09:08:41 +01:00
|
|
|
readonly XBPS_VERSION=$(xbps-uhelper -V|awk '{print $2}')
|
2014-04-01 11:29:21 +02:00
|
|
|
readonly XBPS_SRC_VERSION="113"
|
2015-05-14 11:22:19 +02:00
|
|
|
export XBPS_MACHINE=$(xbps-uhelper arch)
|
2014-03-23 09:08:41 +01:00
|
|
|
|
2014-03-22 12:31:42 +01:00
|
|
|
#
|
|
|
|
# main()
|
|
|
|
#
|
2014-04-22 16:01:05 +02:00
|
|
|
XBPS_OPTIONS=
|
|
|
|
|
2015-02-28 10:29:27 +01:00
|
|
|
while getopts "a:CEfgGhH:Ij:Lm:No:r:tV" opt; do
|
2014-04-28 23:03:35 +02:00
|
|
|
case $opt in
|
2015-03-01 16:45:16 +01:00
|
|
|
a) readonly XBPS_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
|
|
|
|
C) readonly XBPS_KEEP_ALL=1; XBPS_OPTIONS+=" -C";;
|
2015-02-28 10:29:27 +01:00
|
|
|
E) readonly XBPS_BINPKG_EXISTS=1; XBPS_OPTIONS+=" -E";;
|
2015-03-01 16:45:16 +01:00
|
|
|
f) readonly XBPS_BUILD_FORCEMODE=1; XBPS_OPTIONS+=" -f";;
|
|
|
|
G) readonly XBPS_USE_GIT_REVS=1; XBPS_OPTIONS+=" -G";;
|
|
|
|
g) readonly XBPS_DEBUG_PKGS=1; XBPS_OPTIONS+=" -g";;
|
|
|
|
H) readonly XBPS_HOSTDIR="$(readlink -m $OPTARG 2>/dev/null)"; XBPS_OPTIONS+=" -H $XBPS_HOSTDIR";;
|
2014-04-28 23:03:35 +02:00
|
|
|
h) usage && exit 0;;
|
2015-03-01 16:45:16 +01:00
|
|
|
I) readonly XBPS_SKIP_DEPS=1; XBPS_OPTIONS+=" -I";;
|
2015-07-11 20:51:15 +02:00
|
|
|
j) export XBPS_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+=" -j $OPTARG";;
|
2015-03-01 16:45:16 +01:00
|
|
|
L) export NOCOLORS=1; XBPS_OPTIONS+=" -L";;
|
|
|
|
m) readonly XBPS_MASTERDIR=$(readlink -m $OPTARG 2>/dev/null); XBPS_OPTIONS+=" -m $XBPS_MASTERDIR";;
|
|
|
|
N) readonly XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
|
|
|
|
o) readonly XBPS_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
|
|
|
|
r) readonly XBPS_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
|
|
|
|
t) export XBPS_TEMP_MASTERDIR=1; XBPS_OPTIONS+=" -t -C";;
|
2014-04-28 23:03:35 +02:00
|
|
|
V) echo $XBPS_SRC_VERSION && exit 0;;
|
|
|
|
--) shift; break;;
|
|
|
|
esac
|
2014-03-22 12:31:42 +01:00
|
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
2015-08-16 10:45:19 +02:00
|
|
|
[ $# -eq 0 ] && usage && exit 1
|
2014-03-22 12:31:42 +01:00
|
|
|
|
|
|
|
umask 022
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for required utilities in host system.
|
|
|
|
#
|
|
|
|
# Required utilities in host system for the bootstrap target.
|
2015-10-24 11:15:31 +02:00
|
|
|
readonly REQHOST_UTILS_BOOTSTRAP="make gawk bash bison sed gcc g++ msgfmt makeinfo \
|
2014-09-25 08:34:37 +02:00
|
|
|
perl tar xz gzip bzip2 patch flex"
|
2014-03-22 12:31:42 +01:00
|
|
|
|
|
|
|
# Required utilities in host system for chroot ops.
|
|
|
|
readonly REQHOST_UTILS="xbps-install xbps-query xbps-rindex xbps-uhelper \
|
2015-03-12 18:56:14 +01:00
|
|
|
xbps-reconfigure xbps-remove xbps-create xbps-uchroot xbps-uunshare git"
|
2014-03-22 12:31:42 +01:00
|
|
|
|
|
|
|
check_reqhost_utils
|
|
|
|
|
|
|
|
if [ -n "$IN_CHROOT" ]; then
|
|
|
|
readonly XBPS_CONFIG_FILE=/etc/xbps/xbps-src.conf
|
2014-10-11 11:15:02 +02:00
|
|
|
readonly XBPS_DISTDIR=/void-packages
|
2014-03-22 12:31:42 +01:00
|
|
|
else
|
2014-03-24 11:43:16 +01:00
|
|
|
_distdir="$(readlink -f $(dirname $0))"
|
2014-03-22 12:31:42 +01:00
|
|
|
if [ "${_distdir}" = "." ]; then
|
|
|
|
readonly XBPS_DISTDIR="$(pwd -P)"
|
|
|
|
else
|
|
|
|
readonly XBPS_DISTDIR="${_distdir}"
|
|
|
|
fi
|
2014-04-01 11:29:21 +02:00
|
|
|
# Read defaults and then the local configuration file
|
|
|
|
if [ -f $XBPS_DISTDIR/etc/defaults.conf ]; then
|
|
|
|
. $XBPS_DISTDIR/etc/defaults.conf
|
|
|
|
fi
|
2014-07-01 10:40:33 +02:00
|
|
|
if [ -s $XBPS_DISTDIR/etc/conf ]; then
|
|
|
|
# Read user configuration first...
|
|
|
|
readonly XBPS_CONFIG_FILE=$XBPS_DISTDIR/etc/conf
|
|
|
|
elif [ -s $HOME/.xbps-src.conf ]; then
|
|
|
|
# ... fallback to ~/.xbps-src.conf otherwise.
|
|
|
|
readonly XBPS_CONFIG_FILE=$HOME/.xbps-src.conf
|
|
|
|
. $XBPS_CONFIG_FILE
|
2014-04-23 16:37:02 +02:00
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check configuration vars before anyting else, and set defaults vars.
|
|
|
|
#
|
|
|
|
check_config_vars
|
|
|
|
|
2014-04-28 11:33:13 +02:00
|
|
|
if [ -n "$XBPS_HOSTDIR" ]; then
|
2014-04-28 23:03:35 +02:00
|
|
|
export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
|
|
|
|
readonly XBPS_SRCDISTDIR=$XBPS_HOSTDIR/sources
|
2014-04-28 11:33:13 +02:00
|
|
|
else
|
2014-04-28 23:03:35 +02:00
|
|
|
export XBPS_REPOSITORY=$XBPS_MASTERDIR/host/binpkgs
|
|
|
|
readonly XBPS_SRCDISTDIR=$XBPS_MASTERDIR/host/sources
|
2014-04-28 11:33:13 +02:00
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
if [ -n "$IN_CHROOT" ]; then
|
2014-04-28 23:03:35 +02:00
|
|
|
readonly XBPS_UHELPER_CMD="xbps-uhelper"
|
|
|
|
readonly XBPS_INSTALL_CMD="xbps-install"
|
|
|
|
readonly XBPS_QUERY_CMD="xbps-query"
|
|
|
|
readonly XBPS_RINDEX_CMD="xbps-rindex"
|
|
|
|
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure"
|
|
|
|
readonly XBPS_REMOVE_CMD="xbps-remove"
|
2014-10-11 11:15:02 +02:00
|
|
|
readonly XBPS_SRCPKGDIR=/void-packages/srcpkgs
|
|
|
|
readonly XBPS_COMMONDIR=/void-packages/common
|
2014-04-28 23:03:35 +02:00
|
|
|
readonly XBPS_DESTDIR=/destdir
|
|
|
|
readonly XBPS_BUILDDIR=/builddir
|
|
|
|
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
|
|
|
|
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
|
|
|
|
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
|
2015-02-21 12:13:07 +01:00
|
|
|
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build-style
|
2014-04-28 23:03:35 +02:00
|
|
|
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
|
2014-03-22 12:31:42 +01:00
|
|
|
else
|
2014-04-28 23:03:35 +02:00
|
|
|
readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR"
|
2015-06-09 09:23:06 +02:00
|
|
|
readonly XBPS_INSTALL_CMD="xbps-install -C /dev/null -c $XBPS_HOSTDIR/repocache --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR"
|
|
|
|
readonly XBPS_QUERY_CMD="xbps-query -C /dev/null -c $XBPS_HOSTDIR/repoache -i --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR"
|
2014-04-28 23:03:35 +02:00
|
|
|
readonly XBPS_RINDEX_CMD="xbps-rindex"
|
|
|
|
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR"
|
|
|
|
readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR"
|
|
|
|
readonly XBPS_SRCPKGDIR=$XBPS_DISTDIR/srcpkgs
|
|
|
|
readonly XBPS_COMMONDIR=$XBPS_DISTDIR/common
|
|
|
|
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
|
|
|
|
readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
|
|
|
|
readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
|
|
|
|
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
|
|
|
|
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
|
2015-02-21 12:13:07 +01:00
|
|
|
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build-style
|
2014-04-28 23:03:35 +02:00
|
|
|
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
|
|
|
# XBPS_FETCH_CMD can be overriden
|
|
|
|
export XBPS_FETCH_CMD="xbps-uhelper fetch"
|
|
|
|
readonly XBPS_DIGEST_CMD="xbps-uhelper digest"
|
|
|
|
readonly XBPS_CMPVER_CMD="xbps-uhelper cmpver"
|
|
|
|
|
2015-03-14 07:50:05 +01:00
|
|
|
readonly XBPS_TARGET="$1"
|
2015-03-14 09:47:56 +01:00
|
|
|
if [ -n "$2" ]; then
|
2015-05-05 11:52:17 +02:00
|
|
|
XBPS_TARGET_PKG="${2##*/}"
|
2015-03-14 09:47:56 +01:00
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
|
|
|
|
# Check if stdout is a tty; if false disable colors.
|
|
|
|
test -t 1 || export NOCOLORS=1
|
|
|
|
|
|
|
|
if [ -f $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
2014-04-28 23:03:35 +02:00
|
|
|
export CHROOT_READY=1
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
|
|
|
export XBPS_ARCH=$(cat $XBPS_MASTERDIR/.xbps_chroot_init)
|
2014-04-22 16:01:05 +02:00
|
|
|
if [ "$XBPS_MACHINE" = "x86_64" -a "$XBPS_ARCH" = "i686" -a -z "$IN_CHROOT" ]; then
|
2014-04-24 14:43:44 +02:00
|
|
|
# reconfigure pkgs via linux32
|
|
|
|
linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
|
2014-04-22 16:01:05 +02:00
|
|
|
# reexec itself via linux32
|
|
|
|
exec linux32 $0 ${XBPS_OPTIONS} $@
|
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
2014-11-22 07:00:50 +01:00
|
|
|
if [ -n "$XBPS_ARCH" ]; then
|
|
|
|
export XBPS_MACHINE=$XBPS_ARCH
|
|
|
|
fi
|
2015-02-10 10:38:13 +01:00
|
|
|
if [ -z "$XBPS_TARGET_MACHINE" ]; then
|
|
|
|
export XBPS_TARGET_MACHINE=${XBPS_ARCH:=$XBPS_MACHINE}
|
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
|
|
|
|
export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
2014-08-14 12:28:27 +02:00
|
|
|
XBPS_SRCPKGDIR XBPS_COMMONDIR XBPS_BUILDDIR XBPS_REPO_DELTAS \
|
2014-04-28 23:03:35 +02:00
|
|
|
XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_SRCDISTDIR XBPS_DIGEST_CMD \
|
|
|
|
XBPS_UHELPER_CMD XBPS_INSTALL_CMD XBPS_QUERY_CMD \
|
|
|
|
XBPS_RINDEX_CMD XBPS_RECONFIGURE_CMD XBPS_REMOVE_CMD \
|
|
|
|
XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_APIVER \
|
2015-03-04 15:17:05 +01:00
|
|
|
XBPS_BUILDSTYLEDIR XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_LDFLAGS \
|
2014-03-22 12:31:42 +01:00
|
|
|
XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
|
|
|
|
XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
|
2014-06-30 11:32:07 +02:00
|
|
|
XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_PKG_OPTIONS \
|
2014-03-22 12:31:42 +01:00
|
|
|
XBPS_CONFIG_FILE XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR \
|
2015-02-28 10:29:27 +01:00
|
|
|
XBPS_SRC_VERSION XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR \
|
2015-08-19 14:45:47 +02:00
|
|
|
XBPS_BINPKG_EXISTS XBPS_LIBEXECDIR XBPS_DISTDIR XBPS_DISTFILES_MIRROR
|
2014-03-22 12:31:42 +01:00
|
|
|
|
|
|
|
for i in REPOSITORY DESTDIR BUILDDIR SRCDISTDIR; do
|
|
|
|
eval val="\$XBPS_$i"
|
|
|
|
if [ ! -d "$val" ]; then
|
|
|
|
mkdir -p $val
|
|
|
|
fi
|
|
|
|
unset val
|
|
|
|
done
|
|
|
|
|
2015-04-16 11:35:58 +02:00
|
|
|
# A temporary masterdir requires xbps-uchroot(8) and -O to use overlayfs
|
|
|
|
# on tmpfs (available with xbps-0.45).
|
2015-04-16 11:40:37 +02:00
|
|
|
if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_MASTERDIR" ]; then
|
2015-04-16 11:35:58 +02:00
|
|
|
if [ "$XBPS_CHROOT_CMD" != "uchroot" ]; then
|
|
|
|
echo "ERROR: -t requires XBPS_CHROOT_CMD=uchroot, exiting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
export XBPS_CHROOT_CMD_ARGS="-O"
|
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
#
|
|
|
|
# Sanitize PATH.
|
|
|
|
#
|
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
2014-04-28 23:03:35 +02:00
|
|
|
# In non chroot case always prefer host tools.
|
|
|
|
MYPATH="$XBPS_MASTERDIR/usr/bin:$XBPS_MASTERDIR/usr/sbin"
|
|
|
|
export PATH="$PATH:$MYPATH"
|
2014-03-22 12:31:42 +01:00
|
|
|
else
|
2014-04-28 23:03:35 +02:00
|
|
|
MYPATH="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
|
|
|
export PATH="$MYPATH"
|
|
|
|
if [ -n "$XBPS_CCACHE" ]; then
|
|
|
|
CCACHEPATH="/usr/lib/ccache/bin"
|
2015-11-19 15:18:35 +01:00
|
|
|
export CCACHE_DIR="$XBPS_HOSTDIR/ccache-${XBPS_CROSS_BUILD:-${XBPS_MACHINE}}"
|
2015-05-18 20:05:16 +02:00
|
|
|
# Avoid not using cached files just due to compiler mtime
|
|
|
|
# changes when e.g. bootstrapping
|
|
|
|
export CCACHE_COMPILERCHECK=content
|
2014-04-28 23:03:35 +02:00
|
|
|
export PATH="$CCACHEPATH:$PATH"
|
2014-10-26 10:22:30 +01:00
|
|
|
mkdir -p $CCACHE_DIR
|
2014-04-28 23:03:35 +02:00
|
|
|
fi
|
|
|
|
if [ -n "$XBPS_DISTCC" ]; then
|
2015-05-02 17:09:37 +02:00
|
|
|
if [ -n "$XBPS_CCACHE" ]; then
|
|
|
|
export CCACHE_PREFIX="/usr/bin/distcc"
|
|
|
|
else
|
|
|
|
DISTCCPATH="/usr/lib/distcc/bin"
|
|
|
|
export PATH="$DISTCCPATH:$PATH"
|
|
|
|
fi
|
2014-10-26 10:52:11 +01:00
|
|
|
export DISTCC_DIR="$XBPS_HOSTDIR/distcc-${XBPS_CROSS_BUILD:-${XBPS_MACHINE}}"
|
2014-04-28 23:03:35 +02:00
|
|
|
export DISTCC_HOSTS="$XBPS_DISTCC_HOSTS"
|
2014-10-26 10:22:30 +01:00
|
|
|
mkdir -p $DISTCC_DIR
|
2014-04-28 23:03:35 +02:00
|
|
|
fi
|
2014-03-22 12:31:42 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
check_build_requirements
|
|
|
|
|
2015-03-14 07:50:05 +01:00
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
|
|
|
trap 'exit_func' INT TERM
|
2015-08-19 14:45:47 +02:00
|
|
|
if [ -n "$XBPS_DISTFILES_MIRROR" ]; then
|
|
|
|
setup_distfiles_mirror
|
|
|
|
fi
|
2015-03-14 07:50:05 +01:00
|
|
|
fi
|
2015-03-01 16:45:16 +01:00
|
|
|
|
2015-11-02 20:25:16 +01:00
|
|
|
reconfigure_bootstrap_pkgs
|
|
|
|
|
2014-03-22 12:31:42 +01:00
|
|
|
#
|
|
|
|
# Main switch.
|
|
|
|
#
|
|
|
|
case "$XBPS_TARGET" in
|
2014-04-28 23:03:35 +02:00
|
|
|
binary-bootstrap)
|
2015-06-07 10:21:08 +02:00
|
|
|
install_bbootstrap ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
|
2014-04-28 23:03:35 +02:00
|
|
|
;;
|
|
|
|
bootstrap)
|
|
|
|
# bootstrap from sources
|
|
|
|
# check for required host utils
|
|
|
|
check_reqhost_utils bootstrap
|
|
|
|
[ ! -d $XBPS_SRCPKGDIR/base-chroot ] && \
|
|
|
|
msg_error "Cannot find $XBPS_SRCPKGDIR/base-chroot directory!\n"
|
2014-12-22 11:38:34 +01:00
|
|
|
bootstrap_vpkg=${XBPS_MASTERDIR}/etc/xbps.d/bootstrap-vpkgs.conf
|
|
|
|
mkdir -p ${XBPS_MASTERDIR}/etc/xbps.d
|
2014-05-19 12:42:43 +02:00
|
|
|
if [ ! -s ${bootstrap_vpkg} ]; then
|
|
|
|
# Fool xbps to resolve dependencies.
|
|
|
|
echo 'virtualpkg=libgcc-4.4.0_1:base-files' >> ${bootstrap_vpkg}
|
|
|
|
echo 'virtualpkg=libstdc++-4.4.0_1:base-files' >> ${bootstrap_vpkg}
|
|
|
|
fi
|
2015-03-14 07:50:05 +01:00
|
|
|
$XBPS_LIBEXECDIR/build.sh base-chroot base-chroot $XBPS_TARGET || exit 1
|
2014-08-26 10:33:15 +02:00
|
|
|
[ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
|
2015-05-05 11:52:17 +02:00
|
|
|
install_bbootstrap bootstrap
|
2014-04-28 23:03:35 +02:00
|
|
|
;;
|
|
|
|
bootstrap-update)
|
2015-03-02 15:51:51 +01:00
|
|
|
bootstrap_update
|
2014-04-28 23:03:35 +02:00
|
|
|
;;
|
|
|
|
chroot)
|
|
|
|
chroot_handler chroot dummy
|
|
|
|
;;
|
|
|
|
clean)
|
2014-05-23 17:14:00 +02:00
|
|
|
if [ -z "$XBPS_TARGET_PKG" ]; then
|
2015-01-04 12:14:14 +01:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler remove-autodeps
|
|
|
|
else
|
|
|
|
remove_pkg_autodeps
|
|
|
|
fi
|
2014-05-23 17:14:00 +02:00
|
|
|
msg_normal "xbps-src: cleaning up masterdir...\n"
|
2014-12-11 11:11:58 +01:00
|
|
|
rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
|
2015-09-03 07:36:27 +02:00
|
|
|
rm -f $XBPS_MASTERDIR/tmp/* >/dev/null 2>&1
|
2014-04-28 23:03:35 +02:00
|
|
|
else
|
2014-05-23 17:14:00 +02:00
|
|
|
read_pkg
|
2015-01-04 12:14:14 +01:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || exit $?
|
|
|
|
else
|
2014-05-23 17:14:00 +02:00
|
|
|
remove_pkg_wrksrc $wrksrc
|
2014-12-13 09:42:11 +01:00
|
|
|
remove_pkg_statedir
|
2014-05-23 17:14:00 +02:00
|
|
|
if declare -f do_clean >/dev/null; then
|
|
|
|
run_func do_clean
|
|
|
|
fi
|
2015-01-04 12:14:14 +01:00
|
|
|
fi
|
|
|
|
remove_pkg $XBPS_CROSS_BUILD
|
2014-04-28 23:03:35 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
remove-autodeps)
|
2015-01-04 12:14:14 +01:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler remove-autodeps
|
|
|
|
else
|
|
|
|
remove_pkg_autodeps
|
|
|
|
fi
|
2014-04-28 23:03:35 +02:00
|
|
|
;;
|
2014-11-17 17:32:30 +01:00
|
|
|
fetch|extract|build|configure|install|pkg)
|
2014-04-28 23:03:35 +02:00
|
|
|
read_pkg
|
2015-01-04 12:14:14 +01:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG
|
|
|
|
else
|
2015-05-06 11:21:26 +02:00
|
|
|
[ -z "$XBPS_KEEP_ALL" -a -z "$XBPS_SKIP_DEPS" ] && remove_pkg_autodeps
|
2015-03-14 07:50:05 +01:00
|
|
|
$XBPS_LIBEXECDIR/build.sh $XBPS_TARGET_PKG $XBPS_TARGET_PKG \
|
2015-03-19 10:08:02 +01:00
|
|
|
$XBPS_TARGET $XBPS_CROSS_BUILD || exit $?
|
2015-01-04 12:14:14 +01:00
|
|
|
fi
|
2014-04-28 23:03:35 +02:00
|
|
|
;;
|
|
|
|
remove|remove-destdir)
|
|
|
|
read_pkg
|
|
|
|
remove_pkg $XBPS_CROSS_BUILD
|
|
|
|
;;
|
|
|
|
list)
|
|
|
|
$XBPS_QUERY_CMD -l
|
|
|
|
;;
|
2015-07-06 09:47:52 +02:00
|
|
|
purge-distfiles)
|
|
|
|
purge_distfiles
|
|
|
|
;;
|
2014-04-28 23:03:35 +02:00
|
|
|
show)
|
|
|
|
read_pkg
|
|
|
|
show_pkg
|
|
|
|
;;
|
2015-04-16 08:38:32 +02:00
|
|
|
show-avail)
|
|
|
|
read_pkg
|
|
|
|
show_avail
|
|
|
|
;;
|
2014-04-28 23:03:35 +02:00
|
|
|
show-files)
|
|
|
|
read_pkg
|
|
|
|
show_pkg_files
|
|
|
|
;;
|
|
|
|
show-deps)
|
|
|
|
read_pkg
|
|
|
|
show_pkg_deps
|
|
|
|
;;
|
|
|
|
show-build-deps)
|
|
|
|
read_pkg
|
|
|
|
show_pkg_build_deps
|
|
|
|
;;
|
|
|
|
show-options)
|
|
|
|
read_pkg
|
2014-06-30 11:32:07 +02:00
|
|
|
show_pkg_build_options
|
2014-04-28 23:03:35 +02:00
|
|
|
;;
|
|
|
|
show-shlib-provides)
|
|
|
|
read_pkg
|
|
|
|
show_pkg_shlib_provides
|
|
|
|
;;
|
|
|
|
show-shlib-requires)
|
|
|
|
read_pkg
|
|
|
|
show_pkg_shlib_requires
|
|
|
|
;;
|
|
|
|
show-var)
|
2015-11-14 10:25:39 +01:00
|
|
|
for f in ${XBPS_COMMONDIR}/environment/setup/*.sh; do
|
|
|
|
source $f
|
|
|
|
done
|
2015-11-14 11:51:45 +01:00
|
|
|
source ${XBPS_COMMONDIR}/build-profiles/${XBPS_MACHINE}.sh
|
2014-04-28 23:03:35 +02:00
|
|
|
eval value="\${$XBPS_TARGET_PKG}"
|
|
|
|
echo $value
|
|
|
|
;;
|
|
|
|
show-repo-updates)
|
|
|
|
bulk_build
|
|
|
|
;;
|
|
|
|
show-sys-updates)
|
|
|
|
bulk_build -i
|
|
|
|
;;
|
2015-08-16 10:45:19 +02:00
|
|
|
sort-dependencies)
|
|
|
|
bulk_sortdeps ${@/$XBPS_TARGET/}
|
|
|
|
;;
|
2014-04-28 23:03:35 +02:00
|
|
|
update-bulk)
|
|
|
|
bulk_update
|
|
|
|
;;
|
|
|
|
update-sys)
|
|
|
|
bulk_update -i
|
|
|
|
;;
|
2014-10-31 20:43:30 +01:00
|
|
|
update-check)
|
|
|
|
read_pkg
|
|
|
|
update_check
|
|
|
|
;;
|
2015-07-03 18:30:34 +02:00
|
|
|
update-hash-cache)
|
|
|
|
update_hash_cache
|
|
|
|
;;
|
2014-04-28 23:03:35 +02:00
|
|
|
zap)
|
|
|
|
masterdir_zap
|
|
|
|
;;
|
|
|
|
*)
|
2014-11-18 06:12:52 +01:00
|
|
|
msg_red "xbps-src: invalid target $XBPS_TARGET.\n"
|
2014-04-28 23:03:35 +02:00
|
|
|
usage && exit 1
|
|
|
|
;;
|
2014-03-22 12:31:42 +01:00
|
|
|
esac
|
|
|
|
|
2015-03-01 16:06:30 +01:00
|
|
|
exit_and_cleanup $?
|