The app was built against a checkout of Crafter.Graphics given with --graphics=, because the text-input purposes it asks the input method for were uncommitted work in one checkout. They are on Crafter.Graphics' master since a9ce1a0, so project.cpp names the library as a GitProject at that commit, as it names Crafter.Network and Crafter.DB. --graphics= is gone, and with it $NOSTRO_GRAPHICS in build-aarch64.sh and the workflow's step that cloned the branch claude/nostro-app, which the forge never had: neither job of the workflow could have built the app. That master also has 89111e0, which the window was not written against. A size the compositor configures is no longer taken in the configure's listener. The listener keeps it and fires onFrameOwed, and the next Render() makes the swapchain again, fires onResize from inside itself, and answers the configure with that frame's buffer. The window draws on demand, so: - Shell::Window asks for a frame from onFrameOwed. Without it nothing draws the frame that answers the configure, and the window keeps its old size until something else changes on it. - Canvas::Reconcile no longer turns the compositor's sizes into Resize(pixels). The library takes the size asked for last, whoever asked, so that call took the configured size's place, and with it came back the surface a dp larger than configured that 89111e0 had ended (Crafter.Graphics #201). It now sizes the window only where the library does not: the app's own size (--size, SetSize, --scale); the size that comes with a new window (#166), handed over in deferredLogicalWidth, where the library's listener keeps every later one; and a scale the display changes to by itself (#165), through RebuildSwapchain. The last two reach into the library's own state, and go once the library does them. The text-input API on master is the one the app was written against: nothing changed there. Looked at on 2026-11-20 on the made-up system, on a desktop (KWin at a scale of 1.85), with WAYLAND_DEBUG=1 on the app: - The accounts at 420x760: the start, and resize:600,800 from --poke, the app's own size. Each size reaches the surface once, with the first buffer drawn for it. - The same window given 760x532 by the compositor (a KWin script that sets its frameGeometry): the configure is kept, a frame is asked for, and set_destination(760, 532), the acknowledgement and the first buffer of 1406x985 go out together. A temporary probe had that frame's draw list reach 1406x985: it is laid out for the new size. - 421x761, whose pixels at 1.85 are no whole number: it opens as 422x762, since the app's own size goes through Resize in pixels. The notes say so. - --scale 2 --size 360x760, the cards and the pay form filled in from --poke, with resize:400,700: the compositor's sizes are passed over. - The --debug-api build driven with crafter-debug: Window_Resize, Ui_Tap, ui.texts and a screenshot. The two paths that are a phone's, a size in the first configure and a scale named after the first frames, were tried only with the values put in by hand in a temporary probe. Nothing was looked at on a phone, and what the input method is told was not read off the wire: the test window never had the keyboard. 17 tests pass and the four lint passes report nothing. The app, its --debug-api build, the fake system, the x86_64 Flatpak bundle and both aarch64 Flatpaks (build-aarch64.sh) build. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
138 lines
7.2 KiB
Shell
Executable file
138 lines
7.2 KiB
Shell
Executable file
#!/bin/sh
|
|
# SPDX-License-Identifier: LGPL-3.0-only
|
|
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
|
|
# build-aarch64.sh: Nostro's two Flatpaks for aarch64, a phone's architecture, into an OSTree repository: the app
|
|
# (net.catcrafts.Nostro) and the service with the nostro command (net.catcrafts.Nostrod). crafter-build cross-compiles
|
|
# the executables against the sysroot of make-aarch64-sysroot.sh (run that first), and flatpak's build commands
|
|
# assemble them on org.freedesktop.Platform 26.08, with the libc++ they were linked against in /app/lib.
|
|
#
|
|
# packaging/flatpak/build-aarch64.sh <repo> [branch] # branch: stable by default
|
|
#
|
|
# The repository is created when it does not exist. On the phone, as root, with the repository copied over:
|
|
# packaging/system/install.sh --repo <repo> --app. The cache and $CRAFTER_REF are make-aarch64-sysroot.sh's.
|
|
# Needs flatpak, flock, readelf and appstreamcli.
|
|
set -eu
|
|
|
|
REPO=${1:?usage: build-aarch64.sh <repo> [branch]}
|
|
BRANCH=${2:-stable}
|
|
APP_ID=net.catcrafts.Nostro
|
|
SERVICE_ID=net.catcrafts.Nostrod
|
|
ARCH=aarch64
|
|
TRIPLE=aarch64-unknown-linux-gnu
|
|
MULTIARCH=aarch64-linux-gnu
|
|
RUNTIME_VERSION=26.08
|
|
CRAFTER_REF=${CRAFTER_REF:-net.catcrafts.CrafterBuild//stable}
|
|
CACHE=${NOSTRO_FLATPAK_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/nostro-flatpak}
|
|
INSTALLATION="$CACHE/installation"
|
|
SYSROOT="$CACHE/sysroot-$ARCH"
|
|
LIBCXX="$CACHE/libcxx-$ARCH"
|
|
SRC=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd)
|
|
# flatpak commands that need the aarch64 Sdk and Platform see their installation; crafter-build runs from wherever it
|
|
# is installed.
|
|
withsdk() { FLATPAK_USER_DIR="$INSTALLATION" "$@"; }
|
|
|
|
command -v readelf >/dev/null 2>&1 || { echo "readelf (binutils) is needed: the NEEDED checks below run on it" >&2; exit 1; }
|
|
# One build at a time on this cache: the build directories are removed and made again by every run.
|
|
mkdir -p "$CACHE"
|
|
exec 9>"$CACHE/lock"; flock 9
|
|
[ -f "$SYSROOT/.made-from" ] || { echo "no sysroot at $SYSROOT: run packaging/flatpak/make-aarch64-sysroot.sh first" >&2; exit 1; } # under the lock: a sysroot being made is not missing
|
|
|
|
# Generic armv8-a: a Flatpak is for any aarch64 machine, not one SoC. An output directory's name ends in a hash of the
|
|
# configuration, and an older variant left in bin/ would be a second match below: this run's are the only ones.
|
|
rm -rf "$SRC/bin/"*"-$TRIPLE-armv8-a-generic-"*
|
|
crafter() { (cd "$SRC" && flatpak run "$CRAFTER_REF" --march=armv8-a --mtune=generic --banks=bunq "$@" -- --target="$TRIPLE" --sysroot="$SYSROOT"); }
|
|
# The one executable of that name this run built. The library and the command are both called nostro, so a directory
|
|
# is told by what it holds.
|
|
built() {
|
|
name=$1
|
|
set -- "$SRC/bin/$name-$TRIPLE-armv8-a-generic-"*/"$name"
|
|
[ $# = 1 ] && [ -x "$1" ] || { echo "expected one $name for $TRIPLE under $SRC/bin, found: $*" >&2; exit 1; }
|
|
echo "$1"
|
|
}
|
|
|
|
echo ">> the executables for $TRIPLE"
|
|
crafter
|
|
crafter --product=daemon
|
|
crafter --product=app
|
|
cli=$(built nostro)
|
|
daemon=$(built nostrod)
|
|
app=$(built nostro-app)
|
|
|
|
platform=$(withsdk flatpak --user info --show-location --arch="$ARCH" "org.freedesktop.Platform//$RUNTIME_VERSION")/files
|
|
# Every library an executable and the libraries it carries need is in the Platform or in /app/lib, or the first start
|
|
# would fail on the phone. And one unwinder: LLVM's libunwind, which the carried libc++abi uses, never the Platform's
|
|
# libunwind 8 beside it.
|
|
checked() {
|
|
files=$1
|
|
shift
|
|
missing=0
|
|
for elf in "$@" "$files/lib/"lib*.so.1; do
|
|
for lib in $(readelf -d "$elf" | sed -n 's/.*(NEEDED).*\[\(.*\)\]/\1/p'); do
|
|
if [ ! -e "$platform/lib/$MULTIARCH/$lib" ] && [ ! -e "$platform/lib/$lib" ] && [ ! -e "$files/lib/$lib" ]; then
|
|
echo "$(basename "$elf") needs $lib, which neither the Platform nor /app/lib has" >&2
|
|
missing=1
|
|
fi
|
|
done
|
|
if readelf -d "$elf" | grep -q 'NEEDED.*\[libunwind\.so\.8\]'; then
|
|
echo "$(basename "$elf") links libunwind 8, not LLVM's libunwind" >&2
|
|
missing=1
|
|
fi
|
|
done
|
|
[ "$missing" = 0 ] || exit 1
|
|
}
|
|
# What both carry: the C++ runtime they were linked against, and the licences of what is in them, which
|
|
# packaging/licenses/NOTICE names.
|
|
carried() {
|
|
files=$1
|
|
id=$2
|
|
mkdir -p "$files/lib"
|
|
cp -a "$LIBCXX/usr/lib/"libc++.so.1* "$LIBCXX/usr/lib/"libc++abi.so.1* "$LIBCXX/usr/lib/"libunwind.so.1* "$files/lib/"
|
|
install -Dm644 "$SRC/packaging/flatpak/$id.metainfo.xml" "$files/share/metainfo/$id.metainfo.xml"
|
|
install -Dm644 -t "$files/share/licenses/$id" "$SRC/LICENSE" "$SRC/LICENSE.GPL" "$SRC/packaging/licenses/NOTICE" \
|
|
"$SRC/packaging/licenses/nlohmann-json-MIT.txt" "$SRC/packaging/licenses/LLVM-LICENSE.TXT"
|
|
}
|
|
# The AppStream catalogue entry software centres list an app by, with PNG icons: appstreamcli's default, JPEG XL, is
|
|
# not read by older clients.
|
|
catalogued() {
|
|
appstreamcli compose --prefix=/ --origin="$2" --image-format=png \
|
|
--result-root="$1" --data-dir="$1/share/app-info/xmls" --icons-dir="$1/share/app-info/icons/flatpak" "$1"
|
|
}
|
|
mkdir -p "$(dirname "$REPO")"
|
|
|
|
echo ">> $SERVICE_ID from $cli and $daemon"
|
|
build="$CACHE/build-service-$ARCH"
|
|
rm -rf "$build"
|
|
withsdk flatpak build-init --arch="$ARCH" "$build" "$SERVICE_ID" org.freedesktop.Sdk org.freedesktop.Platform "$RUNTIME_VERSION"
|
|
files="$build/files"
|
|
install -Dm755 "$cli" "$files/bin/nostro"
|
|
install -Dm755 "$daemon" "$files/bin/nostrod"
|
|
carried "$files" "$SERVICE_ID"
|
|
checked "$files" "$files/bin/nostro" "$files/bin/nostrod"
|
|
catalogued "$files" "$SERVICE_ID"
|
|
# nostrod talks to the bank, and to the bus, logind and polkit on the system bus; the command talks to nostrod there.
|
|
# As packaging/flatpak/net.catcrafts.Nostrod.yaml has it for x86_64.
|
|
withsdk flatpak build-finish "$build" --command=nostro --share=network --socket=system-bus
|
|
withsdk flatpak build-export --arch="$ARCH" "$REPO" "$build" "$BRANCH"
|
|
|
|
echo ">> $APP_ID from $app"
|
|
build="$CACHE/build-app-$ARCH"
|
|
rm -rf "$build"
|
|
withsdk flatpak build-init --arch="$ARCH" "$build" "$APP_ID" org.freedesktop.Sdk org.freedesktop.Platform "$RUNTIME_VERSION"
|
|
files="$build/files"
|
|
# The app finds its fonts and the window library's shaders beside itself.
|
|
mkdir -p "$files/bin"
|
|
cp -a "$(dirname "$app")/." "$files/bin/"
|
|
carried "$files" "$APP_ID"
|
|
install -Dm644 "$SRC/packaging/flatpak/$APP_ID.desktop" "$files/share/applications/$APP_ID.desktop"
|
|
install -Dm644 "$SRC/packaging/flatpak/$APP_ID.svg" "$files/share/icons/hicolor/scalable/apps/$APP_ID.svg"
|
|
install -Dm644 -t "$files/share/licenses/$APP_ID" "$SRC/assets/OFL.txt" "$SRC/packaging/licenses/stb-LICENSE.txt" \
|
|
"$SRC/packaging/licenses/wayland-protocols-NOTICE.txt" "$SRC/packaging/licenses/Vulkan-Utility-Libraries-Apache-2.0.txt" \
|
|
"$SRC/packaging/licenses/libevdev-COPYING.txt"
|
|
checked "$files" "$files/bin/nostro-app"
|
|
catalogued "$files" "$APP_ID"
|
|
# The compositor, the graphics device, and nostrod on the system bus; the desktop's portals need no permission. As
|
|
# project.cpp has it for the x86_64 Flatpak crafter-build makes.
|
|
withsdk flatpak build-finish "$build" --command=nostro-app --socket=wayland --device=dri --system-talk-name=net.catcrafts.Nostro1
|
|
withsdk flatpak build-export --arch="$ARCH" "$REPO" "$build" "$BRANCH"
|
|
echo ">> done: app/$SERVICE_ID/$ARCH/$BRANCH and app/$APP_ID/$ARCH/$BRANCH in $REPO"
|