2
0

macos.yml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  2. #
  3. # SPDX-License-Identifier: curl
  4. name: macOS
  5. 'on':
  6. push:
  7. branches:
  8. - master
  9. - '*/ci'
  10. paths-ignore:
  11. - '**/*.md'
  12. - '.circleci/**'
  13. - 'appveyor.*'
  14. - 'packages/**'
  15. - 'plan9/**'
  16. - 'projects/**'
  17. - 'winbuild/**'
  18. pull_request:
  19. branches:
  20. - master
  21. paths-ignore:
  22. - '**/*.md'
  23. - '.circleci/**'
  24. - 'appveyor.*'
  25. - 'packages/**'
  26. - 'plan9/**'
  27. - 'projects/**'
  28. - 'winbuild/**'
  29. concurrency:
  30. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
  31. cancel-in-progress: true
  32. permissions: {}
  33. # Deprecated Apple APIs and the macos-version-min value required to avoid
  34. # deprecation warnings with llvm/clang:
  35. #
  36. # - 10.7 Lion (2011) - GSS
  37. # - 10.8 Mountain Lion (2012) - CFURLCreateDataAndPropertiesFromResource (used by curl Secure Transport code)
  38. # - 10.9 Maverick (2013) - LDAP
  39. # - 10.14 Mojave (2018) - Secure Transport
  40. #
  41. # For Secure Transport, curl implements features that require a target
  42. # newer than the 10.8 required by `CFURLCreateDataAndPropertiesFromResource`.
  43. # In this case `-Wno-deprecated-declarations` still comes handy to pacify
  44. # deprecation warnings, though the real solution would be to avoid calling
  45. # that function.
  46. env:
  47. LDFLAGS: -w # suppress 'object file was built for newer macOS version than being linked' warnings
  48. MAKEFLAGS: -j 4
  49. jobs:
  50. macos:
  51. name: "${{ matrix.build.generate && 'CM' || 'AM' }} ${{ matrix.compiler }} ${{ matrix.build.name }}"
  52. runs-on: 'macos-latest'
  53. timeout-minutes: 45
  54. env:
  55. DEVELOPER_DIR: "/Applications/Xcode${{ matrix.build.xcode && format('_{0}', matrix.build.xcode) || '' }}.app/Contents/Developer"
  56. CC: ${{ matrix.compiler }}
  57. CFLAGS: ''
  58. strategy:
  59. fail-fast: false
  60. matrix:
  61. compiler: [clang, llvm@15, gcc-12]
  62. build:
  63. # automake
  64. - name: '!ssl !debug brotli zstd'
  65. compiler: clang
  66. install: brotli zstd
  67. configure: --without-ssl --with-brotli --with-zstd
  68. macos-version-min: '10.9'
  69. - name: '!ssl !debug'
  70. compiler: gcc-12
  71. configure: --without-ssl
  72. macos-version-min: '10.9'
  73. - name: '!ssl'
  74. compiler: clang
  75. configure: --enable-debug --without-ssl
  76. macos-version-min: '10.9'
  77. - name: '!ssl libssh2 AppleIDN'
  78. compiler: clang
  79. configure: --enable-debug --with-libssh2=$(brew --prefix libssh2) --without-ssl --with-apple-idn
  80. macos-version-min: '10.9'
  81. - name: 'OpenSSL libssh c-ares'
  82. compiler: clang
  83. install: libssh
  84. configure: --enable-debug --with-libssh --with-openssl=$(brew --prefix openssl) --enable-ares
  85. macos-version-min: '10.9'
  86. - name: 'OpenSSL libssh'
  87. compiler: llvm@15
  88. install: libssh
  89. configure: --enable-debug --with-libssh --with-openssl=$(brew --prefix openssl)
  90. macos-version-min: '10.9'
  91. - name: '!ssl c-ares'
  92. compiler: clang
  93. configure: --enable-debug --enable-ares --without-ssl
  94. macos-version-min: '10.9'
  95. - name: '!ssl HTTP-only'
  96. compiler: clang
  97. configure: >-
  98. --enable-debug
  99. --disable-alt-svc --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap
  100. --disable-ldap --disable-pop3 --disable-rtmp --disable-rtsp --disable-scp --disable-sftp
  101. --disable-shared --disable-smb --disable-smtp --disable-telnet --disable-tftp --disable-unix-sockets
  102. --without-brotli --without-gssapi --without-libidn2 --without-libpsl --without-librtmp --without-libssh2
  103. --without-nghttp2 --without-ntlm-auth --without-ssl --without-zlib --without-zstd
  104. macos-version-min: '10.15' # Catalina (2019)
  105. - name: 'SecureTransport libssh2'
  106. compiler: clang
  107. configure: --enable-debug --with-secure-transport --with-libssh2=$(brew --prefix libssh2)
  108. macos-version-min: '10.8'
  109. - name: 'SecureTransport libssh2 10.12'
  110. compiler: clang
  111. configure: --enable-debug --with-secure-transport --with-libssh2=$(brew --prefix libssh2)
  112. macos-version-min: '10.12' # for monotonic timers
  113. cflags: '-Wno-deprecated-declarations'
  114. - name: 'SecureTransport libssh2'
  115. compiler: gcc-12
  116. configure: --enable-debug --with-secure-transport --with-libssh2=$(brew --prefix libssh2)
  117. macos-version-min: '10.8'
  118. - name: 'LibreSSL +examples'
  119. compiler: clang
  120. install: libressl
  121. configure: --enable-debug --with-openssl=$(brew --prefix libressl)
  122. macos-version-min: '10.9'
  123. - name: 'OpenSSL'
  124. compiler: clang
  125. configure: --enable-debug --with-openssl=$(brew --prefix openssl)
  126. macos-version-min: '10.9'
  127. - name: 'OpenSSL event-based'
  128. compiler: clang
  129. configure: --enable-debug --with-openssl=$(brew --prefix openssl)
  130. macos-version-min: '10.9'
  131. tflags: --test-event
  132. - name: 'OpenSSL libssh2 !ldap 10.15'
  133. compiler: clang
  134. configure: --enable-debug --disable-ldap --with-openssl=$(brew --prefix openssl)
  135. macos-version-min: '10.15'
  136. # cmake
  137. - name: 'OpenSSL gsasl AppleIDN'
  138. install: gsasl
  139. generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_USE_GSASL=ON -DUSE_APPLE_IDN=ON
  140. macos-version-min: '10.9'
  141. - name: 'OpenSSL +static libssh +examples'
  142. install: libssh
  143. generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DBUILD_STATIC_LIBS=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
  144. macos-version-min: '10.9'
  145. - name: 'SecureTransport debug'
  146. generate: -DCURL_USE_SECTRANSP=ON -DENABLE_DEBUG=ON
  147. macos-version-min: '10.8'
  148. - name: 'LibreSSL !ldap heimdal c-ares +examples'
  149. install: libressl heimdal
  150. generate: -DOPENSSL_ROOT_DIR=$(brew --prefix libressl) -DENABLE_ARES=ON -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix heimdal) -DCURL_DISABLE_LDAP=ON
  151. macos-version-min: '10.15'
  152. - name: 'wolfSSL !ldap brotli zstd'
  153. install: brotli wolfssl zstd
  154. generate: -DCURL_USE_WOLFSSL=ON -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_DISABLE_LDAP=ON -DUSE_HTTPSRR=ON -DUSE_ECH=ON
  155. macos-version-min: '10.15'
  156. - name: 'mbedTLS !ldap brotli zstd'
  157. install: brotli mbedtls zstd
  158. generate: -DCURL_USE_MBEDTLS=ON -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_DISABLE_LDAP=ON
  159. macos-version-min: '10.15'
  160. - name: 'GnuTLS !ldap krb5'
  161. install: gnutls nettle krb5
  162. generate: -DCURL_USE_GNUTLS=ON -DCURL_USE_OPENSSL=OFF -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix krb5) -DCURL_DISABLE_LDAP=ON
  163. macos-version-min: '10.15'
  164. - name: 'OpenSSL torture !FTP'
  165. generate: -DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_THREADED_RESOLVER=OFF -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_BROTLI=ON -DCURL_ZSTD=ON
  166. tflags: -t --shallow=25 !FTP
  167. macos-version-min: '10.9'
  168. torture: true
  169. - name: 'OpenSSL torture FTP'
  170. generate: -DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_THREADED_RESOLVER=OFF -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_BROTLI=ON -DCURL_ZSTD=ON
  171. tflags: -t --shallow=20 FTP
  172. macos-version-min: '10.9'
  173. torture: true
  174. exclude:
  175. - { compiler: llvm@15, build: { macos-version-min: '10.15' } }
  176. - { compiler: llvm@15, build: { torture: true } }
  177. - { compiler: gcc-12, build: { torture: true } }
  178. # opt out jobs from combinations that have the compiler set manually
  179. - { compiler: llvm@15, build: { compiler: 'clang' } }
  180. - { compiler: llvm@15, build: { compiler: 'gcc-12' } }
  181. - { compiler: gcc-12, build: { compiler: 'clang' } }
  182. - { compiler: gcc-12, build: { compiler: 'llvm@15' } }
  183. - { compiler: clang, build: { compiler: 'gcc-12' } }
  184. - { compiler: clang, build: { compiler: 'llvm@15' } }
  185. steps:
  186. - name: 'brew install'
  187. # Run this command with retries because of spurious failures seen
  188. # while running the tests, for example
  189. # https://github.com/curl/curl/runs/4095721123?check_suite_focus=true
  190. run: |
  191. echo ${{ matrix.build.generate && 'ninja' || 'automake libtool' }} \
  192. pkgconf libpsl libssh2 nghttp2 stunnel ${{ matrix.build.install }} | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
  193. while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
  194. - name: 'brew unlink openssl'
  195. run: |
  196. if test -d $(brew --prefix)/include/openssl; then
  197. brew unlink openssl
  198. fi
  199. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
  200. - name: 'toolchain versions'
  201. run: |
  202. [[ '${{ matrix.compiler }}' = 'llvm'* ]] && CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  203. [[ '${{ matrix.compiler }}' = 'gcc'* ]] && "${CC}" --print-sysroot
  204. which "${CC}"; "${CC}" --version || true
  205. xcodebuild -version || true
  206. xcrun --sdk macosx --show-sdk-path 2>/dev/null || true
  207. xcrun --sdk macosx --show-sdk-version || true
  208. ls -l /Library/Developer/CommandLineTools/SDKs || true
  209. echo '::group::macros predefined'; "${CC}" -dM -E - < /dev/null | sort || true; echo '::endgroup::'
  210. echo '::group::brew packages installed'; ls -l "$(brew --prefix)/opt"; echo '::endgroup::'
  211. - name: 'autoreconf'
  212. if: ${{ matrix.build.configure }}
  213. run: autoreconf -fi
  214. - name: 'configure'
  215. run: |
  216. if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
  217. sysroot="$("${CC}" --print-sysroot)" # Must match the SDK gcc was built for
  218. else
  219. sysroot="$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  220. fi
  221. if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
  222. CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  223. CC+=" --sysroot=${sysroot}"
  224. CC+=" --target=$(uname -m)-apple-darwin"
  225. fi
  226. if [ -n '${{ matrix.build.configure }}' ]; then
  227. export CFLAGS
  228. if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
  229. options+=" --target=$(uname -m)-apple-darwin"
  230. fi
  231. if [ '${{ matrix.compiler }}' != 'clang' ]; then
  232. options+=" --with-sysroot=${sysroot}"
  233. CFLAGS+=" --sysroot=${sysroot}"
  234. fi
  235. CFLAGS+=' ${{ matrix.build.cflags }}'
  236. CFLAGS+=' -mmacosx-version-min=${{ matrix.build.macos-version-min }}'
  237. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  238. --disable-dependency-tracking \
  239. --with-libpsl=$(brew --prefix libpsl) \
  240. ${{ matrix.build.configure }} ${options}
  241. else
  242. cmake -B bld -G Ninja -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
  243. -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.build.macos-version-min }} \
  244. "-DCMAKE_OSX_SYSROOT=${sysroot}" \
  245. "-DCMAKE_C_COMPILER_TARGET=$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
  246. ${{ matrix.build.generate }}
  247. fi
  248. - name: 'configure log'
  249. if: ${{ !cancelled() }}
  250. run: cat bld/config.log bld/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
  251. - name: 'curl_config.h'
  252. run: |
  253. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  254. grep -F '#define' bld/lib/curl_config.h | sort || true
  255. - name: 'build-cert'
  256. if: contains(matrix.build.generate, '-DCURL_USE_SECTRANSP=ON') || contains(matrix.build.configure, '--with-secure-transport')
  257. run: |
  258. if [ -n '${{ matrix.build.configure }}' ]; then
  259. make -C bld/tests/certs clean-certs
  260. make -C bld/tests/certs build-certs -j1
  261. else
  262. cmake --build bld --target clean-certs
  263. cmake --build bld --target build-certs --parallel 1
  264. fi
  265. - name: 'build'
  266. run: |
  267. if [ -n '${{ matrix.build.configure }}' ]; then
  268. make -C bld V=1
  269. else
  270. cmake --build bld --verbose
  271. fi
  272. - name: 'curl version'
  273. run: bld/src/curl --disable --version
  274. - name: 'build tests'
  275. run: |
  276. if [ -n '${{ matrix.build.configure }}' ]; then
  277. make -C bld V=1 -C tests
  278. else
  279. cmake --build bld --target testdeps
  280. fi
  281. - name: 'install test prereqs'
  282. run: |
  283. python3 -m venv $HOME/venv
  284. source $HOME/venv/bin/activate
  285. python3 -m pip install -r tests/requirements.txt
  286. - name: 'run tests'
  287. timeout-minutes: ${{ matrix.build.torture && 20 || 10 }}
  288. run: |
  289. export TFLAGS='-j20 ${{ matrix.build.tflags }}'
  290. if [ -z '${{ matrix.build.torture }}' ]; then
  291. TFLAGS+=' ~2037 ~2041' # flaky
  292. if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
  293. TFLAGS+=' ~RTSP' # 567 568 569 570 571 572 577 689 3100
  294. TFLAGS+=' ~1156 ~1539' # HTTP Content-Range, Content-Length
  295. if [[ -n '${{ matrix.build.configure }}' || \
  296. '${{ matrix.build.generate }}' = *'-DCURL_USE_SECTRANSP=ON'* ]]; then
  297. TFLAGS+=' ~2100' # 2100:'HTTP GET using DoH' https://github.com/curl/curl/actions/runs/9942146678/job/27462937524#step:15:5059
  298. fi
  299. if [[ '${{ matrix.build.configure }}' = *'--with-secure-transport'* || \
  300. '${{ matrix.build.generate }}' = *'-DCURL_USE_SECTRANSP=ON'* ]]; then
  301. TFLAGS+=' ~HTTP/2' # 2400 2401 2402 2403 2404 2406, Secure Transport + nghttp2
  302. else
  303. TFLAGS+=' ~2402 ~2404' # non-Secure Transport + nghttp2
  304. fi
  305. fi
  306. if [[ '${{ matrix.build.configure }}' = *'--with-secure-transport'* || \
  307. '${{ matrix.build.generate }}' = *'-DCURL_USE_SECTRANSP=ON'* ]]; then
  308. TFLAGS+=' ~313' # Secure Transport does not support crl file
  309. TFLAGS+=' ~1631 ~1632' # Secure Transport is not able to shutdown ftp over https gracefully yet
  310. fi
  311. fi
  312. source $HOME/venv/bin/activate
  313. rm -f $HOME/.curlrc
  314. if [ -n '${{ matrix.build.configure }}' ]; then
  315. make -C bld V=1 ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
  316. else
  317. cmake --build bld --target ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
  318. fi
  319. - name: 'build examples'
  320. if: ${{ contains(matrix.build.name, '+examples') }}
  321. run: |
  322. if [ -n '${{ matrix.build.configure }}' ]; then
  323. make -C bld examples V=1
  324. else
  325. cmake --build bld --target curl-examples --verbose
  326. fi
  327. combinations: # Test buildability with host OS, Xcode / SDK, compiler, target-OS, Secure Transport/not, built tool, combinations
  328. if: true # Set to `true` to enable this test matrix. It runs quickly.
  329. name: "${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }} ${{ matrix.image }} ${{ matrix.xcode }} ${{ matrix.config }}"
  330. runs-on: ${{ matrix.image }}
  331. timeout-minutes: 10
  332. env:
  333. DEVELOPER_DIR: "/Applications/Xcode${{ matrix.xcode && format('_{0}', matrix.xcode) || '' }}.app/Contents/Developer"
  334. CC: ${{ matrix.compiler }}
  335. strategy:
  336. fail-fast: false
  337. matrix:
  338. config: [SecureTransport] # also: OpenSSL
  339. compiler: [gcc-12, gcc-13, gcc-14, llvm@15, llvm@18, clang]
  340. # Xcode support matrix as of 2024-07, with default macOS SDK versions and OS names, years:
  341. # * = default Xcode on the runner.
  342. # macos-13: 14.1, 14.2, 14.3.1, 15.0.1, 15.1,*15.2
  343. # macos-14: 15.0.1, 15.1, 15.2, 15.3,*15.4
  344. # macos-15: *16.0, 16.1
  345. # macOSSDK: 13.0, 13.1, 13.3, 14.0, 14.2, 14.2, 14.4, 14.5, 15.0, 15.1
  346. # Ventura (2022) Sonoma (2023) Sequoia (2024)
  347. # https://github.com/actions/runner-images/tree/main/images/macos
  348. # https://en.wikipedia.org/wiki/MacOS_version_history
  349. image: [macos-13, macos-14, macos-15]
  350. # Can skip these to reduce jobs:
  351. # 15.1 has the same default macOS SDK as 15.2 and identical test result.
  352. # 14.1, 15.4 not revealing new fallouts.
  353. #xcode: ['14.1', '14.2', '14.3.1', '15.0.1', '15.1', '15.2', '15.3', '15.4', '16.0', '16.1'] # all Xcode
  354. #xcode: ['14.1', '14.2', '14.3.1', '15.0.1' , '15.2', '15.3', '15.4', '16.0', '16.1'] # all SDK
  355. #xcode: [ '14.2', '14.3.1', '15.0.1' , '15.2', '15.3' , '16.0' ] # coverage
  356. xcode: [''] # default Xcodes
  357. macos-version-min: ['10.8']
  358. build: [autotools, cmake]
  359. exclude:
  360. # Combinations uncovered by runner images:
  361. - { image: macos-13, xcode: '15.3' }
  362. - { image: macos-13, xcode: '15.4' }
  363. - { image: macos-13, xcode: '16.0' }
  364. - { image: macos-13, xcode: '16.1' }
  365. - { image: macos-14, xcode: '14.1' }
  366. - { image: macos-14, xcode: '14.2' }
  367. - { image: macos-14, xcode: '14.3.1' }
  368. - { image: macos-14, xcode: '16.0' }
  369. - { image: macos-14, xcode: '16.1' }
  370. - { image: macos-15, xcode: '14.1' }
  371. - { image: macos-15, xcode: '14.2' }
  372. - { image: macos-15, xcode: '14.3.1' }
  373. - { image: macos-15, xcode: '15.0.1' }
  374. - { image: macos-15, xcode: '15.1' }
  375. - { image: macos-15, xcode: '15.2' }
  376. - { image: macos-15, xcode: '15.3' }
  377. - { image: macos-15, xcode: '15.4' }
  378. - { image: macos-13, compiler: 'llvm@18' }
  379. - { image: macos-14, compiler: 'llvm@18' }
  380. - { image: macos-15, compiler: 'llvm@15' }
  381. # Reduce build combinations, by dropping less interesting ones
  382. - { compiler: gcc-12, config: SecureTransport }
  383. - { compiler: gcc-13, build: cmake }
  384. - { compiler: gcc-14, build: autotools }
  385. steps:
  386. - name: 'install autotools'
  387. if: ${{ matrix.build == 'autotools' }}
  388. run: |
  389. echo automake libtool | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
  390. while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
  391. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
  392. - name: 'toolchain versions'
  393. run: |
  394. [[ '${{ matrix.compiler }}' = 'llvm'* ]] && CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  395. [[ '${{ matrix.compiler }}' = 'gcc'* ]] && "${CC}" --print-sysroot
  396. which "${CC}"; "${CC}" --version || true
  397. xcodebuild -version || true
  398. xcrun --sdk macosx --show-sdk-path 2>/dev/null || true
  399. xcrun --sdk macosx --show-sdk-version || true
  400. ls -l /Library/Developer/CommandLineTools/SDKs || true
  401. echo '::group::macros predefined'; "${CC}" -dM -E - < /dev/null | sort || true; echo '::endgroup::'
  402. echo '::group::brew packages preinstalled'; ls -l "$(brew --prefix)/opt"; echo '::endgroup::'
  403. - name: 'autoreconf'
  404. if: ${{ matrix.build == 'autotools' }}
  405. run: autoreconf -fi
  406. - name: 'configure / ${{ matrix.build }}'
  407. run: |
  408. if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
  409. sysroot="$("${CC}" --print-sysroot)" # Must match the SDK gcc was built for
  410. else
  411. sysroot="$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  412. fi
  413. if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
  414. CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  415. CC+=" --sysroot=${sysroot}"
  416. CC+=" --target=$(uname -m)-apple-darwin"
  417. fi
  418. if [ '${{ matrix.build }}' = 'autotools' ]; then
  419. export CFLAGS
  420. if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
  421. options+=" --target=$(uname -m)-apple-darwin"
  422. fi
  423. if [ '${{ matrix.compiler }}' != 'clang' ]; then
  424. options+=" --with-sysroot=${sysroot}"
  425. CFLAGS+=" --sysroot=${sysroot}"
  426. fi
  427. [ '${{ matrix.config }}' = 'OpenSSL' ] && options+=" --with-openssl=$(brew --prefix openssl)"
  428. [ '${{ matrix.config }}' = 'SecureTransport' ] && options+=' --with-secure-transport'
  429. CFLAGS+=' -mmacosx-version-min=${{ matrix.macos-version-min }}'
  430. # would pick up nghttp2, libidn2, but libssh2 is disabled by default
  431. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  432. --disable-dependency-tracking \
  433. --disable-docs --disable-manual \
  434. --without-nghttp2 --without-libidn2 \
  435. --without-libpsl \
  436. ${options}
  437. else
  438. [ '${{ matrix.config }}' = 'OpenSSL' ] && options+=' -DCURL_USE_OPENSSL=ON'
  439. [ '${{ matrix.config }}' = 'SecureTransport' ] && options+=' -DCURL_USE_SECTRANSP=ON'
  440. # would pick up nghttp2, libidn2, and libssh2
  441. cmake -B bld -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
  442. -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.macos-version-min }} \
  443. "-DCMAKE_OSX_SYSROOT=${sysroot}" \
  444. "-DCMAKE_C_COMPILER_TARGET=$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
  445. "-DCMAKE_IGNORE_PREFIX_PATH=$(brew --prefix)" \
  446. -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF \
  447. -DUSE_NGHTTP2=OFF -DUSE_LIBIDN2=OFF \
  448. -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF \
  449. ${options}
  450. fi
  451. - name: 'configure log'
  452. if: ${{ !cancelled() }}
  453. run: cat bld/config.log bld/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
  454. - name: 'curl_config.h'
  455. run: |
  456. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  457. grep -F '#define' bld/lib/curl_config.h | sort || true
  458. - name: 'build / ${{ matrix.build }}'
  459. run: make -C bld V=1 VERBOSE=1
  460. - name: 'curl version'
  461. run: bld/src/curl --disable --version