Debian::DpkgCross

Langue: en

Autres versions - même langue

Version: 2008-07-15 (ubuntu - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

Name

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 (C) 2004 Nikita Youshchenko <yoush@cs.msu.su>
Copyright (C) 2004 Raphael Bossek <bossekr@debian.org>
Copyright (c) 2007-2008 Neil Williams <codehelp@debian.org> =back
  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
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  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.
 
 

Bugs

Please report bugs via the Debian Bug Tracking System.

Support

All enquiries to the "<debian-embedded@lists.debian.org"> mailing list.

MAKEFLAGS

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:
  DEB_CONFIGURE_SCRIPT_ENV=
 
 

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

read_config

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

get_config

Return the current configuration from read_config as a hash reference.

get_version

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

dump_debug_data

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

rewrite_pkg_name

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

convert_filename($)

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

get_architecture

Returns the current architecture.

return: Current architecture or empty if not set.

check_arch($arch)

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

setup

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

create_tmpdir($basename)

Safely create a temporary directory
  $1: Directory basename (random suffix will be added)
 
 

return: Full directory pathname, undef if failed

convert_path($path)

Convert path, substituting '$crossinc', '$crosslib', '$crosslib64', '$crosslib32', '$crossdir'. This function will be used while building foreign binary packages or converting GCC options.
  $1: Directory (and file) to convert.
 
 

return: Converted path.

simplify_path($path)

Simplify path. Remove duplicate slashes, ``./'', ``dir/..'', etc

$1: Path to simplify.

return: Simplified path.

get_endianness

Provide a central function to query the endianness of the current cross building architecture.

Parses /etc/dpkg-cross/cross-config.$arch to convert the autotools cache value into a general purpose string.

Returns 'big' or 'little' or undefined on error.

detect_arch

Detect architecture of a given ELF or AR file using 'file' output. In general case it seems to be impossible to distinguish between OSes (e.g. between i386-linux and i386-hurd), so just detect CPU architecture
  $1: Filename to process
 
 

return: Detected architecture name on success, empty string on failure

Note that the table used by this routine is incomplete and may not always identify the arch. Always check the return value.

Legacy code

The following functions were part of dpkg-cross.pl <= 1.39 and were only used by the dpkg-cross diversions of dpkg-buildpackage or dpkg-shlibdeps. The functions and the scripts are retained for now as legacy code or for bespoke implementations but may be removed at a later date. It is NOT recommended to use these functions for newly written code. Scripts that do use these functions must import them explicitly.

get_keepdeps

Array containing the list of dependencies to be kept when building a cross package. Read from the $conffile.

Largely superceded by the -X support in dpkg-cross itself.

  Deprecated: May be removed in future versions.
 
 

get_removedeps

Array containing the list of dependencies to be remove when building a cross package. Read from the $conffile.

Largely superceded by the -X support in dpkg-cross itself.

  Deprecated: May be removed in future versions.
 
 

get_tool

Legacy code - only used by the old version of dpkg-shlibdeps from dpkg-cross <= 1.39
  Finds appropriate tool for ($arch, $tool, $mode)
  $1: architecture wanted
  $2: tool wanted
  $3: current mode
  return: pathname of the tool
 
 

setup_cross_env

Legacy code - only used by the old version of dpkg-shlibdeps from dpkg-cross <= 1.39

This function has since been implemented as a shell ``library'' - buildcross that is called directly by the non-diverted dpkg-buildpackage.

Set the environment variables MAKEFLAGS, PATH, PKG_CONFIG_LIBDIR and all variables from '%pkgvars' which are marked for scope ``environment''.

return: none

dpkgcross_application

Legacy code - only used by the old version of dpkg-shlibdeps from dpkg-cross <= 1.39

If not called (indirectly) from 'dpkg-buildpackage -a<arch>', then exec the original.

This function also initialise '$arch' as set by `dpkg-buildpackage -a'.

return: none

convert_ld_library_path

Legacy code - only used by the old version of dpkg-shlibdeps and strip from dpkg-cross <= 1.39

Remove from LD_LIBRARY_PATH everything that does not start with /usr/lib or /usr/share. This is needed to avoid non-native libraries in LD_LIBRARY_PATH. Just unsetting of LD_LIBRARY_PATH does not work because of usage of LD_LIBRARY_PATH by fakeroot.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:
Around line 74:
You forgot a '=back' before '=head1'