Changes between Version 1 and Version 2 of AnatomyOfAPackage


Ignore:
Timestamp:
01/18/11 14:43:59 (11 years ago)
Author:
jdreed
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AnatomyOfAPackage

    v1 v2  
    11This page duplicates (and plagiarizes) the information at http://debathena.mit.edu/packaging/.  However, this page is aimed more at working within the Athena repository.   
    22 
    3 Within a package source, you'll find the `debian/` directory, which contains the following files: 
     3== Components == 
     4 
     5Within a package source, you'll find the `debian/` directory, which must contain the following files: 
    46 
    57 * '''`debian/changelog`''': The Debian changelog for the package. The changelog is the authoritative source for the Debian version number of the package. It is typically installed to /usr/share/doc/package/changelog.Debian.gz. You can manage this with the dch command, or with Emacs' `change-log-mode`.   
     
    810 * '''`debian/control.in`''': CDBS packages will often have a file called debian/control.in that looks exactly like debian/control except that it has @cdbs@ as a build dependency. This is replaced with various build dependencies that CDBS knows about (like debhelper and cdbs) at build time to generate debian/control. 
    911 * '''`debian/copyright`''':  A human-readable description of the copyright status of the package.   See [wiki:Copyright] for what to use in the Athena repository. 
    10  * '''`debian/rules`''': The executable makefile used to build the binary package.  The information in the table above (along with the control file reference at the end of this document) should be sufficient to generate the files mentioned so far aside from debian/rules, so we will focus attention on that. With CDBS, a simple package whose build system is based on autotools but where autoconf, automake, libtool, and aclocal should not be regenerated will probably look something like the following: 
     12 * '''`debian/rules`''': The executable makefile used to build the binary package.  The information in the table above (along with the control file reference at the end of this document) should be sufficient to generate the files mentioned so far aside from debian/rules, so we will focus attention on that.  
    1113 
     14== The `rules` file == 
     15 
     16With CDBS, a simple package whose build system is based on autotools but where autoconf, automake, libtool, and aclocal should not be regenerated will probably look something like the following: 
     17 
     18{{{ 
    1219#!/usr/bin/make -f 
    1320 
    1421include /usr/share/cdbs/1/rules/debhelper.mk 
    1522include /usr/share/cdbs/1/class/autotools.mk 
     23}}} 
    1624 
    17 DEB_CONFIGURE_EXTRA_FLAGS := --enable-shared 
    18 # (this last line is from the qd package and is not generic) 
    19 For packages that use other build systems, there are rules files in /usr/share/cdbs/1/class/ for make, python-distutils, ant, and a few others. If you plan to use quilt patches, you’ll want to include /usr/share/cdbs/1/rules/patchsys-quilt.mk. CDBS is primarily controlled through the setting of make variables in the rules file or through the existence of special files in the debian directory. Many changes to flags passed to during the build process can be implemented by just setting a single variable. Many of these variables can also be set on a per-package basis using names like CFLAGS_package. To get a definitive answer, one should inspect the code of debhelper.mk or the class file that you are using. Below we list some of the more useful ones: 
     25For packages that use other build systems, there are rules files in `/usr/share/cdbs/1/class/` for make, python-distutils, ant, and a few others. If you plan to use quilt patches, you’ll want to include `/usr/share/cdbs/1/rules/patchsys-quilt.mk`. CDBS is primarily controlled through the setting of make variables in the rules file or through the existence of special files in the debian directory. Many changes to flags passed to during the build process can be implemented by just setting a single variable. Many of these variables can also be set on a per-package basis using names like CFLAGS_package. To get a definitive answer, one should inspect the code of debhelper.mk or the class file that you are using.  
    2026 
    21 DEB_AUTO_UPDATE_DEBIAN_CONTROL 
    22 Set this to enabled auto-generation of debian/control from debian/control.in. This option is basically banned in Debian because it apparently causes problems with NMUs, but it can save work. 
    23 DEB_CONFIGURE_EXTRA_FLAGS (autotools.mk) 
    24 Any extra flags you want to pass to configure. 
    25 DEB_MAKE_ENVVARS (makefile.mk) 
    26 Any environment variables you want to set for make. 
    27 DEB_MAKE_INVOKE += … (makefile.mk) 
    28 Pass extra flags to make (note the += here). 
    29 DEB_MAKE_{BUILD,CLEAN,…}_TARGET (makefile.mk) 
    30 Control what make targets CDBS uses. Note that make install and make check unless you set their corresponding target variable. 
    31 DEB_MAKE_CLEAN_TARGET (makefile.mk) 
    32 Often you want to set this to distclean. 
    33 CFLAGS,CPPFLAGS,LDFLAGS,… (makefile.mk) 
    34 Control common compiler and linker flags. 
    35 DEB_CONFIGURE_EXTRA_FLAGS (autotools.mk) 
    36 Any extra flags you want to pass to configure. 
    37 DEB_AUTO_UPDATE_AUTOAUTO = version (makefile.mk) 
    38 Have autotools component AUTOAUTO-version run at build time. 
    39 DEB_DH_LINK_ARGS 
    40 Create symlinks in your installation. 
    41 DEB_DH_debhelper-tool_ARGS 
    42 Add flags to any of a number of debhelper tools. 
     27=== Useful makefile variables === 
     28 
     29 * DEB_AUTO_UPDATE_DEBIAN_CONTROL: Set this to enabled auto-generation of debian/control from debian/control.in. This option is basically banned in Debian because it apparently causes problems with NMUs, but it can save work. 
     30 * DEB_CONFIGURE_EXTRA_FLAGS (autotools.mk): Any extra flags you want to pass to configure. 
     31 * DEB_MAKE_ENVVARS (makefile.mk): Any environment variables you want to set for make. 
     32 * DEB_MAKE_INVOKE += … (makefile.mk): Pass extra flags to make (note the += here). 
     33 * DEB_MAKE_{BUILD,CLEAN,…}_TARGET (makefile.mk): Control what make targets CDBS uses. Note that make install and make check unless you set their corresponding target variable. 
     34 * DEB_MAKE_CLEAN_TARGET (makefile.mk): Often you want to set this to distclean. 
     35 * CFLAGS,CPPFLAGS,LDFLAGS,… (makefile.mk): Control common compiler and linker flags. 
     36 * DEB_CONFIGURE_EXTRA_FLAGS (autotools.mk): Any extra flags you want to pass to configure. 
     37 * DEB_AUTO_UPDATE_AUTOAUTO = version (makefile.mk): Have autotools component AUTOAUTO-version run at build time. 
     38 * DEB_DH_LINK_ARGS: Create symlinks in your installation (or use a .links file, see below) 
     39 * DEB_DH_debhelper-tool_ARGS: Add flags to any of a number of debhelper tools. 
    4340Many simple tasks, such as installing an init script for your package can be handled easily be just creating the relevant file (CDBS is automatically invoking debhelper to do this). Below is a list of some of the more useful ones; for a complete list, read debhelper.mk: 
     41 
     42== Other special files in `debian/` == 
     43 
    4444 
    4545debian/package.install