Ticket #55318: Portfile

File Portfile, 13.9 KB (added by RJVB (René Bertin), 6 years ago)

devel/qt5-webkit/Portfile

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
3PortSystem          1.0
4PortGroup           qt5 1.0
5PortGroup           cmake 1.1
6PortGroup           github 1.0
7
8set module          qtwebkit
9set targetversion   5.212.0
10set versiontag      ${targetversion}-alpha2
11github.setup        annulen webkit ${module}-${versiontag}
12github.tarball_from releases
13name                qt5-webkit
14# set a numeric version for "5.212.0-alpha2"
15version             5.211.92
16
17categories          devel
18description         QtWebKit Reloaded
19long_description    This port provides QtWebKit upgraded to the modern WebKit code base.
20homepage            https://github.com/annulen/webkit/wiki
21universal_variant   no
22
23maintainers         gmail.com:rjvbertin openmaintainer
24platforms           darwin linux
25license             LGPL-2
26
27# Share the distfiles dir with port:qt5
28dist_subdir         qt5
29
30# subport ${name}-devel {
31#     description-append This port follows the development branch.
32#     long_description-append This port follows the development branch.
33# }
34#
35if {${subport} eq "${name}"} {
36    conflicts-append \
37                    ${name}-devel
38
39    distname        ${module}-${versiontag}
40    use_xz          yes
41    checksums       rmd160  33c3f7c68090fa16f72950ef85c20978432cc058 \
42                    sha256  f8f901de567e11fc5659402b6b827eac75505ff9c5072d8e919aa306003f8f8a
43} else {
44    fetch.type      git
45    git.branch      f53b6b8cfef091770dd3dccd8371420b63d89f83
46    version         5.211.92.53
47    distname        ${module}-git
48    conflicts-append \
49                    ${name}
50}
51
52# a convenience procedure to register conflicts among the different Qt5 ports:
53# for instance: [qt5_port_conflicts {qtbase x11}]
54# adapted from port:qt5-kde
55proc qt5_port_conflicts {components} {
56    global available_qt5_versions available_qt_versions name
57    set cnfls {}
58    if {![info exists available_qt5_versions]} {
59        ui_debug "set available_qt5_versions ${available_qt_versions}"
60        set available_qt5_versions ${available_qt_versions}
61    }
62    foreach suffix {"" "-devel"} {
63        foreach comp ${components} {
64            foreach v ${available_qt5_versions} {
65                if {"${v}-${comp}" ne "${name}"} {
66                    if {${comp} ne "" && ${comp} ne "qtbase"} {
67                        set cnfls [lappend cnfls ${v}-${comp}]
68                        set cnfls [lappend cnfls ${v}-kde${suffix}-${comp}]
69                    } else {
70                        set cnfls [lappend cnfls ${v}-qtbase]
71                        set cnfls [lappend cnfls ${v}-kde${suffix}]
72                    }
73                }
74            }
75        }
76    }
77    return ${cnfls}
78}
79proc qt5.active_version {} {
80    global prefix
81    if {[file exists ${prefix}/bin/pkg-config]} {
82        set av [exec ${prefix}/bin/pkg-config --modversion Qt5Core]
83        return ${av}
84    } else {
85        return 0.0.0
86    }
87}
88
89conflicts-append        [qt5_port_conflicts qtwebkit]
90
91depends_lib-append      port:webp \
92                        port:libxml2 \
93                        port:libxslt \
94                        port:zlib \
95                        port:sqlite3
96platform darwin {
97    depends_lib-append  port:icu \
98                        port:leveldb \
99                        port:fontconfig \
100                        port:hyphen
101    depends_build-append \
102                        port:bison \
103                        port:perl5 \
104                        port:gperf
105    # we need ruby during the build; the system copy will do just
106    # fine as long as it's at least v1.9 .
107    depends_build-append \
108                        bin:ruby:ruby19
109}
110
111if {![variant_isset minimal]} {
112    qt5.depends_component \
113                        qtdeclarative \
114                        qtxmlpatterns \
115                        qtlocation \
116                        qtmultimedia \
117                        qtsensors \
118                        qtwebchannel
119}
120
121patch.pre_args          -Np1
122
123# add the commits made to the qtwebkit-stable branch since the alpha release:
124patchfiles-append       patch-upstream-20171112.diff
125
126# make some modifications for OS X 10.9 (and earlier; untested)
127patchfiles-append       patch-allow-pre-osx1010.diff
128# make sure we use not only the ICU headerfiles from MacPorts, but also the library!
129patchfiles-append       patch-use-icu.diff
130# # we'll want to generate .pkg files
131# # (NB: if those don't work, just provide copies in ${filespath})
132# patchfiles-append       patch-generate-pkgconfigs.diff
133# set the framework compatibility version to the same value as used
134# by the Qt version against which we're building. The default 5.0.0
135# version will be rejected by any app that was linked to a more recent
136# Qt version.
137patchfiles-append       patch-set-compatversion.diff
138
139if {[info proc cmake.save_configure_cmd] ne ""} {
140    cmake.save_configure_cmd "log too"
141}
142
143set branch              [join [lrange [split [qt5.active_version] .] 0 1] .]
144
145configure.args-append   -DENABLE_API_TESTS=OFF \
146                        -DENABLE_PRINT_SUPPORT=ON \
147                        -DENABLE_DEVICE_ORIENTATION=ON \
148                        -DENABLE_GEOLOCATION=ON \
149                        -DENABLE_JIT=ON \
150                        -DENABLE_OPENGL=ON \
151                        -DENABLE_WEBKIT2=ON \
152                        -DENABLE_QT_WEBCHANNEL=ON \
153                        -DUSE_LIBHYPHEN=ON \
154                        -DPORT=Qt
155if {${os.platform} eq "darwin"} {
156    configure.args-append \
157                        -DUSE_QT_MULTIMEDIA=ON \
158                        -DMACOS_FORCE_SYSTEM_XML_LIBRARIES=OFF
159} else {
160    configure.args-append \
161                        -DUSE_GSTREAMER=ON
162}
163
164variant docs description {build the API documentation} {}
165if {[variant_isset docs]} {
166    configure.args-append \
167                        -DGENERATE_DOCUMENTATION=ON
168}
169
170variant minimal description {build a lean & mean variant, sufficient for documentation viewing} {}
171if {[variant_isset minimal]} {
172    configure.args-replace \
173                        -DENABLE_DEVICE_ORIENTATION=ON \
174                        -DENABLE_DEVICE_ORIENTATION=OFF
175    configure.args-replace \
176                        -DENABLE_GEOLOCATION=ON \
177                        -DENABLE_GEOLOCATION=OFF
178#     configure.args-replace \
179#                         -DENABLE_JIT=ON \
180#                         -DENABLE_JIT=OFF
181    configure.args-replace \
182                        -DENABLE_WEBKIT2=ON \
183                        -DENABLE_WEBKIT2=OFF
184    configure.args-replace \
185                        -DENABLE_QT_WEBCHANNEL=ON \
186                        -DENABLE_QT_WEBCHANNEL=OFF
187    if {${os.platform} eq "darwin"} {
188        configure.args-replace \
189                        -DUSE_QT_MULTIMEDIA=ON \
190                        -DUSE_QT_MULTIMEDIA=OFF
191    } else {
192        configure.args-replace \
193                        -DUSE_GSTREAMER=ON \
194                        -DUSE_GSTREAMER=OFF
195    }
196    configure.args-append \
197                        -DENABLE_FTL_JIT=OFF \
198                        -DENABLE_INSPECTOR_UI=OFF \
199                        -DENABLE_DRAG_SUPPORT=OFF \
200                        -DENABLE_SAMPLING_PROFILER=OFF \
201                        -DENABLE_VIDEO=OFF \
202                        -DENABLE_VIDEO_TRACK=OFF
203}
204
205configure.pre_args-delete \
206                        -DCMAKE_INSTALL_NAME_DIR="${cmake.install_prefix}/lib"
207
208configure.args-append   -DKDE_INSTALL_INCLUDEDIR=${qt_includes_dir} \
209                        -DBIN_INSTALL_DIR=${qt_bins_dir}
210
211if {${os.platform} eq "darwin"} {
212    configure.pre_args-append \
213                        -DCMAKE_INSTALL_NAME_DIR="${qt_frameworks_dir}"
214    configure.args-append \
215                        -DLIB_INSTALL_DIR=${qt_frameworks_dir} \
216                        -DCOMPATIBILITY_VERSION="${branch}.0"
217    if {${os.major} == 13} {
218        # this OS supports an almost complete build using the 10.10 SDK
219        # (the allow-pre-1010 patch takes care of deactivating unsupported bits and pieces)
220        set macosx_deployment_target 10.10
221        if {[catch {configure.sdkroot [exec xcrun --show-sdk-path -sdk macosx10.10]} result]} {
222            ui_warn "The SDK macosx10.10 is required on Mac OS X 10.9: ${result}"
223            configure.args-append \
224                        -DUSE_SYSTEM_MALLOC=ON
225        } else {
226            ui_debug "Using SDK macosx10.10 (${configure.sdkroot}): ${result}"
227        }
228    } elseif {${os.major} < 13} {
229        PortGroup       cxx11 1.0
230        configure.args-append \
231                        -DUSE_SYSTEM_MALLOC=ON
232    }
233} else {
234    configure.pre_args-append \
235                        -DCMAKE_INSTALL_NAME_DIR="${qt_libs_dir}"
236    configure.args-append \
237                        -DLIB_INSTALL_DIR=${qt_libs_dir} \
238                        -DCOMPATIBILITY_VERSION="5" \
239                        -DUSE_LD_GOLD=OFF
240}
241
242post-destroot {
243    if {[tbool qt5.using_kde]} {
244        if {[info exists qt_cmake_module_dir]} {
245            ui_info "fixing and moving the CMake files into ${qt_cmake_module_dir}"
246            if {[file exists ${destroot}${qt_frameworks_dir}/cmake]} {
247                set srcdir ${qt_frameworks_dir}
248                # replace the *_install_prefix path with the correct path, but "take a detour" through ${qt_dir}
249                # as an extra insurance and to show the expected Qt install location in case cmake ever finds
250                # a .cmake script that doesn't below to this Qt5 port.
251                set sedcmd "s|/../../../../|/../../../${qt_dir_rel}/|g"
252            } else {
253                set srcdir ${qt_libs_dir}
254                set sedcmd "s|/../../../../../|/../../../${qt_dir_rel}/../../|g"
255            }
256            xinstall -v -m 755 -d ${destroot}${qt_cmake_module_dir}
257            foreach d [glob -tails -nocomplain -directory ${destroot}${srcdir}/cmake *] {
258                xinstall -m 755 -d ${destroot}${qt_cmake_module_dir}/${d}
259                foreach f [glob -nocomplain -directory ${destroot}${srcdir}/cmake/${d} *.cmake] {
260                    # ${qt_frameworks_dir} is  ${qt_dir}/Library/Frameworks while
261                    # ${qt_libs_dir}       is  ${qt_dir}/lib
262                    # unless modified, cmake files will point to a directory that is too high in the directory hierarchy
263                    reinplace ${sedcmd} ${f}
264                    # these cmake modules are generated with ECM and thus use a different way
265                    # to set determine the prefix. After moving them like we just did we'll need
266                    # to correct the fallback because it's what will be used.
267                    reinplace "s|set(_IMPORT_PREFIX \"\")|set(_IMPORT_PREFIX \"${prefix}\")|g" ${f}
268                    file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/
269                }
270            }
271        }
272        platform darwin {
273            # we'll have ended up with the headers in $prefix/include/qt5 (qt_includes_dir) which
274            # is where there should be a symlink to the framework headers dir instead. Fix that.
275            file delete -force ${destroot}${qt_frameworks_dir}/QtWebKit.framework/Versions/5/Headers
276            file delete -force ${destroot}${qt_frameworks_dir}/QtWebKitWidgets.framework/Versions/5/Headers
277            file rename ${destroot}${qt_includes_dir}/QtWebKit ${destroot}${qt_frameworks_dir}/QtWebKit.framework/Versions/5/Headers/
278            file rename ${destroot}${qt_includes_dir}/QtWebKitWidgets ${destroot}${qt_frameworks_dir}/QtWebKitWidgets.framework/Versions/5/Headers/
279            ln -s ${qt_frameworks_dir}/QtWebKit.framework/Versions/5/Headers ${destroot}${qt_includes_dir}/QtWebKit
280            ln -s ${qt_frameworks_dir}/QtWebKitWidgets.framework/Versions/5/Headers ${destroot}${qt_includes_dir}/QtWebKitWidgets
281        }
282    } else {
283        # this comes from `port file qt5-qtbase`
284        xinstall -d -m 0755 ${destroot}${prefix}/lib/cmake
285        foreach cmakedir [glob -type d -nocomplain -tails -directory ${destroot}${qt_libs_dir}/cmake *] {
286            xinstall -d -m 0755 ${destroot}${prefix}/lib/cmake/${cmakedir}
287            foreach cmakefile [glob -tails -directory ${destroot}${qt_libs_dir}/cmake/${cmakedir} *.cmake] {
288                ln -s ${qt_libs_dir}/cmake/${cmakedir}/${cmakefile} ${destroot}${prefix}/lib/cmake/${cmakedir}/
289            }
290        }
291
292        # if cmake finds configuration files in ${prefix}/lib/cmake, CMAKE_CURRENT_LIST_DIR expands to ${prefix}/lib/cmake/xxx
293        # cmake configuration files actually installed in ${qt_cmake_module_dir}/xxx
294        foreach cmakedir [glob -type d -nocomplain -tails -directory ${destroot}${qt_libs_dir}/cmake *] {
295            foreach cmakefile [glob -nocomplain -directory ${destroot}${qt_libs_dir}/cmake/${cmakedir} *.cmake] {
296                reinplace "s|\\\${CMAKE_CURRENT_LIST_DIR}|${qt_cmake_module_dir}/${cmakedir}|g" ${cmakefile}
297            }
298        }
299    }
300    if {${os.platform} eq "darwin"} {
301        file delete -force ${destroot}${qt_frameworks_dir}/pkgconfig
302        xinstall -m 755 -d ${destroot}${qt_pkg_config_dir}
303        xinstall -m 755 ${filespath}/Qt5WebKit.pc ${destroot}${qt_pkg_config_dir}
304        xinstall -m 755 ${filespath}/Qt5WebKitWidgets.pc ${destroot}${qt_pkg_config_dir}
305        reinplace "s|@PREFIX@|${prefix}|g" \
306                     ${destroot}${qt_pkg_config_dir}/Qt5WebKit.pc \
307                     ${destroot}${qt_pkg_config_dir}/Qt5WebKitWidgets.pc
308        reinplace "s|@FRAMEWORKSDIR@|${qt_frameworks_dir}|g" \
309                     ${destroot}${qt_pkg_config_dir}/Qt5WebKit.pc \
310                     ${destroot}${qt_pkg_config_dir}/Qt5WebKitWidgets.pc
311        reinplace "s|@INCLUDESDIR@|${qt_includes_dir}|g" \
312                     ${destroot}${qt_pkg_config_dir}/Qt5WebKit.pc \
313                     ${destroot}${qt_pkg_config_dir}/Qt5WebKitWidgets.pc
314        reinplace "s|@VERSION@|${targetversion}|g" \
315                     ${destroot}${qt_pkg_config_dir}/Qt5WebKit.pc \
316                     ${destroot}${qt_pkg_config_dir}/Qt5WebKitWidgets.pc
317    }
318}
319
320# optional support for HFS-compression of the source and build dirs
321if {[file exists ${qt5::currentportgroupdir}/compress_workdir-1.0.tcl]} {
322    PortGroup       compress_workdir 1.0
323}