Ticket #33430: Portfile-pixilla

File Portfile-pixilla, 4.1 KB (added by pixilla (Bradley Giesbrecht), 13 years ago)

Use ln macro in place of "system ln". Place version string between name and .dylib suffix.

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 87721 2011-12-02 09:31:29Z stromnov@macports.org $
3
4PortSystem          1.0
5
6name                levmar
7version             2.6
8categories          devel
9platforms           darwin
10license             GPL
11
12maintainers         fourpalms.org:lockhart openmaintainer
13
14description         Levenberg-Marquardt nonlinear least squares algorithm
15long_description    levmar is a native ANSI C implementation of the Levenberg-Marquardt \
16                    optimization algorithm.  Both unconstrained and constrained (under linear \
17                    equations, inequality and box constraints) Levenberg-Marquardt variants are \
18                    included.  The LM algorithm is an iterative technique that finds a local \
19                    minimum of a function that is expressed as the sum of squares of nonlinear \
20                    functions.  It has become a standard technique for nonlinear least-squares \
21                    problems and can be thought of as a combination of steepest descent and the \
22                    Gauss-Newton method.  When the current solution is far from the correct on, \
23                    the algorithm behaves like a steepest descent method: slow, but guaranteed \
24                    to converge.  When the current solution is close to the correct solution, it \
25                    becomes a Gauss-Newton method.
26
27homepage            http://www.ics.forth.gr/~lourakis/levmar/
28master_sites        http://www.ics.forth.gr/~lourakis/levmar/
29
30extract.suffix      .tgz
31checksums           rmd160  2b29daea12804050c8d3939b8c142d27d36bffc8 \
32                    sha256  3bf4ef1ea4475ded5315e8d8fc992a725f2e7940a74ca3b0f9029d9e6e94bad7
33
34# Patch taken from levmar RPM by Eric Smith <eric@brouhaha.com>
35patch.pre_args      -p1
36patchfiles          patch-Makefile.so.diff
37
38use_configure       no
39#configure.args      --with-omniORB-config="${prefix}/etc/omniORB.cfg"
40
41universal_variant   no
42
43lassign [split ${version} "."] ver_major ver_minor
44lassign [split "2.2" "."] abi_major abi_minor
45
46post-patch {
47    set fl [open ${worksrcpath}/Makefile.so]
48    set lines [read $fl]
49    close $fl
50    foreach line [split $lines \n] {
51        if {[regexp {(MAJ|MIN)[[:space:]]*=[[:space:]]*([[:digit:]]+)} ${line} matched key value] == 1} {
52            if {${key} == "MAJ"} {
53                ui_debug "Found ABI major field ${value}"
54                set abi_major ${value}
55            } else {
56                ui_debug "Found ABI minor field ${value}"
57                set abi_minor ${value}
58            }
59        }
60    }
61
62    if {${abi_major} != ${ver_major} || ${abi_minor} > ${ver_minor}} {
63        ui_error "levmar version ${ver_major} is inconsistent with ABI version ${abi_major}.${abi_minor}"
64        return -code error
65    }
66
67    reinplace "s|\r||g" ${worksrcpath}/README.txt
68    file mkdir ${worksrcpath}/sobj
69}
70
71build.args-append   "-f Makefile.so"
72build.args-append   "LDFLAGS=-Wl,-rpath,${prefix}/lib"
73
74test.run            yes
75test.cmd            lmdemo
76test.target         {}
77test.env            DYLD_LIBRARY_PATH=${worksrcpath}/sobj
78
79destroot {
80    # library
81    xinstall -m 755 ${worksrcpath}/sobj/liblevmar.${abi_major}.${abi_minor}.dylib ${destroot}${prefix}/lib/liblevmar.${abi_major}.${abi_minor}.dylib
82
83    # test program
84    xinstall -m 755 ${worksrcpath}/lmdemo ${destroot}${prefix}/bin/lmdemo
85
86    # header files
87    xinstall -m 755 ${worksrcpath}/levmar.h ${destroot}${prefix}/include
88
89    # documentation
90    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
91    xinstall -m 644 ${worksrcpath}/LICENSE ${destroot}${prefix}/share/${name}
92    xinstall -m 644 ${worksrcpath}/README.txt ${destroot}${prefix}/share/${name}
93}
94
95post-destroot {
96    ln -s liblevmar.${abi_major}.${abi_minor}.dylib ${destroot}${prefix}/lib/liblevmar.${ver_major}.dylib
97    ln -s liblevmar.${abi_major}.${abi_minor}.dylib ${destroot}${prefix}/lib/liblevmar.dylib
98}
99
100livecheck.type      regex
101livecheck.url       http://www.ics.forth.gr/~lourakis/levmar/
102livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)"