Personal tools
     DOCUMENTATION

Conary:Recipe Template for Simple C Source

From rPath Wiki

Jump to: navigation, search
Conary --> Packaging --> Recipe --> Recipe Templates --> Simple C Source

Conary packagers can write a package recipe to package source code written in C, C++, or C#. Packagers have two classes from which the recipe can inherit, depending on the needs of the application:

  • AutoPackageRecipe is used when the source code can be built with configure ; make ; make install
  • CPackageRecipe is used when this "simple" sequence does not apply, allowing packagers to call associated methods as necessary to perform each source-building task (Use the Complex C App Template for these recipes.)

Use the following template to start recipes using AutoPackageRecipe, and make the changes suggested:

 
class MyApp(AutoPackageRecipe):
    name = 'myapp'
    version = '1.0'
 
    buildRequires = []
 
    def unpack(r):
        r.addArchive('http://www.example.com/foo/'
                     '%(name)s-%(version)s.tar.bz2')

Suggested changes:

  • Change the class name to a CamelCase representation of the application name
  • Change the value for name to the application name as packaged
  • Change the value for version to the application version
  • After cooking (with cvc) or building (with rMake), add items to the buildRequires section as instructed by the build messages (see Conary Recipe Structure for more information); remove the buildRequires line altogether if it is not needed
  • Change the URL to reflect the location of the application

Example: Building curl from sources checked out from cvs.

 
class MyCurlFromSource(AutoPackageRecipe):
        name = 'curl'
        version = '7.17.1'
 
        buildRequires = [ 'pkgconfig', 'autoconf', 'automake', 'libtool' ]
 
        def unpack(r):
                r.addCvsSnapshot(':pserver:anonymous@cool.haxx.se:/cvsroot/curl', 'curl')
                r.Run('./buildconf')

addCvsSnapshot will check out sources from the specified CVSROOT and project, and will change the current directory to the directory checked out. Curl uses the buildconf script to create the configure script, so we explicitly run this script after checking it out. Once buildconf has been run, the standard configure ; make ; make install commands will be executed as usual for the AutoPackageRecipe base class.



From here you may wish to:

Participate in the rPath Community | Contribute to rPath Wiki | Report an issue to rPath