yad icon indicating copy to clipboard operation
yad copied to clipboard

[Request] Add a Wiki Page: "Creating a Debian Package"

Open nerun opened this issue 1 year ago • 10 comments

I wrote this little tutorial on how to create a debian package easily. It would be interesting to add these instructions to the GitHub Wiki section.

Creating a Debian Package

1) Install required packages

sudo apt install checkinstall m4 libtool libcurl4-openssl-dev intltool autotools-dev autoconf \
automake libglib2.0-dev libgtk-3-dev

2) Download and extract

  • Go to releases section and download latest linux package (tar.xz).
  • Extract the package.
  • Open a terminal inside the extracted folder.

3) Preparation

Generate build scripts and configuration files:

autoreconf -ivf && intltoolize --force && ./configure && make -j $(nproc)

[!Warning]

DO NOT make install.

Create some directories. They will not be populated by checkinstall, but checkinstall need them to create package:

sudo mkdir -pv \
    /usr/local/share/aclocal \
    /usr/local/share/applications \
    /usr/local/share/icons/hicolor \
    /usr/local/share/icons/hicolor/16x16/apps \
    /usr/local/share/icons/hicolor/24x24/apps \
    /usr/local/share/icons/hicolor/32x32/apps \
    /usr/local/share/icons/hicolor/48x48/apps \
    /usr/local/share/icons/hicolor/96x96/apps \
    /usr/local/share/icons/hicolor/128x128/apps \
    /usr/local/share/man/man1 \
    /usr/local/share/glib-2.0

4) Checkinstall tool

Create a description-pak:

echo """tool for creating graphical dialogs from shell scripts
 Yad allows you to display GTK+ dialog boxes from command line or shell
 scripts. It is similar to Zenity but with more dialog types and options.""" > description-pak

This file will be used by checkinstall to create a summary that can be read by some tools like apt search yad. This is the default text used by package 0.40 available in Debian and Ubuntu repositories.

Create the package:

checkinstall -D \
    --install=no \
    --fstrans=yes \
    --backup=no --deldoc=yes --deldesc=yes --delspec=yes \
    --replaces="yad" \
    --requires="\"libc6 (>= 2.34), libcairo2 (>= 1.2.4), libgdk-pixbuf-2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.30.0), libgtk-3-0 (>= 3.21.6), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0), dconf-gsettings-backend | gsettings-backend\"" \
    --pkgversion=<version> \
    --pkggroup="utils" \
    --maintainer="\"YOUR NAME <[email protected]>\"" \
    -y

Meanings:

Option Meaning
-D creates a debian package
--install=no do not install package after finished. It is good if you want to verify package first.
--fstrans=yes do not need to root, package owner will be the user
--backup=no
--deldoc=yes
--deldesc=yes
--delspec=yes
do not make a backup and delete all the trash after finished

These ones go inside control file, inside debian package:

Option Meaning
--replaces yad will replace any previous yad version
--requires yad dependencies that will be installed (same as for Debian experimental v7.2).
--pkgversion program version
--pkggroup actually it is the "Section", will be "utils" or "utilities"
--maintainer dont need, but tell who created the package, the responsible
-y say yes to all other questions

5. Install package

sudo apt install ./yad_*.deb

This short command use regex and will install any yad package in the current dir. The use of apt instead of dpkg allows to install dependencies automatically, that's why you should provide the option ./ in front of the package name.

nerun avatar Jan 22 '23 19:01 nerun