Base movel: firmware ESP32 com API REST, OTA e canal pipe.ovelha.cloud
- software/firmware/RoboMovel_CNCV3_ESP32_REST: firmware para Wemos D1 R32 + CNC Shield V3 (4 NEMA17 mecanum), API REST (/move, /stop, /status, /wifi), redes Wi-Fi salvas, gravacao pelo Wi-Fi (ota.sh), descoberta por broadcast UDP 4210 e cliente do canal publico pipe.ovelha.cloud. Senhas das redes padrao ficam em redes_padrao.h (fora do git). - software/pipe-ovelha: servidor do canal publico (aiohttp) com nginx e servico systemd. - app/robomovel-esp32-joystick-app: app Kivy so com joystick, busca automatica do robo na rede local e uso do pipe.ovelha.cloud pela internet. - compilar_apk.sh: corrige caminhos do autotools local (autom4te.cfg e libtoolize). - Remove backup .lbrn2 da chapa base.
This commit is contained in:
1 parent
6405625c1a
commit
43fae8237a
19 files changed
+1601
-6461
No files matched your search
+104
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env bash
|
||||
# Compila o APK de depuração (arm64-v8a) do app de joystick do RoboMovel (ESP32).
|
||||
#
|
||||
# O script cuida das duas armadilhas do buildozer/python-for-android:
|
||||
#
|
||||
# 1. O recipe do libffi (usado pelo python3) roda autogen.sh/autoreconf e
|
||||
# precisa de autoconf, automake, libtool e libltdl-dev. Se eles não
|
||||
# estiverem no sistema, o script baixa os .deb e extrai uma cópia local
|
||||
# em ~/.local/share/robomovel-build/autotools (não precisa de sudo).
|
||||
# 2. O python-for-android trata os wheels marcados "android" como puros e o
|
||||
# pip do host recusa ("not a supported wheel on this platform"). O patch
|
||||
# p4a-android-wheel.patch corrige isso e também evita o auto-upgrade do
|
||||
# pip do hostpython (que quebrava o venv do build).
|
||||
#
|
||||
# Uso: ./compilar_apk.sh (compila)
|
||||
# ./compilar_apk.sh --limpar (apaga .buildozer e recompila do zero)
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
FERR="${XDG_DATA_HOME:-$HOME/.local/share}/robomovel-build"
|
||||
AUTOTOOLS="$FERR/autotools"
|
||||
P4A=".buildozer/android/platform/python-for-android"
|
||||
APK="bin/robomoveljoystick-0.1.0-arm64-v8a-debug.apk"
|
||||
|
||||
# --- 1. autotools locais (só se o sistema não tiver) -----------------------
|
||||
if ! command -v autoreconf >/dev/null 2>&1; then
|
||||
if [ ! -x "$AUTOTOOLS/usr/bin/autoreconf" ]; then
|
||||
echo "==> Baixando autoconf/automake/libtool para $AUTOTOOLS"
|
||||
mkdir -p "$FERR/debs"
|
||||
(cd "$FERR/debs" && apt-get download autoconf automake m4 libtool libltdl-dev)
|
||||
for d in "$FERR"/debs/*.deb; do dpkg-deb -x "$d" "$AUTOTOOLS"; done
|
||||
|
||||
# Os pacotes do Debian gravam /usr/share/... e /usr/bin/... dentro
|
||||
# dos scripts; apontamos tudo para a cópia local.
|
||||
grep -rlI "/usr/share\|/usr/bin/" "$AUTOTOOLS/usr/share" 2>/dev/null |
|
||||
while read -r f; do
|
||||
sed -i -e "s|/usr/share|$AUTOTOOLS/usr/share|g" \
|
||||
-e "s|/usr/bin/autom4te|$AUTOTOOLS/usr/bin/autom4te|g" \
|
||||
-e "s|/usr/bin/autoconf|$AUTOTOOLS/usr/bin/autoconf|g" \
|
||||
-e "s|/usr/bin/autoheader|$AUTOTOOLS/usr/bin/autoheader|g" \
|
||||
-e "s|'/usr/bin/m4'|'$AUTOTOOLS/usr/bin/m4'|g" "$f"
|
||||
done
|
||||
# Idem nos scripts perl de usr/bin, com wrappers que fixam PERL5LIB.
|
||||
for f in autoreconf autoconf autoheader autom4te autoscan autoupdate \
|
||||
ifnames aclocal-1.16 automake-1.16; do
|
||||
[ -f "$AUTOTOOLS/usr/bin/$f" ] || continue
|
||||
mv "$AUTOTOOLS/usr/bin/$f" "$AUTOTOOLS/usr/bin/$f.real"
|
||||
sed -i -e "s|/usr/share|$AUTOTOOLS/usr/share|g" \
|
||||
-e "s|/usr/bin/autom4te|$AUTOTOOLS/usr/bin/autom4te|g" \
|
||||
-e "s|/usr/bin/autoconf|$AUTOTOOLS/usr/bin/autoconf|g" \
|
||||
-e "s|/usr/bin/autoheader|$AUTOTOOLS/usr/bin/autoheader|g" \
|
||||
-e "s|'/usr/bin/m4'|'$AUTOTOOLS/usr/bin/m4'|g" \
|
||||
"$AUTOTOOLS/usr/bin/$f.real"
|
||||
printf '#!/bin/sh\nexport PERL5LIB=%s/usr/share/autoconf:%s/usr/share/automake-1.16\nexec %s/usr/bin/%s.real "$@"\n' \
|
||||
"$AUTOTOOLS" "$AUTOTOOLS" "$AUTOTOOLS" "$f" > "$AUTOTOOLS/usr/bin/$f"
|
||||
chmod +x "$AUTOTOOLS/usr/bin/$f"
|
||||
done
|
||||
(cd "$AUTOTOOLS/usr/bin" && ln -sf automake-1.16 automake && ln -sf aclocal-1.16 aclocal)
|
||||
# libtoolize é shell (não passa pelo laço acima) e também tem /usr/share fixo.
|
||||
sed -i "s|=\"/usr/share|=\"$AUTOTOOLS/usr/share|g" "$AUTOTOOLS/usr/bin/libtoolize"
|
||||
# autom4te.cfg também tem caminho fixo, mas já foi corrigido no laço acima
|
||||
# (fica em usr/share); corrigir de novo duplicaria o prefixo.
|
||||
fi
|
||||
export PATH="$AUTOTOOLS/usr/bin:$PATH"
|
||||
fi
|
||||
|
||||
# --- 2. venv do buildozer --------------------------------------------------
|
||||
if [ ! -x .buildozer-venv/bin/buildozer ]; then
|
||||
echo "==> Criando .buildozer-venv"
|
||||
python3 -m venv .buildozer-venv
|
||||
.buildozer-venv/bin/pip install -q --upgrade pip
|
||||
.buildozer-venv/bin/pip install -q "buildozer==1.6.0"
|
||||
fi
|
||||
export VIRTUAL_ENV="$PWD/.buildozer-venv"
|
||||
export PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
if [ "${1:-}" = "--limpar" ]; then
|
||||
echo "==> Apagando .buildozer (build do zero; demora bastante)"
|
||||
rm -rf .buildozer
|
||||
fi
|
||||
|
||||
# --- 3. patch do python-for-android ---------------------------------------
|
||||
aplicar_patch() {
|
||||
[ -d "$P4A" ] || return 0
|
||||
if grep -q 'android" in filename' "$P4A/pythonforandroid/build.py"; then
|
||||
return 0
|
||||
fi
|
||||
echo "==> Aplicando p4a-android-wheel.patch"
|
||||
if ! git -C "$P4A" apply "$PWD/p4a-android-wheel.patch"; then
|
||||
echo "AVISO: o patch não aplicou (o python-for-android mudou?)." >&2
|
||||
echo " Se o build falhar com 'not a supported wheel', revise o patch." >&2
|
||||
fi
|
||||
}
|
||||
|
||||
# A primeira execução clona o p4a e só então dá para aplicar o patch.
|
||||
aplicar_patch
|
||||
if ! .buildozer-venv/bin/buildozer android debug; then
|
||||
aplicar_patch
|
||||
.buildozer-venv/bin/buildozer android debug
|
||||
fi
|
||||
|
||||
ls -lh "$APK"
|
||||
echo "APK: $PWD/$APK"
|
||||
Reference in new issue
Block a user