Personal tools

Creating Debian packages from Cabal package

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(Document the process of creating a new Debian package from a Cabal package)
 
(PackageTemplate)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Packaging a Cabal package in 10 easy steps ==
+
== Packaging a Cabal library package with haskell-devscripts for unstable ==
   
''This process requires the <tt>haskell-utils</tt> package.''
+
This is a little bit outdated. For up-to-date information about packaging for Debian, with the Debian Haskell Group, check: http://wiki.debian.org/Haskell/CollabMaint/PackageTemplate
   
Here is an example on was created a new Debian package out of an Haskell [[Cabal]] package: [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mtl-1.0 mtl].
+
This is the recommended way to package a Cabal library for Debian now. Example of how a package could be created, using:
   
1. <tt>wget http://hackage.haskell.org/packages/archive/mtl/1.0/mtl-1.0.tar.gz -O haskell-mtl_1.0.1.orig.tar.gz</tt>
+
* $package as the package name
  +
* $version as the version of the package.
  +
* $maintainerName as the name of the maintainer
  +
* $maintainerEmail as the email of the maintainer
  +
* $packageShortDescription as the Cabal short description of the package
  +
* $packageLongDescription as the Cabal long description of the package
   
2. <tt>tar -zxf haskell-mtl_1.0.1.orig.tar.gz</tt>
+
<ol>
  +
<li><tt>wget http://hackage.haskell.org/packages/archive/$package/$version/$package-$version.tar.gz -O haskell-${package}_$version.orig.tar.gz</tt></li>
  +
<li><tt>tar -zxf haskell-$package_$version.orig.tar.gz</tt></li>
  +
<li><tt>cd $package-$version</tt></li>
  +
<li><tt>mkdir debian</tt></li>
  +
<li><tt><pre>cat << EOF > debian/control
  +
Source: haskell-$package
  +
Section: libdevel
  +
Priority: optional
  +
Maintainer: $maintainerName <$maintainerEmail>
  +
Standards-Version: 3.8.1
  +
Build-Depends: debhelper (>= 5), cdbs, dpatch, haskell-devscripts (>= 0.6.15+nmu1), ghc6, ghc6-prof
  +
Build-Depends-Indep: ghc6-doc, haddock, hscolour
  +
Homepage: http://hackage.haskell.org/cgi-bin/$package/package/$package
   
