Ticket #10958: Portfile.2

File Portfile.2, 4.5 KB (added by kballard (Lily Ballard), 18 years ago)

Updated new portfile

Line 
1PortSystem          1.0
2name                caml-findlib
3version             1.1.2pl1
4revision            0
5distfiles           findlib-${version}.tar.gz
6worksrcdir          findlib-${version}
7categories          devel
8maintainers         kevin@sb.org
9description         Objective Caml library management system
10long_description    The findlib library provides a scheme to manage reusable \
11                    software components (packages), and includes tools that support \
12                    this scheme. Packages are collections of OCaml modules for which \
13                    metainformation can be stored. The packages are kept in the filesystem \
14                    hierarchy, but with strict directory structure. The library contains \
15                    functions to look the directory up that stores a package, to query \
16                    metainformation about a package, and to retrieve dependency information \
17                    about multiple packages. There is also a tool that allows the user to \
18                    enter queries on the command-line. In order to simplify compilation and \
19                    linkage, there are new frontends of the various OCaml compilers that \
20                    can directly deal with packages.
21homepage            http://www.ocaml-programming.de/programming/findlib.html
22platforms           darwin
23master_sites        http://www.ocaml-programming.de/packages/
24extract.suffix      .tar.gz
25build.target        all opt
26checksums           sha1 ccd8b9d6249b5a4097040d32b90048b11054f461 \
27                    md5 df4c9176e9d5b8a6d37668d108fae923
28
29depends_lib         port:ocaml
30
31configure.args      -bindir ${prefix}/bin \
32                    -mandir ${prefix}/share/man \
33                    -sitelib ${prefix}/lib/ocaml/site-lib
34
35configure.pre_args  ""
36
37destroot.destdir    prefix=${destroot}
38
39post-destroot {
40        # `ocamlfind printconf destdir` returns nothing if the dir isn't in place
41        # but we know it's the same as our site-lib dir
42        set ocamlfind_destdir [file normalize ${prefix}/lib/ocaml/site-lib/stublibs]
43        file mkdir ${destroot}${ocamlfind_destdir}
44        # make a turd file so the directory doesn't get pruned when installing
45        # I suppose I don't actually know if it prunes before or after this phase
46        # but better to be safe than sorry
47        close [open ${destroot}${ocamlfind_destdir}/.turd_${portname} w]
48}
49
50post-activate {
51        # Add our stublibs dir path to ld.conf
52        set ocamlfind_destdir [file normalize ${prefix}/lib/ocaml/site-lib/stublibs]
53        set ldconfpath [exec ${destroot}${prefix}/bin/ocamlfind printconf ldconf]
54        # ld.conf should exist since ocaml is installed, but lets just be safe anyway
55        if {[file exists $ldconfpath]} then {
56          # make sure ld.conf doesn't already have this line, so if the user installs,
57          # uninstalls, then installs again, we won't duplicate it
58          set has_line 0
59          set ldconf [open $ldconfpath r+]
60          while {[gets $ldconf line] != -1 && !$has_line} {
61            if {[string equal $line $ocamlfind_destdir]} then {
62              set has_line 1
63            }
64          }
65          if {!$has_line} {
66            ui_msg "## Adding line `${ocamlfind_destdir}' to file ${ldconfpath}"
67            ui_msg "## Be sure to remove this line if you uninstall ${portname}"
68            puts $ldconf $ocamlfind_destdir
69          }
70          close $ldconf
71        } else {
72          ui_warn "File ${ldconfpath} doesn't seem to be installed."
73          ui_warn "Is ocaml installed properly?"
74        }
75}
76
77# pre-deactivate doesn't actually exist
78# which annoys me, because it means I can't remove the line I added to ld.conf
79#pre-deactivate {
80#        # remove our stublibs dir path from ld.conf
81#        set ocamlfind_destdir [file normalize ${prefix}/lib/ocaml/site-lib/stublibs]
82#        set ldconfpath ${destroot}[exec ${destroot}${prefix}/bin/ocamlfind printconf ldconf]
83#        set ldconfoutpath [file dirname $ldconfpath]/.[file tail $ldconfpath]~
84#        if {[file exists $ldconfpath]} then {
85#          set ldconf [open $ldconfpath r]
86#          set ldconfout [open $ldconfoutpath w]
87#          while {[gets $ldconf line] != -1} {
88#            if {![string equal $line $ocamlfind_destdir]} {
89#              puts $ldconfout $line
90#            }
91#          }
92#          close $ldconfout
93#          close $ldconf
94#          file rename -force $ldconfoutpath $ldconfpath
95#        }
96#}
97
98variant toolbox {
99        configure.args-append -with-toolbox
100        depends_lib bin:lablgtk:lablgtk
101}