Skip to content

Commit

Permalink
Sync android-cmake with AUR
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Jan 11, 2025
1 parent d837bc6 commit d4fd94f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
12 changes: 7 additions & 5 deletions cmake/android/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

pkgname=android-cmake
pkgver=1
pkgrel=1
pkgrel=3
arch=('any')
pkgdesc="CMake wrapper for Android (android)"
depends=('cmake' 'android-environment' 'android-pkg-config')
pkgdesc="CMake wrapper for Android"
depends=('cmake'
'android-environment'
'android-pkg-config')
license=("custom")
url="https://cmake.org/"
source=("android-cmake.sh"
"android-cmake-py.sh")
sha256sums=('SKIP'
'SKIP')
md5sums=('585a84fbeebb622208c3ec602abb6663'
'8e068ffe8d39fea8f7f0c03bf62ab074')
_architectures="aarch64 armv7a-eabi x86 x86-64"
_python_versions="27 35 36 37"

Expand Down
44 changes: 18 additions & 26 deletions cmake/android/android-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,24 @@

source android-env @TRIPLE@

default_android_pp_flags="-D_FORTIFY_SOURCE=2"
default_android_compiler_flags="$default_android_pp_flags -O2 -pipe -fno-plt -fexceptions --param=ssp-buffer-size=4"
default_android_linker_flags="-Wl,-O1,--sort-common,--as-needed"

export CPPFLAGS="${ANDROID_CPPFLAGS:-$default_android_pp_flags $CPPFLAGS}"
export CFLAGS="${ANDROID_CFLAGS:-$default_android_compiler_flags $CFLAGS}"
export CXXFLAGS="${ANDROID_CXXFLAGS:-$default_android_compiler_flags $CXXFLAGS}"
export LDFLAGS="${ANDROID_LDFLAGS:-$default_android_linker_flags $LDFLAGS}"

PATH=${ANDROID_PREFIX_BIN}:$PATH cmake \
-DCMAKE_INSTALL_PREFIX:PATH=${ANDROID_PREFIX} \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DINCLUDE_INSTALL_DIR:PATH=${ANDROID_PREFIX_INCLUDE} \
-DLIB_INSTALL_DIR:PATH=${ANDROID_PREFIX_LIB} \
-DSYSCONF_INSTALL_DIR:PATH=${ANDROID_PREFIX_ETC} \
-DSHARE_INSTALL_DIR:PATH=${ANDROID_PREFIX_SHARE} \
-DCMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES:PATH=${ANDROID_PREFIX_INCLUDE} \
-DCMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES:PATH=${ANDROID_PREFIX_INCLUDE} \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DBUILD_SHARED_LIBS:BOOL=ON \
PATH="${ANDROID_PREFIX_BIN}:$PATH" cmake \
-DCMAKE_INSTALL_PREFIX="${ANDROID_PREFIX}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DINCLUDE_INSTALL_DIR="${ANDROID_PREFIX_INCLUDE}" \
-DLIB_INSTALL_DIR="${ANDROID_PREFIX_LIB}" \
-DSYSCONF_INSTALL_DIR="${ANDROID_PREFIX_ETC}" \
-DSHARE_INSTALL_DIR="${ANDROID_PREFIX_SHARE}" \
-DCMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES="${ANDROID_PREFIX_INCLUDE}" \
-DCMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES="${ANDROID_PREFIX_INCLUDE}" \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_ABI=${ANDROID_ABI} \
-DANDROID_NDK=${ANDROID_NDK_HOME} \
-DANDROID_NATIVE_API_LEVEL=${ANDROID_MINIMUM_PLATFORM} \
-DANDROID_ABI="${ANDROID_ABI}" \
-DANDROID_NDK="${ANDROID_NDK_HOME}" \
-DANDROID_NATIVE_API_LEVEL="${ANDROID_MINIMUM_PLATFORM}" \
-DANDROID_TOOLCHAIN=clang \
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS" \
-DCMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$LDFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
"$@"

0 comments on commit d4fd94f

Please sign in to comment.