portfileを書いてみた

MacPortsに登録されているxml-lightが、findlibを使ってないことに嫌気がさしたので、自前でportfileを書いてみた。

で、そのときの流れをメモしようと思ったけど、http://lapangan.net/darwinports/index.php?cmd=read&page=HowTo%2FPrivatePortfileTutorialという、とてもよくまとまっているページを見つけたので、やる気をなくした。

書いたportfile

# $Id: $
PortSystem        1.0
name              caml-xml-light
version           2.2
categories        devel,ml
maintainers       mzpppp@gmail.com
description       Objective Caml interface for XML parsing and printing
long_description  XML Light is a minimal XML parser & printer for OCaml. \
		  It provide functions to parse an XML document into an \
		  OCaml data structure, work with it, and print it back \
		  to an XML document.
homepage          http://tech.motion-twin.com/xmllight/
distfiles	  xml-light-${version}.zip:master META.zip:patch
master_sites      http://tech.motion-twin.com/zip/:master \
		  http://howdyworld.org/patches/:patch

checksums         xml-light-${version}.zip md5 7658985cfdaeeb94b579b932eeaa3e00 \
		  META.zip  md5  7d48a50a3918d7de1d772d83b6700d9d
use_zip		  yes
use_configure	  no
worksrcdir	  xml-light
build.target	  all opt

depends_lib         port:ocaml \
                    port:caml-findlib

destroot.cmd	    ocamlfind
destroot.target	    install

destroot {
    set ocaml_site_path [exec ocamlfind printconf destdir]
    file mkdir ${destroot}/${ocaml_site_path}
    system "cd ${worksrcpath} && ocamlfind install -destdir ${destroot}/${ocaml_site_path} xml-light META xml-light.a xml-light.cma xml-light.cmxa"
}