2929 fail-fast : false
3030 matrix :
3131 arch : [x86-64]
32+ family : [x86-64]
3233 compiler : [gcc, clang]
3334 container :
3435 - archlinux:latest
@@ -54,27 +55,31 @@ jobs:
5455 # Debian 32-bit builds
5556 - container : " debian:testing"
5657 arch : i386
58+ family : x86
5759 compiler : gcc -m32
5860 cross_compile : i686-linux-gnu
5961 pkg_config_path : /usr/lib/i386-linux-gnu/pkgconfig
6062 variant : i386
6163
6264 - container : " debian:stable"
6365 arch : i386
66+ family : x86
6467 compiler : gcc -m32
6568 cross_compile : i686-linux-gnu
6669 pkg_config_path : /usr/lib/i386-linux-gnu/pkgconfig
6770 variant : i386
6871
6972 - container : " debian:bookworm"
7073 arch : i386
74+ family : x86
7175 compiler : gcc -m32
7276 cross_compile : i686-linux-gnu
7377 pkg_config_path : /usr/lib/i386-linux-gnu/pkgconfig
7478 variant : i386
7579
7680 - container : " debian:buster"
7781 arch : i386
82+ family : x86
7883 compiler : gcc -m32
7984 cross_compile : i686-linux-gnu
8085 pkg_config_path : /usr/lib/i386-linux-gnu/pkgconfig
@@ -83,55 +88,63 @@ jobs:
8388 # Debian cross compilation builds
8489 - container : " debian:testing"
8590 arch : armhf
91+ family : arm
8692 compiler : arm-linux-gnueabihf-gcc
8793 cross_compile : arm-linux-gnueabihf
8894 pkg_config_path : /usr/lib/arm-linux-gnueabihf/pkgconfig
8995 variant : cross-compile
9096
9197 - container : " debian:testing"
9298 arch : arm64
99+ family : aarch64
93100 compiler : aarch64-linux-gnu-gcc
94101 cross_compile : aarch64-linux-gnu
95102 pkg_config_path : /usr/lib/aarch64-linux-gnu/pkgconfig
96103 variant : cross-compile
97104
98105 - container : " debian:testing"
99106 arch : ppc64el
107+ family : ppc64
100108 compiler : powerpc64le-linux-gnu-gcc
101109 cross_compile : powerpc64le-linux-gnu
102110 pkg_config_path : /usr/lib/powerpc64le-linux-gnu/pkgconfig
103111 variant : cross-compile
104112
105113 - container : " debian:testing"
106114 arch : s390x
115+ family : s390x
107116 compiler : s390x-linux-gnu-gcc
108117 cross_compile : s390x-linux-gnu
109118 pkg_config_path : /usr/lib/s390x-linux-gnu/pkgconfig
110119 variant : cross-compile
111120
112121 - container : " debian:stable"
113122 arch : armhf
123+ family : arm
114124 compiler : arm-linux-gnueabihf-gcc
115125 cross_compile : arm-linux-gnueabihf
116126 pkg_config_path : /usr/lib/arm-linux-gnueabihf/pkgconfig
117127 variant : cross-compile
118128
119129 - container : " debian:stable"
120130 arch : arm64
131+ family : aarch64
121132 compiler : aarch64-linux-gnu-gcc
122133 cross_compile : aarch64-linux-gnu
123134 pkg_config_path : /usr/lib/aarch64-linux-gnu/pkgconfig
124135 variant : cross-compile
125136
126137 - container : " debian:stable"
127138 arch : ppc64el
139+ family : ppc64
128140 compiler : powerpc64le-linux-gnu-gcc
129141 cross_compile : powerpc64le-linux-gnu
130142 pkg_config_path : /usr/lib/powerpc64le-linux-gnu/pkgconfig
131143 variant : cross-compile
132144
133145 - container : " debian:stable"
134146 arch : s390x
147+ family : s390x
135148 compiler : s390x-linux-gnu-gcc
136149 cross_compile : s390x-linux-gnu
137150 pkg_config_path : /usr/lib/s390x-linux-gnu/pkgconfig
@@ -141,9 +154,9 @@ jobs:
141154 image : ${{ matrix.container }}
142155 env :
143156 ARCH : ${{ matrix.arch }}
157+ FAMILY : ${{ matrix.family }}
144158 CC : ${{ matrix.compiler }}
145159 CROSS_COMPILE : ${{ matrix.cross_compile }}
146- MODE : ${{ matrix.mode }}
147160 PKG_CONFIG_PATH : ${{ matrix.pkg_config_path }}
148161 VARIANT : ${{ matrix.variant }}
149162
@@ -154,10 +167,11 @@ jobs:
154167 - name : Show env (matrix settings)
155168 run : |
156169 echo "ARCH: $ARCH"
170+ echo "FAMILY: $FAMILY"
157171 echo "CC: $CC"
158172 echo "CROSS_COMPILE: $CROSS_COMPILE"
159- echo "MODE: $MODE"
160173 echo "VARIANT: $VARIANT"
174+ echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
161175
162176 - name : Git checkout
163177 uses : actions/checkout@v3
@@ -187,14 +201,42 @@ jobs:
187201 echo "############################################"
188202 printenv
189203
204+ # i386 build on x86_64 only requires passing -m32 to CFLAGS & LDFLAGS
205+ - name : Meson init for i386
206+ if : ${{ matrix.container != 'ubuntu:xenial' && matrix.variant == 'i386' }}
207+ run : |
208+ mkdir build
209+ CFLAGS="-m32" LDFLAGS="-m32" meson setup . build
210+
211+ - name : Meson init with cross compile
212+ if : ${{ matrix.container != 'ubuntu:xenial' && matrix.variant == 'cross-compile' }}
213+ run : |
214+ # Generate cross compile file (see https://mesonbuild.com/Cross-compilation.html#cross-compilation)
215+ echo "[binaries]" > cross.txt
216+ echo "c = '${CROSS_COMPILE}-gcc'" >> cross.txt
217+ echo "strip = '${CROSS_COMPILE}-strip'" >> cross.txt
218+ # Forcing pkgconfig binary to 'pkg-config' is required for cross build to work
219+ echo "pkgconfig = 'pkg-config'" >> cross.txt
220+ echo "[host_machine]" >> cross.txt
221+ echo "system = 'linux'" >> cross.txt
222+ echo "cpu_family = '${FAMILY}'" >> cross.txt
223+ echo "cpu = '${ARCH}'" >> cross.txt
224+ echo "endian = 'little'" >> cross.txt
225+ echo "[properties]" >> cross.txt
226+ echo "pkg_config_libdir = '${PKG_CONFIG_PATH}'" >> cross.txt
227+ cat cross.txt
228+ mkdir build
229+ meson setup --cross-file cross.txt . build
230+
190231 - name : Meson init
191- if : ${{ matrix.arch == 'x86-64 ' && matrix.container != 'ubuntu:xenial ' }}
232+ if : ${{ matrix.container != 'ubuntu:xenial ' && matrix.variant == ' ' }}
192233 run : |
193234 mkdir build
235+ # Ubuntu Xenial Meson version doesn't support meson setup, so use old way by default
194236 meson . build
195237
196238 - name : Ninja build
197- if : ${{ matrix.arch == 'x86-64' && matrix. container != 'ubuntu:xenial' }}
239+ if : ${{ matrix.container != 'ubuntu:xenial' }}
198240 run : ninja -C build
199241
200242 - name : Compile
0 commit comments