prepare Makefie and stuff for apk/{webview,native}

This commit is contained in:
Alexander Mahr 2024-10-10 13:59:02 +02:00
parent 3a9ac9f73f
commit 6327c380ba
3 changed files with 44 additions and 21 deletions

View file

@ -1,7 +1,7 @@
FROM archlinux:latest
RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm coreutils bash shadow make unzip jdk11-openjdk wget
RUN pacman -S --noconfirm coreutils bash shadow make unzip zip jdk11-openjdk wget
ENV ANDROID_SDK_ROOT="/opt/android"
ENV BUILD_TOOLS_LATEST="$ANDROID_SDK_ROOT/cmdline-tools/latest"
RUN BUILD_TOOLS="$(realpath -m "$BUILD_TOOLS_LATEST/..")";\
@ -19,9 +19,11 @@ ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk/"
#ENTRYPOINT bash -c 'sleep 10000'
ENV LIBRARY_PATH="$LIBRARY_PATH:$BUILD_TOOLS_LATEST/lib"
ARG YESACCEPT=n
RUN test "$YESACCEPT" = "y" || { printf "\033[31;1;4m%s\n%s\033[0m " "FAILED TO BUILD CONTAINER: You did not ACCEPT THE UPSTREAM LICENSE" " -> export YESACCEPT=y" >&2; exit 1; }
RUN echo you selected to accept the licenses/TOS
RUN echo "$YESACCEPT" | sdkmanager --install "build-tools;33.0.2"
RUN echo "$YESACCEPT" | sdkmanager --install "platforms;android-33"
RUN echo "$YESACCEPT" | sdkmanager --install "ndk;28.0.12433566"
#RUN apk add setpriv
COPY entrypoint.sh /entrypoint.sh
RUN chown 0:0 /entrypoint.sh

View file

@ -1,36 +1,47 @@
all: build install
all: docker-compose-build.log build-all install-all
build:
docker-compose run compile
.PHONY: build-all
build-all: build-webview build-native
install:
adb install -r ./apk/example.app.apk
.PHONY: build-webview
build-webview:
docker-compose run --rm compile webview
ln -sf apk/webview/result/example.app.apk ./; test -e ./example.app.apk || rm ./example.app.apk
.PHONY: build-native
build-native:
docker-compose run --rm compile native
#ln -sf apk/native/result/example.app.apk ./; test -e ./example.app.apk || rm ./example.app.apk
.PHONY: install-all
install-all: install-webview install-native
.PHONY: install-webview
install-webview:
adb install -r ./example.app.apk
.PHONY: install-native
install-native:
true
#adb install -r ./example.app.apk
.PHONY: clean-all
clean-all: clean-docker clean-apk
.PHONY: clean-docker
clean-docker:
rm docker-compose-build.log || true
docker-compose down --remove-orphans --rmi all
.PHONY: clean-apk
clean-apk:
cd apk && $(MAKE) clean
apk: apk/app.apk
true
apk/app.apk: docker-compose-build.log
docker-compose run --rm compile
docker-compose-build.log: Dockerfile docker-compose.yml
docker-compose-build.log: Dockerfile compose.yml
docker-compose down --remove-orphans --rmi all
BUILDKIT_PROGRESS=plain docker-compose build | tee docker-compose-build.log

View file

@ -1,8 +1,18 @@
#!/bin/sh
cd /apk;
VOLUID="$(stat -c "%u" /apk)";
VOLGID="$(stat -c "%g" /apk)";
CMD="${*:-"make"}"
setpriv --reuid $VOLUID --regid $VOLGID --clear-groups sh -c "$CMD"
set -x
APKDIR="/apk/$1"
shift
#test -d "$1" ==
#APKDIR=
#cd /apk/$1;
#shift
VOLUID="$(stat -c "%u" "$APKDIR")";
VOLGID="$(stat -c "%g" "$APKDIR")";
#CMD="${*:-"make"}"
cd "$APKDIR"
test -z "$*" && set -- make
setpriv --reuid $VOLUID --regid $VOLGID --clear-groups sh -c "$*"