-
Notifications
You must be signed in to change notification settings - Fork 3
/
buildvgl.linux
executable file
·118 lines (102 loc) · 4.04 KB
/
buildvgl.linux
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
set -u
set -e
SCRIPTDIR=`dirname $0`
if ls $OUTDIR/files/VirtualGL-[0-9]*.i386.rpm >/dev/null 2>&1 \
|| ls $OUTDIR/files/VirtualGL-[0-9]*.x86_64.rpm >/dev/null 2>&1 \
|| ls $OUTDIR/files/VirtualGL-[0-9]*.aarch.rpm >/dev/null 2>&1 \
|| ls $OUTDIR/files/virtualgl*_[0-9]*_amd64.deb >/dev/null 2>&1 \
|| ls $OUTDIR/files/virtualgl*_[0-9]*_arm64.deb >/dev/null 2>&1 \
|| ls $OUTDIR/files/virtualgl*_[0-9]*_i386.deb >/dev/null 2>&1; then
if [ $FORCEBINARY = 0 ]; then
>&2 echo
>&2 echo Binary already exists!
>&2 echo Run $SCRIPT -fb to rebuild it.
>&2 echo
exit 1
else
rm -f $OUTDIR/files/*.i386.rpm $OUTDIR/files/*.x86_64.rpm $OUTDIR/files/*.aarch64.rpm $OUTDIR/files/*.deb
fi
fi
exec 2>&1
echo Creating i386 and x86-64 binary RPMs ...
mkdir -p rpmbuild/RPMS
mkdir -p rpmbuild/BUILD
mkdir -p rpmbuild/SRPMS
mkdir -p rpmbuild/buildroot
export CFLAGS=
export CXXFLAGS=
export LDFLAGS=
export LD_LIBRARY_PATH=
rpmbuild --rebuild --buildroot $TMPDIR/rpmbuild/buildroot \
--define "_topdir $TMPDIR/rpmbuild" $OUTDIR/files/VirtualGL-[0-9]*.src.rpm
VERSION=`rpm -q -p rpmbuild/RPMS/x86_64/VirtualGL-[0-9]*.x86_64.rpm | cut -f2 -d-`
mv rpmbuild/RPMS/x86_64/VirtualGL-[0-9]*.x86_64.rpm $OUTDIR/files/VirtualGL-$VERSION.x86_64.rpm
mv rpmbuild/RPMS/x86_64/VirtualGL-debuginfo-[0-9]*.x86_64.rpm $OUTDIR/files/VirtualGL-debuginfo-$VERSION.x86_64.rpm
if [ -f $SCRIPTDIR/gpgsign ]; then
$SCRIPTDIR/rpmsign $OUTDIR/files/VirtualGL-$VERSION.x86_64.rpm
rpm --checksig -v $OUTDIR/files/VirtualGL-$VERSION.x86_64.rpm
$SCRIPTDIR/rpmsign $OUTDIR/files/VirtualGL-debuginfo-$VERSION.x86_64.rpm
rpm --checksig -v $OUTDIR/files/VirtualGL-debuginfo-$VERSION.x86_64.rpm
fi
export CFLAGS='-m32'
export CXXFLAGS='-m32'
export LDFLAGS='-m32'
rpmbuild --rebuild --buildroot $TMPDIR/rpmbuild/buildroot --target i386 \
--define "_topdir $TMPDIR/rpmbuild" $OUTDIR/files/VirtualGL-[0-9]*.src.rpm
VERSION=`rpm -q -p rpmbuild/RPMS/i386/VirtualGL-[0-9]*.i386.rpm | cut -f2 -d-`
mv rpmbuild/RPMS/i386/VirtualGL-[0-9]*.i386.rpm $OUTDIR/files/VirtualGL-$VERSION.i386.rpm
mv rpmbuild/RPMS/i386/VirtualGL-debuginfo-[0-9]*.i386.rpm $OUTDIR/files/VirtualGL-debuginfo-$VERSION.i386.rpm
if [ -f $SCRIPTDIR/gpgsign ]; then
$SCRIPTDIR/rpmsign $OUTDIR/files/VirtualGL-$VERSION.i386.rpm
rpm --checksig -v $OUTDIR/files/VirtualGL-$VERSION.i386.rpm
$SCRIPTDIR/rpmsign $OUTDIR/files/VirtualGL-debuginfo-$VERSION.i386.rpm
rpm --checksig -v $OUTDIR/files/VirtualGL-debuginfo-$VERSION.i386.rpm
fi
echo Creating i386 and amd64 binary DEBs ...
rm -rf rpmbuild
pushd VirtualGL-[0-9]*
mkdir linux64 linux
pushd linux64
export CFLAGS=
export CXXFLAGS=
export LDFLAGS=
$SCRIPTDIR/setupscripts/linux64
export NUMCPUS=`grep -c '^processor' /proc/cpuinfo`
make -j$NUMCPUS --load-average=$NUMCPUS
make deb
mv virtualgl_[0-9]*_amd64.deb $OUTDIR/files/
if [ -f $SCRIPTDIR/gpgsign ]; then
. $SCRIPTDIR/gpgsign
expect $SCRIPTDIR/debsign "$GPG_KEY_PASS" "$GPG_KEY_ID" $OUTDIR/files/virtualgl_[0-9]*_amd64.deb
fi
popd
pushd linux
$SCRIPTDIR/setupscripts/linux
make -j$NUMCPUS --load-average=$NUMCPUS
make deb
mv virtualgl_[0-9]*_i386.deb $OUTDIR/files/
mv virtualgl32_[0-9]*_amd64.deb $OUTDIR/files/
if [ -f $SCRIPTDIR/gpgsign ]; then
expect $SCRIPTDIR/debsign "$GPG_KEY_PASS" "$GPG_KEY_ID" $OUTDIR/files/virtualgl_[0-9]*_i386.deb
expect $SCRIPTDIR/debsign "$GPG_KEY_PASS" "$GPG_KEY_ID" $OUTDIR/files/virtualgl32_[0-9]*_amd64.deb
fi
popd
echo Creating AArch64 binary RPM and DEB ...
mkdir linux64.arm
pushd linux64.arm
$SCRIPTDIR/setupscripts/linux64.arm
make -j$NUMCPUS --load-average=$NUMCPUS
STRIP=/opt/gcc.arm64/bin/aarch64-none-linux-gnu-strip make rpm
VERSION=`rpm -q -p VirtualGL-[0-9]*.aarch64.rpm | cut -f2 -d-`
mv VirtualGL-[0-9]*.aarch64.rpm $OUTDIR/files/VirtualGL-$VERSION.aarch64.rpm
if [ -f $SCRIPTDIR/gpgsign ]; then
$SCRIPTDIR/rpmsign $OUTDIR/files/VirtualGL-$VERSION.aarch64.rpm
rpm --checksig -v $OUTDIR/files/VirtualGL-$VERSION.aarch64.rpm
fi
make deb
mv virtualgl_[0-9]*_arm64.deb $OUTDIR/files/
if [ -f $SCRIPTDIR/gpgsign ]; then
expect $SCRIPTDIR/debsign "$GPG_KEY_PASS" "$GPG_KEY_ID" $OUTDIR/files/virtualgl_[0-9]*_arm64.deb
fi
popd
popd