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

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

qt4-mac :

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