dh_auto_build - Linux


Overview

dh_auto_build is a command in the devscripts package that automates the process of building Debian packages. It helps package maintainers quickly and easily create source and binary packages from source code.

Syntax

dh_auto_build [options] [targets]

Options/Flags

  • -A, **–arch=**ARCH: Build specified ARCHitecture.
  • -a, **–append-to-version=**SUFFIX: Append SUFFIX to the package version.
  • -B, **–build-directory=**DIR: Specify build directory.
  • -c, **–config=**PKG_CONFIG: Set PKG_CONFIG environment to PKG_CONFIG.
  • -d, –debug: Enable debug mode.
  • **–debian-branch=**BRANCH: Use BRANCH as the Debian branch.
  • **–debian-maintainer=**MAINTAINER: Use MAINTAINER as the Debian maintainer.
  • -F, –fail-on-bad-dependency: Abort if a dependency version is too low.
  • -G, –ignore-build-errors: Ignore build errors and continue.
  • -H, –show-supported-archs: List supported architectures.
  • -I, –list-overrides: List available override values.
  • -j, **–jobs=**N: Use N parallel build jobs.
  • -K, –skip-build: Skip the build step.
  • -l, –list-tests: List the available tests.
  • -N, –native: Build the native architecture.
  • -O, **–override=**STRING: Override a variable.
  • -p, **–override-value=**VALUE: Override a value.
  • -P, **–override-file=**PATH: Read overrides from PATH.
  • -r, –force-reconfigure: Force reconfiguration of package.
  • -s, **–source-directory=**DIR: Specify source directory.
  • -S, –skip-sign: Skip gpg signing of packages.
  • -t, **–test-suite=**TEST: Only run the specified test.
  • -V, –version: Print version information.
  • –exclude-variant=VAR: Exclude the specified variant from building.
  • –show-overrides: Show the current override values.
  • –override-guess: Guess the architecture and source location.
  • –use-build-dir: Use the build directory as the current working directory.

Examples

Simple Build

dh_auto_build

Build for a Specific Architecture

dh_auto_build -A amd64

Append Suffix to Version

dh_auto_build --append-to-version "-beta"

Build and Upload to Debian

dh_auto_build -A amd64 --build-directory ~/build-area
dput ppa:my-ppa/ppa ~/build-area/*.changes

Common Issues

  • Build errors: Ensure dependencies are met and the source package is properly configured.
  • Package version conflicts: Use --override-value to override the package version.
  • Failed to find source: Verify the source directory is correct.

Integration

dh_auto_build can be integrated with various tools, such as:

  • git: Use dh_auto_build --override-guess to automatically detect the source location from a git repository.
  • dpkg-dev: Create Debian packages with dh_auto_build and manage them using dpkg-dev.
  • reprepro: Upload packages built with dh_auto_build to a Debian repository using reprepro.

Related Commands