Skip to content

Commit 7f71a05

Browse files
committed
Initial commit
0 parents  commit 7f71a05

3 files changed

Lines changed: 108 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
setup-and-build:
8+
runs-on: ubuntu-latest
9+
10+
env:
11+
NDK_VERSION: r26d
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Build for all architectures
18+
run: |
19+
chmod +x ./build.sh
20+
./build.sh
21+
22+
- name: Upload build artifacts
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: ndk-build-artifacts
26+
path: |
27+
build-arm64/install
28+
build-arm/install
29+
build-x86/install
30+
build-x86_64/install

build.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
set -e
3+
4+
source setup.sh
5+
6+
PACKAGE_NAME=com.logicodeum.ide
7+
PREFIX="data/data/$PACKAGE_NAME/files/usr"
8+
9+
NDK="$ANDROID_NDK"
10+
TOOLCHAIN="$NDK/toolchains/llvm/prebuilt/linux-x86_64"
11+
SYSROOT="$TOOLCHAIN/sysroot/usr/lib"
12+
13+
copy_libcxx() {
14+
ARCH=$1
15+
echo "Setting up libc++ for $ARCH"
16+
17+
case $ARCH in
18+
arm64) TARGET=aarch64-linux-android ;;
19+
arm) TARGET=arm-linux-androideabi ;;
20+
x86) TARGET=i686-linux-android ;;
21+
x86_64) TARGET=x86_64-linux-android ;;
22+
*) echo "Unknown arch $ARCH"; exit 1 ;;
23+
esac
24+
25+
BUILD_DIR="build-$ARCH"
26+
INSTALL_DIR="$PWD/$BUILD_DIR/install/$PREFIX"
27+
28+
mkdir -p "$INSTALL_DIR/lib"
29+
30+
SRC="$SYSROOT/$TARGET"
31+
32+
# Copy shared + static
33+
cp "$SRC/libc++_shared.so" "$INSTALL_DIR/lib/"
34+
cp "$SRC/libc++_static.a" "$INSTALL_DIR/lib/" 2>/dev/null || true
35+
36+
# Optional: strip to reduce size
37+
"$TOOLCHAIN/bin/llvm-strip" "$INSTALL_DIR/lib/libc++_shared.so" || true
38+
}
39+
40+
for arch in arm64 arm x86 x86_64; do
41+
copy_libcxx $arch
42+
done
43+
44+
echo "Done."
45+
echo "Binaries placed at:"
46+
echo "build-<arch>/install/$PREFIX/lib"

setup.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
set -e
3+
4+
NDK_VERSION="r26d"
5+
NDK_ZIP="android-ndk-${NDK_VERSION}-linux.zip"
6+
NDK_DIR="$PWD/android-ndk-${NDK_VERSION}"
7+
NDK_URL="https://dl.google.com/android/repository/${NDK_ZIP}"
8+
9+
PACKAGES=(build-essential clang llvm make cmake pkg-config autoconf automake libtool unzip curl wget git python3)
10+
11+
for pkg in "${PACKAGES[@]}"; do
12+
if ! dpkg -s "$pkg" >/dev/null 2>&1; then
13+
sudo apt-get install -y "$pkg"
14+
fi
15+
done
16+
17+
if [ ! -d "$NDK_DIR" ]; then
18+
if [ ! -f "$NDK_ZIP" ]; then
19+
wget -q --show-progress "$NDK_URL"
20+
fi
21+
unzip -q "$NDK_ZIP"
22+
fi
23+
24+
export ANDROID_NDK="$NDK_DIR"
25+
export TOOLCHAIN="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64"
26+
export PATH="$TOOLCHAIN/bin:$PATH"
27+
28+
ls "$TOOLCHAIN/bin" | grep -q clang || { echo "Toolchain missing!"; exit 1; }
29+
30+
echo "NDK setup done"
31+
echo "ANDROID_NDK=$ANDROID_NDK"
32+
echo "TOOLCHAIN=$TOOLCHAIN"

0 commit comments

Comments
 (0)