07c1a647d4
- Removed prehistoric multilib support.
108 lines
3.3 KiB
Bash
Executable File
108 lines
3.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
DESTDIR="${DESTDIR:-/}"
|
|
pkglibdir="${pkglibdir:-/usr/lib/rpm}"
|
|
|
|
RPMRC="${1:-rpmrc}"
|
|
MACROS="${2:-macros}"
|
|
PLATFORM="${3:-platform}"
|
|
|
|
if grep /share/ $PLATFORM > /dev/null 2>&1 ; then
|
|
DEFAULTDOCDIR='%{_usr}/share/doc'
|
|
else
|
|
DEFAULTDOCDIR='%{_usr}/doc'
|
|
fi
|
|
|
|
#TEMPRC="/tmp/rpmrc.$$"
|
|
#cat << E_O_F > $TEMPRC
|
|
#include: $RPMRC
|
|
#macrofiles: $MACROS
|
|
#E_O_F
|
|
#
|
|
#RPM="./rpm --rcfile $TEMPRC"
|
|
RPM=rpm
|
|
|
|
arch="`$RPM --eval '%{_target_cpu}'`"
|
|
VENDOR="`$RPM --eval '%{_vendor}'`"
|
|
OS="`$RPM --eval '%{_os}'`"
|
|
RPMRC_GNU="`$RPM --eval '%{_gnu}'`"
|
|
target_platform="`$RPM --eval '%{?_gnu:%undefine _gnu}%{_target_platform}'`"
|
|
target="`$RPM --eval '%{_target}'`"
|
|
|
|
case "$arch" in
|
|
i[3456]86|k6|athlon|athlon_xp|pentium[234])
|
|
SUBSTS='s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),i386, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),i486, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),i586, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),i686, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),k6, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),athlon, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),athlon_xp, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),pentium2, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),pentium3, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),pentium4, s,\(i[3456]86\|k6\|athlon_xp\|athlon\|pentium[234]\),noarch,'
|
|
;;
|
|
alpha*)
|
|
SUBSTS='s,alpha,alpha, s,alpha,alphaev5, s,alpha,alphaev56, s,alpha,alphapca56, s,alpha,alphaev6, s,alpha,alphaev67,'
|
|
;;
|
|
arm*)
|
|
SUBSTS='s,arm.*,arm, s,arm.*,armeb, s,arm.*,armv3l, s,arm.*,armv4l, s,arm.*,armv4b, s,arm.*,armv5l, s,arm.*,armv5tel, s,arm.*,armv5tejl, s,arm.*,armv5b, s,arm.*,noarch,'
|
|
;;
|
|
sparc*)
|
|
SUBSTS='s,sparc\(64\|v9\),sparc, s,sparc64,sparcv9,;s,sparc\([^v]\|$\),sparcv9\1, s,sparcv9,sparc64,;s,sparc\([^6]\|$\),sparc64\1,'
|
|
;;
|
|
powerpc*|ppc*)
|
|
SUBSTS='s,ppc64,ppc, s,ppc\([^6]\|$\),ppc64\1,'
|
|
;;
|
|
x86_64)
|
|
SUBSTS='s,x86_64,x86_64, s,x86_64,noarch,'
|
|
;;
|
|
*)
|
|
SUBSTS='y___'
|
|
;;
|
|
esac
|
|
base_arch=`echo $arch | sed -e 's_i?86_i386_;s_sparc.*_sparc_;s_alpha.*_alpha_;s_\(powerpc\|ppc\).*_ppc_;s,amd64,x86_64,'`
|
|
|
|
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
|
|
|
|
PPD="${DESTDIR}/${pkglibdir}/${ARCH}-${VENDOR}-${OS}"
|
|
|
|
[ -d $PPD ] || mkdir $PPD
|
|
|
|
RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
|
|
RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
|
|
|
|
ARCH_INSTALL_POST='%{nil}'
|
|
case "${ARCH}-${OS}" in
|
|
sparc64-linux) LIB=lib64 ;;
|
|
x86_64-linux) LIB=lib64 ;;
|
|
esac
|
|
|
|
case $VENDOR in
|
|
alt)
|
|
VENDORSED='-e s,^@alt@,,'
|
|
;;
|
|
pld)
|
|
VENDORSED='-e s,^@pld@,,'
|
|
;;
|
|
mandrake)
|
|
VENDORSED='-e s,^@mandrake@,,'
|
|
RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e s/i386/i686/`"
|
|
;;
|
|
conectiva)
|
|
VENDORSED='-e s,^@conectiva@,,'
|
|
;;
|
|
redhat)
|
|
VENDORSED='-e s,^@redhat@,,'
|
|
;;
|
|
esac
|
|
|
|
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,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \
|
|
-e "s,@DEFAULTDOCDIR@,$DEFAULTDOCDIR," \
|
|
$VENDORSED \
|
|
| grep -v '^@' \
|
|
> ${PPD}/macros
|
|
done
|
|
|
|
#rm $TEMPRC
|