Ticket #53231: qgis_Portfile

File qgis_Portfile, 6.8 KB (added by michaelld (Michael Dickens), 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
3PortSystem          1.0
4PortGroup           cmake   1.0
5PortGroup           qt5     1.0
6PortGroup           github  1.0
7
8name                QGIS
9categories          gis
10maintainers         vince
11description         QGIS is a user-friendly GIS based on Qt 5.
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
20subport ${name}-devel {}
21
22if {${subport} eq ${name}} {
23
24    version             2.18.5
25    set version_u       [string map {. _} ${version}]
26    github.setup        qgis QGIS ${version_u} final-
27
28    checksums           rmd160 50e9d6b126192eabbacc208cba29569de1ec5534 \
29                        sha256 d76416adbe698907b2a5af703ec8d686dbaacc252a7497b1958d3327ec5fc187
30
31    conflicts           ${name}-devel
32
33} else {
34
35    github.setup        qgis QGIS 6f9f087c3d6a2ce475a7a5b35d57e13a086abadf
36    version             20170402
37    checksums           rmd160 6debc3de04a74bba3c4dd0fc84bd0a9f9c5e4c6a \
38                        sha256 b8cc91897154da7ef394c63e81f70f6553ab641d57288d67edc60905e9edeacf
39
40    conflicts           ${name}
41
42}
43
44homepage            http://www.qgis.org/
45
46# do VPATH (out of source tree) build
47
48cmake.out_of_source yes
49
50patchfiles          patch-app_info_plist_in.diff
51
52depends_lib-append  port:libiconv \
53                    port:expat \
54                    path:lib/libssl.dylib:openssl \
55                    port:proj \
56                    port:geos \
57                    port:gdal \
58                    port:sqlite3 \
59                    port:gsl \
60                    port:fcgi \
61                    port:spatialindex \
62                    port:postgis2 \
63                    port:python36 \
64                    port:py36-gdal \
65                    port:qjson
66
67depends_lib-append  port:py36-pyqt5 \
68                    port:qt5-qtscript \
69                    port:qt5-sqlite-plugin \
70                    port:qca-qt5 \
71                    port:qca-qt5-ossl \
72                    port:py36-qscintilla2 \
73                    port:qwt61
74
75depends_build-append \
76                    port:bison \
77                    port:ld64 \
78                    port:py36-sip
79
80depends_run-append  port:py36-psycopg2 \
81                    port:py36-requests
82
83post-patch {
84    reinplace -E "s|@@@|${prefix}|g" \
85        ${worksrcpath}/mac/app.info.plist.in
86#    reinplace -E "s|Clang|AppleClang|" ${worksrcpath}/CMakeLists.txt
87    # Handle legacy OS/XCode
88    if {[vercmp $xcodeversion 4.6.3] <= 0} {
89        configure.compiler  llvm-gcc-4.2
90    }
91
92    if {[variant_isset grass]} {
93        # grass70 -> grass72 in hardcoded files
94        set files_to_patch [list \
95            ${worksrcpath}/python/plugins/processing/algs/grass7/Grass7Algorithm.py \
96            ${worksrcpath}/python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py \
97            ${worksrcpath}/python/plugins/processing/algs/grass7/Grass7Utils.py]
98       
99        foreach filename ${files_to_patch} {
100            reinplace "s#grass70#grass72#" ${filename}
101        }
102    }
103
104}
105
106# Python related stuff
107
108set Py_FRM              ${frameworks_dir}/Python.framework/Versions/3.6
109
110configure.args-append  "-DPYTHON_EXECUTABLE=${prefix}/bin/python3.6"
111configure.args-append  "-DWITH_GRASS=OFF"
112configure.args-append  "-DWITH_GRASS7=OFF"
113configure.args-append  "-DWITH_QWTPOLAR=FALSE"
114configure.args-append  "-DGIT_MARKER=NOTFOUND"
115configure.args-append  "-DENABLE_TEST=NO"
116#configure.args-append  "--trace"
117configure.args-append  "-DPYUIC_PROGRAM=${prefix}/bin/pyuic5-3.6"
118configure.args-append  "-DPYRCC_PROGRAM=${prefix}/bin/pyrcc5-3.6"
119
120pre-configure {
121    reinplace -E "s|Versions/Current|Versions/3.6|" \
122        ${worksrcpath}/cmake/FindPythonLibrary.cmake
123}
124
125#QT5 stuff
126
127configure.ldflags       "-Wl,-rpath,${prefix}/libexec/qt5/lib"
128configure.args-append   "-DENABLE_QT5=ON"
129configure.args-append   "-DWITH_BINDINGS=ON"
130configure.args-append   "-DQCA_INCLUDE_DIR=${prefix}/libexec/qt5/include/QtCrypto"
131configure.args-append   "-DQCA_LIBRARY=${prefix}/libexec/qt5/lib/libqca-qt5.dylib"
132configure.args-append   "-DQSCINTILLA_INCLUDE_DIR=${prefix}/libexec/qt5/include"
133configure.args-append   "-DQSCINTILLA_LIBRARY=${prefix}/libexec/qt5/lib/libqscintilla2_qt5.dylib"
134configure.args-append   "-DQWT_LIBRARY=${prefix}/libexec/qt5/lib/libqwt.dylib"
135configure.args-append   "-DQWT_INCLUDE_DIR=${prefix}/libexec/qt5/include/qwt"
136configure.args-append   "-DQT_LRELEASE_EXECUTABLE=${prefix}/libexec/qt5/bin/lrelease"
137
138# Database variants (from the GDAL port)
139set postgresql_suffixes {94 95 96}
140
141set portsgresql_variants {}
142foreach s ${postgresql_suffixes} {
143    lappend portsgresql_variants postgresql${s}
144}
145
146foreach s ${postgresql_suffixes} {
147    set p postgresql${s}
148    set v [string index ${s} 0].[string index ${s} 1]
149    set i [lsearch -exact ${portsgresql_variants} ${p}]
150    set c [lreplace ${portsgresql_variants} ${i} ${i}]
151    eval [subst {
152        variant ${p} description "Enable PostgreSQL ${v} support" conflicts ${c} {
153            depends_lib-append      port:${p}
154            configure.args-append   \
155                    "-DPOSTGRES_CONFIG=${prefix}/lib/${p}/bin/pg_config"
156        }
157    }]
158}
159
160# postgresql default
161set pgd "if {"
162foreach s ${postgresql_suffixes} {
163    set pgd "${pgd}!\[variant_isset postgresql${s}\] && "
164}
165set pgd [string range ${pgd} 0 end-4]
166set pgd "${pgd}} { default_variants +postgresql96 }"
167eval ${pgd}
168
169variant grass description "Build Grass 7 plugin" {
170
171    depends_lib-append      port:grass7
172    configure.args-delete  "-DWITH_GRASS7=OFF"
173    configure.args-append  "-DWITH_GRASS7=ON"
174    configure.args-append   \
175                "-DGRASS_PREFIX7=${prefix}/share/grass-7.2.0"
176}
177
178configure.args-append  "-DEXPAT_INCLUDE_DIR=${prefix}/include"
179configure.args-append  "-DEXPAT_LIBRARY=${prefix}/lib/libexpat.dylib"
180configure.args-append  "-DCMAKE_INSTALL_PREFIX=${applications_dir}"
181configure.args-append  "-DQGIS_MACAPP_BUNDLE=0"
182configure.args-append  "-DGDAL_CONFIG=${prefix}/bin/gdal-config"
183configure.args-append  "-DGDAL_INCLUDE_DIR=${prefix}/include"
184configure.args-append  "-DGDAL_LIBRARY=${prefix}/lib/libgdal.dylib"
185configure.args-append  "-DGEOS_CONFIG=${prefix}/bin/geos-config"
186configure.args-append  "-DGEOS_INCLUDE_DIR=${prefix}/include"
187configure.args-append  "-DGEOS_LIBRARY=${prefix}/lib/libgeos_c.dylib"
188configure.args-append  "-DGSL_CONFIG=${prefix}/bin/gsl-config"
189configure.args-append  "-DPROJ_INCLUDE_DIR=${prefix}/include"
190configure.args-append  "-DPROJ_LIBRARY=${prefix}/lib/libproj.dylib"
191configure.args-append  \
192        "-DSPATIALINDEX_LIBRARY=${prefix}/lib/libspatialindex.dylib"