Ticket #46536: qt5-2.0.tcl

File qt5-2.0.tcl, 10.9 KB (added by RJVB (René Bertin), 9 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: qt5-2.0.tcl 113952 2015-01-12 16:30:53Z gmail.com:rjvbertin $
3# $Id: qt5-1.0.tcl 113952 2013-11-26 18:01:53Z michaelld@macports.org $
4
5# Copyright (c) 2014 The MacPorts Project
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions are
10# met:
11#
12# 1. Redistributions of source code must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright
15#    notice, this list of conditions and the following disclaimer in the
16#    documentation and/or other materials provided with the distribution.
17# 3. Neither the name of Apple Computer, Inc. nor the names of its
18#    contributors may be used to endorse or promote products derived from
19#    this software without specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#
33#
34# This portgroup defines standard settings when using Qt5.
35#
36# Usage:
37# PortGroup     qt5 2.0
38
39# no universal binary support in Qt 5
40#     see http://lists.qt-project.org/pipermail/interest/2012-December/005038.html
41#     see also https://bugreports.qt-project.org/browse/QTBUG-24952
42if { ![exists universal_variant] || [option universal_variant] } {
43    PortGroup muniversal 1.0
44    #universal_archs_supported i386 x86_64
45}
46
47# check for +debug variant of this port, and make sure Qt was
48# installed with +debug as well; if not, error out.
49platform darwin {
50    pre-extract {
51        if {[variant_exists debug] && \
52            [variant_isset debug] && \
53           ![info exists building_qt5]} {
54            if {![file exists ${qt_frameworks_dir}/QtCore.framework/QtCore_debug]} {
55                return -code error "\n\nERROR:\n\
56In order to install this port as +debug,
57Qt5 must also be installed with +debug.\n"
58            }
59        }
60    }
61}
62
63# standard Qt5 name
64global qt_name
65set qt_name             qt5
66
67# standard install directory
68    global qt_dir
69    global qt_dir_rel
70# standard Qt documents directory
71    global qt_docs_dir
72# standard Qt plugins directory
73    global qt_plugins_dir
74# standard Qt mkspecs directory
75    global qt_mkspecs_dir
76# standard Qt imports directory
77    global qt_imports_dir
78# standard Qt qml directory
79    global qt_qml_dir
80# standard Qt includes directory
81    global qt_includes_dir
82# standard Qt libraries directory
83    global qt_libs_dir
84# standard Qt libraries directory
85    global qt_frameworks_dir
86    global qt_frameworks_dir_rel
87# standard Qt non-.app executables directory
88    global qt_bins_dir
89# standard Qt data directory
90    global qt_data_dir
91# standard Qt translations directory
92    global qt_translations_dir
93# standard Qt sysconf directory
94    global qt_sysconf_dir
95# standard Qt examples directory
96    global qt_examples_dir
97# standard Qt tests directory
98    global qt_tests_dir
99# standard Qt demos directory
100    global qt_demos_dir
101# standard CMake module directory for Qt-related files
102    global qt_cmake_module_dir
103# standard qmake command location
104    global qt_qmake_cmd
105# standard moc command location
106    global qt_moc_cmd
107# standard uic command location
108    global qt_uic_cmd
109# standard lrelease command location
110    global qt_lrelease_cmd
111
112global qt5_is_concurrent
113# check if we're building qt5 itself
114if {![info exists building_qt5] || ![info exists name] || ${name} ne "qt5-mac"} {
115    # no, this must be a dependent port: check the qt5 install:
116    if {[file exists ${prefix}/libexec/${qt_name}/bin/qmake]} {
117        # we have a "concurrent" install, which means we must look for the various components
118        # in different locations (esp. qmake)
119        set qt5_is_concurrent   1
120        set auto_concurrent     1
121    }
122} else {
123    # we're building qt5-mac or one of its subports
124    # we're asking for the standard concurrent install. No need to guess anything, give the user what s/he wants
125    set qt5_is_concurrent   1
126    set auto_concurrent     1
127}
128
129if {![info exists qt5_is_concurrent]} {
130    if {![info exists building_qt5]} {
131                return -code error "\n\nERROR:\n\
132Qt5 appears to be installed in the old, exclusive mode,
133and this port, ${name}, ought to use PortGroup qt5 1.0\n"
134    }
135}
136
137set qt_dir              ${prefix}/libexec/${qt_name}
138set qt_dir_rel          libexec/${qt_name}
139set qt_docs_dir         ${prefix}/share/doc/${qt_name}
140set qt_plugins_dir      ${prefix}/share/${qt_name}/plugins
141set qt_mkspecs_dir      ${prefix}/share/${qt_name}/mkspecs
142set qt_imports_dir      ${prefix}/share/${qt_name}/imports
143set qt_qml_dir          ${prefix}/share/${qt_name}/qml
144set qt_includes_dir     ${prefix}/include/${qt_name}
145set qt_libs_dir         ${qt_dir}/lib
146set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
147set qt_bins_dir         ${qt_dir}/bin
148set qt_data_dir         ${prefix}/share/${qt_name}
149set qt_translations_dir ${prefix}/share/${qt_name}/translations
150set qt_sysconf_dir      ${prefix}/etc/${qt_name}
151set qt_tests_dir        ${prefix}/share/${qt_name}/tests
152set qt_demos_dir        ${prefix}/share/${qt_name}/demos
153set qt_cmake_module_dir ${prefix}/lib/cmake
154set qt_qmake_cmd        ${qt_dir}/bin/qmake
155set qt_moc_cmd          ${qt_dir}/bin/moc
156set qt_uic_cmd          ${qt_dir}/bin/uic
157set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
158set qt_frameworks_dir_rel   ${qt_dir_rel}/Library/Frameworks
159
160# standard Qt .app executables directory, if created
161global qt_apps_dir
162set qt_apps_dir         ${applications_dir}/Qt5
163set qt_examples_dir     ${qt_apps_dir}/examples
164
165# standard qmake spec
166# configure script prefers clang (but "[a]dvertise[s] g++ as an alternative on Lion and below").
167# According to http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations,
168#    however, Snow Leopard is only tested on "GCC as provided by Apple"
169# Create a variant for Snow Leopard that uses "-platform macx-g++-32" or "-platform macx-g++"?
170global qt_qmake_spec
171global qt_qmake_spec_32
172global qt_qmake_spec_64
173compiler.whitelist clang
174
175set qt_qmake_spec_32 macx-clang-32
176set qt_qmake_spec_64 macx-clang
177
178if { ![option universal_variant] || ![variant_isset universal] } {
179    if { ${build_arch} eq "i386" } {
180        set qt_qmake_spec ${qt_qmake_spec_32}
181    } else {
182        set qt_qmake_spec ${qt_qmake_spec_64}
183    }
184} else {
185    set qt_qmake_spec ""
186}
187
188# standard PKGCONFIG path
189global qt_pkg_config_dir
190set qt_pkg_config_dir   ${prefix}/lib/pkgconfig
191
192# data used by qmake
193global qt_host_data_dir
194set qt_host_data_dir   ${prefix}/share/${qt_name} 
195
196# standard cmake info for Qt5
197global qt_cmake_defines
198set qt_cmake_defines    \
199    "-DQT_QT_INCLUDE_DIR=${qt_includes_dir} \
200     -DQT_QMAKESPEC=${qt_qmake_spec} \
201     -DQT_ZLIB_LIBRARY=${prefix}/lib/libz.dylib \
202     -DQT_PNG_LIBRARY=${prefix}/lib/libpng.dylib"
203
204# allow for depending on either qt5-mac or qt5-mac-devel or qt5-mac*-kde, simultaneously
205
206if {![info exists building_qt5]} {
207    if {${os.platform} eq "darwin"} {
208
209        # see if the framework install exists, and if so depend on it;
210        # if not, depend on the library version
211
212        if {[info exists qt5_is_concurrent]} {
213            if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} {
214                depends_lib-append path:libexec/${qt_name}/Library/Frameworks/QtCore.framework/QtCore:qt5-mac
215            } else {
216                depends_lib-append path:libexec/${qt_name}/lib/libQtCore.5.dylib:qt5-mac
217            }
218        } else {
219            if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} {
220                depends_lib-append path:Library/Frameworks/QtCore.framework/QtCore:qt5-mac
221            } else {
222                depends_lib-append path:lib/libQtCore.5.dylib:qt5-mac
223            }
224        }
225    }
226}
227
228# standard configure environment, when not building qt5
229
230if {![info exists building_qt5]} {
231    configure.env-append \
232        QTDIR=${qt_dir} \
233        QMAKE=${qt_qmake_cmd} \
234        MOC=${qt_moc_cmd}
235
236    if { ![option universal_variant] || ![variant_isset universal] } {
237        configure.env-append QMAKESPEC=${qt_qmake_spec}
238    } else {
239        set merger_configure_env(i386)   "QMAKESPEC=${qt_qmake_spec_32}"
240        set merger_configure_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}"
241    }
242
243    # make sure the Qt binaries' directory is in the path, if it is
244    # not the current prefix
245
246    if {${qt_dir} ne ${prefix}} {
247        configure.env-append PATH=${qt_dir}/bin:$env(PATH)
248    }
249} else {
250    configure.env-append QMAKE_NO_DEFAULTS=""
251}
252
253# standard build environment, when not building qt5
254
255if {![info exists building_qt5]} {
256    build.env-append \
257        QTDIR=${qt_dir} \
258        QMAKE=${qt_qmake_cmd} \
259        MOC=${qt_moc_cmd}
260
261    if { ![option universal_variant] || ![variant_isset universal] } {
262        build.env-append QMAKESPEC=${qt_qmake_spec}
263    } else {
264        set merger_build_env(i386)   "QMAKESPEC=${qt_qmake_spec_32}"
265        set merger_build_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}"
266    }
267
268    # make sure the Qt binaries' directory is in the path, if it is
269    # not the current prefix
270
271    if {${qt_dir} ne ${prefix}} {
272        build.env-append    PATH=${qt_dir}/bin:$env(PATH)
273    }
274}
275
276# use PKGCONFIG for Qt discovery in configure scripts
277depends_build-append    port:pkgconfig
278
279# standard destroot environment
280if { ![option universal_variant] || ![variant_isset universal] } {
281    destroot.env-append \
282        INSTALL_ROOT=${destroot}
283} else {
284    foreach arch ${configure.universal_archs} {
285        lappend merger_destroot_env($arch) INSTALL_ROOT=${workpath}/destroot-${arch}
286    }
287}
288
289# standard destroot environment, when not building qt5
290
291if {![info exists building_qt5]} {
292    destroot.env-append \
293        QTDIR=${qt_dir} \
294        QMAKE=${qt_qmake_cmd} \
295        MOC=${qt_moc_cmd}
296
297    if { ![option universal_variant] || ![variant_isset universal] } {
298        build.env-append QMAKESPEC=${qt_qmake_spec}
299    } else {
300        set destroot_build_env(i386)   "QMAKESPEC=${qt_qmake_spec_32}"
301        set destroot_build_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}"
302    }
303
304    # make sure the Qt binaries' directory is in the path, if it is
305    # not the current prefix
306
307    if {${qt_dir} ne ${prefix}} {
308        destroot.env-append PATH=${qt_dir}/bin:$env(PATH)
309    }
310}