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

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

qt4-mac: require Xcode 2.5 on Tiger; see #32025

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 20.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 87272 2011-11-15 17:45:11Z ryandesign@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.7.4
15revision            1
16categories          aqua
17platforms           macosx
18maintainers         michaelld
19license             {LGPL-2.1 GPL-3}
20
21homepage            http://qt.nokia.com/
22description         Qt Tool Kit
23long_description    Qt Tool Kit: A cross-platform framework \
24                    (headers, data, and libraries) for writing \
25                    cross-platform GUI-based applications.
26
27master_sites        trolltech
28distname            qt-everywhere-opensource-src-${version}
29
30# 4.7.4 was stealth-updated; see #31252
31dist_subdir         ${name}/${version}_1
32
33checksums           md5     9831cf1dfa8d0689a06c2c54c5c65aaf \
34                    sha1    af9016aa924a577f7b06ffd28c9773b56d74c939 \
35                    rmd160  3e47b09663a89973b1c8628506c995dfc2a5387c
36
37minimum_xcodeversions   {8 2.5}
38
39depends_lib-append  port:zlib port:dbus port:openssl port:sqlite3 \
40                    port:tiff port:libpng port:libmng port:jpeg
41
42# (0) Fix the testing script to properly handle both +universal as
43# well as the native arch for both CXX and CC compiling; also make
44# sure it does not create a Mac app bundle.
45patchfiles-append   patch-config.tests_unix_compile.test.diff
46
47# (1) Test for Precompiled-headers support requires a C++ compiler,
48# but configure calls it, by default, with a C compiler.
49patchfiles-append   patch-precomp.test.diff
50
51# (2) Tweak various scripts to allow easy replacement of
52# MACOSX_DEPLOYMENT_TARGET: build for just the user's current OS.
53patchfiles-append   patch-macosx-deployment-target.diff
54
55# (3) Tweak the configure script to allow easy replacement of arch
56# type(s).  The location of this patch is dependent on patch (2), but
57# 'patch' should be able to figure it out.
58patchfiles-append   patch-configure-arch.diff
59
60# (4) Tweak Qt spec files:
61# (4a) Place the -I path for local moc-created headers -before-
62# all other -I paths.
63patchfiles-append   patch-mkspecs-features-moc.prf.diff
64
65# (4b) Remove Qt's LIBDIR and INCDIR from various Qmake internal
66# variables, since they are already included in the user-supplied
67# LIBS and INCLUDEPATH.
68patchfiles-append   patch-mkspecs-features-qt.prf.diff
69
70# (4c) Change placement of Qt's LIBDIR and INCDIR, to always be after
71# those supplied by the user's QMake (.pro) files.  By the time QMake
72# gets to the patched function, it is creating the Makefile parts to
73# find Qt's headers and libraries, so moving these paths to this
74# location should always work.
75patchfiles-append   patch-mkspecs-features-qt_functions.prf.diff
76
77# (4d) Add "absolute_library_soname" to the default CONFIG variables,
78# so that when a DYLIB is created, if "target.path" is set for it then
79# that path is prepended to its "install_name".
80patchfiles-append   patch-mkspecs-macx-g++-qmake.prf.diff
81
82# (4e) allow use of 'ccache' via "qmake && make CCACHE=ccache", in mac
83# only; this patch requires that (2) already be in place.
84patchfiles-append   patch-mkspecs_common_mac.conf.diff
85
86# (5) fix the corewlan qmake file to use non-standard Developer SDK
87# location under 10.6, e.g., for some developers doing both iOS and
88# OSX.  This patch does not change behavior for 10.4 or 10.5.
89# Also include fix to use the correct SDK.
90patchfiles-append   patch-src-plugins-bearer-corewlan-corewlan.pro.diff
91
92# (6) fix use of CARBON, found on PPC64, but will work on any system
93patchfiles-append   patch-PluginView-no-carbon.diff
94
95# (7) Allow compiling under OS X 10.7
96patchfiles-append   patch-src-corelib-global-qglobal.h.diff
97
98# (8) fix #includes for OS X 10.7 in Bearer CoreWLAN
99patchfiles-append   patch-src-plugins-bearer-corewlan-qcorewlanengine.mm.diff
100
101# (9) from Qt, blocklist bad digistor certs
102# < http://labs.qt.nokia.com/2011/09/07/ >
103patchfiles-append   patch-blacklist-diginotar-certs.diff
104
105# (10) from Qt bugs (#18346), fix shader effect item code.
106patchfiles-append   patch-src-imports-shaders-shadereffectitem.cpp.diff
107
108# find a way to specify the OS MINOR version.
109global MINOR
110set MINOR ""
111
112# hopefully the macosx_deployment_target exists and is set by now.  if
113# not, last resort (which is not desirable) is to use the os.version.
114if {${macosx_deployment_target} != ""} {
115    set MINOR [lindex [split ${macosx_deployment_target} "."] 1]
116} else {
117    set MINOR [expr [lindex [split ${os.version} "."] 0] - 4]
118}
119
120post-patch {
121    # set ARCHES in configure (per the third patchfile above), for
122    # building QMake.  join any 2 or more arch entries with the GCC
123    # arch flag (join does not effect a single entry).  first "-arch"
124    # is already in place in the 'configure' script (since there has
125    # to be at least 1 arch).
126    set ARCHES ""
127    if {[variant_exists universal] && [variant_isset universal]} {
128        set ARCHES [join ${universal_archs} " -arch "]
129    } else {
130        set ARCHES ${build_arch}
131    }
132    reinplace "s|@ARCHES@|${ARCHES}|g" ${worksrcpath}/configure
133
134    global MINOR
135
136    # set MACOSX_DEPLOYMENT_TARGET version in various places.  These
137    # were all patched in (2) above, and can be easily changed or
138    # overridden by the user in a project-local qmake .pro script.
139    set TARGET "10.${MINOR}"
140    foreach fixfile {configure mkspecs/common/mac-g++.conf \
141                     mkspecs/common/mac.conf qmake/qmake.pri \
142                     src/tools/bootstrap/bootstrap.pro } {
143        reinplace "s|@MACOSX_DEPLOYMENT_TARGET@|${TARGET}|g" \
144            ${worksrcpath}/${fixfile}
145    }
146
147    # Fix OS version on Bearer CoreWLAN QMake file
148    reinplace "s|@MACOSX_VERSION_MINOR@|${MINOR}|g" \
149        ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
150
151    # Ensure that correct C/C++ compilers are used.
152    reinplace "s| g++\$| ${configure.cxx}|" \
153        ${worksrcpath}/mkspecs/common/g++.conf
154    reinplace "s| gcc\$| ${configure.cc}|"  \
155        ${worksrcpath}/mkspecs/common/g++.conf
156    reinplace "s| g++\$| ${configure.cxx}|" \
157        ${worksrcpath}/mkspecs/macx-g++/qmake.conf
158    reinplace "s| gcc\$| ${configure.cc}|"  \
159        ${worksrcpath}/mkspecs/macx-g++/qmake.conf
160
161    # fix up tests to work with ccache, if used
162    foreach fixfile [exec find ${worksrcpath}/config.tests \
163                         -name "*.test"] {
164        reinplace "s@\\\"\\\$COMPILER\\\"@\$COMPILER@g" ${fixfile}
165    }
166
167    # fix 'configure' script to find the correct QMAKE CXX compiler by
168    # removing possibilities that include the character "$".  Yes,
169    # that's a lot of "\"s: each "\\\\" -> a single "\" in the patched
170    # file, and need "\\\\$" (with the "s) there.
171    reinplace "/QMAKE_CONF_COMPILER/ \
172             s@tail@grep -v \"\\\\\\\\\\\\\\\\\$\" | tail@" \
173        ${worksrcpath}/configure
174
175    # fix the corewlan .pro file to use the correct developer dir
176    reinplace "s,@DEVELOPER_DIR@,${developer_dir},g" \
177        ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
178}
179
180# The build process uses -fconstant-cfstrings.
181# configure.compiler should therefore not be one of the MacPorts compilers.
182
183# does not work with clang, see #30271 and #31638 .
184if {${configure.compiler} == "clang"} {
185    configure.compiler llvm-gcc-4.2
186}
187
188# --prefix is not recognized.
189configure.pre_args-delete       --prefix=${prefix}
190
191# --disable-dependency-tracking is not recognized.
192configure.universal_args-delete --disable-dependency-tracking
193
194################################################################################
195# We do not want flags of any kind -- QT is smart enough to set up its own.    #
196################################################################################
197
198configure.cflags
199configure.cppflags
200configure.cxxflags
201configure.ldflags
202
203configure.universal_cflags
204configure.universal_cppflags
205configure.universal_cxxflags
206configure.universal_ldflags
207
208configure.cc_archflags
209configure.cxx_archflags
210if {[info exists configure.ld_archflags]} {
211    configure.ld_archflags
212}
213
214#  use compiler.cpath and compiler.library_path, as per
215#  http://trac.macports.org/ticket/25321 for all -I and -L entries,
216#  so-as to avoid conflicts with already-installed headers and
217#  libraries (giving preference to internal-to-this-port first)
218#
219#  CPATH is used instead of -I to avoid conflicts with other ports.
220#  See http://trac.macports.org/ticket/15219 and
221#  http://trac.macports.org/ticket/18723.
222#
223#  set the default paths to include those for SQLITE3 and DBUS-1
224
225set header_path [ list ${prefix}/include/dbus-1.0 \
226                       ${prefix}/lib/dbus-1.0/include \
227                       ${prefix}/include ]
228
229set library_path [ list ${prefix}/lib ]
230
231# -system-sqlite ensures the use SQLite provided by MacPorts instead of Qt.
232#
233# -dbus-linked prevends qt4 from trying to dynamically load libdbus-1,
234#     which it is not able to find in ${prefix}.
235#
236# -openssl-linked ensures that the MacPorts openssl is used.
237#
238# -no-framework ensures that this port is installed as separate
239#     libraries and headers, with guaranteed locations and names.
240#
241# -no-phonon ensures that Qt does not install the 3rd-parth Phonon
242#     port or its backend to QuickTime 7; Phonon is now installed via
243#     the 'phonon' port, which is more up to date than that provided
244#     by Qt.
245
246configure.args                                            \
247    -v                                                    \
248    -confirm-license                                      \
249    -opensource                                           \
250    -prefix          ${qt_dir}                            \
251    -bindir          ${qt_bins_dir}                       \
252    -libdir          ${qt_libs_dir}                       \
253    -docdir          ${qt_docs_dir}                       \
254    -headerdir       ${qt_includes_dir}                   \
255    -plugindir       ${qt_plugins_dir}                    \
256    -importdir       ${qt_imports_dir}                    \
257    -datadir         ${qt_data_dir}                       \
258    -translationdir  ${qt_translations_dir}               \
259    -sysconfdir      ${qt_sysconf_dir}                    \
260    -examplesdir     ${qt_examples_dir}                   \
261    -demosdir        ${qt_demos_dir}                      \
262    -system-sqlite                                        \
263    -openssl-linked                                       \
264    -dbus-linked                                          \
265    -fast                                                 \
266    -optimized-qmake                                      \
267    -no-framework                                         \
268    -no-phonon                                            \
269    -no-phonon-backend
270
271# Stop configure script from searching for SQL Drivers
272#    not available from MacPorts.
273foreach driver {db2 ibase oci tds} {
274    configure.args-append -no-sql-${driver}
275}
276
277# By default, disable most SQL Drivers.
278# There must be at least one enabled (http://trac.macports.org/ticket/15627).
279# SQLite is chosen to be always enabled because a copy of it is distributed
280#    with Qt, so it is reasonable for the user to expect it.
281foreach driver {mysql odbc psql sqlite2} {
282    configure.args-append -no-sql-${driver}
283}
284
285pre-configure {
286    # use the corrected CPATH and LIBRARY_PATH for build
287    compiler.cpath [join ${header_path} :]
288    compiler.library_path [join ${library_path} :]
289}
290
291platform darwin 8 {
292    # build as Carbon only, not cocoa.
293    configure.args-append -carbon
294
295    # required linking flags?
296    configure.ldflags-append -lcrypto -ldbus-1 -ljpeg -llcms -lsqlite3 -lssl -lz
297
298    # Under 10.4 only: patch QMake build files using just "-lQtHelp"
299    # to do "-lQtHelp -lQtCLucene -lQtNetwork -lQtWebKit" instead.
300    # For some reason 10.5+ "knows" that how to do this correctly.
301    patchfiles-append patch-QtHelp_10.4_only.diff
302}
303
304platform darwin {
305    pre-configure {
306        # retrieve the arch type(s) to use, in Qt-speak
307        configure.args-append -arch \"${qt_arch_types}\"
308
309        # cannot use pre-compiled headers when compiling with more than 1
310        # arch type (typically +universal) or for X11
311        #if {[llength ${qt_arch_types}] != 1 || [variant_isset x11]}
312        if {[llength ${qt_arch_types}] != 1} {
313            configure.args-append -no-pch
314        } else {
315            configure.args-append -pch
316        }
317
318        # check to see if not compiling for the native machine hardware
319        # (e.g., compiling for just i386 but CPU is x86_64); optimization
320        # of QMake does not work in this circumstance.
321        if {[lsearch -exact ${qt_arch_types} ${os.arch}] == -1} {
322            # not building for native arch: disable optimizing qmake
323            configure.args-delete -optimized-qmake
324        } elseif {${MINOR} == "6" &&
325                  [llength ${qt_arch_types}] == 1 &&
326                  [lsearch -exact ${qt_arch_types} x86] == 0} {
327            # disable qmake optimization on 10.6 32-bit
328            configure.args-delete -optimized-qmake
329        }
330
331        # find a way to specify the SDK to use; Qt will use the 10.4u
332        # by default which won't work on 10.6 since it is not
333        # supported.  Allow the user to specify the SDK if desired.
334        set SDK ${configure.sdkroot}
335        if {${SDK} == ""} {
336            # set SDK version depending on OS version
337            global MINOR
338            set sdk_version ""
339            if {${MINOR} == "4"} {
340                # OSX 10.4 requires an additional 'u'
341                set sdk_version "10.4u"
342            } else {
343                set sdk_version "10.${MINOR}"
344            }
345            set SDK ${developer_dir}/SDKs/MacOSX${sdk_version}.sdk
346        }
347        if {[file exists ${SDK}]} {
348            configure.args-append -sdk ${SDK}
349        } else {
350            ui_msg \
351"No SDK found in ${developer_dir}/SDKs for ${sdk_version} ; \
352configure will probably fail. \n \
353Please install Apple's Developer Tools again."
354        }
355    }
356}
357
358# Remove any '-I' and '-L' string from the *FLAGS for SQLITE, DBUS,
359# ODBC, and OPENSSL, so that what remains are just non-I/L flags;
360# these paths are in compiler.cpath and compiler.library_path.  The
361# header and library paths for all the other variants are not used by
362# 'configure', and are already included in the compiler.cpath and
363# compiler.library_path . during the 'build' stage, 'make' will
364# rebuild the Makefiles that depend on any of these changed files.
365# These patches are sufficient to make sure local (to this build)
366# paths are searched first, and then system paths last (via the
367# compiler.X settings).  Ideally, 'qmake' -- either via its mkspecs
368# files or the project's build files -- would distinguish between
369# "local" and "system" includes & libraries.
370post-configure {
371    # SQLITE
372    reinplace "/SQLITE/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
373        ${worksrcpath}/.qmake.cache
374    reinplace "/SQLITE/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
375        ${worksrcpath}/.qmake.cache
376    # DBUS
377    reinplace "/DBUS/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
378        ${worksrcpath}/.qmake.cache
379    reinplace "/DBUS/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
380        ${worksrcpath}/.qmake.cache
381    # OPENSSL
382    reinplace "/OPENSSL/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
383        ${worksrcpath}/.qmake.cache
384    reinplace "/OPENSSL/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
385        ${worksrcpath}/.qmake.cache
386    # ODBC
387    reinplace "/ODBC/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
388        ${worksrcpath}/.qmake.cache
389    reinplace "/ODBC/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
390        ${worksrcpath}/.qmake.cache
391}
392
393pre-build {
394    # use the corrected CPATH and LIBRARY_PATH for build
395    compiler.cpath [join ${header_path} :]
396    compiler.library_path [join ${library_path} :]
397}
398
399build.target all
400
401post-destroot {
402    set destroot_qt ${destroot}${qt_dir}
403
404    # Fix .pc and .prl files by changing ${worksrcpath}\${prefix} to
405    # ${qt_dir}\${prefix} ("\" means 'take away').  Cannot use
406    # "find -E" since it is not necessarily portable.
407    regsub ${prefix} ${worksrcpath} "" from_dir
408    regsub ${prefix} ${qt_dir} "" to_dir
409    foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
410        reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
411    }
412    foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
413        reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
414    }
415
416    # Install documentation.
417    xinstall -m 755 -d ${worksrcpath}/${qt_docs_dir}
418    xinstall -m 644 -W ${worksrcpath} \
419        INSTALL LGPL_EXCEPTION.txt LICENSE.FDL \
420        LICENSE.GPL3 LICENSE.LGPL README \
421        ${destroot}${qt_docs_dir}
422
423    # Move .apps into the applications_dir
424    xinstall -m 755 -d ${destroot}${qt_apps_dir}
425    foreach app [glob ${destroot}/${qt_bins_dir}/*.app] {
426        move ${app} ${destroot}${qt_apps_dir}
427    }
428
429    # install qt_menu.nib, used by any applications making use of Qt's
430    # application class.
431    xinstall -m 755 -d ${destroot_qt}/lib/Resources
432    copy ${worksrcpath}/src/gui/mac/qt_menu.nib \
433        ${destroot_qt}/lib/Resources
434}
435
436pre-activate {
437    # make sure 'none' is selected by qt4_select, so that there is no
438    # conflict between it and this port.
439    if {[file exists ${prefix}/bin/qt4_select]} {
440        if {[exec ${prefix}/bin/qt4_select -s] != "none"} {
441            ui_msg "Disabling 'qt4_select' selection."
442            system "exec ${prefix}/bin/qt4_select none"
443        }
444    }
445}
446
447variant framework description {Build as Frameworks} {
448    configure.args-delete -no-framework
449    configure.args-append -framework
450}
451
452variant mysql description {Enable MySQL SQL Driver} {
453    depends_lib-append path:lib/mysql5:mysql5
454    lunshift header_path ${prefix}/include/mysql5/mysql
455    lunshift library_path ${prefix}/lib/mysql5/mysql
456    configure.args-delete -no-sql-mysql
457    configure.args-append -plugin-sql-mysql
458}
459
460variant odbc description {Enable iODBC SQL Driver} {
461    depends_lib-append port:libiodbc
462    configure.args-delete -no-sql-odbc
463    configure.args-append -plugin-sql-odbc
464}
465
466variant psql83 conflicts psql84 psql90 psql91 \
467description {Enable Postgre SQL Driver version 8.3} {}
468
469variant psql84 conflicts psql83 psql90 psql91 \
470description {Enable Postgre SQL Driver version 8.4} {}
471
472variant psql90 conflicts psql83 psql84 psql91 \
473description {Enable Postgre SQL Driver version 9.0} {}
474
475variant psql91 conflicts psql83 psql84 psql90 \
476description {Enable Postgre SQL Driver version 9.1} {}
477
478set psql_version ""
479if {[variant_isset psql83]} {
480    set psql_version "83"
481} elseif {[variant_isset psql84]} {
482    set psql_version "84"
483} elseif {[variant_isset psql90]} {
484    set psql_version "90"
485} elseif {[variant_isset psql91]} {
486    set psql_version "91"
487}
488
489if {${psql_version} != ""} {
490    depends_lib-append port:postgresql${psql_version}
491    lunshift header_path ${prefix}/include/postgresql${psql_version}
492    lunshift library_path ${prefix}/lib/postgresql${psql_version}
493    configure.args-delete -no-sql-psql
494    configure.args-append -plugin-sql-psql
495}
496
497variant sqlite2 description {Enable SQLite version 2 SQL Driver} {
498    depends_lib-append port:sqlite2
499    configure.args-delete -no-sql-sqlite2
500    configure.args-append -plugin-sql-sqlite2
501}
502
503variant raster description {Use raster graphics system by default} {
504    configure.args-append -graphicssystem raster
505}
506
507variant demos description {Build demos} {}
508
509if {![variant_isset demos]} {
510   configure.args-append -nomake demos
511}
512
513variant examples description {Build examples} {}
514
515if {![variant_isset examples]} {
516   configure.args-append -nomake examples
517}
518
519variant debug description {Build both release and debug library} {}
520
521if {[variant_isset debug]} {
522    configure.args-append -debug-and-release
523} else {
524    configure.args-append -release
525}
526
527#variant quartz conflicts x11
528variant quartz \
529description {Build for Native OSX Quartz GUI, not X11 (default)} {}
530
531#variant x11 conflicts quartz \
532#description {Build for X11 GUI, not Native OSX Quartz} {}
533
534# if neither +x11 or +quartz were specified, default to the latter
535#if {![variant_isset quartz] && ![variant_isset x11]}
536    default_variants +quartz
537#}
538
539# check to see if user specified just "-quartz", which can't work.
540#if {![variant_isset quartz] && ![variant_isset x11]} {
541#    return -code error \
542#"\n\nThe variant -quartz will not work alone.
543#Please select one of +quartz or +x11 as a variant.\n"
544#}
545
546#if {[variant_isset x11]} {
547#    return -code error "\n\nVariant +x11 is not yet functional; \
548#please use +quartz for now.\n"
549#}
550
551livecheck.type      regex
552livecheck.url       http://get.qt.nokia.com/qt/source/
553livecheck.regex     "qt-everywhere-opensource-src-(\[0-9a-z.-\]+)${extract.suffix}"
Note: See TracBrowser for help on using the repository browser.