-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·46 lines (34 loc) · 1.08 KB
/
build.sh
File metadata and controls
executable file
·46 lines (34 loc) · 1.08 KB
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
#!/bin/bash
set -e
source setup.sh
PACKAGE_NAME=com.logicodeum.ide
PREFIX="data/data/$PACKAGE_NAME/files/usr"
NDK="$ANDROID_NDK"
TOOLCHAIN="$NDK/toolchains/llvm/prebuilt/linux-x86_64"
SYSROOT="$TOOLCHAIN/sysroot/usr/lib"
copy_libcxx() {
ARCH=$1
echo "Setting up libc++ for $ARCH"
case $ARCH in
arm64) TARGET=aarch64-linux-android ;;
arm) TARGET=arm-linux-androideabi ;;
x86) TARGET=i686-linux-android ;;
x86_64) TARGET=x86_64-linux-android ;;
*) echo "Unknown arch $ARCH"; exit 1 ;;
esac
BUILD_DIR="build-$ARCH"
INSTALL_DIR="$PWD/$BUILD_DIR/install/$PREFIX"
mkdir -p "$INSTALL_DIR/lib"
SRC="$SYSROOT/$TARGET"
# Copy shared + static
cp "$SRC/libc++_shared.so" "$INSTALL_DIR/lib/"
cp "$SRC/libc++_static.a" "$INSTALL_DIR/lib/" 2>/dev/null || true
# Optional: strip to reduce size
"$TOOLCHAIN/bin/llvm-strip" "$INSTALL_DIR/lib/libc++_shared.so" || true
}
for arch in arm64 arm x86 x86_64; do
copy_libcxx $arch
done
echo "Done."
echo "Binaries placed at:"
echo "build-<arch>/install/$PREFIX/lib"