Skip to content

Commit

Permalink
Fix build failed on ndk-r23c
Browse files Browse the repository at this point in the history
  • Loading branch information
deal.g committed Jul 14, 2022
1 parent 9b54ce2 commit 6531064
Show file tree
Hide file tree
Showing 5 changed files with 762 additions and 14 deletions.
25 changes: 16 additions & 9 deletions 1k/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,35 @@ if [ "$BUILD_TARGET" = "android" ] ; then
elif [ "$RUNNER_OS" = "macOS" ] ; then
NDK_PLAT=darwin
fi
ndk_ver=$(cat ndk.properties | grep -w 'ndk_ver' | cut -d '=' -f 2 | tr -d '\n')

# Check exist ndk
if [ -d "$ANDROID_NDK" ] ; then
echo "Using exist android ndk: $ANDROID_NDK"
ndk_rev=$(cat $ANDROID_NDK/source.properties | grep -w 'Pkg.Revision' | cut -d '=' -f 2 | tr -d '\n')
ndk_ver=${ndk_rev:0:2}
else
ndk_rver=${ndk_ver:0:3}
ndk_rev=$(cat ndk.properties | grep -w 'ndk_rev' | cut -d '=' -f 2 | tr -d '\n')
ndk_ver=${ndk_rev:1:2}
ndk_pkg_suffix=-x86_64
if [[ $ndk_rver > 'r23' ]] || [[ $ndk_rver == 'r23' ]] ; then
if [[ $ndk_ver > '22' ]] ; then
ndk_pkg_suffix=
fi

echo "ndk_pkg_suffix=$ndk_pkg_suffix"

if [ ! -d "buildsrc/android-ndk-${ndk_ver}" ] ; then
NDK_URL="https://dl.google.com/android/repository/android-ndk-${ndk_ver}-${NDK_PLAT}${ndk_pkg_suffix}.zip"
if [ ! -d "buildsrc/android-ndk-${ndk_rev}" ] ; then
NDK_URL="https://dl.google.com/android/repository/android-ndk-${ndk_rev}-${NDK_PLAT}${ndk_pkg_suffix}.zip"
echo "Downloading ${NDK_URL}..."
wget -q -O buildsrc/android-ndk-${ndk_ver}-${NDK_PLAT}${ndk_pkg_suffix}.zip https://dl.google.com/android/repository/android-ndk-${ndk_ver}-${NDK_PLAT}${ndk_pkg_suffix}.zip
unzip -q buildsrc/android-ndk-${ndk_ver}-${NDK_PLAT}${ndk_pkg_suffix}.zip -d buildsrc/
wget -q -O buildsrc/android-ndk-${ndk_rev}-${NDK_PLAT}${ndk_pkg_suffix}.zip https://dl.google.com/android/repository/android-ndk-${ndk_rev}-${NDK_PLAT}${ndk_pkg_suffix}.zip
unzip -q buildsrc/android-ndk-${ndk_rev}-${NDK_PLAT}${ndk_pkg_suffix}.zip -d buildsrc/
else
echo "The directory buildsrc/android-ndk-${ndk_ver} exists"
echo "The directory buildsrc/android-ndk-${ndk_rev} exists"
fi
export ANDROID_NDK=`pwd`/buildsrc/android-ndk-${ndk_ver}
export ANDROID_NDK=`pwd`/buildsrc/android-ndk-${ndk_rev}
fi

echo "ndk_rev=$ndk_rev"
echo "ndk_ver=$ndk_ver"

