hooks/prepare-32bit: new variables to improve 32bit pkg creation.
- lib32depends: if set, 32bit pkg will use this rather than "depends". - lib32disabled: if set, no 32bit pkg will be created. - lib32mode: * if unset only files for libraries will be copied. * if set to "full" all files will be copied Still not perfect but should be enough to have skype-32bit.
This commit is contained in:
parent
9b369ced1e
commit
e9e8c638a8
|
@ -1,14 +1,21 @@
|
|||
# This hook creates a new PKGDESTDIR with 32bit libraries for x86_64.
|
||||
# This hook creates a new PKGDESTDIR with 32bit files for x86_64.
|
||||
#
|
||||
# Variables that can be used in templates:
|
||||
# - lib32depends: if set, 32bit pkg will use this rather than "depends".
|
||||
# - lib32disabled: if set, no 32bit pkg will be created.
|
||||
# - lib32mode:
|
||||
# * if unset only files for libraries will be copied.
|
||||
# * if set to "full" all files will be copied.
|
||||
#
|
||||
# XXX remaining issues:
|
||||
# - due to ${pkgname} -> ${pkgname}32 renaming, some pkgs have wrong deps
|
||||
# (noarch pkgs, development pkgs, etc).
|
||||
# - wrong dependencies in some cases.
|
||||
# - no way to specify additional files.
|
||||
|
||||
hook() {
|
||||
local destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
|
||||
|
||||
# By default always enabled unless "lib32_disabled" is set.
|
||||
if [ -n "$lib32_disabled" ]; then
|
||||
# By default always enabled unless "lib32disabled" is set.
|
||||
if [ -n "$lib32disabled" ]; then
|
||||
return
|
||||
fi
|
||||
# This hook will only work when building for x86.
|
||||
|
@ -19,6 +26,9 @@ hook() {
|
|||
if [ -n "$noarch" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -z "$lib32mode" ]; then
|
||||
# Library mode, copy only relevant files to new destdir.
|
||||
#
|
||||
# If /usr/lib does not exist don't continue...
|
||||
if [ ! -d ${PKGDESTDIR}/usr/lib ]; then
|
||||
return
|
||||
|
@ -44,16 +54,20 @@ hook() {
|
|||
rmdir --ignore-fail-on-non-empty -p "$f" &>/dev/null
|
||||
done
|
||||
|
||||
if [ ! -d ${destdir32} ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Switch pkg-config files to lib32.
|
||||
if [ -d ${destdir32}/usr/lib32/pkgconfig ]; then
|
||||
sed -e 's,/usr/lib,/usr/lib32,g' \
|
||||
-e 's,${exec_prefix}/lib,${exec_prefix}/lib32,g' \
|
||||
-i ${destdir32}/usr/lib32/pkgconfig/*.pc
|
||||
fi
|
||||
elif [ "$lib32mode" = "full" ]; then
|
||||
# Full 32bit mode; copy everything to new destdir.
|
||||
mkdir -p ${destdir32}
|
||||
cp -a ${PKGDESTDIR}/* ${destdir32}/
|
||||
fi
|
||||
if [ ! -d ${destdir32} ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the rdeps file exist (runtime deps), copy and then modify it for
|
||||
# 32bit dependencies.
|
||||
|
@ -62,7 +76,14 @@ hook() {
|
|||
: > ${destdir32}/rdeps
|
||||
|
||||
if [ -s "$PKGDESTDIR/rdeps" ]; then
|
||||
for f in $(cat ${PKGDESTDIR}/rdeps); do
|
||||
if [ -n "$lib32depends" ]; then
|
||||
_deps="${lib32depends}"
|
||||
else
|
||||
_deps="$(cat ${PKGDESTDIR}/rdeps)"
|
||||
fi
|
||||
for f in ${_deps}; do
|
||||
unset pkgn pkgv _noarch _hasdevel
|
||||
|
||||
pkgn="$($XBPS_UHELPER_CMD getpkgdepname $f)"
|
||||
if [ -z "${pkgn}" ]; then
|
||||
pkgn="$($XBPS_UHELPER_CMD getpkgname $f)"
|
||||
|
@ -73,6 +94,12 @@ hook() {
|
|||
else
|
||||
pkgv="$($XBPS_UHELPER_CMD getpkgdepversion ${f})"
|
||||
fi
|
||||
# If dependency is noarch do not change it to 32bit.
|
||||
_noarch=$($XBPS_QUERY_CMD -R --property=architecture "$f")
|
||||
if [ "${_noarch}" = "noarch" ]; then
|
||||
printf "${pkgn}${pkgv} " >> ${destdir32}/rdeps
|
||||
continue
|
||||
fi
|
||||
printf "${pkgn}-32bit${pkgv} " >> $destdir32/rdeps
|
||||
done
|
||||
fi
|
||||
|
@ -82,4 +109,6 @@ hook() {
|
|||
printf "${pkgver} " >> ${destdir32}/rdeps
|
||||
fi
|
||||
printf "\n" >> ${destdir32}/rdeps
|
||||
|
||||
unset lib32depends lib32disabled lib32mode
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue