source: trunk/dports/math/levmar/Portfile

Last change on this file was 122667, checked in by mojca@…, 3 years ago

change email of Thomas Lockhart

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.7 KB
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 122667 2014-07-26 12:03:22Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                levmar
7version             2.6
8revision            3
9categories          math
10platforms           darwin
11license             GPL
12
13maintainers         gmail.com:tlockhart1976 openmaintainer
14
15description         Levenberg-Marquardt nonlinear least squares algorithm
16long_description    levmar is a native ANSI C implementation of the Levenberg-Marquardt \
17                    optimization algorithm.  Both unconstrained and constrained (under linear \
18                    equations, inequality and box constraints) Levenberg-Marquardt variants are \
19                    included.  The LM algorithm is an iterative technique that finds a local \
20                    minimum of a function that is expressed as the sum of squares of nonlinear \
21                    functions.  It has become a standard technique for nonlinear least-squares \
22                    problems and can be thought of as a combination of steepest descent and the \
23                    Gauss-Newton method.  When the current solution is far from the correct on, \
24                    the algorithm behaves like a steepest descent method: slow, but guaranteed \
25                    to converge.  When the current solution is close to the correct solution, it \
26                    becomes a Gauss-Newton method.
27
28homepage            http://www.ics.forth.gr/~lourakis/levmar/
29master_sites        http://www.ics.forth.gr/~lourakis/levmar/
30
31extract.suffix      .tgz
32checksums           rmd160  2b29daea12804050c8d3939b8c142d27d36bffc8 \
33                    sha256  3bf4ef1ea4475ded5315e8d8fc992a725f2e7940a74ca3b0f9029d9e6e94bad7
34
35# Patch taken from levmar RPM by Eric Smith <eric@brouhaha.com>
36patch.pre_args      -p1
37patchfiles          patch-Makefile.so.diff
38
39default_variants +atlas
40
41variant universal {}
42
43variant atlas description {Use MacPorts' ATLAS instead of Accelerate Framework} {
44    depends_lib-append  port:atlas
45}
46
47if {! [variant_isset atlas]} {
48    conflicts       atlas
49}
50
51global makefile
52set makefile ${worksrcpath}/Makefile.so
53
54use_configure       no
55
56set ver_major [lindex [split ${version} "."] 0]
57set ver_minor [lindex [split ${version} "."] 1]
58set abi_major 2
59set abi_minor 2
60
61post-patch {
62    set fl [open ${makefile}]
63    set lines [read $fl]
64    close $fl
65    foreach line [split $lines \n] {
66        if {[regexp {(MAJ|MIN)[[:space:]]*=[[:space:]]*([[:digit:]]+)} ${line} matched key value] == 1} {
67            if {${key} == "MAJ"} {
68                ui_debug "Found ABI major field ${value}"
69                set abi_major ${value}
70            } else {
71                ui_debug "Found ABI minor field ${value}"
72                set abi_minor ${value}
73            }
74        }
75    }
76
77    if {${abi_major} != ${ver_major} || ${abi_minor} > ${ver_minor}} {
78        ui_error "levmar version ${ver_major} is inconsistent with ABI version ${abi_major}.${abi_minor}"
79        return -code error
80    }
81
82    if {[variant_isset atlas]} {
83        reinplace "s|^LAPACKLIBS=.*$|LAPACKLIBS= -L${prefix}/lib -lsatlas|g" ${makefile}
84    }
85
86    reinplace "s|\r||g" ${worksrcpath}/README.txt
87    file mkdir ${worksrcpath}/sobj
88}
89
90build.args-append   -f ${makefile}
91build.args-append   CC="${configure.cc} [get_canonical_archflags cc]"
92build.args-append   LDFLAGS+=-Wl,-rpath,${prefix}/lib
93# Add this local rpath to allow port test to run successfully
94build.args-append   LDFLAGS+=-Wl,-rpath,${worksrcpath}/sobj
95
96test.run            yes
97test.cmd            ${worksrcpath}/lmdemo
98test.target         {}
99
100destroot {
101    # library
102    xinstall -m 755 ${worksrcpath}/sobj/liblevmar.${abi_major}.${abi_minor}.dylib ${destroot}${prefix}/lib/liblevmar.${abi_major}.${abi_minor}.dylib
103
104    # test program
105    xinstall -m 755 ${worksrcpath}/lmdemo ${destroot}${prefix}/bin/lmdemo
106    # Remove the local rpath which was present to allow port test to run successfully
107    system "install_name_tool -delete_rpath ${worksrcpath}/sobj ${destroot}${prefix}/bin/lmdemo"
108
109    # header files
110    xinstall -m 755 ${worksrcpath}/levmar.h ${destroot}${prefix}/include
111
112    # documentation
113    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
114    xinstall -m 644 ${worksrcpath}/LICENSE ${destroot}${prefix}/share/${name}
115    xinstall -m 644 ${worksrcpath}/README.txt ${destroot}${prefix}/share/${name}
116}
117
118post-destroot {
119    ln -s liblevmar.${abi_major}.${abi_minor}.dylib ${destroot}${prefix}/lib/liblevmar.${ver_major}.dylib
120    ln -s liblevmar.${abi_major}.${abi_minor}.dylib ${destroot}${prefix}/lib/liblevmar.dylib
121}
122
123livecheck.type      regex
124livecheck.url       http://www.ics.forth.gr/~lourakis/levmar/
125livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)"
Note: See TracBrowser for help on using the repository browser.