Debian Codegraph @

.travis/linux-build.sh

raw symbols SCIP
1 #!/bin/bash -ex
2
3 VERS="master v5.4 v4.19 v4.17 v4.16 v4.13 v4.12 v4.11 v4.10"
4
5 nproc=$(/usr/bin/getconf _NPROCESSORS_ONLN)
6 basedir=$(pwd)
7
8 function cleanup()
9 {
10 cd "$basedir"
11 [ ! -d linux ] || rm -rf linux
12 [ ! -d "linux-$KERNEL" ] || rm -rf "linux-$KERNEL"
13 make distclean || :
14 }
15
16 function clone_kernel()
17 {
18 git clone https://github.com/torvalds/linux
19 }
20
21 function download_kernel()
22 {
23 VER="$1"
24 URL="https://www.kernel.org/pub/linux/kernel/v4.x/linux-$VER.tar.xz"
25 wget "$URL"
26 tar xf "linux-$VER.tar.xz"
27 }
28
29 function __prep_kernel()
30 {
31 make mrproper
32 make allmodconfig
33 make -j $nproc modules_prepare
34 make -j $nproc headers_install
35 KERNEL_HEADERS=$(pwd)/usr/include
36 popd
37 }
38
39 function git_prep_kernel()
40 {
41 VER="$1"
42
43 pushd "linux"
44 git checkout "$VER"
45 __prep_kernel
46 }
47
48 function download_prep_kernel()
49 {
50 VER="$1"
51
52 pushd "linux-$VER"
53 __prep_kernel
54 }
55
56 function build_lksctp()
57 {
58 local use_builddir="$1"
59
60 make distclean || :
61 ./bootstrap
62
63 #CFLAGS="-Werror"
64 if [ -n "$KERNEL_HEADERS" ]; then
65 CFLAGS="$CFLAGS -I$KERNEL_HEADERS"
66 fi
67 export CFLAGS
68
69 if [ "$use_builddir" == 1 ]; then
70 mkdir build
71 pushd build
72 ../configure
73 else
74 ./configure
75 fi
76
77 make -j $nproc
78
79 make -j $nproc distcheck
80
81 if [ "$use_builddir" == 1 ]; then
82 popd
83 rm -rf build
84 fi
85 }
86
87 # When building the coverity_scan branch, allow only the 6th job to continue
88 # to avoid travis-ci/travis-ci#1975. 6th = gcc7, linux tip
89 if [[ "${TRAVIS_BRANCH}" == "coverity_scan" ]]; then
90 exit 0
91 fi
92
93 trap cleanup EXIT
94 if [ -z "$KERNEL" ]; then
95 clone_kernel
96
97 for ver in $VERS; do
98 git_prep_kernel "$ver"
99 build_lksctp
100 build_lksctp 1
101 done
102 else
103 if [ "$KERNEL" == 'master' ]; then
104 clone_kernel
105 git_prep_kernel "$KERNEL"
106 else
107 download_kernel "$KERNEL"
108 download_prep_kernel "$KERNEL"
109 fi
110 build_lksctp
111 build_lksctp 1
112 fi