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 137535 2015-06-13 20:02:33Z mcalhoun@macports.org $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | |
---|
6 | # RJVB: at the time of the initial request for a Qt5 port, the opinion was voiced and supported by michaelld |
---|
7 | # that it should be called simply qt5 . I adhere to that opinion because there will be no "non-mac" Qt5 port. |
---|
8 | # Instead, it is possible to create (and I have implemented) a qt5-x11 subport that installs the xcb platform |
---|
9 | # plugin in the Qt5 plugin directory. Semantics, but it would be weird to call it qt5-mac-x11 ... |
---|
10 | name qt5-mac |
---|
11 | version 5.4.2 |
---|
12 | set branch [join [lrange [split ${version} .] 0 1] .] |
---|
13 | |
---|
14 | categories aqua |
---|
15 | platforms macosx |
---|
16 | maintainers mcalhoun openmaintainer |
---|
17 | license {LGPL-2.1 GPL-3} |
---|
18 | |
---|
19 | homepage http://qt.io |
---|
20 | description Qt Tool Kit ${branch} |
---|
21 | long_description Qt Tool Kit: A cross-platform framework \ |
---|
22 | (headers, data, and libraries) for writing \ |
---|
23 | cross-platform GUI-based applications. |
---|
24 | |
---|
25 | distname qt-everywhere-opensource-src-${version} |
---|
26 | |
---|
27 | master_sites http://download.qt.io/official_releases/qt/${branch}/${version}/single/ |
---|
28 | |
---|
29 | checksums rmd160 3382c482a99e114560f56a9fe9501b8cabf334a9 \ |
---|
30 | sha256 cfc768c55f0a0cd232bed914a9022528f8f2e50cb010bf0e4f3f62db3dfa17bd |
---|
31 | |
---|
32 | if { ${os.major} < 11 } { |
---|
33 | pre-fetch { |
---|
34 | ui_error "OS X prior to 10.8 (Mountain Lion) is not a Reference Configuration for Qt." |
---|
35 | ui_error "OS X prior to 10.7 (Lion) is not even tested." |
---|
36 | ui_error "See http://doc.qt.io/qt-5/supported-platforms.html#reference-configurations" |
---|
37 | return -code error "unsupported OS" |
---|
38 | } |
---|
39 | } elseif { ${os.major} > 14 } { |
---|
40 | pre-fetch { |
---|
41 | ui_warn "OS X subsequent to 10.10 (Yosemite) is not a Reference Configuration for Qt." |
---|
42 | ui_warn "See http://doc.qt.io/qt-5/supported-platforms.html#reference-configurations" |
---|
43 | } |
---|
44 | } else { |
---|
45 | # 11 <= ${os.major} <= 14 |
---|
46 | if { [variant_isset universal] } { |
---|
47 | pre-fetch { |
---|
48 | ui_warn "Multiple architectures is not a Reference Configuration for Qt." |
---|
49 | ui_warn "See http://doc.qt.io/qt-5/supported-platforms.html#reference-configurations" |
---|
50 | } |
---|
51 | } else { |
---|
52 | if { ${build_arch} eq "i386" } { |
---|
53 | pre-fetch { |
---|
54 | ui_warn "32-bit mode is not a Reference Configuration for Qt." |
---|
55 | ui_warn "See http://doc.qt.io/qt-5/supported-platforms.html#reference-configurations" |
---|
56 | } |
---|
57 | } |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | if { ${subport} eq "${name}-docs" } { |
---|
62 | universal_variant no |
---|
63 | } |
---|
64 | |
---|
65 | if { ${subport} eq ${name} || ${subport} eq "${name}-docs" } { |
---|
66 | # use the qt5 group; set 'building_qt5' so that the portgroup |
---|
67 | # does not include certain parts |
---|
68 | set building_qt5 1 |
---|
69 | PortGroup conflicts_build 1.0 |
---|
70 | PortGroup qt5 1.0 |
---|
71 | PortGroup xcodeversion 1.0 |
---|
72 | |
---|
73 | conflicts qt3 qt3-mac qt4-mac |
---|
74 | |
---|
75 | minimum_xcodeversions {11 4.1} |
---|
76 | |
---|
77 | # See https://bugreports.qt.io/browse/QTBUG-34902 |
---|
78 | conflicts_build-append qt4-mac |
---|
79 | |
---|
80 | # qtwebengine/src/core/gyp_run.pro buils an executable using g++ |
---|
81 | # This causes an error if UsingTheRightCompiler (https://trac.macports.org/wiki/UsingTheRightCompiler) |
---|
82 | # Quick fix is to use full path to g++ (should use ${configure.cxx} instead?) |
---|
83 | # N.B. that the python executable is found from the configuration environment |
---|
84 | #patchfiles-append patch-ninja-compiler.diff |
---|
85 | |
---|
86 | #needed? qtwebengine/src/3rdparty/chromium/build/gyp_helper.py |
---|
87 | |
---|
88 | # qtwebengine/src/core/gyp_run.pro |
---|
89 | # calls |
---|
90 | # qtwebengine/tools/buildscripts/gyp_qtwebengine |
---|
91 | # gyp_qtwebengine insists on x64 and libcpp ? |
---|
92 | |
---|
93 | # qtwebengine/src/3rdparty/ninja/bootstrap.py calls g++ (must set CXX) |
---|
94 | |
---|
95 | if { [variant_isset tests] } { |
---|
96 | # header file QtCore/private/qmachparser_p.h is included only if "defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)" |
---|
97 | # code from header is used only "ifdef Q_OF_MACH_O" |
---|
98 | # the two must be consistent |
---|
99 | # assume the header include code is correct |
---|
100 | patchfiles-append patch-tst_qpluginloader.diff |
---|
101 | |
---|
102 | # see http://stackoverflow.com/questions/14506151/invalid-symbol-redefinition-in-inline-asm-on-llvm |
---|
103 | patchfiles-append patch-tst_benchlibcallgrind.diff |
---|
104 | |
---|
105 | # When testing, ensure that a universal object file is not inadvertently created. |
---|
106 | patchfiles-append patch-machtest.diff |
---|
107 | |
---|
108 | # On testing of 32-bit systems, |
---|
109 | # Pre-patch: QCOMPARE(unsigned long const&, unsigned int const& |
---|
110 | # Post-patch: QCOMPARE(unsigned int const&, unsigned int const& |
---|
111 | # Function template is only instantiated for same first and second arguments. |
---|
112 | patchfiles-append patch-tst_qarraydata.diff |
---|
113 | |
---|
114 | # During testing, NSStringFromRect requires NSRect. |
---|
115 | patchfiles-append patch-tst_qaccessibilitymac_helpers.diff |
---|
116 | } |
---|
117 | |
---|
118 | # see #44934 (and #35067 for the qt4-mac version) |
---|
119 | if { true } { |
---|
120 | set framework_list [split ${qt_frameworks_dir} '/'] |
---|
121 | set qt_list [split ${qt_dir} '/'] |
---|
122 | |
---|
123 | while {[llength ${qt_list}] && [llength ${framework_list}]} { |
---|
124 | set var_qt [lindex $qt_list 0] |
---|
125 | set var_framework [lindex $framework_list 0] |
---|
126 | |
---|
127 | if { ${var_qt} ne ${var_framework} } { |
---|
128 | break |
---|
129 | } |
---|
130 | |
---|
131 | # remove first element from list |
---|
132 | set qt_list [lreplace ${qt_list} 0 0] |
---|
133 | set framework_list [lreplace ${framework_list} 0 0] |
---|
134 | } |
---|
135 | set libreplace [string repeat ../ [llength ${qt_list}]][join ${framework_list} /] |
---|
136 | if { ${libreplace} ne "lib" } { |
---|
137 | patchfiles-append patch-shared.diff |
---|
138 | # RJVB: reinplace should be done in the post-patch |
---|
139 | post-patch { |
---|
140 | reinplace "s|__MACPORTS_FRAMWORK_DIR__|${libreplace}|g" ${worksrcpath}/qttools/src/macdeployqt/shared/shared.cpp |
---|
141 | } |
---|
142 | } |
---|
143 | } |
---|
144 | |
---|
145 | # --prefix is not recognized. |
---|
146 | configure.pre_args-delete --prefix=${prefix} |
---|
147 | |
---|
148 | # --disable-dependency-tracking is not recognized. |
---|
149 | configure.universal_args-delete --disable-dependency-tracking |
---|
150 | |
---|
151 | # Installation options: |
---|
152 | #-extprefix SYSROOT/PREFIX |
---|
153 | #-hostprefix EXTPREFIX |
---|
154 | #-libexecdir ARCHDATADIR/libexec |
---|
155 | #-hostbindir HOSTPREFIX/bin |
---|
156 | #-hostlibdir HOSTPREFIX/lib |
---|
157 | configure.args-append \ |
---|
158 | -prefix ${prefix} \ |
---|
159 | -bindir ${qt_bins_dir} \ |
---|
160 | -headerdir ${qt_includes_dir} \ |
---|
161 | -libdir ${qt_frameworks_dir} \ |
---|
162 | -archdatadir ${qt_archdata_dir} \ |
---|
163 | -plugindir ${qt_plugins_dir} \ |
---|
164 | -importdir ${qt_imports_dir} \ |
---|
165 | -qmldir ${qt_qml_dir} \ |
---|
166 | -datadir ${qt_data_dir} \ |
---|
167 | -docdir ${qt_docs_dir} \ |
---|
168 | -translationdir ${qt_translations_dir} \ |
---|
169 | -sysconfdir ${qt_sysconf_dir} \ |
---|
170 | -examplesdir ${qt_examples_dir} \ |
---|
171 | -testsdir ${qt_tests_dir} \ |
---|
172 | -hostdatadir ${qt_host_data_dir} \ |
---|
173 | -hostbindir ${qt_bins_dir} \ |
---|
174 | -hostlibdir ${qt_frameworks_dir} |
---|
175 | |
---|
176 | |
---|
177 | # Configure options: |
---|
178 | # RJVB : -c++11 is the default (when auto-detection detects it's supported) and it |
---|
179 | # is probably best left implicit (e.g. for building on earlier OS X versions) => remove -c++11 |
---|
180 | configure.args-append \ |
---|
181 | -release \ |
---|
182 | -opensource \ |
---|
183 | -confirm-license \ |
---|
184 | -c++11 \ |
---|
185 | -shared \ |
---|
186 | -largefile \ |
---|
187 | -accessibility |
---|
188 | |
---|
189 | # RJVB/pixilla: the sqlite3 plugin ("sqlite") should be re-absorbed into the main port |
---|
190 | configure.args-append -system-sqlite |
---|
191 | depends_lib-append port:sqlite3 |
---|
192 | foreach driver { db2 ibase mysql oci odbc psql sqlite2 tds } { |
---|
193 | configure.args-append -no-sql-${driver} |
---|
194 | } |
---|
195 | |
---|
196 | # RJVB: -qml-debug is the default |
---|
197 | configure.args-append \ |
---|
198 | -qml-debug |
---|
199 | |
---|
200 | if { ![variant_isset universal] } { |
---|
201 | configure.args-append "-platform ${qt_qmake_spec}" |
---|
202 | } else { |
---|
203 | set merger_configure_args(i386) "-platform ${qt_qmake_spec_32}" |
---|
204 | set merger_configure_args(x86_64) "-platform ${qt_qmake_spec_64}" |
---|
205 | } |
---|
206 | |
---|
207 | configure.args-append \ |
---|
208 | -force-pkg-config |
---|
209 | |
---|
210 | # Third Party Libraries: |
---|
211 | # RJVB : Qt has no business depending on PulseAudio on OS X; it only pulls in undesirable dependencies (like gnome...) |
---|
212 | configure.args-append \ |
---|
213 | -system-zlib \ |
---|
214 | -no-mtdev \ |
---|
215 | -no-journald \ |
---|
216 | -system-libpng \ |
---|
217 | -system-libjpeg \ |
---|
218 | -system-freetype \ |
---|
219 | -system-harfbuzz \ |
---|
220 | -openssl-linked \ |
---|
221 | -system-pcre \ |
---|
222 | --disable-xcb \ |
---|
223 | --disable-xkbcommon \ |
---|
224 | -no-xinput2 \ |
---|
225 | -no-xcb-xlib \ |
---|
226 | -glib \ |
---|
227 | -pulseaudio \ |
---|
228 | -no-alsa \ |
---|
229 | -no-gtkstyle |
---|
230 | |
---|
231 | # Additional options: |
---|
232 | # RJVB: what's the point in not optimising qmake? Any increase in configure time (which I don't believe in) |
---|
233 | # can be compensated by patching the configure script so it builds qmake with -j${build.jobs} . |
---|
234 | configure.args-append \ |
---|
235 | {-make libs} \ |
---|
236 | {-make tools} \ |
---|
237 | {-nomake examples} \ |
---|
238 | {-nomake tests} \ |
---|
239 | -gui \ |
---|
240 | -widgets \ |
---|
241 | -rpath \ |
---|
242 | -verbose \ |
---|
243 | -no-optimized-qmake \ |
---|
244 | -nis \ |
---|
245 | -cups \ |
---|
246 | -iconv \ |
---|
247 | -no-evdev \ |
---|
248 | -icu \ |
---|
249 | -fontconfig \ |
---|
250 | -strip \ |
---|
251 | -no-pch \ |
---|
252 | -dbus-linked \ |
---|
253 | -no-use-gold-linker \ |
---|
254 | -no-separate-debug-info \ |
---|
255 | -no-xcb \ |
---|
256 | -no-eglfs \ |
---|
257 | -no-directfb \ |
---|
258 | -no-linuxfb \ |
---|
259 | -no-kms \ |
---|
260 | -no-system-proxies |
---|
261 | |
---|
262 | # MacOS/iOS options: |
---|
263 | configure.args-append \ |
---|
264 | -framework |
---|
265 | |
---|
266 | if {${configure.sdkroot} ne ""} { |
---|
267 | configure.args-append \ |
---|
268 | -sdk [string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]] |
---|
269 | } |
---|
270 | |
---|
271 | # configure options that don't show up in configure --help |
---|
272 | configure.args-append \ |
---|
273 | -no-libudev \ |
---|
274 | -no-egl \ |
---|
275 | -no-openvg |
---|
276 | |
---|
277 | # Qt builds part of the system using environment provided my MacPorts. |
---|
278 | # It builds the rest using its own internal environment. |
---|
279 | # For consistency, clear MacPorts environment. |
---|
280 | configure.cxx_stdlib |
---|
281 | configure.sdkroot |
---|
282 | configure.cc_archflags |
---|
283 | configure.cxx_archflags |
---|
284 | configure.objc_archflags |
---|
285 | configure.objcxx_archflags |
---|
286 | configure.ld_archflags |
---|
287 | configure.cppflags |
---|
288 | configure.cflags |
---|
289 | configure.cxxflags |
---|
290 | configure.objcflags |
---|
291 | configure.objcxxflags |
---|
292 | configure.ldflags |
---|
293 | configure.pipe no |
---|
294 | if { [variant_isset universal] } { |
---|
295 | set merger_arch_flag no |
---|
296 | } |
---|
297 | configure.march |
---|
298 | configure.mtune |
---|
299 | configure.universal_ldflags |
---|
300 | configure.universal_cflags |
---|
301 | configure.universal_cxxflags |
---|
302 | configure.universal_cppflags |
---|
303 | } |
---|
304 | |
---|
305 | if { ${subport} eq ${name} } { |
---|
306 | # RJVB: port:pulseaudio should disappear from this list when Qt is configured *without* PA support |
---|
307 | depends_lib \ |
---|
308 | port:zlib \ |
---|
309 | port:libpng \ |
---|
310 | port:jpeg \ |
---|
311 | port:freetype \ |
---|
312 | path:bin/dbus-daemon:dbus \ |
---|
313 | port:openssl \ |
---|
314 | port:tiff \ |
---|
315 | port:libmng \ |
---|
316 | path:lib/pkgconfig/glib-2.0.pc:glib2 \ |
---|
317 | port:icu \ |
---|
318 | port:pcre \ |
---|
319 | port:libiconv \ |
---|
320 | port:harfbuzz \ |
---|
321 | port:pulseaudio |
---|
322 | |
---|
323 | # see https://bugreports.qt.io/browse/QTBUG-35514 |
---|
324 | build.target |
---|
325 | |
---|
326 | if { [variant_isset universal] } { |
---|
327 | merger-post-destroot { |
---|
328 | foreach arch ${universal_archs_to_use} { |
---|
329 | set dir ${destroot}-${arch} |
---|
330 | |
---|
331 | # Libs.private contains the value of ${worksrcpath}-${arch}, which prevents merging |
---|
332 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_libs_dir}/pkgconfig/Qt5WebKit.pc |
---|
333 | |
---|
334 | foreach prlfl [glob ${dir}${qt_libs_dir}/*.framework/*.prl] { |
---|
335 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl} |
---|
336 | } |
---|
337 | |
---|
338 | foreach prlfl [glob ${dir}${qt_libs_dir}/*.prl] { |
---|
339 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl} |
---|
340 | } |
---|
341 | |
---|
342 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri |
---|
343 | reinplace "s|macx-clang-32|macx-clang|g" ${dir}${qt_libs_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake |
---|
344 | |
---|
345 | |
---|
346 | if { [variant_isset examples] } { |
---|
347 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_examples_dir}/declarative/tutorials/gettingStarted/parts/part5/filedialog/Makefile |
---|
348 | reinplace -E "/\\w*-arch \\\\/d" ${dir}${qt_examples_dir}/declarative/tutorials/gettingStarted/parts/part5/filedialog/Makefile |
---|
349 | reinplace -E "/\\w*${arch} \\\\/d" ${dir}${qt_examples_dir}/declarative/tutorials/gettingStarted/parts/part5/filedialog/Makefile |
---|
350 | reinplace -E {s:-arch +[^ ]+::g} ${dir}${qt_examples_dir}/declarative/tutorials/gettingStarted/parts/part5/filedialog/Makefile |
---|
351 | reinplace "s|macx-clang-32|macx-clang|g" ${dir}${qt_examples_dir}/declarative/tutorials/gettingStarted/parts/part5/filedialog/Makefile |
---|
352 | |
---|
353 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_examples_dir}/multimedia/spectrum/fftreal.framework/fftreal.prl |
---|
354 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_examples_dir}/multimedia/spectrum/spectrum.app/Contents/Frameworks/fftreal.framework/fftreal.prl |
---|
355 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_examples_dir}/sensors/grue/libgruesensor.prl |
---|
356 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_examples_dir}/declarative/tutorials/gettingStarted/parts/part5/filedialog/Makefile |
---|
357 | if { [variant_isset debug] } { |
---|
358 | reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_examples_dir}/widgets/tools/plugandpaint/plugins/libpnp_basictools_debug.prl |
---|
359 | } |
---|
360 | } |
---|
361 | } |
---|
362 | } |
---|
363 | |
---|
364 | post-destroot { |
---|
365 | # delete preprocessor comments surrounding QT_CPU_FEATURES.i386 and QT_CPU_FEATURES.x86_64 |
---|
366 | reinplace "/^#ifndef.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
---|
367 | reinplace "/^#else.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
---|
368 | reinplace "/^#endif.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
---|
369 | } |
---|
370 | |
---|
371 | # The file ${prefix}/share/qt5/mkspecs/qconfig.pri is still not properly merged |
---|
372 | # The solution is ???. |
---|
373 | } |
---|
374 | |
---|
375 | post-destroot { |
---|
376 | # see #44204 |
---|
377 | # RJVB: use the code below ">>>..." instead of this block, which fails to populate qt_includes_dir completely. |
---|
378 | # foreach f [glob -nocomplain -tails -directory ${destroot}${qt_libs_dir} *.framework] { |
---|
379 | # set framework [file rootname ${f}] |
---|
380 | # |
---|
381 | # set include_list [split ${qt_includes_dir} '/'] |
---|
382 | # set framework_list [split ${qt_libs_dir} '/'] |
---|
383 | # |
---|
384 | # while {[llength ${include_list}] && [llength ${framework_list}]} { |
---|
385 | # set var_include [lindex $include_list 0] |
---|
386 | # set var_framework [lindex $framework_list 0] |
---|
387 | # |
---|
388 | # if { ${var_include} ne ${var_framework} } { |
---|
389 | # break |
---|
390 | # } |
---|
391 | # |
---|
392 | # # remove first element from list |
---|
393 | # set include_list [lreplace ${include_list} 0 0] |
---|
394 | # set framework_list [lreplace ${framework_list} 0 0] |
---|
395 | # } |
---|
396 | # |
---|
397 | # ln -s [string repeat ../ [llength ${include_list}]][join ${framework_list} /]/${f}/Headers ${destroot}${qt_includes_dir}/${framework} |
---|
398 | # } |
---|
399 | |
---|
400 | # RJVB: tried and true logic copied from the qt4-mac port |
---|
401 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
402 | # move items out of the Frameworks directory that are more appropriate to lib directory |
---|
403 | xinstall -m 775 -d ${destroot}${qt_cmake_module_dir} |
---|
404 | foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] { |
---|
405 | xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d} |
---|
406 | foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] { |
---|
407 | # ${qt_frameworks_dir} is ${qt_dir}/Library/Frameworks while |
---|
408 | # ${qt_libs_dir} is ${qt_dir}/lib |
---|
409 | # unless modified, cmake files will point to a directory that is too high in the directory hierarchy |
---|
410 | reinplace "s|/../../../../|/../../../${qt_dir_rel}/|g" ${f} |
---|
411 | file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/ |
---|
412 | } |
---|
413 | } |
---|
414 | set qt_vers [split ${version} "."] |
---|
415 | set qt_major [lindex ${qt_vers} 0] |
---|
416 | set qt_minor [lindex ${qt_vers} 1] |
---|
417 | set qt_patch [lindex ${qt_vers} 2] |
---|
418 | |
---|
419 | # link includes and libraries for each actual installed framework |
---|
420 | # make sure that the target directories exist |
---|
421 | exec mkdir -p ${destroot}${qt_includes_dir} ${destroot}${qt_libs_dir} |
---|
422 | foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \ |
---|
423 | -name "*.framework" | \ |
---|
424 | sed -e "s@${destroot}@@g"] { |
---|
425 | |
---|
426 | set tf_full [strsed ${fixfile} {s@\\.framework@@}] |
---|
427 | set tf [strsed ${tf_full} {g@.*\/@@}] |
---|
428 | |
---|
429 | # special for QtWebKit entries |
---|
430 | set t_minor ${qt_minor} |
---|
431 | set is_QtWebKit 0 |
---|
432 | if {[string compare ${tf} QtWebKit] == 0} { |
---|
433 | set t_minor 9 |
---|
434 | set is_QtWebKit 1 |
---|
435 | } |
---|
436 | |
---|
437 | # link headers into ${qt_includes_dir}, removing directories |
---|
438 | # if they are already there first |
---|
439 | set inc_file ${destroot}${qt_includes_dir}/${tf} |
---|
440 | if {[file exists ${inc_file}]} { |
---|
441 | ui_msg "*Warning* replacing directory ${inc_file} with a symlink to ${tf_full}.framework/Headers!" |
---|
442 | file delete -force ${inc_file} |
---|
443 | } |
---|
444 | ln -s ${tf_full}.framework/Headers ${inc_file} |
---|
445 | |
---|
446 | # link libraries into ${qt_libs_dir}, all 4 number variants |
---|
447 | set dr_qt_libs_dir ${destroot}${qt_libs_dir} |
---|
448 | ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib |
---|
449 | ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib |
---|
450 | ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib |
---|
451 | ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib |
---|
452 | |
---|
453 | # copy .prl file, then correct it for library usage |
---|
454 | copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl |
---|
455 | |
---|
456 | # fix TARGET in .prl file |
---|
457 | reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl |
---|
458 | |
---|
459 | # fix PRL_LIBS -F -> -L in .prl file |
---|
460 | reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl |
---|
461 | |
---|
462 | # fix "-framework Qt*" -> "-lQt*" in .prl file |
---|
463 | reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \ |
---|
464 | ${dr_qt_libs_dir}/lib${tf}.prl |
---|
465 | |
---|
466 | # remove the QMAKE_PRL_BUILD_DIR line from the .prl file |
---|
467 | reinplace "/QMAKE_PRL_BUILD_DIR/d" ${dr_qt_libs_dir}/lib${tf}.prl |
---|
468 | |
---|
469 | # deal with debug files |
---|
470 | # RJVB: this is the only block I never tested |
---|
471 | if {[variant_isset debug]} { |
---|
472 | |
---|
473 | # but not if QtWebKit and +universal, since that one does |
---|
474 | # not exist (the 32-bit version of the debug library is |
---|
475 | # larger than fits into the 32-bit filespace). |
---|
476 | |
---|
477 | if {[variant_isset debug] && ${is_QtWebKit}} { |
---|
478 | continue |
---|
479 | } |
---|
480 | |
---|
481 | # link libraries into ${qt_libs_dir}, all 4 number variants |
---|
482 | ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib |
---|
483 | ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib |
---|
484 | ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib |
---|
485 | ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib |
---|
486 | |
---|
487 | # copy .prl file, then correct it for library usage |
---|
488 | copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl |
---|
489 | |
---|
490 | # fix TARGET in .prl file |
---|
491 | reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl |
---|
492 | |
---|
493 | # fix PRL_LIBS -F -> -L in .prl file |
---|
494 | reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl |
---|
495 | |
---|
496 | # fix "-framework Qt*" -> "-lQt*_debug" in .prl file |
---|
497 | reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl |
---|
498 | } |
---|
499 | } |
---|
500 | # RJVB: spoiler: reference to the qt5*-kde subport |
---|
501 | if {${subport} eq ${name} || ${subport} eq "${name}-kde"} { |
---|
502 | ln -s ${qt_qmake_cmd} ${destroot}/${prefix}/bin/qmake-qt${qt_major} |
---|
503 | ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc-qt${qt_major} |
---|
504 | ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic-qt${qt_major} |
---|
505 | ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease-qt${qt_major} |
---|
506 | } |
---|
507 | if {${qt_pkg_config_dir} ne "${qt_frameworks_dir}/pkgconfig"} { |
---|
508 | # move the pkgconfig files to their assigned location |
---|
509 | foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] { |
---|
510 | file rename ${f} ${destroot}${qt_pkg_config_dir} |
---|
511 | } |
---|
512 | } |
---|
513 | if {${qt_libs_dir} ne ${qt_frameworks_dir}} { |
---|
514 | xinstall -m 775 -d ${destroot}${qt_libs_dir}/ |
---|
515 | foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] { |
---|
516 | file rename ${f} ${destroot}${qt_libs_dir}/ |
---|
517 | } |
---|
518 | |
---|
519 | # link back the static libraries to where some Qt components expect them: |
---|
520 | foreach f [exec find ${destroot}${qt_libs_dir} \ |
---|
521 | -name "*.a" | \ |
---|
522 | sed -e "s@${destroot}@@g"] { |
---|
523 | ln -s ${f} ${destroot}${qt_frameworks_dir}/ |
---|
524 | } |
---|
525 | # certain applications might expect to find the following .prl files in ${qt_frameworks_dir} |
---|
526 | foreach fixfile { libQt5OpenGLExtensions_debug.prl libQt5PlatformSupport_debug.prl \ |
---|
527 | libQt5QmlDevTools.prl libQt5UiTools.prl libQt5UiTools_debug.prl } { |
---|
528 | if {[file exists ${destroot}${qt_libs_dir}/${fixfile}]} { |
---|
529 | ln -s ${qt_libs_dir}/${fixfile} ${destroot}${qt_frameworks_dir}/${fixfile} |
---|
530 | } |
---|
531 | } |
---|
532 | } |
---|
533 | |
---|
534 | # Move .apps into the applications_dir, and link each .apps' |
---|
535 | # executable back into ${qt_bins_dir} |
---|
536 | set dr_qt_apps_dir ${destroot}${qt_apps_dir} |
---|
537 | set dr_qt_bins_dir ${destroot}${qt_bins_dir} |
---|
538 | xinstall -m 755 -d ${dr_qt_apps_dir} |
---|
539 | foreach app [glob -nocomplain ${dr_qt_bins_dir}/*.app] { |
---|
540 | # remove the leading stuff |
---|
541 | set app [lindex [split ${app} /] end] |
---|
542 | # move the .app |
---|
543 | move ${dr_qt_bins_dir}/${app} ${dr_qt_apps_dir} |
---|
544 | # link it back |
---|
545 | ln -s ${qt_apps_dir}/${app} ${dr_qt_bins_dir} |
---|
546 | # provide a proxy to the app's executable; symlinks won't |
---|
547 | # be accepted by qtchooser if the user has that port installed. |
---|
548 | # RJVB: requires ${filespath}/appProxy.sh |
---|
549 | # set texe [strsed ${app} {g@\.app@@}] |
---|
550 | # set appProxy ${dr_qt_bins_dir}/[string tolower ${texe}] |
---|
551 | # copy ${filespath}/appProxy.sh ${appProxy} |
---|
552 | # reinplace "s|@BUNDLEEXEC@|${qt_apps_dir}/${app}/Contents/MacOS/${texe}|g" ${appProxy} |
---|
553 | |
---|
554 | } |
---|
555 | if {[file exists ${destroot}${qt_mkspecs_dir}/qmodule.pri]} { |
---|
556 | # clean up the generated mkspecs/qmodule.pri: |
---|
557 | # undo any symlink normalisation that introduced the clang version number into QMAKE_CC/CXX (e.g. clang++-mp-3.5) |
---|
558 | reinplace "s|bin/clang-mp-.*|bin/clang|g" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
---|
559 | reinplace "s|bin/clang\+\+-mp-.*|bin/clang\+\+|g" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
---|
560 | } |
---|
561 | if {[file exists ${destroot}${qt_mkspecs_dir}/qmodule.pri]} { |
---|
562 | # if the user used configure.optflags="-something" make sure that gets added to compiler options qmake |
---|
563 | # determines, rather than replacing all of those |
---|
564 | reinplace "s|QMAKE_CFLAGS = |QMAKE_CFLAGS \+= |g" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
---|
565 | reinplace "s|QMAKE_CXXFLAGS = |QMAKE_CXXFLAGS \+= |g" ${destroot}${qt_mkspecs_dir}/qmodule.pri |
---|
566 | } |
---|
567 | #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
568 | } |
---|
569 | |
---|
570 | variant tests description {Enable tests} { |
---|
571 | configure.args-replace {-nomake tests} {-make tests} |
---|
572 | } |
---|
573 | |
---|
574 | variant examples description {Build examples} { |
---|
575 | configure.args-replace {-nomake examples} {-make examples} |
---|
576 | } |
---|
577 | |
---|
578 | variant debug description {Build both release and debug library} { |
---|
579 | configure.args-replace -release -debug-and-release |
---|
580 | } |
---|
581 | } |
---|
582 | |
---|
583 | # RJVB: the docs subport should be renamed such that it comes last during an `upgrade outdated` |
---|
584 | subport ${name}-docs { |
---|
585 | depends_lib-append \ |
---|
586 | path:${qt_bins_dir}/qdoc:${name} \ |
---|
587 | path:${qt_plugins_dir}/sqldrivers/libqsqlite.dylib:${name}-sqlite3-plugin |
---|
588 | |
---|
589 | supported_archs noarch |
---|
590 | |
---|
591 | build.target docs |
---|
592 | destroot.target install_docs |
---|
593 | |
---|
594 | post-extract { |
---|
595 | # For the most part, generated makefiles use ${prefix}/bin/qdoc. |
---|
596 | ln -s ${qt_bins_dir}/qdoc ${worksrcpath}/qtbase/bin |
---|
597 | |
---|
598 | # Similarly, location of qhelpgenerator is expected in ${worksrcpath} |
---|
599 | xinstall -d -m 755 ${worksrcpath}/qttools/bin/ |
---|
600 | ln -s ${qt_bins_dir}/qhelpgenerator ${worksrcpath}/qttools/bin/ |
---|
601 | |
---|
602 | # Without this file, the makefile ${worksrcpath}/qtwebkit/Source/WebCore/Makefile.WebCore.Target |
---|
603 | # keeps generating itself over and over again. |
---|
604 | # This file is only created when the library is being built, however. |
---|
605 | xinstall -d -m 755 ${worksrcpath}/qtwebkit/Source/WebCore/generated |
---|
606 | touch ${worksrcpath}/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc |
---|
607 | } |
---|
608 | } |
---|
609 | |
---|
610 | # See http://doc.qt.io/qt-5/sql-driver.html for info on building SQL Database Drivers |
---|
611 | |
---|
612 | # RJVB/pixilla: applications built by the main port depend on the sqlite3 plugin. It should be built |
---|
613 | # with the main port and not be a separate subport. |
---|
614 | subport ${name}-sqlite3-plugin { |
---|
615 | replaced_by ${name} |
---|
616 | PortGroup obsolete 1.0 |
---|
617 | PortGroup qmake5 1.0 |
---|
618 | |
---|
619 | depends_lib-append port:sqlite3 |
---|
620 | |
---|
621 | # for single architecture, easier to use |
---|
622 | # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/sqlite, |
---|
623 | # but doesn't work for universal build |
---|
624 | configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/sqlite |
---|
625 | build.dir ${configure.dir} |
---|
626 | destroot.dir ${configure.dir} |
---|
627 | |
---|
628 | configure.args-append "INCLUDEPATH+=${prefix}/include" "LIBS+=\"-L${prefix}/lib -lsqlite3\"" |
---|
629 | } |
---|
630 | |
---|
631 | subport ${name}-psql84-plugin { |
---|
632 | PortGroup qmake5 1.0 |
---|
633 | |
---|
634 | depends_lib-append port:postgresql84 |
---|
635 | |
---|
636 | # for single architecture, easier to use |
---|
637 | # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/psql, |
---|
638 | # but doesn't work for universal build |
---|
639 | configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/psql |
---|
640 | build.dir ${configure.dir} |
---|
641 | destroot.dir ${configure.dir} |
---|
642 | |
---|
643 | configure.args-append "INCLUDEPATH+=${prefix}/include/postgresql84" "LIBS+=\"-L${prefix}/lib/postgresql84 -lpq\"" |
---|
644 | } |
---|
645 | |
---|
646 | subport ${name}-mysql56-plugin { |
---|
647 | PortGroup qmake5 1.0 |
---|
648 | |
---|
649 | depends_lib-append port:mysql56 |
---|
650 | |
---|
651 | # for single architecture, easier to use |
---|
652 | # worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/mysql, |
---|
653 | # but doesn't work for universal build |
---|
654 | configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/mysql |
---|
655 | build.dir ${configure.dir} |
---|
656 | destroot.dir ${configure.dir} |
---|
657 | |
---|
658 | configure.args-append "INCLUDEPATH+=${prefix}/include/mysql56/mysql" "LIBS+=\"-L${prefix}/lib/mysql56/mysql -lmysqlclient_r\"" |
---|
659 | } |
---|
660 | |
---|
661 | livecheck.type regex |
---|
662 | livecheck.url http://download.qt.io/archive/qt/5.4/ |
---|
663 | livecheck.regex (\\d+(\\.\\d+)+) |
---|