diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-12 15:17:20 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-12 15:17:20 +0900 |
commit | 7df2385c2f6c93f96e00bc87f2086066cae89ecc (patch) | |
tree | 79d5c20a494622eb084de831a2a51530cd421e33 /installplatform | |
parent | b7a3bffb8e0341b7e4ef69def268bca3a7f279ff (diff) | |
download | rpm-submit/tizen_2.2/20130710.072219.tar.gz rpm-submit/tizen_2.2/20130710.072219.tar.bz2 rpm-submit/tizen_2.2/20130710.072219.zip |
Tizen 2.1 basesubmit/tizen_2.2/20130710.072219submit/tizen_2.1/20130423.104200accepted/tizen_2.1/20130423.1513382.2_release2.2.1_release2.1b_releasetizen_2.2tizen_2.1
Diffstat (limited to 'installplatform')
-rwxr-xr-x | installplatform | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/installplatform b/installplatform new file mode 100755 index 0000000..5973a18 --- /dev/null +++ b/installplatform @@ -0,0 +1,155 @@ +#!/usr/bin/env bash + +DESTDIR="${DESTDIR:-/}" +pkglibdir="${pkglibdir:-/usr/lib/rpm}" +platformdir="${pkglibdir}/platform" + +RPMRC="${1:-rpmrc}" +MACROS="${2:-macros}" +PLATFORM="${3:-platform}" + +RPM="./rpm --rcfile=$RPMRC --macros=$MACROS" + +canonarch_sed='s_i.86_i386_;s_pentium[34]_i386_;s_athlon_i386_;s_sparc[^-]*_sparc_;s_alpha[^-]*_alpha_;s_arm[^-]*_arm_;s_\(powerpc\|ppc\)[^-]*_ppc_;s,\(ia32e\|amd64\),x86_64,;s_sh4a_sh4_' +arch="`$RPM --eval '%{_arch}'|sed -e "$canonarch_sed"`" +VENDOR="`$RPM --eval '%{_vendor}'`" +OS="`$RPM --eval '%{_os}'`" +RPMRC_GNU="`$RPM --eval '%{_gnu}'`" + +case "$arch" in + i[3456]86|pentium[34]|athlon|geode) SUBSTS='s_i386_i386_ s_i386_i486_ s_i386_i586_ s_i386_i686_ s_i386_pentium3_ s_i386_pentium4_ s_i386_athlon_ s_i386_geode_' ;; + 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_armv3l_ s_arm_armv4l_ s_arm_armv4tl_ s_arm_armv5tel_ s_arm_armv5tejl_ s_arm_armv6l_ s_arm_armv7l_' ;; + sh4*) SUBSTS='s_sh4_sh4_ s_sh4_sh4a_' ;; + sparc*) SUBSTS='s_sparc\(64\|64v\|v9v\|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\([^6ip]\|$\)_ppc64\1_ s_ppc\([^6ip]\|$\)_ppciseries_ s_ppc\([^6ip]\|$\)_ppcpseries_ s_ppc\([^6ip]\|$\)_ppc64iseries_ s_ppc\([^6ip]\|$\)_ppc64pseries_' ;; + s390*) SUBSTS='s_s390x_s390_ s_s390\([^x]\|$\)_s390x\1_' ;; + x86_64|amd64|ia32e) SUBSTS='s,x86_64,x86_64, s,x86_64,ia32e, s,x86_64,amd64, s,x86_64,i386, s,x86_64,i486, s,x86_64,i586, s,x86_64,i686, s,x86_64,pentium3, s,x86_64,pentium4, s,x86_64,athlon, s,x86_64,geode,' ;; + *) SUBSTS=y___ ;; +esac + +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` + + PPD="${DESTDIR}/${platformdir}/${ARCH}-${OS}" + + [ -d $PPD ] || mkdir -p $PPD + + RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`" + RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`" + case $RPMRC_OPTFLAGS in + *-g*) ;; + *) RPMRC_OPTFLAGS="$RPMRC_OPTFLAGS -g" ;; + esac + + ARCH_INSTALL_POST='%{nil}' + case "${ARCH}-${OS}" in + sparc64*-linux) LIB=lib64 ;; + s390x-linux) LIB=lib64 ;; + ppc64-linux|powerpc64-linux) LIB=lib64 ;; + x86_64-linux|amd64-linux|ia32e-linux) LIB=lib64 ;; + *) LIB=lib;; + esac + + # XXX FIXME: incomplete and quite likely wrong too in places, + # consult various arch folks for correct names etc. + ISANAME= + ISABITS= + case "${ARCH}" in + sparc64*) + ISANAME=sparc + ISABITS=64 + ;; + sparc*) + ISANAME=sparc + ISABITS=32 + ;; + s390) + ISANAME=s390 + ISABITS=32 + ;; + s390x) + ISANAME=s390 + ISABITS=64 + ;; + ppc64*) + ISANAME=ppc + ISABITS=64 + ;; + ppc*) + ISANAME=ppc + ISABITS=32 + ;; + i?86|pentium?|athlon|geode) + ISANAME=x86 + ISABITS=32 + ;; + x86_64|amd64|ia32e) + ISANAME=x86 + ISABITS=64 + ;; + ia64) + ISANAME=ia + ISABITS=64 + ;; + sh*) + ISANAME=sh + ISABITS=32 + ;; + arm*) + ISANAME=`echo ${ARCH} | sed "s/^\([^-]*\)-.*/\1/"` + ISABITS=32 + ;; + alpha*) + ISANAME=alpha + ISABITS=64 + ;; + esac + + case $VENDOR in + yellowdog) + VENDORSED='-e s,^@yellowdog@,,' + ;; + pld) + VENDORSED='-e s,^@pld@,,' + RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e "s/ -g/ /"`" + ;; + 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@,,' + ;; + apple) + VENDORSED='-e s,^@apple@,,' + ;; + esac + + CANONARCH="`echo $ARCH|sed -e "$canonarch_sed"`" + + cat $PLATFORM \ + | sed -e "s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS," \ + -e "s,$arch,$CANONARCH," \ + -e "s,@RPMRC_GNU@,$RPMRC_GNU," \ + -e "s,@LIB@,$LIB," \ + -e "s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST," \ + -e '/\${\w*:-/!s,\${,%{_,' \ + -e "s,@ISANAME@,$ISANAME," \ + -e "s,@ISABITS@,$ISABITS," \ + $VENDORSED \ + | grep -v '^@' \ + > ${PPD}/macros + +done + +{ cd ${DESTDIR}/${platformdir} + [ -L noarch-${OS} ] && rm -f noarch-${OS} 2>/dev/null + mkdir -p noarch-${OS} + sed -e "/^%_arch/s,${arch},noarch," ${arch}-${OS}/macros | grep -v '^%optflags' | grep -v "^%__isa" > noarch-${OS}/macros +} |