Ticket #51149: Portfile

File Portfile, 7.0 KB (added by aaschwanden (Andy Aschwanden), 8 years ago)
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 146464 2016-03-09 09:58:53Z vince@macports.org $
3
4PortSystem          1.0
5PortGroup           cmake   1.0
6
7name                qgis
8version             2.14.1
9categories          gis
10maintainers         vince
11description         QGIS is a user-friendly GIS based on Qt 4
12long_description    QGIS is a GIS. It can visualize, inject data into\
13                    PostGres/PostGIS, or serve as a Qt front-end to\
14                    Grass. Extended with Python plugins, it can become\
15                    a quite powerful GIS on its own.
16
17platforms           darwin
18license             GPL
19
20use_parallel_build  no
21homepage            http://www.qgis.org/
22
23distname            ${name}-${version}
24master_sites        http://qgis.org/downloads/
25use_bzip2           yes
26
27checksums           rmd160  23e7ab26210319d3708e7c27d92d76e116a4df6e \
28                    sha256  52b5128911666faf9ef913bd22e777d308489fef52f8cb8868be51b609a0418a
29
30patchfiles          patch-app_info_plist_in.diff \
31                    patch-PyQtMacros.diff \
32                    patch-sip.diff
33
34worksrcdir          ${name}-${version}
35
36depends_lib-append  port:libiconv \
37                    port:expat \
38                    path:lib/libssl.dylib:openssl \
39                    port:proj \
40                    port:geos \
41                    port:gdal \
42                    port:sqlite3 \
43                    port:gsl \
44                    port:fcgi \
45                    port:spatialindex \
46                    port:postgis2 \
47                    port:python27 \
48                    port:py27-gdal \
49                    port:qca \
50                    port:qca-ossl
51
52depends_build-append \
53                    port:bison \
54                    port:ld64 \
55                    port:py27-sip
56
57depends_run-append  port:py27-psycopg2 \
58                    port:py27-spatialite
59
60post-extract {
61    system -W ${worksrcpath} "mkdir build"
62}
63
64
65post-patch {
66    reinplace -E "s|@@@|${prefix}|g" \
67        ${worksrcpath}/mac/app.info.plist.in
68#    reinplace -E "s|Clang|AppleClang|" ${worksrcpath}/CMakeLists.txt
69    # Handle legacy OS/XCode
70    if {[vercmp $xcodeversion 4.6.3] <= 0} {
71        configure.compiler  llvm-gcc-4.2
72    }
73}
74
75# Overrides default
76
77
78if {![variant_isset qt4] && ![variant_isset qt5]} {
79
80    default_variants    +qt4
81}
82
83# Python related stuff
84
85set Py_FRM              ${frameworks_dir}/Python.framework/Versions/2.7
86
87configure.args-append  "-DPYTHON_EXECUTABLE=${prefix}/bin/python2.7"
88configure.args-append  "-DWITH_GRASS=OFF"
89configure.args-append  "-DWITH_GRASS7=OFF"
90configure.args-append  "-DWITH_QWTPOLAR=FALSE"
91configure.args-append  "-DGIT_MARKER=NOTFOUND"
92#configure.args-append  "-DPYUIC_PROGRAM=${prefix}/bin/pyuic4-2.7"
93#configure.args-append  "-DPYRCC_PROGRAM=${prefix}/bin/pyuic4-2.7"
94
95pre-configure {
96    reinplace -E "s|Versions/Current|Versions/2.7|" \
97        ${worksrcpath}/cmake/FindPythonLibrary.cmake
98}
99
100variant qt5 conflicts qt4 description "Build with Qt5" {
101    PortGroup               qt5     1.0
102    #patchfiles-append       patch-CMakeLists_txt.diff
103    #post-patch {
104    #    reinplace           "s|ZZZ|${prefix}|" ${worksrcpath}/CMakeLists.txt
105    #}
106
107    configure.ldflags       "-Wl,-rpath,${prefix}/libexec/qt5/lib"
108    configure.args-append   "-DENABLE_QT5=ON"
109    configure.args-append   "-DWITH_BINDINGS=FALSE"
110    configure.args-append   "-DQCA_INCLUDE_DIR=${prefix}/lib/qca.framework/Headers"
111    configure.args-append   "-DQCA_LIBRARY=${prefix}/lib/qca.framework/qca"
112    configure.args-append   "-DQSCINTILLA_INCLUDE_DIR=${prefix}/libexec/qt5/include"
113    configure.args-append   "-DQSCINTILLA_LIBRARY=${prefix}/libexec/qt5/lib/libqscintilla2.dylib"
114    configure.args-append   "-DQWT_LIBRARY=${prefix}/libexec/qt5/lib/libqwt.dylib"
115
116    depends_lib-append      port:py27-pyqt5 \
117                            port:qt5-qtscript
118
119}
120
121variant qt4 conflicts qt5 description "Build with Qt4" {
122    PortGroup               qt4     1.0
123
124    configure.args-append   "-DENABLE_QT5=OFF"
125    configure.args-append   "-DPYTHON_CUSTOM_FRAMEWORK=${Py_FRM}"
126    configure.args-append   "-DSIP_BINARY_PATH=${prefix}/bin/sip-2.7"
127    configure.args-append   "-DPYUIC4_PROGRAM=${prefix}/bin/pyuic4-2.7"
128    configure.args-append   "-DPYRCC4_PROGRAM=${prefix}/bin/pyrcc4-2.7"
129    configure.args-append   "-DWITH_SERVER=TRUE"
130    configure.args-append   "-DWITH_SERVER_PLUGINS=TRUE"
131
132    depends_lib-append      port:py27-pyqt4 \
133                            port:py27-qscintilla \
134                            port:qwt61
135}
136
137# Database variants (from the GDAL port)
138set postgresql_suffixes {93 94 95}
139
140set portsgresql_variants {}
141foreach s ${postgresql_suffixes} {
142    lappend portsgresql_variants postgresql${s}
143}
144
145foreach s ${postgresql_suffixes} {
146    set p postgresql${s}
147    set v [string index ${s} 0].[string index ${s} 1]
148    set i [lsearch -exact ${portsgresql_variants} ${p}]
149    set c [lreplace ${portsgresql_variants} ${i} ${i}]
150    eval [subst {
151        variant ${p} description "Enable PostgreSQL ${v} support" conflicts ${c} {
152            depends_lib-append      port:${p}
153            configure.args-append   \
154                    "-DPOSTGRES_CONFIG=${prefix}/lib/${p}/bin/pg_config"
155        }
156    }]
157}
158
159# postgresql default
160set pgd "if {"
161foreach s ${postgresql_suffixes} {
162    set pgd "${pgd}!\[variant_isset postgresql${s}\] && "
163}
164set pgd [string range ${pgd} 0 end-4]
165set pgd "${pgd}} { default_variants +postgresql94 }"
166eval ${pgd}
167
168variant grass               description "Build Grass 7 plugin" {
169
170    #depends_lib-append      port:grass
171    configure.args-delete  "-DWITH_GRASS7=OFF"
172    configure.args-append  "-DWITH_GRASS7=ON"
173    configure.args-append   \
174                "-DGRASS_PREFIX7=${prefix}/share/grass-7.0.2"
175}
176
177configure.dir               ${worksrcpath}/build
178configure.cmd               cmake ..
179
180configure.args-append  "-DCMAKE_CXX_COMPILER=${configure.cxx}"
181configure.args-append  "-DCMAKE_C_COMPILER=${configure.cc}"
182configure.args-append  "-DEXPAT_INCLUDE_DIR=${prefix}/include"
183configure.args-append  "-DEXPAT_LIBRARY=${prefix}/lib/libexpat.dylib"
184configure.args-append  "-DCMAKE_INSTALL_PREFIX=${applications_dir}"
185configure.args-append  "-DQGIS_MACAPP_BUNDLE=0"
186configure.args-append  "-DGDAL_CONFIG=${prefix}/bin/gdal-config"
187configure.args-append  "-DGDAL_INCLUDE_DIR=${prefix}/include"
188configure.args-append  "-DGDAL_LIBRARY=${prefix}/lib/libgdal.dylib"
189configure.args-append  "-DGEOS_CONFIG=${prefix}/bin/geos-config"
190configure.args-append  "-DGEOS_INCLUDE_DIR=${prefix}/include"
191configure.args-append  "-DGEOS_LIBRARY=${prefix}/lib/libgeos_c.dylib"
192configure.args-append  "-DGSL_CONFIG=${prefix}/bin/gsl-config"
193configure.args-append  "-DPROJ_INCLUDE_DIR=${prefix}/include"
194configure.args-append  "-DPROJ_LIBRARY=${prefix}/lib/libproj.dylib"
195configure.args-append  \
196        "-DSPATIALINDEX_LIBRARY=${prefix}/lib/libspatialindex.dylib"
197configure.args-append  "-DCMAKE_BUILD_TYPE=Release"
198
199use_parallel_build          yes
200build.dir                   ${worksrcpath}/build
201destroot.target             install