Ticket #40315: Portfile

File Portfile, 17.3 KB (added by Veence (Vincent), 11 years ago)

Portfile with a +console option and some fix for Clang

Line 
1# $Id: Portfile 116079 2014-01-17 17:34:48Z mojca@macports.org $
2
3PortSystem        1.0
4PortGroup         wxWidgets 1.0
5PortGroup         active_variants 1.1
6
7name              grass
8epoch             1
9version           6.4.3
10revision          3
11maintainers       nomaintainer
12categories        gis
13license           GPL-2+
14platforms         darwin
15
16description       GRASS
17long_description  GRASS is a Geographic Information System (GIS) used for \
18                  geospatial data management and analysis.
19
20homepage          http://grass.osgeo.org/
21master_sites      ${homepage}grass[join [lrange [split ${version} .] 0 1] {}]/source/
22
23checksums         rmd160  bdbd671972730701aa8213c2041abe31a68eea4c \
24                  sha256  5d29d322a262330894aa046845e6790258cd6e3f95b28c350ed7839810672ed6
25
26depends_build     port:pkgconfig
27depends_lib       port:fftw-3 \
28                  port:freetype \
29                  port:gdal \
30                  port:geos \
31                  port:jpeg \
32                  port:libpng \
33                  port:mesa \
34                  lib:libXm:openmotif \
35                  port:proj47 \
36                  port:tk \
37                  path:lib/pkgconfig/cairo.pc:cairo \
38                  port:readline
39
40# https://trac.macports.org/ticket/32790
41# this should probably only apply to some Xcode versions
42#compiler.blacklist  *clang*
43
44patchfiles \
45    patch-configure.diff \
46    patch-gui-wxpython-core-globalvar.py.diff \
47    patch-gui-wxpython-gui_core-ghelp.py.diff \
48    patch-lib-init-grass.src.diff \
49    patch-macosx_Makefile.diff \
50    patch-Makefile.diff \
51    patch-ffmpeg.diff
52
53post-patch {
54    set rterra ${worksrcpath}/raster/r.terraflow
55    foreach file [glob ${rterra}/*.cc ${rterra}/*.h] {
56        reinplace -E "s/is_void/nodata_is_void/" $file
57    }
58}
59 
60# List of all python scripts. Used later to ensure usage of python26/python27
61# (insteaf of the currently active python)
62# Work around bug http://trac.osgeo.org/grass/ticket/1758
63set python_scripts [ list \
64    doc/python/m.distance.py \
65    doc/python/raster_example_ctypes.py \
66    doc/python/vector_example_ctypes.py \
67    general/g.parser/test.py \
68    gui/scripts/d.rast3d.py \
69    gui/scripts/g.change.gui.py \
70    gui/scripts/g.extension.py \
71    gui/scripts/g.extension.rebuild.all.py \
72    gui/scripts/v.type_wrapper.py \
73    gui/wxpython/compat/__init__.py \
74    gui/wxpython/compat/subprocess.py \
75    gui/wxpython/core/debug.py \
76    gui/wxpython/core/gcmd.py \
77    gui/wxpython/core/globalvar.py \
78    gui/wxpython/core/menudata.py \
79    gui/wxpython/core/render.py \
80    gui/wxpython/core/settings.py \
81    gui/wxpython/core/units.py \
82    gui/wxpython/core/utils.py \
83    gui/wxpython/core/workspace.py \
84    gui/wxpython/create__init__.py \
85    gui/wxpython/dbmgr/dialogs.py \
86    gui/wxpython/dbmgr/manager.py \
87    gui/wxpython/dbmgr/sqlbuilder.py \
88    gui/wxpython/dbmgr/vinfo.py \
89    gui/wxpython/gcp/manager.py \
90    gui/wxpython/gcp/mapdisplay.py \
91    gui/wxpython/gcp/toolbars.py \
92    gui/wxpython/gis_set.py \
93    gui/wxpython/gmodeler/dialogs.py \
94    gui/wxpython/gmodeler/frame.py \
95    gui/wxpython/gmodeler/menudata.py \
96    gui/wxpython/gmodeler/model.py \
97    gui/wxpython/gmodeler/preferences.py \
98    gui/wxpython/gmodeler/toolbars.py \
99    gui/wxpython/gui_core/dialogs.py \
100    gui/wxpython/gui_core/forms.py \
101    gui/wxpython/gui_core/ghelp.py \
102    gui/wxpython/gui_core/goutput.py \
103    gui/wxpython/gui_core/gselect.py \
104    gui/wxpython/gui_core/mapdisp.py \
105    gui/wxpython/gui_core/mapwindow.py \
106    gui/wxpython/gui_core/menu.py \
107    gui/wxpython/gui_core/preferences.py \
108    gui/wxpython/gui_core/prompt.py \
109    gui/wxpython/gui_core/toolbars.py \
110    gui/wxpython/gui_core/widgets.py \
111    gui/wxpython/icons/__init__.py \
112    gui/wxpython/icons/grass2_icons.py \
113    gui/wxpython/icons/grass_icons.py \
114    gui/wxpython/icons/icon.py \
115    gui/wxpython/icons/silk_icons.py \
116    gui/wxpython/lmgr/frame.py \
117    gui/wxpython/lmgr/layertree.py \
118    gui/wxpython/lmgr/menudata.py \
119    gui/wxpython/lmgr/pyshell.py \
120    gui/wxpython/lmgr/toolbars.py \
121    gui/wxpython/location_wizard/base.py \
122    gui/wxpython/location_wizard/dialogs.py \
123    gui/wxpython/location_wizard/wizard.py \
124    gui/wxpython/mapdisp/frame.py \
125    gui/wxpython/mapdisp/gprint.py \
126    gui/wxpython/mapdisp/main.py \
127    gui/wxpython/mapdisp/mapwindow.py \
128    gui/wxpython/mapdisp/overlays.py \
129    gui/wxpython/mapdisp/statusbar.py \
130    gui/wxpython/mapdisp/toolbars.py \
131    gui/wxpython/modules/colorrules.py \
132    gui/wxpython/modules/extensions.py \
133    gui/wxpython/modules/histogram.py \
134    gui/wxpython/modules/mcalc_builder.py \
135    gui/wxpython/modules/ogc_services.py \
136    gui/wxpython/modules/vclean.py \
137    gui/wxpython/nviz/animation.py \
138    gui/wxpython/nviz/main.py \
139    gui/wxpython/nviz/mapwindow.py \
140    gui/wxpython/nviz/preferences.py \
141    gui/wxpython/nviz/tools.py \
142    gui/wxpython/nviz/workspace.py \
143    gui/wxpython/nviz/wxnviz.py \
144    gui/wxpython/psmap/dialogs.py \
145    gui/wxpython/psmap/frame.py \
146    gui/wxpython/psmap/instructions.py \
147    gui/wxpython/psmap/menudata.py \
148    gui/wxpython/psmap/toolbars.py \
149    gui/wxpython/psmap/utils.py \
150    gui/wxpython/scripts/p.cmd.py \
151    gui/wxpython/scripts/p.db.py \
152    gui/wxpython/scripts/p.mon.py \
153    gui/wxpython/scripts/p.rast.py \
154    gui/wxpython/scripts/p.vect.py \
155    gui/wxpython/scripts/vkrige.py \
156    gui/wxpython/tools/update_menudata.py \
157    gui/wxpython/vdigit/dialogs.py \
158    gui/wxpython/vdigit/main.py \
159    gui/wxpython/vdigit/mapwindow.py \
160    gui/wxpython/vdigit/preferences.py \
161    gui/wxpython/vdigit/toolbars.py \
162    gui/wxpython/vdigit/wxdigit.py \
163    gui/wxpython/vdigit/wxdisplay.py \
164    gui/wxpython/wxgui.py \
165    gui/wxpython/wxplot/base.py \
166    gui/wxpython/wxplot/dialogs.py \
167    gui/wxpython/wxplot/profile.py \
168    imagery/i.atcorr/create_iwave.py \
169    lib/python/__init__.py \
170    lib/python/array.py \
171    lib/python/core.py \
172    lib/python/ctypes/__init__.py \
173    lib/python/ctypes/ctypesgen.py \
174    lib/python/ctypes/ctypesgencore/__init__.py \
175    lib/python/ctypes/ctypesgencore/ctypedescs.py \
176    lib/python/ctypes/ctypesgencore/descriptions.py \
177    lib/python/ctypes/ctypesgencore/expressions.py \
178    lib/python/ctypes/ctypesgencore/libraryloader.py \
179    lib/python/ctypes/ctypesgencore/messages.py \
180    lib/python/ctypes/ctypesgencore/options.py \
181    lib/python/ctypes/ctypesgencore/parser/__init__.py \
182    lib/python/ctypes/ctypesgencore/parser/cdeclarations.py \
183    lib/python/ctypes/ctypesgencore/parser/cgrammar.py \
184    lib/python/ctypes/ctypesgencore/parser/cparser.py \
185    lib/python/ctypes/ctypesgencore/parser/ctypesparser.py \
186    lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py \
187    lib/python/ctypes/ctypesgencore/parser/lex.py \
188    lib/python/ctypes/ctypesgencore/parser/lextab.py \
189    lib/python/ctypes/ctypesgencore/parser/parsetab.py \
190    lib/python/ctypes/ctypesgencore/parser/pplexer.py \
191    lib/python/ctypes/ctypesgencore/parser/preprocessor.py \
192    lib/python/ctypes/ctypesgencore/parser/yacc.py \
193    lib/python/ctypes/ctypesgencore/printer/__init__.py \
194    lib/python/ctypes/ctypesgencore/printer/defaultheader.py \
195    lib/python/ctypes/ctypesgencore/printer/preamble.py \
196    lib/python/ctypes/ctypesgencore/printer/printer.py \
197    lib/python/ctypes/ctypesgencore/printer/test.py \
198    lib/python/ctypes/ctypesgencore/processor/__init__.py \
199    lib/python/ctypes/ctypesgencore/processor/dependencies.py \
200    lib/python/ctypes/ctypesgencore/processor/operations.py \
201    lib/python/ctypes/ctypesgencore/processor/pipeline.py \
202    lib/python/ctypes/loader.py \
203    lib/python/ctypes/preamble.py \
204    lib/python/db.py \
205    lib/python/grass__init__.py \
206    lib/python/raster.py \
207    lib/python/task.py \
208    lib/python/vector.py ]
209
210configure.ldflags-append -framework OpenGL -framework Accelerate
211configure.args \
212    --with-fftw-includes=${prefix}/include \
213    --with-fftw-libs=${prefix}/lib \
214    --with-freetype \
215    --with-freetype-includes=${prefix}/include/freetype2 \
216    --with-freetype-libs=${prefix}/lib \
217    --with-gdal=${prefix}/bin/gdal-config \
218    --with-jpeg-includes=${prefix}/include \
219    --with-jpeg-libs=${prefix}/lib \
220    --with-motif \
221    --with-motif-includes=${prefix}/include \
222    --with-motif-libs=${prefix}/lib \
223    --with-png-includes=${prefix}/include \
224    --with-png-libs=${prefix}/lib \
225    --with-proj-includes=${prefix}/lib/proj47/include \
226    --with-proj-libs=${prefix}/lib/proj47/lib \
227    --with-proj-share=${prefix}/lib/proj47/share/proj \
228    --with-tcltk-includes=${prefix}/include \
229    --with-tcltk-libs=${prefix}/lib \
230    --with-cxx \
231    --with-x \
232    --without-postgres \
233    --enable-largefile \
234    --with-cairo \
235    --with-cairo-includes=${prefix}/include/cairo \
236    --with-cairo-libs=${prefix}/lib \
237    --with-blas \
238    --with-lapack \
239    --with-readline \
240    --with-readline-includes=${prefix}/include/readline \
241    --with-readline-libs=${prefix}/lib \
242    --with-regex-includes=/usr/include \
243    --with-regex-lib=/usr/lib
244
245build.target        default
246
247variant mysql5 description {Add MySQL 5 support} {
248    depends_lib-append    path:bin/mysql_config5:mysql5
249    configure.args-append --with-mysql
250    configure.args-append --with-mysql-includes=${prefix}/include/mysql5/mysql
251    configure.args-append --with-mysql-libs=${prefix}/lib/mysql5/mysql
252    configure.env-append  MYSQLD_CONFIG=${prefix}/lib/mysql5/bin/mysql_config
253}
254
255variant postgresql83 conflicts postgresql84 postgresql90 postgresql91 postgresql92 postgresql93 description {Add PostgreSQL 8.3 support} {
256    depends_lib-append    port:postgresql83
257    configure.args-delete --without-postgres
258    configure.args-append --with-postgres
259    configure.args-append --with-postgres-includes=${prefix}/include/postgresql83
260    configure.args-append --with-postgres-libs=${prefix}/lib/postgresql83
261}
262
263variant postgresql84 conflicts postgresql83 postgresql90 postgresql91 postgresql92 postgresql93 description {Add PostgreSQL 8.4 support} {
264    depends_lib-append    port:postgresql84
265    configure.args-delete --without-postgres
266    configure.args-append --with-postgres
267    configure.args-append --with-postgres-includes=${prefix}/include/postgresql84
268    configure.args-append --with-postgres-libs=${prefix}/lib/postgresql84
269}
270
271variant postgresql90 conflicts postgresql83 postgresql84 postgresql91 postgresql92 postgresql93 description {Add PostgreSQL 9.0 support} {
272    depends_lib-append    port:postgresql90
273    configure.args-delete --without-postgres
274    configure.args-append --with-postgres
275    configure.args-append --with-postgres-includes=${prefix}/include/postgresql90
276    configure.args-append --with-postgres-libs=${prefix}/lib/postgresql90
277}
278
279variant postgresql91 conflicts postgresql83 postgresql84 postgresql90 postgresql92 postgresql93 description {Add PostgreSQL 9.1 support} {
280    depends_lib-append    port:postgresql91
281    configure.args-delete --without-postgres
282    configure.args-append --with-postgres
283    configure.args-append --with-postgres-includes=${prefix}/include/postgresql91
284    configure.args-append --with-postgres-libs=${prefix}/lib/postgresql91
285}
286
287variant postgresql92 conflicts postgresql83 postgresql84 postgresql90 postgresql91 postgresql93 description {Add PostgreSQL 9.2 support} {
288    depends_lib-append    port:postgresql92
289    configure.args-delete --without-postgres
290    configure.args-append --with-postgres
291    configure.args-append --with-postgres-includes=${prefix}/include/postgresql92
292    configure.args-append --with-postgres-libs=${prefix}/lib/postgresql92
293}
294
295variant postgresql93 conflicts postgresql83 postgresql84 postgresql90 postgresql91 postgresql92 description {Add PostgreSQL 9.3 support} {
296    depends_lib-append    port:postgresql93
297    configure.args-delete --without-postgres
298    configure.args-append --with-postgres
299    configure.args-append --with-postgres-includes=${prefix}/include/postgresql93
300    configure.args-append --with-postgres-libs=${prefix}/lib/postgresql93
301}
302
303variant sqlite3 description {Add SQLite 3 support} {
304    depends_lib-append    port:sqlite3
305    configure.args-append --with-sqlite
306    configure.args-append --with-sqlite-includes=${prefix}/include
307    configure.args-append --with-sqlite-libs=${prefix}/lib
308}
309
310variant ffmpeg description {Add ffmpeg support} {
311    depends_lib-append    path:lib/libavcodec.dylib:ffmpeg
312    configure.args-append --with-ffmpeg \
313                          --with-ffmpeg-includes=\"${prefix}/include/libavcodec  \
314                                                   ${prefix}/include/libavformat \
315                                                   ${prefix}/include/libswscale\" \
316                          --with-ffmpeglibs=${prefix}/lib
317}
318
319# python26 variant is only present to allow 'grass +wxgtk28' to coexist with py27-wxpython-3.0
320# once support for wxWidgets 3.0 is complete, support for Python 2.6 may be removed
321variant python26 conflicts python27 description {} {
322    depends_lib-append    port:python26
323    set python_bin        ${frameworks_dir}/Python.framework/Versions/2.6/bin/python2.6
324    #                     Enable support for wxGUI Python extensions
325    #                     (by removing this we wouldn't need to depend on py-wxpython-x.y)
326    configure.args-append --with-python=${frameworks_dir}/Python.framework/Versions/2.6/bin/python2.6-config
327    build.args-append     PYTHON=${python_bin}
328    # TODO: this port doesn't work with the python portgroup because the group changes too much
329    # but it would make sense to fix this in such a way that python_bin could be determined automatically
330
331    post-patch {
332        # for some reason it fails if python_bin is not defined inside post-patch (figure out why)
333        set python_bin ${frameworks_dir}/Python.framework/Versions/2.6/bin/python2.6
334        reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|" ${worksrcpath}/configure
335        reinplace "s|@@PYTHON@@|${python_bin}|" ${worksrcpath}/lib/init/grass.src
336        foreach f $python_scripts {
337            reinplace "s|/usr/bin/env python|${python_bin}|" $f
338        }
339    }
340}
341
342variant python27 conflicts python26 description {} {
343    depends_lib-append    port:python27
344    set python_bin        ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
345    configure.args-append --with-python=${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7-config
346    build.args-append     PYTHON=${python_bin}
347
348    post-patch {
349        set python_bin ${frameworks_dir}/Python.framework/Versions/2.7/bin/python2.7
350        reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|" ${worksrcpath}/configure
351        reinplace "s|@@PYTHON@@|${python_bin}|" ${worksrcpath}/lib/init/grass.src
352        foreach f $python_scripts {
353            reinplace "s|/usr/bin/env python|${python_bin}|" $f
354        }
355    }
356}
357
358variant console conflicts wxwidgets30 wxgtk28 python27 python26 description {Buils command mode only} {
359
360    configure.args-delete   --with-motif \
361                            --with-motif-includes=${prefix}/include \
362                            --with-motif-libs=${prefix}/lib
363    configure.args-delete   --with-tcltk-includes=${prefix}/include \
364                            --with-tcltk-libs=${prefix}/lib
365    depends_lib-delete      port:mesa \
366                            lib:libXm:openmotif \
367                            port:tk
368
369    configure.args-append   --without-motif \
370                            --without-tcltk \
371                            --without-wxwidgets \
372                            --without-python \
373                            --without-opengl
374
375    post-patch {
376        reinplace -E "s/gui//" ${worksrcpath}/Makefile
377    }
378}
379
380# TODO: in principle wxWidgets is optional and could be disable with
381#       --disable-wxwidgets if there is demand for that
382#       grass 4.6.3 is not compatible with wxWidgets 3.0 yet
383variant wxwidgets30 conflicts wxgtk28 description {Use Cocoa-based wxWidgets 3.0 (experimental)} {
384    wxWidgets.use         wxPython-3.0
385    depends_lib-append    port:${wxWidgets.port}
386    configure.args-append --with-wxwidgets=${wxWidgets.wxconfig}
387}
388variant wxgtk28 conflicts wxwidgets30 description {Use GTK-based wxWidgets 2.8} {
389    wxWidgets.use         wxGTK-2.8
390    depends_lib-append    port:${wxWidgets.port}
391    configure.args-append --with-wxwidgets=${wxWidgets.wxconfig}
392}
393
394
395
396#if {![variant_isset wxwidgets30] && ![variant_isset wxgtk28]} {
397#    default_variants-append +wxgtk28
398#}
399
400if {![variant_isset python26] && ![variant_isset python27] && ![variant_isset console]} {
401    if {[variant_isset wxgtk28]} {
402        default_variants-append +python26
403    } else {
404        default_variants-append +python27
405    }
406}
407
408# TODO: if py27-wxpython-3.0 is installed, grass +wxgtk28 cannot be installed with +python27
409#       we could remove this by disabling wxpython support altogether
410#       (in case there is demand for it)
411if {[variant_isset wxgtk28]} {
412    if {[variant_isset python26]} {
413        depends_lib-append port:py26-wxpython-2.8
414        require_active_variants py26-wxpython-2.8 gtk carbon
415    } elseif {[variant_isset python27]} {
416        depends_lib-append port:py27-wxpython-2.8
417        require_active_variants py27-wxpython-2.8 gtk carbon
418    }
419} elseif {[variant_isset wxwidgets30]} {
420    if {[variant_isset python26]} {
421        depends_lib-append port:py26-wxpython-3.0
422    } elseif {[variant_isset python27]} {
423        depends_lib-append port:py27-wxpython-3.0
424    }
425}
426
427livecheck.type      regex
428livecheck.url       http://grass.osgeo.org/download/software/sources/
429livecheck.regex     grass-(\[0-9.\]+)${extract.suffix}