-
Notifications
You must be signed in to change notification settings - Fork 11
/
tarjdk.sh
executable file
·48 lines (38 loc) · 1.14 KB
/
tarjdk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
. setdevkitpath.sh
unset AR AS CC CXX LD OBJCOPY RANLIB STRIP CPPFLAGS LDFLAGS
git clone --depth 1 https://github.com/termux/termux-elf-cleaner || true
cd termux-elf-cleaner
mkdir build
cd build
export CFLAGS=-D__ANDROID_API__=${API}
cmake ..
make -j4
unset CFLAGS
cd ../..
findexec() { find $1 -type f -name "*" -not -name "*.o" -exec sh -c '
case "$(head -n 1 "$1")" in
?ELF*) exit 0;;
MZ*) exit 0;;
#!*/ocamlrun*)exit0;;
esac
exit 1
' sh {} \; -print
}
findexec jreout | xargs -- ./termux-elf-cleaner/build/termux-elf-cleaner
findexec jdkout | xargs -- ./termux-elf-cleaner/build/termux-elf-cleaner
cp -rv jre_override/lib/* jreout/lib/ || true
cp -rv jre_override/lib/* jdkout/lib/ || true
if [ "${TARGET_SHORT}" = "arm64" ] && [ -f jreout/lib/jspawnhelper ]; then
cp jreout/lib/jspawnhelper libjsph17.so
fi
cd jreout
# Strip
find ./ -name '*.so' -execdir ${TOOLCHAIN}/bin/llvm-strip {} \;
tar cJf ../jre17-${TARGET_SHORT}-`date +%Y%m%d`-${JDK_DEBUG_LEVEL}.tar.xz .
cd ../jdkout
tar cJf ../jdk17-${TARGET_SHORT}-`date +%Y%m%d`-${JDK_DEBUG_LEVEL}.tar.xz .
# Remove jreout and jdkout
cd ..
rm -rf jreout jdkout