Skip to content

Instantly share code, notes, and snippets.

@sryze
Last active October 26, 2023 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sryze/dfb0c000453ff0dfbc291e153f7887ad to your computer and use it in GitHub Desktop.
Save sryze/dfb0c000453ff0dfbc291e153f7887ad to your computer and use it in GitHub Desktop.
Installing build dependencies of a Debian package that can be easily removed later

This approach allows you to install a *-build-deps package that can be easily apt autoremoved later when you don't need the dependencies anymore.

  1. Install packaging tools: sudo apt install devscripts equivs
  2. Generate a build-deps package (in this case we use nextcloud-desktop as an example):
    mk-build-deps nextcloud-desktop
    
  3. Install it:
    sudo apt install ./nextcloud-desktop-build-deps_x.y.z_amd64.deb
    
  4. Try to compile the package. If some build dependencies are missing at this point, you can install them with an additional package. To do that:
  • Create a control file like this:
    Package: nextcloud-desktop-build-deps-more
    Version: 0.1.0
    Architecture: amd64
    Maintainer: Your Name <your@email.com>
    Installed-Size: 10
    Depends: libkf5archive-dev:amd64, qtbase5-private-dev:amd64
    Section: devel
    Priority: optional
    Multi-Arch: foreign
    Description: Additional build dependencies for nextcloud-desktop
    
  • Generate a DEB package:
    #!/bin/sh
    equivs-build nextcloud-desktop-build-deps-more.control
    
  • Install it: sudo apt install ./nextcloud-desktop-build-deps-more_0.1.0_amd64.deb
  1. When you are done with compiling:
    sudo apt autoremove nextcloud-desktop-build-deps nextcloud-desktop-build-deps-more
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment