emcache

Langue: en

Version: 2008-09-11 (debian - 07/07/09)

Section: 1 (Commandes utilisateur)

Name

emcache - Check current cache values against the dpkg-cross provision.
  Copyright (C) 2008  Neil Williams <codehelp@debian.org>
 
  This package 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 3 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, see <http://www.gnu.org/licenses/>.
 
 

Usage

  emcache [-a|--arch ARCH] [--config FILENAME]
  emcache -?|-h|--help|--version
 
 

Options

  -a|--arch ARCH:          Set architecture (default: defined by dpkg-cross)
     --config FILENAME:    Alternative system-wide cache file to check.
  -v|--verbose:            Be verbose (repeat for more verbosity)
  -q|--quiet:              Be quiet [default]
 
 

Description

Packages consisting of compiled C code and using the autotools can support a cache file of values to help the ./configure script to identify settings for the target that differ from the architecture performing the build. Cache files can also be used to provide the answer when letting ./configure calculate the result would end in failure. Typically, this is due to ./configure trying to compile a test program on the build architecture using the target compiler - resulting in trying to run an arm binary on, say, amd64. To prevent such disasters, the value that the test program is trying to calculate can be provided in a cache file and autotools will skip the test program.

Some cache values are already pre-determined by the predictable differences between architectures and dpkg-cross already supplies these values. The cache values that are calculated in the actual builds used in Emdebian are generally distribution dependent - or possibly libc / kernel dependent in some cases (i.e. linux vs hurd vs bsd not versions of the same kernel). Most of the tests are for libraries and configuration options that are set within Debian and many are written especially for specific upstream packages.

As such, it is possible to collate the test results in an extra file in dpkg-cross to store the values as retrieved from Debian, a linux kernel and glibc. emcache then checks the values and the highlights when the file needs to be updated with new or modified cache values.

The contents of the cache file are automatically added to the architecture-dependent values already specified by dpkg-cross. This removes the need for any cache files in the Emdebian patch sets and simplifying the patches for debian/rules. dpkg-cross has always had this kind of support but it was not being updated. The purpose of emcache is to allow these values to be kept up to date.

In the case of errors from emcache, please check first that the affected package(s) are up to date using 'emsource --status' - if so, update the build using 'emsource -c'. emcache also checks branches within your Emdebian working directory - check the full URL of the cache file identified by emcache and update the branch directory as necessary.

If the error persists, file a bug against emdebian-tools using the Debian Bug Tracking System. emcache bugs should never be higher than 'normal' severity. Please include the output from 'emcache -q'. The bug can then be reassigned to dpkg-cross or an appropriate Debian package.

Notes

Updates to cached values can also be implemented directly within packages - by dropping a file into /etc/dpkg-cross/cross-config.d/ (provided by dpkg-cross (>= 2.3.1).

FILES

Cache config files are read in a specific order - data from later files overwrites data read in from earlier files.
/etc/dpkg-cross/cross-config.d/*
Files from packages and under the control of a package maintainer in Debian.
/etc/dpkg-cross/cross-config.cache or --config option
Values from Emdebian.
/etc/dpkg-cross/cross-config.$arch
Architecture-dependent values (fixed).

i.e. the architecture-specific cache values are not overridden (to retain existing behaviour).

All additional cache values are architecture-independent.

Files in /etc/dpkg-cross/cross-config.d/ should use the source package name (the value assigned to $PACKAGE_NAME in ./configure, which may be the upstream project name). The cache file will then be sourced into the configure script when cross-building.

emcache checks all cache data in one operation because the values themselves are meant to be distribution-specific not package-specific.

Non-conforming packages

A small number of packages (e.g. orbit2) still need package-specific, yet architecture-dependent values. Packages need to access these values by using a standard architecture-independent cache file.

These cache files can be put into /etc/dpkg-cross/cross-config.d/$arch/ and packages must create the relevant directory as well as a file in /etc/dpkg-cross/cross-config.d/ that brings in the relevant architecture-dependent cache file.

Values need to be calculated during native builds.

Maintaining cache data

emcache data is architecture-independent so it is possible for Debian maintainers to identify and correlate the necessary values from "config.log" generated from standard, native, builds.

Also emcache data generally does not change between releases - most values are distribution-specific or dependent on standard Debian options that do not change particularly often. Cache values that change more frequently need to be handled within the "debian/rules" file.

Only a handful of packages require cache files - the list of packages used in Emdebian that need cache files can be found on the Emdebian website. http://www.emdebian.org/emdebian/extending.html

In some situations, it is trivial to "grep" for the cache value directly:
 $ ./configure
 $ grep ac_cv_func_setpgrp_void config.log
 ac_cv_func_setpgrp_void=yes

Sometimes, a variable can actually encode a system directory, inherited from the "--prefix" value passed to "./configure".
 $ ./configure --prefix=/usr
 $ grep ac_cv_file__usr_share_sgml_X11_defs_ent config.log

Such values can be kept up to date by the package maintainer (if the values are subsequently shown to be out of date during a cross-build, the Emdebian config will allow an updated value to be provided).

Ideas and patches for scripts to automate this process would be very welcome!