source: trunk/dports/devel/swig/Portfile @ 137992

Last change on this file since 137992 was 137992, checked in by mww@…, 4 years ago

inc. revision to rebuild library dependents of ocaml (ocaml update to version 4.02.2)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.0 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 137992 2015-06-24 16:17:51Z mww@macports.org $
3
4PortSystem 1.0
5
6name            swig
7version         3.0.5
8revision        1
9checksums       rmd160 691eece5c0da027b2cad0f671ed2cc7d732cf15e \
10                sha256 9f4cb9e8f213f041853646f58fe5e8428d63250d05f5c943b6fa759c77322a3c
11
12categories      devel
13maintainers     michaelld openmaintainer
14
15# The swig tool itself is GPL, but code incorporated into dependents has a
16# permissive license.
17license         {GPL-3+ Permissive}
18
19description     Tool to wrap C/C++ libraries in high-level languages.
20long_description \
21    SWIG is a software development tool that connects programs written in C \
22    and C++ with a variety of high-level programming languages. SWIG is \
23    primarily used with common scripting languages such as Perl, Python, \
24    Tcl/Tk, Ruby, Guile and MzScheme, however the list of supported languages \
25    also includes non-scripting languages such as Java and OCAML. SWIG is \
26    most commonly used to create high-level interpreted programming \
27    environments, user interfaces, and as a tool for testing and \
28    prototyping C/C++ software. SWIG may be freely used, distributed, and \
29    modified for commercial and noncommercial use.
30
31homepage        http://www.swig.org/
32platforms       darwin
33master_sites    sourceforge:project/swig/swig/swig-${version}
34
35depends_build   port:bison \
36                port:gsed
37
38post-patch {
39    # The configure script should use GNU sed
40    reinplace "s/\[\[:<:\]\]sed\[\[:>:\]\]/gsed/g" ${worksrcpath}/configure
41}
42
43build.target
44
45test.run        yes
46test.target     check
47
48array set bindings {
49    chicken     {port:chicken           chicken}
50    clisp       {port:clisp             clisp}
51    csharp      {port:mono              csharp}
52    gcj         {port:gcc47             "gcj=${prefix}/bin/gcj-mp-4.7 --with-gcjh=${prefix}/bin/gcjh-mp-4.7"}
53    d           {port:phobos            d}
54    go          {port:go                go}
55    guile       {port:guile             guile}
56    java        {bin:java:kaffe         java}
57    lua         {port:lua               lua}
58    mzscheme    {port:mzscheme          mzscheme}
59    ocaml       {port:ocaml             ocaml}
60    octave      {path:bin/octave:octave octave}
61    perl        {path:bin/perl:perl5    perl5=${prefix}/bin/perl}
62    php         {port:php55             "php=${prefix}/bin/php55"}
63    php5        {path:bin/php:php5      php}
64    pike        {port:pike              pike}
65    python      {port:python_select     python}
66    r           {port:R                 r}
67    ruby        {port:ruby              ruby}
68    tcl         {port:tcl               tcl}
69}
70array set prettynames {chicken Chicken clisp CLISP csharp "C#"
71    d D gcj GCJ go Go guile Guile java Java lua Lua mzscheme MzScheme
72    ocaml "Objective Caml" octave Octave perl5 Perl php "PHP 5" pike Pike
73    python Python r R ruby Ruby tcl Tcl}
74
75options         swig.lang
76default         swig.lang ""
77
78foreach lang [lsort [array names bindings]] {
79    set arg      [lindex $bindings($lang) 1]
80    set arg_name [lindex [split ${arg} =] 0]
81    subport swig-${lang} "
82        depends_lib-append      [lindex $bindings($lang) 0]
83        configure.args-append   --with-${arg}
84        destroot.args           lib-languages=\"${arg_name}\"
85        swig.lang               $arg_name
86    "
87    if {${swig.lang} != $arg_name} {
88        configure.args-append --without-${arg_name}
89    }
90}
91
92subport swig-php5 {
93    replaced_by swig-php
94    pre-configure {
95        ui_error "This port has been replaced by 'swig-php'."
96        return -code error
97    }
98    distfiles
99}
100
101subport swig-php {
102
103    patchfiles-append patch-configure.diff
104
105    variant php52 conflicts php53 php54 php55 php56 description {build using PHP 5.2} {
106        depends_lib-delete port:php55
107        depends_lib-append port:php52
108        configure.args-delete --with-php=${prefix}/bin/php55
109        configure.args-append --with-php=${prefix}/bin/php52
110    }
111    variant php53 conflicts php52 php54 php55 php56 description {build using PHP 5.3} {
112        depends_lib-delete port:php55
113        depends_lib-append port:php53
114        configure.args-delete --with-php=${prefix}/bin/php55
115        configure.args-append --with-php=${prefix}/bin/php53
116    }
117    variant php54 conflicts php52 php53 php55 php56 description {build using PHP 5.4} {
118        depends_lib-delete port:php55
119        depends_lib-append port:php54
120        configure.args-delete --with-php=${prefix}/bin/php55
121        configure.args-append --with-php=${prefix}/bin/php54
122    }
123    variant php55 conflicts php52 php53 php54 php56 description {build using PHP 5.5} {}
124
125    variant php56 conflicts php52 php53 php54 php55 description {build using PHP 5.6} {
126        depends_lib-delete port:php55
127        depends_lib-append port:php56
128        configure.args-delete --with-php=${prefix}/bin/php55
129        configure.args-append --with-php=${prefix}/bin/php56
130    }
131
132    if {![variant_isset php52] && ![variant_isset php53] && ![variant_isset php54] &&
133        ![variant_isset php55] && ![variant_isset php56]} {
134        default_variants +php55
135    }
136    if {![variant_isset php52] && ![variant_isset php53] && ![variant_isset php54] &&
137        ![variant_isset php55] && ![variant_isset php56]} {
138        ui_error "\n\nA +php5X variant must be selected; the variant '-php55' cannot be used alone.\n"
139        return -code error "Invalid variant selection"
140    }
141}
142
143subport swig-gcj {
144    variant gcc43 conflicts gcc44 gcc45 gcc47 gcc48 description {build using GCJ 4.3} {
145        depends_lib-delete port:gcc47
146        depends_lib-append port:gcc43
147        configure.args-delete --with-gcj=${prefix}/bin/gcj-mp-4.7 --with-gcjh=${prefix}/bin/gcjh-mp-4.7
148        configure.args-append --with-gcj=${prefix}/bin/gcj-mp-4.3 --with-gcjh=${prefix}/bin/gcjh-mp-4.3
149    }
150
151    variant gcc44 conflicts gcc43 gcc45 gcc47 gcc48 description {build using GCJ 4.4} {
152        depends_lib-delete port:gcc47
153        depends_lib-append port:gcc44
154        configure.args-delete --with-gcj=${prefix}/bin/gcj-mp-4.7 --with-gcjh=${prefix}/bin/gcjh-mp-4.7
155        configure.args-append --with-gcj=${prefix}/bin/gcj-mp-4.4 --with-gcjh=${prefix}/bin/gcjh-mp-4.4
156    }
157
158    variant gcc45 conflicts gcc43 gcc44 gcc47 gcc48 description {build using GCJ 4.5} {
159        depends_lib-delete port:gcc47
160        depends_lib-append port:gcc45
161        configure.args-delete --with-gcj=${prefix}/bin/gcj-mp-4.7 --with-gcjh=${prefix}/bin/gcjh-mp-4.7
162        configure.args-append --with-gcj=${prefix}/bin/gcj-mp-4.5 --with-gcjh=${prefix}/bin/gcjh-mp-4.5
163    }
164
165    # No +gcc46 because the gcc46 port does not build GCJ.
166
167    variant gcc48 conflicts gcc43 gcc44 gcc45 gcc47 description {build using GCJ 4.8} {
168        depends_lib-delete port:gcc47
169        depends_lib-append port:gcc48
170        configure.args-delete --with-gcj=${prefix}/bin/gcj-mp-4.7 --with-gcjh=${prefix}/bin/gcjh-mp-4.7
171        configure.args-append --with-gcj=${prefix}/bin/gcj-mp-4.8 --with-gcjh=${prefix}/bin/gcjh-mp-4.8
172    }
173
174    # Placeholder variant for the default.
175    variant gcc47 conflicts gcc43 gcc44 gcc45 gcc48 description {build using GCJ 4.7} {}
176
177    if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] &&
178        ![variant_isset gcc47] && ![variant_isset gcc48]} {
179        default_variants +gcc47
180    }
181    if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] &&
182        ![variant_isset gcc47] && ![variant_isset gcc48]} {
183        ui_error "\n\nA +gcc4X variant must be selected; the variant '-gcc47' cannot be used alone.\n"
184        return -code error "Invalid variant selection"
185    }
186}
187
188if {${swig.lang} == ""} {
189    depends_lib     port:pcre
190
191    set docdir      ${prefix}/share/doc/${name}-${version}
192   
193    destroot.args   lib-languages="typemaps"
194   
195    post-destroot {
196        xinstall -d ${destroot}${docdir}
197        xinstall -m 0644 -W ${worksrcpath} ANNOUNCE CHANGES LICENSE README \
198            TODO ${destroot}${docdir}
199    }
200   
201    variant doc description {Install extra documentation} {
202        post-destroot {
203            xinstall -d ${destroot}${docdir}/html
204            eval xinstall -m 0644 [glob ${worksrcpath}/Doc/Manual/*.{css,html,pdf,png}] \
205                ${destroot}${docdir}/html
206        }
207    }
208   
209    livecheck.type      regex
210    livecheck.url       http://www.swig.org/download.html
211    livecheck.regex     ${name}-(\\d+(?:\\.\\d+)*)
212} else {
213    description     $prettynames(${swig.lang}) binding for swig
214    long_description    \
215        SWIG is a software development tool that connects programs written in C \
216        and C++ with a variety of high-level programming languages. This is the \
217        $prettynames(${swig.lang}) binding.
218    depends_lib-append  port:swig
219    livecheck.type      none
220    post-destroot {
221        delete ${destroot}${prefix}/bin
222        delete ${destroot}${prefix}/share/man
223        foreach f [glob -directory ${destroot}${prefix}/share/swig/${version} *] {
224            if {[file tail $f] != ${swig.lang}} {
225                delete $f
226            }
227        }
228    }
229}
Note: See TracBrowser for help on using the repository browser.