3 DESTDIR="${DESTDIR:-/}"
4 pkglibdir="${pkglibdir:-/usr/lib/rpm}"
8 PLATFORM="${3:-platform}"
10 if grep /share/ $PLATFORM > /dev/null 2>&1 ; then
11 DEFAULTDOCDIR='%{_prefix}/share/doc'
13 DEFAULTDOCDIR='%{_prefix}/doc'
16 TEMPRC="/tmp/rpmrc.$$"
17 cat << E_O_F > $TEMPRC
22 RPM="./rpm --rcfile $TEMPRC"
24 arch="`$RPM --eval '%{_arch}'`"
25 VENDOR="`$RPM --eval '%{_vendor}'`"
26 OS="`$RPM --eval '%{_os}'`"
27 target_platform="`$RPM --eval '%{_target_platform}'`"
28 target="`$RPM --eval '%{_target}'`"
30 ln -sf ${arch}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/noarch-${VENDOR}-${OS}
31 ln -sf ${arch}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/noarch-${OS}
34 i[3456]86) SUBSTS='s_i386_i386_ s_i386_i486_ s_i386_i586_ s_i386_i686_' ;;
35 sparc*) SUBSTS='s_sparc\(64\|v9\)_sparc_ s_sparc64_sparcv9_;s_sparc\([^v]\|$\)_sparcv9\1_ s_sparcv9_sparc64_;s_sparc\([^6]\|$\)_sparc64\1_' ;;
38 base_arch=`echo $arch | sed -e 's_i?86_i386_;s_sparc.*_sparc_'`
40 for SUBST in $SUBSTS ; do
41 ARCH=`echo $arch | sed -e $SUBST`
42 TARGET_PLATFORM=`echo $target_platform | sed -e $SUBST`
43 TARGET=`echo $target | sed -e $SUBST`
46 PPD="${DESTDIR}/${pkglibdir}/${ARCH}-${VENDOR}-${OS}"
48 [ -d $PPD ] || mkdir $PPD
50 # RPMRC_OPTFLAGS="`$RPM --target $TARGET --eval '%{optflags}'`"
51 RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
52 RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
54 ARCH_INSTALL_POST='%{nil}'
55 case "${ARCH}-${OS}" in
56 sparc64-linux) ARCH_INSTALL_POST=${pkglibdir}/brp-sparc64-linux; LIB=lib64 ;;
60 sed -e "s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS," \
61 -e "s,@RPMRC_ARCH@,$base_arch," \
63 -e "s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \
64 -e "s,@DEFAULTDOCDIR@,$DEFAULTDOCDIR," \
69 # Better try to create these too until the smoke clears. Yuck.
70 [ "${ARCH}-${VENDOR}-${OS}" = "${TARGET}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET}
71 [ "${ARCH}-${VENDOR}-${OS}" = "${TARGET_PLATFORM}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET_PLATFORM}