summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 147230f01eb6a426bad8104c57af2257a237297f (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
stages:
  - containers
  - builds
  - sanity_checks

.multilib: &multilib |
  dpkg_architecture=$(which dpkg-architecture 2>/dev/null || true)
  rpm=$(which rpm 2>/dev/null || true)
  if test -x "$dpkg_architecture"; then
    multilib=$(dpkg-architecture -q DEB_TARGET_MULTIARCH);
  elif test -x "$rpm"; then
    multilib=$(rpm --eval '%{_lib}');
  fi

.native-environment: &native-environment |
  export VIRT_PREFIX="$HOME/build/libvirt"
  export PATH="$VIRT_PREFIX/bin:$PATH"
  export C_INCLUDE_PATH="$VIRT_PREFIX/include"
  export LD_LIBRARY_PATH="$VIRT_PREFIX/$multilib"
  export PKG_CONFIG_PATH="$VIRT_PREFIX/$multilib/pkgconfig"
  export XDG_DATA_DIRS="$VIRT_PREFIX/share:/usr/share:/usr/local/share"
  export GI_TYPELIB_PATH="$VIRT_PREFIX/$multilib/girepository-1.0"
  export OSINFO_SYSTEM_DIR="$VIRT_PREFIX/share/osinfo"
  export MAKEFLAGS="-j $(getconf _NPROCESSORS_ONLN)"
  export CCACHE_BASEDIR="$(pwd)"
  export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
  export CCACHE_MAXSIZE="50M"
  export PATH="$CCACHE_WRAPPERSDIR:$PATH"

.mingw-environment: &mingw-environment |
  export VIRT_PREFIX="$VIRT_PREFIX/$ABI/sys-root/mingw"
  export PKG_CONFIG_PATH="$VIRT_PREFIX/lib/pkgconfig"

.native_build_job:
  cache:
    paths:
      - ccache
    key: "$CI_JOB_NAME"
  script:
    - *multilib
    - *native-environment
    - pushd /tmp/
    - git clone https://gitlab.com/libosinfo/osinfo-db.git
    - cd osinfo-db
    - mkdir build
    - cd build
    - $MAKE -f ../Makefile VPATH=..
    - $MAKE -f ../Makefile VPATH=.. check
    - $MAKE -f ../Makefile VPATH=.. install OSINFO_DB_TARGET="--system"
    - popd
    - mkdir build
    - cd build
    - meson .. . --prefix=$VIRT_PREFIX --werror
    - $NINJA
    - $NINJA install
    - $NINJA test
    - $NINJA dist
    - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
      then
        rpmbuild --nodeps --define '_without_mingw 1' -ta meson-dist/*.tar.xz;
      fi

.native_build_job_prebuilt_env:
  extends:
    - .native_build_job
    - .gitlab_native_build_job_prebuilt_env

.native_build_job_local_env:
  extends:
    - .native_build_job
    - .gitlab_native_build_job_local_env

.cross_build_job:
  cache:
    paths:
      - ccache
    key: "$CI_JOB_NAME"
  script:
    - *multilib
    - *native-environment
    - *mingw-environment
    - mkdir build
    - cd build
    - meson .. . $MESON_OPTS --prefix=$VIRT_PREFIX -Denable-gtk-doc=false -Denable-tests=false -Denable-introspection=disabled -Denable-vala=disabled --werror
    - $NINJA
    - $NINJA install

.cross_build_job_prebuilt_env:
  extends:
    - .cross_build_job
    - .gitlab_cross_build_job_prebuilt_env

.cross_build_job_local_env:
  extends:
    - .cross_build_job
    - .gitlab_cross_build_job_local_env

include: '/ci/gitlab.yml'