Building Debian Packages

Method 1: Quick and Dirty

  1. dpkg-deb PACKAGE_ROOT package_version_arch.deb
  2. make PACKAGE_ROOT/DEBIAN folder
  3. make control file in PACKAGE_ROOT/DEBIAN folder
    a. Package: name
    b. Version: version
    c. Architecture: arch or all
    d. Maintainer: name
    e. Depends: package(s)
    f. Description: description
  4. files in PACKAGE_ROOT

Method 2: Debian Way

  1. dpkg-buildpackage -b in PACKAGE_ROOT
  2. make PACKAGE_ROOT/debian folder
  3. make control file in PACKAGE_ROOT/debian folder
    a. Source: source_name
    b. Section: section
    c. Priority: priority
    d. Maintainer: name
    e. Build-Depends: package (comparitor version)
    f. Package: package_name
    g. Architecture: arch
    h. Depends: package(s)
    i. Description: description
  4. make changelog file in PACKAGE_ROOT/debian folder
    a. source_name (version) distribution; urgency=urgency
    b. * change_description
    c. – name RFC2822 date
  5. make compat file in PACKAGE_ROOT/debian folder
    a. 9
  6. make rules file in PACKAGE_ROOT/debian folder
    a. Makefile

Helper Scripts

  • dh_gencontrol creates DEBIAN/control from debian/control
  • dh_builddeb calls dpkg-deb to create the final deb package(s)
    substitutes ${shlibs:Depends} and ${misc:Depends}
  • dpkg-buildpackage checks Build-Dependencies in debian/control
  • dh_makeshlibs
    substitutes ${shlibs:Depends} and ${misc:Depends}
  • strip --strip-all debian/package/usr/bin/binary

debhelper

  • clean
  • build
  • binary

Variables

  • DESTDIR

Notes

  • Architecture must be changed from all to any if the package requires compilation