]>
description | Packaging harness for the ggml ecosystem |
owner | argeo-org |
last change | Tue, 24 Jun 2025 10:21:21 +0000 (12:21 +0200) |
URL | https://git.djapps.eu/pkg/ggml |
This packaging harness is based on git-buildpackage and simplifies the development of the packaging for software in the ggml ecosystem.
The software layers are configured as git submodules under the
sources/
subdirectory. These git repositories follow
Debian's DEP-14 layout
and can be used independently of this harness.
Make sure that you have the necessary packages installed and that you have a base for the distribution and arch you are targeting:
sudo apt install git-buildpackage cowbuilder
# sources/create-pbuilder <dist> <arch>
sources/create-pbuilder sid amd64
Clone recursively the packaging harness. For example:
git clone --recurse-submodules --branch unstable https://git.djapps.eu/pkg/ggml
To build a layer, cd to its directory and run:
../build-pbuilder <dist> <arch> [<branch>]
For example:
cd sources/ggml
../build-pbuilder sid amd64
or:
cd sources/llama.cpp
git checkout debian/bullseye
../build-pbuilder bullseye amd64 debian/bullseye
(See below how to configure a local repository)
(Using ggml
as an example, the same approach applies to
the other layers)
In a given layer git repository, make sure the upstream git repository is registered as remote:
cd sources/ggml
git remote add github https://github.com/ggml-org/ggml.git
Fetch new commits from upstreams's master
branch, and
merge them to the upstream/latest
branch.
git fetch --tags github master
git checkout upstream/latest
git merge --ff-only github/master
Check out the commit you are interested in and count revisions in order to create a versioned tag:
git checkout 9a4acb374565f4146b8d6eb1cffdcd7d437d1ba2
# git checkout b4719 # llama.cpp
git tag -m "Pinned upstream commit" upstream/0.0.$(git rev-list --count HEAD) # ggml or llama.cpp
# git tag -m "Pinned upstream commit" upstream/1.7.4+$(git rev-list --count v1.7.4..HEAD) # whisper.cpp
After updating upstream, checkout debian/latest
and
merge from upstream tag:
git checkout debian/latest
git merge --no-commit upstream/0.0.1722
Edit debian/changelog
and perform packaging-specific
changes.
Commit changes and test the build locally:
../build-pbuilder bookworm amd64
Push to remote repositories:
git push origin \
"refs/heads/debian/*" \
"refs/heads/upstream/*" \
"refs/tags/upstream/*"
Except for the ggml
layer itself, pbuilder/cowbuilder
needs to be configured appropriately in order to use either a local
repository with the ggml
packages you just built, or a
remote repository with the required ggml
-related
packages.
Below is a basic approach to configure a local repository, as an illustration to be adapted to your own build infrastructure and procedures.
Update /etc/pbuilderrc
. For example:
...
BINDMOUNTS="/srv/repo/deb/bullseye/ml/1.1 /srv/repo/deb/bookworm/ml/1.1 /srv/repo/deb/sid/ml/1.1"
...
and create a create-pbuilder.settings
file which will be
sourced by the create-pbuilder
script:
export GIT_PBUILDER_OPTIONS="--aptcache /var/cache/pbuilder/aptcache --othermirror 'deb [trusted=yes] file:/srv/repo/deb/$DIST/ml/1.1/ ./'"
or (for a CUDA build).
export GIT_PBUILDER_OPTIONS="--aptcache /var/cache/pbuilder/aptcache --components 'main contrib non-free' --othermirror 'deb [trusted=yes] file:/srv/repo/deb/$DIST/ml/1.1/ ./'"
Apply the same procedure by editing
build-pbuilder.settings
which will be sourced by the
build-pbuilder
script:
export GIT_PBUILDER_OPTIONS="--aptcache /var/cache/pbuilder/aptcache --buildresult /srv/repo/deb/$DIST/ml/1.1/"
Please note that the Packages
file needs to be generated
after each build. For example:
cd /srv/repo/deb/sid/ml/1.1
apt-ftparchive packages . > Packages
Or pbuilder hooks can be used.
When developing the packaging, cd to a layer directory and use git-buildpackage as usual.
A shortcut is provided in order to build the packages in-tree. (It requires the dependent packages to be installed locally). For example:
cd sources/whisper.cpp
../build.dev
3 days ago | unstable | shortlog | log | tree |