Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

45.1. git-2.55.0

Distributed version control system

Version 2.55.0, release 1
Shelf vcs — Version control and diff/merge tools
Phase 30_foundation (Build Foundation), 123 of 127 in build order
Licence GPL-2.0-only
Homepage https://git-scm.com/
Build time 1.1 SBU
Installed size 754.7 MiB in 448 files
Recipe ports/core/vcs/git/kpkgbuild

About

Git is the distributed version control system. On KDOS it is a command of its own and the program that git-lfs, tig, lazygit, git-cola, jujutsu, pass (which keeps its password store in a Git repository), notmuch, helix and the other ports that name it in depends run.

Git has no configure step in this recipe: its Makefile reads every choice as a make variable, so the whole configuration is the _mk array, passed unchanged to the main build and to contrib/subtree.

Sources

Dependencies

Depends on: curl, openssl, perl, python3, gettext, expat, zlib, asciidoc, xmlto, pcre2.

Required by (17): audacity, dolphin-plugins, git-cola, git-lfs, helix, jujutsu, kde-dev-scripts, koreader, lazygit, nb, notmuch, opencpn, orcaslicer, pass, ptouch-print, qmapshack, tig.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install git'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/vcs/git.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/vcs/git
echo '457fdb04dc8728e007d4688695e6912e6f680727920f2a40bf11eacc17505357  git-2.55.0.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/git
SRC=$SRC_ROOT/git-2.55.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf git-2.55.0.tar.xz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

_vendor=$(/usr/bin/perl -MConfig -wle 'print $Config{installvendorlib}')
_mk=(CFLAGS="$CFLAGS"
	LDFLAGS="$LDFLAGS"
	prefix=/usr
	gitexecdir=/usr/lib/git-core
	perllibdir="$_vendor"
	PYTHON_PATH=/usr/bin/python3
	NO_REGEX=NeedsStartEnd
	NO_TCLTK=Yes
	NO_RUST=Yes
	USE_LIBPCRE2=Yes
	DESTDIR=$PKG)
make "${_mk[@]}" install install-man
make -C contrib/subtree "${_mk[@]}" install install-man

rm -r "$PKG$_vendor/Git/SVN" "$PKG$_vendor/Git/SVN.pm"
rm "$PKG"/usr/lib/git-core/git-{svn,cvsserver} "$PKG/usr/bin/git-cvsserver" \
	"$PKG"/usr/share/man/man1/git-{svn,cvsserver}.1

install -Dm644 contrib/completion/git-completion.bash "$PKG/usr/share/bash-completion/completions/git"
install -Dm644 contrib/completion/git-prompt.sh -t "$PKG/usr/share/git"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/git, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf git-2.55.0-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/git, and runs the triggers its paths call for.

Contents

Installed programs: git, git-receive-pack, git-shell, git-upload-archive, git-upload-pack, scalar.

Installed directories: /usr/lib/git-core, /usr/share/git, /usr/share/git-core, /usr/share/gitweb, /usr/share/licenses/git, /usr/share/perl5/vendor_perl/FromCPAN, /usr/share/perl5/vendor_perl/Git.

Short descriptions

git the stupid content tracker
git-receive-pack Receive what is pushed into the repository
git-shell Restricted login shell for Git-only SSH access
git-upload-archive Send archive back to git-archive
git-upload-pack Send objects packed back to git-fetch-pack
scalar A tool for managing large Git repositories

Notes

The second make, in contrib/subtree, builds and installs git subtree and its manual page: it is shipped in Git’s source but not built by the top-level Makefile.

git svn and git cvsserver are removed from the package after the install, with their manual pages and the Git::SVN modules. Git’s Makefile has no switch to leave them out, and neither can start here: git svn needs Subversion’s Perl bindings (SVN::Core) and git cvsserver needs DBI with its SQLite driver, and none of them is a port. git cvsimport, git cvsexportcommit and git archimport stay; they start, and run the cvsps, cvs or tla program their work needs, none of which is a port either.

build.sh installs two shell files from contrib/completion. git-completion.bash goes to /usr/share/bash-completion/completions/git, where bash-completion loads it the first time git is completed. git-prompt.sh goes to /usr/share/git, for a prompt to source; nothing sources it by default. The zsh completion in the same directory is not installed: as site-functions/_git it would come first in zsh’s fpath and shadow zsh’s own, fuller _git with a wrapper around the bash one.