Dpkg::BuildDriver(3perl) libdpkg-perl Dpkg::BuildDriver(3perl)

# [NAME](#NAME)

Dpkg::BuildDriver - drive the build of a Debian package

# [DESCRIPTION](#DESCRIPTION)

This class is used by dpkg-buildpackage to drive the build of a Debian package.

**Note**: This is a private module, its API can change at any time.

# [METHODS](#METHODS)

$bd = Dpkg::BuildDriver-&gt;new(%opts)

Create a new Dpkg::BuildDriver object. It will load a build driver module as requested in the **Build-Drivers** field in the $opts{ctrl} Dpkg::Control::Info object or if not present, it will fall back to load the default **debian-rules** driver.

Options:

[**ctrl** (required)](#ctrl)

A Dpkg::Control::Info object.

[**root\_cmd**](#root_cmd)

A string with the gain-root-command to use when needing to execute a command with root-like rights. If needed and unset, it will default to fakeroot if it is available or the module will error out.

[**as\_root**](#as_root)

A boolean to force *debian/rules* target calls as root-like, even if they would normally not require to be executed as root-like. This option is applied to all targets globally.

**Note**: This option is only relevant for drivers that use *debian/rules*.

[**debian\_rules**](#debian_rules)

An array containing the command to execute the *debian/rules* file and any additional arguments. It defaults to **debian/rules**.

**Note**: This option is only relevant for drivers that use *debian/rules*.

[**rrr\_override**](#rrr_override)

A string that overrides the **Rules-Requires-Root** field value.

**Note**: This option is only relevant for drivers that use *debian/rules*.

$bd-&gt;**pre\_check()**

Perform build driver specific checks, before anything else.

This will run after the **init** hook, and before "dpkg-source --before-build".

**Note**: This is an optional method that can be omitted from the driver implementation.

$bool = $bd-&gt;need\_build\_task($build\_task, binary\_task)

Returns whether we need to use the build task.

**Note**: This method is needed as long as we support building as root-like. Once that is not needed this method will be deprecated.

$bd-&gt;run\_build\_task($build\_task, $binary\_task)

Executes the build task for the build.

**Note**: This is an optional method needed as long as we support building as root-like. Once that is not needed this method will be deprecated.

$bd-&gt;run\_task($task)

Executes the given task for the build.

# [CHANGES](#CHANGES)

## [Version 0.xx](#Version_0.xx)

This is a private module.

2026-09-09 1.23.11-dirty

---

Document: Dpkg::BuildDriver(3perl) from dpkg 1.23.11-r0 (Chainguard OS)
Source: https://git.dpkg.org/git/dpkg/dpkg.git
