| 1 | #!/bin/bashscip-shell filesystem . . `/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/getconfscip-shell filesystem . . `/usr/bin/getconf`. _NPROCESSORS_ONLN) |
| 6 | basedir=$(pwdscip-shell system . . pwd.) |
| 7 | |
| 8 | function cleanupscip-shell shell shell-project 0.0.0 cleanup().() |
| 9 | { |
| 10 | cd "$basedir" |
| 11 | [scip-shell system . . `[`. ! -d linux ] || rmscip-shell system . . rm. -rf linux |
| 12 | [scip-shell system . . `[`. ! -d "linux-$KERNEL" ] || rmscip-shell system . . rm. -rf "linux-$KERNEL" |
| 13 | makescip-shell system . . make. distclean || : |
| 14 | } |
| 15 | |
| 16 | function clone_kernelscip-shell shell shell-project 0.0.0 clone_kernel().() |
| 17 | { |
| 18 | gitscip-shell system . . git. clone https://github.com/torvalds/linux |
| 19 | } |
| 20 | |
| 21 | function download_kernelscip-shell shell shell-project 0.0.0 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 | tarscip-shell system . . tar. xf "linux-$VER.tar.xz" |
| 27 | } |
| 28 | |
| 29 | function __prep_kernelscip-shell shell shell-project 0.0.0 __prep_kernel().() |
| 30 | { |
| 31 | makescip-shell system . . make. mrproper |
| 32 | makescip-shell system . . make. allmodconfig |
| 33 | makescip-shell system . . make. -j $nproc modules_prepare |
| 34 | makescip-shell system . . make. -j $nproc headers_install |
| 35 | KERNEL_HEADERS=$(pwdscip-shell system . . pwd.)/usr/include |
| 36 | popd |
| 37 | } |
| 38 | |
| 39 | function git_prep_kernelscip-shell shell shell-project 0.0.0 git_prep_kernel().() |
| 40 | { |
| 41 | VER="$1" |
| 42 | |
| 43 | pushd "linux" |
| 44 | gitscip-shell system . . git. checkout "$VER" |
| 45 | __prep_kernelscip-shell shell shell-project 0.0.0 __prep_kernel(). |
| 46 | } |
| 47 | |
| 48 | function download_prep_kernelscip-shell shell shell-project 0.0.0 download_prep_kernel().() |
| 49 | { |
| 50 | VER="$1" |
| 51 | |
| 52 | pushd "linux-$VER" |
| 53 | __prep_kernelscip-shell shell shell-project 0.0.0 __prep_kernel(). |
| 54 | } |
| 55 | |
| 56 | function build_lksctpscip-shell shell shell-project 0.0.0 build_lksctp().() |
| 57 | { |
| 58 | local use_builddir="$1" |
| 59 | |
| 60 | makescip-shell system . . make. distclean || : |
| 61 | ./bootstrap |
| 62 | |
| 63 | #CFLAGS="-Werror" |
| 64 | if [scip-shell system . . `[`. -n "$KERNEL_HEADERS" ]; then |
| 65 | CFLAGS="$CFLAGS -I$KERNEL_HEADERS" |
| 66 | fi |
| 67 | export CFLAGS |
| 68 | |
| 69 | if [scip-shell system . . `[`. "$use_builddir" == 1 ]; then |
| 70 | mkdirscip-shell system . . mkdir. build |
| 71 | pushd build |
| 72 | ../configure |
| 73 | else |
| 74 | ./configure |
| 75 | fi |
| 76 | |
| 77 | makescip-shell system . . make. -j $nproc |
| 78 | |
| 79 | makescip-shell system . . make. -j $nproc distcheck |
| 80 | |
| 81 | if [scip-shell system . . `[`. "$use_builddir" == 1 ]; then |
| 82 | popd |
| 83 | rmscip-shell system . . 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 [scip-shell system . . `[`. -z "$KERNEL" ]; then |
| 95 | clone_kernelscip-shell shell shell-project 0.0.0 clone_kernel(). |
| 96 | |
| 97 | for ver in $VERS; do |
| 98 | git_prep_kernelscip-shell shell shell-project 0.0.0 git_prep_kernel(). "$ver" |
| 99 | build_lksctpscip-shell shell shell-project 0.0.0 build_lksctp(). |
| 100 | build_lksctpscip-shell shell shell-project 0.0.0 build_lksctp(). 1 |
| 101 | done |
| 102 | else |
| 103 | if [scip-shell system . . `[`. "$KERNEL" == 'master' ]; then |
| 104 | clone_kernelscip-shell shell shell-project 0.0.0 clone_kernel(). |
| 105 | git_prep_kernelscip-shell shell shell-project 0.0.0 git_prep_kernel(). "$KERNEL" |
| 106 | else |
| 107 | download_kernelscip-shell shell shell-project 0.0.0 download_kernel(). "$KERNEL" |
| 108 | download_prep_kernelscip-shell shell shell-project 0.0.0 download_prep_kernel(). "$KERNEL" |
| 109 | fi |
| 110 | build_lksctpscip-shell shell shell-project 0.0.0 build_lksctp(). |
| 111 | build_lksctpscip-shell shell shell-project 0.0.0 build_lksctp(). 1 |
| 112 | fi |