Search code examples
packagedebiandebdpkg

Creating multiple packages with dpkg-buildpackage


I have a source tree structure like -

/src 
   /moduleA
   /moduleB
   /common

where moduleA and moduleB need packaged separately but share the common code.

Is it possible to create 2 separate binary packages using dpkg-buildpackage?

Thanks!


Solution

  • It is possible. In order to do it, you should modify the control file. When you use dh_make -s, you have something like :

    Source: yourpackage
    Section: unknown
    Priority: optional
    Maintainer: toto <toto@unknown>
    Build-Depends: debhelper (>= 8.0.0), autotools-dev
    Standards-Version: 3.9.4
    Homepage: <insert the upstream URL, if relevant>
    #Vcs-Git: git://git.debian.org/collab-maint/libsnow.git
    #Vcs-Browser: http://git.debian.org/?p=collab-maint/libsnow.git;a=summary
    
    Package: yourpackage
    Architecture: any
    Depends: ${shlibs:Depends}, ${misc:Depends}
    Description: <insert up to 60 chars description>
     <insert long description, indented with spaces>
    

    All you have to do is to add a paragraph like that :

    Package: yourpackagebis
    Architecture: any
    Depends: ${shlibs:Depends}, ${misc:Depends}
    Description: <insert up to 60 chars description>
     <insert long description, indented with spaces>
    

    (I should warn you, you can only use lowercase characters for the package's name). Once you've done that, you have to specify which file will go where. You have to create four new files : yourpackage.dirs, yourpackage.install, yourpackagebis.dirs, and yourpackagebis.install. In yourpackage.dirs, you have to specify what are the directories you need to create (one per line). In yourpackage.install, you have to tell dpkg-buildpackage what files should be put in the package yourpackage, and where. It must be in the following format (one per line):

    moduleA/foo usr/bin
    

    (assuming your makefile is in src/. It can be something else than usr/bin). yourpackagebis.dirs and yourpackagebis.install works the same way for the package yourpackagebis.