source: trunk/dports/_resources/port1.0/group/qt5-1.0.tcl @ 134878

Last change on this file since 134878 was 134878, checked in by michaelld@…, 4 years ago

qt5 1.0 PortGroup: whitespace.

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