Scroll to navigation

Debian::DpkgCross(3) User Contributed Perl Documentation Debian::DpkgCross(3)


Debian::DpkgCross - Package of dpkg-cross commonly used functions

The 2.x series of dpkg-cross is seeking to achieve its own removal by incorporating as much cross-building support as possible into dpkg itself. The number, scope and range of functions supported by this package is therefore only going to decrease. Any newly-written code using this package will need to keep up with changes in dpkg. Developers are recommended to join the debian-dpkg and debian-embedded mailing lists and keep their code under review.

Copyright and License

 Copyright (C) 2004  Nikita Youshchenko <>
 Copyright (C) 2004  Raphael Bossek <>
 Copyright (c) 2007-2009  Neil Williams <>
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


Please report bugs via the Debian Bug Tracking System.


All enquiries to the "<"> mailing list.


See bug #437507 Even if the other flags are needed CC, GCC and other compiler names should *NOT* be overridden in $ENV{'MAKEFLAGS'} because this prevents packages compiling and running build tools using CC_FOR_BUILD. CDBS packages need to declare an empty override variable in debian/rules:


Depending on progress with dpkg cross-building support, the remaining overrides may also be removed. Do not rely on these being set.


Read '$conffile' and save the definition in global variables all recognised variables.

'$crossroot' will be set by setup(). Until setup() is called all "crossroot-<arch>" settings are stored within '%allcrossroots'.

All package variables are stored within '%conf'.

No variables are skipped.

return: none


Return the current configuration from read_config as a hash reference.


Return the current DpkgCross version string used by all dpkg-cross scripts.


Return a hashtable of assorted debug data collated during the current run that can be processed using Data::Dumper.


Converts a package name into the dpkg-cross package name.

$1 - the package name to check and convert if needed return - the cross-package name


Converts an original .deb filename into the dpkg-cross .deb filename or converts a dpkg-cross .deb filename into the original .deb filename.

returns undef on error


Returns the current architecture.

return: Current architecture or empty if not set.


Checks that the supplied $arch is (or can be converted to) a DEB_HOST_GNU_TYPE that can be supported by dpkg-cross.

returns the DPKG_HOST_GNU_TYPE or undef


Set global variables '$arch', '$crossbase', '$crossbin', '$crosslib32', '$crossdir', '$crossinc', '$crosslib', '$crosslib64', '$crossprefix', '$compilerpath' and '$deb_host_gnu_type' to defaults and substitute them with variables from '%conf' and '$arch'.

return: none


Safely create a temporary directory

 $1: Directory basename (random suffix will be added)

return: Full directory pathname, undef if failed

convert_path($multiarch, $path)

Convert path, substituting '$crossinc', '$crosslib', '$crosslib64', '$crosslib32', '$crossdir', allowing for multiarch paths. This function will be used while building foreign binary packages or converting GCC options.

 $1: Multiarch sub-directory to strip
 $2: Directory (and file) to convert.

return: Converted path.


Simplify path. Remove duplicate slashes, "./", "dir/..", etc

$1: Path to simplify.

return: Simplified path.

2022-12-06 perl v5.36.0