2014-03-22 11:31:42 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# vim: set ts=4 sw=4 et:
|
|
|
|
|
2015-07-14 10:07:15 +00: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 11:31:42 +00:00
|
|
|
usage() {
|
2014-04-28 21:03:35 +00:00
|
|
|
cat << _EOF
|
2019-04-13 11:43:07 +00:00
|
|
|
$PROGNAME: [options] <target> [arguments]
|
2014-03-22 11:31:42 +00:00
|
|
|
|
|
|
|
Targets: (only one may be specified)
|
|
|
|
|
2014-04-28 21:03:35 +00: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 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
bootstrap
|
|
|
|
Build and install from source the bootstrap packages into <masterdir>.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
bootstrap-update
|
|
|
|
Updates bootstrap packages with latest versions available from registered
|
|
|
|
repositories in the XBPS configuration file.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2016-03-21 15:49:56 +00:00
|
|
|
consistency-check
|
|
|
|
Runs a consistency check on all packages
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
chroot
|
|
|
|
Enter to the chroot in <masterdir>.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2019-02-12 14:37:22 +00:00
|
|
|
clean-repocache
|
|
|
|
Removes obsolete packages from <hostdir>/repocache.
|
|
|
|
|
2019-02-26 13:26:29 +00:00
|
|
|
fetch <pkgname>
|
|
|
|
Download package source distribution file(s).
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
extract <pkgname>
|
|
|
|
Extract package source distribution file(s) into the build directory.
|
|
|
|
By default set to <masterdir>/builddir.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2019-02-26 13:26:29 +00:00
|
|
|
patch <pkgname>
|
|
|
|
Patch the package sources and perform other operations required to
|
|
|
|
prepare a package for configuring and building
|
|
|
|
|
|
|
|
configure <pkgname>
|
|
|
|
Configure a package (fetch + extract + patch + configure).
|
|
|
|
|
|
|
|
build <pkgname>
|
|
|
|
Build package source (fetch + extract + patch + configure + build).
|
|
|
|
|
|
|
|
check <pkgname>
|
|
|
|
Run the package check(s) after building the package source.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00: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 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
pkg <pkgname>
|
|
|
|
Build binary package for <pkgname> and all required dependencies.
|
2014-03-23 10:27:09 +00:00
|
|
|
|
2019-02-26 13:26:29 +00:00
|
|
|
clean [pkgname]
|
|
|
|
Removes auto dependencies, cleans up <masterdir>/builddir and <masterdir>/destdir.
|
|
|
|
If <pkgname> argument is specified, package files from <masterdir>/destdir and its
|
|
|
|
build directory in <masterdir>/buiddir are removed.
|
|
|
|
|
|
|
|
list
|
|
|
|
Lists installed packages in <masterdir>.
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
remove <pkgname>
|
|
|
|
Remove target package from <destdir>. If <pkgname>-<version> is not matched
|
|
|
|
from build template nothing is removed.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
remove-autodeps
|
|
|
|
Removes all package dependencies that were installed automatically.
|
2014-03-23 10:27:09 +00:00
|
|
|
|
2015-07-06 07:47:52 +00:00
|
|
|
purge-distfiles
|
|
|
|
Removes all obsolete distfiles in <hostdir>/sources.
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show <pkgname>
|
|
|
|
Show information for the specified package.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2015-04-16 06:38:32 +00:00
|
|
|
show-avail <pkgname>
|
|
|
|
Returns 0 if package can be built for the given architecture,
|
|
|
|
any other error otherwise.
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-build-deps <pkgname>
|
|
|
|
Show required build dependencies for <pkgname>.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-deps <pkgname>
|
|
|
|
Show required run-time dependencies for <pkgname>. Package must be
|
|
|
|
installed into destdir.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-files <pkgname>
|
|
|
|
Show files installed by <pkgname>. Package must be installed into destdir.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2019-01-26 19:29:36 +00:00
|
|
|
show-hostmakedepends <pkgname>
|
|
|
|
Show required host build dependencies for <pkgname>.
|
|
|
|
|
|
|
|
show-makedepends <pkgname>
|
|
|
|
Show required target build dependencies for <pkgname>.
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-options <pkgname>
|
|
|
|
Show available build options by <pkgname>.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-shlib-provides <pkgname>
|
|
|
|
Show list of provided shlibs for <pkgname>. Package must be installed into destdir.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-shlib-requires <pkgname>
|
|
|
|
Show list of required shlibs for <pkgname>. Package must be installed into destdir.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-var <var>
|
|
|
|
Prints the value of <var> if it's defined in xbps-src.
|
2014-04-09 07:52:48 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-repo-updates
|
|
|
|
Prints the list of outdated packages in XBPS repositories.
|
2014-04-09 10:11:50 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
show-sys-updates
|
2019-05-26 16:33:34 +00:00
|
|
|
Prints the list of outdated packages in your system.
|
2014-04-09 10:11:50 +00:00
|
|
|
|
2015-08-16 08:45:19 +00: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 21:03:35 +00:00
|
|
|
update-bulk
|
|
|
|
Rebuilds all packages in the system repositories that are outdated.
|
2014-04-09 14:42:07 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
update-sys
|
|
|
|
Rebuilds all packages in your system that are outdated and updates them.
|
2014-04-09 14:42:07 +00:00
|
|
|
|
2014-10-31 19:43:30 +00:00
|
|
|
update-check <pkgname>
|
|
|
|
Check upstream site of <pkgname> for new releases.
|
|
|
|
|
2015-07-03 16:30:34 +00:00
|
|
|
update-hash-cache
|
|
|
|
Update the hash cache with existing source distfiles.
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
zap
|
|
|
|
Removes a masterdir but preserving ccache, distcc and host directories.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
|
|
|
Options:
|
|
|
|
|
2020-05-19 18:06:06 +00:00
|
|
|
-1 If dependencies of target package are missing, fail instead of building them.
|
|
|
|
|
2016-04-27 15:03:24 +00:00
|
|
|
-a <target>
|
|
|
|
Cross compile packages for this target machine. Supported targets:
|
2015-07-14 10:07:15 +00:00
|
|
|
|
|
|
|
$(print_cross_targets)
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2020-02-12 02:10:39 +00:00
|
|
|
-c <configuration>
|
|
|
|
If specified, etc/conf.<configuration> will be used as the primary config
|
|
|
|
file name; etc/conf will only be attempted if that does not exist.
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-C Do not remove build directory, automatic dependencies and
|
|
|
|
package destdir after successful install.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2015-02-28 09:29:27 +00: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 13:45:47 +00:00
|
|
|
-f Force running the specified stage (configure/build/install/pkg)
|
|
|
|
even if it ran successfully.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-07-01 08:33:54 +00:00
|
|
|
-G Enable XBPS_USE_GIT_REVS (see etc/defaults.conf for more information).
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-g Enable building -dbg packages with debugging symbols.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00: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 09:15:02 +00:00
|
|
|
If unset defaults to void-packages/hostdir.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-h Usage output.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-I Ignore required dependencies, useful for extracting/fetching sources.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2020-05-19 18:06:06 +00:00
|
|
|
-i Make xbps-src internal errors non-fatal.
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-j Number of parallel build jobs to use when building packages.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-L Disable ASCII colors.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00: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 09:15:02 +00:00
|
|
|
If unset defaults to void-packages/masterdir.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-N Disable use of remote repositories to resolve dependencies.
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-o <opt,~opt2,...>
|
2020-02-12 01:55:24 +00:00
|
|
|
Enable or disable (prefixed with ~) package build options. If 'etc/conf'
|
|
|
|
already specifies some, it is merged. Keep in mind that these options
|
|
|
|
apply to all packages within the build, as in if a dependency needs to
|
|
|
|
be built, it will inherit these options.
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
Supported options can be shown with the 'show-options' target.
|
|
|
|
|
2019-10-16 19:57:17 +00:00
|
|
|
-p <variable,variable2,...>
|
|
|
|
For show target, show specified variables in addition to default ones.
|
|
|
|
Variable is split and each word is printed in separate line by default.
|
|
|
|
In order to print the whole value in one line, append asterisk to variable name.
|
|
|
|
|
2020-03-07 20:40:51 +00:00
|
|
|
-Q Enable running the check stage.
|
|
|
|
|
|
|
|
-q Suppress informational output of xbps-src (build output is still printed).
|
|
|
|
|
2014-04-28 21:03:35 +00:00
|
|
|
-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 22:00:55 +00: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.
|
2020-09-03 16:59:38 +00:00
|
|
|
This flag requires xbps-uchroot(1), and won't work on filesystems that don't
|
|
|
|
support overlayfs.
|
2015-02-27 22:00:55 +00:00
|
|
|
|
2020-05-19 18:06:06 +00:00
|
|
|
-V Print version of xbps, then exit.
|
|
|
|
|
2014-03-22 11:31:42 +00:00
|
|
|
_EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
check_reqhost_utils() {
|
2014-04-28 21:03:35 +00:00
|
|
|
local broken
|
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
[ "$IN_CHROOT" ] && return 0
|
2014-04-28 21:03:35 +00:00
|
|
|
|
|
|
|
for f in ${REQHOST_UTILS}; do
|
|
|
|
if ! command -v ${f} &>/dev/null; then
|
2019-07-10 08:31:21 +00:00
|
|
|
echo "${f} is missing in your system, can't continue!" 1>&2
|
2014-04-28 21:03:35 +00:00
|
|
|
broken=1
|
|
|
|
fi
|
|
|
|
done
|
2019-07-10 17:48:54 +00:00
|
|
|
[ "$broken" ] && exit 1
|
2014-04-28 21:03:35 +00:00
|
|
|
[ -z "$1" ] && return 0
|
|
|
|
|
|
|
|
for f in ${REQHOST_UTILS_BOOTSTRAP}; do
|
|
|
|
if ! command -v ${f} &>/dev/null; then
|
2019-07-10 08:31:21 +00:00
|
|
|
echo "${f} is missing in your system, can't continue!" 1>&2
|
2014-04-28 21:03:35 +00:00
|
|
|
broken=1
|
|
|
|
fi
|
|
|
|
done
|
2019-07-10 17:48:54 +00:00
|
|
|
[ "$broken" ] && exit 1
|
2014-03-22 11:31:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
check_build_requirements() {
|
|
|
|
local found
|
|
|
|
|
|
|
|
case "$XBPS_TARGET" in
|
|
|
|
*bootstrap*) found=1;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
if [ -z "$found" ]; then
|
2014-04-28 21:03:35 +00:00
|
|
|
xbps-uhelper cmpver "$XBPS_VERSION" "$XBPS_VERSION_REQ"
|
|
|
|
if [ $? -eq 255 ]; then
|
2019-07-10 08:31:21 +00:00
|
|
|
echo "ERROR: requires xbps>=${XBPS_VERSION_REQ}" 1>&2
|
|
|
|
echo "Bootstrap packages must be updated with 'xbps-src bootstrap-update'" 1>&2
|
2014-04-28 21:03:35 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2014-03-22 11:31:42 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
chroot_check() {
|
|
|
|
if [ -f $XBPS_MASTERDIR/.xbps_chroot_init -o "$XBPS_CHROOT_CMD" = "ethereal" ]; then
|
|
|
|
export CHROOT_READY=1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
check_native_arch() {
|
|
|
|
if [ "$CHROOT_READY" ]; then
|
|
|
|
if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
|
|
|
export XBPS_ARCH=$(<$XBPS_MASTERDIR/.xbps_chroot_init)
|
|
|
|
else
|
|
|
|
export XBPS_ARCH=$(xbps-uhelper arch)
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
LDD=$(ldd --version 2>&1|head -1)
|
|
|
|
if [[ $LDD == *musl* ]]; then
|
|
|
|
export XBPS_ARCH=${XBPS_MACHINE%-musl}-musl
|
|
|
|
else
|
|
|
|
# XBPS_ARCH == $(uname -m)
|
|
|
|
export XBPS_ARCH=$(uname -m)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-03-22 11:31:42 +00:00
|
|
|
masterdir_zap() {
|
2019-10-13 18:27:54 +00:00
|
|
|
rm -rf "$XBPS_MASTERDIR"
|
|
|
|
mkdir -p "$XBPS_MASTERDIR"
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
msg_normal "xbps-src: $XBPS_MASTERDIR masterdir cleaned up.\n"
|
2014-03-22 11:31:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exit_func() {
|
2014-05-15 18:45:14 +00:00
|
|
|
wait
|
2019-07-10 17:48:54 +00:00
|
|
|
if [ "$sourcepkg" ]; then
|
2014-04-28 21:03:35 +00:00
|
|
|
remove_pkg $XBPS_CROSS_BUILD
|
2014-03-22 11:31:42 +00:00
|
|
|
fi
|
2014-04-28 21:03:35 +00:00
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
2019-11-08 17:47:21 +00:00
|
|
|
msg_red "xbps-src: a failure has occurred! exiting...\n"
|
2014-04-28 21:03:35 +00:00
|
|
|
fi
|
|
|
|
exit 2
|
2014-03-22 11:31:42 +00:00
|
|
|
}
|
|
|
|
|
2014-03-23 08:04:05 +00:00
|
|
|
read_pkg() {
|
|
|
|
if [ -z "${XBPS_TARGET_PKG}" ]; then
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
[ ! -r ./template ] && msg_error "xbps-src: missing build template in $(pwd).\n"
|
2019-04-13 11:43:07 +00:00
|
|
|
XBPS_TARGET_PKG=${PWD##*/}
|
2014-03-23 08:04:05 +00:00
|
|
|
fi
|
2016-10-20 23:49:45 +00:00
|
|
|
setup_pkg "$XBPS_TARGET_PKG" "$XBPS_CROSS_BUILD" "$1"
|
2014-03-23 08:04:05 +00:00
|
|
|
}
|
|
|
|
|
2015-08-19 12:45:47 +00: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
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
msg_warn "xbps-src: Invalid path in XBPS_DISTFILES_MIRROR ($mirror)\n"
|
2015-08-19 12:45:47 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
mkdir -p "$XBPS_MASTERDIR/$path"
|
|
|
|
XBPS_CHROOT_CMD_ARGS+=" -b $path:$path"
|
|
|
|
else
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
msg_warn "xbps-src: File URLs ($mirror) don't work with '$XBPS_CHROOT_CMD'\n"
|
2015-08-19 12:45:47 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-07-05 10:08:45 +00:00
|
|
|
#
|
|
|
|
# main()
|
|
|
|
#
|
2019-07-10 17:48:54 +00:00
|
|
|
readonly PROGNAME="${0##*/}"
|
|
|
|
readonly XBPS_VERSION_REQ="0.55"
|
|
|
|
XBPS_VERSION=$(xbps-uhelper -V)
|
|
|
|
XBPS_VERSION=${XBPS_VERSION%%API*}
|
|
|
|
XBPS_VERSION=${XBPS_VERSION##*:}
|
|
|
|
readonly XBPS_SRC_VERSION="113"
|
|
|
|
export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
|
|
|
|
|
2014-04-22 14:01:05 +00:00
|
|
|
XBPS_OPTIONS=
|
2019-10-16 19:57:17 +00:00
|
|
|
XBPS_OPTSTRING="1a:c:CEfgGhH:iIj:Lm:No:p:qQr:tV"
|
2014-04-22 14:01:05 +00:00
|
|
|
|
2016-07-04 14:37:12 +00:00
|
|
|
# Preprocess arguments in order to allow options before and after XBPS_TARGET.
|
2017-05-24 18:02:46 +00:00
|
|
|
eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
|
2016-07-04 14:37:12 +00:00
|
|
|
|
2020-02-12 01:55:24 +00:00
|
|
|
# Options are saved as XBPS_ARG_FOO instead of XBPS_FOO for now; this is
|
|
|
|
# because configuration files may override those and we want arguments to
|
|
|
|
# take precedence over configuration files
|
2016-07-04 14:37:12 +00:00
|
|
|
while getopts "$XBPS_OPTSTRING" opt; do
|
2014-04-28 21:03:35 +00:00
|
|
|
case $opt in
|
2020-02-12 01:55:24 +00:00
|
|
|
1) XBPS_ARG_BUILD_ONLY_ONE_PKG=yes; XBPS_OPTIONS+=" -1";;
|
|
|
|
a) XBPS_ARG_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";;
|
2020-02-12 02:10:39 +00:00
|
|
|
c) XBPS_ARG_CONFIG="$OPTARG"; XBPS_OPTIONS+=" -c $OPTARG";;
|
2020-02-12 01:55:24 +00:00
|
|
|
C) XBPS_ARG_KEEP_ALL=1; XBPS_OPTIONS+=" -C";;
|
|
|
|
E) XBPS_ARG_BINPKG_EXISTS=1; XBPS_OPTIONS+=" -E";;
|
|
|
|
f) XBPS_ARG_BUILD_FORCEMODE=1; XBPS_OPTIONS+=" -f";;
|
|
|
|
G) XBPS_ARG_USE_GIT_REVS=1; XBPS_OPTIONS+=" -G";;
|
|
|
|
g) XBPS_ARG_DEBUG_PKGS=1; XBPS_OPTIONS+=" -g";;
|
|
|
|
H) XBPS_ARG_HOSTDIR="$OPTARG"; XBPS_OPTIONS+=" -H $OPTARG";;
|
2014-04-28 21:03:35 +00:00
|
|
|
h) usage && exit 0;;
|
2020-02-12 01:55:24 +00:00
|
|
|
i) XBPS_ARG_INFORMATIVE_RUN=1; XBPS_OPTIONS+=" -i";;
|
|
|
|
I) XBPS_ARG_SKIP_DEPS=1; XBPS_OPTIONS+=" -I";;
|
|
|
|
j) XBPS_ARG_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+=" -j $OPTARG";;
|
2015-03-01 15:45:16 +00:00
|
|
|
L) export NOCOLORS=1; XBPS_OPTIONS+=" -L";;
|
2020-02-12 01:55:24 +00:00
|
|
|
m) XBPS_ARG_MASTERDIR="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
|
|
|
|
N) XBPS_ARG_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
|
|
|
|
o) XBPS_ARG_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
|
2019-10-16 19:57:17 +00:00
|
|
|
p) XBPS_ARG_PRINT_VARIABLES="$OPTARG"; XBPS_OPTIONS+=" -p $OPTARG";;
|
2020-02-12 01:55:24 +00:00
|
|
|
q) XBPS_ARG_QUIET=1; XBPS_OPTIONS+=" -q";;
|
|
|
|
Q) XBPS_ARG_CHECK_PKGS=1; XBPS_OPTIONS+=" -Q";;
|
|
|
|
r) XBPS_ARG_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
|
|
|
|
t) XBPS_ARG_TEMP_MASTERDIR=1; XBPS_OPTIONS+=" -t -C";;
|
2019-07-10 17:48:54 +00:00
|
|
|
V) echo "xbps-src-$XBPS_SRC_VERSION $(xbps-uhelper -V)" && exit 0;;
|
2014-04-28 21:03:35 +00:00
|
|
|
--) shift; break;;
|
|
|
|
esac
|
2014-03-22 11:31:42 +00:00
|
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
2015-08-16 08:45:19 +00:00
|
|
|
[ $# -eq 0 ] && usage && exit 1
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2019-06-19 16:10:44 +00:00
|
|
|
# Check if stdout is a tty; if false disable colors.
|
|
|
|
test -t 1 || export NOCOLORS=1
|
|
|
|
# http://no-color.org
|
2019-07-10 17:48:54 +00:00
|
|
|
if [ "${NO_COLOR+x}" ]; then
|
2019-06-19 16:10:44 +00:00
|
|
|
export NOCOLORS=1
|
|
|
|
fi
|
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
# sane umask
|
2014-03-22 11:31:42 +00:00
|
|
|
umask 022
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for required utilities in host system.
|
|
|
|
#
|
|
|
|
# Required utilities in host system for the bootstrap target.
|
2020-04-06 11:15:37 +00:00
|
|
|
readonly REQHOST_UTILS_BOOTSTRAP="file objdump find make gawk bash sed gcc g++ gnat \
|
|
|
|
perl bsdtar gzip patch flock pkg-config"
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2020-01-04 10:19:05 +00:00
|
|
|
# Required utilities in host.
|
2014-03-22 11:31:42 +00:00
|
|
|
readonly REQHOST_UTILS="xbps-install xbps-query xbps-rindex xbps-uhelper \
|
2019-03-07 02:11:21 +00:00
|
|
|
xbps-reconfigure xbps-remove xbps-create xbps-uchroot xbps-uunshare"
|
2014-03-22 11:31:42 +00:00
|
|
|
|
|
|
|
check_reqhost_utils
|
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
#
|
|
|
|
# Set XBPS_CONFIG_FILE, XBPS_DISTDIR, XBPS_MASTERDIR
|
|
|
|
# and XBPS_HOSTDIR.
|
|
|
|
#
|
|
|
|
if [ "$IN_CHROOT" ]; then
|
2014-03-22 11:31:42 +00:00
|
|
|
readonly XBPS_CONFIG_FILE=/etc/xbps/xbps-src.conf
|
2014-10-11 09:15:02 +00:00
|
|
|
readonly XBPS_DISTDIR=/void-packages
|
2019-03-27 06:24:38 +00:00
|
|
|
readonly XBPS_MASTERDIR=/
|
|
|
|
readonly XBPS_HOSTDIR=/host
|
2014-03-22 11:31:42 +00:00
|
|
|
else
|
2019-04-14 12:04:06 +00:00
|
|
|
_distdir="$(readlink -f ${0%/*})"
|
2014-03-22 11:31:42 +00:00
|
|
|
if [ "${_distdir}" = "." ]; then
|
|
|
|
readonly XBPS_DISTDIR="$(pwd -P)"
|
|
|
|
else
|
|
|
|
readonly XBPS_DISTDIR="${_distdir}"
|
|
|
|
fi
|
2014-04-01 09:29:21 +00:00
|
|
|
# Read defaults and then the local configuration file
|
|
|
|
if [ -f $XBPS_DISTDIR/etc/defaults.conf ]; then
|
|
|
|
. $XBPS_DISTDIR/etc/defaults.conf
|
|
|
|
fi
|
2020-02-12 02:10:39 +00:00
|
|
|
if [ -n "$XBPS_ARG_CONFIG" -a -s $XBPS_DISTDIR/etc/conf.$XBPS_ARG_CONFIG ]; then
|
|
|
|
# If specified, read custom user configuration...
|
|
|
|
readonly XBPS_CONFIG_FILE=$XBPS_DISTDIR/etc/conf.$XBPS_ARG_CONFIG
|
|
|
|
elif [ -s $XBPS_DISTDIR/etc/conf ]; then
|
|
|
|
# ... otherwise read generic user configuration...
|
2014-07-01 08:40:33 +00:00
|
|
|
readonly XBPS_CONFIG_FILE=$XBPS_DISTDIR/etc/conf
|
2020-05-08 14:09:48 +00:00
|
|
|
elif [ -s ${XDG_CONFIG_HOME:-$HOME/.config}/xbps-src.conf ]; then
|
|
|
|
readonly XBPS_CONFIG_FILE=${XDG_CONFIG_HOME:-$HOME/.config}/xbps-src.conf
|
2014-07-01 08:40:33 +00:00
|
|
|
elif [ -s $HOME/.xbps-src.conf ]; then
|
|
|
|
# ... fallback to ~/.xbps-src.conf otherwise.
|
|
|
|
readonly XBPS_CONFIG_FILE=$HOME/.xbps-src.conf
|
2014-04-23 14:37:02 +00:00
|
|
|
fi
|
2014-03-22 11:31:42 +00:00
|
|
|
fi
|
2019-07-10 17:48:54 +00:00
|
|
|
# Read settings from config file
|
|
|
|
[ -s "$XBPS_CONFIG_FILE" ] && . $XBPS_CONFIG_FILE &>/dev/null
|
2019-07-03 17:36:22 +00:00
|
|
|
|
2020-02-12 01:55:24 +00:00
|
|
|
# Set options passed on command line, after configuration files have been read
|
|
|
|
[ -n "$XBPS_ARG_BUILD_ONLY_ONE_PKG" ] && XBPS_BUILD_ONLY_ONE_PKG=yes
|
|
|
|
[ -n "$XBPS_ARG_SKIP_REMOTEREPOS" ] && XBPS_SKIP_REMOTEREPOS=1
|
|
|
|
[ -n "$XBPS_ARG_BUILD_FORCEMODE" ] && XBPS_BUILD_FORCEMODE=1
|
|
|
|
[ -n "$XBPS_ARG_INFORMATIVE_RUN" ] && XBPS_INFORMATIVE_RUN=1
|
|
|
|
[ -n "$XBPS_ARG_TEMP_MASTERDIR" ] && XBPS_TEMP_MASTERDIR=1
|
|
|
|
[ -n "$XBPS_ARG_BINPKG_EXISTS" ] && XBPS_BINPKG_EXISTS=1
|
|
|
|
[ -n "$XBPS_ARG_USE_GIT_REVS" ] && XBPS_USE_GIT_REVS=1
|
|
|
|
[ -n "$XBPS_ARG_CHECK_PKGS" ] && XBPS_CHECK_PKGS=1
|
|
|
|
[ -n "$XBPS_ARG_DEBUG_PKGS" ] && XBPS_DEBUG_PKGS=1
|
|
|
|
[ -n "$XBPS_ARG_SKIP_DEPS" ] && XBPS_SKIP_DEPS=1
|
|
|
|
[ -n "$XBPS_ARG_KEEP_ALL" ] && XBPS_KEEP_ALL=1
|
|
|
|
[ -n "$XBPS_ARG_QUIET" ] && XBPS_QUIET=1
|
2019-10-16 19:57:17 +00:00
|
|
|
[ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
|
2020-02-12 01:55:24 +00:00
|
|
|
[ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
|
|
|
|
[ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
|
|
|
|
[ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
|
|
|
|
|
|
|
|
export XBPS_BUILD_ONLY_ONE_PKG XBPS_SKIP_REMOTEREPOS XBPS_BUILD_FORCEMODE \
|
|
|
|
XBPS_INFORMATIVE_RUN XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
|
|
|
|
XBPS_USE_GIT_REVS XBPS_CHECK_PKGS XBPS_DEBUG_PKGS XBPS_SKIP_DEPS \
|
|
|
|
XBPS_KEEP_ALL XBPS_QUIET XBPS_ALT_REPOSITORY XBPS_CROSS_BUILD \
|
2019-10-16 19:57:17 +00:00
|
|
|
XBPS_MAKEJOBS XBPS_PRINT_VARIABLES
|
2020-02-12 01:55:24 +00:00
|
|
|
|
|
|
|
# The masterdir/hostdir variables are forced and readonly in chroot
|
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
|
|
|
[ -n "$XBPS_ARG_MASTERDIR" ] && XBPS_MASTERDIR="$XBPS_ARG_MASTERDIR"
|
|
|
|
[ -n "$XBPS_ARG_HOSTDIR" ] && XBPS_HOSTDIR="$XBPS_ARG_HOSTDIR"
|
|
|
|
|
|
|
|
# Sanitize masterdir/hostdir once set for real (resolve links)
|
|
|
|
export XBPS_MASTERDIR="$(readlink -f $XBPS_MASTERDIR 2>/dev/null)"
|
|
|
|
export XBPS_HOSTDIR="$(readlink -f $XBPS_HOSTDIR 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
|
2020-02-06 07:33:03 +00:00
|
|
|
# Forbid root unless XBPS_ALLOW_CHROOT_BREAKOUT is set
|
2020-11-17 02:42:30 +00:00
|
|
|
# (for CI).
|
2020-02-06 07:33:03 +00:00
|
|
|
if [ -z "$IN_CHROOT" -a "$UID" -eq 0 -a -z "$XBPS_ALLOW_CHROOT_BREAKOUT" ]; then
|
|
|
|
echo "ERROR: xbps-src cannot be used as root." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
# if XBPS_MASTERDIR unset, defaults to $XBPS_DISTDIR/masterdir.
|
|
|
|
: ${XBPS_MASTERDIR:=$XBPS_DISTDIR/masterdir}
|
|
|
|
[ ! -d $XBPS_MASTERDIR ] && mkdir -p $XBPS_MASTERDIR
|
2019-07-03 17:36:22 +00:00
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
# if XBPS_HOSTDIR unset, defaults to $XBPS_DISTDIR/hostdir.
|
|
|
|
: ${XBPS_HOSTDIR:=$XBPS_DISTDIR/hostdir}
|
|
|
|
[ ! -d $XBPS_HOSTDIR ] && mkdir -p $XBPS_HOSTDIR
|
|
|
|
|
|
|
|
if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then
|
2019-07-10 08:31:21 +00:00
|
|
|
echo "ERROR: can't write to masterdir $XBPS_MASTERDIR." 1>&2
|
2019-07-10 17:48:54 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Try using chroot-git then git from the host system
|
|
|
|
if command -v chroot-git &>/dev/null; then
|
2020-04-22 13:59:26 +00:00
|
|
|
export XBPS_GIT_CMD=$(command -v chroot-git)
|
2019-07-10 17:48:54 +00:00
|
|
|
elif command -v git &>/dev/null; then
|
2020-04-22 13:59:26 +00:00
|
|
|
export XBPS_GIT_CMD=$(command -v git)
|
2019-07-10 17:48:54 +00:00
|
|
|
else
|
2019-07-10 08:31:21 +00:00
|
|
|
echo "neither chroot-git or git are available in your system!" 1>&2
|
2019-07-10 17:48:54 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-06-19 14:12:49 +00:00
|
|
|
|
2014-04-28 09:33:13 +00:00
|
|
|
if [ -n "$XBPS_HOSTDIR" ]; then
|
2014-04-28 21:03:35 +00:00
|
|
|
export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
|
|
|
|
readonly XBPS_SRCDISTDIR=$XBPS_HOSTDIR/sources
|
2014-04-28 09:33:13 +00:00
|
|
|
else
|
2014-04-28 21:03:35 +00:00
|
|
|
export XBPS_REPOSITORY=$XBPS_MASTERDIR/host/binpkgs
|
|
|
|
readonly XBPS_SRCDISTDIR=$XBPS_MASTERDIR/host/sources
|
2014-04-28 09:33:13 +00:00
|
|
|
fi
|
2019-06-19 14:12:49 +00:00
|
|
|
|
|
|
|
# Set XBPS_REPOSITORY to our current branch.
|
|
|
|
if [ -z "$XBPS_ALT_REPOSITORY" ]; then
|
|
|
|
pushd "$PWD" &>/dev/null
|
|
|
|
cd $XBPS_DISTDIR
|
2019-07-10 17:48:54 +00:00
|
|
|
_gitbranch="$($XBPS_GIT_CMD symbolic-ref --short HEAD 2>/dev/null)"
|
|
|
|
if [ "${_gitbranch}" -a "${_gitbranch}" != "master" ]; then
|
2019-06-19 14:12:49 +00:00
|
|
|
export XBPS_ALT_REPOSITORY="${_gitbranch}"
|
|
|
|
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${_gitbranch}"
|
|
|
|
fi
|
|
|
|
popd &>/dev/null
|
|
|
|
else
|
|
|
|
export XBPS_REPOSITORY="${XBPS_REPOSITORY}/${XBPS_ALT_REPOSITORY}"
|
|
|
|
fi
|
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
readonly XBPS_SRCPKGDIR=$XBPS_DISTDIR/srcpkgs
|
|
|
|
readonly XBPS_COMMONDIR=$XBPS_DISTDIR/common
|
|
|
|
readonly XBPS_SHUTILSDIR=$XBPS_COMMONDIR/xbps-src/shutils
|
|
|
|
readonly XBPS_TRIGGERSDIR=$XBPS_SRCPKGDIR/xbps-triggers/files
|
|
|
|
readonly XBPS_CROSSPFDIR=$XBPS_COMMONDIR/cross-profiles
|
|
|
|
readonly XBPS_BUILDSTYLEDIR=$XBPS_COMMONDIR/build-style
|
|
|
|
readonly XBPS_LIBEXECDIR=$XBPS_COMMONDIR/xbps-src/libexec
|
|
|
|
readonly XBPS_BUILDHELPERDIR=$XBPS_COMMONDIR/build-helper
|
|
|
|
|
2015-03-14 06:50:05 +00:00
|
|
|
readonly XBPS_TARGET="$1"
|
2019-07-10 17:48:54 +00:00
|
|
|
if [ "$2" ]; then
|
2015-05-05 09:52:17 +00:00
|
|
|
XBPS_TARGET_PKG="${2##*/}"
|
2015-03-14 08:47:56 +00:00
|
|
|
fi
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
# Check for CHROOT_READY and set up XBPS_ARCH environment var for xbps.
|
2019-02-02 15:35:18 +00:00
|
|
|
chroot_check
|
2019-07-10 17:48:54 +00:00
|
|
|
check_native_arch
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2019-08-07 15:16:55 +00:00
|
|
|
# test if to use linux32 for 32-bit masterdirs in 64-bit environments
|
|
|
|
# x86_64, ppc64 (BE) and aarch64 are capable of this, others are not
|
|
|
|
linux32_check() {
|
|
|
|
local hostarch="$1"
|
|
|
|
local tgtarch="$2"
|
|
|
|
case "$hostarch" in
|
|
|
|
x86_64*) if [[ "$tgtarch" == i686* ]]; then return 0; fi ;;
|
2020-04-29 22:40:07 +00:00
|
|
|
ppc64le*) if [[ "$tgtarch" == ppcle* ]]; then return 0; fi ;;
|
2019-08-07 15:16:55 +00:00
|
|
|
ppc64*)
|
|
|
|
case "$tgtarch" in
|
|
|
|
ppc64*) return 1 ;;
|
|
|
|
ppc*) return 0 ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
aarch64*) if [[ "$tgtarch" == armv* ]]; then return 0; fi ;;
|
|
|
|
esac
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Reconfigure pkgs for 32bit on 64-bit systems and reexec itself.
|
2016-04-13 06:07:02 +00:00
|
|
|
if [ -z "$XBPS_REINIT" -a -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
2019-07-10 17:48:54 +00:00
|
|
|
export XBPS_ARCH=${XBPS_ARCH:-$(<$XBPS_MASTERDIR/.xbps_chroot_init)}
|
2019-08-07 15:16:55 +00:00
|
|
|
if linux32_check "$XBPS_MACHINE" "$XBPS_ARCH"; then
|
2014-04-24 12:43:44 +00:00
|
|
|
# reconfigure pkgs via linux32
|
|
|
|
linux32 xbps-reconfigure -r ${XBPS_MASTERDIR} -a &>/dev/null
|
2014-04-22 14:01:05 +00:00
|
|
|
# reexec itself via linux32
|
2016-04-13 06:07:02 +00:00
|
|
|
export XBPS_REINIT=1
|
2014-04-22 14:01:05 +00:00
|
|
|
exec linux32 $0 ${XBPS_OPTIONS} $@
|
|
|
|
fi
|
2014-03-22 11:31:42 +00:00
|
|
|
fi
|
2019-07-10 17:48:54 +00:00
|
|
|
if [ "$XBPS_ARCH" ]; then
|
2014-11-22 06:00:50 +00:00
|
|
|
export XBPS_MACHINE=$XBPS_ARCH
|
|
|
|
fi
|
2019-07-10 17:48:54 +00:00
|
|
|
# At this point if XBPS_TARGET_MACHINE isn't defined we assume
|
|
|
|
# it's a native build.
|
2015-02-10 09:38:13 +00:00
|
|
|
if [ -z "$XBPS_TARGET_MACHINE" ]; then
|
2019-07-10 17:48:54 +00:00
|
|
|
export XBPS_TARGET_MACHINE=$XBPS_MACHINE
|
2015-02-10 09:38:13 +00:00
|
|
|
fi
|
2014-03-22 11:31:42 +00:00
|
|
|
|
2020-01-27 02:48:07 +00:00
|
|
|
if [ "$IN_CHROOT" ]; then
|
|
|
|
readonly XBPS_UHELPER_CMD="xbps-uhelper"
|
|
|
|
readonly XBPS_INSTALL_CMD="xbps-install -c /host/repocache-$XBPS_MACHINE"
|
|
|
|
readonly XBPS_QUERY_CMD="xbps-query -c /host/repocache-$XBPS_MACHINE"
|
|
|
|
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure"
|
|
|
|
readonly XBPS_REMOVE_CMD="xbps-remove"
|
|
|
|
readonly XBPS_CHECKVERS_CMD="xbps-checkvers"
|
|
|
|
readonly XBPS_DESTDIR=/destdir
|
|
|
|
readonly XBPS_BUILDDIR=/builddir
|
|
|
|
else
|
|
|
|
readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR"
|
2020-08-18 12:53:55 +00:00
|
|
|
readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR -C etc/xbps.d"
|
|
|
|
readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR -C etc/xbps.d"
|
2020-01-27 02:48:07 +00:00
|
|
|
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR"
|
|
|
|
readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR"
|
|
|
|
readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_MASTERDIR"
|
|
|
|
readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
|
|
|
|
readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
|
|
|
|
fi
|
|
|
|
readonly XBPS_RINDEX_CMD="xbps-rindex"
|
|
|
|
readonly XBPS_FETCH_CMD="xbps-fetch"
|
|
|
|
readonly XBPS_DIGEST_CMD="xbps-digest"
|
|
|
|
readonly XBPS_CMPVER_CMD="xbps-uhelper cmpver"
|
|
|
|
|
2014-03-22 11:31:42 +00:00
|
|
|
export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
2019-07-10 17:48:54 +00:00
|
|
|
XBPS_SRCPKGDIR XBPS_COMMONDIR XBPS_BUILDDIR \
|
2014-04-28 21:03:35 +00:00
|
|
|
XBPS_REPOSITORY XBPS_ALT_REPOSITORY XBPS_SRCDISTDIR XBPS_DIGEST_CMD \
|
2017-09-04 02:08:25 +00:00
|
|
|
XBPS_UHELPER_CMD XBPS_INSTALL_CMD XBPS_QUERY_CMD XBPS_BUILD_ONLY_ONE_PKG \
|
2019-07-10 17:48:54 +00:00
|
|
|
XBPS_RINDEX_CMD XBPS_RECONFIGURE_CMD XBPS_REMOVE_CMD XBPS_CHECKVERS_CMD \
|
|
|
|
XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
|
2017-03-08 16:28:31 +00:00
|
|
|
XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
|
2014-03-22 11:31:42 +00:00
|
|
|
XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
|
2017-02-23 21:03:31 +00:00
|
|
|
XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
|
2020-08-28 17:19:13 +00:00
|
|
|
XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
|
2015-12-27 07:17:07 +00:00
|
|
|
XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
|
2019-01-18 05:06:18 +00:00
|
|
|
XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
|
2016-02-19 12:45:49 +00:00
|
|
|
XBPS_LIBEXECDIR XBPS_DISTDIR XBPS_DISTFILES_MIRROR XBPS_ALLOW_RESTRICTED \
|
2019-06-25 08:52:37 +00:00
|
|
|
XBPS_USE_GIT_COMMIT_DATE XBPS_PKG_COMPTYPE XBPS_REPO_COMPTYPE XBPS_BUILDHELPERDIR
|
2014-03-22 11:31:42 +00:00
|
|
|
|
|
|
|
for i in REPOSITORY DESTDIR BUILDDIR SRCDISTDIR; do
|
|
|
|
eval val="\$XBPS_$i"
|
|
|
|
if [ ! -d "$val" ]; then
|
|
|
|
mkdir -p $val
|
|
|
|
fi
|
|
|
|
unset val
|
|
|
|
done
|
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
# A temporary masterdir requires xbps-uchroot(1) and -O to use overlayfs
|
2015-12-12 09:12:33 +00:00
|
|
|
# on tmpfs (available with xbps-0.45).
|
|
|
|
if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_MASTERDIR" ]; then
|
2016-04-27 15:03:24 +00:00
|
|
|
export XBPS_CHROOT_CMD="uchroot"
|
2015-12-12 09:13:22 +00:00
|
|
|
export XBPS_CHROOT_CMD_ARGS+=" -O"
|
2015-12-12 09:12:33 +00:00
|
|
|
fi
|
2014-03-22 11:31:42 +00:00
|
|
|
#
|
|
|
|
# Sanitize PATH.
|
|
|
|
#
|
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
2014-04-28 21:03:35 +00:00
|
|
|
# In non chroot case always prefer host tools.
|
2019-07-10 17:48:54 +00:00
|
|
|
export PATH="$PATH:$XBPS_MASTERDIR/usr/bin"
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set up ccache
|
|
|
|
#
|
|
|
|
if [ "$XBPS_CCACHE" ]; then
|
|
|
|
export CCACHEPATH="/usr/lib/ccache/bin"
|
|
|
|
export CCACHE_DIR="$XBPS_HOSTDIR/ccache"
|
|
|
|
# Avoid not using cached files just due to compiler mtime
|
|
|
|
# changes when e.g. bootstrapping
|
|
|
|
export CCACHE_COMPILERCHECK=content CCACHE_COMPRESS=1
|
|
|
|
export PATH="$CCACHEPATH:$PATH"
|
|
|
|
mkdir -p $CCACHE_DIR
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set up distcc
|
|
|
|
#
|
|
|
|
if [ "$XBPS_DISTCC" ]; then
|
|
|
|
if [ "$XBPS_CCACHE" ]; then
|
|
|
|
export CCACHE_PREFIX="/usr/bin/distcc"
|
|
|
|
else
|
|
|
|
DISTCCPATH="/usr/lib/distcc/bin"
|
|
|
|
export PATH="$DISTCCPATH:$PATH"
|
2014-04-28 21:03:35 +00:00
|
|
|
fi
|
2019-07-10 17:48:54 +00:00
|
|
|
export DISTCC_DIR="$XBPS_HOSTDIR/distcc-${XBPS_CROSS_BUILD:-${XBPS_MACHINE}}"
|
|
|
|
export DISTCC_HOSTS="$XBPS_DISTCC_HOSTS"
|
|
|
|
mkdir -p $DISTCC_DIR
|
2014-03-22 11:31:42 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
check_build_requirements
|
|
|
|
|
2015-03-14 06:50:05 +00:00
|
|
|
if [ -z "$IN_CHROOT" ]; then
|
|
|
|
trap 'exit_func' INT TERM
|
2015-08-19 12:45:47 +00:00
|
|
|
if [ -n "$XBPS_DISTFILES_MIRROR" ]; then
|
|
|
|
setup_distfiles_mirror
|
|
|
|
fi
|
2015-03-14 06:50:05 +00:00
|
|
|
fi
|
2019-07-10 17:48:54 +00:00
|
|
|
#
|
|
|
|
# Read funcs from helpers
|
|
|
|
#
|
|
|
|
for f in ${XBPS_SHUTILSDIR}/*.sh; do
|
|
|
|
[ -r "$f" ] && . $f
|
|
|
|
done
|
2015-03-01 15:45:16 +00:00
|
|
|
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
reconfigure_base_chroot
|
2015-11-02 19:25:16 +00:00
|
|
|
|
2014-03-22 11:31:42 +00:00
|
|
|
#
|
|
|
|
# Main switch.
|
|
|
|
#
|
|
|
|
case "$XBPS_TARGET" in
|
2014-04-28 21:03:35 +00:00
|
|
|
binary-bootstrap)
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
|
|
|
bootstrap)
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
# base-chroot building on host
|
2014-04-28 21:03:35 +00:00
|
|
|
# check for required host utils
|
|
|
|
check_reqhost_utils bootstrap
|
2019-07-10 17:48:54 +00:00
|
|
|
(
|
|
|
|
export XBPS_ARCH=$XBPS_MACHINE
|
|
|
|
export XBPS_SKIP_REMOTEREPOS=1
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
chroot_sync_repodata
|
2019-07-10 17:48:54 +00:00
|
|
|
$XBPS_LIBEXECDIR/build.sh \
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
base-chroot base-chroot $XBPS_TARGET || exit 1
|
2019-07-10 17:48:54 +00:00
|
|
|
) || exit 1
|
2014-08-26 08:33:15 +00:00
|
|
|
[ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
|
|
|
bootstrap-update)
|
2019-05-26 16:36:00 +00:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler bootstrap-update
|
|
|
|
else
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
chroot_sync_repodata
|
|
|
|
update_base_chroot
|
2019-05-26 16:36:00 +00:00
|
|
|
fi
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
|
|
|
chroot)
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
chroot_sync_repodata
|
2014-04-28 21:03:35 +00:00
|
|
|
chroot_handler chroot dummy
|
|
|
|
;;
|
|
|
|
clean)
|
2014-05-23 15:14:00 +00:00
|
|
|
if [ -z "$XBPS_TARGET_PKG" ]; then
|
2019-02-02 17:16:18 +00:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler remove-autodeps
|
|
|
|
else
|
|
|
|
remove_pkg_autodeps
|
|
|
|
fi
|
2014-05-23 15:14:00 +00:00
|
|
|
msg_normal "xbps-src: cleaning up masterdir...\n"
|
2019-06-19 09:49:05 +00:00
|
|
|
# Needed to remove Go Modules
|
2020-02-25 17:08:59 +00:00
|
|
|
[ -d "$XBPS_BUILDDIR" ] && chmod -R +wX $XBPS_BUILDDIR
|
|
|
|
rm -rf \
|
|
|
|
$XBPS_BUILDDIR \
|
2020-02-26 18:03:13 +00:00
|
|
|
$XBPS_DESTDIR
|
|
|
|
rm -rf $XBPS_MASTERDIR/tmp
|
|
|
|
mkdir -p $XBPS_MASTERDIR/tmp
|
2014-04-28 21:03:35 +00:00
|
|
|
else
|
2014-05-23 15:14:00 +00:00
|
|
|
read_pkg
|
2015-01-04 11:14:14 +00:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || exit $?
|
|
|
|
else
|
2014-05-23 15:14:00 +00:00
|
|
|
if declare -f do_clean >/dev/null; then
|
|
|
|
run_func do_clean
|
|
|
|
fi
|
2020-06-17 21:22:23 +00:00
|
|
|
remove_pkg_wrksrc
|
|
|
|
remove_pkg_statedir
|
2015-01-04 11:14:14 +00:00
|
|
|
fi
|
|
|
|
remove_pkg $XBPS_CROSS_BUILD
|
2014-04-28 21:03:35 +00:00
|
|
|
fi
|
|
|
|
;;
|
2019-02-12 14:37:22 +00:00
|
|
|
clean-repocache)
|
|
|
|
export XBPS_TARGET_ARCH="${XBPS_CROSS_BUILD:-$XBPS_TARGET_MACHINE}"
|
2020-01-27 02:48:07 +00:00
|
|
|
$XBPS_REMOVE_CMD -C /dev/null -c $XBPS_HOSTDIR/repocache-${XBPS_TARGET_ARCH} -O
|
2019-02-12 14:37:22 +00:00
|
|
|
;;
|
2016-03-21 15:49:56 +00:00
|
|
|
consistency-check)
|
|
|
|
consistency_check
|
|
|
|
;;
|
2014-04-28 21:03:35 +00:00
|
|
|
remove-autodeps)
|
2019-02-02 17:16:18 +00:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler remove-autodeps
|
|
|
|
else
|
|
|
|
remove_pkg_autodeps
|
|
|
|
fi
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
2019-02-26 13:06:58 +00:00
|
|
|
fetch|extract|patch|configure|build|check|install|pkg)
|
2017-11-20 12:45:03 +00:00
|
|
|
if [ "$XBPS_TARGET" = "check" ]; then
|
|
|
|
export XBPS_CHECK_PKGS=1
|
|
|
|
fi
|
2014-04-28 21:03:35 +00:00
|
|
|
read_pkg
|
2015-01-04 11:14:14 +00:00
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG
|
|
|
|
else
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
chroot_sync_repodata
|
2020-01-28 00:06:16 +00:00
|
|
|
# prevent update_base_chroot from removing the builddir/destdir
|
|
|
|
update_base_chroot keep-all-force
|
2015-03-14 06:50:05 +00:00
|
|
|
$XBPS_LIBEXECDIR/build.sh $XBPS_TARGET_PKG $XBPS_TARGET_PKG \
|
2015-03-19 09:08:02 +00:00
|
|
|
$XBPS_TARGET $XBPS_CROSS_BUILD || exit $?
|
2015-01-04 11:14:14 +00:00
|
|
|
fi
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
|
|
|
remove|remove-destdir)
|
|
|
|
read_pkg
|
|
|
|
remove_pkg $XBPS_CROSS_BUILD
|
|
|
|
;;
|
|
|
|
list)
|
|
|
|
$XBPS_QUERY_CMD -l
|
|
|
|
;;
|
2015-07-06 07:47:52 +00:00
|
|
|
purge-distfiles)
|
|
|
|
purge_distfiles
|
|
|
|
;;
|
2014-04-28 21:03:35 +00:00
|
|
|
show)
|
2017-08-07 04:35:13 +00:00
|
|
|
read_pkg ignore-problems
|
2019-10-16 19:57:17 +00:00
|
|
|
show_pkg $XBPS_PRINT_VARIABLES
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
2015-04-16 06:38:32 +00:00
|
|
|
show-avail)
|
2019-07-10 17:48:54 +00:00
|
|
|
read_pkg &>/dev/null
|
2015-04-16 06:38:32 +00:00
|
|
|
show_avail
|
|
|
|
;;
|
2014-04-28 21:03:35 +00:00
|
|
|
show-files)
|
2017-08-07 04:35:13 +00:00
|
|
|
read_pkg ignore-problems
|
2014-04-28 21:03:35 +00:00
|
|
|
show_pkg_files
|
|
|
|
;;
|
|
|
|
show-deps)
|
2017-08-07 04:35:13 +00:00
|
|
|
read_pkg ignore-problems
|
2014-04-28 21:03:35 +00:00
|
|
|
show_pkg_deps
|
|
|
|
;;
|
|
|
|
show-build-deps)
|
2017-08-07 04:35:13 +00:00
|
|
|
read_pkg ignore-problems
|
2014-04-28 21:03:35 +00:00
|
|
|
show_pkg_build_deps
|
|
|
|
;;
|
2019-01-26 19:29:36 +00:00
|
|
|
show-hostmakedepends)
|
|
|
|
read_pkg ignore-problems
|
|
|
|
show_pkg_hostmakedepends
|
|
|
|
;;
|
|
|
|
show-makedepends)
|
|
|
|
read_pkg ignore-problems
|
|
|
|
show_pkg_makedepends
|
|
|
|
;;
|
2020-05-07 23:00:47 +00:00
|
|
|
show-pkg-var-dump)
|
|
|
|
read_pkg ignore-problems
|
|
|
|
for sub_name in $subpackages; do
|
|
|
|
if [ $sub_name = $XBPS_TARGET_PKG ]; then
|
|
|
|
${sub_name}_package
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
printf "archs: %s\n\n" "$archs"
|
|
|
|
printf "bootstrap: %s\n\n" "$bootstrap"
|
|
|
|
printf "broken: %s\n\n" "$broken"
|
|
|
|
printf "depends: %s\n\n" "$depends"
|
|
|
|
printf "hostmakedepends: %s\n\n" "$hostmakedepends"
|
|
|
|
printf "makedepends: %s\n\n" "$makedepends"
|
|
|
|
printf "nocross: %s\n\n" "$nocross"
|
|
|
|
printf "pkgname: %s\n\n" "$pkgname"
|
|
|
|
printf "restricted: %s\n\n" "$restricted"
|
|
|
|
printf "revision: %s\n\n" "$revision"
|
|
|
|
printf "subpackages: %s\n\n" "$subpackages"
|
|
|
|
printf "version: %s\n\n" "$version"
|
|
|
|
printf "provides: %s\n\n" "$provides"
|
|
|
|
printf "lib32disabled: %s\n\n" "$lib32disabled"
|
|
|
|
printf "nodebug: %s\n\n" "$nodebug"
|
|
|
|
;;
|
2017-08-07 04:43:41 +00:00
|
|
|
show-pkg-var)
|
|
|
|
read_pkg ignore-problems
|
|
|
|
for sub_name in $subpackages; do
|
|
|
|
if [ $sub_name = $XBPS_TARGET_PKG ]; then
|
|
|
|
${sub_name}_package
|
|
|
|
fi
|
|
|
|
done
|
2020-05-07 23:00:47 +00:00
|
|
|
while IFS= read -r pkg_var; do
|
|
|
|
print_var=
|
|
|
|
case "${pkg_var}" in
|
|
|
|
archs) print_var="$archs ";;
|
|
|
|
bootstrap) print_var="$bootstrap ";;
|
|
|
|
broken) print_var="$broken ";;
|
|
|
|
depends) print_var="$depends ";;
|
|
|
|
hostmakedepends) print_var="$hostmakedepends ";;
|
|
|
|
makedepends) print_var="$makedepends ";;
|
|
|
|
nocross) print_var="$nocross ";;
|
|
|
|
pkgname) print_var="$pkgname ";;
|
|
|
|
restricted) print_var="$restricted ";;
|
|
|
|
revision) print_var="$revision ";;
|
|
|
|
subpackages) print_var="$subpackages ";;
|
|
|
|
version) print_var="$version ";;
|
|
|
|
provides) print_var="$provides ";;
|
|
|
|
lib32disabled) print_var="$lib32disabled ";;
|
|
|
|
nodebug) print_var="$nodebug ";;
|
|
|
|
esac # the space at the end of each is essential for unset vars
|
|
|
|
if [ -n "$print_var" ]; then
|
|
|
|
printf "%s\n" "$(printf "${print_var% }" | tr -t '\n\r' ' ')"
|
|
|
|
fi # The trailing space gets stripped before printing anyway
|
|
|
|
done
|
2017-08-07 04:43:41 +00:00
|
|
|
;;
|
2014-04-28 21:03:35 +00:00
|
|
|
show-options)
|
2017-08-07 04:35:13 +00:00
|
|
|
read_pkg ignore-problems
|
2014-06-30 09:32:07 +00:00
|
|
|
show_pkg_build_options
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
|
|
|
show-shlib-provides)
|
2017-08-07 04:35:13 +00:00
|
|
|
read_pkg ignore-problems
|
2014-04-28 21:03:35 +00:00
|
|
|
show_pkg_shlib_provides
|
|
|
|
;;
|
|
|
|
show-shlib-requires)
|
2017-08-07 04:35:13 +00:00
|
|
|
read_pkg ignore-problems
|
2014-04-28 21:03:35 +00:00
|
|
|
show_pkg_shlib_requires
|
|
|
|
;;
|
|
|
|
show-var)
|
2015-11-14 09:25:39 +00:00
|
|
|
for f in ${XBPS_COMMONDIR}/environment/setup/*.sh; do
|
|
|
|
source $f
|
|
|
|
done
|
2015-11-14 10:51:45 +00:00
|
|
|
source ${XBPS_COMMONDIR}/build-profiles/${XBPS_MACHINE}.sh
|
2014-04-28 21:03:35 +00:00
|
|
|
eval value="\${$XBPS_TARGET_PKG}"
|
|
|
|
echo $value
|
|
|
|
;;
|
|
|
|
show-repo-updates)
|
|
|
|
bulk_build
|
|
|
|
;;
|
|
|
|
show-sys-updates)
|
2019-07-10 17:48:54 +00:00
|
|
|
bulk_build -I
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
2015-08-16 08:45:19 +00:00
|
|
|
sort-dependencies)
|
|
|
|
bulk_sortdeps ${@/$XBPS_TARGET/}
|
|
|
|
;;
|
2014-04-28 21:03:35 +00:00
|
|
|
update-bulk)
|
|
|
|
bulk_update
|
|
|
|
;;
|
|
|
|
update-sys)
|
2019-07-10 17:48:54 +00:00
|
|
|
bulk_update -I
|
2014-04-28 21:03:35 +00:00
|
|
|
;;
|
2014-10-31 19:43:30 +00:00
|
|
|
update-check)
|
2017-08-07 04:35:13 +00:00
|
|
|
read_pkg ignore-problems
|
2014-10-31 19:43:30 +00:00
|
|
|
update_check
|
|
|
|
;;
|
2015-07-03 16:30:34 +00:00
|
|
|
update-hash-cache)
|
|
|
|
update_hash_cache
|
|
|
|
;;
|
2014-04-28 21:03:35 +00:00
|
|
|
zap)
|
|
|
|
masterdir_zap
|
|
|
|
;;
|
|
|
|
*)
|
2014-11-18 05:12:52 +00:00
|
|
|
msg_red "xbps-src: invalid target $XBPS_TARGET.\n"
|
2014-04-28 21:03:35 +00:00
|
|
|
usage && exit 1
|
|
|
|
;;
|
2014-03-22 11:31:42 +00:00
|
|
|
esac
|
|
|
|
|
2015-03-01 15:06:30 +00:00
|
|
|
exit_and_cleanup $?
|