time gmake -j3 examples
echo '::endgroup::'
+ android:
+ name: "Android ${{ matrix.platform }} (${{ matrix.build == 'cmake' && 'CM' || 'AM' }}, arm64)"
+ runs-on: 'ubuntu-24.04'
+ timeout-minutes: 5
+ strategy:
+ matrix:
+ platform: ['21', '35']
+ build: [autotools, cmake]
+ fail-fast: false
+ steps:
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
+
+ - name: 'configure'
+ run: |
+ if [ '${{ matrix.build }}' = 'cmake' ]; then
+ cmake -B bld \
+ -DANDROID_ABI=arm64-v8a \
+ -DANDROID_PLATFORM=android-${{ matrix.platform }} \
+ -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \
+ -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
+ -DCURL_WERROR=ON \
+ -DCURL_ENABLE_SSL=OFF \
+ -DCURL_USE_LIBPSL=OFF
+ else
+ autoreconf -fi
+ TOOLCHAIN="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64"
+ mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ 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 }} \
+ --without-ssl \
+ --without-libpsl
+ 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 -j5 -C bld
+ fi
+
+ - name: 'curl info'
+ run: |
+ find . -type f \( -name curl -o -name '*.so' -o -name '*.a' \) -exec file '{}' \;
+
+ - 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 -j5 -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
+ else
+ make -j5 -C bld examples
+ fi
+
amiga:
name: "AmigaOS (${{ matrix.build == 'cmake' && 'CM' || 'AM' }}, AmiSSL, gcc, m68k)"
runs-on: 'ubuntu-24.04'
###########################################################################
@PACKAGE_INIT@
-if(UNIX OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING)) # Keep in sync with root CMakeLists.txt
+# Keep condition in sync with CMake/curl-config.cmake.in
+if((UNIX AND NOT ANDROID) OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING))
set(_curl_use_pkgconfig_default ON)
else()
set(_curl_use_pkgconfig_default OFF)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
endif()
+# Fill platform level variable when using CMake's built-in Android configuration
+if(ANDROID AND NOT DEFINED ANDROID_PLATFORM_LEVEL AND NOT CMAKE_SYSTEM_VERSION EQUAL 1)
+ set(ANDROID_PLATFORM_LEVEL "${CMAKE_SYSTEM_VERSION}")
+endif()
+
set(_target_flags "")
if(APPLE)
set(_target_flags "${_target_flags} APPLE")
if(BSD)
set(_target_flags "${_target_flags} BSD")
endif()
+if(ANDROID)
+ set(_target_flags "${_target_flags} ANDROID-${ANDROID_PLATFORM_LEVEL}")
+endif()
if(WIN32)
set(_target_flags "${_target_flags} WIN32")
endif()
endif()
# Override to force-disable or force-enable the use of pkg-config.
-if(UNIX OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING)) # Keep in sync with CMake/curl-config.cmake.in
+# Keep condition in sync with CMake/curl-config.cmake.in
+if((UNIX AND NOT ANDROID) OR VCPKG_TOOLCHAIN OR (MINGW AND NOT CMAKE_CROSSCOMPILING))
set(_curl_use_pkgconfig_default ON)
else()
set(_curl_use_pkgconfig_default OFF)
if test "$curl_cv_winuwp" = 'yes'; then
curl_pflags="${curl_pflags} UWP"
fi
+ case $host in
+ *-*-android*)
+ curl_pflags="${curl_pflags} ANDROID"
+ ANDROID_PLATFORM_LEVEL=`echo "$host_os" | $SED -ne 's/.*android\(@<:@0-9@:>@*\).*/\1/p'`
+ if test -n "${ANDROID_PLATFORM_LEVEL}"; then
+ curl_pflags="${curl_pflags}-${ANDROID_PLATFORM_LEVEL}"
+ fi
+ ;;
+ esac
if test "$curl_cv_cygwin" = 'yes'; then
curl_pflags="${curl_pflags} CYGWIN"
fi
- `CURL_USE_LIBUV`: Use libuv for event-based tests. Default: `OFF`
- `CURL_USE_MBEDTLS`: Enable mbedTLS for SSL/TLS. Default: `OFF`
- `CURL_USE_OPENSSL`: Enable OpenSSL for SSL/TLS. Default: `ON` if no other TLS backend was enabled.
-- `CURL_USE_PKGCONFIG`: Enable `pkg-config` to detect dependencies. Default: `ON` for Unix, vcpkg, MinGW if not cross-compiling.
+- `CURL_USE_PKGCONFIG`: Enable `pkg-config` to detect dependencies. Default: `ON` for Unix (except Android), vcpkg, MinGW if not cross-compiling.
- `CURL_USE_RUSTLS`: Enable Rustls for SSL/TLS. Default: `OFF`
- `CURL_USE_SCHANNEL`: Enable Windows native SSL/TLS (Schannel). Default: `OFF`
- `CURL_USE_SECTRANSP`: Enable Apple OS native SSL/TLS (Secure Transport). Default: `OFF`
# Android
-When building curl for Android it is recommended to use a Linux/macOS
-environment since using curl's `configure` script is the easiest way to build
-curl for Android. Before you can build curl for Android, you need to install
-the Android NDK first. This can be done using the SDK Manager that is part of
-Android Studio. Once you have installed the Android NDK, you need to figure
-out where it has been installed and then set up some environment variables
-before launching `configure`. On macOS, those variables could look like this
-to compile for `aarch64` and API level 29:
+When building curl for Android you can you CMake or curl's `configure` script.
+
+Before you can build curl for Android, you need to install the Android NDK
+first. This can be done using the SDK Manager that is part of Android Studio.
+Once you have installed the Android NDK, you need to figure out where it has
+been installed and then set up some environment variables before launching
+the build.
+
+Examples to compile for `aarch64` and API level 29:
+
+with CMake, where `ANDROID_NDK_HOME` points into your NDK:
+
+ cmake . \
+ -DANDROID_ABI=arm64-v8a \
+ -DANDROID_PLATFORM=android-29 \
+ -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
+ -DCURL_ENABLE_SSL=OFF \
+ -DCURL_USE_LIBPSL=OFF
+
+with `configure`, on macOS:
```bash
export ANDROID_NDK_HOME=~/Library/Android/sdk/ndk/25.1.8937393 # Point into your NDK.
export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$HOST_TAG
export AR=$TOOLCHAIN/bin/llvm-ar
export AS=$TOOLCHAIN/bin/llvm-as
-export CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
-export CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++
+export CC=$TOOLCHAIN/bin/aarch64-linux-android29-clang
+export CXX=$TOOLCHAIN/bin/aarch64-linux-android29-clang++
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip