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:
Juan RP 2020-01-01 11:15:35 +01:00
parent b714ffe390
commit 75eca1b03e
26 changed files with 325 additions and 356 deletions

2
.gitignore vendored
View file

@ -7,4 +7,4 @@ masterdir*
hostdir* hostdir*
etc/conf etc/conf
etc/virtual etc/virtual
.xbps-checkvers.plist .xbps-checkvers*.plist

View file

@ -70,8 +70,8 @@ hook() {
fi fi
case ${cursufx} in case ${cursufx} in
txz|tbz|tlz|tgz|crate) tar|txz|tbz|tlz|tgz|crate)
tar -x --no-same-permissions --no-same-owner -f $srcdir/$curfile -C $extractdir bsdtar -x --no-same-permissions --no-same-owner -f $srcdir/$curfile -C $extractdir
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
@ -84,12 +84,6 @@ hook() {
cd $extractdir && bunzip2 -f $curfile cd $extractdir && bunzip2 -f $curfile
fi fi
;; ;;
tar)
tar -x --no-same-permissions --no-same-owner -f $srcdir/$curfile -C $extractdir
if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
fi
;;
zip) zip)
if command -v unzip &>/dev/null; then if command -v unzip &>/dev/null; then
unzip -o -q $srcdir/$curfile -d $extractdir unzip -o -q $srcdir/$curfile -d $extractdir

View file

@ -50,7 +50,7 @@ contents_cksum() {
case ${cursufx} in case ${cursufx} in
tar|txz|tbz|tlz|tgz|crate) tar|txz|tbz|tlz|tgz|crate)
cksum=$($XBPS_DIGEST_CMD <(tar xf "$curfile" --to-stdout)) cksum=$($XBPS_DIGEST_CMD <(bsdtar xf "$curfile" --list))
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile to pipe.\n" msg_error "$pkgver: extracting $curfile to pipe.\n"
fi fi
@ -95,7 +95,7 @@ contents_cksum() {
fi fi
;; ;;
gem) gem)
cksum=$($XBPS_DIGEST_CMD <(tar -xf "$curfile" data.tar.gz --to-stdout | tar -xzO )) cksum=$($XBPS_DIGEST_CMD <(bsdtar -xf "$curfile" data.tar.gz --list | bsdtar -xzO ))
;; ;;
*) *)
msg_error "$pkgver: cannot guess $curfile extract suffix. ($cursufx)\n" msg_error "$pkgver: cannot guess $curfile extract suffix. ($cursufx)\n"

View file

@ -129,20 +129,4 @@ if [ -n "$XBPS_DEPENDENCY" -o -z "$XBPS_KEEP_ALL" ]; then
remove_pkg_statedir remove_pkg_statedir
fi fi
# If base-chroot not installed, install "base-files" into masterdir
# from local repository; this is the only pkg required to be able to build
# the bootstrap pkgs from scratch.
if [ -z "$CHROOT_READY" -a "$PKGNAME" = "base-files" ]; then
msg_normal "Installing $PKGNAME into masterdir...\n"
_log=$(mktemp) || exit 1
XBPS_ARCH=$XBPS_MACHINE $XBPS_INSTALL_CMD -yf $PKGNAME >${_log} 2>&1
if [ $? -ne 0 ]; then
msg_red "Failed to install $PKGNAME into masterdir, see below for errors:\n"
cat ${_log}
rm -f ${_log}
msg_error "Cannot continue!\n"
fi
rm -f ${_log}
fi
exit 0 exit 0

View file

