Ticket #51619: qt5-1.0.tcl

File qt5-1.0.tcl, 16.4 KB (added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), 7 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#
3# Copyright (c) 2014-2016 The MacPorts Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met:
9#
10# 1. Redistributions of source code must retain the above copyright
11#    notice, this list of conditions and the following disclaimer.
12# 2. Redistributions in binary form must reproduce the above copyright
13#    notice, this list of conditions and the following disclaimer in the
14#    documentation and/or other materials provided with the distribution.
15# 3. Neither the name of Apple Computer, Inc. nor the names of its
16#    contributors may be used to endorse or promote products derived from
17#    this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30#
31#
32# This portgroup defines standard settings when using Qt5.
33#
34# Usage:
35# PortGroup     qt5 1.0
36
37global available_qt_versions
38set available_qt_versions {
39    qt5
40    qt56
41    qt55
42    qt5-kde
43}
44
45# standard Qt5 name
46global qt_name
47
48# default to kde?
49global qt5.using_kde
50
51proc qt5.get_default_name {} {
52    global qt5.using_kde os.major cxx_stdlib
53
54    if { ![tbool qt5.using_kde] } {
55
56        if { ${os.major} <= 7 } {
57            #
58            # Qt 5 does not support ppc
59            # see http://doc.qt.io/qt-5/osx-requirements.html
60            #
61            return qt55
62            #
63        } elseif { ${os.major} <= 9 } {
64            #
65            # Mac OS X Tiger (10.4)
66            # Mac OS X Leopard (10.5)
67            #
68            # never supported by Qt 5
69            #
70            return qt55
71            #
72        } elseif { ${os.major} == 10 } {
73            #
74            # Mac OS X Snow Leopard (10.6)
75            #
76            #     Qt 5.3: Deployment only
77            # Qt 5.0-5.2: Occasionally tested
78            #
79            return qt55
80            #
81        } elseif { ${os.major} == 11 } {
82            #
83            # Mac OS X Lion (10.7)
84            #
85            # Qt 5.6: Deployment only
86            # Qt 5.5: Occasionally tested
87            # Qt 5.4: Supported
88            #
89            return qt56
90            #
91        } elseif { ${os.major} <= 15 } {
92            #
93            # OS X Mountain Lion (10.8)
94            # OS X Mavericks (10.9)
95            # OS X Yosemite (10.10)
96            # OS X El Capitan (10.11)
97            #
98            # Qt 5.7: Supported
99            # Qt 5.6: Supported
100            #
101            if {${cxx_stdlib} eq "libstdc++"} {
102                return qt56
103            } else {
104                return qt5
105            }
106            #
107        } elseif { ${os.major} <= 16 } {
108            #
109            # macOS Sierra (10.12)
110            # as of Qt version 5.7, there is no official support
111            #
112            if {${cxx_stdlib} eq "libstdc++"} {
113                return qt56
114            } else {
115                return qt5
116            }
117            #
118        } else {
119            #
120            # macOS ??? (???)
121            #
122            if {${cxx_stdlib} eq "libstdc++"} {
123                return qt56
124            } else {
125                return qt5
126            }
127        }
128    } else {
129        return qt5-kde
130    }
131}
132
133if { ![info exists qt_name] } {
134    set qt_name [qt5.get_default_name]
135}
136
137# Qt has what is calls reference configurations, which are said to be thoroughly tested
138# Qt also has configurations which are "occasionally tested" or are "[d]eployment only"
139# see http://doc.qt.io/qt-5/supported-platforms.html#reference-configurations
140global qt5_min_tested_version
141global qt5_max_tested_version
142global qt5_min_reference_version
143global qt5_max_reference_version
144
145# see http://doc.qt.io/qt-5/supported-platforms-and-configurations.html
146switch -exact ${qt_name} {
147    qt5 {
148        set qt5_min_tested_version     12
149        set qt5_max_tested_version     15
150        set qt5_min_reference_version  12
151        set qt5_max_reference_version  15
152    }
153    qt56 {
154        set qt5_min_tested_version     11
155        set qt5_max_tested_version     15
156        set qt5_min_reference_version  12
157        set qt5_max_reference_version  15
158    }
159    qt55 {
160        set qt5_min_tested_version     11
161        set qt5_max_tested_version     14
162        set qt5_min_reference_version  13
163        set qt5_max_reference_version  14
164    }
165    qt5-kde {
166        set qt5_min_tested_version     11
167        set qt5_max_tested_version     15
168        set qt5_min_reference_version  12
169        set qt5_max_reference_version  15
170    }
171}
172
173if {[tbool just_want_qt5_version_info]} {
174    return
175}
176
177# standard install directory
178global qt_dir
179set qt_dir               ${prefix}/libexec/qt5
180
181# standard Qt non-.app executables directory
182global qt_bins_dir
183set qt_bins_dir         ${qt_dir}/bin
184
185# standard Qt includes directory
186global qt_includes_dir
187set qt_includes_dir     ${qt_dir}/include
188
189# standard Qt libraries directory
190global qt_libs_dir
191set qt_libs_dir         ${qt_dir}/lib
192
193# standard Qt libraries directory
194global qt_frameworks_dir
195set qt_frameworks_dir   ${qt_libs_dir}
196
197global qt_archdata_dir
198set qt_archdata_dir  ${qt_dir}
199
200# standard Qt plugins directory
201global qt_plugins_dir
202set qt_plugins_dir      ${qt_archdata_dir}/plugins
203
204# standard Qt imports directory
205global qt_imports_dir
206set qt_imports_dir      ${qt_archdata_dir}/imports
207
208# standard Qt qml directory
209global qt_qml_dir
210set qt_qml_dir          ${qt_archdata_dir}/qml
211
212# standard Qt data directory
213global qt_data_dir
214set qt_data_dir         ${qt_dir}
215
216# standard Qt documents directory
217global qt_docs_dir
218set qt_docs_dir         ${qt_data_dir}/doc
219
220# standard Qt translations directory
221global qt_translations_dir
222set qt_translations_dir ${qt_data_dir}/translations
223
224# standard Qt sysconf directory
225global qt_sysconf_dir
226set qt_sysconf_dir      ${qt_dir}/etc/xdg
227
228# standard Qt examples directory
229global qt_examples_dir
230set qt_examples_dir     ${qt_dir}/examples
231
232# standard Qt tests directory
233global qt_tests_dir
234set qt_tests_dir        ${qt_dir}/tests
235
236# data used by qmake
237global qt_host_data_dir
238set qt_host_data_dir    ${qt_dir}
239
240# standard Qt demos directory
241#global qt_demos_dir
242#set qt_demos_dir        ${qt_dir}/share/${qt_name}/demos
243
244# standard Qt mkspecs directory
245global qt_mkspecs_dir
246set qt_mkspecs_dir      ${qt_dir}/mkspecs
247
248# standard Qt .app executables directory, if created
249global qt_apps_dir
250set qt_apps_dir         ${applications_dir}/Qt5
251
252# standard CMake module directory for Qt-related files
253#global qt_cmake_module_dir
254set qt_cmake_module_dir ${qt_libs_dir}/cmake
255
256# standard qmake command location
257global qt_qmake_cmd
258set qt_qmake_cmd        ${qt_dir}/bin/qmake
259
260# standard moc command location
261global qt_moc_cmd
262set qt_moc_cmd          ${qt_dir}/bin/moc
263
264# standard uic command location
265global qt_uic_cmd
266set qt_uic_cmd          ${qt_dir}/bin/uic
267
268# standard lrelease command location
269global qt_lrelease_cmd
270set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
271
272# standard lupdate command location
273global qt_lupdate_cmd
274set qt_lupdate_cmd     ${qt_dir}/bin/lupdate
275
276# standard PKGCONFIG path
277global qt_pkg_config_dir
278set qt_pkg_config_dir   ${qt_libs_dir}/pkgconfig
279
280if {[tbool just_want_qt5_variables]} {
281    return
282}
283
284# a procedure for declaring dependencies on Qt5 components, which will expand them
285# into the appropriate subports for the Qt5 flavour installed
286# e.g. qt5.depends_component qtbase qtsvg qtdeclarative
287proc qt5.depends_component-append {first args} {
288    global qt_name qt5.using_kde
289
290    set args [linsert $args[set list {}] 0 ${first}]
291    foreach comp ${args} {
292
293        if { ![tbool qt5.using_kde] } {
294            set qt_port_name ${qt_name}-${comp}
295        } else {
296            switch -exact ${comp} {
297                qtwebkit -
298                qtwebengine -
299                qtwebview {
300                    # these components are subports
301                    set qt_port_name ${qt_name}-${comp}
302                }
303                default {
304                    # qt5*-kde provides all components except those above
305                    set qt_port_name ${qt_name}
306                }
307            }
308        }
309
310        switch -exact ${comp} {
311            qtquickcontrols2 {
312                depends_lib-append path:lib/pkgconfig/Qt5QuickControls2.pc:${qt_port_name}
313            }
314            qtbase {
315                depends_lib-append path:lib/pkgconfig/Qt5Core.pc:${qt_port_name}
316            }
317            qtwebengine {
318                depends_lib-append path:lib/pkgconfig/Qt5WebEngine.pc:${qt_port_name}
319            }
320            qtdeclarative {
321                depends_lib-append path:lib/pkgconfig/Qt5Qml.pc:${qt_port_name}
322            }
323            qtserialport {
324                depends_lib-append path:lib/pkgconfig/Qt5SerialPort.pc:${qt_port_name}
325            }
326            qtsensors {
327                depends_lib-append path:lib/pkgconfig/Qt5Sensors.pc:${qt_port_name}
328            }
329            qtcharts {
330                depends_lib-append path:lib/pkgconfig/Qt5Charts.pc:${qt_port_name}
331            }
332            qtwebkit {
333                depends_lib-append path:lib/pkgconfig/Qt5WebKit.pc:${qt_port_name}
334            }
335            qtwebchannel {
336                depends_lib-append path:lib/pkgconfig/Qt5WebChannel.pc:${qt_port_name}
337            }
338            qtdeclarative-render2d {
339                depends_lib-append path:lib/cmake/Qt5Quick/Qt5Quick_ContextPlugin.cmake:${qt_port_name}
340            }
341            qtimageformats {
342                depends_lib-append path:lib/cmake/Qt5Gui/Qt5Gui_QTiffPlugin.cmake:${qt_port_name}
343            }
344            qtvirtualkeyboard {
345                depends_lib-append path:lib/cmake/Qt5Gui/Qt5Gui_QVirtualKeyboardPlugin.cmake:${qt_port_name}
346            }
347            qtsvg {
348                depends_lib-append path:lib/pkgconfig/Qt5Svg.pc:${qt_port_name}
349            }
350            qtmacextras {
351                depends_lib-append path:lib/pkgconfig/Qt5MacExtras.pc:${qt_port_name}
352            }
353            qtlocation {
354                depends_lib-append path:lib/pkgconfig/Qt5Location.pc:${qt_port_name}
355            }
356            qtxmlpatterns {
357                depends_lib-append path:lib/pkgconfig/Qt5XmlPatterns.pc:${qt_port_name}
358            }
359            qtserialbus {
360                depends_lib-append path:lib/pkgconfig/Qt5SerialBus.pc:${qt_port_name}
361            }
362            qtmultimedia {
363                depends_lib-append path:lib/pkgconfig/Qt5Multimedia.pc:${qt_port_name}
364            }
365            qtcanvas3d {
366                depends_lib-append path:libexec/qt5/qml/QtCanvas3D/libqtcanvas3d.dylib:${qt_port_name}
367            }
368            qtdatavis3d {
369                depends_lib-append path:lib/pkgconfig/Qt5DataVisualization.pc:${qt_port_name}
370            }
371            qtgraphicaleffects {
372                depends_lib-append path:libexec/qt5/qml/QtGraphicalEffects/libqtgraphicaleffectsplugin.dylib:${qt_port_name}
373            }
374            qtpurchasing {
375                depends_lib-append path:lib/pkgconfig/Qt5Purchasing.pc:${qt_port_name}
376            }
377            qtscript {
378                depends_lib-append path:lib/pkgconfig/Qt5Script.pc:${qt_port_name}
379            }
380            qtscxml {
381                depends_lib-append path:lib/pkgconfig/Qt5Scxml.pc:${qt_port_name}
382            }
383            qt3d {
384                depends_lib-append path:lib/pkgconfig/Qt53DCore.pc:${qt_port_name}
385            }
386            qtconnectivity {
387                depends_lib-append path:lib/pkgconfig/Qt5Bluetooth.pc:${qt_port_name}
388            }
389            qtgamepad {
390                depends_lib-append path:lib/pkgconfig/Qt5Gamepad.pc:${qt_port_name}
391            }
392            qtwebview {
393                depends_lib-append path:lib/pkgconfig/Qt5WebView.pc:${qt_port_name}
394            }
395            qttools {
396                depends_lib-append path:lib/pkgconfig/Qt5Designer.pc:${qt_port_name}
397            }
398            qtquickcontrols {
399                depends_lib-append path:libexec/qt5/qml/QtQuick/Controls/libqtquickcontrolsplugin.dylib:${qt_port_name}
400            }
401            qtwebsockets {
402                depends_lib-append path:lib/pkgconfig/Qt5WebSockets.pc:${qt_port_name}
403            }
404            qttranslations {
405                depends_lib-append path:libexec/qt5/translations/qt_ar.qm:${qt_port_name}
406            }
407            mysql-plugin {
408                depends_lib-append path:lib/cmake/Qt5Sql/Qt5Sql_QMYSQLDriverPlugin.cmake:${qt_port_name}
409            }
410            psql-plugin {
411                depends_lib-append path:lib/cmake/Qt5Sql/Qt5Sql_QPSQLDriverPlugin.cmake:${qt_port_name}
412            }
413            sqlite-plugin {
414                depends_lib-append path:lib/cmake/Qt5Sql/Qt5Sql_QSQLiteDriverPlugin.cmake:${qt_port_name}
415            }
416            qtquick1 {
417                depends_lib-append path:lib/pkgconfig/Qt5Declarative.pc:${qt_port_name}
418            }
419            qtenginio {
420                depends_lib-append path:lib/pkgconfig/Enginio.pc:${qt_port_name}
421            }
422            default {
423                return -code error "unknown component"
424            }
425        }
426    }
427}
428
429# no universal binary support in Qt 5
430#     see http://lists.qt-project.org/pipermail/interest/2012-December/005038.html
431#     and https://bugreports.qt.io/browse/QTBUG-24952
432default supported_archs {"i386 x86_64"}
433# override universal_setup found in portutil.tcl so it uses muniversal PortGroup
434# see https://trac.macports.org/ticket/51643
435proc universal_setup {args} {
436    if {[variant_exists universal]} {
437        ui_debug "universal variant already exists, so not adding the default one"
438    } elseif {[exists universal_variant] && ![option universal_variant]} {
439        ui_debug "universal_variant is false, so not adding the default universal variant"
440    } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
441        ui_debug "using xmkmf, so not adding the default universal variant"
442    } elseif {![exists os.universal_supported] || ![option os.universal_supported]} {
443        ui_debug "OS doesn't support universal builds, so not adding the default universal variant"
444    } elseif {[llength [option supported_archs]] == 1} {
445        ui_debug "only one arch supported, so not adding the default universal variant"
446    } else {
447        ui_debug "adding universal variant via PortGroup muniversal"
448        uplevel "PortGroup muniversal 1.0"
449        uplevel "default universal_archs_supported {\"i386 x86_64\"}"
450    }
451}
452
453# standard qmake spec
454# other platforms required
455#     see http://doc.qt.io/qt-5/supported-platforms.html
456#     and http://doc.qt.io/QtSupportedPlatforms/index.html
457global qt_qmake_spec
458global qt_qmake_spec_32
459global qt_qmake_spec_64
460compiler.blacklist-append *gcc*
461
462set qt_qmake_spec_32 macx-clang-32
463set qt_qmake_spec_64 macx-clang
464
465if { ![option universal_variant] || ![variant_isset universal] } {
466    if { ${configure.build_arch} eq "i386" } {
467        set qt_qmake_spec ${qt_qmake_spec_32}
468    } else {
469        set qt_qmake_spec ${qt_qmake_spec_64}
470    }
471} else {
472    set qt_qmake_spec ""
473}
474
475# do not try to install if qt5-qtbase dependency will fail to build
476# warn about non-reference configurations
477if { ${os.major} < ${qt5_min_tested_version} } {
478    pre-fetch {
479        ui_warn "Qt dependency is not supported on this platform and may not build"
480    }
481}
482
483if { ${qt_name} ne "qt5" } {
484    pre-fetch {
485        ui_warn "Qt dependency is not the latest version but may be the latest supported on your OS"
486    }
487}
488
489if {![info exists building_qt5]} {
490    qt5.depends_component-append qtbase
491}
492
493# use PKGCONFIG for Qt discovery in configure scripts
494depends_build-append    port:pkgconfig
495
496# standard destroot environment
497if { ![option universal_variant] || ![variant_isset universal] } {
498    destroot.env-append \
499        INSTALL_ROOT=${destroot}
500} else {
501    foreach arch ${configure.universal_archs} {
502        lappend merger_destroot_env($arch) INSTALL_ROOT=${workpath}/destroot-${arch}
503    }
504}