source: trunk/dports/aqua/qt4-mac/Portfile @ 97950

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

qt4-mac :

  • bump to 4.8.3_0;
  • disable +framework variant; always install as framework, and use symlinks to populate libraries and headers into ${prefix}/lib and ${prefix}/include;
  • correct patches to work with new version;
  • remove old 10.8 patchfile, and replace with the single remaining patch needed for linking corelib;
  • install private headers for some Qt modules to allow other ports to work fully (e.g., qt4-creator-mac).
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 28.6 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: Portfile 97950 2012-09-20 19:39:52Z michaelld@macports.org $
3
4PortSystem          1.0
5
6# use the qt4 group; set 'building_qt4' so that the portgroup
7# does not include certain parts
8set building_qt4    1
9PortGroup           qt4 1.0
10PortGroup           xcodeversion 1.0
11
12name                qt4-mac
13conflicts           qt3 qt3-mac qt4-mac-devel
14version             4.8.3
15categories          aqua
16platforms           macosx
17maintainers         michaelld openmaintainer
18license             {LGPL-2.1 GPL-3}
19
20homepage            http://qt.nokia.com/
21description         Qt Tool Kit
22long_description    Qt Tool Kit: A cross-platform framework \
23                    (headers, data, and libraries) for writing \
24                    cross-platform GUI-based applications.
25
26master_sites        trolltech
27distname            qt-everywhere-opensource-src-${version}
28
29checksums           sha1    bc352a283610e0cd2fe0dbedbc45613844090fcb \
30                    rmd160  fe56e5da874503a79d6f84a1e15460eba5a6feae
31
32minimum_xcodeversions   {8 2.5}
33
34depends_lib-append  port:zlib path:bin/dbus-daemon:dbus \
35                    port:openssl port:sqlite3 port:tiff \
36                    port:libpng port:libmng port:jpeg
37
38###############################################
39# Patches are used to both fix compiling on various OS versions, and
40# to enhance the functionality of QMake and its build files.  Some of
41# these patches are 2-stage: use a file here, and the replace an
42# @VARIABLE@ in post-patch.  There are LOTS of patches, because Qt is
43# a large, complicated system.
44
45# (0) Fix the testing script to properly handle both +universal as
46# well as the native arch for both CXX and CC compiling; also make
47# sure it does not create a Mac app bundle.
48
49patchfiles-append   patch-config.tests_unix_compile.test.diff
50
51# (1) Test for Precompiled-headers support (a) requires a C++
52# compiler, but configure calls it, by default, with a C compiler;
53# thus, enable testing using the C compiler. (b) to work with ccache,
54# if used.
55
56patchfiles-append   patch-config.tests_unix_precomp.test.diff
57
58# (2) fix 'configure' script: (a) to allow easy replacement of arch
59# type(s). (b) to find the correct QMAKE CXX compiler by removing
60# possibilities that include the character "$". (c) to declare, use,
61# and set QT_INSTALL_FRAMEWORKS and QMAKE_FRAMEWORKDIR_QT, both here
62# and in the resulting .qmake.cache files. (d) to allow easy
63# replacement of MACOSX_DEPLOYMENT_TARGET: build for just the user's
64# current OS.
65
66patchfiles-append   patch-configure.diff
67
68# (3) Tweak various scripts to allow easy replacement of
69# MACOSX_DEPLOYMENT_TARGET: build for just the user's current OS.
70
71patchfiles-append   patch-mkspecs_common_g++-macx.conf.diff
72
73# (4) (a) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build
74# for just the user's current OS; (b) allow QMake to use 'ccache' via,
75# e.g., "qmake && make CCACHE=ccache".
76
77patchfiles-append   patch-mkspecs_common_mac.conf.diff
78
79# (5) Place the -I path for local moc-created headers -before-
80# all other -I paths.
81
82patchfiles-append   patch-mkspecs_features_moc.prf.diff
83
84# (6) Remove Qt's LIBDIR and INCDIR from various Qmake internal
85# variables, since they are already included in the user-supplied
86# LIBS and INCLUDEPATH.
87
88patchfiles-append   patch-mkspecs_features_qt.prf.diff
89
90# (7) (a) Change placement of Qt's LIBDIR and INCDIR, to always be
91# after those supplied by the user's QMake (.pro) files.  By the time
92# QMake gets to the patched function, it is creating the Makefile
93# parts to find Qt's headers and libraries, so moving these paths to
94# this location should always work. (b) If the library is QtWebKit,
95# and the build is library (no-framework), universal, and debug, then
96# the linkage is just -lQtWebKit, not -lQtWebKit_debug because the
97# debug library for 32-bit system cannot be created (too large).
98
99patchfiles-append   patch-mkspecs_features_qt_functions.prf.diff
100
101# (8) Add "absolute_library_soname" to the default CONFIG variables,
102# so that when a DYLIB is created, if "target.path" is set for it then
103# that path is prepended to its "install_name".
104
105patchfiles-append   patch-mkspecs_macx-g++_qmake.conf.diff
106
107# (9) Add QT_INSTALL_FRAMEWORKS and related variables to QMake, to
108# provide a default variable for the location of QMake installed
109# frameworks.
110
111patchfiles-append   \
112    patch-qmake_option.h.diff \
113    patch-qmake_property.cpp.diff \
114    patch-src_corelib_global_qlibraryinfo.cpp.diff \
115    patch-src_corelib_global_qlibraryinfo.h.diff
116
117# (10) In QMake, disable default MKSPECS and FEATURES path
118# concatinations if the shell environment variable QMAKE_NO_DEFAULTS
119# is set (to anything); we use this variable in this portfile to make
120# sure only internal paths (to the build) are searched by QMake.
121
122patchfiles-append   patch-qmake_project.cpp.diff
123
124# (11) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build for
125# just the user's current OS.
126
127patchfiles-append   \
128    patch-qmake_qmake.pri.diff \
129    patch-src_tools_bootstrap_bootstrap.pro.diff
130
131# (12) fix compiling of MediaPlayerPrivateQTKit.mm for 10.5; does not
132# hurt others
133
134patchfiles-append   patch-src_3rdparty_webkit_Source_WebCore_platform_graphics_mac_MediaPlayerPrivateQTKit.mm.diff
135
136# (13) fix use of CARBON, found on PPC64; does not hurt others
137
138patchfiles-append   \
139    patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff \
140    patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff
141
142# (14) fix MKSPECS install location for WebKit; fix WebCore to handle
143# 32-bit compiling correctly on x86 and ppc
144
145patchfiles-append   \
146    patch-src_3rdparty_webkit_Source_WebKit_qt_QtWebKit.pro.diff
147
148# (15) fix the corewlan qmake file to use non-standard Developer SDK
149# location under 10.6 and newer, e.g., for some developers doing both
150# iOS and OSX.  This patch does not change behavior for 10.4 or 10.5.
151# Also include fix to use the correct SDK.
152
153patchfiles-append   patch-src_plugins_bearer_corewlan_corewlan.pro.diff
154
155# (16) fix the corewlan source to work under 10.7
156
157patchfiles-append   patch-src_plugins_bearer_corewlan_qcorewlanengine.mm.diff
158
159# (17) Use the "target.path" for libdir for core libraries instead of
160# the standard QT_INSTALL_LIBS; allows us to set for library or
161# framework elsewhere and have the install still work here.
162
163patchfiles-append   patch-src_qbase.pri.diff
164
165# (18) (a) Disable explicit disabling of framework or static install;
166# i.e., install as a framework if that mode is selected, and as
167# library otherwise. (b) If installing as framework, use the new
168# QT_INSTALL_FRAMEWORKS directory; otherwise, use the old
169# QT_INSTALL_LIBS; (c) Get PKGCONFIG dependencies correct, hopefully;
170# (d) create and install .pc, .la, and .prl library description files,
171# including basic path replacement into DESTDIR; we couple this with a
172# post-patch to get the correct install location.
173
174patchfiles-append   \
175    patch-src_qt_install.pri.diff \
176    patch-tools_assistant_lib_fulltextsearch_fulltextsearch.pro.diff \
177    patch-tools_assistant_lib_lib.pro.diff \
178    patch-tools_designer_src_components_lib_lib.pro.diff \
179    patch-tools_designer_src_lib_lib.pro.diff \
180    patch-tools_designer_src_uitools_uitools.pro.diff \
181    patch-mkspecs_features_uitools.prf.diff
182
183# (19) fix 'macdeployqt' to look for the correct plugins location by
184# default.  This is paired with a "reinplace" in post-patch
185
186patchfiles-append   \
187    patch-tools_macdeployqt_macdeployqt_main.cpp.diff
188
189# (20) Under 10.4 only: patch QMake build files using just "-lQtHelp"
190# to do "-lQtHelp -lQtCLucene -lQtNetwork -lQtWebKit" instead.  For
191# some reason 10.5+ "knows" that how to do this correctly.
192
193platform darwin 8 {
194    patchfiles-append patch-QtHelp_10.4_only.diff
195}
196
197# (21) fix the Mac timer's use of "mach_timebase_info"
198
199patchfiles-append   \
200    patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff
201
202# (22) fix WebCore to handle 32-bit compiling correctly on x86 and ppc
203
204patchfiles-append   \
205    patch-src_3rdparty_webkit_Source_WebCore_WebCore.pro.diff
206
207# (23) Under 10.8 only: Patch to fix corelib linking
208
209platform darwin 12 {
210    patchfiles-append patch-src_corelib_corelib.pro.diff
211}
212
213# (24) fix Framework directory in MacDeployQt tool
214
215patchfiles-append   \
216    patch-tools_macdeployqt_shared_shared.cpp.diff
217
218###############################################
219
220# disable CCACHE for now (ticket #34856)
221
222configure.ccache no
223
224# create the global for the psql version, if selected
225
226global psql_version
227set psql_version ""
228
229# find a way to specify the OS MINOR version.
230global MINOR
231set MINOR ""
232
233# hopefully the macosx_deployment_target exists and is set by now.  if
234# not, last resort (which is not desirable) is to use the os.version.
235if {${macosx_deployment_target} != ""} {
236    set MINOR [lindex [split ${macosx_deployment_target} "."] 1]
237} else {
238    set MINOR [expr [lindex [split ${os.version} "."] 0] - 4]
239}
240
241# find a way to specify the SDK to use; Qt will use the 10.4u by
242# default which won't work on 10.6 since it is not supported.  Allow
243# the user to specify the SDK if desired.
244
245global SDK
246set SDK ${configure.sdkroot}
247if {${SDK} == ""} {
248    # set SDK version depending on OS version
249    set sdk_version ""
250    if {${MINOR} == "4"} {
251        # OSX 10.4 requires an additional 'u'
252        set sdk_version "10.4u"
253    } else {
254        set sdk_version "10.${MINOR}"
255    }
256    if {[vercmp ${xcodeversion} 4.3] < 0} {
257        set SDK ${developer_dir}/SDKs/MacOSX${sdk_version}.sdk
258    } else {
259        set SDK ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${sdk_version}.sdk
260    }
261}
262
263post-patch {
264    # set ARCHES in configure (per the third patchfile above), for
265    # building QMake.  join any 2 or more arch entries with the GCC
266    # arch flag (join does not effect a single entry).  first "-arch"
267    # is already in place in the 'configure' script (since there has
268    # to be at least 1 arch).
269    set ARCHES ""
270    if {[variant_exists universal] && [variant_isset universal]} {
271        set ARCHES [join ${universal_archs} " -arch "]
272    } else {
273        set ARCHES ${build_arch}
274    }
275    reinplace "s|@ARCHES@|${ARCHES}|g" ${worksrcpath}/configure
276
277    # set MACOSX_DEPLOYMENT_TARGET version in various places.  These
278    # were all patched in (2) above, and can be easily changed or
279    # overridden by the user in a project-local qmake .pro script.
280    set TARGET "10.${MINOR}"
281    foreach fixfile {configure mkspecs/common/g++-macx.conf \
282                     mkspecs/common/mac.conf qmake/qmake.pri \
283                     src/tools/bootstrap/bootstrap.pro } {
284        reinplace "s|@MACOSX_DEPLOYMENT_TARGET@|${TARGET}|g" \
285            ${worksrcpath}/${fixfile}
286    }
287
288    # Fix OS version on Bearer CoreWLAN QMake file
289    reinplace "s|@MACOSX_VERSION_MINOR@|${MINOR}|g" \
290        ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
291
292    # Ensure that correct C/C++ compilers are used.
293
294    reinplace "s| g++\$| ${configure.cxx}|" \
295        ${worksrcpath}/mkspecs/common/g++-base.conf
296    reinplace "s| gcc\$| ${configure.cc}|"  \
297        ${worksrcpath}/mkspecs/common/g++-base.conf
298
299    # fix the corewlan .pro file to use the correct developer SDK
300
301    reinplace "s,@DEVELOPER_SDK@,${SDK},g" \
302        ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
303
304    # fix 'macdeployqt' to look for the correct plugins location by default.
305
306    reinplace "s,@QT_PLUGINS_DIR@,${qt_plugins_dir},g" \
307        ${worksrcpath}/tools/macdeployqt/macdeployqt/main.cpp
308
309    # fix path to "pg_config", if the variant was selected
310
311    if {${psql_version} != ""} {
312        reinplace "s,@PATH_TO_PG_CONFIG@,${prefix}/lib/postgresql${psql_version}/bin/,g" ${worksrcpath}/configure
313    }
314
315    # if no debug, then do not even build debug code
316
317    if {![variant_isset debug]} {
318        foreach fixfile { src/qbase.pri \
319                          src/3rdparty/webkit/Source/WebKit.pri \
320                          src/imports/qimportbase.pri \
321                          src/plugins/qpluginbase.pri \
322                          tools/designer/src/components/lib/lib.pro \
323                          tools/designer/src/lib/lib.pro \
324                          tools/designer/src/plugins/activeqt/activeqt.pro \
325                          tools/designer/src/plugins/plugins.pri \
326                          tools/designer/src/uitools/uitools.pro \
327                          src/3rdparty/webkit/Source/WebKit/qt/declarative/declarative.pro } {
328            reinplace "/+=/s@debug_and_release@@g" \
329                ${worksrcpath}/${fixfile}
330        }
331    }
332}
333
334# The build process uses -fconstant-cfstrings.
335# configure.compiler should therefore not be one of the MacPorts compilers.
336
337# does not work with clang, see #30271 and #31638 .
338if {${configure.compiler} == "clang"} {
339    configure.compiler llvm-gcc-4.2
340}
341
342# --prefix is not recognized.
343configure.pre_args-delete       --prefix=${prefix}
344
345# --disable-dependency-tracking is not recognized.
346configure.universal_args-delete --disable-dependency-tracking
347
348################################################################################
349# We do not want flags of any kind -- QT is smart enough to set up its own.    #
350################################################################################
351
352configure.cflags
353configure.cppflags
354configure.cxxflags
355configure.ldflags
356
357configure.universal_cflags
358configure.universal_cppflags
359configure.universal_cxxflags
360configure.universal_ldflags
361
362configure.cc_archflags
363configure.cxx_archflags
364configure.ld_archflags
365
366#  use compiler.cpath and compiler.library_path, as per
367#  http://trac.macports.org/ticket/25321 for all -I and -L entries,
368#  so-as to avoid conflicts with already-installed headers and
369#  libraries (giving preference to internal-to-this-port first)
370#
371#  CPATH is used instead of -I to avoid conflicts with other ports.
372#  See http://trac.macports.org/ticket/15219 and
373#  http://trac.macports.org/ticket/18723.
374#
375#  set the default paths to include those for SQLITE3 and DBUS-1
376
377set header_path [ list ${prefix}/include/dbus-1.0 \
378                       ${prefix}/lib/dbus-1.0/include \
379                       ${prefix}/include ]
380
381set library_path [ list ${prefix}/lib ]
382
383# -system-sqlite ensures the use SQLite provided by MacPorts instead of Qt.
384#
385# -dbus-linked prevends qt4 from trying to dynamically load libdbus-1,
386#     which it is not able to find in ${prefix}.
387#
388# -openssl-linked ensures that the MacPorts openssl is used.
389#
390# -framework ensures that this port is installed as frameworks
391#     (collections of {library, headers, resources}); in
392#     post-destroot, link headers and libraries from the frameworks
393#     into non-framework locations as if "-no-framework" were
394#     specified.  Some dependent projects will not work properly if Qt
395#     is installed as libraries by default, thus make it so #1.
396#
397# -no-phonon ensures that Qt does not install the 3rd-parth Phonon
398#     port or its backend to QuickTime 7; Phonon is now installed via
399#     the 'phonon' port, which is more up to date than that provided
400#     by Qt.
401
402configure.args                                            \
403    -v                                                    \
404    -confirm-license                                      \
405    -opensource                                           \
406    -prefix          ${qt_dir}                            \
407    -bindir          ${qt_bins_dir}                       \
408    -libdir          ${qt_libs_dir}                       \
409    -docdir          ${qt_docs_dir}                       \
410    -headerdir       ${qt_includes_dir}                   \
411    -plugindir       ${qt_plugins_dir}                    \
412    -importdir       ${qt_imports_dir}                    \
413    -datadir         ${qt_data_dir}                       \
414    -translationdir  ${qt_translations_dir}               \
415    -sysconfdir      ${qt_sysconf_dir}                    \
416    -examplesdir     ${qt_examples_dir}                   \
417    -demosdir        ${qt_demos_dir}                      \
418    -system-sqlite                                        \
419    -openssl-linked                                       \
420    -dbus-linked                                          \
421    -fast                                                 \
422    -optimized-qmake                                      \
423    -framework                                            \
424    -no-phonon                                            \
425    -no-phonon-backend
426
427# Stop configure script from searching for SQL Drivers
428#    not available from MacPorts.
429foreach driver {db2 ibase oci tds} {
430    configure.args-append -no-sql-${driver}
431}
432
433# By default, disable most SQL Drivers.
434# There must be at least one enabled (http://trac.macports.org/ticket/15627).
435# SQLite is chosen to be always enabled because a copy of it is distributed
436#    with Qt, so it is reasonable for the user to expect it.
437foreach driver {mysql odbc psql sqlite2} {
438    configure.args-append -no-sql-${driver}
439}
440
441pre-configure {
442    # use the corrected CPATH and LIBRARY_PATH for build
443    compiler.cpath [join ${header_path} :]
444    compiler.library_path [join ${library_path} :]
445
446    # for 10.4 or 10.5 32-bit PPC, build as Carbon only, not Cocoa
447
448    if {${MINOR} == "4"} {
449
450        configure.args-append -carbon
451
452        # required linking flags?
453
454        configure.ldflags-append -lcrypto -ldbus-1 -ljpeg -llcms \
455            -lsqlite3 -lssl -lz
456
457    } elseif {${MINOR} == "5" &&
458              [llength ${qt_arch_types}] == 1 &&
459              [lsearch -exact ${qt_arch_types} ppc] == 0} {
460
461        configure.args-append -carbon
462
463    }
464
465    # set the arch type(s) to use, in Qt-speak
466
467    configure.args-append -arch \"${qt_arch_types}\"
468
469    # cannot use pre-compiled headers when compiling with more than 1
470    # arch type (typically +universal) or for X11
471
472    #if {[llength ${qt_arch_types}] != 1 || [variant_isset x11]}
473
474    if {[llength ${qt_arch_types}] != 1} {
475        configure.args-append -no-pch
476    } else {
477        configure.args-append -pch
478    }
479
480    # check to see if not compiling for the native machine hardware
481    # (e.g., compiling for just i386 but CPU is x86_64); optimization
482    # of QMake does not work in this circumstance.
483
484    if {[lsearch -exact ${qt_arch_types} ${os.arch}] == -1} {
485
486        # not building for native arch: disable optimizing qmake
487        configure.args-delete -optimized-qmake
488
489    } elseif {${MINOR} == "6" &&
490              [llength ${qt_arch_types}] == 1 &&
491              [lsearch -exact ${qt_arch_types} x86] == 0} {
492
493        # disable qmake optimization on 10.6 32-bit
494        configure.args-delete -optimized-qmake
495
496    }
497
498    # set the SDK, if it was found and exists
499
500    if {[file exists ${SDK}]} {
501        configure.args-append -sdk ${SDK}
502    }
503}
504
505post-configure {
506
507    # Remove any '-I' and '-L' string from the *FLAGS for SQLITE,
508    # DBUS, ODBC, and OPENSSL, so that what remains are just non-I/L
509    # flags; these paths are in compiler.cpath and
510    # compiler.library_path.  The header and library paths for all the
511    # other variants are not used by 'configure', and are already
512    # included in the compiler.cpath and compiler.library_path
513    # . during the 'build' stage, 'make' will rebuild the Makefiles
514    # that depend on any of these changed files.  These patches are
515    # sufficient to make sure local (to this build) paths are searched
516    # first, and then system paths last (via the compiler.X settings).
517    # Ideally, 'qmake' -- either via its mkspecs files or the
518    # project's build files -- would distinguish between "local" and
519    # "system" includes & libraries.
520
521    # SQLITE
522    reinplace "/SQLITE/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
523        ${worksrcpath}/.qmake.cache
524    reinplace "/SQLITE/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
525        ${worksrcpath}/.qmake.cache
526    # DBUS
527    reinplace "/DBUS/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
528        ${worksrcpath}/.qmake.cache
529    reinplace "/DBUS/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
530        ${worksrcpath}/.qmake.cache
531    # OPENSSL
532    reinplace "/OPENSSL/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
533        ${worksrcpath}/.qmake.cache
534    reinplace "/OPENSSL/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
535        ${worksrcpath}/.qmake.cache
536    # ODBC
537    reinplace "/ODBC/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
538        ${worksrcpath}/.qmake.cache
539    reinplace "/ODBC/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
540        ${worksrcpath}/.qmake.cache
541}
542
543pre-build {
544    # use the corrected CPATH and LIBRARY_PATH for build
545    compiler.cpath [join ${header_path} :]
546    compiler.library_path [join ${library_path} :]
547}
548
549build.target all
550
551post-destroot {
552    set destroot_qt ${destroot}${qt_dir}
553
554    # Fix .pc and .prl files by changing ${worksrcpath}\${prefix} to
555    # ${qt_dir}\${prefix} ("\" means 'take away').  Cannot use
556    # "find -E" since it is not necessarily portable.
557    regsub ${prefix} ${worksrcpath} "" from_dir
558    regsub ${prefix} ${qt_dir} "" to_dir
559    foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
560        reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
561    }
562    foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
563        reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
564    }
565
566    # remove Libs.private from all pc files
567    foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
568        reinplace "/Libs\.private/d" ${fixfile}
569    }
570
571    # Fix .pc files to use ${prefix} correctly
572    foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
573        reinplace "s|${prefix}/|\${prefix}/|g" ${fixfile}
574    }
575
576    # remove -L entries from .prl, and .la files; this is a
577    # framework install, not a library install
578
579    foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
580        reinplace "/QMAKE_PRL_LIBS/s|-L\[^ \]*||g" ${fixfile}
581    }
582    foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
583        reinplace "/dependency_libs/s|-L\[^ \]*||g" ${fixfile}
584    }
585
586    # remove redundant -F${prefix}/Library/Frameworks entries
587
588    foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
589        reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*|FREPLACEME|1" \
590            ${fixfile}
591        reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*||g" ${fixfile}
592        reinplace "s|FREPLACEME|-F${prefix}/Library/Frameworks|1" \
593            ${fixfile}
594    }
595    foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
596        reinplace "/dependency_libs/s|-F\[^ \]*|FREPLACEME|1" \
597            ${fixfile}
598        reinplace "/dependency_libs/s|-F\[^ \]*||g" ${fixfile}
599        reinplace "s|FREPLACEME|-F${prefix}/Library/Frameworks|1" \
600            ${fixfile}
601    }
602
603    # move .pc files from ${qt_frameworks_dir}/pkgconfig to
604    # ${qt_pkg_config_dir}
605
606    file delete -force ${destroot}${qt_pkg_config_dir}
607    xinstall -m 755 -d ${destroot}${qt_libs_dir}
608    move ${destroot}${qt_frameworks_dir}/pkgconfig \
609        ${destroot}${qt_libs_dir}
610
611    # get Qt's version numbers
612
613    set qt_vers [split ${version} "."]
614    set qt_major [lindex ${qt_vers} 0]
615    set qt_minor [lindex ${qt_vers} 1]
616    set qt_patch [lindex ${qt_vers} 2]
617
618    # link includes and libraries for each actual installed framework
619
620    foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
621                         -name "*.framework" | \
622                         sed -e "s@${destroot}@@g"] {
623
624        set tf_full [strsed ${fixfile} {s@\\.framework@@}]
625        set tf [strsed ${tf_full} {g@.*\/@@}]
626
627        # link headers into ${qt_includes_dir}, removing directories
628        # if they are already there first
629
630        set inc_file ${destroot}${qt_includes_dir}/${tf}
631        if {[file exists ${inc_file}]} {
632            file delete -force ${inc_file}
633        }
634        ln -s ${tf_full}.framework/Headers ${inc_file}
635
636        # link libraries into ${qt_libs_dir}, all 4 number variants as
637        # well as the .prl and .la files
638
639        set libs_dir ${destroot}${qt_libs_dir}
640
641        ln -s ${tf_full}.framework/${tf}.prl ${libs_dir}/lib${tf}.prl
642        ln -s ${tf_full}.la ${libs_dir}/lib${tf}.la
643        ln -s ${tf_full}.framework/${tf} ${libs_dir}/lib${tf}.dylib
644        ln -s ${tf_full}.framework/${tf} ${libs_dir}/lib${tf}.${qt_major}.dylib
645        ln -s ${tf_full}.framework/${tf} ${libs_dir}/lib${tf}.${qt_major}.${qt_minor}.dylib
646        ln -s ${tf_full}.framework/${tf} ${libs_dir}/lib${tf}.${qt_major}.${qt_minor}.${qt_patch}.dylib
647
648    }
649
650    # Install documentation.
651
652    xinstall -m 755 -d ${worksrcpath}/${qt_docs_dir}
653    xinstall -m 644 -W ${worksrcpath} \
654        INSTALL LGPL_EXCEPTION.txt LICENSE.FDL \
655        LICENSE.GPL3 LICENSE.LGPL README \
656        ${destroot}${qt_docs_dir}
657
658    # Install private headers needed by QtCreator
659
660    foreach {src_dir include_dir} \
661    {corelib QtCore gui QtGui script QtScript declarative QtDeclarative} {
662        set dest_dir ${destroot}${qt_frameworks_dir}/${include_dir}.framework/Headers/private
663        xinstall -m 755 -d ${dest_dir}
664        set files [exec find ${worksrcpath}/src/${src_dir} -type f -name "*_p.h"]
665        eval xinstall -m 644 [split ${files}] ${dest_dir}
666    }
667
668    # Move .apps into the applications_dir
669
670    xinstall -m 755 -d ${destroot}${qt_apps_dir}
671    foreach app [glob ${destroot}/${qt_bins_dir}/*.app] {
672        move ${app} ${destroot}${qt_apps_dir}
673    }
674
675    # remove 'tests' directory
676
677    file delete -force ${destroot}${prefix}/tests
678}
679
680pre-activate {
681    # make sure 'none' is selected by qt4_select, so that there is no
682    # conflict between it and this port.
683    if {[file exists ${prefix}/bin/qt4_select]} {
684        if {[exec ${prefix}/bin/qt4_select -s] != "none"} {
685            ui_msg "Disabling 'qt4_select' selection."
686            system "exec ${prefix}/bin/qt4_select none"
687        }
688    }
689}
690
691variant framework description {Framework Legacy Compatibility Variant} {
692    ui_error "${name} variant +framework has been disabled because ${name} now installs as both libraries and frameworks.  Please install ${name} without +framework."
693    return -code error "Variant disabled"
694}
695
696variant mysql description {MySQL Qt4 Plugin Legacy Compatibility Variant} {
697    ui_error "${name} variant +mysql has been replaced by the port 'qt4-mac-mysql55-plugin' and its subports.  Please install ${name} without +mysql, then install your desired MySQL Qt plugin."
698    return -code error "Variant disabled"
699}
700
701variant odbc description {Enable iODBC SQL Driver} {
702    depends_lib-append port:libiodbc
703    configure.args-delete -no-sql-odbc
704    configure.args-append -plugin-sql-odbc
705}
706
707variant psql83 conflicts psql84 psql90 psql91 \
708description {PostgreSQL 8.3 Qt4 Plugin Legacy Compatibility Variant} {}
709
710variant psql84 conflicts psql83 psql90 psql91 \
711description {PostgreSQL 8.4 Qt4 Plugin Legacy Compatibility Variant} {}
712
713variant psql90 conflicts psql83 psql84 psql91 \
714description {PostgreSQL 9.0 Qt4 Plugin Legacy Compatibility Variant} {}
715
716variant psql91 conflicts psql83 psql84 psql90 \
717description {PostgreSQL 9.1 Qt4 Plugin Legacy Compatibility Variant} {}
718
719if {[variant_isset psql83]} {
720    set psql_version "83"
721} elseif {[variant_isset psql84]} {
722    set psql_version "84"
723} elseif {[variant_isset psql90]} {
724    set psql_version "90"
725} elseif {[variant_isset psql91]} {
726    set psql_version "91"
727}
728
729if {${psql_version} != ""} {
730    ui_error "${name} variant +psql${psql_version} has been replaced by the port 'qt4-mac-postgresql91-plugin' and its subports.  Please install ${name} without +psql${psql_version}, then install your desired PostgreSQL Qt plugin."
731    return -code error "Variant disabled"
732}
733
734variant sqlite2 description {Enable SQLite version 2 SQL Driver} {
735    depends_lib-append port:sqlite2
736    configure.args-delete -no-sql-sqlite2
737    configure.args-append -plugin-sql-sqlite2
738}
739
740variant raster description {Use raster graphics system by default} {
741    configure.args-append -graphicssystem raster
742}
743
744variant demos description {Build demos} {}
745
746if {![variant_isset demos]} {
747   configure.args-append -nomake demos
748}
749
750variant examples description {Build examples} {}
751
752if {![variant_isset examples]} {
753   configure.args-append -nomake examples
754}
755
756variant debug description {Build both release and debug library} {}
757
758if {[variant_isset debug]} {
759    configure.args-append -debug-and-release -declarative-debug
760} else {
761    configure.args-append -release -no-declarative-debug
762}
763
764#variant quartz conflicts x11
765variant quartz \
766description {Build for Native OSX Quartz GUI, not X11 (default)} {}
767
768#variant x11 conflicts quartz \
769#description {Build for X11 GUI, not Native OSX Quartz} {}
770
771# if neither +x11 or +quartz were specified, default to the latter
772#if {![variant_isset quartz] && ![variant_isset x11]} {
773    default_variants +quartz
774#}
775
776# check to see if user specified just "-quartz", which can't work.
777#if {![variant_isset quartz] && ![variant_isset x11]} {
778#    return -code error \
779#"\n\nThe variant -quartz will not work alone.
780#Please select one of +quartz or +x11 as a variant.\n"
781#}
782
783#if {[variant_isset x11]} {
784#    return -code error "\n\nVariant +x11 is not yet functional; \
785#please use +quartz for now.\n"
786#}
787
788livecheck.type      regex
789livecheck.url       http://get.qt.nokia.com/qt/source/
790livecheck.regex     "qt-everywhere-opensource-src-(\[0-9a-z.-\]+)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.