2014-09-05 09:10:07 +00:00
|
|
|
# vim: set ts=4 sw=4 et:
|
|
|
|
|
|
|
|
remove_pkg_cross_deps() {
|
2019-10-21 18:58:31 +00:00
|
|
|
local rval= tmplogf= prevs=0
|
2014-09-05 09:10:07 +00:00
|
|
|
[ -z "$XBPS_CROSS_BUILD" ] && return 0
|
|
|
|
|
|
|
|
cd $XBPS_MASTERDIR || return 1
|
|
|
|
msg_normal "${pkgver:-xbps-src}: removing autocrossdeps, please wait...\n"
|
2019-06-17 15:38:07 +00:00
|
|
|
tmplogf=$(mktemp) || exit 1
|
2014-09-05 09:10:07 +00:00
|
|
|
|
|
|
|
if [ -z "$XBPS_REMOVE_XCMD" ]; then
|
|
|
|
source_file $XBPS_CROSSPFDIR/${XBPS_CROSS_BUILD}.sh
|
2016-04-27 14:47:05 +00:00
|
|
|
XBPS_REMOVE_XCMD="env XBPS_TARGET_ARCH=$XBPS_TARGET_MACHINE xbps-remove -r /usr/$XBPS_CROSS_TRIPLET"
|
2014-09-05 09:10:07 +00:00
|
|
|
fi
|
|
|
|
|
2014-09-24 17:51:17 +00:00
|
|
|
$XBPS_REMOVE_XCMD -Ryo > $tmplogf 2>&1
|
2019-10-21 18:58:31 +00:00
|
|
|
rval=$?
|
|
|
|
while [ $rval -eq 0 ]; do
|
|
|
|
local curs=$(stat -c %s $tmplogf)
|
|
|
|
if [ $curs -eq $prevs ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
prevs=$curs
|
|
|
|
$XBPS_REMOVE_XCMD -Ryo >> $tmplogf 2>&1
|
|
|
|
rval=$?
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $rval -ne 0 ]; then
|
2014-09-05 09:10:07 +00:00
|
|
|
msg_red "${pkgver:-xbps-src}: failed to remove autocrossdeps:\n"
|
|
|
|
cat $tmplogf && rm -f $tmplogf
|
|
|
|
msg_error "${pkgver:-xbps-src}: cannot continue!\n"
|
|
|
|
fi
|
|
|
|
rm -f $tmplogf
|
|
|
|
}
|
|
|
|
|
2015-03-23 11:42:35 +00:00
|
|
|
prepare_cross_sysroot() {
|
|
|
|
local cross="$1"
|
2019-07-10 17:48:54 +00:00
|
|
|
local statefile="$XBPS_MASTERDIR/.xbps-${cross}-done"
|
2015-03-23 11:42:35 +00:00
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
[ -z "$cross" -o "$cross" = "" -o -f $statefile ] && return 0
|
2015-03-23 11:42:35 +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
|
|
|
# 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 $?
|
2015-03-23 11:42:35 +00:00
|
|
|
fi
|
|
|
|
|
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
|
|
|
# Check if cross-vpkg-dummy is installed.
|
2019-06-13 17:29:23 +00:00
|
|
|
check_installed_pkg cross-vpkg-dummy-0.30_1 $cross
|
2015-04-14 08:42:47 +00:00
|
|
|
[ $? -eq 0 ] && return 0
|
|
|
|
|
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
|
|
|
# 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 bootstrap pkg $cross init || return $?
|
|
|
|
fi
|
|
|
|
|
2015-03-23 11:42:35 +00:00
|
|
|
msg_normal "Installing $cross cross pkg: cross-vpkg-dummy ...\n"
|
2019-06-17 15:38:07 +00:00
|
|
|
errlog=$(mktemp) || exit 1
|
2015-04-14 09:01:11 +00:00
|
|
|
$XBPS_INSTALL_XCMD -Syfd cross-vpkg-dummy &>$errlog
|
2015-03-23 11:42:35 +00:00
|
|
|
rval=$?
|
2019-07-10 17:48:54 +00:00
|
|
|
if [ $rval -ne 0 ]; then
|
2015-03-23 11:42:35 +00:00
|
|
|
msg_red "failed to install cross-vpkg-dummy (error $rval)\n"
|
|
|
|
cat $errlog
|
|
|
|
rm -f $errlog
|
|
|
|
msg_error "cannot continue due to errors above\n"
|
|
|
|
fi
|
|
|
|
rm -f $errlog
|
2015-04-15 10:23:07 +00:00
|
|
|
# Create top level symlinks in sysroot.
|
2019-07-10 17:48:54 +00:00
|
|
|
XBPS_ARCH=$XBPS_TARGET_MACHINE xbps-reconfigure -r $XBPS_CROSS_BASE -f base-files &>/dev/null
|
2016-01-20 18:38:04 +00:00
|
|
|
# Create a sysroot/include and sysroot/lib symlink just in case.
|
2015-05-01 10:34:17 +00:00
|
|
|
ln -s usr/include ${XBPS_CROSS_BASE}/include
|
2016-01-20 18:38:04 +00:00
|
|
|
ln -s usr/lib ${XBPS_CROSS_BASE}/lib
|
2015-03-23 11:42:35 +00:00
|
|
|
|
2019-07-10 17:48:54 +00:00
|
|
|
touch -f $statefile
|
|
|
|
|
2015-03-23 11:42:35 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2014-09-05 09:10:07 +00:00
|
|
|
install_cross_pkg() {
|
|
|
|
local cross="$1" rval errlog
|
|
|
|
|
|
|
|
[ -z "$cross" -o "$cross" = "" ] && return 0
|
|
|
|
|
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
|
|
|
# Check if installed.
|
|
|
|
check_installed_pkg cross-${XBPS_CROSS_TRIPLET}-0.1_1
|
|
|
|
[ $? -eq 0 ] && return 0
|
|
|
|
|
2015-03-23 11:42:35 +00:00
|
|
|
# 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
|
2019-11-03 15:34:47 +00:00
|
|
|
$XBPS_LIBEXECDIR/build.sh cross-${XBPS_CROSS_TRIPLET} cross-${XBPS_CROSS_TRIPLET} pkg || return $?
|
2014-09-05 09:10:07 +00:00
|
|
|
fi
|
|
|
|
|
2019-06-17 15:38:07 +00:00
|
|
|
errlog=$(mktemp) || exit 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
|
|
|
msg_normal "xbps-src: installing cross compiler: cross-${XBPS_CROSS_TRIPLET} ...\n"
|
2015-04-14 08:47:25 +00:00
|
|
|
$XBPS_INSTALL_CMD -Syfd cross-${XBPS_CROSS_TRIPLET} &>$errlog
|
2015-03-23 11:42:35 +00:00
|
|
|
rval=$?
|
|
|
|
if [ $rval -ne 0 -a $rval -ne 17 ]; then
|
|
|
|
msg_red "failed to install cross-${XBPS_CROSS_TRIPLET} (error $rval)\n"
|
|
|
|
cat $errlog
|
|
|
|
rm -f $errlog
|
|
|
|
msg_error "cannot continue due to errors above\n"
|
2014-09-05 09:10:07 +00:00
|
|
|
fi
|
2015-03-23 11:42:35 +00:00
|
|
|
rm -f $errlog
|
|
|
|
|
|
|
|
return 0
|
2014-09-05 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
remove_cross_pkg() {
|
|
|
|
local cross="$1" rval
|
|
|
|
|
|
|
|
[ -z "$cross" -o "$cross" = "" ] && return 0
|
|
|
|
|
|
|
|
source_file ${XBPS_CROSSPFDIR}/${cross}.sh
|
|
|
|
|
|
|
|
if [ -z "$CHROOT_READY" ]; then
|
|
|
|
echo "ERROR: chroot mode not activated (install a bootstrap)."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$IN_CHROOT" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
msg_normal "Removing cross pkg: cross-${XBPS_CROSS_TRIPLET} ...\n"
|
|
|
|
$XBPS_REMOVE_CMD -Ry cross-${XBPS_CROSS_TRIPLET} &>/dev/null
|
|
|
|
rval=$?
|
|
|
|
if [ $rval -ne 0 ]; then
|
|
|
|
msg_error "failed to remove cross-${XBPS_CROSS_TRIPLET} (error $rval)\n"
|
|
|
|
fi
|
|
|
|
}
|