@ -20,10 +20,6 @@ done
setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD setup_pkg "$PKGNAME" $XBPS_CROSS_BUILD
for f in $XBPS_COMMONDIR/environment/patch/*.sh; do
source_file "$f"
done
XBPS_PATCH_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_patch_done" XBPS_PATCH_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_patch_done"
if [ -f $XBPS_PATCH_DONE ]; then if [ -f $XBPS_PATCH_DONE ]; then

View file

@ -43,10 +43,9 @@ setup_pkg_depends() {
# #
# Install required package dependencies, like: # Install required package dependencies, like:
# #
# xbps-install -AIy <pkgs> # xbps-install -Ay <pkgs>
# #
# -A automatic mode # -A automatic mode
# -I to ignore file conflicts
# -y yes # -y yes
# #
# Returns 0 if package already installed or installed successfully. # Returns 0 if package already installed or installed successfully.
@ -56,10 +55,12 @@ setup_pkg_depends() {
# ENOENT (2): package missing in repositories. # ENOENT (2): package missing in repositories.
# ENXIO (6): package depends on invalid dependencies. # ENXIO (6): package depends on invalid dependencies.
# EAGAIN (11): package conflicts. # EAGAIN (11): package conflicts.
# EBUSY (16): package 'xbps' needs to be updated.
# EEXIST (17): file conflicts in transaction (XBPS_FLAG_IGNORE_FILE_CONFLICTS unset) # EEXIST (17): file conflicts in transaction (XBPS_FLAG_IGNORE_FILE_CONFLICTS unset)
# ENODEV (19): package depends on missing dependencies. # ENODEV (19): package depends on missing dependencies.
# ENOTSUP (95): no repositories registered. # ENOTSUP (95): no repositories registered.
# # -1 (255): unexpected error.
install_pkg_from_repos() { install_pkg_from_repos() {
local cross="$1" rval tmplogf cmd local cross="$1" rval tmplogf cmd
shift shift
@ -71,7 +72,7 @@ install_pkg_from_repos() {
cmd=$XBPS_INSTALL_CMD cmd=$XBPS_INSTALL_CMD
[[ $cross ]] && cmd=$XBPS_INSTALL_XCMD [[ $cross ]] && cmd=$XBPS_INSTALL_XCMD
$cmd -AIy "$@" >$tmplogf 2>&1 $cmd -Ay "$@" >$tmplogf 2>&1
rval=$? rval=$?
case "$rval" in case "$rval" in
@ -137,9 +138,9 @@ install_pkg_deps() {
done done
if [ "$pkg" != "$targetpkg" ]; then 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 else
msg_normal "$pkgver: building${style} ...\n" msg_normal "$pkgver: building${style} for $XBPS_TARGET_MACHINE...\n"
fi fi
# #
@ -189,7 +190,7 @@ install_pkg_deps() {
echo " [host] ${_vpkg}: not found" echo " [host] ${_vpkg}: not found"
host_missing_deps+=("$_vpkg") host_missing_deps+=("$_vpkg")
fi fi
done < <($XBPS_CHECKVERS_CMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm $templates) done < <($XBPS_CHECKVERS_CMD -D $XBPS_DISTDIR -sm $templates)
fi fi
# #
@ -239,7 +240,7 @@ install_pkg_deps() {
echo " [check] ${_vpkg}: not found" echo " [check] ${_vpkg}: not found"
host_missing_deps+=("$_vpkg") host_missing_deps+=("$_vpkg")
fi fi
done < <($XBPS_CHECKVERS_CMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm ${templates}) done < <($XBPS_CHECKVERS_CMD -D $XBPS_DISTDIR -sm ${templates})
fi fi
# #
@ -253,7 +254,7 @@ install_pkg_deps() {
templates+=" $f" templates+=" $f"
continue continue
fi 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 if [ "$_repourl" ]; then
echo " [target] ${f}: found (${_repourl})" echo " [target] ${f}: found (${_repourl})"
binpkg_deps+=("$f") binpkg_deps+=("$f")
@ -289,7 +290,7 @@ install_pkg_deps() {
echo " [target] ${_vpkg}: not found" echo " [target] ${_vpkg}: not found"
missing_deps+=("$_vpkg") missing_deps+=("$_vpkg")
fi fi
done < <($XBPS_CHECKVERS_XCMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm $templates) done < <($XBPS_CHECKVERS_XCMD -D $XBPS_DISTDIR -sm $templates)
fi fi
# #
@ -303,7 +304,7 @@ install_pkg_deps() {
templates+=" $f" templates+=" $f"
continue continue
fi 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 if [ "$_repourl" ]; then
echo " [target] ${f}: found (${_repourl})" echo " [target] ${f}: found (${_repourl})"
continue continue
@ -337,7 +338,7 @@ install_pkg_deps() {
echo " [runtime] ${_vpkg}: not found" echo " [runtime] ${_vpkg}: not found"
missing_rdeps+=("$_vpkg") missing_rdeps+=("$_vpkg")
fi fi
done < <($XBPS_CHECKVERS_XCMD ${XBPS_SKIP_REMOTEREPOS:+-i} -D $XBPS_DISTDIR -sm $templates) done < <($XBPS_CHECKVERS_XCMD -D $XBPS_DISTDIR -sm $templates)
fi fi
if [ -n "$XBPS_BUILD_ONLY_ONE_PKG" ]; then if [ -n "$XBPS_BUILD_ONLY_ONE_PKG" ]; then
@ -359,8 +360,8 @@ install_pkg_deps() {
curpkgdepname=$($XBPS_UHELPER_CMD getpkgname "$i" 2>/dev/null) curpkgdepname=$($XBPS_UHELPER_CMD getpkgname "$i" 2>/dev/null)
setup_pkg $curpkgdepname setup_pkg $curpkgdepname
exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \ exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \
$XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target || exit $? $XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target $cross_prepare || exit $?
) || exit $? ) || msg_error "xbps-src: failed to build host dependency '$i' ($?)\n"
host_binpkg_deps+=("$i") host_binpkg_deps+=("$i")
done done
@ -373,7 +374,7 @@ install_pkg_deps() {
setup_pkg $curpkgdepname $cross setup_pkg $curpkgdepname $cross
exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \ exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \
$XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target $cross $cross_prepare || exit $? $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") binpkg_deps+=("$i")
done done
@ -391,7 +392,7 @@ install_pkg_deps() {
setup_pkg $curpkgdepname $cross setup_pkg $curpkgdepname $cross
exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \ exec env XBPS_DEPENDENCY=1 XBPS_BINPKG_EXISTS=1 \
$XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target $cross $cross_prepare || exit $? $XBPS_LIBEXECDIR/build.sh $sourcepkg $pkg $target $cross $cross_prepare || exit $?
) || exit $? ) || msg_error "xbps-src: failed to build target dependency '$i' ($?)\n"
done done
if [[ ${host_binpkg_deps} ]]; then if [[ ${host_binpkg_deps} ]]; then

View file

@ -115,6 +115,6 @@ bulk_update() {
if [ -n "$pkgs" -a -n "$args" ]; then if [ -n "$pkgs" -a -n "$args" ]; then
echo echo
msg_normal "xbps-src: updating your system, confirm to proceed...\n" 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 fi
} }

View file

@ -1,5 +1,62 @@
# vim: set ts=4 sw=4 et: # 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 # FIXME: $XBPS_FFLAGS is not set when chroot_init() is run
# It is set in common/build-profiles/bootstrap.sh but lost somewhere? # It is set in common/build-profiles/bootstrap.sh but lost somewhere?
chroot_init() { chroot_init() {
@ -36,26 +93,7 @@ exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DI
_EOF _EOF
chmod 755 $XBPS_MASTERDIR/bin/xbps-shell chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
cp -f /etc/resolv.conf $XBPS_MASTERDIR/etc 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() { chroot_prepare() {
@ -90,8 +128,6 @@ chroot_prepare() {
mkdir -p $XBPS_MASTERDIR/etc/xbps.d mkdir -p $XBPS_MASTERDIR/etc/xbps.d
echo "syslog=false" >> $XBPS_MASTERDIR/etc/xbps.d/xbps.conf 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. # Prepare default locale: en_US.UTF-8.
if [ -s ${XBPS_MASTERDIR}/etc/default/libc-locales ]; then if [ -s ${XBPS_MASTERDIR}/etc/default/libc-locales ]; then
@ -104,62 +140,11 @@ chroot_prepare() {
return 0 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() { chroot_handler() {
local action="$1" pkg="$2" rv=0 arg= _envargs= 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 if [ -n "$IN_CHROOT" -o -z "$CHROOT_READY" ]; then
return 0 return 0
fi fi
@ -167,13 +152,10 @@ chroot_handler() {
mkdir -p $XBPS_MASTERDIR/void-packages mkdir -p $XBPS_MASTERDIR/void-packages
fi fi
[ -z "$action" -a -z "$pkg" ] && return 1
case "$action" in case "$action" in
fetch|extract|patch|configure|build|check|install|pkg|bootstrap-update|chroot) fetch|extract|patch|configure|build|check|install|pkg|bootstrap-update|chroot)
chroot_prepare || return $? chroot_prepare || return $?
chroot_init || return $? chroot_init || return $?
chroot_sync_repos || return $?
;; ;;
esac esac
@ -200,3 +182,121 @@ chroot_handler() {
return $rv 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
}

View file

@ -28,43 +28,43 @@ run_func() {
} }
ch_wrksrc() { ch_wrksrc() {
cd "$wrksrc" || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n" cd "$wrksrc" || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n"
if [ -n "$build_wrksrc" ]; then if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc || \ cd $build_wrksrc || \
msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n" msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n"
fi fi
} }
# runs {pre,do,post}_X tripplets # runs {pre,do,post}_X tripplets
run_step() { 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 ch_wrksrc
run_pkg_hooks "pre-$step_name" run_pkg_hooks "pre-$step_name"
# Run pre_* Phase # Run pre_* Phase
if declare -f "pre_$step_name" >/dev/null; then if declare -f "pre_$step_name" >/dev/null; then
ch_wrksrc ch_wrksrc
run_func "pre_$step_name" run_func "pre_$step_name"
fi fi
ch_wrksrc ch_wrksrc
# Run do_* Phase # Run do_* Phase
if declare -f "do_$step_name" >/dev/null; then if declare -f "do_$step_name" >/dev/null; then
run_func "do_$step_name" run_func "do_$step_name"
elif [ -n "$build_style" ]; then elif [ -n "$build_style" ]; then
if [ -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then if [ -r $XBPS_BUILDSTYLEDIR/${build_style}.sh ]; then
. $XBPS_BUILDSTYLEDIR/${build_style}.sh . $XBPS_BUILDSTYLEDIR/${build_style}.sh
if declare -f "do_$step_name" >/dev/null; then if declare -f "do_$step_name" >/dev/null; then
run_func "do_$step_name" run_func "do_$step_name"
elif [ ! "$optional_step" ]; then elif [ ! "$optional_step" ]; then
msg_error "$pkgver: cannot find do_$step_name() in $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n" 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 fi
else
msg_error "$pkgver: cannot find build style $XBPS_BUILDSTYLEDIR/${build_style}.sh!\n"
fi
elif [ ! "$optional_step" ]; then elif [ ! "$optional_step" ]; then
msg_error "$pkgver: cannot find do_$step_name()!\n" msg_error "$pkgver: cannot find do_$step_name()!\n"
fi fi
# Run do_ phase hooks # Run do_ phase hooks
@ -72,13 +72,13 @@ run_step() {
# Run post_* Phase # Run post_* Phase
if declare -f "post_$step_name" >/dev/null; then if declare -f "post_$step_name" >/dev/null; then
ch_wrksrc ch_wrksrc
run_func "post_$step_name" run_func "post_$step_name"
fi fi
if ! [ "$skip_post_hook" ]; then if ! [ "$skip_post_hook" ]; then
ch_wrksrc ch_wrksrc
run_pkg_hooks "post-$step_name" run_pkg_hooks "post-$step_name"
fi fi
} }
@ -171,8 +171,8 @@ set_build_options() {
OIFS="$IFS"; IFS=',' OIFS="$IFS"; IFS=','
for j in ${pkgopts}; do for j in ${pkgopts}; do
case "$j" in case "$j" in
"$f") options[$j]=1 ;; "$f") options[$j]=1 ;;
"~$f") options[${j#\~}]=0 ;; "~$f") options[${j#\~}]=0 ;;
esac esac
done done
IFS="$OIFS" IFS="$OIFS"
@ -239,9 +239,9 @@ unset_package_funcs() {
for f in $(typeset -F); do for f in $(typeset -F); do
case "$f" in case "$f" in
*_package) *_package)
unset -f "$f" unset -f "$f"
;; ;;
esac esac
done done
} }
@ -297,9 +297,9 @@ get_subpkgs() {
for f in $(typeset -F); do for f in $(typeset -F); do
case "$f" in case "$f" in
*_package) *_package)
echo "${f%_package}" echo "${f%_package}"
;; ;;
esac esac
done 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_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_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_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 else
export XBPS_TARGET_MACHINE=${XBPS_ARCH:-$XBPS_MACHINE} export XBPS_TARGET_MACHINE=${XBPS_ARCH:-$XBPS_MACHINE}
unset XBPS_CROSS_BASE XBPS_CROSS_LDFLAGS XBPS_CROSS_FFLAGS unset XBPS_CROSS_BASE XBPS_CROSS_LDFLAGS XBPS_CROSS_FFLAGS
@ -455,11 +455,12 @@ setup_pkg() {
arch="$XBPS_TARGET_MACHINE" arch="$XBPS_TARGET_MACHINE"
fi fi
if [ -n "$XBPS_BINPKG_EXISTS" ]; then if [ -n "$XBPS_BINPKG_EXISTS" ]; then
# nonfree packages need this otherwise they'll rebuild even with -E local _binpkgver="$($XBPS_QUERY_XCMD -R -ppkgver $pkgver 2>/dev/null)"
if [ -n "$repository" ]; then if [ "$_binpkgver" = "$pkgver" ]; then
extrarepo=" --repository=$XBPS_REPOSITORY/$repository" if [ -z "$XBPS_DEPENDENCY" ]; then
fi local _repo="$($XBPS_QUERY_XCMD -R -prepository $pkgver 2>/dev/null)"
if [ "$($XBPS_QUERY_XCMD $extrarepo -i -R -ppkgver $pkgver 2>/dev/null)" = "$pkgver" ]; then msg_normal "xbps-src: $pkgver: found ($XBPS_TARGET_MACHINE) ($_repo)\n"
fi
exit_and_cleanup exit_and_cleanup
fi fi
fi fi

View file

@ -39,15 +39,27 @@ prepare_cross_sysroot() {
[ -z "$cross" -o "$cross" = "" -o -f $statefile ] && return 0 [ -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. # Check for cross-vpkg-dummy available for the target arch, otherwise build it.
pkg_available 'cross-vpkg-dummy>=0.33_1' $cross pkg_available 'cross-vpkg-dummy>=0.33_1' $cross
if [ $? -eq 0 ]; then 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 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" msg_normal "Installing $cross cross pkg: cross-vpkg-dummy ...\n"
errlog=$(mktemp) || exit 1 errlog=$(mktemp) || exit 1
$XBPS_INSTALL_XCMD -Syfd cross-vpkg-dummy &>$errlog $XBPS_INSTALL_XCMD -Syfd cross-vpkg-dummy &>$errlog
@ -75,6 +87,10 @@ install_cross_pkg() {
[ -z "$cross" -o "$cross" = "" ] && return 0 [ -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. # Check if the cross compiler pkg is available in repos, otherwise build it.
pkg_available cross-${XBPS_CROSS_TRIPLET} pkg_available cross-${XBPS_CROSS_TRIPLET}
rval=$? rval=$?
@ -82,11 +98,8 @@ install_cross_pkg() {
$XBPS_LIBEXECDIR/build.sh cross-${XBPS_CROSS_TRIPLET} cross-${XBPS_CROSS_TRIPLET} pkg || return $? $XBPS_LIBEXECDIR/build.sh cross-${XBPS_CROSS_TRIPLET} cross-${XBPS_CROSS_TRIPLET} pkg || return $?
fi fi
check_installed_pkg cross-${XBPS_CROSS_TRIPLET}-0.1_1
[ $? -eq 0 ] && return 0
errlog=$(mktemp) || exit 1 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 $XBPS_INSTALL_CMD -Syfd cross-${XBPS_CROSS_TRIPLET} &>$errlog
rval=$? rval=$?
if [ $rval -ne 0 -a $rval -ne 17 ]; then if [ $rval -ne 0 -a $rval -ne 17 ]; then

View file

@ -15,9 +15,14 @@
# #
# [OPTIONAL] # [OPTIONAL]
# Enable optional arguments to xbps-install for the host system. # Enable optional arguments to xbps-install(1) for the host system.
# Currently used in the binary-bootstrap bootstrap-update targets. # Currently used in the 'binary-bootstrap' and 'bootstrap-update' targets.
XBPS_INSTALL_ARGS="--repository=https://alpha.de.repo.voidlinux.org/current --repository=https://alpha.de.repo.voidlinux.org/current/musl --repository=https://alpha.de.repo.voidlinux.org/current/aarch64" #
# NOTE: local repositories are handled automatically by xbps-src,
# but you can modify the default remote repositories at
# 'etc/xbps.d/repos-remote*.conf'
#
#XBPS_INSTALL_ARGS=""
# [OPTIONAL] # [OPTIONAL]
# Native Compilation/Preprocessor flags for C and C++. Additional settings # Native Compilation/Preprocessor flags for C and C++. Additional settings
@ -60,7 +65,7 @@ XBPS_SUCMD="sudo /bin/sh -c"
# [OPTIONAL] # [OPTIONAL]
# Enable recording git revisions in final binary packages; enable this # Enable recording git revisions in final binary packages; enable this
# if you are sure the package you are building is available in the # if you are sure the package you are building is available in the
# xbps-packages git repository. # void-packages git repository.
# #
#XBPS_USE_GIT_REVS=yes #XBPS_USE_GIT_REVS=yes
@ -113,8 +118,8 @@ XBPS_SUCMD="sudo /bin/sh -c"
# [OPTIONAL] # [OPTIONAL]
# Set the preferred chroot style. Available styles at common/chroot-style/*.sh: # Set the preferred chroot style. Available styles at common/chroot-style/*.sh:
# #
# - uunshare (uses xbps-uunshare(8), user namespaces) # - uunshare (uses xbps-uunshare(1), user namespaces)
# - uchroot (uses xbps-uchroot(8), namespaces, setgid) # - uchroot (uses xbps-uchroot(1), namespaces, setgid)
# - proot (uses proot, external, does not need special permissions) # - proot (uses proot, external, does not need special permissions)
# - bwrap (uses bwrap, external, does not need special permissions) # - bwrap (uses bwrap, external, does not need special permissions)
# - ethereal (uses root, needs no permissions, for disposable containers) # - ethereal (uses root, needs no permissions, for disposable containers)

View file

@ -1,13 +0,0 @@
# Remote repositories
repository=https://alpha.de.repo.voidlinux.org/current/musl
repository=https://alpha.de.repo.voidlinux.org/current/musl/nonfree
repository=https://alpha.de.repo.voidlinux.org/current
repository=https://alpha.de.repo.voidlinux.org/current/nonfree
repository=https://alpha.de.repo.voidlinux.org/current/aarch64
# Additional mirrors
#
# http://mirror.clarkson.edu/voidlinux/current/ US
# http://www.gtlib.gatech.edu/pub/VoidLinux/current/ US
# https://lug.utdallas.edu/mirror/void/ US
# http://mirror.aarnet.edu.au/pub/voidlinux/current/ AU

View file

@ -1 +0,0 @@
syslog=false

View file

@ -1,3 +1,4 @@
# Local repositories # DON'T EDIT THIS FILE
# x86_64/glibc local repositories
repository=/host/binpkgs/multilib repository=/host/binpkgs/multilib
repository=/host/binpkgs/multilib/nonfree repository=/host/binpkgs/multilib/nonfree

View file

@ -1,3 +1,4 @@
# DON'T EDIT THIS FILE
# Local repositories # Local repositories
repository=/host/binpkgs repository=/host/binpkgs
repository=/host/binpkgs/nonfree repository=/host/binpkgs/nonfree

View file

@ -0,0 +1,4 @@
# aarch64 voidlinux remote repositories
repository=https://alpha.de.repo.voidlinux.org/current/aarch64
repository=https://alpha.de.repo.voidlinux.org/current/aarch64/nonfree
repository=https://alpha.de.repo.voidlinux.org/current/aarch64/debug

View file

@ -0,0 +1,4 @@
# voidlinux remote repositories (musl)
repository=https://alpha.de.repo.voidlinux.org/current/musl
repository=https://alpha.de.repo.voidlinux.org/current/musl/nonfree
repository=https://alpha.de.repo.voidlinux.org/current/musl/debug

View file

@ -1,3 +1,3 @@
# Remote repositories # voidlinux remote repositories (x86_64/glibc)
repository=https://alpha.de.repo.voidlinux.org/current/multilib repository=https://alpha.de.repo.voidlinux.org/current/multilib
repository=https://alpha.de.repo.voidlinux.org/current/multilib/nonfree repository=https://alpha.de.repo.voidlinux.org/current/multilib/nonfree

View file

@ -0,0 +1,4 @@
# voidlinux remote repositories (glibc)
repository=https://alpha.de.repo.voidlinux.org/current
repository=https://alpha.de.repo.voidlinux.org/current/nonfree
repository=https://alpha.de.repo.voidlinux.org/current/debug

View file

@ -1,21 +0,0 @@
# Template file for 'base-chroot-musl'
pkgname=base-chroot-musl
version=0.19
revision=6
archs="*-musl"
bootstrap=yes
build_style=meta
homepage="https://www.voidlinux.org"
short_desc="Bootstrap packages for xbps-src (musl libc)"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="Public domain"
conflicts="base-chroot>=0"
provides="base-chroot-${version}_${revision}"
depends="
base-files kernel-libc-headers musl-devel musl-legacy-compat
gcc patch chroot-bash chroot-grep coreutils findutils
mpfr gettext chroot-texinfo sed chroot-gawk diffutils
make gzip file tar chroot-util-linux chroot-git ccache
chroot-distcc xbps xz which libada-devel gcc-ada"

View file

@ -1,17 +1,21 @@
# Template file for 'base-chroot' # Template file for 'base-chroot'
pkgname=base-chroot pkgname=base-chroot
version=0.65 version=0.66
revision=6 revision=1
archs="~*-musl"
bootstrap=yes bootstrap=yes
build_style=meta build_style=meta
homepage="http://www.voidlinux.org" homepage="http://www.voidlinux.org"
short_desc="Bootstrap packages for xbps-src" short_desc="Minimal set of packages required for chroot with xbps-src"
maintainer="Enno Boland <gottox@voidlinux.org>" maintainer="Juan RP <xtraeme@gmail.com>"
license="Public domain" license="Public domain"
depends=" case "$XBPS_TARGET_LIBC" in
base-files>=0.127 kernel-libc-headers glibc-devel glibc-locales binutils gcc musl) depends="musl-devel";;
mpfr patch chroot-bash chroot-grep coreutils gettext libada-devel gcc-ada *) depends="glibc-devel glibc-locales";;
chroot-texinfo sed chroot-gawk findutils diffutils make gzip file tar esac
chroot-distcc chroot-util-linux chroot-git ccache xbps readline xz which"
depends+="
base-files binutils gcc gcc-ada libada-devel
patch sed findutils diffutils make gzip coreutils
file bsdtar ccache xbps chroot-bash chroot-grep
chroot-gawk chroot-distcc chroot-util-linux chroot-git"

View file

@ -1,39 +0,0 @@
# Template file for 'chroot-texinfo'
pkgname=chroot-texinfo
reverts="6.5_1"
version=4.13a
revision=10
wrksrc=texinfo-4.13
bootstrap=yes
hostmakedepends="ncurses-devel"
makedepends="ncurses-devel"
conflicts="texinfo>=0"
provides="texinfo-${version}_${revision}"
short_desc="The GNU Documentation System -- for xbps-src use"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-3"
homepage="http://www.gnu.org/software/texinfo/"
distfiles="${GNU_SITE}/texinfo/texinfo-${version}.tar.lzma"
checksum=6d28b0ceae866e3536142fc552e7a3bc9f84c8303119c25731b2478eef64c9e5
do_configure() {
cp -f ${XBPS_COMMONDIR}/environment/configure/automake/config.sub build-aux
./configure ${configure_args} --disable-nls
}
do_build() {
if [ -d tools ]; then
make ${makejobs} -C tools/gnulib/lib
make ${makejobs} -C tools
fi
make ${makejobs}
}
do_install() {
make DESTDIR=${DESTDIR} install
rm -f ${DESTDIR}/usr/bin/info
rm -f ${DESTDIR}/usr/bin/infokey
rm -rf ${DESTDIR}/usr/share
}

View file

@ -2,7 +2,6 @@
pkgname=gettext pkgname=gettext
version=0.20.1 version=0.20.1
revision=1 revision=1
bootstrap=yes
build_style=gnu-configure build_style=gnu-configure
configure_args="--disable-java --disable-native-java --disable-csharp configure_args="--disable-java --disable-native-java --disable-csharp
--disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs --disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs
@ -23,7 +22,7 @@ case "$XBPS_TARGET_MACHINE" in
esac esac
if [ "$CROSS_BUILD" ]; then if [ "$CROSS_BUILD" ]; then
hostmakedepends="automake libtool git" hostmakedepends="automake libtool"
pre_configure() { pre_configure() {
autoreconf -fi autoreconf -fi
} }

View file

@ -2,7 +2,6 @@
pkgname=tar pkgname=tar
version=1.32 version=1.32
revision=1 revision=1
bootstrap=yes
build_style=gnu-configure build_style=gnu-configure
configure_args="gl_cv_struct_dirent_d_ino=yes" configure_args="gl_cv_struct_dirent_d_ino=yes"
makedepends="acl-devel" makedepends="acl-devel"

View file

@ -1,13 +1,12 @@
# Template file for 'texinfo' # Template file for 'texinfo'
pkgname=texinfo pkgname=texinfo
version=6.5 version=6.5
revision=1 revision=2
build_style=gnu-configure build_style=gnu-configure
configure_args="--disable-static" configure_args="--disable-static"
hostmakedepends="perl ncurses-devel" hostmakedepends="perl ncurses-devel"
makedepends="ncurses-devel" makedepends="ncurses-devel"
checkdepends="ncurses gzip" checkdepends="ncurses gzip"
conflicts="chroot-texinfo>=0"
depends="gzip perl" depends="gzip perl"
short_desc="The GNU Documentation System" short_desc="The GNU Documentation System"
maintainer="Enno Boland <gottox@voidlinux.org>" maintainer="Enno Boland <gottox@voidlinux.org>"
@ -16,7 +15,6 @@ homepage="http://www.gnu.org/software/texinfo/"
distfiles="${GNU_SITE}/$pkgname/$pkgname-$version.tar.xz" distfiles="${GNU_SITE}/$pkgname/$pkgname-$version.tar.xz"
checksum=77774b3f4a06c20705cc2ef1c804864422e3cf95235e965b1f00a46df7da5f62 checksum=77774b3f4a06c20705cc2ef1c804864422e3cf95235e965b1f00a46df7da5f62
post_install() { post_install() {
rm -f ${DESTDIR}/usr/share/info/dir rm -f ${DESTDIR}/usr/share/info/dir
# Compress manually info files. # Compress manually info files.

107
xbps-src
View file

@ -269,69 +269,10 @@ check_native_arch() {
fi fi
} }
install_bbootstrap() {
[ "$CHROOT_READY" ] && return
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 "Installing bootstrap from binary package repositories...\n"
# XBPS_TARGET_PKG == arch
if [ "$XBPS_TARGET_PKG" ]; then
_bootstrap_arch="env XBPS_TARGET_ARCH=$XBPS_TARGET_PKG"
if [ "${XBPS_TARGET_PKG}" != "${XBPS_TARGET_PKG#*-}" ]; then
_subarch="-${XBPS_TARGET_PKG#*-}"
fi
fi
mkdir -p $XBPS_MASTERDIR/var/db/xbps/keys
cd $XBPS_MASTERDIR
cp -f $XBPS_COMMONDIR/repo-keys/*.plist $XBPS_MASTERDIR/var/db/xbps/keys
${_bootstrap_arch} $XBPS_INSTALL_CMD ${XBPS_INSTALL_ARGS:+-S $XBPS_INSTALL_ARGS} -y base-chroot${_subarch}
if [ $? -ne 0 ]; then
msg_error "Failed to install bootstrap packages!\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 "Installed bootstrap successfully!\n"
chroot_prepare $XBPS_TARGET_PKG || msg_error "Failed to initialize chroot!\n"
chroot_check
chroot_handler clean
}
reconfigure_bootstrap_pkgs() {
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 "Reconfiguring bootstrap packages...\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
}
bootstrap_update() {
[ -z "$CHROOT_READY" ] && return
remove_pkg_autodeps
msg_normal "xbps-src: cleaning up masterdir...\n"
rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
msg_normal "xbps-src: updating $XBPS_MASTERDIR ...\n"
${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -Syu
return $?
}
masterdir_zap() { masterdir_zap() {
rm -rf "$XBPS_MASTERDIR" rm -rf "$XBPS_MASTERDIR"
mkdir -p "$XBPS_MASTERDIR" mkdir -p "$XBPS_MASTERDIR"
msg_normal "$XBPS_MASTERDIR masterdir cleaned up.\n" msg_normal "xbps-src: $XBPS_MASTERDIR masterdir cleaned up.\n"
} }
exit_func() { exit_func() {
@ -347,7 +288,7 @@ exit_func() {
read_pkg() { read_pkg() {
if [ -z "${XBPS_TARGET_PKG}" ]; then if [ -z "${XBPS_TARGET_PKG}" ]; then
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n" [ ! -r ./template ] && msg_error "xbps-src: missing build template in $(pwd).\n"
XBPS_TARGET_PKG=${PWD##*/} XBPS_TARGET_PKG=${PWD##*/}
fi fi
setup_pkg "$XBPS_TARGET_PKG" "$XBPS_CROSS_BUILD" "$1" setup_pkg "$XBPS_TARGET_PKG" "$XBPS_CROSS_BUILD" "$1"
@ -368,13 +309,13 @@ setup_distfiles_mirror() {
[ "$scheme" != "file" ] && continue [ "$scheme" != "file" ] && continue
if [ "$XBPS_CHROOT_CMD" == "uchroot" -o "$XBPS_CHROOT_CMD" == "proot" ]; then if [ "$XBPS_CHROOT_CMD" == "uchroot" -o "$XBPS_CHROOT_CMD" == "proot" ]; then
if [ ! -d "$path" ]; then if [ ! -d "$path" ]; then
msg_warn "Invalid path in XBPS_DISTFILES_MIRROR ($mirror)\n" msg_warn "xbps-src: Invalid path in XBPS_DISTFILES_MIRROR ($mirror)\n"
continue continue
fi fi
mkdir -p "$XBPS_MASTERDIR/$path" mkdir -p "$XBPS_MASTERDIR/$path"
XBPS_CHROOT_CMD_ARGS+=" -b $path:$path" XBPS_CHROOT_CMD_ARGS+=" -b $path:$path"
else else
msg_warn "File URLs ($mirror) don't work with '$XBPS_CHROOT_CMD'\n" msg_warn "xbps-src: File URLs ($mirror) don't work with '$XBPS_CHROOT_CMD'\n"
fi fi
done done
} }
@ -537,20 +478,20 @@ readonly XBPS_BUILDHELPERDIR=$XBPS_COMMONDIR/build-helper
if [ "$IN_CHROOT" ]; then if [ "$IN_CHROOT" ]; then
readonly XBPS_UHELPER_CMD="xbps-uhelper" readonly XBPS_UHELPER_CMD="xbps-uhelper"
readonly XBPS_INSTALL_CMD="xbps-install --repository=$XBPS_REPOSITORY" readonly XBPS_INSTALL_CMD="xbps-install -c /host/repocache"
readonly XBPS_QUERY_CMD="xbps-query --repository=$XBPS_REPOSITORY" readonly XBPS_QUERY_CMD="xbps-query -c /host/repocache"
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure" readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure"
readonly XBPS_REMOVE_CMD="xbps-remove" readonly XBPS_REMOVE_CMD="xbps-remove"
readonly XBPS_CHECKVERS_CMD="xbps-checkvers --repository=$XBPS_REPOSITORY" readonly XBPS_CHECKVERS_CMD="xbps-checkvers"
readonly XBPS_DESTDIR=/destdir readonly XBPS_DESTDIR=/destdir
readonly XBPS_BUILDDIR=/builddir readonly XBPS_BUILDDIR=/builddir
else else
readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR" readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR"
readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR" readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache -r $XBPS_MASTERDIR"
readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache --repository=$XBPS_REPOSITORY -r $XBPS_MASTERDIR" readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache -r $XBPS_MASTERDIR"
readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR" readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR"
readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR" readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR"
readonly XBPS_CHECKVERS_CMD="xbps-checkvers --repository=$XBPS_REPOSITORY" readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_MASTERDIR"
readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir readonly XBPS_DESTDIR=$XBPS_MASTERDIR/destdir
readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir readonly XBPS_BUILDDIR=$XBPS_MASTERDIR/builddir
fi fi
@ -687,46 +628,39 @@ for f in ${XBPS_SHUTILSDIR}/*.sh; do
[ -r "$f" ] && . $f [ -r "$f" ] && . $f
done done
reconfigure_bootstrap_pkgs reconfigure_base_chroot
# #
# Main switch. # Main switch.
# #
case "$XBPS_TARGET" in case "$XBPS_TARGET" in
binary-bootstrap) binary-bootstrap)
install_bbootstrap ${XBPS_TARGET_PKG:=$XBPS_MACHINE} install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
;; ;;
bootstrap) bootstrap)
# bootstrap from sources # base-chroot building on host
# check for required host utils # check for required host utils
check_reqhost_utils bootstrap check_reqhost_utils bootstrap
[[ $XBPS_MACHINE =~ musl ]] && subarch="-musl"
[ ! -d $XBPS_SRCPKGDIR/base-chroot${subarch} ] && \
msg_error "Cannot find $XBPS_SRCPKGDIR/base-chroot${subarch} directory!\n"
bootstrap_vpkg=${XBPS_MASTERDIR}/etc/xbps.d/bootstrap-vpkgs.conf
mkdir -p ${XBPS_MASTERDIR}/etc/xbps.d
if [ ! -s ${bootstrap_vpkg} ]; then
# Fool xbps to resolve dependencies.
echo 'virtualpkg=libgcc:base-files' >> ${bootstrap_vpkg}
echo 'virtualpkg=libstdc++:base-files' >> ${bootstrap_vpkg}
fi
( (
export XBPS_ARCH=$XBPS_MACHINE export XBPS_ARCH=$XBPS_MACHINE
export XBPS_SKIP_REMOTEREPOS=1 export XBPS_SKIP_REMOTEREPOS=1
chroot_sync_repodata
$XBPS_LIBEXECDIR/build.sh \ $XBPS_LIBEXECDIR/build.sh \
base-chroot${subarch} base-chroot${subarch} $XBPS_TARGET || exit 1 base-chroot base-chroot $XBPS_TARGET || exit 1
) || exit 1 ) || exit 1
[ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR [ -d $XBPS_MASTERDIR ] && rm -rf $XBPS_MASTERDIR
install_bbootstrap ${XBPS_TARGET_PKG:=$XBPS_MACHINE} install_base_chroot ${XBPS_TARGET_PKG:=$XBPS_MACHINE}
;; ;;
bootstrap-update) bootstrap-update)
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
chroot_handler bootstrap-update chroot_handler bootstrap-update
else else
bootstrap_update chroot_sync_repodata
update_base_chroot
fi fi
;; ;;
chroot) chroot)
chroot_sync_repodata
chroot_handler chroot dummy chroot_handler chroot dummy
;; ;;
clean) clean)
@ -777,7 +711,8 @@ case "$XBPS_TARGET" in
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG
else else
[ -z "$XBPS_KEEP_ALL" -a -z "$XBPS_SKIP_DEPS" ] && remove_pkg_autodeps chroot_sync_repodata
update_base_chroot
$XBPS_LIBEXECDIR/build.sh $XBPS_TARGET_PKG $XBPS_TARGET_PKG \ $XBPS_LIBEXECDIR/build.sh $XBPS_TARGET_PKG $XBPS_TARGET_PKG \
$XBPS_TARGET $XBPS_CROSS_BUILD || exit $? $XBPS_TARGET $XBPS_CROSS_BUILD || exit $?
fi fi