-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathci_build.sh
executable file
·89 lines (82 loc) · 2.45 KB
/
ci_build.sh
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
#!/usr/bin/env bash
#
# Build script for CircleCi
#
# Inputs:
# CIRCLE_OS_NAME - "linux" or "osx"
# MODE - "static", "dynamic", "windows", "raspberrypi", or "minimal"
#
# Static builds use scripts to download libarchive and libconfuse, so those are
# only installed on shared library builds.
#
set -e
set -v
FWUP_VERSION=$(cat VERSION)
# Create ./configure
./autogen.sh
case "${CIRCLE_OS_NAME}-${MODE}" in
*-static)
# If this is a static build, run 'build_pkg.sh'
bash -v scripts/build_pkg.sh
exit 0
;;
linux-minimal)
bash -v scripts/build_and_test_minimal.sh
exit 0
;;
linux-dynamic)
./configure --enable-gcov
;;
linux-singlethread)
# The verify-syscalls script can't follow threads, so
# single thread builds are the only way to verify that
# the issued read and write calls follow the expected
# alignment, size and order
./configure --enable-gcov --without-pthreads
;;
osx-dynamic)
PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig:$(brew --prefix)/lib/pkgconfig:$PKG_CONFIG_PATH" ./configure
;;
linux-windows)
CC=x86_64-w64-mingw32-gcc \
CROSS_COMPILE=x86_64-w64-mingw32 \
bash -v scripts/build_pkg.sh
exit 0
;;
linux-raspberrypi)
CC=arm-linux-gnueabihf-gcc \
CROSS_COMPILE=arm-linux-gnueabihf \
PATH=~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:$PATH \
QEMU_LD_PREFIX=~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf \
bash -v scripts/build_pkg.sh
exit 0
;;
*)
echo "Unexpected build option: ${CIRCLE_OS_NAME}-${MODE}"
exit 1
esac
# Normal build
make -j4
if ! make -j4 check; then
cat tests/test-suite.log
echo "git source 'make check' failed. See log above"
exit 1
fi
make dist
# Check that the distribution version works by building it again
mkdir distcheck
cd distcheck
tar xf ../fwup-$FWUP_VERSION.tar.gz
cd fwup-$FWUP_VERSION
if [ "$CIRCLE_OS_NAME" = "linux" ]; then
./configure;
else
PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig:$(brew --prefix)/lib/pkgconfig:$PKG_CONFIG_PATH" ./configure
fi
make -j4
if ! make -j4 check; then
cat tests/test-suite.log
echo "Distribution 'make check' failed. See log above"
exit 1
fi
cd ../..