# Export alias ENVs
export ANDROID_NDK_HOME=$ANDROID_NDK
Expand Down
15 changes: 11 additions & 4 deletions 1k/build1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,19 @@ elif [ "$BUILD_TARGET" = "android" ] ; then
fi
else # luajit TODO: move to custom config.sh
NDKBIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$NDK_PLAT-x86_64/bin
NDKCROSS_LINKER=$NDKBIN/llvm-
if [ "$BUILD_ARCH" = "arm64" ] ; then
NDKCROSS=$NDKBIN/aarch64-linux-android-
NDKCC=$NDKBIN/aarch64-linux-android$android_api_level_arm64-clang
CONFIG_TARGET="HOST_CC=\"gcc\" CROSS=$NDKCROSS STATIC_CC=$NDKCC DYNAMIC_CC=\"$NDKCC -fPIC\" TARGET_LD=$NDKCC TARGET_SYS=\"Linux\""
CONFIG_TARGET="HOST_CC=\"gcc\" CROSS=$NDKCROSS CROSS_LINKER=$NDKCROSS_LINKER STATIC_CC=$NDKCC DYNAMIC_CC=\"$NDKCC -fPIC\" TARGET_LD=$NDKCC TARGET_SYS=\"Linux\""
elif [ "$BUILD_ARCH" = "arm" ] ; then
NDKCROSS=$NDKBIN/arm-linux-androideabi-
NDKCC=$NDKBIN/armv7a-linux-androideabi$android_api_level-clang
CONFIG_TARGET="HOST_CC=\"gcc -m32\" CROSS=$NDKCROSS STATIC_CC=$NDKCC DYNAMIC_CC=\"$NDKCC -fPIC\" TARGET_LD=$NDKCC TARGET_SYS=\"Linux\""
CONFIG_TARGET="HOST_CC=\"gcc -m32\" CROSS=$NDKCROSS CROSS_LINKER=$NDKCROSS_LINKER STATIC_CC=$NDKCC DYNAMIC_CC=\"$NDKCC -fPIC\" TARGET_LD=$NDKCC TARGET_SYS=\"Linux\""
else
NDKCROSS=$NDKBIN/i686-linux-android-
NDKCC=$NDKBIN/i686-linux-android$android_api_level-clang
CONFIG_TARGET="HOST_CC=\"gcc -m32\" CROSS=$NDKCROSS STATIC_CC=$NDKCC DYNAMIC_CC=\"$NDKCC -fPIC\" TARGET_LD=$NDKCC TARGET_SYS=\"Linux\""
CONFIG_TARGET="HOST_CC=\"gcc -m32\" CROSS=$NDKCROSS CROSS_LINKER=$NDKCROSS_LINKER STATIC_CC=$NDKCC DYNAMIC_CC=\"$NDKCC -fPIC\" TARGET_LD=$NDKCC TARGET_SYS=\"Linux\""
fi
echo NDKCC=$NDKCC
fi
Expand Down Expand Up @@ -237,6 +238,11 @@ elif [ "$cb_tool" = "perl" ] ; then # openssl TODO: move to custom build.sh
make install
elif [ "$cb_tool" = "make" ] ; then # luajit # TODO: move to custom build.sh
if [ ! "$SKIP_CI" = "true" ] ; then
# have custom patch script?
if [ -f "../../src/${LIB_NAME}/patch1.sh" ] ; then
source "../../src/${LIB_NAME}/patch1.sh" "../../src/${LIB_NAME}" `pwd`
fi

CONFIG_ALL_OPTIONS="$CONFIG_TARGET $CONFIG_OPTIONS"
echo CONFIG_ALL_OPTIONS="$CONFIG_ALL_OPTIONS"

Expand All @@ -246,7 +252,8 @@ elif [ "$cb_tool" = "make" ] ; then # luajit # TODO: move to custom build.sh
make
fi

if [ -f "../../src/${LIB_NAME}/install1.sh" ] ; then # have custom install_script?
# have custom install script?
if [ -f "../../src/${LIB_NAME}/install1.sh" ] ; then
install_script="src/${LIB_NAME}/install1.sh"
else
make install PREFIX=$install_dir
Expand Down
2 changes: 1 addition & 1 deletion ndk.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
android_api_level=16
android_api_level_arm64=21
ndk_ver=r23c
ndk_rev=r23c
Loading

0 comments on commit 6531064

Please sign in to comment.