blob: ffd8cd8164eeec404f039456646a4e9488c25144 (
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
|
#!/bin/sh
DESTDIR="${DESTDIR:-/}"
pkglibdir="${pkglibdir:-/usr/lib/rpm}"
RPMRC="${1:-rpmrc}"
MACROS="${2:-macros}"
PLATFORM="${3:-platform}"
TEMPRC="/tmp/rpmrc.$$"
cat << E_O_F > $TEMPRC
include: $RPMRC
macrofiles: $MACROS
E_O_F
RPM="./rpm --rcfile $TEMPRC"
ARCH="`$RPM --eval '%{_arch}'`"
VENDOR="`$RPM --eval '%{_vendor}'`"
OS="`$RPM --eval '%{_os}'`"
TARGET_PLATFORM="`$RPM --eval '%{_target_platform}'`"
TARGET="`$RPM --eval '%{_target}'`"
PPD="${DESTDIR}/${pkglibdir}/${ARCH}-${VENDOR}-${OS}"
[ -d $PPD ] || mkdir $PPD
RPMRC_OPTFLAGS="`$RPM --eval '%{optflags}'`"
RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
cat $PLATFORM | \
sed -e s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS, -e 's,\${,%{_,' \
> ${PPD}/macros
#
# Better try to create these too until the smoke clears. Yuck.
[ "${ARCH}-${VENDOR}-${OS}" = "${TARGET}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET}
[ "${ARCH}-${VENDOR}-${OS}" = "${TARGET_PLATFORM}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET_PLATFORM}
rm $TEMPRC
|