Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ skip_branch_with_pr: true

environment:
python_stack: python 3.12
PYTHON_VERSION: 3.12.6
PYTHON_VERSION: 3.12.7
PYTHON_VERSION_SHORT: 3.12
GITHUB_TOKEN:
secure: 9SKIwc3VSfYJ5IChvNR74rlTF9BMbAfhCGu1/TmYJBMtC6lkY+UDDkZNK7rC9xnQFUxMrNgoo9kNcNAbKbU8XAcrSwkP2H4mX04FI7P+YbxfiWC8nVHhGNxR4LzO+GO0
Expand All @@ -12,16 +12,16 @@ environment:
- job_name: Build Python for iOS and macOS
APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma

- job_name: Build Python for Android
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu-gce-c
NDK_VERSION: r27
# - job_name: Build Python for Android
# APPVEYOR_BUILD_WORKER_IMAGE: ubuntu-gce-c
# NDK_VERSION: r27

- job_name: Build Python for Linux
APPVEYOR_BUILD_WORKER_IMAGE: ubuntu-gce-c
PYTHON_DIST_RELEASE: 20240909
# - job_name: Build Python for Linux
# APPVEYOR_BUILD_WORKER_IMAGE: ubuntu-gce-c
# PYTHON_DIST_RELEASE: 20241016

- job_name: Build Python for Windows
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
# - job_name: Build Python for Windows
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022

matrix:
fast_finish: true
Expand All @@ -44,7 +44,7 @@ for:
- cd darwin

# Build Python for iOS and macOS
- git clone --branch=$PYTHON_VERSION_SHORT https://github.com/beeware/Python-Apple-support.git
- git clone --branch=$PYTHON_VERSION_SHORT-fix-xcrun-aliases https://github.com/flet-dev/Python-Apple-support.git
- mkdir -p dist
- sh: |
pushd Python-Apple-support
Expand Down
18 changes: 18 additions & 0 deletions android/abi-to-host.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
case ${abi:?} in
armeabi-v7a)
HOST=arm-linux-androideabi
;;
arm64-v8a)
HOST=aarch64-linux-android
;;
x86)
HOST=i686-linux-android
;;
x86_64)
HOST=x86_64-linux-android
;;
*)
echo "Unknown ABI: '$abi'"
exit 1
;;
esac
76 changes: 53 additions & 23 deletions android/android-env.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
fail() {
# This script must be sourced with the following variables already set:
: ${HOST:?} # GNU target triplet

# You may also override the following:
: ${api_level:=24} # Minimum Android API level the build will run on
: ${PREFIX:-} # Path in which to find required libraries

NDK_VERSION=r27c

# Print all messages on stderr so they're visible when running within build-wheel.
log() {
echo "$1" >&2
}

fail() {
log "$1"
exit 1
}

# When moving to a new version of the NDK, carefully review the following:
#
# * https://developer.android.com/ndk/downloads/revision_history
#
# * https://android.googlesource.com/platform/ndk/+/ndk-rXX-release/docs/BuildSystemMaintainers.md
# where XX is the NDK version. Do a diff against the version you're upgrading from, e.g.:
# https://android.googlesource.com/platform/ndk/+/ndk-r25-release..ndk-r26-release/docs/BuildSystemMaintainers.md
if [[ -z "${NDK_HOME-}" ]]; then
NDK_HOME=$HOME/ndk/$NDK_VERSION
echo "NDK_HOME environment variable is not set."
Expand Down Expand Up @@ -52,25 +73,24 @@ else
echo "NDK home: $NDK_HOME"
fi

if [ $host_triplet = "arm-linux-androideabi" ]; then
if [ $HOST = "arm-linux-androideabi" ]; then
clang_triplet=armv7a-linux-androideabi
else
clang_triplet=$host_triplet
clang_triplet=$HOST
fi

# These variables are based on BuildSystemMaintainers.md above, and
# $NDK_HOME/build/cmake/android.toolchain.cmake.
toolchain=$(echo $NDK_HOME/toolchains/llvm/prebuilt/*)
export AR="$toolchain/bin/llvm-ar"
export AS="$toolchain/bin/llvm-as"
export CC="$toolchain/bin/${clang_triplet}$api_level-clang"
export CC="$toolchain/bin/${clang_triplet}${api_level}-clang"
export CXX="${CC}++"
export LD="$toolchain/bin/ld"
export NM="$toolchain/bin/llvm-nm"
export RANLIB="$toolchain/bin/llvm-ranlib"
export READELF="$toolchain/bin/llvm-readelf"
export STRIP="$toolchain/bin/llvm-strip"
export LIBC_SHARED_SO="$toolchain/sysroot/usr/lib/${host_triplet}/libc++_shared.so"

# The quotes make sure the wildcard in the `toolchain` assignment has been expanded.
for path in "$AR" "$AS" "$CC" "$CXX" "$LD" "$NM" "$RANLIB" "$READELF" "$STRIP"; do
Expand All @@ -79,28 +99,38 @@ for path in "$AR" "$AS" "$CC" "$CXX" "$LD" "$NM" "$RANLIB" "$READELF" "$STRIP";
fi
done

# Use -idirafter so that package-specified -I directories take priority. For example,
# grpcio provides its own BoringSSL headers which must be used rather than our OpenSSL.
export CFLAGS="-idirafter ${prefix:?}/include"
export LDFLAGS="-L${prefix:?}/lib -Wl,--build-id=sha1 -Wl,--no-rosegment"
export CFLAGS="-D__BIONIC_NO_PAGE_SIZE_MACRO"
export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,-z,max-page-size=16384"

# Unlike Linux, Android does not implicitly use a dlopened library to resolve
# relocations in subsequently-loaded libraries, even if RTLD_GLOBAL is used
# (https://github.com/android/ndk/issues/1244). So any library that fails to
# build with this flag, would also fail to load at runtime.
LDFLAGS="$LDFLAGS -Wl,--no-undefined"

# Many packages get away with omitting -lm on Linux, but Android is stricter.
LDFLAGS="$LDFLAGS -lm"

# Many packages get away with omitting this on standard Linux, but Android is stricter.
LDFLAGS+=" -lm"
# -mstackrealign is included where necessary in the clang launcher scripts which are
# pointed to by $CC, so we don't need to include it here.
if [ $HOST = "arm-linux-androideabi" ]; then
CFLAGS="$CFLAGS -march=armv7-a -mthumb"
fi

if [ -n "${PREFIX:-}" ]; then
abs_prefix=$(realpath $PREFIX)
CFLAGS="$CFLAGS -I$abs_prefix/include"
LDFLAGS="$LDFLAGS -L$abs_prefix/lib"

case $abi in
armeabi-v7a)
CFLAGS+=" -march=armv7-a -mthumb"
;;
x86)
# -mstackrealign is unnecessary because it's included in the clang launcher script
# which is pointed to by $CC.
;;
esac
export PKG_CONFIG="pkg-config --define-prefix"
export PKG_CONFIG_LIBDIR="$abs_prefix/lib/pkgconfig"
fi

export PKG_CONFIG="pkg-config --define-prefix"
export PKG_CONFIG_LIBDIR="$prefix/lib/pkgconfig"
# When compiling C++, some build systems will combine CFLAGS and CXXFLAGS, and some will
# use CXXFLAGS alone.
export CXXFLAGS=$CFLAGS

# conda-build variable name
# Use the same variable name as conda-build
if [ $(uname) = "Darwin" ]; then
export CPU_COUNT=$(sysctl -n hw.ncpu)
else
Expand Down
Loading