Skip to content

Commit

Permalink
added android ndk
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed May 31, 2024
1 parent 5ce23a4 commit 314cc69
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "go-src"]
path = go-src
url = https://github.com/golang/go
branch = release-branch.go1.22
branch = release-branch.go1.22.2
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ RUN cd /go-src && make build-termux
FROM golang:1.22.1
COPY --from=build /usr/local/go/ /usr/local/go
COPY --from=build-termux /usr/local/go/ /usr/local/go-termux/
RUN ln -s /usr/local/go-termux/bin/go /usr/local/bin/go-termux

RUN apt-get update && apt-get install -y sdktools
ENV NDK_VERSION r26.d
RUN sdktools --install 'ndk;${NDK_VERSION}'
ADD go-termux.sh /usr/local/bin/go-termux
8 changes: 8 additions & 0 deletions go-termux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

bindir=/opt/android-sdk/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/linux-x86_64/bin
[ "$GOARCH" = "amd64" ] && export CC="$bindir/x86_64-linux-android34-clang"
[ "$GOARCH" = "arm64" ] && export CC="$bindir/aarch64-linux-android34-clang"
[ "$GOARCH" = "arm" ] && export CC="$bindir/armv7a-linux-androideabi34-clang"

exec /usr/local/go-termux/bin/go "$@"

0 comments on commit 314cc69

Please sign in to comment.