1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-30 00:00:15 +01:00
libhermit/usr/rdma-core/buildlib/travis-build
2017-10-06 15:13:04 +02:00

61 lines
2 KiB
Bash
Executable file

#!/bin/bash
# Stop on error
set -e
# Echo all commands to Travis log
set -x
mkdir build-clang build32 build-sparse build-aarch64
# Build with latest clang first
cd build-clang
CC=clang-4.0 CFLAGS=-Werror cmake -GNinja ..
ninja
../buildlib/check-build --src .. --cc clang-4.0
# 32 bit build to check format strings/etc
cd ../build32
# travis's trusty is not configured in a way that enables all 32 bit
# packages. We could fix this with some sudo stuff.. For now turn off libnl
CC=gcc-7 CFLAGS="-Werror -m32" cmake -GNinja .. -DENABLE_RESOLVE_NEIGH=0
ninja
# aarch64 build to check compilation on ARM 64bit platform
cd ../build-aarch64
CC=$HOME/aarch64/bin/aarch64-linux-gnu-gcc CFLAGS="-Werror -Wno-maybe-uninitialized" cmake -GNinja .. -DENABLE_RESOLVE_NEIGH=0
ninja
# Run sparse on the subdirectories which are sparse clean
cd ../build-sparse
mv ../CMakeLists.txt ../CMakeLists-orig.txt
grep -v "# NO SPARSE" ../CMakeLists-orig.txt > ../CMakeLists.txt
CC=cgcc CFLAGS="-Werror" cmake -GNinja ..
ninja > out
# sparse does not fail gcc on messages
if grep -v '^\[' out; then
false
fi
mv ../CMakeLists-orig.txt ../CMakeLists.txt
# Test with coherent DMA mode disabled (ie as would be on ARM32, etc)
cd ../build-clang
cp ../util/udma_barrier.h ../util/udma_barrier.h.old
echo "#error Fail" >> ../util/udma_barrier.h
rm CMakeCache.txt
CC=clang-4.0 CFLAGS=-Werror cmake -GNinja ..
ninja
cp ../util/udma_barrier.h.old ../util/udma_barrier.h
# Finally run through gcc-7 64 bit through the debian packaging This gives a
# good clue if patches are changing packaging related things, the RPM stuff
# will have to be audited by hand.
# When running cmake through debian/rules it is hard to set -Werror,
# instead force it on by changing the CMakeLists.txt
cd ..
echo 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")' >> buildlib/RDMA_EnableCStd.cmake
sed -i -e 's/-DCMAKE_BUILD_TYPE=Release//g' debian/rules
sed -i -e 's/ninja \(.*\)-v/ninja \1/g' debian/rules
CC=gcc-7 debian/rules build
fakeroot debian/rules binary