Skip to content

Commit 12e51c0

Browse files
committed
fix(ndk): fix on-device building and remove custom __ANDROID_API__ header patches
- Fixes #26838 - Fixes partly #23401 - After #25627, it is believed that the custom definition of `__ANDROID_API__` is no longer needed, because: - There is no longer a way to reproduce any of the errors that it fixed before - Even if there were a way to, it would no longer be able to fix those errors by itself because of the update to NDK r28c (see #25622 for more details) - It is replaced with #25627, which does what it used to a different way that also fixes other errors and seems more reliable
1 parent e40a0f5 commit 12e51c0

File tree

7 files changed

+13
-15
lines changed

7 files changed

+13
-15
lines changed

packages/libc++/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ TERMUX_PKG_MAINTAINER="@termux"
55
# Version should be equal to TERMUX_NDK_{VERSION_NUM,REVISION} in
66
# scripts/properties.sh
77
TERMUX_PKG_VERSION=28c
8+
TERMUX_PKG_REVISION=1
89
TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip
9-
TERMUX_PKG_SHA256=59c2f6dc96743b5daf5d1626684640b20a6bd2b1d85b13156b90333741bad5cc
10+
TERMUX_PKG_SHA256=dfb20d396df28ca02a8c708314b814a4d961dc9074f9a161932746f815aa552f
1011
TERMUX_PKG_AUTO_UPDATE=false
1112
TERMUX_PKG_ESSENTIAL=true
1213
TERMUX_PKG_BUILD_IN_SRC=true
@@ -17,6 +18,7 @@ termux_step_get_source() {
1718
termux_download_src_archive
1819
cd $TERMUX_PKG_TMPDIR
1920
termux_extract_src_archive
21+
mv "$TERMUX_PKG_SRCDIR/android-ndk-r$TERMUX_PKG_VERSION"/* "$TERMUX_PKG_SRCDIR"
2022
else
2123
local lib_path="toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/${TERMUX_HOST_PLATFORM}"
2224
mkdir -p "$TERMUX_PKG_SRCDIR"/"$lib_path"

packages/ndk-multilib/build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ TERMUX_PKG_MAINTAINER="@termux"
55
# Version should be equal to TERMUX_NDK_{VERSION_NUM,REVISION} in
66
# scripts/properties.sh
77
TERMUX_PKG_VERSION=28c
8-
TERMUX_PKG_REVISION=2
8+
TERMUX_PKG_REVISION=3
99
TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip
10-
TERMUX_PKG_SHA256=59c2f6dc96743b5daf5d1626684640b20a6bd2b1d85b13156b90333741bad5cc
10+
TERMUX_PKG_SHA256=dfb20d396df28ca02a8c708314b814a4d961dc9074f9a161932746f815aa552f
1111
TERMUX_PKG_AUTO_UPDATE=false
1212
TERMUX_PKG_PLATFORM_INDEPENDENT=true
1313
TERMUX_PKG_NO_STATICSPLIT=true
@@ -19,6 +19,7 @@ termux_step_get_source() {
1919
termux_download_src_archive
2020
cd $TERMUX_PKG_TMPDIR
2121
termux_extract_src_archive
22+
mv "$TERMUX_PKG_SRCDIR/android-ndk-r$TERMUX_PKG_VERSION"/* "$TERMUX_PKG_SRCDIR"
2223
else
2324
local lib_path="toolchains/llvm/prebuilt/linux-x86_64/sysroot"
2425
mkdir -p "$TERMUX_PKG_SRCDIR"/"$lib_path"

packages/ndk-sysroot/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ TERMUX_PKG_MAINTAINER="@termux"
55
# Version should be equal to TERMUX_NDK_{VERSION_NUM,REVISION} in
66
# scripts/properties.sh
77
TERMUX_PKG_VERSION=28c
8+
TERMUX_PKG_REVISION=1
89
TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip
9-
TERMUX_PKG_SHA256=59c2f6dc96743b5daf5d1626684640b20a6bd2b1d85b13156b90333741bad5cc
10+
TERMUX_PKG_SHA256=dfb20d396df28ca02a8c708314b814a4d961dc9074f9a161932746f815aa552f
1011
TERMUX_PKG_AUTO_UPDATE=false
1112
# This package has taken over <pty.h> from the previous libutil-dev
1213
# and iconv.h from libandroid-support-dev:
@@ -40,6 +41,7 @@ termux_step_get_source() {
4041
termux_download_src_archive
4142
cd $TERMUX_PKG_TMPDIR
4243
termux_extract_src_archive
44+
mv "$TERMUX_PKG_SRCDIR/android-ndk-r$TERMUX_PKG_VERSION"/* "$TERMUX_PKG_SRCDIR"
4345
else
4446
local lib_path="toolchains/llvm/prebuilt/linux-x86_64/sysroot"
4547
mkdir -p "$TERMUX_PKG_SRCDIR"/"$lib_path"
@@ -62,8 +64,6 @@ termux_step_post_get_source() {
6264
-e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" \
6365
"$patch" | patch --silent -p1
6466
done
65-
sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \
66-
usr/include/android/api-level.h
6767
grep -lrw usr/include/c++/v1 -e '<version>' | xargs -n 1 sed -i 's/<version>/\"version\"/g'
6868
popd
6969
}

packages/vulkan-loader-android/build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ TERMUX_PKG_MAINTAINER="@termux"
55
# Version should be equal to TERMUX_NDK_{VERSION_NUM,REVISION} in
66
# scripts/properties.sh
77
TERMUX_PKG_VERSION=28c
8-
TERMUX_PKG_REVISION=1
8+
TERMUX_PKG_REVISION=2
99
TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip
10-
TERMUX_PKG_SHA256=59c2f6dc96743b5daf5d1626684640b20a6bd2b1d85b13156b90333741bad5cc
10+
TERMUX_PKG_SHA256=dfb20d396df28ca02a8c708314b814a4d961dc9074f9a161932746f815aa552f
1111
TERMUX_PKG_AUTO_UPDATE=false
1212
TERMUX_PKG_HOSTBUILD=true
1313
TERMUX_PKG_BUILD_IN_SRC=true
@@ -26,6 +26,7 @@ termux_step_get_source() {
2626
termux_download_src_archive
2727
cd $TERMUX_PKG_TMPDIR
2828
termux_extract_src_archive
29+
mv "$TERMUX_PKG_SRCDIR/android-ndk-r$TERMUX_PKG_VERSION"/* "$TERMUX_PKG_SRCDIR"
2930
else
3031
local lib_path="toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr"
3132
mkdir -p "$TERMUX_PKG_SRCDIR"/"$lib_path"

scripts/build/termux_step_setup_toolchain.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ termux_step_setup_toolchain() {
1010
TERMUX_STANDALONE_TOOLCHAIN+="-v2"
1111
termux_setup_toolchain_28c
1212
elif [ "${TERMUX_NDK_VERSION}" = 23c ]; then
13-
TERMUX_STANDALONE_TOOLCHAIN+="-v8"
13+
TERMUX_STANDALONE_TOOLCHAIN+="-v9"
1414
termux_setup_toolchain_23c
1515
else
1616
termux_error_exit "We do not have a setup_toolchain function for NDK version $TERMUX_NDK_VERSION"

scripts/build/toolchain/termux_setup_toolchain_23c.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,6 @@ termux_setup_toolchain_23c() {
216216
rm -Rf usr/include/vulkan
217217
rm -Rf usr/include/{EGL,GLES{,2,3}}
218218

219-
sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \
220-
usr/include/android/api-level.h
221-
222219
$TERMUX_ELF_CLEANER --api-level=$TERMUX_PKG_API_LEVEL usr/lib/*/*/*.so | { [[ "${CI-}" == "true" ]] && sed -e '1i\::group::Applying `termux-elf-cleaner`' -e '$a\::endgroup::' || cat; }
223220
for dir in usr/lib/*; do
224221
# This seem to be needed when building rust

scripts/build/toolchain/termux_setup_toolchain_28c.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,6 @@ termux_setup_toolchain_28c() {
219219
rm -Rf usr/include/vulkan
220220
rm -Rf usr/include/{EGL,GLES{,2,3}}
221221

222-
sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \
223-
usr/include/android/api-level.h
224-
225222
$TERMUX_ELF_CLEANER --api-level=$TERMUX_PKG_API_LEVEL usr/lib/*/*/*.so | { [[ "${CI-}" == "true" ]] && sed -e '1i\::group::Applying `termux-elf-cleaner`' -e '$a\::endgroup::' || cat; }
226223
for dir in usr/lib/*; do
227224
# This seem to be needed when building rust

0 commit comments

Comments
 (0)