skeleton: bring AppImage parity, scaffolded apps inherit the packaging flow
The v0.1.0 shakedown fixes for AppImage assembly (path-repo
symlink:false sed, writable-cache redirect) all landed in
examples/todo. The skeleton — which is what bin/php-qml-init copies
when scaffolding a new app — had no `appimage` target at all, so every
scaffolded app would have to either copy the example's Makefile by
hand or re-discover the same shakedown bugs.
Brings parity:
- framework/skeleton/Makefile gains `staging-symfony` and `appimage`
targets, mirroring the example's. Two new variables (BUNDLE_SRC,
PACKAGING) parameterise the framework-tree paths so bin/php-qml-init
can rewrite them at scaffold time without sed-touching the recipe.
- framework/skeleton/packaging/skeleton.{desktop,png} added — minimum
surface for the AppImage assembly to succeed without the user
needing to author them.
- framework/skeleton/Makefile's staging-symfony recipe handles both
relative (framework default `../../php`) and absolute (post-scaffold)
BUNDLE_SRC values via a case statement.
- bin/php-qml-init renames packaging/skeleton.* → packaging/$NAME.*,
rewrites the .desktop file's Name/Exec/Icon, and updates the
Makefile's --app-name / --output / --desktop / --icon flags +
BUNDLE_SRC + PACKAGING variables. For --vendor mode, framework's
packaging/linux/ is also vendored to .bridge-packaging/ alongside
the existing .bridge/ + .bridge-qml/.
Verified by scaffolding both modes:
- non-vendored: BUNDLE_SRC + PACKAGING absolute paths
- --vendor: BUNDLE_SRC=../.bridge, PACKAGING=.bridge-packaging,
.bridge-packaging/ contains build-appimage.sh
Skeleton's `make quality` still green; staging-symfony works locally
(vendor/php-qml/bridge resolves to a real directory, not a symlink).
Closes the v0.1.1 follow-up "bin/php-qml-init parity" tracked in
PLAN.md §13.
Bundled drive-by: docs/makers.md picked up two markdownlint auto-fixes
(blank lines around lists) when the IDE saved.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -146,11 +146,31 @@ sed -i \
|
||||
-e "s|php-qml — skeleton|php-qml — $NAME|g" \
|
||||
"$TARGET/qml/Main.qml"
|
||||
|
||||
# Makefile: $(BUILD_DIR)/skeleton → $(BUILD_DIR)/$NAME.
|
||||
# Makefile: rewrite identifiers for the appimage target — binary name,
|
||||
# packaging filenames, AppImage output filename. The path-repo + packaging
|
||||
# absolute paths are handled later (after we know vendor vs absolute mode).
|
||||
sed -i \
|
||||
-e "s|\$(BUILD_DIR)/skeleton|\$(BUILD_DIR)/$NAME|g" \
|
||||
-e "s|--app-name skeleton|--app-name $NAME|g" \
|
||||
-e "s|packaging/skeleton.desktop|packaging/$NAME.desktop|g" \
|
||||
-e "s|packaging/skeleton.png|packaging/$NAME.png|g" \
|
||||
-e "s|build/Skeleton-x86_64.AppImage|build/$PASCAL-x86_64.AppImage|g" \
|
||||
"$TARGET/Makefile"
|
||||
|
||||
# Rename packaging files to match the app name + rewrite the Exec/Icon
|
||||
# fields in the .desktop file (XDG-launched binary lookup uses these).
|
||||
if [ -f "$TARGET/packaging/skeleton.desktop" ]; then
|
||||
mv "$TARGET/packaging/skeleton.desktop" "$TARGET/packaging/$NAME.desktop"
|
||||
sed -i \
|
||||
-e "s|^Name=php-qml Skeleton|Name=php-qml $PASCAL|" \
|
||||
-e "s|^Exec=skeleton|Exec=$NAME|" \
|
||||
-e "s|^Icon=skeleton|Icon=$NAME|" \
|
||||
"$TARGET/packaging/$NAME.desktop"
|
||||
fi
|
||||
if [ -f "$TARGET/packaging/skeleton.png" ]; then
|
||||
mv "$TARGET/packaging/skeleton.png" "$TARGET/packaging/$NAME.png"
|
||||
fi
|
||||
|
||||
# .vscode/launch.json: binary path + config label both mention `skeleton`.
|
||||
if [ -f "$TARGET/.vscode/launch.json" ]; then
|
||||
sed -i \
|
||||
@@ -168,6 +188,8 @@ if [ "$VENDOR" -eq 1 ]; then
|
||||
mkdir -p "$TARGET/.bridge"
|
||||
say "vendoring framework/qml → $NAME/.bridge-qml/"
|
||||
mkdir -p "$TARGET/.bridge-qml"
|
||||
say "vendoring framework/packaging → $NAME/.bridge-packaging/"
|
||||
mkdir -p "$TARGET/.bridge-packaging"
|
||||
if command -v rsync >/dev/null 2>&1; then
|
||||
rsync -a --delete \
|
||||
--exclude 'vendor/' --exclude '.phpunit.cache/' \
|
||||
@@ -176,18 +198,23 @@ if [ "$VENDOR" -eq 1 ]; then
|
||||
rsync -a --delete \
|
||||
--exclude 'build/' \
|
||||
"$FRAMEWORK/framework/qml/" "$TARGET/.bridge-qml/"
|
||||
rsync -a --delete \
|
||||
"$FRAMEWORK/packaging/linux/" "$TARGET/.bridge-packaging/"
|
||||
else
|
||||
cp -R "$FRAMEWORK/framework/php/." "$TARGET/.bridge/"
|
||||
cp -R "$FRAMEWORK/framework/qml/." "$TARGET/.bridge-qml/"
|
||||
cp -R "$FRAMEWORK/packaging/linux/." "$TARGET/.bridge-packaging/"
|
||||
rm -rf "$TARGET/.bridge/vendor" "$TARGET/.bridge-qml/build" 2>/dev/null || true
|
||||
fi
|
||||
BUNDLE_URL="../.bridge"
|
||||
# qml/CMakeLists.txt lives at $TARGET/qml/, vendored qml module at
|
||||
# $TARGET/.bridge-qml/, so the relative path from the consumer is ../.bridge-qml.
|
||||
QML_FW_PATH="\${CMAKE_CURRENT_SOURCE_DIR}/../.bridge-qml"
|
||||
PACKAGING_PATH=".bridge-packaging"
|
||||
else
|
||||
BUNDLE_URL="$FRAMEWORK/framework/php"
|
||||
QML_FW_PATH="$FRAMEWORK/framework/qml"
|
||||
PACKAGING_PATH="$FRAMEWORK/packaging/linux"
|
||||
fi
|
||||
say "path-repo → $BUNDLE_URL"
|
||||
# Replace the original "../../php" path-repo URL. The skeleton's
|
||||
@@ -206,6 +233,15 @@ sed -i \
|
||||
-e "s|\${CMAKE_CURRENT_SOURCE_DIR}/../../qml|$QML_FW_PATH|g" \
|
||||
"$TARGET/qml/CMakeLists.txt"
|
||||
|
||||
# Makefile: BUNDLE_SRC + PACKAGING were framework-tree relative; rewrite
|
||||
# to absolute (or the vendored path). Both are matched against the literal
|
||||
# values in the skeleton Makefile.
|
||||
say "appimage paths → bundle=$BUNDLE_URL packaging=$PACKAGING_PATH"
|
||||
sed -i \
|
||||
-e "s|^BUNDLE_SRC := ../../php\$|BUNDLE_SRC := $BUNDLE_URL|" \
|
||||
-e "s|^PACKAGING := ../../packaging/linux\$|PACKAGING := $PACKAGING_PATH|" \
|
||||
"$TARGET/Makefile"
|
||||
|
||||
# ── Composer install + first-run migrations ──────────────────────────
|
||||
if [ "$SKIP_INSTALL" -eq 1 ]; then
|
||||
say "skipping composer install (--skip-install)"
|
||||
|
||||
Reference in New Issue
Block a user