Ticket #50966: qmake5-1.0.tcl

File qmake5-1.0.tcl, 7.0 KB (added by RJVB (René Bertin), 8 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# $Id: qmake5-1.0.tcl 145157 2016-01-27 04:47:20Z mcalhoun@macports.org $
3
4#
5# Copyright (c) 2013 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 qmake.
35#
36# Usage:
37# PortGroup                     qmake5 1.0
38#
39# or
40# set qt5.prefer_kde            yes
41# PortGroup                     qmake5 1.0
42
43PortGroup                       qt5 1.0
44
45if {![info exists qt5.using_kde]} {
46    ui_debug "qmake5 PortGroup : no qt5-kde info was provided by the Qt5 PortGroup"
47    set qt5.using_kde           no
48}
49
50if {${qt5.using_kde}} {
51
52    #configure.cmd                   ${qt_qmake_cmd} -r
53    configure.cmd                   ${qt_qmake_cmd}
54    configure.pre_args-replace      --prefix=${prefix} PREFIX=${prefix}
55    configure.universal_args-delete --disable-dependency-tracking
56
57    # qmake defaults to -mmacosx-version-min=10.6, which implies stdlib is libstdc++, which caused problems
58    #    (see https://trac.macports.org/wiki/FAQ#libcpp)
59    # override QMAKE_MACOSX_DEPLOYMENT_TARGET set in ${prefix}/libexec/qt5/mkspecs/macx-clang/qmake.conf
60    # see #50249
61    configure.pre_args-append       "QMAKE_MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}"
62
63    if {[variant_exists universal] && [variant_isset universal]} {
64        set merger_configure_args(i386)     "CONFIG+=\"x86\" -spec ${qt_qmake_spec_32}"
65        set merger_configure_args(x86_64)   "-spec ${qt_qmake_spec_64}"
66    }
67
68    # qt5-kde does not currently support a debug variant, but does provide (some) debugging information
69    configure.pre_args-append       "CONFIG+=release"   
70
71} else {
72
73    # using the mainstream port:qt5
74
75    PortGroup                       active_variants 1.1
76
77    # with the -r option, the examples do not install correctly (no source code)
78    #     the install_sources target is not created in the Makefile(s)
79    configure.cmd                   ${qt_qmake_cmd}
80    #configure.cmd                   ${qt_qmake_cmd} -r
81
82    configure.pre_args-replace      --prefix=${prefix} "PREFIX=${prefix}"
83    configure.universal_args-delete --disable-dependency-tracking
84
85    # specify build configuration (compiler, 32-bit/64-bit, etc.)
86    if { ![option universal_variant] || ![variant_isset universal] } {
87        configure.args-append -spec ${qt_qmake_spec}
88    } else {
89        lappend merger_configure_args(i386)   -spec ${qt_qmake_spec_32}
90        lappend merger_configure_args(x86_64) -spec ${qt_qmake_spec_64}
91    }
92
93    # if qtbase was build as a universal,
94    #    QT_ARCH and QT_TARGET_ARCH may be set incorrectly in ${qt_mkspecs_dir}/qconfig.pri,
95    #    so set them manually
96    if { ![option universal_variant] || ![variant_isset universal] } {
97        pre-configure {
98            if {[active_variants qt5-qtbase universal ""]} {
99                configure.args-append \
100                    QT_ARCH=${build_arch} \
101                    QT_TARGET_ARCH=${build_arch}
102            }
103        }
104    } else {
105        foreach arch ${configure.universal_archs} {
106            lappend merger_configure_args(${arch}) \
107                QT_ARCH=${arch} \
108                QT_TARGET_ARCH=${arch}
109        }
110    }
111
112    # override QMAKE_MACOSX_DEPLOYMENT_TARGET set in ${prefix}/libexec/qt5/mkspecs/macx-clang/qmake.conf
113    # see #50249
114    configure.args-append QMAKE_MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}
115
116    if {![info exists qt5_qmake_request_no_debug]} {
117        variant debug description {Build both release and debug libraries} {}
118
119        # accommodating variant request varies depending on how qtbase was built
120        pre-configure {
121
122            # determine if qmake builds debug libraries by default (set via variants)
123            if {[active_variants qt5-qtbase debug ""]} {
124                set base_debug true
125            } else {
126                set base_debug false
127            }
128
129            # determine if the user wants to build debug libraries
130            if { [variant_exists debug] && [variant_isset debug] } {
131                set this_debug true
132            } else {
133                set this_debug false
134            }
135
136            # determine of qmake's default and user requests are compatible; override qmake if necessary
137            if { ${this_debug} && !${base_debug}  } {
138                configure.args-append "QT_CONFIG+=\"debug_and_release build_all\""
139            }
140
141            if { !${this_debug} && ${base_debug}  } {
142                configure.args-append "QT_CONFIG-=\"debug_and_release build_all\" CONFIG-=\"debug\""
143            }
144        }
145    }
146
147}
148
149# override C++11 flags set in ${prefix}/libexec/qt5/mkspecs/common/clang-mac.conf
150#    so value of ${configure.cxx_stdlib} can always be used
151# RJVB: only use cxx_stdlib when it is actually set and not equal to libc++ already.
152if {${configure.cxx_stdlib} ne ""} {
153    if {${configure.cxx_stdlib} ne "libc++"} {
154        configure.args-append \
155            QMAKE_CXXFLAGS_CXX11-=-stdlib=libc++ \
156            QMAKE_LFLAGS_CXX11-=-stdlib=libc++   \
157            QMAKE_CXXFLAGS_CXX11+=-stdlib=${configure.cxx_stdlib} \
158            QMAKE_LFLAGS_CXX11+=-stdlib=${configure.cxx_stdlib}
159    }
160    # ensure ${configure.cxx_stdlib} is used for C++ stdlib
161    configure.args-append \
162        QMAKE_CXXFLAGS+=-stdlib=${configure.cxx_stdlib} \
163        QMAKE_LFLAGS+=-stdlib=${configure.cxx_stdlib}
164}
165
166# 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;