feat: move git to app bundle

This commit is contained in:
daniel committed 2026-10-01 10:47:28 +02:00
1 parent 35e3d1a0bb
commit 46be13a60a
5 files changed
+69 -35

No files matched your search

+33 -22
View File
@@ -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)
+14 -8
View File
@@ -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
+16
View File
@@ -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