aboutsummaryrefslogtreecommitdiff
blob: ce213a3d587af1aea187ecfc0b6ec3eed483c5b4 (plain)
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
# Originally by Nicolas Iooss from: https://github.com/fishilico/selinux-refpolicy-patched/blob/travis-upstream/.travis.yml

language: python
python:
 - "2.7"

# for T in standard mls mcs ; do for D in arch debian gentoo ; do for I in n y ; do for M in y n ; do
# echo "  - TYPE=$T DISTRO=$D DIRECT_INITRC=$I MONOLITHIC=$M" ; done ; done ; done ; done
env:
  - TYPE=standard DISTRO=gentoo DIRECT_INITRC=n MONOLITHIC=n
  - TYPE=mls DISTRO=gentoo DIRECT_INITRC=n MONOLITHIC=n
  - TYPE=mcs DISTRO=gentoo DIRECT_INITRC=n MONOLITHIC=n

# Install SELinux userspace utilities dependencies
before_install:
# Show OS version information
  - lsb_release -a
  - sudo apt-get update -qq
  - sudo apt-get install -qq libaudit-dev libcap-ng-dev libustr-dev swig

# Compile and install a newer version of SELinux userspace utilities
install:
  # Setup the directory where SELinux utilities will be installed
  - export DESTDIR="$HOME/selinux-project"
  - mkdir "$DESTDIR"
  - export PATH="$DESTDIR/usr/bin:$DESTDIR/usr/sbin:$DESTDIR/bin:$DESTDIR/sbin:$PATH"
  - export LD_LIBRARY_PATH="$DESTDIR/usr/lib:$DESTDIR/lib:$LD_LIBRARY_PATH"

  # On Ubuntu 12.04, default CFLAGS make the build fail in libsepol/cil with:
  #    error: declaration of 'index' shadows a global declarationo
  # So define our own CFLAGS
  - export CFLAGS="-O2 -pipe -fPIC -Wall"

  # Download SELinux userspace tools and libraries
  - wget https://github.com/SELinuxProject/selinux/archive/20140826-rc6.tar.gz
  - tar -xzf 20140826-rc6.tar.gz
  - mv selinux-20140826-rc6 selinux-src

  # Download setools
  - wget https://github.com/TresysTechnology/setools3/archive/setools-3.3.8.tar.gz
  - tar -xzf setools-3.3.8.tar.gz
  - mv setools3-setools-3.3.8 setools-src

  # Ubuntu 12.04 coreutils is too old to provide "ln --relative" :(
  - sed 's/ln -sf --relative /ln -sf /' -i selinux-src/libsepol/src/Makefile
  - sed 's/ln -sf --relative /ln -sf /' -i selinux-src/libselinux/src/Makefile

  # Compile and install SELinux libraries first
  - make -C selinux-src/libsepol install
  - make -C selinux-src/libselinux install
  - make -C selinux-src/libsemanage install

  # Now that the libraries are installed, use them to compile the tools
  - export CFLAGS="$CFLAGS -I$DESTDIR/usr/include"
  - export LDFLAGS="$LDFLAGS -L$DESTDIR/usr/lib"

  # Compile and install setools
  - cd setools-src
  - aclocal && autoreconf -if && automake
  - ./configure
        --prefix="$DESTDIR/usr"
        --disable-gui --disable-swig-tcl
        --disable-bwidget-check --disable-selinux-check
        --with-sepol-devel="$DESTDIR/usr"
        --with-selinux-devel="$DESTDIR/usr"
  - make -C libqpol DESTDIR= install
  - make -C libapol DESTDIR= install
  - cd ..

  # Compile and install SELinux tools
  - export LIBDIR="$DESTDIR/usr/lib"
  - export LIBEXECDIR="$DESTDIR/usr/lib"
  - export SHLIBDIR="$DESTDIR/usr/lib"
  - export SEMODULE_PATH="$DESTDIR/usr/bin"
  - make -C selinux-src/sepolgen install
  - make -C selinux-src/checkpolicy install
  - make -C selinux-src/policycoreutils install

  # Use the newly-built toolchain
  - export TEST_TOOLCHAIN="$DESTDIR"

# XXX: not sure whether the definition in make command line are useful or whether the env definitions are enough
# Use a heartbeat loop to produce output while compiling the policy, which takes quite a long time.
script:
  - make bare
  - make TYPE="$TYPE" MONOLITHIC="$MONOLITHIC" conf

#  - if [ "$MONOLITHIC" = y ]; then
#    ( for A in $(seq 8) ; do sleep 300 ; echo "Heartbeat $((A*5)) minutes" ; done ) &
#    make TYPE="$TYPE" DISTRO="$DISTRO" DIRECT_INITRC="$DIRECT_INITRC" MONOLITHIC=y ;
#    fi
#  - if [ "$MONOLITHIC" = y ]; then make TYPE="$TYPE" DISTRO="$DISTRO" DIRECT_INITRC="$DIRECT_INITRC" MONOLITHIC=y file_contexts ; fi
#  - if [ "$MONOLITHIC" = y ]; then setfiles -c policy.$(checkpolicy -V | cut -d' ' -f1) file_contexts ; fi
#  - if [ "$MONOLITHIC" = n ]; then make TYPE="$TYPE" DISTRO="$DISTRO" DIRECT_INITRC="$DIRECT_INITRC" MONOLITHIC=n base ; fi
#  - if [ "$MONOLITHIC" = n ]; then make TYPE="$TYPE" DISTRO="$DISTRO" DIRECT_INITRC="$DIRECT_INITRC" MONOLITHIC=n modules ; fi
#  - if [ "$MONOLITHIC" = n ]; then
#    ( for A in $(seq 8) ; do sleep 300 ; echo "Heartbeat $((A*5)) minutes" ; done ) &
#    make TYPE="$TYPE" DISTRO="$DISTRO" DIRECT_INITRC="$DIRECT_INITRC" MONOLITHIC=n validate ;
#    fi

  - make TYPE="$TYPE" DISTRO="$DISTRO" DIRECT_INITRC="$DIRECT_INITRC" MONOLITHIC=n base
  - make TYPE="$TYPE" DISTRO="$DISTRO" DIRECT_INITRC="$DIRECT_INITRC" MONOLITHIC=n modules
  - ( for A in $(seq 8) ; do sleep 300 ; echo "Heartbeat $((A*5)) minutes" ; done ) &
    make TYPE="$TYPE" DISTRO="$DISTRO" DIRECT_INITRC="$DIRECT_INITRC" MONOLITHIC=n validate

# Only build travis branches
branches:
  only:
    - /^travis-.*/

notifications:
  email: false