Ticket #68705: Portfile

File Portfile, 10.9 KB (added by JDLH (Jim DeLaHunt), 3 weeks ago)

webkit2-gtk Portfile, revision 8, applies patch-deprecated-file-exists-rb32.diff

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
2
3# We have an umbrella radar tracking webkit-gtk issues on OS X.  Please relate
4# any future issues with this tracker.
5# http://bugs.webkit.org/show_bug.cgi?id=126492
6
7PortSystem          1.0
8PortGroup           active_variants 1.1
9PortGroup           cmake 1.1
10PortGroup           legacysupport 1.1
11
12compiler.cxx_standard 2017
13cmake.generator     Ninja
14# Fix compilation for Angle subproject: platform.h: error: 'TARGET_OS_OSX' is not defined
15legacysupport.newest_darwin_requires_legacy 15
16
17name                webkit2-gtk
18conflicts           webkit2-gtk-devel
19version             2.28.2
20revision            9
21
22description         Apple's WebKit2 HTML rendering library for GTK+3
23long_description    {*}${description}
24maintainers         {devans @dbevans} {mascguy @mascguy}
25categories          www gnome
26platforms           darwin freebsd
27license             LGPL-2+ BSD
28homepage            http://webkitgtk.org/
29master_sites        http://webkitgtk.org/releases/
30
31use_xz              yes
32distname            webkitgtk-${version}
33
34dist_subdir         webkit-gtk
35
36checksums           rmd160  a626f58cf30b6dd1ef8a63c165ce85770c4da675 \
37                    sha256  b9d23525cfd8d22c37b5d964a9fe9a8ce7583042a2f8d3922e71e6bbc68c30bd \
38                    size    21427772
39
40depends_build-append \
41                    port:gperf \
42                    port:gtk-doc \
43                    port:perl5.34 \
44                    port:pkgconfig \
45                    port:python27 \
46                    port:py27-simplejson
47
48depends_lib-append  port:atk \
49                    port:at-spi2-atk \
50                    port:bison \
51                    path:lib/pkgconfig/cairo.pc:cairo \
52                    port:flex \
53                    port:fontconfig \
54                    port:freetype \
55                    port:enchant2 \
56                    port:geoclue2 \
57                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
58                    path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection \
59                    port:gstreamer1 \
60                    port:gstreamer1-gst-plugins-bad \
61                    port:gstreamer1-gst-plugins-base \
62                    port:gstreamer1-gst-plugins-good \
63                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
64                    path:lib/pkgconfig/harfbuzz-icu.pc:harfbuzz-icu \
65                    port:hyphen \
66                    path:lib/pkgconfig/icu-uc.pc:icu \
67                    path:include/turbojpeg.h:libjpeg-turbo \
68                    port:libnotify \
69                    port:libpng \
70                    port:libsecret \
71                    path:lib/pkgconfig/libsoup-2.4.pc:libsoup \
72                    port:libxml2 \
73                    port:libxslt \
74                    port:sqlite3 \
75                    port:webp \
76                    port:woff2 \
77                    port:zlib
78
79
80# 1. add missing JavaScriptCore include directory used only on Apple webkit builds
81# 2. don't copy the ICU includes into the source tree
82# 3. add missing WebCore include directory used only on Apple webkit builds
83# 4. add a missing Apple-only header found in the WebKit project
84# 5. change some int64_t to gint64 to stop typedef errors in gstreamer
85patchfiles-append   patch-webkit2gtk-macports.diff
86
87# and a few more for webkit2-gtk-2.27.2
88patchfiles-append   patch-webkit2gtk-272-macports.diff
89
90# and a few more for 282
91patchfiles-append   patch-webkit2gtk-2282-unprotected-egl-changes.diff
92
93# os log is only available on newer systems.
94patchfiles-append   patch-webkit2gtk-2282-os-log-availability.diff
95
96# enable Netscape plugin architecture on macOS
97# or can be explicitly disabled with the following addition if preferred
98# configure.args-append -DENABLE_NETSCAPE_PLUGIN_API=OFF
99patchfiles-append    patch-enable-plugin-architecture-unix.diff
100
101# add a link library to WebCore. I am not sure this is still needed; builds and
102# runs without this patch.
103patchfiles-append    patch-bundle-link-webcore.diff
104
105# Fix incompatibility with XCode 12:
106# https://bugs.webkit.org/show_bug.cgi?id=207871
107patchfiles-append    patch-WTF-wtf-getVTablePointer.diff
108
109# Fix build errors due to -WWc++11-narrowing
110# https://bugs.webkit.org/show_bug.cgi?id=211193
111patchfiles-append    patch-bool_narrowed.diff
112
113# Explicitly specify installed dylib paths to g-ir-compile
114# Fixes dlopen errors in apps using webkit2gtk introspection
115patchfiles-append    patch-webkit2gtk-specify-installed-dylibs.diff
116
117# Backport https://github.com/WebKit/WebKit/commit/b83958928838b8a997c12a8de06f89377df0a903
118patchfiles-append    patch-icu-68-true-false.diff
119
120# API changed with libxml2 2.12+
121# https://github.com/WebKit/WebKit/commit/1bad176b2496579d760852c80cff3ad9fb7c3a4b
122patchfiles-append    patch-webkit2-gtk-fixes-for-libxml2-2.12.0.diff
123
124# Fix build with Ruby 3.2
125# MacPorts ticket https://trac.macports.org/ticket/68705
126# Webkit ticket: https://bugs.webkit.org/show_bug.cgi?id=246743
127# Commit for Webkit 2.38.0 which fixes it:
128# https://github.com/WebKit/WebKit/commit/b7ac5d0ccc7ca3ed6bf4f2d40fde60247ce87d3c
129# The following diff is a backport of the above patch to Webkit 2.28.2.
130patchfiles-append    patch-deprecated-file-exists-rb32.diff
131
132# Reduce compilation warnings
133configure.cppflags-append \
134    -Wno-deprecated-declarations
135
136# it is preferred to use the WebKit built in bmalloc if it builds on a given os.
137# it has improved security features, but not all systems can build it at present.
138configure.args-append \
139    -DPORT=GTK \
140    -DENABLE_INTROSPECTION=ON \
141    -DENABLE_MINIBROWSER=OFF \
142    -DENABLE_VIDEO=ON \
143    -DUSE_SYSTEM_MALLOC=OFF \
144    -DPERL_EXECUTABLE=${prefix}/bin/perl5.34
145
146pre-configure {
147    if {![variant_isset quartz] && ![variant_isset x11]} {
148        error "Either +x11 or +quartz is required"
149    }
150}
151
152if {![variant_isset quartz]} {
153    default_variants-append +x11
154}
155
156# this is nice to have, and should be the default
157default_variants-append +minibrowser
158
159variant quartz conflicts x11 {
160    require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 quartz
161
162    # TODO: restrict this patch to just Big Sur?
163    patchfiles-append patch-Source_WebKit_Platform_IPC_Connection.cpp.diff
164
165    configure.args-append \
166        -DENABLE_QUARTZ_TARGET=ON \
167        -DENABLE_X11_TARGET=OFF \
168        -DENABLE_OPENGL=OFF
169
170# OPENGL does not work with +quartz, eg: https://trac.macports.org/ticket/52495
171# OPENGL must be explicitly turned off, otherwise GLX is found, but X11 is not, and:
172# CMake Error at Source/cmake/OptionsGTK.cmake:280 (message):
173#  Either GLX or EGL is needed for ENABLE_OPENGL.
174
175}
176
177variant x11 conflicts quartz {
178    require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 x11
179
180    configure.args-append \
181        -DENABLE_QUARTZ_TARGET=OFF \
182        -DENABLE_X11_TARGET=ON \
183        -DENABLE_OPENGL=OFF
184
185    depends_lib-append \
186        port:mesa \
187        port:xorg-libXt
188}
189
190variant minibrowser description {Build and install MiniBrowser (for testing)} {
191    configure.args-delete   -DENABLE_MINIBROWSER=OFF
192    configure.args-append   -DENABLE_MINIBROWSER=ON
193    depends_run-append       port:adwaita-icon-theme
194}
195
196# see https://trac.macports.org/ticket/56792
197# no success at building universal after considerable attempts
198# errors out in the javascript interpreter
199# muniversal PG does not fix it. disabling the JIT does not fix it
200# help wanted, if suitably motivated
201universal_variant   no
202
203# Fix builds if ccache happens to be installed when configure.ccache=no
204if {![option configure.ccache]} {
205    build.env-append        CCACHE_DIR=${workpath}/.ccache
206}
207
208# the above code presently builds as-in on 10.13 and up
209if {${os.platform} eq "darwin" && ${os.major} <= 16} {
210
211    # build of bmalloc fails up to 10.12 https://trac.macports.org/ticket/59447
212    configure.args-replace -DUSE_SYSTEM_MALLOC=OFF -DUSE_SYSTEM_MALLOC=ON
213    patchfiles-append       patch-ramsize.diff
214
215    # Source/WTF/wtf/unix/CPUTimeUnix.cpp : add back a previous Darwin compat version
216    patchfiles-append       patch-source-wtf-wtf-unix-cputimeunix-cpp-darwin-version-restore.diff
217
218    # some Darwin versions don't have MAP_JIT; only use it if available
219    patchfiles-append       patch-source-wtf-wtf-osallocatorposix-cpp-map-jit.diff
220
221    # gl cocoa build continues to fail due to use of API not available on darwin 12 or earlier
222    # so gstreamergl is not available at present for darwin 12 or earlier
223    # todo clarify further where this is exactly needed
224    configure.args-append -DUSE_GSTREAMER_GL=OFF
225
226    # for the webcore/page/crypt code to flow correctly,
227    # ENABLE_WEB_CRYPTO has to be ON for 10.10+ and OFF for 10.9 and less
228    if {${os.major} <= 13} {
229        configure.args-append  -DENABLE_WEB_CRYPTO=OFF
230    }
231    # disable Apple internal security libraries, available only on new systems
232    patchfiles-append       patch-Webcore-page-crypto.diff
233
234    # restrict special process memory kernel calls to 10.9+ that support them
235    patchfiles-append       patch-WTF-wtf-spi-darwin-ProcessMemoryFootprint-h.diff
236
237    # the darwin build uses security features that are Apple internal only, but
238    # the unix version does not FIXME: sort the ifdefs out
239    # https://bugs.webkit.org/show_bug.cgi?id=157554
240    patchfiles-append       patch-WTF-wtf-Randomdevice.diff
241
242    # disable veclib on 10.7 and 10.8. There is a definition for
243    # class complex<> in the vForce.h header that collides with libc++
244    # if anyone has a more elegant fix for this, please volunteer it
245    if {${os.major} == 11 || ${os.major} == 12} {
246        patchfiles-append       patch-webcore-platform-audio-directconvolver-disable-veclib.diff
247    }
248
249    # there is a missing header that manifests on 10.7 and less
250    patchfiles-append patch-webkit2gtk-source-javascriptcore-jit-executableallocator-missingfcntl-h-older-systems.diff
251
252    # add dep for newer ruby and spec this for build
253    # https://trac.macports.org/ticket/52016
254    depends_build-append    port:ruby25
255    configure.args-append   -DRUBY_EXECUTABLE=${prefix}/bin/ruby2.5
256
257    # fix missing PRId64 definitions on systems
258    # that don't define __STDC_FORMAT_MACROS by default
259    # https://bugs.webkit.org/show_bug.cgi?id=156596
260    # https://trac.macports.org/ticket/52016
261    # also added defn for TARGET_OS_IOS to avoid innumerable warnings
262    patchfiles-append patch-snowleopard-cmakelists-stdcformatmacros.diff
263   
264    # special case: fix build on 10.6 with macports-libstdc++
265    # contents of snowmath.h should someday become part of gcc6 cmath
266    # TODO: remove this?
267    if { ${configure.cxx_stdlib} eq "macports-libstdc++"  && ${os.major} < 11 } {
268        configure.cxxflags-append -D_GLIBCXX_USE_C99_MATH_TR1=1
269        configure.cxxflags-append -include ${filespath}/snowmath.h
270    }
271}
272
273notes-append "
274If you are porting new software to use webkit2gtk on Apple systems,\
275you will likely need to define BUILDING_GTK__ to get the correct\
276behaviour from WebKitAvailability.h.
277"
278
279livecheck.type      regex
280livecheck.url       http://webkitgtk.org/releases/
281livecheck.regex     "webkitgtk-(\\d+\\.\\d*\[02468\](?:\\.\\d+)*)"