Difference between revisions of "Haskell package guidelines"

From ArchWiki
Jump to: navigation, search
m (Automatic local building of Hackage Packages with cabal2arch using Bauerbill: Bauerbill has been officially discontinued)
m ([haskell-core] maintenance)
(39 intermediate revisions by 15 users not shown)
Line 1: Line 1:
[[Category:Guidelines (English)]]
+
[[Category:Package development]]
[[Category:Package development (English)]]
+
[[it:Haskell Package Guidelines]]
 +
{{Package Guidelines}}
  
{{i18n|Haskell package guidelines}}
+
[[Wikipedia:Haskell|Haskell]] is well supported on Arch Linux.
 +
GHC and a few core packages are available in the [[Official Repositories|official repositories]].
 +
For more serious Haskellers, the [[ArchHaskell]] community project provides many packages from [http://hackage.haskell.org Hackage], and the number is growing.
  
'''Haskell on Arch Linux'''
+
See the [[ArchHaskell]] community page for contact details and ways to help.
 
+
Haskell is well supported on Arch Linux, with GHC and other key tools available via pacman, a growing number of packages made available by the ArchHaskell group, and a large part of [http://hackage.haskell.org hackage.haskell.org] library database [http://aur.archlinux.org/packages.php?O=0&L=0&C=0&K=arch-haskell&SeB=m&SB=n&SO=a&PP=100&do_Search=Go available via AUR].
+
 
+
The community around Haskell on Arch is active and well organized but your help is always welcome.
+
 
+
== Community ==
+
 
+
All the details on the [[ArchHaskell]] group is available on its own page.
+
  
 
== Haskell Packages ==
 
== Haskell Packages ==
 +
To use Haskell on Arch Linux, you have two mutually exclusive options:
 +
# Use packages from the official Arch Linux repositories. These are a well maintained small subset of all Haskell packages. Just install them the way you would install anything else on Arch Linux. Examples of what is available: in the [https://www.archlinux.org/packages/?arch=x86_64&repo=Extra&q=haskell&last_update=&limit=50 extra] and [https://www.archlinux.org/packages/?arch=x86_64&repo=Community&q=haskell&last_update=&limit=50 community] repositories. The packages here should satisfy people who just want to use the Haskell Platform. You may also combine this option with other packages from unofficial sources like the AUR.
 +
# Use the ArchHaskell project's unofficial repositories. These contain a much larger subset of what's available on Hackage. As a community effort, we often need volunteers to help maintain and add more packages to these repositories. Read on for information about using them.
  
The core Haskell tools are available in the core system (extra):
+
=== [haskell-core] ===
 
+
The [haskell-core] repository is the base repository of packages maintained by the ArchHaskell team.
==== <nowiki>[Extra]</nowiki> ====
+
[haskell-core] can be accessed by adding the following entry to {{ic|/etc/pacman.conf}} (above [extra]):
 
+
* [http://www.archlinux.org/packages/?arch=x86_64&repo=Extra&q=haskell&last_update=&limit=50 Haskell packages in the core system]
+
 
+
Our policy is for [extra] to provide the Haskell platform, and popular Haskell applications.
+
 
+
==== <nowiki>[haskell]</nowiki> ====
+
 
+
The packages maintained by the ArchHaskell group can be accessed by adding the following entry to pacman.conf:
+
 
+
[haskell]
+
Server = http://andromeda.kiwilight.com/$repo/$arch
+
 
+
==== <nowiki>AUR</nowiki> ====
+
 
+
* [http://aur.archlinux.org/packages.php?O=0&L=0&C=0&K=arch-haskell&SeB=m&SB=n&SO=a&PP=100&do_Search=Go Haskell packages in AUR]
+
 
+
A huge number (almost 2000) packages built from http://hackage.haskell.org
+
 
+
These generally improve on installing directly from Hackage as they resolve required C libraries. They can be installed as, for example:
+
 
+
    sudo paktahn -S haskell-csv
+
 
+
Anything not found here can be installed via [http://aur.archlinux.org/packages.php?ID=17411 cabal-install] direct from Hackage.
+
 
+
== Guidelines ==
+
 
+
In almost all cases cabalised Haskell packages can be automatically translated into Arch packages, via the cabal2arch tool.  It is strongly recommended that you use the latest released version of this tool, as it implements the packaging policy for Haskell packages.  You can get it in several ways:
+
 
+
* Add the <nowiki>[haskell]</nowiki> repository to pacman.conf and use pacman do install the latest release.
+
* Download and build the [http://aur.archlinux.org/packages.php?ID=17471 source from AUR], either manually or using one of the many [[AUR Helpers]].
+
* Install directly from Hackage using "cabal install cabal2arch".
+
 
+
===cabal2arch: an example===
+
 
+
This example illustrates how to create a new package with cabal2arch. We'll make a new package for the delimited continuations library, CC-delcont:
+
 
+
First, set the name and email address to be used in the generated PKGBUILD:
+
 
+
export ARCH_HASKELL='My Name <my.name@domain.org>'
+
 
+
Second, find [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/CC-delcont the hackage page for CC-delcont], then identify the link to the .cabal file. Use this link as an argument to cabal2arch:
+
 
+
<pre>
+
% cd /tmp
+
% cabal2arch http://hackage.haskell.org/packages/archive/pandoc/1.6.0.1/pandoc.cabal
+
Using /tmp/tmp.x9SEhTJ8N9/pandoc.cabal
+
Feeding the PKGBUILD to `makepkg -g`...
+
==> Retrieving Sources...
+
  -> Downloading pandoc-1.6.0.1.tar.gz...
+
--2011-01-30 22:12:18--  http://hackage.haskell.org/packages/archive/pandoc/1.6.0.1/pandoc-1.6.0.1.tar.gz
+
Resolving hackage.haskell.org... 69.30.63.204
+
Connecting to hackage.haskell.org|69.30.63.204|:80... connected.
+
HTTP request sent, awaiting response... 200 OK
+
Length: 355477 (347K) [application/x-tar]
+
Saving to: `pandoc-1.6.0.1.tar.gz.part'
+
 
+
    0K .......... .......... .......... .......... .......... 14% 20.3K 15s
+
    50K .......... .......... .......... .......... .......... 28% 40.3K 9s
+
  100K .......... .......... .......... .......... .......... 43% 53.0K 6s
+
  150K .......... .......... .......... .......... .......... 57% 58.2K 4s
+
  200K .......... .......... .......... .......... .......... 72% 57.7K 2s
+
  250K .......... .......... .......... .......... .......... 86% 67.1K 1s
+
  300K .......... .......... .......... .......... .......  100% 76.4K=7.7s
+
 
+
2011-01-30 22:12:27 (44.9 KB/s) - `pandoc-1.6.0.1.tar.gz.part' saved [355477/355477]
+
 
+
==> Generating checksums for source files...
+
</pre>
+
 
+
Checking what was created:
+
  
  % ls
+
  [haskell-core]
  haskell-cc-delcont
+
  Server = http://xsounds.org/~haskell/core/$arch
  
You can now inspect the PKGBUILD and install script for the library:
+
or
  
<pre>
+
[haskell-core]
# Maintainer: My Name <my.name@domain.org>
+
Server = http://www.kiwilight.com/haskell/core/$arch
_hkgname=pandoc
+
pkgname=haskell-pandoc
+
pkgver=1.6.0.1
+
pkgrel=1
+
pkgdesc="Conversion between markup formats"
+
url="http://hackage.haskell.org/package/${_hkgname}"
+
license=('GPL')
+
arch=('i686' 'x86_64')
+
makedepends=()
+
depends=('ghc' 'haskell-http=4000.0.9' 'haskell-bytestring=0.9.1.7' 'haskell-containers=0.3.0.0' 'haskell-directory=1.0.1.1' 'haskell-extensible-exceptions=0.1.1.1' 'haskell-filepath=1.1.0.4' 'haskell-mtl>=1.1' 'haskell-network=2.2.1.7' 'haskell-old-time=1.0.0.5' 'haskell-parsec=2.1.0.1' 'haskell-pretty=1.0.1.1' 'haskell-process=1.0.1.3' 'haskell-random=1.0.0.2' 'haskell-syb=0.1.0.2' 'haskell-texmath<0.5' 'haskell-utf8-string>=0.3' 'haskell-xhtml=3000.2.0.1' 'haskell-xml<1.4' 'haskell-zip-archive<0.2')
+
options=('strip')
+
source=(http://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz)
+
install=${pkgname}.install
+
md5sums=('d19a630462595941b3100dff6f839aa3')
+
build() {
+
    cd ${srcdir}/${_hkgname}-${pkgver}
+
    runhaskell Setup configure -O --enable-split-objs --enable-shared \
+
      --prefix=/usr --docdir=/usr/share/doc/${pkgname} --libsubdir=\$compiler/site-local/\$pkgid
+
    runhaskell Setup build
+
    runhaskell Setup haddock
+
    runhaskell Setup register  --gen-script
+
    runhaskell Setup unregister --gen-script
+
    sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
+
}
+
package() {
+
    cd ${srcdir}/${_hkgname}-${pkgver}
+
    install -D -m744 register.sh  ${pkgdir}/usr/share/haskell/${pkgname}/register.sh
+
    install    -m744 unregister.sh ${pkgdir}/usr/share/haskell/${pkgname}/unregister.sh
+
    install -d -m755 ${pkgdir}/usr/share/doc/ghc/html/libraries
+
    ln -s /usr/share/doc/${pkgname}/html ${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}
+
    runhaskell Setup copy --destdir=${pkgdir}
+
}
+
</pre>
+
  
It follows the conventions for Haskell packages:
+
The set of packages in the [haskell-core] repository is derived from the '''habs''' tree officially located [https://github.com/archhaskell/habs here]. A tool called [https://github.com/magthe/cblrepo cblrepo] is used to keep the '''habs''' tree synchronized with the official Haskell packages from [http://hackage.haskell.org/packages/hackage.html Hackage].
  
* Libraries are prefixed with "haskell-"
+
Putting [haskell-core] above [extra] will ensure that the packages from [haskell-core] take precedence, in case of duplicate packages in the two repositories.
* All libraries that the package depend on are listed (libraries shipped with ghc are dealt with by having the ghc package provide them)
+
* It uses cabal to generate a post-install register/unregister script, with a standard name.
+
* We use haddock to build the documentation.
+
  
All Haskell libraries should follow these naming conventions, and using the latest release of cabal2arch will ensure this is the case.
+
=== [haskell-web] ===
 +
The [haskell-web] repository builds on [haskell], providing several more packages, especially those useful for web applications.
  
===Guidelines for Libraries===
+
[haskell-web]
 +
Server = http://archhaskell.mynerdside.com/$repo/$arch
  
In general, each .cabal file should map to one PKGBUILD. The following conventions hold:
+
Add it after [haskell].
  
* libraries have their cabal names prefixed with "haskell-"
+
=== Last resorts ===
* all libraries have a dependency on 'ghc'
+
* [https://aur.archlinux.org/packages.php?O=0&K=haskell- Haskell packages in the AUR]
* all libraries that are depended on must be listed in the depends-array in the PKGBUILD
+
* cabal-install directly
* be careful about dependencies from gtk2hs: cairo, svg, glib, gtk. These are all provided by the 'gtk2hs' package, not , e.g. "haskell-cairo"
+
  
Registering Haskell libraries is done via a register hook, see above.
+
Unfortunately, many of the packages in the AUR are outdated due to a lack of resources.
 +
If you have the time, it is recommended to use cblrepo and create something like [haskell-web], which can then be added to the collection of haskell-providing repositories.
  
===Guidelines for Programs ===
+
== Improving ArchHaskell ==
  
* Have their normal name. Examples: hmp3, xmonad, ghc, cabal-install
+
=== Community ===
 +
See the [[ArchHaskell]] community page and get in touch via the mailing list or the IRC channel.
  
* Be careful about dynamically linked runtime dependencies on C. For example, all GHC-produced binaries have a runtime dependency on 'gmp'. OpenGL or GtT-based binaries will have additional 'depends'. cabal2arch will attempt to work out the C dependencies, but there may be others implied by Haskell dependencies that are missed.
+
=== Overview ===
 +
The plan is to have one user-facing repository, [haskell], which merges the packages available in various satellite repositories (like [haskell-web]), thereby distributing the maintenance load.
 +
One satellite repo is special, the [haskell-core] repository, which provides packages that are dependencies of all the other satellites.
  
* Use executable stripping, --enable-executable-stripping. cabal2arch will do this automatically.
+
=== [haskell-core] maintenance ===
 +
Ensure:
 +
* [haskell-core] is an Arch repo hosted at kiwilight and xsounds.
 +
* [haskell-core] is in sync with the [https://github.com/archhaskell/habs habs] cblrepo database.
  
== Automatic local building of Hackage Packages with cabal2arch using Bauerbill ==
+
=== Other repo maintenance ===
{{Warning|''Bauerbill'' development has been officially discontinued: its latest version does not work with            ''pacman>&#61;3.5''. See [[https://bbs.archlinux.org/viewtopic.php?id&#61;115660]].}}
+
For example, for haskell-foo, ensure:
Although there are a number of haskell packages on AUR, there will always be outdated packages on AUR. If this happens and you want to create a fully updated package you would normally use cabal2arch. This however can become painful/time consuming if you have numerous packages with different dependencies (some of which may/may not be updated). Instead you can automatic this process by using [[Bauerbill]] which has the --hackage flag, allowing you to create AUR packages from Hackage locally. Below is an example of some common commands
+
* haskell-foo is a cblrepo database, possibly using packages from [haskell-core] as DistroPkgs.
 +
* Whenever [haskell-core] is updated, haskell-foo's database is updated to match within a reasonable time.
  
    bauerbill -S --hackage [pkgs] : build [pkgs] directly from Hackage*
+
=== Creating another repo ===
    bauerbill -Si --hackage [pkgs] : look up information about [pkgs]
+
    bauerbill -Ss --hackage [args] : search for [args]
+
    bauerbill -Qu --hackage : list upgradable Hackage packages
+
  
Syncing packages with the --hackage flag will interactively download all dependencies of the package from Hackage, convert them using cabal2arch and then build/install them (while checking dependencies). You can combine this with the --aur flag to give precedence to Hackage packages that are on AUR
+
=== List of satellite repos ===

Revision as of 16:07, 26 December 2012

Template:Package Guidelines

Haskell is well supported on Arch Linux. GHC and a few core packages are available in the official repositories. For more serious Haskellers, the ArchHaskell community project provides many packages from Hackage, and the number is growing.

See the ArchHaskell community page for contact details and ways to help.

Haskell Packages

To use Haskell on Arch Linux, you have two mutually exclusive options:

  1. Use packages from the official Arch Linux repositories. These are a well maintained small subset of all Haskell packages. Just install them the way you would install anything else on Arch Linux. Examples of what is available: in the extra and community repositories. The packages here should satisfy people who just want to use the Haskell Platform. You may also combine this option with other packages from unofficial sources like the AUR.
  2. Use the ArchHaskell project's unofficial repositories. These contain a much larger subset of what's available on Hackage. As a community effort, we often need volunteers to help maintain and add more packages to these repositories. Read on for information about using them.

[haskell-core]

The [haskell-core] repository is the base repository of packages maintained by the ArchHaskell team. [haskell-core] can be accessed by adding the following entry to /etc/pacman.conf (above [extra]):

[haskell-core]
Server = http://xsounds.org/~haskell/core/$arch

or

[haskell-core]
Server = http://www.kiwilight.com/haskell/core/$arch

The set of packages in the [haskell-core] repository is derived from the habs tree officially located here. A tool called cblrepo is used to keep the habs tree synchronized with the official Haskell packages from Hackage.

Putting [haskell-core] above [extra] will ensure that the packages from [haskell-core] take precedence, in case of duplicate packages in the two repositories.

[haskell-web]

The [haskell-web] repository builds on [haskell], providing several more packages, especially those useful for web applications.

[haskell-web]
Server = http://archhaskell.mynerdside.com/$repo/$arch

Add it after [haskell].

Last resorts

Unfortunately, many of the packages in the AUR are outdated due to a lack of resources. If you have the time, it is recommended to use cblrepo and create something like [haskell-web], which can then be added to the collection of haskell-providing repositories.

Improving ArchHaskell

Community

See the ArchHaskell community page and get in touch via the mailing list or the IRC channel.

Overview

The plan is to have one user-facing repository, [haskell], which merges the packages available in various satellite repositories (like [haskell-web]), thereby distributing the maintenance load. One satellite repo is special, the [haskell-core] repository, which provides packages that are dependencies of all the other satellites.

[haskell-core] maintenance

Ensure:

  • [haskell-core] is an Arch repo hosted at kiwilight and xsounds.
  • [haskell-core] is in sync with the habs cblrepo database.

Other repo maintenance

For example, for haskell-foo, ensure:

  • haskell-foo is a cblrepo database, possibly using packages from [haskell-core] as DistroPkgs.
  • Whenever [haskell-core] is updated, haskell-foo's database is updated to match within a reasonable time.

Creating another repo

List of satellite repos