Skip to content

Commit

Permalink
build(perf): use newer ndk paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias-Boulay committed Apr 15, 2024
1 parent 7706022 commit f82a61c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
14 changes: 8 additions & 6 deletions maketoolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
set -e

. setdevkitpath.sh

$NDK/build/tools/make_standalone_toolchain.py \
--arch=${TARGET_SHORT} \
--api=21 \
--install-dir=$NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain
cp devkit.info.${TARGET_SHORT} $NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain/

# No need since all toolchains are standalone
# $NDK/build/tools/make_standalone_toolchain.py \
# --arch=${TARGET_SHORT} \
# --api=21 \
# --install-dir=$NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain

cp devkit.info.${TARGET_SHORT} ${TOOLCHAIN}
6 changes: 3 additions & 3 deletions removejdkdebuginfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rm -rf dizout jreout jdkout dSYM-temp
mkdir -p dizout dSYM-temp/{lib,bin}

if [[ "$BUILD_IOS" != "1" ]]; then
cp freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT/lib/libfreetype.so $imagespath/jdk/lib/
cp freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT/lib/libfreetype.so $imagespath/jdk/lib/
fi

cp -r $imagespath/jdk jdkout
Expand All @@ -32,11 +32,11 @@ jlink \
--module-path=jdkout/jmods \
--add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.management.rmi,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.se,java.security.jgss,java.security.sasl,java.sql,java.sql.rowset,java.transaction.xa,java.xml,java.xml.crypto,jdk.accessibility,jdk.charsets,jdk.crypto.cryptoki,jdk.crypto.ec,jdk.dynalink,jdk.httpserver,jdk.jdwp.agent,jdk.jfr,jdk.jsobject,jdk.localedata,jdk.management,jdk.management.agent,jdk.management.jfr,jdk.naming.dns,jdk.naming.rmi,jdk.net,jdk.nio.mapmode,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsupported,jdk.xml.dom,jdk.zipfs$EXTRA_JLINK_OPTION \
--output jreout \
--strip-debug \
--strip-native-debug-symbols=exclude-debuginfo-files:objcopy=${OBJCOPY} \
--no-man-pages \
--no-header-files \
--release-info=jdkout/release \
--compress=0
--compress=0

if [[ "$BUILD_IOS" != "1" ]]; then
cp freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT/lib/libfreetype.so jreout/lib/
Expand Down
17 changes: 12 additions & 5 deletions setdevkitpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,23 @@ export JVM_PLATFORM=linux
export API=21
export NDK=$PWD/android-ndk-$NDK_VERSION
export ANDROID_NDK_ROOT=$NDK
export TOOLCHAIN=$NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain
# export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
#export TOOLCHAIN=$NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64

export ANDROID_INCLUDE=$TOOLCHAIN/sysroot/usr/include


# If I'm right it should only need the dummy libs
export CPPFLAGS="-I$ANDROID_INCLUDE -I$ANDROID_INCLUDE/$TARGET" # -I/usr/include -I/usr/lib
export LDFLAGS="-L$NDK/platforms/android-$API/arch-$TARGET_SHORT/usr/lib"
#export LDFLAGS="-L$NDK/platforms/android-$API/arch-$TARGET_SHORT/usr/lib"
export CPPFLAGS=""
export LDFLAGS=""

export thecc=$TOOLCHAIN/bin/$TARGET-gcc
export thecxx=$TOOLCHAIN/bin/$TARGET-g++
# Underlying compiler called by the wrappers
# export thecc=$TOOLCHAIN/bin/$TARGET-gcc
# export thecxx=$TOOLCHAIN/bin/$TARGET-g++
export thecc=$TOOLCHAIN/bin/${NDK_PREBUILT_ARCH}-linux-android${API}-clang
export thecxx=$TOOLCHAIN/bin/${NDK_PREBUILT_ARCH}-linux-android${API}-clang++

# Configure and build.
export AR=$TOOLCHAIN/bin/llvm-ar
Expand Down
5 changes: 3 additions & 2 deletions tarjdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ if [[ "$BUILD_IOS" != "1" ]]; then
unset AR AS CC CXX LD OBJCOPY RANLIB STRIP CPPFLAGS LDFLAGS
git clone https://github.com/termux/termux-elf-cleaner || true
cd termux-elf-cleaner
git checkout eab198c72a020e883b79f99b70a5aa0243dbf0a8
autoreconf --install
bash configure
make CFLAGS=-D__ANDROID_API__=24
make CFLAGS=-D__ANDROID_API__=${API}
cd ..

findexec() { find $1 -type f -name "*" -not -name "*.o" -exec sh -c '
Expand All @@ -32,7 +33,7 @@ cp -rv jre_override/lib/* jreout/lib/ || true
cd jreout

# Strip in place all .so files thanks to the ndk
find ./ -name '*.so' -execdir $NDK/toolchains/llvm/prebuilt/linux-x86_64/${NDK_PREBUILT_ARCH}-linux-android/bin/strip {} \;
find ./ -name '*.so' -execdir ${TOOLCHAIN}/bin/llvm-strip {} \;

tar cJf ../jre17-${TARGET_SHORT}-`date +%Y%m%d`-${JDK_DEBUG_LEVEL}.tar.xz .

Expand Down

0 comments on commit f82a61c

Please sign in to comment.