Automacao de empacotamento AppImage (make appimage)
- Makefile: alvos "appdir" (monta build/TinyBlocks.AppDir), "appimage"
(baixa o appimagetool e gera build/TinyBlocks-<ver>-x86_64.AppImage),
"run-appimage" e "icon".
- packaging/: tinyblocks.desktop, AppRun, tinyblocks.png (icone 256x256)
e make_icon.py (gera o icone sem dependencias externas).
- appdir:
* empacota o editor + SDL2/SDL2_ttf (com uma excludelist das libs do
sistema: glibc, X11/GL, som, dbus, systemd...);
* copia as libraries de extensao (.so + library.toml) para
usr/share/tinyblocks/libraries/<nome>/build;
- libman: tb_libman_scan_defaults agora tambem varre libraries ao lado do
executavel (usr/share/tinyblocks/libraries e usr/lib/...), de modo que o
AppImage acha suas extensoes mesmo rodando fora do repositorio.
Verificado: AppImage monta, abre o editor e carrega um .so empacotado
(TOML) pela tela "Escolha uma Extensao".
This commit is contained in:
1 parent
b29908e65b
commit
4de611cc1e
6 files changed
+206
No files matched your search
@@ -77,6 +77,7 @@ LIB_LDFLAGS := -L$(ED_DIR)/build -L$(GX_DIR)/build -L$(SD_DIR)/build \
|
||||
|
||||
.PHONY: all help debug release static shared example sdl2 clean run python-lib mcp-lib json \
|
||||
editor run-editor run-sdl2 mylib vector customappearance graphics sdl2-backend test-editor \
|
||||
appdir appimage run-appimage icon \
|
||||
test-toml test-plugin test-blueprint \
|
||||
category-libs category-sos libs \
|
||||
lib-events lib-control lib-operators lib-variables lib-appearance lib-pen lib-fs \
|
||||
@@ -228,6 +229,76 @@ editor: static libs $(BUILD)/editor ## Compila o editor visual (estilo Scratch)
|
||||
run-editor: editor ## Compila e abre o editor visual
|
||||
./$(BUILD)/editor
|
||||
|
||||
# ── Empacotamento AppImage ──────────────────────────────────────────────
|
||||
APP_NAME := TinyBlocks
|
||||
APP_VER := 0.1.0
|
||||
APPDIR := $(BUILD)/$(APP_NAME).AppDir
|
||||
APPIMAGE := $(BUILD)/$(APP_NAME)-$(APP_VER)-x86_64.AppImage
|
||||
AITOOL := $(BUILD)/.tools/appimagetool-x86_64.AppImage
|
||||
AITOOL_URL := https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
PKG_DIR := packaging
|
||||
|
||||
# Bibliotecas que NAO devem ser empacotadas (glibc, X11/GL/som do sistema).
|
||||
APPIMAGE_EXCLUDE := ld-linux libc.so libm.so libpthread librt libdl libgcc_s libstdc++ \
|
||||
libGL libEGL libGLX libGLdispatch libOpenGL libGLU libdrm libgbm \
|
||||
libX11 libxcb libXau libXdmcp libXext libXrender libXfixes libXi libXrandr \
|
||||
libXcursor libXss libXinerama libxkbcommon libwayland libdecor \
|
||||
libdbus libasound libpulse libpulsecommon libsystemd libudev libselinux libmount
|
||||
|
||||
$(AITOOL):
|
||||
@mkdir -p $(BUILD)/.tools
|
||||
@echo "Baixando appimagetool..."
|
||||
@curl -fL --retry 3 -o $@ $(AITOOL_URL) || { rm -f $@; \
|
||||
echo "Falha ao baixar appimagetool. Baixe manualmente em"; \
|
||||
echo " $(AITOOL_URL)"; \
|
||||
echo "e rode: make appimage APPIMAGETOOL=/caminho/appimagetool"; exit 1; }
|
||||
@chmod +x $@
|
||||
|
||||
appdir: editor ## Monta o AppDir (build/TinyBlocks.AppDir) para o AppImage
|
||||
$(RM) -r $(APPDIR)
|
||||
mkdir -p $(APPDIR)/usr/bin $(APPDIR)/usr/lib \
|
||||
$(APPDIR)/usr/share/applications \
|
||||
$(APPDIR)/usr/share/icons/hicolor/256x256/apps
|
||||
cp $(BUILD)/editor $(APPDIR)/usr/bin/tinyblocks
|
||||
cp $(PKG_DIR)/tinyblocks.png $(APPDIR)/usr/share/icons/hicolor/256x256/apps/tinyblocks.png
|
||||
cp $(PKG_DIR)/tinyblocks.png $(APPDIR)/tinyblocks.png
|
||||
cp $(PKG_DIR)/tinyblocks.desktop $(APPDIR)/tinyblocks.desktop
|
||||
cp $(PKG_DIR)/tinyblocks.desktop $(APPDIR)/usr/share/applications/tinyblocks.desktop
|
||||
cp $(PKG_DIR)/AppRun $(APPDIR)/AppRun
|
||||
chmod +x $(APPDIR)/AppRun
|
||||
@echo "Empacotando bibliotecas (exceto as do sistema)..."
|
||||
@ldd $(BUILD)/editor | awk '/=> \//{print $$1, $$3}' | while read name path; do \
|
||||
skip=0; \
|
||||
for ex in $(APPIMAGE_EXCLUDE); do case "$$name" in $$ex*) skip=1;; esac; done; \
|
||||
[ $$skip -eq 0 ] && cp -L "$$path" $(APPDIR)/usr/lib/ 2>/dev/null || true; \
|
||||
done
|
||||
@echo "Empacotando libraries de extensao (.so + library.toml)..."
|
||||
@mkdir -p $(APPDIR)/usr/share/tinyblocks/libraries
|
||||
@for d in $(LIBDIR)/tinyblocks-*/; do \
|
||||
name=$$(basename "$$d"); \
|
||||
[ -f "$$d"library.toml ] || continue; \
|
||||
so=$$(ls "$${d}build/"*.so 2>/dev/null | head -1); \
|
||||
[ -n "$$so" ] || continue; \
|
||||
mkdir -p "$(APPDIR)/usr/share/tinyblocks/libraries/$$name/build"; \
|
||||
cp "$$d"library.toml "$(APPDIR)/usr/share/tinyblocks/libraries/$$name/"; \
|
||||
cp "$$so" "$(APPDIR)/usr/share/tinyblocks/libraries/$$name/build/"; \
|
||||
done
|
||||
@echo "AppDir pronto: $(APPDIR)"
|
||||
|
||||
appimage: appdir ## Gera o AppImage portatil (build/TinyBlocks-*.AppImage)
|
||||
@test -n "$(APPIMAGETOOL)" || $(MAKE) $(AITOOL)
|
||||
@TOOL="$(if $(APPIMAGETOOL),$(APPIMAGETOOL),$(abspath $(AITOOL)))"; \
|
||||
cd $(BUILD) && ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 \
|
||||
"$$TOOL" --no-appstream $(abspath $(APPDIR)) $(abspath $(APPIMAGE))
|
||||
@echo "AppImage: $(APPIMAGE)"
|
||||
@echo "Rode com: $(APPIMAGE)"
|
||||
|
||||
run-appimage: appimage ## Gera e abre o AppImage
|
||||
./$(APPIMAGE)
|
||||
|
||||
icon: ## (Re)gera o icone do AppImage (packaging/tinyblocks.png)
|
||||
python3 $(PKG_DIR)/make_icon.py
|
||||
|
||||
# -- Exemplo de library externa (hot reload) ---
|
||||
$(BUILD)/mylib.so: examples/mylib/mylib.c $(LIB_A)
|
||||
$(CC) $(CFLAGS_REL) -Iinclude -fPIC -shared \
|
||||
|
||||
Reference in new issue
Block a user