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`
This commit is contained in:
parent
b714ffe390
commit
75eca1b03e
26 changed files with 325 additions and 356 deletions
|
@ -43,10 +43,9 @@ setup_pkg_depends() {
|
|||
#
|
||||
# Install required package dependencies, like:
|
||||
#
|
||||
# xbps-install -AIy <pkgs>
|
||||
# xbps-install -Ay <pkgs>
|
||||
#
|
||||
# -A automatic mode
|
||||
# -I to ignore file conflicts
|
||||
# -y yes
|
||||
#
|
||||
# Returns 0 if package already installed or installed successfully.
|
||||
|
@ -56,10 +55,12 @@ setup_pkg_depends() {
|
|||
# ENOENT (2): package missing in repositories.
|
||||
# ENXIO (6): package depends on invalid dependencies.
|
||||
# EAGAIN (11): package conflicts.
|
||||
# EBUSY (16): package 'xbps' needs to be updated.
|
||||
# EEXIST (17): file conflicts in transaction (XBPS_FLAG_IGNORE_FILE_CONFLICTS unset)
|
||||
# ENODEV (19): package depends on missing dependencies.
|
||||
# ENOTSUP (95): no repositories registered.
|
||||
#
|
||||
# -1 (255): unexpected error.
|
||||
|
||||
install_pkg_from_repos() {
|
||||
local cross="$1" rval tmplogf cmd
|
||||
shift
|
||||
|
@ -71,7 +72,7 @@ install_pkg_from_repos() {
|
|||
|
||||
cmd=$XBPS_INSTALL_CMD
|
||||
[[ $cross ]] && cmd=$XBPS_INSTALL_XCMD
|
||||
$cmd -AIy "$@" >$tmplogf 2>&1
|
||||
$cmd -Ay "$@" >$tmplogf 2>&1
|
||||
rval=$?
|
||||
|
||||
case "$rval" in
|
||||
|
@ -137,9 +138,9 @@ install_pkg_deps() {
|
|||
done
|
||||
|
||||
if [ "$pkg" != "$targetpkg" ]; then
|
||||
msg_normal "$pkgver: building${style} (dependency of $targetpkg) ...\n"
|
||||
msg_normal "$pkgver: building${style} (dependency of $targetpkg) for $XBPS_TARGET_MACHINE...\n"
|
||||
else
|
||||
msg_normal "$pkgver: building${style} ...\n"
|
||||
msg_normal "$pkgver: building${style} for $XBPS_TARGET_MACHINE...\n"
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -189,7 +190,7 @@ install_pkg_deps() {
|
|||
echo " [host] ${_vpkg}: not found"
|
||||
host_missing_deps+=("$_vpkg")
|
||||
fi
|
||||
done < <($XBPS_CHECKVERS_CMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm $templates)
|
||||
done < <($XBPS_CHECKVERS_CMD -D $XBPS_DISTDIR -sm $templates)
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -239,7 +240,7 @@ install_pkg_deps() {
|
|||
echo " [check] ${_vpkg}: not found"
|
||||
host_missing_deps+=("$_vpkg")
|
||||
fi
|
||||
done < <($XBPS_CHECKVERS_CMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm ${templates})
|
||||
done < <($XBPS_CHECKVERS_CMD -D $XBPS_DISTDIR -sm ${templates})
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -253,7 +254,7 @@ install_pkg_deps() {
|
|||
templates+=" $f"
|
||||
continue
|
||||
fi
|
||||
local _repourl=$($XBPS_QUERY_CMD -R -prepository "$f" 2>/dev/null)
|
||||
local _repourl=$($XBPS_QUERY_XCMD -R -prepository "$f" 2>/dev/null)
|
||||
if [ "$_repourl" ]; then
|
||||
echo " [target] ${f}: found (${_repourl})"
|
||||
binpkg_deps+=("$f")
|
||||
|
@ -289,7 +290,7 @@ install_pkg_deps() {
|
|||
echo " [target] ${_vpkg}: not found"
|
||||
missing_deps+=("$_vpkg")
|
||||
fi
|
||||
done < <($XBPS_CHECKVERS_XCMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm $templates)
|
||||
done < <($XBPS_CHECKVERS_XCMD -D $XBPS_DISTDIR -sm $templates)
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -303,7 +304,7 @@ install_pkg_deps() {
|
|||
templates+=" $f"
|
||||
continue
|
||||
fi
|
||||
local _repourl=$($XBPS_QUERY_CMD -R -prepository "$f" 2>/dev/null)
|
||||
local _repourl=$($XBPS_QUERY_XCMD -R -prepository "$f" 2>/dev/null)
|
||||
if [ "$_repourl" ]; then
|
||||
echo " [target] ${f}: found (${_repourl})"
|
||||
continue
|
||||
|
@ -337,7 +338,7 @@ install_pkg_deps() {
|
|||
echo " [runtime] ${_vpkg}: not found"
|
||||
missing_rdeps+=("$_vpkg")
|
||||
fi
|
||||
done < <($XBPS_CHECKVERS_XCMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm $templates)
|
||||
done < <($XBPS_CHECKVERS_XCMD -D $XBPS_DISTDIR -sm $templates)
|
||||
fi
|
||||
|
||||
if [ -n "$XBPS_BUILD_ONLY_ONE_PKG" ]; then
|
||||
|
@ -359,8 +360,8 @@ install_pkg_deps() {
|
|||
curpkgdepname=$($XBPS_UHELPER_CMD getpkgname "$i" 2>/dev/null)
|
||||
setup_pkg $curpkgdepname
|
||||
exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \
|
||||
$XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target || exit $?
|
||||
) || exit $?
|
||||
$XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target $cross_prepare || exit $?
|
||||
) || msg_error "xbps-src: failed to build host dependency '$i' ($?)\n"
|
||||
host_binpkg_deps+=("$i")
|
||||
done
|
||||
|
||||
|
@ -373,7 +374,7 @@ install_pkg_deps() {
|
|||
setup_pkg $curpkgdepname $cross
|
||||
exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \
|
||||
$XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target $cross $cross_prepare || exit $?
|
||||
) || exit $?
|
||||
) || msg_error "xbps-src: failed to build target dependency '$i' ($?)\n"
|
||||
binpkg_deps+=("$i")
|
||||
done
|
||||
|
||||
|
@ -391,7 +392,7 @@ install_pkg_deps() {
|
|||
setup_pkg $curpkgdepname $cross
|
||||
exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \
|
||||
$XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target $cross $cross_prepare || exit $?
|
||||
) || exit $?
|
||||
) || msg_error "xbps-src: failed to build target dependency '$i' ($?)\n"
|
||||
done
|
||||
|
||||
if [[ ${host_binpkg_deps} ]]; then
|
||||
|
|
|
@ -115,6 +115,6 @@ bulk_update() {
|
|||
if [ -n "$pkgs" -a -n "$args" ]; then
|
||||
echo
|
||||
msg_normal "xbps-src: updating your system, confirm to proceed...\n"
|
||||
${XBPS_SUCMD} "xbps-install --repository=$XBPS_REPOSITORY --repository=$XBPS_REPOSITORY/nonfree -u ${pkgs}" || return 1
|
||||
${XBPS_SUCMD} "$XBPS_INSTALL_CMD $XBPS_INSTALL_ARGS -u ${pkgs}" || return 1
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,5 +1,62 @@
|
|||
# vim: set ts=4 sw=4 et:
|
||||
|
||||
install_base_chroot() {
|
||||
[ "$CHROOT_READY" ] && return
|
||||
chroot_sync_repodata
|
||||
if [ "$1" = "bootstrap" ]; then
|
||||
unset XBPS_TARGET_PKG XBPS_INSTALL_ARGS
|
||||
else
|
||||
XBPS_TARGET_PKG="$1"
|
||||
fi
|
||||
[ "$XBPS_SKIP_REMOTEREPOS" ] && unset XBPS_INSTALL_ARGS
|
||||
# binary bootstrap
|
||||
msg_normal "xbps-src: installing base-chroot...\n"
|
||||
# XBPS_TARGET_PKG == arch
|
||||
if [ "$XBPS_TARGET_PKG" ]; then
|
||||
_bootstrap_arch="env XBPS_TARGET_ARCH=$XBPS_TARGET_PKG"
|
||||
fi
|
||||
${_bootstrap_arch} $XBPS_INSTALL_CMD ${XBPS_INSTALL_ARGS} -y base-chroot
|
||||
if [ $? -ne 0 ]; then
|
||||
msg_error "xbps-src: failed to install base-chroot!\n"
|
||||
fi
|
||||
# Reconfigure base-files to create dirs/symlinks.
|
||||
if xbps-query -r $XBPS_MASTERDIR base-files &>/dev/null; then
|
||||
XBPS_ARCH=$XBPS_TARGET_PKG xbps-reconfigure -r $XBPS_MASTERDIR -f base-files &>/dev/null
|
||||
fi
|
||||
|
||||
msg_normal "xbps-src: installed base-chroot successfully!\n"
|
||||
chroot_prepare $XBPS_TARGET_PKG || msg_error "xbps-src: failed to initialize chroot!\n"
|
||||
chroot_check
|
||||
chroot_handler clean
|
||||
}
|
||||
|
||||
reconfigure_base_chroot() {
|
||||
local statefile="$XBPS_MASTERDIR/.xbps_chroot_configured"
|
||||
local pkgs="glibc-locales ca-certificates"
|
||||
[ -z "$IN_CHROOT" -o -e $statefile ] && return 0
|
||||
# Reconfigure ca-certificates.
|
||||
msg_normal "xbps-src: reconfiguring base-chroot...\n"
|
||||
for f in ${pkgs}; do
|
||||
if xbps-query -r $XBPS_MASTERDIR $f &>/dev/null; then
|
||||
xbps-reconfigure -r $XBPS_MASTERDIR -f $f
|
||||
fi
|
||||
done
|
||||
touch -f $statefile
|
||||
}
|
||||
|
||||
update_base_chroot() {
|
||||
[ -z "$CHROOT_READY" ] && return
|
||||
[ -z "$XBPS_KEEP_ALL" -a -z "$XBPS_SKIP_DEPS" ] && remove_pkg_autodeps
|
||||
msg_normal "xbps-src: cleaning up $XBPS_MASTERDIR masterdir...\n"
|
||||
[ -z "$XBPS_KEEP_ALL" ] && rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
|
||||
msg_normal "xbps-src: updating software in $XBPS_MASTERDIR masterdir...\n"
|
||||
# no need to sync repodata, chroot_sync_repodata() does it for us.
|
||||
if $(${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -nu|grep xbps); then
|
||||
${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -yu xbps || msg_error "xbps-src: failed to update xbps!\n"
|
||||
fi
|
||||
${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -yu || msg_error "xbps-src: failed to update base-chroot!\n"
|
||||
}
|
||||
|
||||
# FIXME: $XBPS_FFLAGS is not set when chroot_init() is run
|
||||
# It is set in common/build-profiles/bootstrap.sh but lost somewhere?
|
||||
chroot_init() {
|
||||
|
@ -36,26 +93,7 @@ exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DI
|
|||
_EOF
|
||||
|
||||
chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
|
||||
|
||||
cp -f /etc/resolv.conf $XBPS_MASTERDIR/etc
|
||||
|
||||
# Update xbps alternative repository if set.
|
||||
mkdir -p $XBPS_MASTERDIR/etc/xbps.d
|
||||
if [ -n "$XBPS_ALT_REPOSITORY" ]; then
|
||||
( \
|
||||
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}"; \
|
||||
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}/nonfree"; \
|
||||
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}/debug"; \
|
||||
) > $XBPS_MASTERDIR/etc/xbps.d/00-repository-alternative.conf
|
||||
if [ "$XBPS_MACHINE" = "x86_64" ]; then
|
||||
( \
|
||||
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}/multilib"; \
|
||||
echo "repository=/host/binpkgs/${XBPS_ALT_REPOSITORY}/multilib/nonfree"; \
|
||||
) >> $XBPS_MASTERDIR/etc/xbps.d/00-repository-alternative.conf
|
||||
fi
|
||||
else
|
||||
rm -f $XBPS_MASTERDIR/etc/xbps.d/00-repository-alternative.conf
|
||||
fi
|
||||
}
|
||||
|
||||
chroot_prepare() {
|
||||
|
@ -90,8 +128,6 @@ chroot_prepare() {
|
|||
|
||||
mkdir -p $XBPS_MASTERDIR/etc/xbps.d
|
||||
echo "syslog=false" >> $XBPS_MASTERDIR/etc/xbps.d/xbps.conf
|
||||
echo "cachedir=/host/repocache" >> $XBPS_MASTERDIR/etc/xbps.d/xbps.conf
|
||||
ln -sf /dev/null $XBPS_MASTERDIR/etc/xbps.d/00-repository-main.conf
|
||||
|
||||
# Prepare default locale: en_US.UTF-8.
|
||||
if [ -s ${XBPS_MASTERDIR}/etc/default/libc-locales ]; then
|
||||
|
@ -104,62 +140,11 @@ chroot_prepare() {
|
|||
return 0
|
||||
}
|
||||
|
||||
chroot_sync_repos() {
|
||||
local f=
|
||||
|
||||
# Copy xbps configuration files to the masterdir.
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.conf \
|
||||
${XBPS_MASTERDIR}/etc/xbps.d/00-xbps-src.conf
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/repos-local.conf \
|
||||
${XBPS_MASTERDIR}/etc/xbps.d/10-repository-local.conf
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/repos-remote.conf \
|
||||
${XBPS_MASTERDIR}/etc/xbps.d/20-repository-remote.conf
|
||||
|
||||
if [ "$XBPS_MACHINE" = "x86_64" ]; then
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/repos-local-x86_64.conf \
|
||||
${XBPS_MASTERDIR}/etc/xbps.d/12-repository-local-x86_64.conf
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/repos-remote-x86_64.conf \
|
||||
${XBPS_MASTERDIR}/etc/xbps.d/22-repository-remote-x86_64.conf
|
||||
fi
|
||||
|
||||
# if -N is set, get rid of remote repos from x86_64 (glibc).
|
||||
if [ -n "$XBPS_SKIP_REMOTEREPOS" ]; then
|
||||
rm -f ${XBPS_MASTERDIR}/etc/xbps.d/20-repository-remote.conf
|
||||
rm -f ${XBPS_MASTERDIR}/etc/xbps.d/22-repository-remote-x86_64.conf
|
||||
fi
|
||||
|
||||
# Copy host repos to the cross root.
|
||||
if [ -n "$XBPS_CROSS_BUILD" ]; then
|
||||
rm -rf $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||
mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||
cp ${XBPS_MASTERDIR}/etc/xbps.d/*.conf \
|
||||
$XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||
rm -f $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d/*-x86_64.conf
|
||||
fi
|
||||
|
||||
if [ -z "$XBPS_SKIP_REMOTEREPOS" ]; then
|
||||
# Make sure to sync index for remote repositories.
|
||||
xbps-install -r $XBPS_MASTERDIR -S
|
||||
fi
|
||||
|
||||
if [ -n "$XBPS_CROSS_BUILD" ]; then
|
||||
# Copy host keys to the target rootdir.
|
||||
mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/var/db/xbps/keys
|
||||
cp $XBPS_MASTERDIR/var/db/xbps/keys/*.plist \
|
||||
$XBPS_MASTERDIR/$XBPS_CROSS_BASE/var/db/xbps/keys
|
||||
# Make sure to sync index for remote repositories.
|
||||
if [ -z "$XBPS_SKIP_REMOTEREPOS" ]; then
|
||||
env -- XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE \
|
||||
xbps-install -r $XBPS_MASTERDIR/$XBPS_CROSS_BASE -S
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
chroot_handler() {
|
||||
local action="$1" pkg="$2" rv=0 arg= _envargs=
|
||||
|
||||
[ -z "$action" -a -z "$pkg" ] && return 1
|
||||
|
||||
if [ -n "$IN_CHROOT" -o -z "$CHROOT_READY" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
@ -167,13 +152,10 @@ chroot_handler() {
|
|||
mkdir -p $XBPS_MASTERDIR/void-packages
|
||||
fi
|
||||
|
||||
[ -z "$action" -a -z "$pkg" ] && return 1
|
||||
|
||||
case "$action" in
|
||||
fetch|extract|patch|configure|build|check|install|pkg|bootstrap-update|chroot)
|
||||
chroot_prepare || return $?
|
||||
chroot_init || return $?
|
||||
chroot_sync_repos || return $?
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -200,3 +182,121 @@ chroot_handler() {
|
|||
|
||||
return $rv
|
||||
}
|
||||
|
||||
chroot_sync_repodata() {
|
||||
local f= hostdir= confdir= crossconfdir=
|
||||
|
||||
# always start with an empty xbps.d
|
||||
confdir=$XBPS_MASTERDIR/etc/xbps.d
|
||||
crossconfdir=$XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||
|
||||
[ -d $confdir ] && rm -rf $confdir
|
||||
|
||||
if [ "$CHROOT_READY" ]; then
|
||||
hostdir=/host
|
||||
else
|
||||
hostdir=$XBPS_HOSTDIR
|
||||
fi
|
||||
|
||||
# Update xbps alternative repository if set.
|
||||
mkdir -p $confdir
|
||||
if [ -n "$XBPS_ALT_REPOSITORY" ]; then
|
||||
( \
|
||||
echo "repository=$hostdir/binpkgs/${XBPS_ALT_REPOSITORY}"; \
|
||||
echo "repository=$hostdir/binpkgs/${XBPS_ALT_REPOSITORY}/nonfree"; \
|
||||
echo "repository=$hostdir/binpkgs/${XBPS_ALT_REPOSITORY}/debug"; \
|
||||
) > $confdir/00-repository-alt-local.conf
|
||||
if [ "$XBPS_MACHINE" = "x86_64" ]; then
|
||||
( \
|
||||
echo "repository=$hostdir/binpkgs/${XBPS_ALT_REPOSITORY}/multilib"; \
|
||||
echo "repository=$hostdir/binpkgs/${XBPS_ALT_REPOSITORY}/multilib/nonfree"; \
|
||||
) >> $confdir/00-repository-alt-local.conf
|
||||
fi
|
||||
else
|
||||
rm -f $confdir/00-repository-alt-local.conf
|
||||
fi
|
||||
|
||||
# Disable 00-repository-main.conf from share/xbps.d (part of xbps)
|
||||
ln -s /dev/null $confdir/00-repository-main.conf
|
||||
|
||||
# Generate xbps.d(5) configuration files for repositories
|
||||
sed -e "s,/host,$hostdir,g" ${XBPS_DISTDIR}/etc/xbps.d/repos-local.conf \
|
||||
> $confdir/10-repository-local.conf
|
||||
|
||||
if [ -z "$XBPS_SKIP_REMOTEREPOS" ]; then
|
||||
case "$XBPS_MACHINE" in
|
||||
*-musl)
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-musl.conf \
|
||||
$confdir/20-repository-remote.conf
|
||||
;;
|
||||
*)
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote.conf \
|
||||
$confdir/20-repository-remote.conf
|
||||
;;
|
||||
esac
|
||||
case "$XBPS_MACHINE" in
|
||||
x86_64)
|
||||
# x86_64/glibc
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-local-x86_64.conf \
|
||||
$confdir/12-repository-local-x86_64.conf
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-x86_64.conf \
|
||||
$confdir/22-repository-remote-x86_64.conf
|
||||
;;
|
||||
aarch64*)
|
||||
# aarch64 glibc/musl
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-aarch64.conf \
|
||||
$confdir/22-repository-remote-aarch64.conf
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Copy host repos to the cross root.
|
||||
if [ -n "$XBPS_CROSS_BUILD" ]; then
|
||||
rm -rf $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||
mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||
# copy xbps.d files from host for local repos
|
||||
cp ${XBPS_MASTERDIR}/etc/xbps.d/*local*.conf \
|
||||
$XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||
if [ -z "$XBPS_SKIP_REMOTEREPOS" ]; then
|
||||
# and then remote repos for target machine
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
aarch64*)
|
||||
# aarch64 glibc/musl
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-aarch64.conf \
|
||||
$crossconfdir/22-repository-remote-aarch64.conf
|
||||
;;
|
||||
*-musl)
|
||||
# !aarch64 && musl
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-musl.conf \
|
||||
$crossconfdir/20-repository-remote.conf
|
||||
;;
|
||||
*)
|
||||
# !aarch64 && glibc
|
||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote.conf \
|
||||
$crossconfdir/20-repository-remote.conf
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
# Copy xbps repository keys to the masterdir.
|
||||
mkdir -p $XBPS_MASTERDIR/var/db/xbps/keys
|
||||
cp -f $XBPS_COMMONDIR/repo-keys/*.plist $XBPS_MASTERDIR/var/db/xbps/keys
|
||||
|
||||
# Make sure to sync index for remote repositories.
|
||||
msg_normal "xbps-src: updating repositories for host ($XBPS_MACHINE)...\n"
|
||||
xbps-install -r $XBPS_MASTERDIR -S
|
||||
|
||||
if [ -n "$XBPS_CROSS_BUILD" ]; then
|
||||
# Copy host keys to the target rootdir.
|
||||
mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/var/db/xbps/keys
|
||||
cp $XBPS_MASTERDIR/var/db/xbps/keys/*.plist \
|
||||
$XBPS_MASTERDIR/$XBPS_CROSS_BASE/var/db/xbps/keys
|
||||
# Make sure to sync index for remote repositories.
|
||||
msg_normal "xbps-src: updating repositories for target ($XBPS_TARGET_MACHINE)...\n"
|
||||
env -- XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE \
|
||||
xbps-install -r $XBPS_MASTERDIR/$XBPS_CROSS_BASE -S
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -28,43 +28,43 @@ run_func() {
|
|||
}
|
||||
|
||||
ch_wrksrc() {
|
||||
cd "$wrksrc" || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n"
|
||||
if [ -n "$build_wrksrc" ]; then
|
||||
cd $build_wrksrc || \
|
||||
msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n"
|
||||
fi
|
||||
cd "$wrksrc" || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n"
|
||||
if [ -n "$build_wrksrc" ]; then
|
||||
cd $build_wrksrc || \
|
||||
msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n"
|
||||
fi
|
||||
}
|
||||
|
||||
# runs {pre,do,post}_X tripplets
|
||||
run_step() {
|
||||
local step_name="$1" optional_step="$2" skip_post_hook="$3"
|
||||
local step_name="$1" optional_step="$2" skip_post_hook="$3"
|
||||
|
||||
ch_wrksrc
|
||||
run_pkg_hooks "pre-$step_name"
|
||||
ch_wrksrc
|
||||
run_pkg_hooks "pre-$step_name"
|
||||
|
||||
# Run pre_* Phase
|
||||
if declare -f "pre_$step_name" >/dev/null; then
|
||||
ch_wrksrc
|
||||
run_func "pre_$step_name"
|
||||
ch_wrksrc
|
||||
run_func "pre_$step_name"
|
||||
fi
|
||||
|
||||
ch_wrksrc
|
||||
# Run do_* Phase
|
||||
if declare -f "do_$step_name" >/dev/null; then
|
||||
run_func "do_$step_name"
|
||||
run_func "do_$step_name"
|
||||
elif [ -n "$build_style" ]; then
|
||||
if [ -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
|
||||
. $XBPS_BUILDSTYLEDIR/${build_style}.sh
|
||||
if declare -f "do_$step_name" >/dev/null; then
|
||||
run_func "do_$step_name"
|
||||
elif [ ! "$optional_step" ]; then
|
||||
msg_error "$pkgver: cannot find do_$step_name() in $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
|
||||
if [ -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
|
||||
. $XBPS_BUILDSTYLEDIR/${build_style}.sh
|
||||
if declare -f "do_$step_name" >/dev/null; then
|
||||
run_func "do_$step_name"
|
||||
elif [ ! "$optional_step" ]; then
|
||||
msg_error "$pkgver: cannot find do_$step_name() in $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
|
||||
fi
|
||||
else
|
||||
msg_error "$pkgver: cannot find build style $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
|
||||
fi
|
||||
else
|
||||
msg_error "$pkgver: cannot find build style $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
|
||||
fi
|
||||
elif [ ! "$optional_step" ]; then
|
||||
msg_error "$pkgver: cannot find do_$step_name()!\n"
|
||||
msg_error "$pkgver: cannot find do_$step_name()!\n"
|
||||
fi
|
||||
|
||||
# Run do_ phase hooks
|
||||
|
@ -72,13 +72,13 @@ run_step() {
|
|||
|
||||
# Run post_* Phase
|
||||
if declare -f "post_$step_name" >/dev/null; then
|
||||
ch_wrksrc
|
||||
run_func "post_$step_name"
|
||||
ch_wrksrc
|
||||
run_func "post_$step_name"
|
||||
fi
|
||||
|
||||
if ! [ "$skip_post_hook" ]; then
|
||||
ch_wrksrc
|
||||
run_pkg_hooks "post-$step_name"
|
||||
ch_wrksrc
|
||||
run_pkg_hooks "post-$step_name"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -171,8 +171,8 @@ set_build_options() {
|
|||
OIFS="$IFS"; IFS=','
|
||||
for j in ${pkgopts}; do
|
||||
case "$j" in
|
||||
"$f") options[$j]=1 ;;
|
||||
"~$f") options[${j#\~}]=0 ;;
|
||||
"$f") options[$j]=1 ;;
|
||||
"~$f") options[${j#\~}]=0 ;;
|
||||
esac
|
||||
done
|
||||
IFS="$OIFS"
|
||||
|
@ -239,9 +239,9 @@ unset_package_funcs() {
|
|||
|
||||
for f in $(typeset -F); do
|
||||
case "$f" in
|
||||
*_package)
|
||||
unset -f "$f"
|
||||
;;
|
||||
*_package)
|
||||
unset -f "$f"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -297,9 +297,9 @@ get_subpkgs() {
|
|||
|
||||
for f in $(typeset -F); do
|
||||
case "$f" in
|
||||
*_package)
|
||||
echo "${f%_package}"
|
||||
;;
|
||||
*_package)
|
||||
echo "${f%_package}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ setup_pkg() {
|
|||
XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_REMOVE_CMD -r $XBPS_CROSS_BASE"
|
||||
XBPS_RINDEX_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE $XBPS_RINDEX_CMD"
|
||||
XBPS_UHELPER_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-uhelper -r $XBPS_CROSS_BASE"
|
||||
XBPS_CHECKVERS_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-checkvers -r $XBPS_CROSS_BASE --repository=$XBPS_REPOSITORY"
|
||||
XBPS_CHECKVERS_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-checkvers -r $XBPS_CROSS_BASE"
|
||||
else
|
||||
export XBPS_TARGET_MACHINE=${XBPS_ARCH:-$XBPS_MACHINE}
|
||||
unset XBPS_CROSS_BASE XBPS_CROSS_LDFLAGS XBPS_CROSS_FFLAGS
|
||||
|
@ -455,11 +455,12 @@ setup_pkg() {
|
|||
arch="$XBPS_TARGET_MACHINE"
|
||||
fi
|
||||
if [ -n "$XBPS_BINPKG_EXISTS" ]; then
|
||||
# nonfree packages need this otherwise they'll rebuild even with -E
|
||||
if [ -n "$repository" ]; then
|
||||
extrarepo=" --repository=$XBPS_REPOSITORY/$repository"
|
||||
fi
|
||||
if [ "$($XBPS_QUERY_XCMD $extrarepo -i -R -ppkgver $pkgver 2>/dev/null)" = "$pkgver" ]; then
|
||||
local _binpkgver="$($XBPS_QUERY_XCMD -R -ppkgver $pkgver 2>/dev/null)"
|
||||
if [ "$_binpkgver" = "$pkgver" ]; then
|
||||
if [ -z "$XBPS_DEPENDENCY" ]; then
|
||||
local _repo="$($XBPS_QUERY_XCMD -R -prepository $pkgver 2>/dev/null)"
|
||||
msg_normal "xbps-src: $pkgver: found ($XBPS_TARGET_MACHINE) ($_repo)\n"
|
||||
fi
|
||||
exit_and_cleanup
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -39,15 +39,27 @@ prepare_cross_sysroot() {
|
|||
|
||||
[ -z "$cross" -o "$cross" = "" -o -f $statefile ] && return 0
|
||||
|
||||
# Check if the cross pkg is installed in host.
|
||||
check_installed_pkg cross-${XBPS_CROSS_TRIPLET}-0.1_1
|
||||
[ $? -eq 0 ] && return 0
|
||||
|
||||
# Check if the cross compiler pkg is available in repos, otherwise build it.
|
||||
pkg_available cross-${XBPS_CROSS_TRIPLET}
|
||||
rval=$?
|
||||
if [ $rval -eq 0 ]; then
|
||||
$XBPS_LIBEXECDIR/build.sh cross-${XBPS_CROSS_TRIPLET} cross-${XBPS_CROSS_TRIPLET} pkg || return $?
|
||||
fi
|
||||
|
||||
# Check if cross-vpkg-dummy is installed.
|
||||
check_installed_pkg cross-vpkg-dummy-0.30_1 $cross
|
||||
[ $? -eq 0 ] && return 0
|
||||
|
||||
# Check for cross-vpkg-dummy available for the target arch, otherwise build it.
|
||||
pkg_available 'cross-vpkg-dummy>=0.33_1' $cross
|
||||
if [ $? -eq 0 ]; then
|
||||
$XBPS_LIBEXECDIR/build.sh cross-vpkg-dummy cross-vpkg-dummy pkg $cross init || return $?
|
||||
$XBPS_LIBEXECDIR/build.sh cross-vpkg-dummy bootstrap pkg $cross init || return $?
|
||||
fi
|
||||
|
||||
check_installed_pkg cross-vpkg-dummy-0.30_1 $cross
|
||||
[ $? -eq 0 ] && return 0
|
||||
|
||||
msg_normal "Installing $cross cross pkg: cross-vpkg-dummy ...\n"
|
||||
errlog=$(mktemp) || exit 1
|
||||
$XBPS_INSTALL_XCMD -Syfd cross-vpkg-dummy &>$errlog
|
||||
|
@ -75,6 +87,10 @@ install_cross_pkg() {
|
|||
|
||||
[ -z "$cross" -o "$cross" = "" ] && return 0
|
||||
|
||||
# Check if installed.
|
||||
check_installed_pkg cross-${XBPS_CROSS_TRIPLET}-0.1_1
|
||||
[ $? -eq 0 ] && return 0
|
||||
|
||||
# Check if the cross compiler pkg is available in repos, otherwise build it.
|
||||
pkg_available cross-${XBPS_CROSS_TRIPLET}
|
||||
rval=$?
|
||||
|
@ -82,11 +98,8 @@ install_cross_pkg() {
|
|||
$XBPS_LIBEXECDIR/build.sh cross-${XBPS_CROSS_TRIPLET} cross-${XBPS_CROSS_TRIPLET} pkg || return $?
|
||||
fi
|
||||
|
||||
check_installed_pkg cross-${XBPS_CROSS_TRIPLET}-0.1_1
|
||||
[ $? -eq 0 ] && return 0
|
||||
|
||||
errlog=$(mktemp) || exit 1
|
||||
msg_normal "Installing $cross cross compiler: cross-${XBPS_CROSS_TRIPLET} ...\n"
|
||||
msg_normal "xbps-src: installing cross compiler: cross-${XBPS_CROSS_TRIPLET} ...\n"
|
||||
$XBPS_INSTALL_CMD -Syfd cross-${XBPS_CROSS_TRIPLET} &>$errlog
|
||||
rval=$?
|
||||
if [ $rval -ne 0 -a $rval -ne 17 ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue