Ticket #53778: qmake5-kde-1.0.tcl

File qmake5-kde-1.0.tcl, 7.9 KB (added by RJVB (René Bertin), 7 years ago)

for reference, the qmake5-kde-1.0.tcl version

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#
3# Copyright (c) 2013-2017 The MacPorts Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met:
9#
10# 1. Redistributions of source code must retain the above copyright
11#    notice, this list of conditions and the following disclaimer.
12# 2. Redistributions in binary form must reproduce the above copyright
13#    notice, this list of conditions and the following disclaimer in the
14#    documentation and/or other materials provided with the distribution.
15# 3. Neither the name of Apple Computer, Inc. nor the names of its
16#    contributors may be used to endorse or promote products derived from
17#    this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30#
31#
32# This portgroup defines standard settings when using qmake with qt5-kde.
33# Not to be used directly.
34# Typical usage that allows install-from-scratch of a port that prefers qt5-kde
35# but will still work when port:qt5 is already installed:
36#
37# set qt5.prefer_kde            yes
38# PortGroup                     qmake5 1.0
39
40# transfer control if qt5.using_kde isn't set, which is the case only
41# when port:qt5-kde is installed and the Qt5 PortGroup has processed
42# that fact.
43if {![tbool qt5.using_kde]} {
44    ui_warn "The qmake5-kde PortGroup shouldn't be called directly"
45    PortGroup                   qmake5 1.0
46    return
47}
48
49# if we're here, that means port:qt5-kde is installed, qt5.using_kde is set and
50# qmake5-1.0.tcl transferred control to us.
51
52namespace eval qt5 {
53    set dont_include_twice      yes
54}
55# include qt5-kde only once from here
56PortGroup                       qt5-kde 1.0
57namespace eval qt5 {
58    unset dont_include_twice
59}
60
61if {![info exists qt5.add_spec]} {
62    ### avoid defining these twice:
63
64    # with the -r option, the examples do not install correctly (no source code)
65    #     the install_sources target is not created in the Makefile(s)
66    configure.cmd               ${qt_qmake_cmd}
67
68    options qt5.add_spec qt5.debug_variant
69    default qt5.add_spec        yes
70    default qt5.debug_variants  yes
71
72    configure.pre_args-replace  --prefix=${prefix} "PREFIX=${prefix}"
73    configure.universal_args-delete \
74                                --disable-dependency-tracking
75}
76options qt5.rewind_qmake_cache
77default qt5.rewind_qmake_cache yes
78
79### using port:qt5-kde
80# we use a somewhat simpler qmake cookbook, which doesn't require the magic related
81# to providing all Qt components through subports. We also provide a different +debug
82# variant which dependents don't need to know anything about.
83
84# qt5-kde does not currently support a debug variant, but does provide (some) debugging information
85configure.pre_args-append       "CONFIG+=release"
86
87# see https://trac.macports.org/ticket/53186
88default destroot.destdir        "INSTALL_ROOT=${destroot}"
89
90pre-configure {
91    if {[tbool qt5.add_spec]} {
92        if {[variant_exists universal] && [variant_isset universal]} {
93            set merger_configure_args(i386) \
94                                    "CONFIG+=\"x86\" -spec ${qt_qmake_spec_32}"
95            set merger_configure_args(x86_64) \
96                                        "-spec ${qt_qmake_spec_64}"
97        } elseif {${qt_qmake_spec} ne ""} {
98            configure.args-append   -spec ${qt_qmake_spec}
99        }
100    }
101
102    #
103    # set QT_ARCH and QT_TARGET_ARCH manually since they may be
104    #     incorrect in ${qt_mkspecs_dir}/qconfig.pri
105    #     if qtbase was built universal
106    #
107    # -spec specifies build configuration (compiler, 32-bit/64-bit, etc.)
108    #
109    # set -arch x86_64 since macx-clang spec file assumes it is the default
110    #
111    # set QT and QMAKE values in a qt5::cache file
112    # previously, they were set using configure.args
113    # a qt5::cache file is used for two reasons
114    #
115    # 1) a change in Qt 5.7.1  made it more difficult to override sdk variables
116    #    see https://codereview.qt-project.org/#/c/165499/
117    #    see https://bugreports.qt.io/browse/QTBUG-56965
118    #
119    # 2) some ports (e.g. py-pyqt5 py-qscintilla2) call qmake indirectly and
120    #    do not pass on the configure.args values
121    #
122    xinstall -m 755 -d ${qt5.top_level}
123    if {[tbool qt5.rewind_qmake_cache]} {
124        set qt5::cache [open "${qt5.top_level}/.qmake.cache" w 0644]
125    } else {
126        set qt5::cache [open "${qt5.top_level}/.qmake.cache" a 0644]
127    }
128    platform darwin {
129        puts ${qt5::cache} "if(${qt_qmake_spec_64}) {"
130        puts ${qt5::cache} "  QT_ARCH=x86_64"
131        puts ${qt5::cache} "  QT_TARGET_ARCH=x86_64"
132        puts ${qt5::cache} "  QMAKE_CFLAGS+=-arch x86_64"
133        puts ${qt5::cache} "  QMAKE_CXXFLAGS+=-arch x86_64"
134        puts ${qt5::cache} "  QMAKE_LFLAGS+=-arch x86_64"
135        puts ${qt5::cache} "} else {"
136        puts ${qt5::cache} "  QT_ARCH=i386"
137        puts ${qt5::cache} "  QT_TARGET_ARCH=i386"
138        puts ${qt5::cache} "}"
139        # override QMAKE_MACOSX_DEPLOYMENT_TARGET set in ${prefix}/libexec/qt5/mkspecs/macx-clang/qmake.conf
140        # see #50249
141        puts ${qt5::cache} "QMAKE_MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}"
142        # respect configure.sdkroot if it exists
143        if {${configure.sdkroot} ne ""} {
144            puts ${qt5::cache} \
145                QMAKE_MAC_SDK=[string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]]
146        }
147    }
148    # respect configure.compiler but still allow qmake to find correct Xcode clang based on SDK
149    if { ${configure.compiler} ne "clang" } {
150        puts ${qt5::cache} "QMAKE_CC=${configure.cc}"
151        puts ${qt5::cache} "QMAKE_CXX=${configure.cxx}"
152        puts ${qt5::cache} "QMAKE_LINK_C=${configure.cc}"
153        puts ${qt5::cache} "QMAKE_LINK_C_SHLIB=${configure.cc}"
154        puts ${qt5::cache} "QMAKE_LINK=${configure.cxx}"
155        puts ${qt5::cache} "QMAKE_LINK_SHLIB=${configure.cxx}"
156    }
157
158    set qt5::qt_version [qt5.active_version]
159
160    if {${configure.cxx_stdlib} ne ""} {
161        # only use cxx_stdlib when it is actually set and not equal to libc++ already.
162        if { [vercmp ${qt5::qt_version} 5.6.0] >= 0 } {
163            if { ${configure.cxx_stdlib} ne "libc++" } {
164                # override C++ flags set in ${prefix}/libexec/qt5/mkspecs/common/clang-mac.conf
165                #    so value of ${configure.cxx_stdlib} can always be used
166                puts ${qt5::cache} QMAKE_CXXFLAGS-=-stdlib=libc++
167                puts ${qt5::cache} QMAKE_LFLAGS-=-stdlib=libc++
168                puts ${qt5::cache} QMAKE_CXXFLAGS+=-stdlib=${configure.cxx_stdlib}
169                puts ${qt5::cache} QMAKE_LFLAGS+=-stdlib=${configure.cxx_stdlib}
170            }
171        } else {
172            # always use the same standard library
173            puts ${qt5::cache} QMAKE_CXXFLAGS+=-stdlib=${configure.cxx_stdlib}
174            puts ${qt5::cache} QMAKE_LFLAGS+=-stdlib=${configure.cxx_stdlib}
175        }
176    }
177
178    close ${qt5::cache}
179}
180
181# 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;