1
0
Fork 0
mirror of https://github.com/xHyroM/void-packages.git synced 2024-12-23 12:41:05 +01:00
void-packages/common/hooks/pre-pkg/05-generate-32bit-runtime-deps.sh

88 lines
2.7 KiB
Bash
Raw Normal View History

2024-03-29 08:12:19 +01:00
hook() {
local destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
# By default always enabled unless "lib32disabled" is set.
if [ -n "$lib32disabled" ]; then
return
fi
# This hook will only work when building for x86.
if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
return
fi
if [ ! -d ${destdir32} ]; then
return
fi
# If the rdeps file exist (runtime deps), copy and then modify it for
# 32bit dependencies.
trap - ERR
: > ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
2024-03-29 08:12:19 +01:00
if [ -s "${XBPS_STATEDIR}/${pkgname}-rdeps" ]; then
2024-03-29 08:12:19 +01:00
if [ -n "$lib32depends" ]; then
_deps="${lib32depends}"
else
_deps="$(<${XBPS_STATEDIR}/${pkgname}-rdeps)"
2024-03-29 08:12:19 +01:00
fi
for f in ${_deps}; do
unset found pkgn pkgv _shprovides
pkgn="$($XBPS_UHELPER_CMD getpkgdepname $f)"
if [ -z "${pkgn}" ]; then
pkgn="$($XBPS_UHELPER_CMD getpkgname $f)"
if [ -z "${pkgn}" ]; then
msg_error "$pkgver: invalid dependency $f\n"
fi
pkgv="-$($XBPS_UHELPER_CMD getpkgversion ${f})"
else
pkgv="$($XBPS_UHELPER_CMD getpkgdepversion ${f})"
fi
# If dependency is a development pkg switch it to 32bit.
if [[ $pkgn == *-devel ]]; then
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (development)"
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
2024-03-29 08:12:19 +01:00
continue
fi
# If dependency does not have "shlib-provides" do not
# change it to 32bit.
for x in ${subpackages}; do
if [ "$x" = "$pkgn" ]; then
found=1
break
fi
done
if [ -z "$found" ]; then
# Dependency is not a subpkg, check shlib-provides
# via binpkgs.
_shprovides="$($XBPS_QUERY_CMD -R --property=shlib-provides "$pkgn")"
if [ -n "${_shprovides}" ]; then
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (shlib-provides)"
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
2024-03-29 08:12:19 +01:00
else
echo " RDEP: $f -> ${pkgn}${pkgv} (no shlib-provides)"
printf "${pkgn}${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
2024-03-29 08:12:19 +01:00
fi
else
if [ -s "${XBPS_STATEDIR}/${pkgn}-shlib-provides" ]; then
2024-03-29 08:12:19 +01:00
# Dependency is a subpkg; check if it provides any shlib
# and convert to 32bit if true.
echo " RDEP: $f -> ${pkgn}-32bit${pkgv} (subpkg, shlib-provides)"
printf "${pkgn}-32bit${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
2024-03-29 08:12:19 +01:00
else
echo " RDEP: $f -> ${pkgn}${pkgv} (subpkg, no shlib-provides)"
printf "${pkgn}${pkgv} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
2024-03-29 08:12:19 +01:00
fi
fi
done
fi
# If it's a development pkg add a dependency to the 64bit pkg.
if [[ $pkgn == *-devel ]]; then
echo " RDEP: ${pkgver}"
printf "${pkgver} " >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
2024-03-29 08:12:19 +01:00
fi
printf "\n" >> ${XBPS_STATEDIR}/${pkgname}-32bit-rdeps
2024-03-29 08:12:19 +01:00
}