Ticket #50966: qt5-1.0.tcl

File qt5-1.0.tcl, 5.4 KB (added by RJVB (René Bertin), 8 years ago)
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#
40# or
41#
42# set qt5.prefer_kde    1
43# PortGroup             qt5 1.0
44
45# Check what Qt5 installation flavour already exists, or if not if the port calling us
46# indicated a preference. If not, use the default/mainstream port:qt5 .
47if {[file exists ${prefix}/include/qt5/QtCore/QtCore]
48        && ![info exists qt5.prefer_default]} {
49    # Qt5 has been installed through port:qt5-kde and is not the be reinstalled the other way
50    ui_debug "Qt5 is provided by port:qt5-kde"
51    PortGroup   qt5-kde 1.0
52    set qt5.using_kde   yes
53} elseif {[file exists ${prefix}/libexec/qt5/plugins]
54        && [file type ${prefix}/libexec/qt5/plugins] eq "directory"} {
55    # Qt5 has been installed through port:qt5 and is not to be reinstalled the other way
56    ui_debug "Qt5 is provided by port:qt5"
57    PortGroup   qt5-mac 1.0
58    set qt5.using_kde   no
59    if {[info exists qt5.prefer_kde] && [info exists building_qt5]} {
60        ui_error "You cannot install a Qt5-KDE port with port:qt5 or one of its subports installed!"
61        pre-fetch {
62            return -code error "Deactivate the conflicting port:qt5 (subports) first!"
63        }
64        pre-configure {
65            return -code error "Deactivate the conflicting port:qt5 (subports) first!"
66        }
67    }
68} elseif {[info exists qt5.prefer_kde]} {
69    # The calling port has indicated a preference and no Qt5 port is installed already
70    ui_debug "Qt5 will be provided by port:qt5-kde, by request"
71    PortGroup   qt5-kde 1.0
72    set qt5.using_kde   yes
73} else {
74    # default fall-back to mainstream port:qt5
75    ui_debug "Qt5 will be provided by port:qt5 (default)"
76    PortGroup   qt5-mac 1.0
77    set qt5.using_kde   no
78}
79
80if {!${qt5.using_kde} && [info exists qt5.prefer_kde]} {
81    # this is a port that prefers port:qt5-kde and thus expects most of Qt5 to be installed
82    # through that single port rather than enumerate all components it depends on.
83    depends_lib-append  port:qt5
84}
85
86proc qt_branch {} {
87    global version
88    return [join [lrange [split ${version} .] 0 1] .]
89}
90
91# a procedure for declaring dependencies on Qt5 components, which will expand them
92# into the appropriate subports for the Qt5 flavour installed
93# e.g. qt5.depends_component qtbase qtsvg qtdeclarative
94proc qt5.depends_component {first args} {
95    global qt5_component_lib
96    global qt5.using_kde
97    # join ${first} and (the optional) ${args}
98    set args [linsert $args[set list {}] 0 ${first}]
99    # select the Qt5 port prefix, depending on which Qt5 port is installed
100    if {${qt5.using_kde}} {
101        set qt5pprefix "qt5-kde"
102    } else {
103        set qt5pprefix "qt5"
104    }
105    foreach comp ${args} {
106        if {${comp} eq "qt5"} {
107            if {${qt5.using_kde}} {
108                global qt5_dependency
109                # qt5-kde-1.0.tcl exports the dependency expression in a variable
110                depends_lib-append ${qt5_dependency}
111            } else {
112                depends_lib-append port:${qt5pprefix}
113            }
114        } else {
115            set portname "${qt5pprefix}-${comp}"
116            if {[info exists qt5_component_lib] && [info exists qt5_component_lib(${comp})]} {
117                # an explicit dependency pattern was given, e.g. path:foo
118                depends_lib-append "$qt5_component_lib(${comp}):${portname}"
119            } else {
120                depends_lib-append port:${portname}
121            }
122        }
123    }
124}