aboutsummaryrefslogtreecommitdiffstats
path: root/make_macrosfiles.sh.in
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2005-04-26 23:25:40 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2005-04-26 23:25:40 +0000
commit3d18e198d27190a4bfe8acd66518773acc39f4d7 (patch)
tree668f3f5db61491526cefc7d6372f7c5bebc99e90 /make_macrosfiles.sh.in
parent14106b93fcb2cae4a8c164a5b4030b274966b422 (diff)
downloadrpm-setup-3d18e198d27190a4bfe8acd66518773acc39f4d7.tar
rpm-setup-3d18e198d27190a4bfe8acd66518773acc39f4d7.tar.gz
rpm-setup-3d18e198d27190a4bfe8acd66518773acc39f4d7.tar.bz2
rpm-setup-3d18e198d27190a4bfe8acd66518773acc39f4d7.tar.xz
rpm-setup-3d18e198d27190a4bfe8acd66518773acc39f4d7.zip
- import
Diffstat (limited to 'make_macrosfiles.sh.in')
-rw-r--r--make_macrosfiles.sh.in70
1 files changed, 70 insertions, 0 deletions
diff --git a/make_macrosfiles.sh.in b/make_macrosfiles.sh.in
new file mode 100644
index 0000000..cb8978e
--- /dev/null
+++ b/make_macrosfiles.sh.in
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# $Id$
+
+MINPUT="$1"
+ARCH="$2"
+
+LIB=lib
+OS=@RPMOS@
+OPTFLAGS=`perl -ane "m/^optflags:\s*${ARCH}\s*(.*)/ and print \\$1" < rpmrc`
+MULTILIBNO=
+
+case $ARCH in
+ i*86|k6|athlon)
+ MULTILIBNO=1
+ CANONARCH=i386
+ ;;
+ amd64|x86_64)
+ MULTILIBNO=2
+ CANONARCH=x86_64
+ LIB=lib64
+ ;;
+ sparc|sparcv9)
+ MULTILIBNO=1
+ CANONARCH=sparc
+ ;;
+ sparc64)
+ MULTILIBNO=2
+ CANONARCH=sparc64
+ LIB=lib64
+ ;;
+ ppc|powerpc)
+ MULTILIBNO=1
+ CANONARCH=ppc
+ ;;
+ ppc64|powerpc64)
+ MULTILIBNO=1
+ CANONARCH=ppc64
+ LIB=lib64
+ ;;
+ alpha)
+ CANONARCH=alpha
+ ;;
+ s390)
+ CANONARCH=s390-linux
+ MULTILIBNO=1
+ ;;
+ s390x)
+ CANONARCH=s390x
+ LIB=lib64;
+ MULTILIBNO=2 ;;
+esac
+
+if [ -n "$MULTILIBNO" ]; then
+ MULTILIBSED='-e /^@MULTILIB/d -e s,@MULTILIBNO@,'$MULTILIBNO,
+else
+ MULTILIBSED='-e /^@MULTILIBSTART@/,/^@MULTILIBEND@/d'
+fi
+
+if [ -n "$OPTFLAGS" ]; then
+ OPTFLAGSSED='-e s,@RPMOPTFLAGS@,$OPTFLAGS,g'
+else
+ OPTFLAGSSED='-e s,^%optflags.*,,'
+fi
+
+cat "$MINPUT" | sed \
+ -e "s,@RPMARCH@,$CANONARCH,g" \
+ -e "s,@LIB@,$LIB,g" \
+ $OPTFLAGSSED \
+ $MULTILIBSED