3. <tt>cd mtl-1.0</tt>`
+
Package: libghc6-$package-dev
  +
Architecture: any
  +
Depends: ${haskell:Depends}, ${shlibs:Depends}, ${misc:Depends}
  +
Suggests: libghc6-$package-doc (= ${binary:Version}), libghc6-$package-prof (= ${binary:Version})
  +
Description: $packageShortDescription
  +
This package provides a library for the Haskell programming language.
  +
See http://www.haskell.org/ for more information on Haskell.
  +
.
  +
$packageLongDescription
   
4. <tt>mkdir -p debian/varfiles</tt>
+
Package: libghc6-$package-prof
  +
Architecture: any
  +
Depends: libghc6-$package-dev (= ${binary:Version}), ${haskell:Depends}, ${shlibs:Depends}, ${misc:Depends}
  +
Description: $packageShortDescription; profiling libraries
  +
This package provides a library for the Haskell programming language,
  +
compiled for profiling.
  +
See http://www.haskell.org/ for more information on Haskell.
  +
.
  +
$packageLongDescription
   
5. Create <tt>debian/varfiles/varfile</tt> with your favorite editor:
+
Package: libghc6-$package-doc
<pre>maintainer="Ian Lynagh (wibble) <igloo@debian.org>"
+
Section: doc
short_description="Haskell monad transformer library for GHC"
+
Architecture: all
long_description=" MTL is a monad transformer library, inspired by the paper \"Functional
+
Depends: ${misc:Depends}
Programming with Overloading and Higher-Order Polymorphism\",
+
Recommends: ghc6-doc (>= 6.8.2)
by Mark P Jones (<http://www.cse.ogi.edu/~mpj/>), Advanced School
+
Suggests: libghc6-$package-dev (= ${binary:Version})
of Functional Programming, 1995."
+
Description: $packageShortDescription; documentation
c_dev_libs=""
+
This package provides the documentation for a library for the Haskell
extra_build_deps=""
+
programming language.
</pre>
+
See http://www.haskell.org/ for more information on Haskell.
+
.
6. Create <tt>debian/copyright</tt> with your favorite editor:
+
$packageLongDescription
<pre>
+
EOF</pre>
Debianised by ...
+
# echo 5 > debian/compat
  +
# Create debian/copyright with your favorite editor:
  +
<pre>Debianised by ...
 
Author ...
 
Author ...
 
Copyright: BSD ... /usr/share/common-licenses/BSD ...
 
Copyright: BSD ... /usr/share/common-licenses/BSD ...
EOF
+
EOF</pre></tt></li>
</pre>
+
<li><tt><pre>cat << EOF > debian/rules
  +
#!/usr/bin/make -f
   
7. <tt>dch --create -D unstable --package haskell-mtl --newversion 1.0.1-1</tt>
+
include /usr/share/cdbs/1/rules/debhelper.mk
  +
include /usr/share/cdbs/1/class/hlibrary.mk
  +
EOF</pre></tt></li>
  +
<li><tt><pre>cat << EOF > debian/watch
  +
version=3
  +
http://hackage.haskell.org/packages/archive/$package/([\d\.]+)/$package-([\d\.]+).tar.gz
  +
EOF</pre></tt></li>
  +
<li><tt>dch --create -D unstable --package haskell-$package --newversion $version-1</tt></li>
  +
<li><tt>debuild -us -uc</tt></li></ol>
   
8. <tt>update-debian-haskell-files</tt>
+
== Packaging a Cabal library package in 10 easy steps ==
   
9. <tt>debian/rules update-generated-files</tt>
+
''This process requires the <tt>haskell-utils</tt> package.''
   
10. <tt>debuild -us -uc</tt>
+
Here is an example on was created a new Debian package out of an Haskell [[Cabal]] library package: [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mtl-1.0 mtl].
  +
  +
<ol>
  +
<li><tt>wget http://hackage.haskell.org/packages/archive/mtl/1.0/mtl-1.0.tar.gz -O haskell-mtl_1.0.1.orig.tar.gz</tt></li>
  +
<li><tt>tar -zxf haskell-mtl_1.0.1.orig.tar.gz</tt></li>
  +
<li><tt>cd mtl-1.0</tt></li>
  +
<li><tt>mkdir -p debian/varfiles</tt></li>
  +
<li>Create <tt>debian/varfiles/varfile</tt> with your favorite editor:
  +
<pre> maintainer="Ian Lynagh (wibble) <igloo@debian.org>"
  +
short_description="Haskell monad transformer library for GHC"
  +
long_description=" MTL is a monad transformer library, inspired by the paper \"Functional
  +
Programming with Overloading and Higher-Order Polymorphism\",
  +
by Mark P Jones (<http://www.cse.ogi.edu/~mpj/>), Advanced School
  +
of Functional Programming, 1995."
  +
c_dev_libs=""
  +
extra_build_deps=""</pre>
  +
(Pay attention to the leading space in <tt>long_description</tt>. It's necessary due to the format of Debian's <tt>control</tt> file.)</li>
  +
<li>Create <tt>debian/copyright</tt> with your favorite editor:
  +
<pre> Debianised by ...
  +
Author ...
  +
Copyright: BSD ... /usr/share/common-licenses/BSD ...
  +
EOF</pre></li>
  +
<li><tt>dch --create -D unstable --package haskell-mtl --newversion 1.0.1-1</tt></li>
  +
<li><tt>update-debian-haskell-files</tt></li>
  +
<li><tt>debian/rules update-generated-files</tt></li>
  +
<li><tt>debuild -us -uc</tt></li>
  +
</ol>
   
 
With luck the <tt>.cabal</tt> file will provide most of the text for steps 5 and 6.
 
With luck the <tt>.cabal</tt> file will provide most of the text for steps 5 and 6.
Line 46: Line 46:
 
Even if packaging Haskell libraries seems easy, the [http://www.debian.org/doc/debian-policy/ Debian Policy] and the [http://www.debian.org/doc/developers-reference/ Developers Reference] contains a lot of valuable informations on how to create a policy compliant Debian package.
 
Even if packaging Haskell libraries seems easy, the [http://www.debian.org/doc/debian-policy/ Debian Policy] and the [http://www.debian.org/doc/developers-reference/ Developers Reference] contains a lot of valuable informations on how to create a policy compliant Debian package.
   
Please subscribe to the [http://urchin.earth.li/mailman/listinfo/debian-haskell debian-haskell] mailling-list if you are interested in creating new Haskell packages for Debian.
+
Please subscribe to the [http://lists.debian.org/debian-haskell/ debian-haskell] mailling-list if you are interested in creating new Haskell packages for Debian.
  +
  +
== Packaging a Cabal program package in N easy steps ==
  +
  +
TBD

Latest revision as of 21:48, 18 February 2010

[edit] 1 Packaging a Cabal library package with haskell-devscripts for unstable

This is a little bit outdated. For up-to-date information about packaging for Debian, with the Debian Haskell Group, check: http://wiki.debian.org/Haskell/CollabMaint/PackageTemplate

This is the recommended way to package a Cabal library for Debian now. Example of how a package could be created, using:

  • $package as the package name
  • $version as the version of the package.
  • $maintainerName as the name of the maintainer
  • $maintainerEmail as the email of the maintainer
  • $packageShortDescription as the Cabal short description of the package
  • $packageLongDescription as the Cabal long description of the package
  1. wget http://hackage.haskell.org/packages/archive/$package/$version/$package-$version.tar.gz -O haskell-${package}_$version.orig.tar.gz
  2. tar -zxf haskell-$package_$version.orig.tar.gz
  3. cd $package-$version
  4. mkdir debian
  5. cat << EOF > debian/control
    Source: haskell-$package
    Section: libdevel
    Priority: optional
    Maintainer: $maintainerName <$maintainerEmail>
    Standards-Version: 3.8.1
    Build-Depends: debhelper (>= 5), cdbs, dpatch, haskell-devscripts (>= 0.6.15+nmu1), ghc6, ghc6-prof
    Build-Depends-Indep: ghc6-doc, haddock, hscolour
    Homepage: http://hackage.haskell.org/cgi-bin/$package/package/$package
    
    Package: libghc6-$package-dev
    Architecture: any
    Depends: ${haskell:Depends}, ${shlibs:Depends}, ${misc:Depends}
    Suggests: libghc6-$package-doc (= ${binary:Version}), libghc6-$package-prof (= ${binary:Version})
    Description: $packageShortDescription
     This package provides a library for the Haskell programming language.
     See http://www.haskell.org/ for more information on Haskell.
     .
     $packageLongDescription
    
    Package: libghc6-$package-prof
    Architecture: any
    Depends: libghc6-$package-dev (= ${binary:Version}), ${haskell:Depends}, ${shlibs:Depends}, ${misc:Depends}
    Description: $packageShortDescription; profiling libraries
     This package provides a library for the Haskell programming language,
     compiled for profiling.
     See http://www.haskell.org/ for more information on Haskell.
     .
     $packageLongDescription
    
    Package: libghc6-$package-doc
    Section: doc
    Architecture: all
    Depends: ${misc:Depends}
    Recommends: ghc6-doc (>= 6.8.2)
    Suggests: libghc6-$package-dev (= ${binary:Version})
    Description: $packageShortDescription; documentation
     This package provides the documentation for a library for the Haskell
     programming language.
     See http://www.haskell.org/ for more information on Haskell.
     .
     $packageLongDescription
    EOF
    1. echo 5 > debian/compat
    2. Create debian/copyright with your favorite editor:
    Debianised by ...
    Author ...
    Copyright: BSD ... /usr/share/common-licenses/BSD ...
    EOF
  6. cat << EOF > debian/rules
    #!/usr/bin/make -f
    
    include /usr/share/cdbs/1/rules/debhelper.mk
    include /usr/share/cdbs/1/class/hlibrary.mk
    EOF
  7. cat << EOF > debian/watch
    version=3
    http://hackage.haskell.org/packages/archive/$package/([\d\.]+)/$package-([\d\.]+).tar.gz
    EOF
  8. dch --create -D unstable --package haskell-$package --newversion $version-1
  9. debuild -us -uc

[edit] 2 Packaging a Cabal library package in 10 easy steps

This process requires the haskell-utils package.

Here is an example on was created a new Debian package out of an Haskell Cabal library package: mtl.

  1. wget http://hackage.haskell.org/packages/archive/mtl/1.0/mtl-1.0.tar.gz -O haskell-mtl_1.0.1.orig.tar.gz
  2. tar -zxf haskell-mtl_1.0.1.orig.tar.gz
  3. cd mtl-1.0
  4. mkdir -p debian/varfiles
  5. Create debian/varfiles/varfile with your favorite editor:
        maintainer="Ian Lynagh (wibble) <igloo@debian.org>"
        short_description="Haskell monad transformer library for GHC"
        long_description=" MTL is a monad transformer library, inspired by the paper \"Functional
        Programming with Overloading and Higher-Order Polymorphism\",
        by Mark P Jones (<http://www.cse.ogi.edu/~mpj/>), Advanced School
        of Functional Programming, 1995."
        c_dev_libs=""
        extra_build_deps=""
    (Pay attention to the leading space in long_description. It's necessary due to the format of Debian's control file.)
  6. Create debian/copyright with your favorite editor:
        Debianised by ...
        Author ...
        Copyright: BSD ... /usr/share/common-licenses/BSD ...
        EOF
  7. dch --create -D unstable --package haskell-mtl --newversion 1.0.1-1
  8. update-debian-haskell-files
  9. debian/rules update-generated-files
  10. debuild -us -uc

With luck the .cabal file will provide most of the text for steps 5 and 6.

When making future changes, apart from adding a changelog entry (use dch), only steps 9 and 10 need to be repeated.

Even if packaging Haskell libraries seems easy, the Debian Policy and the Developers Reference contains a lot of valuable informations on how to create a policy compliant Debian package.

Please subscribe to the debian-haskell mailling-list if you are interested in creating new Haskell packages for Debian.

[edit] 3 Packaging a Cabal program package in N easy steps

TBD