aboutsummaryrefslogtreecommitdiffstats
path: root/make_macrosfiles.sh.in
blob: cb8978eeff0d288f73eb1142a643ffc6135d5626 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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