feat: move git to app bundle
This commit is contained in:
1 parent
35e3d1a0bb
commit
46be13a60a
5 files changed
+69
-35
No files matched your search
+33
-22
@@ -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)
|
||||
Reference in new issue
Block a user