source: trunk/dports/_resources/port1.0/group/qmake5-1.0.tcl @ 144445

Last change on this file since 144445 was 144445, checked in by mcalhoun@…, 3 years ago

qmake5 Portgroup: respect macosx_deployment_target and configure.cxx_stdlib values when building with qmake (fixes #50249)

File size: 4.9 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: qmake-1.0.tcl 106930 2013-06-12 03:13:56Z ryandesign@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
39PortGroup                       qt5 1.0
40PortGroup                       active_variants 1.1
41
42# with the -r option, the examples do not install correctly (no source code)
43#     the install_sources target is not created in the Makefile(s)
44configure.cmd                   ${qt_qmake_cmd}
45#configure.cmd                   ${qt_qmake_cmd} -r
46
47configure.pre_args-replace      --prefix=${prefix} "PREFIX=${prefix}"
48configure.universal_args-delete --disable-dependency-tracking
49
50# specify build configuration (compiler, 32-bit/64-bit, etc.)
51if { ![option universal_variant] || ![variant_isset universal] } {
52    configure.args-append -spec ${qt_qmake_spec}
53} else {
54    lappend merger_configure_args(i386)   -spec ${qt_qmake_spec_32}
55    lappend merger_configure_args(x86_64) -spec ${qt_qmake_spec_64}
56}
57
58# if qtbase was build as a universal,
59#    QT_ARCH and QT_TARGET_ARCH may be set incorrectly in ${qt_mkspecs_dir}/qconfig.pri,
60#    so set them manually
61if { ![option universal_variant] || ![variant_isset universal] } {
62    pre-configure {
63        if {[active_variants qt5-qtbase universal ""]} {
64            configure.args-append \
65                QT_ARCH=${build_arch} \
66                QT_TARGET_ARCH=${build_arch}
67        }
68    }
69} else {
70    foreach arch ${configure.universal_archs} {
71        lappend merger_configure_args(${arch}) \
72            QT_ARCH=${arch} \
73            QT_TARGET_ARCH=${arch}
74    }
75}
76
77# override QMAKE_MACOSX_DEPLOYMENT_TARGET set in ${prefix}/libexec/qt5/mkspecs/macx-clang/qmake.conf
78# see #50249
79configure.args-append QMAKE_MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}
80
81# override C++11 flags set in ${prefix}/libexec/qt5/mkspecs/common/clang-mac.conf
82#    so value of ${configure.cxx_stdlib} can always be used
83configure.args-append \
84    QMAKE_CXXFLAGS_CXX11-=-stdlib=libc++ \
85    QMAKE_LFLAGS_CXX11-=-stdlib=libc++
86
87# ensure ${configure.cxx_stdlib} is used for C++ stdlib
88configure.args-append \
89    QMAKE_CXXFLAGS+=-stdlib=${configure.cxx_stdlib} \
90    QMAKE_LFLAGS+=-stdlib=${configure.cxx_stdlib}
91
92if {![info exists qt5_qmake_request_no_debug]} {
93    variant debug description {Build both release and debug libraries} {}
94
95    # accommodating variant request varies depending on how qtbase was built
96    pre-configure {
97
98        # determine if qmake builds debug libraries by default (set via variants)
99        if {[active_variants qt5-qtbase debug ""]} {
100            set base_debug true
101        } else {
102            set base_debug false
103        }
104
105        # determine if the user wants to build debug libraries
106        if { [variant_exists debug] && [variant_isset debug] } {
107            set this_debug true
108        } else {
109            set this_debug false
110        }
111
112        # determine of qmake's default and user requests are compatible; override qmake if necessary
113        if { ${this_debug} && !${base_debug}  } {
114            configure.args-append "QT_CONFIG+=\"debug_and_release build_all\""
115        }
116
117        if { !${this_debug} && ${base_debug}  } {
118            configure.args-append "QT_CONFIG-=\"debug_and_release build_all\" CONFIG-=\"debug\""
119        }
120    }
121}
Note: See TracBrowser for help on using the repository browser.