Difference between revisions of "OCaml package guidelines"

From ArchWiki
Jump to: navigation, search
(Created page with "Category:Package development (English) Category:Guidelines (English) ==Package Naming== For libraries, use ''ocaml-modulename''. For applications, use the program name. ...")
 
Line 11: Line 11:
  
 
In most packages the OCaml findlib directory will need to be specified, this should never be specified statically, but should use the ocaml-findlib destdir variable. Generally this is set in this manner:
 
In most packages the OCaml findlib directory will need to be specified, this should never be specified statically, but should use the ocaml-findlib destdir variable. Generally this is set in this manner:
OCAMLFIND_DESTDIR=${pkgdir}$(ocamlfind printconf destdir)
+
OCAMLFIND_DESTDIR=${pkgdir}/$(ocamlfind printconf destdir)
  
 
== Bytecode ==
 
== Bytecode ==
Line 35: Line 35:
 
build() {
 
build() {
 
   cd $startdir/src/${pkgname}-${pkgver}
 
   cd $startdir/src/${pkgname}-${pkgver}
  export DESTDIR=${pkgdir}
+
 
  export OCAMLFIND_DESTDIR=${pkgdir}$(ocamlfind printconf destdir)
+
   ./configure || return 1
   ./configure --prefix=/usr || return 1
+
 
   make || return 1
 
   make || return 1
   make install || return 1
+
   make opt || return 1
 +
  env DESTDIR="${pkgdir}" \
 +
      OCAMLFIND_DESTDIR="${pkgdir}/$(ocamlfind printconf destdir)" \
 +
      make install || return 1
 
}
 
}
  
 
</pre>
 
</pre>
  
Keep in mind that many OCaml Packages will need extra parameters passed to make and make install.
+
Keep in mind that many OCaml Packages will often need extra parameters passed to make and make install.

Revision as of 21:49, 1 January 2011


Package Naming

For libraries, use ocaml-modulename. For applications, use the program name. In either case, the pkgname should be entirely lowercase.

OCaml Library Locations

All OCaml libraries should be installed via ocaml-findlib, ocaml-findlib maintains a means whereby ocaml packages are more clearly tracked. The only distinction for ocaml-findlib is that it requires that a META file be created. Most OCaml packages already have a META file, for those which do not provide an upstream META file chances are the file can be obtained from the Debian/Ubuntu or Fedora package.

The OCaml libraries should all be installed under /usr/lib/ocaml, there has been some confusion about where to install OCaml libraries, and many OCaml libraries have been installed under /usr/lib/ocaml/site-lib, this practice can break a number of OCaml program builds and has resulted in a schism in OCaml package development. Maintaining a central location for all OCaml packages will aleviate a number of problems with the continued development of ArchLinux OCaml support.

In most packages the OCaml findlib directory will need to be specified, this should never be specified statically, but should use the ocaml-findlib destdir variable. Generally this is set in this manner: OCAMLFIND_DESTDIR=${pkgdir}/$(ocamlfind printconf destdir)

Bytecode

If bytecode is produced make sure to include "options=('!strip')". Otherwise the packaging process will damage the OCaml bytecode.

OCaml PKGBUILD Example

# Contributor: Your Name <youremail@domain.com>

pkgname=ocaml-<package name>
pkgver=4.2
pkgrel=1
license=('GPL')
arch=('i686' 'x86_64')
pkgdesc="An OCaml Package"
url=""
depends=()
makedepends=('ocaml' 'ocaml-findlib')
source=()
options=('!strip')
md5sums=()

build() {
  cd $startdir/src/${pkgname}-${pkgver}

  ./configure || return 1
  make || return 1
  make opt || return 1
  env DESTDIR="${pkgdir}" \
      OCAMLFIND_DESTDIR="${pkgdir}/$(ocamlfind printconf destdir)" \
      make install || return 1
}

Keep in mind that many OCaml Packages will often need extra parameters passed to make and make install.