Ticket #48024: qt5-1.0.tcl

File qt5-1.0.tcl, 10.8 KB (added by RJVB (René Bertin), 9 years ago)

proposed amended Qt5 portgroup

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# kate: backspace-indents true; indent-pasted-text true; indent-width 4; keep-extra-spaces true; remove-trailing-spaces modified; replace-tabs true; replace-tabs-save true; syntax Tcl/Tk; tab-indents true; tab-width 4;
3# $Id: qt5-1.0.tcl 113952 2015-06-11 16:30:53Z gmail.com:rjvbertin $
4# $Id: qt5-1.0.tcl 113952 2013-11-26 18:01:53Z michaelld@macports.org $
5
6# Copyright (c) 2014 The MacPorts Project
7# All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions are
11# met:
12#
13# 1. Redistributions of source code must retain the above copyright
14#    notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright
16#    notice, this list of conditions and the following disclaimer in the
17#    documentation and/or other materials provided with the distribution.
18# 3. Neither the name of Apple Computer, Inc. nor the names of its
19#    contributors may be used to endorse or promote products derived from
20#    this software without specific prior written permission.
21#
22# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33#
34#
35# This portgroup defines standard settings when using Qt5.
36#
37# Usage:
38# PortGroup     qt5 1.0
39
40if { ![exists universal_variant] || [option universal_variant] } {
41    PortGroup muniversal 1.0
42    #universal_archs_supported i386 x86_64
43}
44
45# check for +debug variant of this port, and make sure Qt was
46# installed with +debug as well; if not, error out.
47platform darwin {
48    pre-extract {
49        if {[variant_exists debug] && \
50            [variant_isset debug] && \
51           ![info exists building_qt5]} {
52            if {![file exists ${qt_frameworks_dir}/QtCore.framework/QtCore_debug]} {
53                return -code error "\n\nERROR:\n\
54In order to install this port as +debug,
55Qt5 must also be installed with +debug.\n"
56            }
57        }
58    }
59}
60
61# standard Qt5 name. This should be just "qt5" (or qt53 for instance when more
62# specific version info must be included). There is nothing but a historical reason
63# to call the Qt5 port itself qt5-mac, so that name should not appear on disk where
64# files could be installed that would be the distant descendants of files from qt4-x11
65global qt_name
66set qt_name             qt5
67
68# global definitions with explanation; set the actual values below for cleanness.
69# standard install directory
70    global qt_dir
71# idem, relative to ${prefix}
72    global qt_dir_rel
73# archdata: equal to qt_dir
74    global qt_archdata_dir
75# standard Qt documents directory
76    global qt_docs_dir
77# standard Qt plugins directory
78    global qt_plugins_dir
79# standard Qt mkspecs directory
80    global qt_mkspecs_dir
81# standard Qt imports directory
82    global qt_imports_dir
83# standard Qt qml directory
84    global qt_qml_dir
85# standard Qt includes directory, under ${prefix}/includes where they would be expected
86    global qt_includes_dir
87# standard Qt libraries directory
88    global qt_libs_dir
89# standard Qt libraries directory: OS X frameworks
90    global qt_frameworks_dir
91# idem, relative to ${prefix}
92    global qt_frameworks_dir_rel
93# standard Qt non-.app executables directory
94    global qt_bins_dir
95# standard Qt data directory
96    global qt_data_dir
97# standard Qt translations directory
98    global qt_translations_dir
99# standard Qt sysconf directory
100    global qt_sysconf_dir
101# standard Qt .app executables directory, if created
102    global qt_apps_dir
103# standard Qt examples directory
104    global qt_examples_dir
105# standard Qt demos directory
106    global qt_demos_dir
107# standard Qt tests directory
108    global qt_tests_dir
109# standard CMake module directory for Qt-related files
110    global qt_cmake_module_dir
111# standard qmake command location
112    global qt_qmake_cmd
113# standard moc command location
114    global qt_moc_cmd
115# standard uic command location
116    global qt_uic_cmd
117# standard lrelease command location
118    global qt_lrelease_cmd
119
120set qt_dir                  ${prefix}/libexec/${qt_name}
121set qt_dir_rel              libexec/${qt_name}
122set qt_includes_dir         ${prefix}/include/${qt_name}
123set qt_libs_dir             ${qt_dir}/lib
124set qt_frameworks_dir       ${qt_dir}/Library/Frameworks
125set qt_frameworks_dir_rel   ${qt_dir_rel}/Library/Frameworks
126set qt_bins_dir             ${qt_dir}/bin
127set qt_cmake_module_dir     ${prefix}/lib/cmake
128set qt_archdata_dir         ${qt_dir}
129set qt_sysconf_dir          ${prefix}/etc/${qt_name}
130set qt_data_dir             ${prefix}/share/${qt_name}
131set qt_plugins_dir          ${prefix}/share/${qt_name}/plugins
132set qt_mkspecs_dir          ${prefix}/share/${qt_name}/mkspecs
133set qt_imports_dir          ${prefix}/share/${qt_name}/imports
134set qt_qml_dir              ${prefix}/share/${qt_name}/qml
135set qt_translations_dir     ${prefix}/share/${qt_name}/translations
136set qt_tests_dir            ${prefix}/share/${qt_name}/tests
137set qt_docs_dir             ${prefix}/share/doc/${qt_name}
138
139set qt_qmake_cmd            ${qt_dir}/bin/qmake
140set qt_moc_cmd              ${qt_dir}/bin/moc
141set qt_uic_cmd              ${qt_dir}/bin/uic
142set qt_lrelease_cmd         ${qt_dir}/bin/lrelease
143
144set qt_apps_dir             ${applications_dir}/Qt5
145set qt_examples_dir         ${qt_apps_dir}/examples
146set qt_demos_dir            ${qt_apps_dir}/demos
147
148global qt_qmake_spec
149global qt_qmake_spec_32
150global qt_qmake_spec_64
151
152PortGroup                   compiler_blacklist_versions 1.0
153compiler.whitelist          clang macports-clang-3.5 macports-clang-3.4
154compiler.blacklist-append   macports-llvm-gcc-4.2 llvm-gcc-4.2
155compiler.blacklist-append   gcc-4.2 apple-gcc-4.2 gcc-4.0
156compiler.blacklist-append   macports-clang-3.1 macports-clang-3.0 macports-clang-3.2 macports-clang-3.3
157compiler.blacklist-append   {clang < 500}
158
159
160# set Qt understood arch types, based on user preference
161options qt_arch_types
162default qt_arch_types       {[string map {i386 x86} [get_canonical_archs]]}
163
164set qt_qmake_spec_32        macx-clang-32
165set qt_qmake_spec_64        macx-clang
166
167if { ![option universal_variant] || ![variant_isset universal] } {
168    if { ${build_arch} eq "i386" } {
169        set qt_qmake_spec   ${qt_qmake_spec_32}
170    } else {
171        set qt_qmake_spec   ${qt_qmake_spec_64}
172    }
173} else {
174    set qt_qmake_spec ""
175}
176
177# standard PKGCONFIG path
178global qt_pkg_config_dir
179set qt_pkg_config_dir       ${prefix}/lib/pkgconfig
180
181# data used by qmake
182global qt_host_data_dir
183set qt_host_data_dir        ${prefix}/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# allow for depending on either qt5[-mac] or qt5[-mac]-devel or qt5[-mac]*-kde, simultaneously
194
195if {![info exists building_qt5]} {
196    if {${os.platform} eq "darwin"} {
197
198        # see if the framework install exists, and if so depend on it;
199        # if not, depend on the library version
200
201        if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} {
202            depends_lib-append path:libexec/${qt_name}/Library/Frameworks/QtCore.framework/QtCore:qt5-mac
203        } else {
204            depends_lib-append path:libexec/${qt_name}/lib/libQtCore.5.dylib:qt5-mac
205        }
206    }
207}
208
209# standard configure environment, when not building qt5
210
211if {![info exists building_qt5]} {
212    configure.env-append \
213        QTDIR=${qt_dir} \
214        QMAKE=${qt_qmake_cmd} \
215        MOC=${qt_moc_cmd}
216
217    if { ![option universal_variant] || ![variant_isset universal] } {
218        configure.env-append QMAKESPEC=${qt_qmake_spec}
219    } else {
220        set merger_configure_env(i386)   "QMAKESPEC=${qt_qmake_spec_32}"
221        set merger_configure_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}"
222        set merger_arch_flag             yes
223        set merger_arch_compiler         yes
224    }
225
226    # make sure the Qt binaries' directory is in the path, if it is
227    # not the current prefix
228
229    if {${qt_dir} ne ${prefix}} {
230        configure.env-append PATH=${qt_dir}/bin:$env(PATH)
231    }
232} else {
233    configure.env-append QMAKE_NO_DEFAULTS=""
234}
235
236# standard build environment, when not building qt5
237
238if {![info exists building_qt5]} {
239    build.env-append \
240        QTDIR=${qt_dir} \
241        QMAKE=${qt_qmake_cmd} \
242        MOC=${qt_moc_cmd}
243
244    if { ![option universal_variant] || ![variant_isset universal] } {
245        build.env-append QMAKESPEC=${qt_qmake_spec}
246    } else {
247        set merger_build_env(i386)      "QMAKESPEC=${qt_qmake_spec_32}"
248        set merger_build_env(x86_64)    "QMAKESPEC=${qt_qmake_spec_64}"
249        set merger_arch_flag            yes
250        set merger_arch_compiler        yes
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}
296
297proc qt_branch {} {
298    global version
299    return [join [lrange [split ${version} .] 0 1] .]
300}