source: trunk/dports/aqua/qt5-mac/Portfile @ 135232

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

icu: update to 55.1

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 16.9 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 135232 2015-04-20 00:15:39Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                qt5-mac
7version             5.3.2
8revision            1
9set branch          [join [lrange [split ${version} .] 0 1] .]
10
11categories          aqua
12platforms           macosx
13maintainers         mcalhoun openmaintainer
14license             {LGPL-2.1 GPL-3}
15
16homepage            http://qt-project.org
17description         Qt Tool Kit
18long_description    Qt Tool Kit: A cross-platform framework \
19    (headers, data, and libraries) for writing \
20    cross-platform GUI-based applications.
21
22distname            qt-everywhere-opensource-src-${version}
23
24master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/single/
25
26checksums           rmd160  5cd61acc2fbfba2597a386a09d83710ed2fdf483 \
27                    sha256  c8d3fd2ead30705c6673c5e4af6c6f3973346b4fb2bd6079c7be0943a5b0282d
28
29if { ${os.major} < 10 } {
30    pre-fetch {
31        ui_error "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
32        ui_error "OS X prior to 10.6 (Snow Leopard) is not even tested."
33        ui_error "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
34        return -code error "unsupported OS"
35    }
36} elseif { ${os.major} == 10 } {
37    pre-fetch {
38        ui_warn "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
39        if { [variant_isset universal] } {
40            ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
41            ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
42        } else {
43            if { ${build_arch} eq "i386" } {
44                ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\"."
45                ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
46            } else {
47                ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
48                ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
49            }
50        }
51        ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
52    }
53} elseif { ${os.major} > 13 } {
54    pre-fetch {
55        ui_warn "OS X subsequent to 10.9 (Mavericks) is not a Reference Configuration for Qt."
56        ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
57    }
58} else {
59    # 11 <= ${os.major} <= 13
60    if { [variant_isset universal] } {
61        pre-fetch {
62            ui_warn "Multiple architectures is not a Reference Configuration for Qt."
63            ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
64        }
65    } else {
66        if { ${build_arch} eq "i386" } {
67            pre-fetch {
68                ui_warn "32-bit mode is not a Reference Configuration for Qt."
69                ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
70            }
71        }
72    }
73}
74
75if { ${subport} eq "${name}-docs"  } {
76    universal_variant no
77}
78
79if { ${subport} eq ${name} || ${subport} eq "${name}-docs" } {
80    # use the qt5 group; set 'building_qt5' so that the portgroup
81    # does not include certain parts
82    set building_qt5    1
83    PortGroup           conflicts_build 1.0
84    PortGroup           qt5 1.0
85    PortGroup           xcodeversion 1.0
86
87    conflicts           qt3 qt3-mac qt4-mac
88
89    minimum_xcodeversions   {10 3.2}
90
91    # See https://bugreports.qt-project.org/browse/QTBUG-34902
92    conflicts_build-append  qt4-mac
93
94    # Kuba states in https://trac.macports.org/ticket/44207#comment:7
95    #  "There's no reason to have parallel building disabled. Really."
96    #use_parallel_build no
97
98    # header file QtCore/private/qmachparser_p.h is included only if "defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)"
99    #     code from header is used only "ifdef Q_OF_MACH_O"
100    #     the two must be consistent
101    #     assume the header include code is correct
102    patchfiles-append patch-tst_qpluginloader.diff
103
104    # When testing, ensure that a universal object file is not inadvertently created.
105    patchfiles-append patch-machtest.diff
106
107    # On testing of 32-bit systems,
108    #  Pre-patch: QCOMPARE(unsigned long const&, unsigned int const&
109    # Post-patch: QCOMPARE(unsigned int  const&, unsigned int const&
110    # Function template is only instantiated for same first and second arguments.
111    patchfiles-append patch-tst_qarraydata.diff
112
113    # see http://stackoverflow.com/questions/14506151/invalid-symbol-redefinition-in-inline-asm-on-llvm
114    patchfiles-append patch-tst_benchlibcallgrind.diff
115
116    # During testing, NSStringFromRect requires NSRect.
117    patchfiles-append patch-tst_qaccessibilitymac_helpers.diff
118
119    # see #44934 (and #35067 for the qt4-mac version)
120    patchfiles-append patch-shared.diff
121
122    # see https://bugreports.qt-project.org/browse/QTBUG-41136
123    patchfiles-append patch-avfmediaplayersession.diff
124
125    # see https://bugreports.qt-project.org/browse/QTBUG-41367
126    patchfiles-append patch-qmacstyle_mac.diff
127
128    # --prefix is not recognized.
129    configure.pre_args-delete       --prefix=${prefix}
130
131    # --disable-dependency-tracking is not recognized.
132    configure.universal_args-delete --disable-dependency-tracking
133
134    if {${configure.sdkroot} ne ""} {
135        configure.args-append \
136            -sdk [string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]]
137    }
138
139    configure.args-append                      \
140        -prefix         ${qt_dir}              \
141        -docdir         ${qt_docs_dir}         \
142        -headerdir      ${qt_includes_dir}     \
143        -plugindir      ${qt_plugins_dir}      \
144        -importdir      ${qt_imports_dir}      \
145        -qmldir         ${qt_qml_dir}          \
146        -datadir        ${qt_data_dir}         \
147        -libdir         ${qt_frameworks_dir}   \
148        -bindir         ${qt_bins_dir}         \
149        -translationdir ${qt_translations_dir} \
150        -sysconfdir     ${qt_sysconf_dir}      \
151        -examplesdir    ${qt_examples_dir}     \
152        -testsdir       ${qt_tests_dir}        \
153        -hostdatadir    ${qt_host_data_dir}
154
155    # Configure options:
156    configure.args-append \
157        -release          \
158        -opensource       \
159        -confirm-license  \
160        -shared           \
161        -process
162
163    # Third Party Libraries:
164    configure.args-append \
165        -no-mtdev         \
166        -no-harfbuzz      \
167        -openssl-linked   \
168        -no-xinput2       \
169        -no-xcb-xlib
170
171    # configure options that don't show up in configure --help
172    configure.args-append \
173        -no-libudev       \
174        -no-egl
175
176    # Additional options:
177    configure.args-append    \
178        {-make libs}         \
179        {-make tools}        \
180        {-nomake examples}   \
181        {-nomake tests}      \
182        -verbose             \
183        -no-optimized-qmake  \
184        -nis                 \
185        -cups                \
186        -iconv               \
187        -no-evdev            \
188        -icu                 \
189        -fontconfig          \
190        -strip               \
191        -no-pch              \
192        -dbus-linked         \
193        -no-xcb              \
194        -glib                \
195        -directfb            \
196        -no-linuxfb          \
197        -no-kms              \
198        -no-system-proxies   \
199        -framework
200
201    foreach driver { db2 ibase mysql oci odbc psql sqlite sqlite2 tds } {
202        configure.args-append -no-sql-${driver}
203    }
204
205    if { ![variant_isset universal] } {
206        configure.args-append "-platform ${qt_qmake_spec}"
207    } else {
208        set merger_configure_args(i386)   "-platform ${qt_qmake_spec_32}"
209        set merger_configure_args(x86_64) "-platform ${qt_qmake_spec_64}"
210    }
211
212    # configure options that don't show up in configure --help
213    configure.args-append \
214        -no-openvg
215
216    # Qt builds part of the system using environment provided my MacPorts.
217    # It builds the rest using its own internal environment.
218    # For consistency, clear MacPorts environment.
219    configure.cxx_stdlib
220    configure.sdkroot
221    configure.cc_archflags
222    configure.cxx_archflags
223    configure.objc_archflags
224    configure.objcxx_archflags
225    configure.ld_archflags
226    configure.cppflags
227    configure.cflags
228    configure.cxxflags
229    configure.objcflags
230    configure.objcxxflags
231    configure.ldflags
232    configure.pipe  no
233    if { [variant_isset universal] } {
234        set merger_arch_flag no
235    }
236    configure.march
237    configure.mtune
238    configure.universal_ldflags
239    configure.universal_cflags
240    configure.universal_cxxflags
241    configure.universal_cppflags
242}
243
244if { ${subport} eq ${name} } {
245    # remove this when updating to the next version
246    incr revision
247
248    depends_lib                              \
249        port:zlib                            \
250        port:libpng                          \
251        port:jpeg                            \
252        port:freetype                        \
253        path:bin/dbus-daemon:dbus            \
254        port:openssl                         \
255        port:tiff                            \
256        port:libmng                          \
257        path:lib/pkgconfig/glib-2.0.pc:glib2 \
258        port:icu                             \
259        port:pcre                            \
260        port:libiconv
261
262    # see https://bugreports.qt-project.org/browse/QTBUG-35514
263    build.target
264
265    if { [variant_isset universal] } {
266        merger-post-destroot {
267            foreach arch ${universal_archs_to_use} {
268                set dir ${destroot}-${arch}
269
270                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_frameworks_dir}/pkgconfig/Qt5WebKit.pc
271
272                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
273                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
274                }
275
276                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.prl] {
277                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
278                }
279
280                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
281                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
282                }
283
284                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri
285
286                reinplace \
287                    "s|^set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang.*\")$|set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang-32\" \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang\")|" \
288                    ${dir}${qt_frameworks_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake
289            }
290        }
291
292        post-destroot {
293            # delete preprocessor comments surrounding QT_CPU_FEATURES.i386 and QT_CPU_FEATURES.x86_64
294            reinplace "/^#ifndef.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri
295            reinplace "/^#else.*$/d"   ${destroot}${qt_mkspecs_dir}/qmodule.pri
296            reinplace "/^#endif.*$/d"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
297        }
298
299        # The file ${prefix}/share/qt5/mkspecs/qconfig.pri is still not properly merged
300        # The solution is ???.
301    }
302
303    post-destroot {
304
305        # see #44204
306        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
307            set framework [file rootname [file tail ${f}]]
308            set incname   [string map {Qt5 Qt} ${framework}]
309            reinplace "s|-I\${includedir}/${incname}|-I\${includedir}|g" ${f}
310            reinplace "s|includedir=\${prefix}/include|includedir=\${libdir}/${framework}/Headers|g" ${f}
311        }
312
313        # move items out of the Frameworks directory that are more appropriate to lib directory
314        xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}
315        foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] {
316            xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d}
317            foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] {
318                # ${qt_frameworks_dir} is  ${qt_dir}/Library/Frameworks while
319                # ${qt_libs_dir}       is  ${qt_dir}/lib
320                # unless modified, cmake files will point to a directory that is too high in the directory hierarchy
321                reinplace "s|/../../../../|/../../../|g" ${f}
322                file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/
323            }
324        }
325        xinstall -m 775 -d ${destroot}${qt_pkg_config_dir}
326        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
327            file rename ${f} ${destroot}${qt_pkg_config_dir}
328        }
329        xinstall -m 775 -d ${destroot}${qt_libs_dir}/
330        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] {
331            file rename ${f} ${destroot}${qt_libs_dir}/
332        }
333
334        # move items out of the bin directory that are more appropriate to the Applications directory
335        xinstall -m 775 -d ${destroot}${qt_apps_dir}
336        foreach f [glob -nocomplain -directory ${destroot}${qt_bins_dir} *.app] {
337            file rename ${f} ${destroot}${qt_apps_dir}/
338        }
339    }
340
341    variant harfbuzz description {(experimental) Use HarfBuzz-NG to do text shaping} {
342        depends_lib-append port:harfbuzz
343        configure.args-replace \
344            -no-harfbuzz       \
345            -system-harfbuzz
346    }
347
348    variant tests description {Enable tests} {
349        configure.args-replace {-nomake tests} {-make tests}
350    }
351
352    variant examples description {Build examples} {
353        configure.args-replace {-nomake examples} {-make examples}
354    }
355
356    variant debug description {Build both release and debug library} {
357        configure.args-replace -release -debug-and-release
358    }
359}
360
361subport ${name}-docs {
362    depends_lib-append \
363        path:${prefix}/bin/qdoc:${name} \
364        path:${qt_plugins_dir}/sqldrivers/libqsqlite.dylib:${name}-sqlite3-plugin
365
366    supported_archs   noarch
367
368    build.target      docs
369    destroot.target   install_docs
370
371    post-extract {
372        # For the most part, generated makefiles use ${prefix}/bin/qdoc.
373        # There are a couple of places that look in ${worksrcpath}/qtbase/src/tools/qdoc/.
374        ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/src/tools/qdoc/
375        ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/bin
376
377        # Similarly, location of qhelpgenerator is expected in ${worksrcpath}
378        xinstall -d -m 755 ${worksrcpath}/qttools/bin/
379        ln -s ${prefix}/bin/qhelpgenerator ${worksrcpath}/qttools/bin/
380
381        # Without this file, the makefile ${worksrcpath}/qtwebkit/Source/WebCore/Makefile.WebCore.Target
382        #    keeps generating itself over and over again.
383        # This file is only created when the library is being built, however.
384        xinstall -d -m 755 ${worksrcpath}/qtwebkit/Source/WebCore/generated
385        touch ${worksrcpath}/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc
386    }
387}
388
389# See http://qt-project.org/doc/qt-5/sql-driver.html for info on building SQL Database Drivers
390
391subport ${name}-sqlite3-plugin {
392    PortGroup           qmake5 1.0
393
394    depends_lib-append port:sqlite3
395
396    # for single architecture, easier to use
397    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/sqlite,
398    #    but doesn't work for universal build
399    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/sqlite
400    build.dir     ${configure.dir}
401    destroot.dir  ${configure.dir}
402
403    configure.args-append "INCLUDEPATH+=${prefix}/include" "LIBS+=\"-L${prefix}/lib -lsqlite3\""
404}
405
406subport ${name}-psql84-plugin {
407    PortGroup           qmake5 1.0
408
409    depends_lib-append port:postgresql84
410
411    # for single architecture, easier to use
412    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/psql,
413    #    but doesn't work for universal build
414    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/psql
415    build.dir     ${configure.dir}
416    destroot.dir  ${configure.dir}
417
418    configure.args-append "INCLUDEPATH+=${prefix}/include/postgresql84" "LIBS+=\"-L${prefix}/lib/postgresql84 -lpq\""
419}
420
421subport ${name}-mysql56-plugin {
422    PortGroup           qmake5 1.0
423
424    depends_lib-append port:mysql56
425
426    # for single architecture, easier to use
427    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/mysql,
428    #    but doesn't work for universal build
429    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/mysql
430    build.dir     ${configure.dir}
431    destroot.dir  ${configure.dir}
432
433    configure.args-append "INCLUDEPATH+=${prefix}/include/mysql56/mysql" "LIBS+=\"-L${prefix}/lib/mysql56/mysql -lmysqlclient_r\""
434}
435
436livecheck.type      regex
437livecheck.url       http://qt-project.org/downloads
438livecheck.regex     "Qt (5(?:\\.\\d+)*) for Mac"
Note: See TracBrowser for help on using the repository browser.