File: multiarch.yml

package info (click to toggle)
zxc 0.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,468 kB
  • sloc: ansic: 7,730; sh: 604; python: 239; javascript: 214; cpp: 133; makefile: 8
file content (337 lines) | stat: -rw-r--r-- 12,355 bytes parent folder | download
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
name: Multi-Architecture Build

on:
  workflow_dispatch:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

permissions:
  contents: read

concurrency:
  cancel-in-progress: true
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
  # ===========================================================================
  # Tier 1: Main architectures
  # ===========================================================================
  build-tier1:
    name: "Tier 1: ${{ matrix.name }}"
    runs-on: ${{ matrix.runner }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Linux x64
            runner: ubuntu-latest
            os: linux
            arch_flags: ""
          - name: Linux x86 (32-bit)
            runner: ubuntu-latest
            os: linux
            install_32bit_x86: true
            arch_flags: "-m32"
          - name: Linux ARM64
            runner: ubuntu-24.04-arm
            os: linux
            arch_flags: ""
          - name: Linux ARM (32-bit)
            runner: ubuntu-latest
            os: linux
            install_32bit_arm: true
            cross_compiler_c: arm-linux-gnueabihf-gcc
            cross_compiler_cxx: arm-linux-gnueabihf-g++
            cross_strip: arm-linux-gnueabihf-strip
            cmake_system_name: "Linux"
            cmake_system_processor: "arm"
          - name: Windows x64
            runner: windows-latest
            os: windows
            cmake_arch: "x64"
          - name: Windows x86 (32-bit)
            runner: windows-latest
            os: windows
            cmake_arch: "Win32"
          - name: Windows ARM64
            runner: windows-11-arm
            os: windows
            cmake_arch: "ARM64"
          # Note: Windows ARM 32-bit removed - deprecated and unsupported by Windows SDK 10.0.26100+
          - name: macOS Intel x64
            runner: macos-15-intel
            os: macos
          - name: macOS ARM64
            runner: macos-latest
            os: macos

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v6

      # Case: Linux x86 (32-bit)
      - name: Install x86 32-bit libs
        if: matrix.install_32bit_x86
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-multilib g++-multilib

      # Case: Linux ARM (32-bit)
      - name: Install ARM 32-bit toolchain
        if: matrix.install_32bit_arm
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf

      - name: Configure, Build & Test (Static & Shared)
        shell: bash
        run: |
          # Initialize variables
          EXTRA_ARGS="-DZXC_NATIVE_ARCH=OFF" # Disable native arch detection (Runtime Dispatch enabled)
          
          # Setup Environment for Linux/Mac (Flags & Cross-compilation)
          if [ "${{ matrix.os }}" != "windows" ]; then
             # Handle C flags (e.g., -m32)
             if [ ! -z "${{ matrix.arch_flags }}" ]; then
                export CFLAGS="${{ matrix.arch_flags }}"
                export CXXFLAGS="${{ matrix.arch_flags }}"
             fi
             
             # Handle cross-compiler (e.g., ARM 32-bit on Linux)
             if [ ! -z "${{ matrix.cross_compiler_c }}" ]; then
                EXTRA_ARGS="$EXTRA_ARGS -DCMAKE_C_COMPILER=${{ matrix.cross_compiler_c }} -DCMAKE_CXX_COMPILER=${{ matrix.cross_compiler_cxx }}"
             fi

             # Handle explicit System Name/Processor (crucial for cross-compilation)
             if [ ! -z "${{ matrix.cmake_system_name }}" ]; then
                EXTRA_ARGS="$EXTRA_ARGS -DCMAKE_SYSTEM_NAME=${{ matrix.cmake_system_name }}"
             fi
             if [ ! -z "${{ matrix.cmake_system_processor }}" ]; then
                EXTRA_ARGS="$EXTRA_ARGS -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.cmake_system_processor }}"
             fi
             
             # Handle cross-strip tool (e.g., ARM 32-bit on Linux)
             if [ ! -z "${{ matrix.cross_strip }}" ]; then
                EXTRA_ARGS="$EXTRA_ARGS -DCMAKE_STRIP=/usr/bin/${{ matrix.cross_strip }}"
             fi
          fi

          # Iterate over Library Types
          for LIB_TYPE in "STATIC" "SHARED"; do
              echo ">>> Starting Build: $LIB_TYPE"
              BUILD_DIR="build_${LIB_TYPE}"
              
              SHARED_FLAG="OFF"
              if [ "$LIB_TYPE" == "SHARED" ]; then SHARED_FLAG="ON"; fi
              
              CURRENT_ARGS="$EXTRA_ARGS -DBUILD_SHARED_LIBS=$SHARED_FLAG"

              # 1. Configure
              if [ "${{ matrix.os }}" = "windows" ]; then
                  # Visual Studio Generator
                  cmake -S . -B $BUILD_DIR -A ${{ matrix.cmake_arch }} $CURRENT_ARGS
              else
                  # Ninja/Makefiles
                  cmake -S . -B $BUILD_DIR -DCMAKE_BUILD_TYPE=Release $CURRENT_ARGS
              fi
              
              # 2. Build
              cmake --build $BUILD_DIR --config Release --parallel
              
              # 3. Test (Skip if cross-compiling)
              if [ -z "${{ matrix.cross_compiler_c }}" ]; then
                  echo "Running Tests for $LIB_TYPE..."
                  ctest --test-dir $BUILD_DIR -C Release --output-on-failure
              else
                  echo "Skipping tests for $LIB_TYPE (Cross-compilation)"
              fi
              echo ">>> Completed Build: $LIB_TYPE"
              echo ""
          done

  # ===========================================================================
  # Tier 2: Extended Linux architectures (cross-compiled, tested via QEMU)
  # ===========================================================================
  build-tier2:
    name: "Tier 2: ${{ matrix.name }}"
    runs-on: ubuntu-latest
    container: debian:trixie
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Linux amd64
            cross_pkg: gcc
            cross_prefix: x86_64-linux-gnu
            cmake_processor: x86_64
            qemu_binary: qemu-x86_64
          - name: Linux arm64
            cross_pkg: gcc-aarch64-linux-gnu
            cross_prefix: aarch64-linux-gnu
            cmake_processor: aarch64
            qemu_binary: qemu-aarch64
          - name: Linux i386
            cross_pkg: gcc-i686-linux-gnu
            cross_prefix: i686-linux-gnu
            cmake_processor: i686
            qemu_binary: qemu-i386
          - name: Linux RISC-V 64
            cross_pkg: gcc-riscv64-linux-gnu
            cross_prefix: riscv64-linux-gnu
            cmake_processor: riscv64
            qemu_binary: qemu-riscv64
          - name: Linux s390x
            cross_pkg: gcc-s390x-linux-gnu
            cross_prefix: s390x-linux-gnu
            cmake_processor: s390x
            qemu_binary: qemu-s390x
          - name: Linux armhf
            cross_pkg: gcc-arm-linux-gnueabihf
            cross_prefix: arm-linux-gnueabihf
            cmake_processor: arm
            qemu_binary: qemu-arm
          - name: Linux ppc64el
            cross_pkg: gcc-powerpc64le-linux-gnu
            cross_prefix: powerpc64le-linux-gnu
            cmake_processor: ppc64le
            qemu_binary: qemu-ppc64le
          - name: Linux mipsel
            cross_pkg: gcc-mipsel-linux-gnu
            cross_prefix: mipsel-linux-gnu
            cmake_processor: mipsel
            qemu_binary: qemu-mipsel
          - name: Linux powerpc
            cross_pkg: gcc-powerpc-linux-gnu
            cross_prefix: powerpc-linux-gnu
            cmake_processor: powerpc
            qemu_binary: qemu-ppc
          - name: Linux ppc64
            cross_pkg: gcc-powerpc64-linux-gnu
            cross_prefix: powerpc64-linux-gnu
            cmake_processor: ppc64
            qemu_binary: qemu-ppc64
          - name: Linux sparc64
            cross_pkg: gcc-sparc64-linux-gnu
            cross_prefix: sparc64-linux-gnu
            cmake_processor: sparc64
            qemu_binary: qemu-sparc64
          - name: Linux armel
            cross_pkg: gcc-arm-linux-gnueabi
            cross_prefix: arm-linux-gnueabi
            cmake_processor: arm
            qemu_binary: qemu-arm

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v6

      - name: Install cross-compiler
        run: |
          apt-get update
          apt-get install -y cmake build-essential ninja-build ${{ matrix.cross_pkg }} qemu-user

      - name: Configure, Build & Test (Static & Shared)
        shell: bash
        run: |
          CROSS_C=${{ matrix.cross_prefix }}-gcc
          CROSS_CXX=${{ matrix.cross_prefix }}-g++
          CROSS_STRIP=/usr/bin/${{ matrix.cross_prefix }}-strip
          SYSROOT=/usr/${{ matrix.cross_prefix }}

          for LIB_TYPE in "STATIC" "SHARED"; do
              echo ">>> Starting Build: $LIB_TYPE"
              BUILD_DIR="build_${LIB_TYPE}"

              SHARED_FLAG="OFF"
              if [ "$LIB_TYPE" == "SHARED" ]; then SHARED_FLAG="ON"; fi

              cmake -S . -B $BUILD_DIR \
                  -DCMAKE_BUILD_TYPE=Release \
                  -DCMAKE_C_COMPILER=$CROSS_C \
                  -DCMAKE_CXX_COMPILER=$CROSS_CXX \
                  -DCMAKE_STRIP=$CROSS_STRIP \
                  -DCMAKE_SYSTEM_NAME=Linux \
                  -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.cmake_processor }} \
                  -DZXC_NATIVE_ARCH=OFF \
                  -DBUILD_SHARED_LIBS=$SHARED_FLAG

              cmake --build $BUILD_DIR --config Release --parallel

              echo "Running Tests for $LIB_TYPE via QEMU..."
              ${{ matrix.qemu_binary }} -L $SYSROOT ./$BUILD_DIR/zxc_test

              echo ">>> Completed Build: $LIB_TYPE"
              echo ""
          done

  # ===========================================================================
  # Tier 3: Experimental Linux architectures (cross-compiled, tested via QEMU)
  # ===========================================================================
  build-tier3:
    name: "Tier 3: ${{ matrix.name }}"
    runs-on: ubuntu-latest
    container: debian:trixie
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Linux mips64el
            cross_pkg: gcc-mips64el-linux-gnuabi64
            cross_prefix: mips64el-linux-gnuabi64
            cmake_processor: mips64
            qemu_binary: qemu-mips64el
          - name: Linux loong64
            cross_pkg: gcc-loongarch64-linux-gnu
            cross_prefix: loongarch64-linux-gnu
            cmake_processor: loongarch64
            qemu_binary: qemu-loongarch64
          - name: Linux alpha
            cross_pkg: gcc-alpha-linux-gnu
            cross_prefix: alpha-linux-gnu
            cmake_processor: alpha
            qemu_binary: qemu-alpha

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v6

      - name: Install cross-compiler
        run: |
          apt-get update
          apt-get install -y cmake build-essential ninja-build ${{ matrix.cross_pkg }} qemu-user

      - name: Configure, Build & Test (Static & Shared)
        shell: bash
        run: |
          CROSS_C=${{ matrix.cross_prefix }}-gcc
          CROSS_CXX=${{ matrix.cross_prefix }}-g++
          CROSS_STRIP=/usr/bin/${{ matrix.cross_prefix }}-strip
          SYSROOT=/usr/${{ matrix.cross_prefix }}

          for LIB_TYPE in "STATIC" "SHARED"; do
              echo ">>> Starting Build: $LIB_TYPE"
              BUILD_DIR="build_${LIB_TYPE}"

              SHARED_FLAG="OFF"
              if [ "$LIB_TYPE" == "SHARED" ]; then SHARED_FLAG="ON"; fi

              cmake -S . -B $BUILD_DIR \
                  -DCMAKE_BUILD_TYPE=Release \
                  -DCMAKE_C_COMPILER=$CROSS_C \
                  -DCMAKE_CXX_COMPILER=$CROSS_CXX \
                  -DCMAKE_STRIP=$CROSS_STRIP \
                  -DCMAKE_SYSTEM_NAME=Linux \
                  -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.cmake_processor }} \
                  -DZXC_NATIVE_ARCH=OFF \
                  -DBUILD_SHARED_LIBS=$SHARED_FLAG

              cmake --build $BUILD_DIR --config Release --parallel

              echo "Running Tests for $LIB_TYPE via QEMU..."
              ${{ matrix.qemu_binary }} -L $SYSROOT ./$BUILD_DIR/zxc_test

              echo ">>> Completed Build: $LIB_TYPE"
              echo ""
          done