source: trunk/dports/_resources/port1.0/group/qt4-1.0.tcl @ 97988

Last change on this file since 97988 was 97988, checked in by michaelld@…, 8 years ago

qt4 1.0 portgroup : correct +debug framework name for determining if qt4-mac was installed with +debug.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.6 KB
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: qt4-1.0.tcl 97988 2012-09-21 12:52:02Z michaelld@macports.org $
3
4# Copyright (c) 2010 The MacPorts Project
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are
9# met:
10#
11# 1. Redistributions of source code must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16# 3. Neither the name of Apple Computer, Inc. nor the names of its
17#    contributors may be used to endorse or promote products derived from
18#    this software without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31#
32#
33# This portgroup defines standard settings when using Qt4.
34#
35# Usage:
36# PortGroup     qt4 1.0
37
38# check for +debug variant of this port, and make sure Qt was
39# installed with +debug as well; if not, error out.
40platform darwin {
41    pre-extract {
42        if {[variant_exists debug] && \
43            [variant_isset debug] && \
44           ![info exists building_qt4]} {
45            if {![file exists ${qt_frameworks_dir}/QtCore.framework/QtCore_debug]} {
46                return -code error "\n\nERROR:\n\
47In order to install this port as +debug,
48Qt4 must also be installed with +debug.\n"
49            }
50        }
51    }
52}
53
54# standard Qt4 name
55global qt_name
56set qt_name             qt4
57
58# standard install directory
59global qt_dir
60set qt_dir              ${prefix}
61
62# standard Qt documents directory
63global qt_docs_dir
64set qt_docs_dir         ${qt_dir}/share/doc/${qt_name}
65
66# standard Qt plugins directory
67global qt_plugins_dir
68set qt_plugins_dir      ${qt_dir}/share/${qt_name}/plugins
69
70# standard Qt mkspecs directory
71global qt_mkspecs_dir
72set qt_mkspecs_dir      ${qt_dir}/share/${qt_name}/mkspecs
73
74# standard Qt imports directory
75global qt_imports_dir
76set qt_imports_dir      ${qt_dir}/share/${qt_name}/imports
77
78# standard Qt includes directory
79global qt_includes_dir
80set qt_includes_dir     ${qt_dir}/include
81
82# standard Qt libraries directory
83global qt_libs_dir
84set qt_libs_dir         ${qt_dir}/lib
85
86# standard Qt libraries directory
87global qt_frameworks_dir
88set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
89
90# standard Qt non-.app executables directory
91global qt_bins_dir
92set qt_bins_dir         ${qt_dir}/bin
93
94# standard Qt .app executables directory, if created
95global qt_apps_dir
96set qt_apps_dir         ${applications_dir}/Qt4
97
98# standard Qt data directory
99global qt_data_dir
100set qt_data_dir         ${qt_dir}/share/${qt_name}
101
102# standard Qt translations directory
103global qt_translations_dir
104set qt_translations_dir ${qt_dir}/share/${qt_name}/translations
105
106# standard Qt sysconf directory
107global qt_sysconf_dir
108set qt_sysconf_dir      ${qt_dir}/etc/${qt_name}
109
110# standard Qt examples directory
111global qt_examples_dir
112set qt_examples_dir     ${qt_dir}/share/${qt_name}/examples
113
114# standard Qt demos directory
115global qt_demos_dir
116set qt_demos_dir        ${qt_dir}/share/${qt_name}/demos
117
118# standard CMake module directory for Qt-related files
119global qt_cmake_module_dir
120set qt_cmake_module_dir ${qt_dir}/share/cmake/modules
121
122# standard qmake command location
123global qt_qmake_cmd
124set qt_qmake_cmd        ${qt_dir}/bin/qmake
125
126# standard qmake spec
127global qt_qmake_spec
128set qt_qmake_spec       macx-g++
129
130# standard moc command location
131global qt_moc_cmd
132set qt_moc_cmd          ${qt_dir}/bin/moc
133
134# standard uic command location
135global qt_uic_cmd
136set qt_uic_cmd          ${qt_dir}/bin/uic
137
138# standard lrelease command location
139global qt_lrelease_cmd
140set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
141
142# standard PKGCONFIG path
143global qt_pkg_config_dir
144set qt_pkg_config_dir   ${qt_libs_dir}/pkgconfig
145
146# standard cmake info for Qt4
147global qt_cmake_defines
148set qt_cmake_defines    \
149    "-DQT_QT_INCLUDE_DIR=${qt_includes_dir} \
150     -DQT_QMAKESPEC=${qt_qmake_spec} \
151     -DQT_ZLIB_LIBRARY=${prefix}/lib/libz.dylib \
152     -DQT_PNG_LIBRARY=${prefix}/lib/libpng.dylib"
153
154# set Qt understood arch types, based on user preference
155options qt_arch_types
156default qt_arch_types {[string map {i386 x86} [get_canonical_archs]]}
157
158# allow for depending on either qt4-mac and qt4-mac-devel, simultaneously
159
160if {![info exists building_qt4]} {
161    if {${os.platform} == "darwin"} {
162
163        # see if the framework install exists, and if so depend on it;
164        # if not, depend on the library version
165
166        if {[file exists ${qt_frameworks_dir}/QtCore/QtCore]} {
167            depends_lib-append path:Library/Frameworks/QtCore/QtCore:qt4-mac
168        } else {
169            depends_lib-append path:lib/libQtCore.4.dylib:qt4-mac
170        }
171
172    } else {
173        depends_lib-append      path:lib/libQtCore.so.4:qt4-x11
174    }
175}
176
177# standard configure environment, when not building qt4
178
179if {![info exists building_qt4]} {
180    configure.env-append \
181        QTDIR=${qt_dir} \
182        QMAKE=${qt_qmake_cmd} \
183        QMAKESPEC=${qt_qmake_spec} \
184        MOC=${qt_moc_cmd}
185
186    # make sure the Qt binaries' directory is in the path, if it is
187    # not the current prefix
188
189    if {${qt_dir} != ${prefix}} {
190        configure.env-append PATH=${qt_dir}/bin:$env(PATH)
191    }
192} else {
193    configure.env-append QMAKE_NO_DEFAULTS=""
194}
195
196# standard build environment, when not building qt4
197
198if {![info exists building_qt4]} {
199    build.env-append \
200        QTDIR=${qt_dir} \
201        QMAKE=${qt_qmake_cmd} \
202        QMAKESPEC=${qt_qmake_spec} \
203        MOC=${qt_moc_cmd}
204
205    # make sure the Qt binaries' directory is in the path, if it is
206    # not the current prefix
207
208    if {${qt_dir} != ${prefix}} {
209        build.env-append    PATH=${qt_dir}/bin:$env(PATH)
210    }
211} else {
212    build.env-append QMAKE_NO_DEFAULTS=""
213}
214
215# use PKGCONFIG for Qt discovery in configure scripts
216depends_build-append    port:pkgconfig
217
218# standard destroot environment
219
220destroot.env-append \
221    INSTALL_ROOT=${destroot} \
222    DESTDIR=${destroot}
223
224# standard destroot environment, when not building qt4
225
226if {![info exists building_qt4]} {
227    destroot.env-append \
228        QTDIR=${qt_dir} \
229        QMAKE=${qt_qmake_cmd} \
230        QMAKESPEC=${qt_qmake_spec} \
231        MOC=${qt_moc_cmd}
232
233    # make sure the Qt binaries' directory is in the path, if it is
234    # not the current prefix
235
236    if {${qt_dir} != ${prefix}} {
237        destroot.env-append PATH=${qt_dir}/bin:$env(PATH)
238    }
239} else {
240    destroot.env-append QMAKE_NO_DEFAULTS=""
241}
242
243# append Qt's PKGCONFIG path to whatever is there now.
244set qt_pkg_config_path ${qt_pkg_config_dir}
245if {${qt_dir} != ${prefix}} {
246    set qt_pkg_config_path ${pkg_config_path}:${prefix}/lib/pkgconfig
247}
248if {${configure.pkg_config_path} == ""} {
249    configure.pkg_config_path ${qt_pkg_config_path}
250} else {
251    configure.pkg_config_path ${qt_pkg_config_path}:${configure.pkg_config_path}
252}
253unset qt_pkg_config_path
Note: See TracBrowser for help on using the repository browser.