source: trunk/dports/devel/ocaml-findlib/Portfile

Last change on this file was 148127, checked in by mcalhoun@…, 19 months ago

ocaml-findlib: prevent installation of the META file for ocaml-camlp4 (fixes #44929)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1# $Id: Portfile 148127 2016-04-27 17:53:47Z ryandesign@macports.org $
2
3PortSystem 1.0
4
5name                ocaml-findlib
6version             1.5.5
7revision            3
8distname            findlib-${version}
9categories          devel ml
10maintainers         mww openmaintainer
11platforms           darwin
12license             MIT
13description         Objective Caml library management system
14long_description    The findlib library provides a scheme to manage reusable \
15                    software components (packages), and includes tools that support \
16                    this scheme. Packages are collections of OCaml modules for which \
17                    metainformation can be stored. The packages are kept in the filesystem \
18                    hierarchy, but with strict directory structure. The library contains \
19                    functions to look the directory up that stores a package, to query \
20                    metainformation about a package, and to retrieve dependency information \
21                    about multiple packages. There is also a tool that allows the user to \
22                    enter queries on the command-line. In order to simplify compilation and \
23                    linkage, there are new frontends of the various OCaml compilers that \
24                    can directly deal with packages.
25homepage            http://projects.camlcity.org/projects/findlib.html
26master_sites        http://download.camlcity.org/download/
27checksums           rmd160  4dd077e963b7a72ce9bd716ee497f8555b182139 \
28                    sha256  aafaba4f7453c38347ff5269c6fd4f4c243ae2bceeeb5e10b9dab89329905946
29
30livecheck.type      regex
31livecheck.regex     "findlib-(.*?).tar.gz"
32
33depends_lib         port:ocaml
34
35# see #44929
36# patch modified from https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-ml/findlib/files
37# if labltk is updated, patchfile will have to remove labltk META file as well
38patchfiles-append   patch-meta.diff
39depends_lib-append  port:ocaml-camlp4
40
41configure.args      -bindir ${prefix}/bin \
42                    -mandir ${prefix}/share/man \
43                    -sitelib ${prefix}/lib/ocaml/site-lib
44
45configure.pre_args  ""
46
47use_parallel_build  no
48build.target        all opt
49
50universal_variant   no
51
52# `ocamlfind printconf destdir` returns nothing if the dir isn't in place
53# but we know it's the same as our site-lib dir
54set ocamlfind_destdir ${prefix}/lib/ocaml/site-lib/stublibs
55destroot.keepdirs   ${destroot}${ocamlfind_destdir}
56
57destroot.env-append OCAMLFIND_DESTDIR=${destroot}${prefix}/lib/ocaml/site-lib
58destroot.destdir    prefix=${destroot}
59
60post-destroot {
61    xinstall -m 755 ${filespath}/camlp4find ${destroot}${prefix}/bin/camlp4find
62}
63
64post-activate {
65        # Add our stublibs dir path to ld.conf
66        set ldconfpath [exec ${prefix}/bin/ocamlfind printconf ldconf]
67        # ld.conf should exist since ocaml is installed, but lets just be safe anyway
68        if {[file exists $ldconfpath]} then {
69          # make sure ld.conf doesn't already have this line, so if the user installs,
70          # uninstalls, then installs again, we won't duplicate it
71          set has_line 0
72          set ldconf [open $ldconfpath r+]
73          while {[gets $ldconf line] != -1 && !$has_line} {
74            if {[string equal $line $ocamlfind_destdir]} then {
75              set has_line 1
76            }
77          }
78          if {!$has_line} {
79            if {${registry.format} == "receipt_flat"} {
80                ui_msg "## Adding line `${ocamlfind_destdir}' to file ${ldconfpath}"
81                ui_msg "## Be sure to remove this line if you uninstall ${name}"
82            }
83            puts $ldconf $ocamlfind_destdir
84          }
85          close $ldconf
86        } else {
87          ui_warn "File ${ldconfpath} doesn't seem to be installed."
88          ui_warn "Is ocaml installed properly?"
89        }
90}
91
92pre-deactivate {
93        # remove our stublibs dir path from ld.conf
94        set ocamlfind_destdir [file normalize ${prefix}/lib/ocaml/site-lib/stublibs]
95        set ldconfpath [exec ${prefix}/bin/ocamlfind printconf ldconf]
96        set ldconfoutpath [file dirname $ldconfpath]/.[file tail $ldconfpath]~
97        if {[file exists $ldconfpath]} then {
98          set ldconf [open $ldconfpath r]
99          set ldconfout [open $ldconfoutpath w]
100          while {[gets $ldconf line] != -1} {
101            if {![string equal $line $ocamlfind_destdir]} {
102              puts $ldconfout $line
103            }
104          }
105          close $ldconfout
106          close $ldconf
107          file rename -force $ldconfoutpath $ldconfpath
108        }
109}
110
111variant toolbox description {build the toolbox wizard, requires labltk} {
112        configure.args-append -with-toolbox
113        depends_lib-append port:ocaml-labltk
114}
Note: See TracBrowser for help on using the repository browser.