curl-sys 0.4.90+curl-8.21.0

Native bindings to the libcurl library
Documentation
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# Copyright (C) Viktor Szakats
#
# SPDX-License-Identifier: curl

name: 'non-native'

'on':
  push:
    branches:
      - master
      - '*/ci'
    paths-ignore:
      - '**/*.md'
      - '.circleci/**'
      - 'appveyor.*'
      - 'Dockerfile'
      - 'projects/**'
  pull_request:
    branches:
      - master
    paths-ignore:
      - '**/*.md'
      - '.circleci/**'
      - 'appveyor.*'
      - 'Dockerfile'
      - 'projects/**'

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

permissions: {}

env:
  CURL_CI: github
  CURL_TEST_MIN: 1820
  DO_NOT_TRACK: '1'

jobs:
  cross:
    name: "${{ matrix.os }} ${{ matrix.version }}, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.cc }} ${{ matrix.desc }} ${{ matrix.arch }}"
    runs-on: ubuntu-latest
    timeout-minutes: 15
    defaults:
      run:
        shell: cpa.sh {0}  # zizmor: ignore[misfeature]
    env:
      CC: '${{ matrix.cc }}'
      MAKEFLAGS: -j 3
      MATRIX_ARCH: '${{ matrix.arch }}'
      MATRIX_BUILD: '${{ matrix.build }}'
      MATRIX_INSTALL: '${{ matrix.install }}'
      MATRIX_OPTIONS: '${{ matrix.options }}'
      MATRIX_OS: '${{ matrix.os }}'
      MATRIX_VERSION: '${{ matrix.version }}'
    strategy:
      matrix:
        include:
          # https://github.com/DragonFlyBSD/DPorts
          # { os: 'dragonflybsd', version: '6.4.2', build: 'autotools', arch: 'x86_64', cc: 'gcc'  , desc: 'openssl skiprun',
          #   install: 'autoconf automake libtool openldap26-client libidn2',
          #   options: '--with-openssl --enable-ldap --enable-ldaps --with-libidn2' }

          # { os: 'dragonflybsd', version: '6.4.2', build: 'cmake'    , arch: 'x86_64', cc: 'gcc'  , desc: 'openssl skipall',
          #   install: 'cmake ninja' }

          # https://ports.freebsd.org/
          - { os: 'freebsd'     , version: '15.1',  build: 'autotools', arch: 'x86_64', cc: 'clang', desc: 'openssl',
              install: 'autoconf automake libtool krb5-devel openldap26-client libidn2 stunnel',
              options: '--with-openssl --with-gssapi --enable-ldap --enable-ldaps --with-libidn2' }

          - { os: 'freebsd'     , version: '15.1',  build: 'cmake'    , arch: 'x86_64', cc: 'clang', desc: 'openssl !unity skiprun !examples',
              install: 'cmake-core ninja perl5 krb5-devel openldap26-client libidn2',
              options: '-DCURL_USE_GSSAPI=ON -DCMAKE_UNITY_BUILD=OFF' }

          - { os: 'freebsd'     , version: '14.3',  build: 'autotools', arch: 'arm64' , cc: 'clang', desc: 'openssl !examples',
              install: 'autoconf automake libtool krb5-devel openldap26-client libidn2 stunnel',
              options: '--with-openssl --with-gssapi --enable-ldap --enable-ldaps --with-libidn2' }

          - { os: 'freebsd'     , version: '14.3',  build: 'cmake'    , arch: 'arm64' , cc: 'clang', desc: 'openssl',
              install: 'cmake-core ninja perl5 krb5-devel openldap26-client libidn2 stunnel',
              options: '-DCURL_USE_GSSAPI=ON' }

          # https://app.midnightbsd.org/
          # https://man.midnightbsd.org/cgi-bin/man.cgi/mport
          # { os: 'midnightbsd' , version: '4.0.4', build: 'autotools' , arch: 'x86_64', cc: 'clang', desc: 'gnutls skipall !examples',
          #   install: 'autoconf autoconf-archive automake libtool gnutls',
          #   options: '--with-gnutls' }

          - { os: 'midnightbsd' , version: '4.0.4', build: 'cmake'    , arch: 'x86_64', cc: 'clang', desc: 'gnutls skiprun',
              install: 'cmake-core ninja perl5 gnutls openldap26-client libidn2',
              options: '-DCURL_USE_GNUTLS=ON' }

          # https://pkgsrc.se/
          - { os: 'netbsd'      , version: '10.1' , build: 'autotools', arch: 'x86_64', cc: 'gcc'  , desc: 'openssl skipall !examples',
              install: 'autoconf automake libtool mit-krb5',
              options: '--with-openssl --with-gssapi' }

          - { os: 'netbsd'      , version: '10.1' , build: 'cmake'    , arch: 'x86_64', cc: 'gcc'  , desc: 'openssl',
              install: 'cmake ninja-build mit-krb5 openldap-client libidn2',
              options: '-DCURL_USE_GSSAPI=ON' }

          # https://openbsd.app/
          # https://www.openbsd.org/faq/faq15.html
          # https://github.com/OpenMPT/openmpt/blob/master/.github/workflows/OpenBSD-Autotools.yml
          - { os: 'openbsd'     , version: '7.9'  , build: 'autotools', arch: 'x86_64', cc: 'clang', desc: 'libressl skipall !examples',
              install: 'autoconf-2.72p0 automake-1.18.1 libtool',  # NOTE: also sync these versions with the autoreconf step!
              options: '--with-openssl' }

          - { os: 'openbsd'     , version: '7.9'  , build: 'cmake'    , arch: 'x86_64', cc: 'clang', desc: 'libressl',
              install: 'cmake ninja openldap-client-- libidn2' }

      fail-fast: false
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - name: 'setup VM'
        uses: cross-platform-actions/action@5ea7e8e4677bd726033a10b094ba1c5762b15dee # v1.3.0
        with:
          environment_variables: 'CC CURL_CI CURL_TEST_MIN DO_NOT_TRACK MAKEFLAGS MATRIX_ARCH MATRIX_BUILD MATRIX_INSTALL MATRIX_OPTIONS MATRIX_OS MATRIX_VERSION'
          operating_system: '${{ matrix.os }}'
          version: '${{ matrix.version }}'
          architecture: '${{ matrix.arch }}'

      - name: 'install prereqs'
        run: |
          if [ "${MATRIX_OS}" = 'dragonflybsd' ]; then
            sudo pkg install -y pkgconf brotli libnghttp2 ${MATRIX_INSTALL}
          elif [ "${MATRIX_OS}" = 'freebsd' ]; then
            sudo pkg install -y pkgconf brotli libnghttp2 ${MATRIX_INSTALL}
          elif [ "${MATRIX_OS}" = 'midnightbsd' ]; then
            if [ "${MATRIX_BUILD}" = 'autotools' ]; then
              sudo mport index | grep -v -E 'Downloading.+%'
              sudo mport upgrade | grep -v -E '(Downloading.+%|^/usr/local)'
            fi
            sudo mport install pkgconf brotli libnghttp2 ${MATRIX_INSTALL} | grep -v -E '(Downloading.+%|^/usr/local)' || true
          elif [ "${MATRIX_OS}" = 'netbsd' ]; then
            sudo pkgin -y install pkg-config perl brotli libssh2 libpsl nghttp2 ${MATRIX_INSTALL}
          elif [ "${MATRIX_OS}" = 'openbsd' ]; then
            sudo pkg_add -I brotli libssh2 libpsl nghttp2 ${MATRIX_INSTALL}
            if [ "${MATRIX_BUILD}" = 'autotools' ]; then
              sudo pkg_delete -I curl  # to avoid autotools build linking against system libcurl
            fi
          fi

      - name: 'autoreconf'
        if: ${{ matrix.build == 'autotools' }}
        run: |
          if [ "${MATRIX_OS}" = 'openbsd' ]; then
            if [ "${MATRIX_VERSION}" = '7.9' ]; then
              export AUTOCONF_VERSION=2.72
              export AUTOMAKE_VERSION=1.18
            fi
          fi
          autoreconf -fi

      - name: 'configure'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake -B bld -G Ninja -DCMAKE_INSTALL_PREFIX="$HOME"/curl-install \
              -DCMAKE_C_COMPILER="${CC}" \
              -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug \
              -DCURL_ENABLE_NTLM=ON ${MATRIX_OPTIONS}
          else
            if [ "${MATRIX_ARCH}" != 'x86_64' ]; then
              options='--disable-manual --disable-docs'  # Slow with autotools, skip on emulated CPU
            fi
            mkdir bld && cd bld
            ../configure --prefix="$HOME"/curl-install --enable-unity --enable-debug --enable-warnings --enable-werror --disable-static \
              --disable-dependency-tracking --enable-option-checking=fatal \
              --with-brotli --with-libssh2 --with-nghttp2  \
              ${options} ${MATRIX_OPTIONS}
          fi

      - name: 'configure log'
        if: ${{ !cancelled() }}
        run: cat bld/config.log bld/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true

      - name: 'curl_config.h'
        run: |
          echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
          grep -F '#define' bld/lib/curl_config.h | sort || true

      - name: 'build'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld
          else
            make -C bld V=1
          fi

      - name: 'curl -V'
        run: bld/src/curl --disable --version

      - name: 'curl install'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --install bld
          else
            make -C bld install
          fi

      - name: 'build tests'
        if: ${{ matrix.arch == 'x86_64' && !contains(matrix.desc, 'skipall') }}  # Slow on emulated CPU
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --target testdeps
          else
            make -C bld -C tests
          fi

      - name: 'run tests'
        if: ${{ matrix.arch == 'x86_64' && !contains(matrix.desc, 'skipall') && !contains(matrix.desc, 'skiprun') }}  # Slow on emulated CPU
        run: |
          export TFLAGS='-j8'
          if [ "${MATRIX_OS}" = 'openbsd' ]; then
            TFLAGS="$TFLAGS !2707"  # Skip 2707 'ws: Peculiar frame sizes' on suspicion of hangs
          fi
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --verbose --target test-ci
          else
            make -C bld V=1 test-ci
          fi

      - name: 'build examples'
        if: ${{ !contains(matrix.desc, '!examples') }}
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --target curl-examples-build
          else
            make -C bld examples
          fi

  amiga:
    name: "AmigaOS, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} gcc AmiSSL m68k"
    runs-on: ubuntu-latest
    timeout-minutes: 5
    env:
      MAKEFLAGS: -j 5
      MATRIX_BUILD: '${{ matrix.build }}'
      AMISSL_VERSION: '5.27'
      AMISSL_SHA256: 5003bef8c5930354d16b0ce7196d71b2811891c42fad38a9238c5ce4098ad42a
      TOOLCHAIN_VERSION: 6.5.0
      TOOLCHAIN_SHA256: 381e227c9ef552f073771d6f851cfdf873b574f3cf5db7c1c0107ea5d7146edc
    strategy:
      matrix:
        build: [autotools, cmake]
      fail-fast: false
    steps:
      - name: 'cache compiler'
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        id: cache-compiler
        with:
          path: ~/opt/amiga
          key: ${{ runner.os }}-amigaos-${{ env.TOOLCHAIN_VERSION }}-${{ env.AMISSL_VERSION }}-amd64

      - name: 'install compiler'
        if: ${{ !steps.cache-compiler.outputs.cache-hit }}
        run: |
          cd ~
          curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 --retry-connrefused \
            https://franke.ms/download/amiga-gcc.tgz --output pkg.bin
          sha256sum pkg.bin | tee /dev/stderr | grep -qwF -- "${TOOLCHAIN_SHA256}" && tar -xf pkg.bin && rm -f pkg.bin
          cd opt/amiga
          curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 --retry-connrefused \
            --location --proto-redir =https "https://github.com/jens-maus/amissl/releases/download/${AMISSL_VERSION}/AmiSSL-${AMISSL_VERSION}-SDK.lha" --output pkg.bin
          sha256sum pkg.bin | tee /dev/stderr | grep -qwF -- "${AMISSL_SHA256}" && 7z x -bd -y pkg.bin && rm -f pkg.bin

      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - name: 'configure'
        run: |
          ln -s ~/opt/amiga /opt
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake -B bld -G Ninja \
              -DAMIGA=1 \
              -DCMAKE_SYSTEM_NAME=Generic \
              -DCMAKE_SYSTEM_PROCESSOR=m68k \
              -DCMAKE_C_COMPILER_TARGET=m68k-unknown-amigaos \
              -DCMAKE_C_COMPILER=/opt/amiga/bin/m68k-amigaos-gcc \
              -DCMAKE_C_FLAGS='-O0 -msoft-float -mcrt=clib2' \
              -DCMAKE_UNITY_BUILD=ON \
              -DCURL_WERROR=ON \
              -DCURL_USE_LIBPSL=OFF \
              -DAMISSL_INCLUDE_DIR=/opt/amiga/AmiSSL/Developer/include \
              -DAMISSL_STUBS_LIBRARY=/opt/amiga/AmiSSL/Developer/lib/AmigaOS3/libamisslstubs.a \
              -DAMISSL_AUTO_LIBRARY=/opt/amiga/AmiSSL/Developer/lib/AmigaOS3/libamisslauto.a
          else
            autoreconf -fi
            mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
              --disable-dependency-tracking --enable-option-checking=fatal \
              CC=/opt/amiga/bin/m68k-amigaos-gcc \
              AR=/opt/amiga/bin/m68k-amigaos-ar \
              RANLIB=/opt/amiga/bin/m68k-amigaos-ranlib \
              --host=m68k-amigaos \
              --disable-shared \
              --without-libpsl \
              --with-amissl \
              LDFLAGS=-L/opt/amiga/AmiSSL/Developer/lib/AmigaOS3 \
              CPPFLAGS=-I/opt/amiga/AmiSSL/Developer/include \
              CFLAGS='-O0 -msoft-float -mcrt=clib2' \
              LIBS='-lnet -lm -latomic'
          fi

      - name: 'configure log'
        if: ${{ !cancelled() }}
        run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true

      - name: 'curl_config.h'
        run: |
          echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
          grep -F '#define' bld/lib/curl_config.h | sort || true

      - name: 'build'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld
          else
            make -C bld
          fi

      - name: 'curl info'
        run: |
          find . -type f \( -name curl -o -name '*.a' \) -print0 | xargs -0 file --
          find . -type f \( -name curl -o -name '*.a' \) -print0 | xargs -0 stat -c '%10s bytes: %n' --

      - name: 'build tests'
        if: ${{ matrix.build == 'cmake' }}  # skip for autotools to save time
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --target testdeps
          else
            make -C bld -C tests
          fi

      - name: 'build examples'
        if: ${{ matrix.build == 'cmake' }}  # skip for autotools to save time
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --target curl-examples-build
          else
            make -C bld examples
          fi

  android:
    name: "Android ${{ matrix.platform }}, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.name }} arm64"
    runs-on: ubuntu-latest
    timeout-minutes: 5
    env:
      LDFLAGS: -s
      MAKEFLAGS: -j 5
      MATRIX_BUILD: '${{ matrix.build }}'
    strategy:
      matrix:
        include:
          - { build: 'autotools', platform: '21', name: "!ssl !zstd",
              options: '--without-ssl --without-libpsl --without-zstd' }

          - { build: 'cmake'    , platform: '21', name: "!ssl !zstd",
              options: '-DCURL_ENABLE_SSL=OFF -DCURL_USE_LIBPSL=OFF -DCURL_ZSTD=OFF' }

          - { build: 'autotools', platform: '35', name: "!ssl !zstd",
              options: '--without-ssl --without-libpsl --without-zstd' }

          - { build: 'cmake'    , platform: '35', name: "!ssl !zstd",
              options: '-DCURL_ENABLE_SSL=OFF -DCURL_USE_LIBPSL=OFF -DCURL_ZSTD=OFF' }

      fail-fast: false
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - name: 'autoreconf'
        if: ${{ matrix.build == 'autotools' }}
        run: autoreconf -fi

      - name: 'configure'
        env:
          MATRIX_OPTIONS: '${{ matrix.options }}'
          MATRIX_PLATFORM: '${{ matrix.platform }}'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then  # https://developer.android.com/ndk/guides/cmake
            cmake -B bld -G Ninja \
              -DANDROID_ABI=arm64-v8a \
              -DANDROID_PLATFORM="android-${MATRIX_PLATFORM}" \
              -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" -DCMAKE_WARN_DEPRECATED=OFF \
              -DCMAKE_UNITY_BUILD=ON \
              -DCURL_WERROR=ON \
              ${MATRIX_OPTIONS}
          else
            TOOLCHAIN="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64"
            mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror --disable-shared \
              --disable-dependency-tracking --enable-option-checking=fatal \
              CC="$TOOLCHAIN/bin/aarch64-linux-android${MATRIX_PLATFORM}-clang" \
              AR="$TOOLCHAIN/bin/llvm-ar" \
              RANLIB="$TOOLCHAIN/bin/llvm-ranlib" \
              --host="aarch64-linux-android${MATRIX_PLATFORM}" \
              ${MATRIX_OPTIONS}
          fi

      - name: 'configure log'
        if: ${{ !cancelled() }}
        run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true

      - name: 'dump config files'
        run: |
          for f in libcurl.pc curl-config; do
            echo "::group::${f}"; grep -v '^#' bld/"${f}" || true; echo '::endgroup::'
          done

      - name: 'curl_config.h'
        run: |
          echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
          grep -F '#define' bld/lib/curl_config.h | sort || true

      - name: 'build'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --verbose
          else
            make -C bld V=1
          fi

      - name: 'curl info'
        run: |
          find . -type f \( -name curl -o -name '*.so' -o -name '*.a' \) -print0 | xargs -0 file --
          find . -type f \( -name curl -o -name '*.so' -o -name '*.a' \) -print0 | xargs -0 stat -c '%10s bytes: %n' --

      - name: 'build tests'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --target testdeps
          else
            make -C bld -C tests
          fi

      - name: 'build examples'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --target curl-examples-build
          else
            make -C bld examples
          fi

  msdos:
    name: "MS-DOS, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} djgpp !ssl i586"
    runs-on: ubuntu-latest
    timeout-minutes: 5
    env:
      LDFLAGS: -s
      MAKEFLAGS: -j 5
      MATRIX_BUILD: '${{ matrix.build }}'
      # renovate: datasource=github-releases depName=andrewwutw/build-djgpp versioning=semver-coerced registryUrl=https://github.com
      TOOLCHAIN_VERSION: '3.4'
      TOOLCHAIN_SHA256: 8464f17017d6ab1b2bb2df4ed82357b5bf692e6e2b7fee37e315638f3d505f00
    strategy:
      matrix:
        build: [autotools, cmake]
      fail-fast: false
    steps:
      - name: 'install packages'
        timeout-minutes: 2
        run: |
          sudo find /etc/apt/sources.list.d -type f -not -name 'ubuntu.sources' -delete -print
          sudo sed -i 's/priority:1/priority:9/' /etc/apt/apt-mirrors.txt; cat /etc/apt/apt-mirrors.txt
          sudo apt-get -o Dpkg::Use-Pty=0 update
          sudo apt-get -o Dpkg::Use-Pty=0 install libfl2

      - name: 'cache compiler (djgpp)'
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        id: cache-compiler
        with:
          path: ~/djgpp
          key: ${{ runner.os }}-djgpp-${{ env.TOOLCHAIN_VERSION }}-amd64

      - name: 'install compiler (djgpp)'
        if: ${{ !steps.cache-compiler.outputs.cache-hit }}
        run: |
          cd ~
          curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 --retry-connrefused \
            --location --proto-redir =https "https://github.com/andrewwutw/build-djgpp/releases/download/v${TOOLCHAIN_VERSION}/djgpp-linux64-gcc1220.tar.bz2" --output pkg.bin
          sha256sum pkg.bin | tee /dev/stderr | grep -qwF -- "${TOOLCHAIN_SHA256}" && tar -xjf pkg.bin && rm -f pkg.bin
          cd djgpp
          curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 --retry-connrefused \
            https://www.delorie.com/pub/djgpp/current/v2tk/wat3211b.zip --output pkg.bin
          sha256sum pkg.bin | tee /dev/stderr | grep -qwF faa2222ab5deb2c2aac229c760bf4d45aca5379f5af97865c308a0467046b67a && unzip -q pkg.bin && rm -f pkg.bin
          curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 --retry-connrefused \
            https://www.delorie.com/pub/djgpp/current/v2tk/zlb13b.zip --output pkg.bin
          sha256sum pkg.bin | tee /dev/stderr | grep -qwF f3d2fa8129e7591c7e79074306d8ab91a70ec172cc01baedeae74992285dd3a3 && unzip -q pkg.bin && rm -f pkg.bin

      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      - name: 'configure'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake -B bld -G Ninja \
              -DCMAKE_SYSTEM_NAME=DOS \
              -DCMAKE_SYSTEM_PROCESSOR=x86 \
              -DCMAKE_C_COMPILER_TARGET=i586-pc-msdosdjgpp \
              -DCMAKE_C_COMPILER="$HOME"/djgpp/bin/i586-pc-msdosdjgpp-gcc \
              -DCMAKE_UNITY_BUILD=ON \
              -DCURL_WERROR=ON \
              -DCURL_ENABLE_SSL=OFF -DCURL_USE_LIBPSL=OFF \
              -DZLIB_INCLUDE_DIR="$HOME"/djgpp/include \
              -DZLIB_LIBRARY="$HOME"/djgpp/lib/libz.a \
              -DWATT_ROOT="$HOME"/djgpp/net/watt
          else
            autoreconf -fi
            mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror --disable-shared \
              --disable-dependency-tracking --enable-option-checking=fatal \
              CC="$HOME"/djgpp/bin/i586-pc-msdosdjgpp-gcc \
              AR="$HOME"/djgpp/bin/i586-pc-msdosdjgpp-ar \
              RANLIB="$HOME"/djgpp/bin/i586-pc-msdosdjgpp-ranlib \
              WATT_ROOT="$HOME"/djgpp/net/watt \
              --host=i586-pc-msdosdjgpp \
              --without-ssl --without-libpsl \
              --with-zlib="$HOME"/djgpp
          fi

      - name: 'configure log'
        if: ${{ !cancelled() }}
        run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true

      - name: 'curl_config.h'
        run: |
          echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
          grep -F '#define' bld/lib/curl_config.h | sort || true

      - name: 'build'
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld
          else
            make -C bld
          fi

      - name: 'curl info'
        run: |
          find . \( -name '*.exe' -o -name '*.a' \) -print0 | xargs -0 file --
          find . \( -name '*.exe' -o -name '*.a' \) -print0 | xargs -0 stat -c '%10s bytes: %n' --

      - name: 'build tests'
        if: ${{ matrix.build == 'cmake' }}  # skip for autotools to save time
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --target testdeps
          else
            make -C bld -C tests
          fi

      - name: 'build examples'
        if: ${{ matrix.build == 'cmake' }}  # skip for autotools to save time
        run: |
          if [ "${MATRIX_BUILD}" = 'cmake' ]; then
            cmake --build bld --target curl-examples-build
          else
            make -C bld examples
          fi