source: trunk/dports/devel/swig/Portfile

Last change on this file was 153959, checked in by michaelld@…, 9 months ago

swig-ruby: initial attempt to add variants for selecting ruby version; addresses ticket #52600.

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