From 2da4c86923752e393e7737cd00f15eeec8a71647 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Thu, 5 Nov 2026 14:58:30 +0200 Subject: [PATCH] Drop the on-device GCC suite and Janet runtime, keep Yabasic FFI intact - Remove gcc, g++, musl-dev, make, janet, janet-dev and jpm from scripts/rootfs-packages.txt and add them to the prune denylist; 14 packages and 143.86 MiB disappear, with no runtime callers in the overlay. - Verify the Yabasic chain by running the real armv7 binaries under qemu-arm in a chroot of the rebuilt rootfs: yabasic 2.92.1, basic print, import neonet (libffi -> libcurl.so.4) and import neoui (libffi -> libneoui.so) all work. - Guard yabasic/yabasic-doc as critical, forbid compiler/Janet packages, and check the NeoUI/NeoNet FFI artifacts in check-rebuild.sh. - Update README.md, MANUAL.md, AGENTS.md and SDK.md; replace the on-device compile examples with cross-compilation guidance and add SDK.md section 7, an inventory of paramount versus removable scripting runtimes. - Rebuild images/bananarchy-nokia-argon.img (1.66 GiB, down from 1.84 GiB) and confirm via debugfs that the compiler/Janet binaries are gone while yabasic, libneoui.so, neoui.yab, neonet.yab and libcurl are present. --- AGENTS.md | 1 + CHANGELOG.md | 6 ++++ MANUAL.md | 2 +- README.md | 2 +- SDK.md | 60 ++++++++++++++++++++++++++++--- scripts/check-rebuild.sh | 22 ++++++++++-- scripts/rootfs-packages.txt | 10 ++---- scripts/rootfs-prune-packages.txt | 10 ++++++ 8 files changed, 96 insertions(+), 17 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index f7723c4..8f82549 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -60,5 +60,6 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` - **Artifact sources**: `prebuilt/` is the single source of truth for compiled artifacts and `scripts/rootfs-packages.txt` for the `armv7` package set. Never edit `overlay/rootfs/` copies of binaries by hand; run `./scripts/sync-prebuilt-overlay.sh` after changing `prebuilt/`. - **Package hygiene**: keep `scripts/rootfs-packages.txt` free of Rust-based top-level packages (use C `sudo`, never `sudo-rs`) and Wayland-purpose packages; `libwpe` and the `wayland-libs-*` shared libraries stay because GTK3/WebKitGTK link them directly, but no Wayland compositor, backend, or viewer is shipped. `scripts/check-rebuild.sh` enforces this. - **Image residue**: `rebuild-image.sh` strips `/var/cache/apk`, all `apk.log*` files, and unused gettext locale trees before `mke2fs` and aborts the build if any apk cache/log remains; never add an `apk` call after that guard. +- **No on-device compiler**: `scripts/rootfs-packages.txt` ships no `gcc`/`g++`/`musl-dev`/`make` and no Janet runtime (`janet`, `janet-dev`, `jpm`); cross-compile native code with `scripts/build-*.sh`. On-device development uses the Yabasic FFI SDK (`neoui.yab` / `neonet.yab`), which requires `yabasic`, `libffi`, `libneoui.so`, and `libcurl.so.4` — never remove those. `scripts/check-rebuild.sh` guards both sides. - **Local agent config**: `.bantam.cfg` is a local, gitignored credential file. Never read, edit, commit, or unignore it; `scripts/check-rebuild.sh` verifies that its ignore rule stays in place. - **Sentence case**: always use sentence case in subheadings and list items across all documentation files (`README.md`, `MANUAL.md`, `SDK.md`, `CHANGELOG.md`, `AGENTS.md`). diff --git a/CHANGELOG.md b/CHANGELOG.md index 685d8cc..6ffe72f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ Release versions follow the `
` format (where `2026` is `a`, ## Unreleased +### Drop the on-device GCC suite and Janet runtime +- Removed `gcc`, `g++`, `musl-dev`, `make`, `janet`, `janet-dev`, and `jpm` from `scripts/rootfs-packages.txt` and added them to `scripts/rootfs-prune-packages.txt`; together with their toolchain-only dependencies this frees 143.86 MiB (14 packages). No overlay script or world package depends on them at runtime. +- Verified the Yabasic runtime is fully functional by executing the actual `armv7` binaries under `qemu-arm` in a chroot of the target rootfs: `yabasic 2.92.1`, basic `print`, `import neonet` + `neonet_version$()` (libffi -> `libcurl.so.4`), and `import neoui` + `neoui_adjust_rgb()` (libffi -> `libneoui.so`). All `DT_NEEDED` libraries of `yabasic`, `libneoui.so`, and `libcurl.so.4` come from packages that remain. +- Updated `README.md`, `MANUAL.md`, and `SDK.md` (on-device compile examples replaced with cross-compilation guidance) and added an on-device scripting runtime inventory to `SDK.md` section 7 classifying paramount versus removable runtimes. +- Hardened `scripts/check-rebuild.sh` with `yabasic`/`yabasic-doc` critical-package assertions, forbidden compiler/Janet assertions, and a Yabasic FFI artifact check. + ### Updated Bantam agent and install_if prune fix - Cross-compiled and installed the updated `bantam-cpp` upstream (`0cd1a67`, "Send stable x-opencode-session header based on project_id") into `prebuilt/bantam/`, `overlay/rootfs/`, and the target rootfs, then rebuilt `images/bananarchy-nokia-argon.img`. - Fixed a prune regression found during that rebuild: apk re-adds `install_if` packages (`imv-wayland`, `gstreamer-ptp-helper`, `libheif-rav1e`) on every transaction, so `apk del` alone could not remove the Wayland viewer or the two Rust helpers. `scripts/rootfs-prune-packages.txt` now pins them with negative `!pkg` world constraints, and `scripts/prune-rootfs-packages.sh` restores those constraints and runs `apk fix` after each purge. `scripts/check-rebuild.sh` verifies the constraints are present. diff --git a/MANUAL.md b/MANUAL.md index 34a9f80..ae7d6e1 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -34,7 +34,7 @@ This manual covers flashing, operating, and customizing **Bananarchy Linux** (`2 - **QDSP6 / Q6Voice audio and Dual-SIM modem**: loudspeaker, boosted (+6 dB) earpiece, internal MEMS and headset microphones, `ModemManager` + `q6voiced` call audio routing, and direct Qualcomm QMI UIM Dual-SIM Dual Standby (DSDS), instant default SIM switching, Primary/Secondary GW (`4G/Data`) slot swapping, PIN/PUK management, and SIM phonebook access. - **Rear 2MP camera and torch LED**: `msm8905-cam` V4L2 driver (`/dev/video0` `800x600` `RGB3` for GalaxyCore `GC2395` / `GC2385` / `GC2365`) and `leds-msm8905-torch` (`white:torch` + PM8909 clean poweroff). 5. **Preinstalled developer and utility stack**: - - `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `nano`, `ed`, `less`, `rlwrap`, `lua` (`5.5` and `5.4`), `yabasic`, `janet` + `jpm`, `bantam` coding agent, `perl` (`IO::Socket::SSL`), `tcl` (`tcllib`, `tcl-tls`, `sqlite-tcl`), `sqlite3`, `frotz`, `ffmpeg`, `mpv`, `imv`, standalone `snake`, `tetris`, and `scoundrel` X11 games, the `gambatte` Game Boy / Game Boy Color emulator, and the **ReMEdy (`remedy` / `j2me`)** `240x320` J2ME (MIDP 2.0 / CLDC 1.1) emulator. + - `git`, GNU `coreutils`, GNU `bc`/`dc`, `nano`, `ed`, `less`, `rlwrap`, `lua` (`5.5` and `5.4`), `yabasic` (with the `neoui.yab` / `neonet.yab` FFI wrappers), `bantam` coding agent, `perl` (`IO::Socket::SSL`), `tcl` (`tcllib`, `tcl-tls`, `sqlite-tcl`), `sqlite3`, `frotz`, `ffmpeg`, `mpv`, `imv`, standalone `snake`, `tetris`, and `scoundrel` X11 games, the `gambatte` Game Boy / Game Boy Color emulator, and the **ReMEdy (`remedy` / `j2me`)** `240x320` J2ME (MIDP 2.0 / CLDC 1.1) emulator. No on-device compiler or Janet runtime is shipped; native code is cross-compiled with `scripts/build-*.sh`. --- diff --git a/README.md b/README.md index faec270..fe90561 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs ### Input, terminal, and developer tools - **6-mode `fcitx5-t9` keypad input**: press `#` to cycle between `abc`, `Abc`, `ABC`, `Sym` (all 32 ASCII punctuation symbols), `Ctl` (`Ctrl` sequences, arrows, `PageUp`/`PageDown`, `F1`–`F12`), and `123` numeric modes with a fixed bottom candidate bar. - **First-class Linux terminal (`st`)**: patched with HarfBuzz OpenType ligatures (`Fira Code` as the default system and terminal font), XIM T9 input, and live theme reloading. -- **On-device development, scripting, and gaming**: preinstalled `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `mandoc`, `nano`, `ed`, `sqlite3`, `lua` (`5.5` and `5.4`), `yabasic` (with full `yabasic-doc` manual and HTML documentation), `perl`, `tcl`, the [Janet](https://janet-lang.org/) language and `jpm`, the [Bantam](https://bantam.luxferre.top/) coding agent, `frotz` (interactive fiction), OpenGL / OpenGL ES hardware diagnostics (`glxinfo`, `eglinfo`, `glxgears`), standalone X11 keypad games (`Snake`, `Tetris`, and `Scoundrel` roguelike solitaire), a full-featured Gambatte-based Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`) with readjustable keypad controls (`B=8`, `Turbo B=5`, `A=9`, `Turbo A=6`, `D-pad`, `Start=2`, `Select=3`, `Palette=*`), 10 color palettes, save states, and file manager `.gb`/`.gbc` integration, and **ReMEdy (`remedy` / `j2me`)**, a native `240x320` J2ME (MIDP 2.0 / CLDC 1.1) emulator with Adreno 304 hardware-accelerated JSR-184 M3G 3D graphics, NeoUI-themed high-level LCDUI widgets, socket/HTTP networking (`Connector`), `RecordStore` (RMS) persistence, MMAPI audio, readjustable keypad controls, and `.jar`/`.jad` file manager integration. +- **On-device scripting, tools, and gaming**: preinstalled `git`, GNU `coreutils`, GNU `bc`/`dc`, `mandoc`, `nano`, `ed`, `sqlite3`, `lua` (`5.5` and `5.4`), `yabasic` (with full `yabasic-doc` manual and HTML documentation plus the `neoui.yab` / `neonet.yab` FFI wrappers), `perl`, `tcl`, the [Bantam](https://bantam.luxferre.top/) coding agent, `frotz` (interactive fiction), OpenGL / OpenGL ES hardware diagnostics (`glxinfo`, `eglinfo`, `glxgears`), standalone X11 keypad games (`Snake`, `Tetris`, and `Scoundrel` roguelike solitaire), a full-featured Gambatte-based Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`) with readjustable keypad controls (`B=8`, `Turbo B=5`, `A=9`, `Turbo A=6`, `D-pad`, `Start=2`, `Select=3`, `Palette=*`), 10 color palettes, save states, and file manager `.gb`/`.gbc` integration, and **ReMEdy (`remedy` / `j2me`)**, a native `240x320` J2ME (MIDP 2.0 / CLDC 1.1) emulator with Adreno 304 hardware-accelerated JSR-184 M3G 3D graphics, NeoUI-themed high-level LCDUI widgets, socket/HTTP networking (`Connector`), `RecordStore` (RMS) persistence, MMAPI audio, readjustable keypad controls, and `.jar`/`.jad` file manager integration. No on-device compiler or Janet runtime is shipped: native code is cross-compiled with `scripts/build-*.sh`, while on-device programming uses the Yabasic FFI SDK. - **NeoUI `240x320` UI SDK (`libneoui.so` + `/usr/include/neoui.h` + `neoui.yab`) and NeoNet (`neonet.yab`)**: unified C-compatible FFI and C++20 UI SDK wrapping Xlib, Xft, Pango, `libjpeg`/`libpng`, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double buffering, standardized OS shell widgets (headers, tabs, softkey bars, list/toggle/slider rows, input boxes, progress bars, scrollbars, modals, popup menus, and toasts), keypad/softkey chord handling, and multi-tap text entry—usable from C, C++, or Yabasic (`~/Projects/neoui.yab`, `~/Projects/neoui_demo.yab`, and `~/Projects/bulls_cows.yab`), paired with **NeoNet (`~/Projects/neonet.yab` and `~/Projects/neonet_demo.yab`)** for `libcurl`-based HTTP/HTTPS requests with custom headers and TCP/TLS/UDP socket exchange in Yabasic. See [SDK.md](./SDK.md) for full documentation. --- diff --git a/SDK.md b/SDK.md index 6c2037a..e11871b 100644 --- a/SDK.md +++ b/SDK.md @@ -138,11 +138,20 @@ Any widget parameter accepting `icon_str` (or `neoui_icon(name)`) resolves the f ## 3. C SDK reference (`/usr/include/neoui.h`) -### 3.1 Compiling C applications on the device +### 3.1 Cross-compiling C applications +Bananarchy ships no on-device compiler. Build native C/C++ code on a host with +the same `armv7` cross toolchain used by `scripts/build-sxmo-x11.sh`: + ```bash -gcc -O2 myapp.c -lneoui -o myapp +armv7-alpine-linux-musleabihf-gcc -O2 --sysroot=/path/to/armv7-sysroot \ + -I/path/to/armv7-sysroot/usr/include myapp.c -lneoui -o myapp ``` +`/usr/include/neoui.h` and `/usr/lib/libneoui.so` remain on the device for +runtime linking. For on-device programming, use the Yabasic FFI wrappers +(`import neoui`, `import neonet`); they need only `yabasic`, `libffi`, +`libneoui.so`, and `libcurl.so.4`, all of which are part of the base image. + ### 3.2 C function summary #### Window and daemon lifecycle @@ -358,11 +367,15 @@ int main(void) { When `#include ` is compiled under C++, it also exposes the `bananarchy` namespace used by Bananarchy's native DWM plugins (`src/dwm-plugins/*.cpp` and `src/xdrawer/xdrawer.cpp`). -### 4.1 Compiling C++ applications or plugins +### 4.1 Cross-compiling C++ applications or plugins +Use the `armv7` cross toolchain from `scripts/build-sxmo-x11.sh` (no on-device +compiler is shipped): + ```bash -g++ -O2 -std=c++17 myapp.cpp \ +armv7-alpine-linux-musleabihf-g++ -O2 -std=c++20 \ + --sysroot=/path/to/armv7-sysroot \ $(pkgconf --cflags --libs x11 xft fontconfig freetype2 pango pangoxft) \ - -lneoui -o myapp + myapp.cpp -lneoui -o myapp ``` ### 4.2 Core C++ classes and helpers @@ -661,3 +674,40 @@ print "UDP DNS resolved example.com -> ", ip$ r = neonet_cleanup() ``` +--- + +## 7. On-device scripting runtime inventory + +Bananarchy no longer ships an on-device compiler (`gcc`, `g++`, `musl-dev`, +`make`) or the Janet runtime (`janet`, `janet-dev`, `jpm`). Native code is +cross-compiled with `scripts/build-*.sh`; on-device development goes through +the Yabasic FFI SDK in sections 5 and 6. + +### 7.1 Absolutely paramount (hard runtime dependencies) + +| Runtime | Why it cannot be removed | +| --- | --- | +| `yabasic` + `yabasic-doc` | Executes `neoui.yab` / `neonet.yab`, the `~/Projects/*.yab` examples, and `bulls_cows.yab`; needs `libX11`, `libncursesw`, `libffi`, `libc`. | +| `libneoui.so` + `libcurl.so.4` + `libffi` | FFI targets of `neoui.yab` and `neonet.yab`; all of their `DT_NEEDED` libraries come from the X11/GTK/curl stack. | +| `python3` | `bananarchy-bt-obex` (Bluetooth OBEX), `msm-modem-uim-selection` (QMI voice), `sleep-inhibitor`, `bluez-simple-agent`, `umpv`, and the `yt-dlp` chain. | +| `bash` | Hard dep of `wireguard-tools-wg-quick`; the prebuilt `gsocket` scripts (`gsocket`, `gs-mount`, `gs-sftp`, `blitz`) use `#!/usr/bin/env bash`. | +| `tcl` | Hard dep of `expect`, which is a hard dep of `sxmo-utils-common`. | +| `luajit` | Hard dep of `mpv` (Sxmo audio/video playback). | +| `gawk`, `jq` | Hard deps of `sxmo-utils`. | +| `gojq` | Hard dep of `postmarketos-base-ui-networkmanager`. | +| `quickjs` | Hard dep of the `yt-dlp-ejs` chain pulled in by `sxmo-utils-common`. | + +### 7.2 Removable without on-device regressions + +| Packages | Approx. size | Notes | +| --- | --- | --- | +| `perl`, `perl-io-socket-ssl` | 31.8 MiB | `git` itself does not depend on Perl; only the optional `git svn` / `git send-email` helpers (`git-perl`, `perl-git`) would go. No overlay script invokes Perl. | +| `tcl-lib`, `tcl-tls`, `sqlite-tcl` | 12.1 MiB | Optional Tcl extensions with no reverse dependencies and no usage; `tcl` itself must stay for `expect`. | +| `lua5.4`, `lua5.4-dev`, `lua5.5`, `lua5.5-dev` | 3.0 MiB | No runtime callers; `mpv` uses `luajit`, not these. Removing them also requires dropping the `lua`/`luac` symlinks in `bootstrap-rootfs-container.sh` / `rebuild-image.sh` and the `lua5.5` critical-binary check. | +| `sqlite` (CLI) | 1.3 MiB | `sqlite-libs` stays (hard dep of WebKitGTK and Python); only the interactive CLI is unused. | +| `bc`, `ed`, `rlwrap` | 0.3 MiB | Interactive conveniences with no runtime callers. | +| `frotz`, `mandoc`, `nano`, `less` | small | Documented user-facing tools, not runtimes; removable only with matching documentation changes. | + +These are recommendations, not applied changes: the current package set still +contains them so that the documented on-device scripting environment stays +intact. diff --git a/scripts/check-rebuild.sh b/scripts/check-rebuild.sh index 947ca58..cc3c21b 100755 --- a/scripts/check-rebuild.sh +++ b/scripts/check-rebuild.sh @@ -52,14 +52,15 @@ else echo " $PKG_COUNT packages" fi for pkg in alpine-base postmarketos-ui-sxmo-de-dwm webkit2gtk-4.1 libwpe \ - sudo imv-x11 fcitx5-gtk3 mesa-utils sfeed; do + sudo imv-x11 fcitx5-gtk3 mesa-utils sfeed yabasic yabasic-doc; do if ! grep -Fxq "$pkg" "$PKGS_FILE"; then fail "missing critical package: $pkg" fi done # Pure X11 and Rust-free top-level package set. for pkg in sudo-rs postmarketos-base-sudo-rs libwpebackend-fdo imv-wayland \ - xwayland sxmo-utils-wayland wofi grim slurp; do + xwayland sxmo-utils-wayland wofi grim slurp \ + gcc g++ musl-dev make janet janet-dev jpm; do if grep -Fxq "$pkg" "$PKGS_FILE"; then fail "forbidden Rust/Wayland package in package list: $pkg" fi @@ -72,7 +73,7 @@ if [ ! -f "$PRUNE_FILE" ]; then else PRUNE_COUNT="$(grep -v '^[[:space:]]*#' "$PRUNE_FILE" | grep -cv '^[[:space:]]*$' || true)" echo " $PRUNE_COUNT prune entries" - for pkg in sudo-rs libwpebackend-fdo imv-wayland; do + for pkg in sudo-rs libwpebackend-fdo imv-wayland gcc janet; do if ! grep -Fxq "$pkg" "$PRUNE_FILE"; then fail "missing prune entry: $pkg" fi @@ -87,6 +88,21 @@ if [ ! -x "$BASE_DIR/scripts/prune-rootfs-packages.sh" ]; then fail "missing or non-executable scripts/prune-rootfs-packages.sh" fi +echo "[check] Yabasic FFI runtime..." +for artifact in \ + "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/libneoui.so" \ + "$BASE_DIR/prebuilt/sxmo-x11/usr/include/neoui.h" \ + "$BASE_DIR/overlay/rootfs/usr/lib/neoui.yab" \ + "$BASE_DIR/overlay/rootfs/usr/lib/neonet.yab" \ + "$BASE_DIR/overlay/rootfs/home/user/Projects/neoui.yab" \ + "$BASE_DIR/overlay/rootfs/home/user/Projects/neonet.yab"; do + # The /usr/lib/*.yab entries are absolute symlinks into the target rootfs, + # so a dangling link on the build host is expected and still valid. + if [ ! -e "$artifact" ] && [ ! -L "$artifact" ]; then + fail "missing Yabasic FFI artifact: ${artifact#"$BASE_DIR/"}" + fi +done + echo "[check] Image residue guard..." if ! grep -q 'strip_build_residue' "$BASE_DIR/rebuild-image.sh" || \ ! grep -q 'apk cache/log still present' "$BASE_DIR/rebuild-image.sh"; then diff --git a/scripts/rootfs-packages.txt b/scripts/rootfs-packages.txt index 9be5606..00f599a 100644 --- a/scripts/rootfs-packages.txt +++ b/scripts/rootfs-packages.txt @@ -4,6 +4,9 @@ # Keep this list synchronized with the packages used by the overlay and plugins. # Pure X11: no Wayland-purpose packages. sudo is the C implementation; the # Rust sudo-rs variant and its postmarketos-base-sudo-rs companion are excluded. +# No on-device compiler or Janet runtime is shipped; native code is +# cross-compiled with scripts/build-*.sh, and Yabasic FFI (neoui.yab / +# neonet.yab) is the on-device SDK path. # scripts/rootfs-prune-packages.txt lists packages purged from existing rootfs # trees (Wayland-only components and retired packages). adwaita-icon-theme @@ -24,8 +27,6 @@ font-fira-code font-noto font-noto-emoji frotz -g++ -gcc git gst-libav gst-plugins-bad @@ -38,9 +39,6 @@ imv-x11 ip6tables iproute2 iptables -janet -janet-dev -jpm lang less libwpe @@ -53,11 +51,9 @@ lua5.4 lua5.4-dev lua5.5 lua5.5-dev -make mandoc mesa-utils modemmanager -musl-dev nano openssh openssh-server-pam diff --git a/scripts/rootfs-prune-packages.txt b/scripts/rootfs-prune-packages.txt index c3348bd..f8e1a2a 100644 --- a/scripts/rootfs-prune-packages.txt +++ b/scripts/rootfs-prune-packages.txt @@ -36,6 +36,16 @@ mesa-demos postmarketos-artwork-wallpapers ttyescape +# Retired on-device compiler toolchain and Janet runtime. Native code is +# cross-compiled with scripts/build-*.sh; Yabasic FFI stays fully functional. +gcc +g++ +musl-dev +make +janet +janet-dev +jpm + # Negative world constraints for install_if packages. apk del removes these # constraints, so the pruner restores them and runs apk fix after every purge. !imv-wayland