source: trunk/dports/aqua/qt4-mac-devel/Portfile @ 99488

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

qt4-mac-devel : set as replaced_by qt4-mac until I can get Qt 5.0.0 beta working.

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