Introduce %_libsuff and %_is_libsuff macros

Previously one who wanted to use only suffix from %_lib macro (without
'lib' prefix) had to either strip it with shell or try to guess it
from %_lib macro.
New macros allow to simplify library suffix logics in spec files:
* %_libsuff is always defined (to %nil on targets where %_lib = lib);
* %_is_libsuff is defined only on those targets where suffix
is not empty (it is useful for %{?...} expressions).
This commit is contained in:
Gleb Fotengauer-Malinovskiy 2017-11-17 17:44:24 +03:00
parent 62acbd59d6
commit 0ca04d42f3
2 changed files with 14 additions and 8 deletions

View File

@ -67,7 +67,7 @@ for SUBST in $SUBSTS ; do
ARCH=`echo $arch | sed -e $SUBST`
TARGET_PLATFORM=`echo $target_platform | sed -e $SUBST`
TARGET=`echo $target | sed -e $SUBST`
LIB=lib
LIBSUFF='%nil'
PPD="${DESTDIR}/${pkglibdir}/${ARCH}-${VENDOR}-${OS}"
@ -78,10 +78,10 @@ for SUBST in $SUBSTS ; do
ARCH_INSTALL_POST='%{nil}'
case "${ARCH}-${OS}" in
aarch64-linux) LIB=lib64 ;;
sparc64-linux) LIB=lib64 ;;
x86_64-linux) LIB=lib64 ;;
e2k*-linux) LIB=lib64 ;;
aarch64-linux) LIBSUFF=64 ;;
sparc64-linux) LIBSUFF=64 ;;
x86_64-linux) LIBSUFF=64 ;;
e2k*-linux) LIBSUFF=64 ;;
esac
case $VENDOR in
@ -103,11 +103,15 @@ for SUBST in $SUBSTS ; do
;;
esac
LIBSUFF_EXISTS=@
[ "$LIBSUFF" = '%nil' ] || LIBSUFF_EXISTS=
cat $PLATFORM \
| sed -e "s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS," \
-e "s,@RPMRC_ARCH@,$ARCH," \
-e "s,@RPMRC_GNU@,$RPMRC_GNU," \
-e "s,@LIB@,$LIB," \
-e "s,@LIBSUFF@,$LIBSUFF," \
-e "s,@LIBSUFF_EXISTS@,$LIBSUFF_EXISTS," \
-e "s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \
-e "s,@DEFAULTDOCDIR@,$DEFAULTDOCDIR," \
$VENDORSED \

View File

@ -23,8 +23,10 @@
%_sysconfdir @sysconfdir@
%_sharedstatedir %{_var}/lib
%_localstatedir @localstatedir@
%_lib @LIB@
%_libdir @prefix@/@LIB@
%_libsuff @LIBSUFF@
@LIBSUFF_EXISTS@%_is_libsuff 1
%_lib lib@LIBSUFF@
%_libdir @prefix@/lib@LIBSUFF@
%_includedir @includedir@
%_oldincludedir @oldincludedir@
%_infodir @infodir@