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
git-2.55.0.tar.xz(7.8 MiB)
sha256457fdb04dc8728e007d4688695e6912e6f680727920f2a40bf11eacc17505357
upstream: https://www.kernel.org/pub/software/scm/git/git-2.55.0.tar.xz
archive copy: sources-4/vcs--git-2.55.0.tar.xz
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:
gitexecdir=/usr/lib/git-core— where the helper programs go: thegit-<command>executables and scripts thatgit <command>runs,git-remote-httpsamong them. Upstream’s default is$(prefix)/libexec/git-core.git --exec-pathprints the directory a givengituses.perllibdir— the directory for Git’s Perl modules (Git.pmand the rest), which the Perl commands such asgit send-emailload. It is set to what Perl reports as its owninstallvendorlib,/usr/share/perl5/vendor_perl. Git writes the directory into ause libline at the top of each of its Perl commands, so they find the modules wherever they are; this location is also on Perl’s own@INC, so any other Perl program canuse Git. Upstream’s default,$(prefix)/share/perl5, is not on@INC.PYTHON_PATH=/usr/bin/python3— the interpreter written into the#!line ofgit-p4, Git’s one Python command. Upstream’s default is/usr/bin/python.NO_REGEX=NeedsStartEnd— build Git’s own copy of the GNU regex engine, incompat/regex, instead of using the C library’s. Git needs theREG_STARTENDflag, which musl’s<regex.h>does not define; without this switchgit-compat-util.hstops the compile with “Git requires REG_STARTEND support. Compile with NO_REGEX=NeedsStartEnd”. Any non-empty value turns the switch on;NeedsStartEndis the value upstream’sconfig.mak.unameuses for the systems that need it.NO_TCLTK=Yes— do not installgitkorgit gui, which are Tcl/Tk programs. Tk is built in42_graphics, and Git in30_foundation.NO_RUST=Yes— build without the parts of Git written in Rust, using their C versions. Rust is built in31_compilers, the phase after this one, so there is nocargoin the chroot when Git is built.USE_LIBPCRE2=Yes— link PCRE2 for Perl-compatible regular expressions:git grep -P,git log --perl-regexpandgrep.patternType=perlneed it.install-man— the target that builds and installs the manual pages, withasciidocandxmlto, both independs.make installalone installs none.
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.