File: installplatform

package info (click to toggle)
rpm 4.14.2.1+dfsg1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 17,592 kB
  • sloc: ansic: 68,414; sh: 31,370; makefile: 884; cpp: 569; python: 485; perl: 222; sed: 16
file content (219 lines) | stat: -rwxr-xr-x 3,658 bytes parent folder | download | duplicates (2)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/usr/bin/env bash

DESTDIR="${DESTDIR:-/}"
pkglibdir="${pkglibdir:-/usr/lib/rpm}"
platformdir="${pkglibdir}/platform"

RPMRC="${1:-rpmrc}"
PLATFORM="${2:-platform}"
MACROS="${3:-macros}"
VENDOR="${4}"
OS="${5}"
RPMRC_GNU="${6}"

for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
  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}'
  LIB=lib

  # XXX FIXME: incomplete and quite likely wrong too in places,
  # consult various arch folks for correct names etc.
  ISANAME=
  ISABITS=
  CANONARCH=
  CANONCOLOR=
  FILTER=cat
  case "${ARCH}" in
    sparc64*) 
	ISANAME=sparc
	ISABITS=64
	CANONARCH=sparc64
	CANONCOLOR=3
	;;
    sparc*) 
	ISANAME=sparc
	ISABITS=32
	CANONARCH=sparc
	CANONCOLOR=0
	;;
    s390)
	ISANAME=s390
	ISABITS=32
	CANONARCH=s390
	CANONCOLOR=0
	;;
    s390x)
	ISANAME=s390
	ISABITS=64
	CANONARCH=s390x
	CANONCOLOR=3
	;;
    ppc64|ppc64p7)
	ISANAME=ppc
	ISABITS=64
	CANONARCH=ppc64
	CANONCOLOR=3
	;;
    ppc64le)
	ISANAME=ppc
        ISABITS=64
        CANONARCH=ppc64le
        CANONCOLOR=3
	;;
    ppc*)
	ISANAME=ppc
	ISABITS=32
	CANONARCH=ppc
	CANONCOLOR=0
	;;
    i?86|pentium?|athlon|geode)
	ISANAME=x86
	ISABITS=32
	CANONARCH=i386
	CANONCOLOR=0
	;;
    x86_64|amd64|ia32e)
	ISANAME=x86
	ISABITS=64
	CANONARCH=x86_64
	CANONCOLOR=3
	;;
    ia64)
	ISANAME=ia
	ISABITS=64
	CANONARCH=ia64
	CANONCOLOR=2
	;;
    sh*)
	ISANAME=sh
	ISABITS=32
	CANONARCH=${ARCH}
	CANONCOLOR=0
	;;
    armv7h*)
	ISANAME=armv7hl
	ISABITS=32
	CANONARCH=arm
	CANONCOLOR=0
	;;
    arm*)
	ISANAME=`echo ${ARCH} | sed "s/^\([^-]*\)-.*/\1/"`
	ISABITS=32
	CANONARCH=arm
	CANONCOLOR=0
	;;
    alpha*)
	ISANAME=alpha
	ISABITS=64
	CANONARCH=alpha
	CANONCOLOR=0
	;;
    aarch64)
	ISANAME=aarch
	ISABITS=64
	CANONARCH=aarch64
	CANONCOLOR=3
	;;
    mips)
	ISANAME=mips
	ISABITS=32
	CANONARCH=mips
	CANONCOLOR=0
	;;
    mipsel)
	ISANAME=mips
	ISABITS=32
	CANONARCH=mipsel
	CANONCOLOR=0
	;;
    mips64)
	ISANAME=mips
	ISABITS=64
	CANONARCH=mips64
	CANONCOLOR=3
	;;
    mips64el)
	ISANAME=mips
	ISABITS=64
	CANONARCH=mips64el
	CANONCOLOR=3
	;;
    mipsr6)
	ISANAME=mipsr6
	ISABITS=32
	CANONARCH=mipsr6
	CANONCOLOR=0
	;;
    mipsr6el)
	ISANAME=mipsr6
	ISABITS=32
	CANONARCH=mipsr6el
	CANONCOLOR=0
	;;
    mips64r6)
	ISANAME=mipsr6
	ISABITS=64
	CANONARCH=mips64r6
	CANONCOLOR=3
	;;
    mips64r6el)
	ISANAME=mipsr6
	ISABITS=64
	CANONARCH=mips64r6el
	CANONCOLOR=3
	;;
    m68k)
	ISANAME=m68k
	ISABITS=32
	CANONARCH=m68k
	CANONCOLOR=0
	;;
    riscv64)
	ISANAME=riscv
	ISABITS=64
	CANONARCH=riscv64
	CANONCOLOR=3
	;;
    noarch)
	CANONARCH=noarch
	CANONCOLOR=0
	FILTER="grep -v -E ^(%optflag|%__isa)"
	;;
  esac

  # skip architectures for which we dont have full config parameters
  [ -z "$CANONARCH" ] && continue

  if [ "$OS" = "linux" ] && [ "$CANONCOLOR" = 3 ]; then
      LIB=${LIB}64
  fi

  PPD="${DESTDIR}/${platformdir}/${ARCH}-${OS}"
  [ -d $PPD ] || mkdir -p $PPD

  cat $PLATFORM \
  | sed -e "s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS," \
	-e "s,@RPMCANONARCH@,$CANONARCH,g" \
	-e "s,@RPMCANONCOLOR@,$CANONCOLOR," \
	-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," \
	-e "s,^@${VENDOR}@,," \
  | grep -v '^@' \
  | ${FILTER} \
  > ${PPD}/macros
  echo "Created ${PPD}/macros"

done

# gently adjust undefined autoconf variables to rpm macros...
cat $MACROS | sed -e 's,${prefix},%{_prefix},g' > ${DESTDIR}/${pkglibdir}/macros