Sunday, February 23, 2025

DEB package on Ubuntu and Debian

If you'd like to create a Golf  installation package for Ubuntu or Debian (or similar based on those), first get Golf source code. To do that, install git first:

sudo apt update
sudo apt install git

Then get Golf source code (use debian upstream folder):

git clone https://github.com/golf-lang/golf.git
cd golf
mv debian-upstream debian

Before you can create a package, you must first install Debian tools:

sudo apt update
sudo apt -y install devscripts equivs build-essential lintian

Next, get the dependencies for Golf (i.e. packages needed to build it):

mk-build-deps -i -s sudo debian/control

The Golf source code already contains necessary debian control (and other) files to produce a .deb package. So you can just do this from command line (if you want it to run lintian, then do "debuild -i -us -uc"):

dpkg-buildpackage -us -uc

Note: if you'd like to run lintian as well, then instead of dpkg-buildpackage above, execute:

debuild -us -uc

Or, the following command might work for you (especially when building non-native packages, which is most of them):

dpkg-buildpackage -b -rfakeroot -us -uc

In the parent directory, this will produce file golf_<version>_amd64.deb (where <version> is the Golf's current version), and you can now copy that file to another system with the same Linux installed, and install Golf with:

sudo apt update
sudo apt install ../golf_<version>_amd64.deb

Note that if you'd like to sign your package, use debsign:

debsign -k 'your key name'

In this case you must you have created a key 'your key name' using "gpg --gen-key".