From 46be13a60aaeaa36e2c378352376c4f3c45cbc41 Mon Sep 17 00:00:00 2001 From: Daniel Hammer Date: Thu, 1 Oct 2026 10:47:28 +0200 Subject: [PATCH] feat: move git to app bundle --- Makefile | 9 ++++--- README.md | 2 +- dev-vcs/git/Makefile | 55 +++++++++++++++++++++++---------------- dev-vcs/git/README.md | 22 ++++++++++------ dev-vcs/git/manifest.toml | 16 ++++++++++++ 5 files changed, 69 insertions(+), 35 deletions(-) create mode 100644 dev-vcs/git/manifest.toml diff --git a/Makefile b/Makefile index f70d4aa..917d3aa 100644 --- a/Makefile +++ b/Makefile @@ -44,14 +44,15 @@ PORTS := \ # Bundle directories are keyed by port name, not category path. PORT_NAMES := $(notdir $(PORTS)) -# Ports that install themselves rather than producing an app bundle: command -# line tools, which land in 0:/os/ with no manifest and no launcher icon. -# `install` below delegates to their own install target. +# Ports that install themselves rather than producing an app bundle. +# `install` below delegates to their own install target. None at the moment: +# even command line tools (dev-vcs/git) ship as bundles, with a manifest that +# hides them from the menu. # # www-client/netsurf is deliberately NOT here: it also has an install target, # but it drops a resource tree next to the binary and is not something every # image should carry, so it stays a manual `make -C www-client/netsurf install`. -SELF_INSTALL_PORTS := dev-vcs/git +SELF_INSTALL_PORTS := .PHONY: all clean install $(PORTS) $(PORT_NAMES) diff --git a/README.md b/README.md index a7b9148..06c245b 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,4 @@ make ramdisk | libnsbmp | [netsurf-browser/libnsbmp](https://github.com/netsurf-browser/libnsbmp) | BMP/ICO decoder. | | netsurf | [netsurf-browser/netsurf](https://github.com/netsurf-browser/netsurf) | Native browser app built on NetSurf, with BearSSL HTTP/HTTPS, tabs, downloads, bookmarks, find, common image formats, and system TrueType fonts. | | doom | [ozkl/doomgeneric](https://github.com/ozkl/doomgeneric) | `doom1.wad` is proprietary and deliberately not bundled. | -| git | [git/git](https://github.com/git/git) | v2.39.5. WIP - installs to `0:/os/git.elf`. Local repositories only. See [dev-vcs/git/README.md](dev-vcs/git/README.md). | +| git | [git/git](https://github.com/git/git) | v2.39.5. WIP - installs to `0:/apps/git/`. Local repositories only. See [dev-vcs/git/README.md](dev-vcs/git/README.md). | diff --git a/dev-vcs/git/Makefile b/dev-vcs/git/Makefile index 1bb7246..96535cb 100644 --- a/dev-vcs/git/Makefile +++ b/dev-vcs/git/Makefile @@ -3,8 +3,10 @@ # Upstream: https://github.com/git/git (submodule at upstream/, pinned to # v2.39.5). # -# git is built as a plain system program (0:/os/git.elf), not an app bundle: -# it is a command-line tool driven from the terminal. +# git is installed as an app bundle (0:/apps/git/) so it carries a manifest +# and a .port marker like every other port, but its manifest keeps it out of +# the menu and the Apps folder: it is a command-line tool driven from the +# terminal, with no window to show. # # CONFIGURATION # The build must not pick up any host defaults. git derives its platform @@ -32,10 +34,14 @@ PORT_NAME := git include ../../mk/port.mk GIT_BIN := $(UPSTREAM)/git -GIT_INSTALL := $(MONTAUKOS)/programs/bin/os +APP_INSTALL := $(MONTAUKOS)/programs/bin/apps/git -# Where git's compiled-in paths point on the target. programs/bin/os is the -# staging directory for 0:/os, so GIT_PREFIX and GIT_STAGE are two names for +# Earlier versions of this port installed into 0:/os; install and uninstall +# both sweep those files away so an old copy cannot shadow the bundle. +LEGACY_INSTALL := $(MONTAUKOS)/programs/bin/os + +# Where git's compiled-in paths point on the target. The bundle directory is +# 0:/apps/git once installed, so GIT_PREFIX and BUNDLE_DIR are two names for # the same place -- one as the OS sees it, one as the build host does. # RUNTIME_PREFIX is off (it wants /proc/self/exe), so these are baked in: # @@ -45,8 +51,7 @@ GIT_INSTALL := $(MONTAUKOS)/programs/bin/os # every command in this build is a # builtin, which is what makes git # usable without fork/exec) -GIT_PREFIX := 0:/os/git -GIT_STAGE := $(GIT_INSTALL)/git +GIT_PREFIX := 0:/apps/git # `git version` string. Without an override GIT-VERSION-GEN runs `git # describe` on the checkout and, because the patch series is applied in the @@ -165,7 +170,7 @@ GIT_MAKE := MAKEFLAGS= $(MAKE) .PHONY: all clean git-build install uninstall -all: git-build +all: bundle $(COMPAT_LIB): $(wildcard compat/*.c) $(wildcard compat/*.h) $(CC) $(GIT_CFLAGS) -c compat/montauk-compat.c -o compat/montauk-compat.o @@ -195,24 +200,30 @@ git-build: $(COMPAT_LIB) @test -f $(GIT_BIN) || { echo "git: expected $(GIT_BIN)" >&2; exit 1; } @echo "Built: $(GIT_BIN) ($$(stat -c%s $(GIT_BIN)) bytes)" -# Installed as a system program, not an app bundle: git is a command line -# tool with no window. It carries no manifest and no .port marker, so -# remember to uninstall before cutting a release ISO. -# -# The binary is STRIPPED on the way in -- the debug info is five sixths of -# its size (17 MB -> 3 MB), and it all has to fit in the ramdisk. -install: git-build - mkdir -p $(GIT_INSTALL) - $(TOOLCHAIN_PREFIX)strip -o $(GIT_INSTALL)/git.elf $(GIT_BIN) - mkdir -p $(GIT_STAGE)/share/git-core - rm -rf $(GIT_STAGE)/share/git-core/templates - cp -rL $(UPSTREAM)/templates/blt $(GIT_STAGE)/share/git-core/templates - @echo "installed: 0:/os/git.elf + $(GIT_PREFIX)/share/git-core/templates" +# The binary is STRIPPED on the way into the bundle -- the debug info is five +# sixths of its size (17 MB -> 3 MB), and it all has to fit in the ramdisk. +# The templates sit under share/git-core in the bundle, which is where +# GIT_PREFIX tells git to look for them. +$(TARGET): git-build | $(BUNDLE_DIR) + $(TOOLCHAIN_PREFIX)strip -o $@ $(GIT_BIN) + mkdir -p $(BUNDLE_DIR)/share/git-core + rm -rf $(BUNDLE_DIR)/share/git-core/templates + cp -rL $(UPSTREAM)/templates/blt $(BUNDLE_DIR)/share/git-core/templates + +# The top-level `make install` copies the bundle like any other; this target +# is the standalone equivalent, plus the sweep of a pre-bundle 0:/os install. +install: bundle + rm -rf $(LEGACY_INSTALL)/git.elf $(LEGACY_INSTALL)/git + rm -rf $(APP_INSTALL) + mkdir -p $(dir $(APP_INSTALL)) + cp -r $(BUNDLE_DIR) $(APP_INSTALL) + @echo "installed: $(GIT_PREFIX)/git.elf + $(GIT_PREFIX)/share/git-core/templates" uninstall: - rm -rf $(GIT_INSTALL)/git.elf $(GIT_STAGE) + rm -rf $(APP_INSTALL) $(LEGACY_INSTALL)/git.elf $(LEGACY_INSTALL)/git clean: @$(GIT_MAKE) -C $(UPSTREAM) $(GIT_ARGS) clean >/dev/null 2>&1 || true @git -C $(UPSTREAM) checkout -- . 2>/dev/null || true rm -f $(COMPAT_LIB) compat/*.o + rm -rf $(BUNDLE_DIR) diff --git a/dev-vcs/git/README.md b/dev-vcs/git/README.md index d911b09..718496e 100644 --- a/dev-vcs/git/README.md +++ b/dev-vcs/git/README.md @@ -3,21 +3,27 @@ Upstream [git/git](https://github.com/git/git), pinned at **v2.39.5** (`upstream/`, submodule). Reports itself as `2.39.5-montauk`. -Installs as a system program, not an app bundle: +Installs as an app bundle with no menu entry -- the manifest sets +`menu.visible = false` and `desktop.section = "hidden"`, since git has no +window: | Path | What | |------|------| -| `0:/os/git.elf` | the binary (~3 MB stripped) | -| `0:/os/git/share/git-core/templates` | `git init` skeleton | -| `0:/os/git/etc/gitconfig` | system config (not created by the install) | +| `0:/apps/git/git.elf` | the binary (~3 MB stripped) | +| `0:/apps/git/share/git-core/templates` | `git init` skeleton | +| `0:/apps/git/etc/gitconfig` | system config (not created by the install) | ```bash -make -C dev-vcs/git # build -make -C dev-vcs/git install # -> MontaukOS/programs/bin/os/ +make -C dev-vcs/git # build the bundle into out/apps/git/ +make -C dev-vcs/git install # -> MontaukOS/programs/bin/apps/git/ ``` -`make ports` from the MontaukOS tree does both (git is in the top-level -Makefile's `SELF_INSTALL_PORTS`). +`make ports` from the MontaukOS tree does both. The standalone `install` (and +`uninstall`) also removes a leftover `0:/os/git.elf` from before the move. + +The shell only searches `0:/os` (and the SDK and games directories) for bare +command names, so from the terminal git is run by path: +`0:/apps/git/git status`. ## Status diff --git a/dev-vcs/git/manifest.toml b/dev-vcs/git/manifest.toml new file mode 100644 index 0000000..d96f112 --- /dev/null +++ b/dev-vcs/git/manifest.toml @@ -0,0 +1,16 @@ +[app] +name = "Git" +binary = "git.elf" + +# git is a command line tool with no window: it is bundled so it installs and +# uninstalls like any other port, but launching it from the desktop would do +# nothing useful, so it appears neither in the menu nor in the Apps folder. +[menu] +category = "Development" +visible = false + +[desktop] +section = "hidden" + +[launch] +pass_home_dir = false