3 DESTDIR="${DESTDIR:-/}"
4 pkglibdir="${pkglibdir:-/usr/lib/rpm}"
8 PLATFORM="${3:-platform}"
10 TEMPRC="/tmp/rpmrc.$$"
11 cat << E_O_F > $TEMPRC
16 RPM="./rpm --rcfile $TEMPRC"
18 arch="`$RPM --eval '%{_arch}'`"
19 VENDOR="`$RPM --eval '%{_vendor}'`"
20 OS="`$RPM --eval '%{_os}'`"
21 target_platform="`$RPM --eval '%{_target_platform}'`"
22 target="`$RPM --eval '%{_target}'`"
25 i[3456]86) SUBSTS='s_i386_i386_ s_i386_i486_ s_i386_i586_ s_i386_i686_' ;;
26 sparc*) SUBSTS='s_sparc64_sparc_ s_sparc\([^6]\)_sparc64\1_' ;;
30 for SUBST in $SUBSTS 's_^[^-]*-_noarch-_' ; do
31 ARCH=`echo $arch | sed -e $SUBST`
32 TARGET_PLATFORM=`echo $target_platform | sed -e $SUBST`
33 TARGET=`echo $target | sed -e $SUBST`
36 PPD="${DESTDIR}/${pkglibdir}/${ARCH}-${VENDOR}-${OS}"
38 [ -d $PPD ] || mkdir $PPD
40 RPMRC_OPTFLAGS="`$RPM --eval '%{optflags}'`"
41 RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
43 ARCH_INSTALL_POST='%{nil}'
44 case "${ARCH}-${OS}" in
45 sparc64-linux) ARCH_INSTALL_POST=${pkglibdir}/brp-sparc64-linux; LIB=lib64 ;;
49 sed -e "s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS," \
50 -e "s,@RPMRC_ARCH@,$ARCH," \
52 -e "s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \
57 # Better try to create these too until the smoke clears. Yuck.
58 [ "${ARCH}-${VENDOR}-${OS}" = "${TARGET}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET}
59 [ "${ARCH}-${VENDOR}-${OS}" = "${TARGET_PLATFORM}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET_PLATFORM}