webkgitgtk: fix 2.14 on macOS

Includes the patches from macports and fixes an issue with the
`otool -L` output that was causing g-ir-scanner to fail.
The paths in the macports patches have been modified so that they
will work with `patches` in nix (an extra directory level was
added).

+237 -13
+5 -4
pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch
··· 57 57 index 838d343..ca7fc0d 100644 58 58 --- a/giscanner/shlibs.py 59 59 +++ b/giscanner/shlibs.py 60 - @@ -53,10 +53,24 @@ def _resolve_libtool(options, binary, libraries): 60 + @@ -53,10 +53,27 @@ def _resolve_libtool(options, binary, libraries): 61 61 # Match absolute paths on OS X to conform to how libraries are usually 62 62 # referenced on OS X systems. 63 63 def _ldd_library_pattern(library_name): 64 64 + nix_store_dir = re.escape('@nixStoreDir@'.rstrip('/')) 65 65 pattern = "(?<![A-Za-z0-9_-])(lib*%s[^A-Za-z0-9_-][^\s\(\)]*)" 66 - - if platform.system() == 'Darwin': 67 - - pattern = "([^\s]*lib*%s[^A-Za-z0-9_-][^\s\(\)]*)" 66 + if platform.system() == 'Darwin': 67 + pattern = "([^\s]*lib*%s[^A-Za-z0-9_-][^\s\(\)]*)" 68 68 - return re.compile(pattern % re.escape(library_name)) 69 + + return re.compile(pattern % re.escape(library_name)) 69 70 + pattern = r''' 70 71 + ( 71 72 + (?: ··· 85 86 86 87 87 88 # This is a what we do for non-la files. We assume that we are on an 88 - @@ -115,7 +129,11 @@ def _resolve_non_libtool(options, binary, libraries): 89 + @@ -115,7 +132,11 @@ def _resolve_non_libtool(options, binary, libraries): 89 90 m = pattern.search(line) 90 91 if m: 91 92 del patterns[library]
+49 -9
pkgs/development/libraries/webkitgtk/2.14.nix
··· 2 2 , pkgconfig, gettext, gobjectIntrospection, libnotify, gnutls 3 3 , gtk2, gtk3, wayland, libwebp, enchant, xlibs, libxkbcommon, epoxy, at_spi2_core 4 4 , libxml2, libsoup, libsecret, libxslt, harfbuzz, libpthreadstubs, pcre, nettle, libtasn1, p11_kit 5 - , libidn 5 + , libidn, libedit, readline, mesa, libintlOrEmpty 6 6 , enableGeoLocation ? true, geoclue2, sqlite 7 7 , gst-plugins-base 8 8 }: ··· 18 18 description = "Web content rendering engine, GTK+ port"; 19 19 homepage = "http://webkitgtk.org/"; 20 20 license = licenses.bsd2; 21 - platforms = platforms.linux; 21 + platforms = with platforms; linux ++ darwin; 22 22 hydraPlatforms = []; 23 23 maintainers = with maintainers; [ ]; 24 24 }; 25 25 26 - preConfigure = "patchShebangs Tools"; 26 + postConfigure = optionalString stdenv.isDarwin '' 27 + substituteInPlace Source/WebKit2/CMakeFiles/WebKit2.dir/link.txt \ 28 + --replace "../../lib/libWTFGTK.a" "" 29 + substituteInPlace Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/link.txt \ 30 + --replace "../../lib/libbmalloc.a" "" 31 + sed -i "s|[\./]*\.\./lib/lib[^\.]*\.a||g" \ 32 + Source/JavaScriptCore/CMakeFiles/LLIntOffsetsExtractor.dir/link.txt \ 33 + Source/JavaScriptCore/shell/CMakeFiles/jsc.dir/link.txt \ 34 + Source/JavaScriptCore/shell/CMakeFiles/testb3.dir/link.txt \ 35 + Source/WebKit2/CMakeFiles/DatabaseProcess.dir/link.txt \ 36 + Source/WebKit2/CMakeFiles/NetworkProcess.dir/link.txt \ 37 + Source/WebKit2/CMakeFiles/webkit2gtkinjectedbundle.dir/link.txt \ 38 + Source/WebKit2/CMakeFiles/WebProcess.dir/link.txt 39 + substituteInPlace Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/link.txt \ 40 + --replace "../../lib/libWTFGTK.a" "-Wl,-all_load ../../lib/libWTFGTK.a" 41 + ''; 27 42 28 43 src = fetchurl { 29 44 url = "http://webkitgtk.org/releases/${name}.tar.xz"; ··· 32 47 33 48 # see if we can clean this up.... 34 49 35 - patches = [ ./finding-harfbuzz-icu.patch ]; 50 + patches = [ ./finding-harfbuzz-icu.patch ] 51 + ++ optionals stdenv.isDarwin [ 52 + ./PR-152650-2.patch 53 + ./PR-153138.patch 54 + ./PR-157554.patch 55 + ./PR-157574.patch 56 + ]; 36 57 37 58 cmakeFlags = [ 38 59 "-DPORT=GTK" 39 60 "-DUSE_LIBHYPHEN=0" 40 - "-DENABLE_GLES2=ON" 61 + ] 62 + ++ optional stdenv.isLinux "-DENABLE_GLES2=ON" 63 + ++ optionals stdenv.isDarwin [ 64 + "-DUSE_SYSTEM_MALLOC=ON" 65 + "-DUSE_ACCELERATE=0" 66 + "-DENABLE_INTROSPECTION=ON" 67 + "-DENABLE_MINIBROWSER=OFF" 68 + "-DENABLE_PLUGIN_PROCESS_GTK2=OFF" 69 + "-DENABLE_MINIBROWSER=OFF" 70 + "-DENABLE_VIDEO=ON" 71 + "-DENABLE_QUARTZ_TARGET=ON" 72 + "-DENABLE_X11_TARGET=OFF" 73 + "-DENABLE_OPENGL=OFF" 74 + "-DENABLE_WEB_AUDIO=OFF" 75 + "-DENABLE_WEBGL=OFF" 76 + "-DENABLE_GRAPHICS_CONTEXT_3D=OFF" 77 + "-DENABLE_GTKDOC=OFF" 41 78 ]; 42 79 43 80 # XXX: WebKit2 missing include path for gst-plugins-base. 44 81 # Filled: https://bugs.webkit.org/show_bug.cgi?id=148894 45 - NIX_CFLAGS_COMPILE = "-I${gst-plugins-base.dev}/include/gstreamer-1.0"; 82 + NIX_CFLAGS_COMPILE = "-I${gst-plugins-base.dev}/include/gstreamer-1.0" 83 + + (optionalString stdenv.isDarwin " -lintl"); 46 84 47 85 nativeBuildInputs = [ 48 86 cmake perl python2 ruby bison gperf sqlite 49 87 pkgconfig gettext gobjectIntrospection 50 88 ]; 51 89 52 - buildInputs = [ 53 - gtk2 wayland libwebp enchant libnotify gnutls pcre nettle libidn 90 + buildInputs = libintlOrEmpty ++ [ 91 + gtk2 libwebp enchant libnotify gnutls pcre nettle libidn 54 92 libxml2 libsecret libxslt harfbuzz libpthreadstubs libtasn1 p11_kit 55 93 gst-plugins-base libxkbcommon epoxy at_spi2_core 56 94 ] ++ optional enableGeoLocation geoclue2 57 - ++ (with xlibs; [ libXdmcp libXt libXtst ]); 95 + ++ (with xlibs; [ libXdmcp libXt libXtst ]) 96 + ++ optionals stdenv.isDarwin [ libedit readline mesa ] 97 + ++ optional stdenv.isLinux wayland; 58 98 59 99 propagatedBuildInputs = [ 60 100 libsoup gtk3
+62
pkgs/development/libraries/webkitgtk/PR-152650-2.patch
··· 1 + From 4607ea0a569b3c527ae8dce341ab55eb0d69d8f7 Mon Sep 17 00:00:00 2001 2 + From: Jeremy Huddleston Sequoia <jeremyhu@apple.com> 3 + Date: Tue, 8 Mar 2016 17:26:23 -0800 4 + Subject: [PATCH 2/2] [GTK][Mac] Enable support for gtk-doc on Mac 5 + 6 + https://bugs.webkit.org/show_bug.cgi?id=152650 7 + 8 + Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> 9 + --- 10 + ChangeLog | 10 ++++++++++ 11 + Source/PlatformGTK.cmake | 2 +- 12 + Source/cmake/OptionsGTK.cmake | 5 ----- 13 + 3 files changed, 11 insertions(+), 6 deletions(-) 14 + 15 + diff --git a/Source/PlatformGTK.cmake b/Source/PlatformGTK.cmake 16 + index af4d2e3..0b11b56 100644 17 + --- a/Source/PlatformGTK.cmake 18 + +++ b/Source/PlatformGTK.cmake 19 + @@ -34,7 +34,7 @@ endmacro() 20 + add_gtkdoc_generator("docs-build.stamp" "") 21 + if (ENABLE_GTKDOC) 22 + add_custom_target(gtkdoc ALL DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp") 23 + -elseif (NOT ENABLED_COMPILER_SANITIZERS AND NOT CMAKE_CROSSCOMPILING AND NOT APPLE) 24 + +elseif (NOT ENABLED_COMPILER_SANITIZERS AND NOT CMAKE_CROSSCOMPILING) 25 + add_custom_target(gtkdoc DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp") 26 + 27 + # Add a default build step which check that documentation does not have any warnings 28 + diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake 29 + index 6b01f1a..b443d10 100644 30 + --- a/Source/cmake/OptionsGTK.cmake 31 + +++ b/Source/cmake/OptionsGTK.cmake 32 + @@ -424,11 +424,6 @@ if (CMAKE_CROSSCOMPILING) 33 + set(ENABLE_INTROSPECTION OFF) 34 + endif () 35 + 36 + -# Override the cached variable, gtk-doc does not really work when building on Mac. 37 + -if (APPLE) 38 + - set(ENABLE_GTKDOC OFF) 39 + -endif () 40 + - 41 + set(DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR ${DERIVED_SOURCES_DIR}/webkitdom) 42 + set(DERIVED_SOURCES_WEBKITGTK_DIR ${DERIVED_SOURCES_DIR}/webkitgtk) 43 + set(DERIVED_SOURCES_WEBKITGTK_API_DIR ${DERIVED_SOURCES_WEBKITGTK_DIR}/webkit) 44 + diff --git a/Tools/gtk/gtkdoc.py b/Tools/gtk/gtkdoc.py 45 + index 4c8237b..a628ae0 100644 46 + --- a/Tools/gtk/gtkdoc.py 47 + +++ b/Tools/gtk/gtkdoc.py 48 + @@ -322,6 +322,11 @@ class GTKDoc(object): 49 + env['RUN'] = 'LD_LIBRARY_PATH="%s:%s" ' % (self.library_path, current_ld_library_path) 50 + else: 51 + env['RUN'] = 'LD_LIBRARY_PATH="%s" ' % self.library_path 52 + + current_dyld_library_path = env.get('DYLD_LIBRARY_PATH') 53 + + if current_ld_library_path: 54 + + env['RUN'] = 'DYLD_LIBRARY_PATH="%s:%s" ' % (self.library_path, current_dyld_library_path) 55 + + else: 56 + + env['RUN'] = 'DYLD_LIBRARY_PATH="%s" ' % self.library_path 57 + 58 + if ldflags: 59 + env['LDFLAGS'] = '%s %s' % (ldflags, env.get('LDFLAGS', '')) 60 + -- 61 + 2.7.2 62 +
+26
pkgs/development/libraries/webkitgtk/PR-153138.patch
··· 1 + From 07886d9eacb7587dd52a9bcae10c1fc8ab56a910 Mon Sep 17 00:00:00 2001 2 + From: Jeremy Huddleston Sequoia <jeremyhu@apple.com> 3 + Date: Fri, 15 Jan 2016 11:53:07 -0800 4 + Subject: [PATCH] https://bugs.webkit.org/show_bug.cgi?id=153138 5 + 6 + Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> 7 + --- 8 + Source/JavaScriptCore/bytecode/StructureStubInfo.cpp | 2 ++ 9 + 1 file changed, 2 insertions(+) 10 + 11 + diff --git a/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp b/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp 12 + index 1e4b4f5..9b27aed 100644 13 + --- a/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp 14 + +++ b/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp 15 + @@ -26,6 +26,8 @@ 16 + #include "config.h" 17 + #include "StructureStubInfo.h" 18 + 19 + +#include "JSCellInlines.h" 20 + + 21 + #include "JSObject.h" 22 + #include "PolymorphicAccess.h" 23 + #include "Repatch.h" 24 + -- 25 + 2.7.0 26 +
+33
pkgs/development/libraries/webkitgtk/PR-157554.patch
··· 1 + https://bugs.webkit.org/show_bug.cgi?id=157554 2 + 3 + --- a/Source/WTF/wtf/OSRandomSource.cpp 4 + +++ b/Source/WTF/wtf/OSRandomSource.cpp 5 + @@ -29,7 +29,7 @@ 6 + #include <stdint.h> 7 + #include <stdlib.h> 8 + 9 + -#if !OS(DARWIN) && OS(UNIX) 10 + +#if OS(UNIX) && !(OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) 11 + #include <errno.h> 12 + #include <fcntl.h> 13 + #include <unistd.h> 14 + @@ -46,7 +46,7 @@ 15 + 16 + namespace WTF { 17 + 18 + -#if !OS(DARWIN) && OS(UNIX) 19 + +#if OS(UNIX) && !(OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) 20 + NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void crashUnableToOpenURandom() 21 + { 22 + CRASH(); 23 + @@ -60,8 +56,8 @@ NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void crashUnableToReadFromURandom() 24 + 25 + void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length) 26 + { 27 + -#if OS(DARWIN) 28 + - RELEASE_ASSERT(!CCRandomCopyBytes(kCCRandomDefault, buffer, length)); 29 + +#if OS(DARWIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 30 + + return arc4random_buf(buffer, length); 31 + #elif OS(UNIX) 32 + int fd = open("/dev/urandom", O_RDONLY, 0); 33 + if (fd < 0)
+62
pkgs/development/libraries/webkitgtk/PR-157574.patch
··· 1 + diff --git a/Source/JavaScriptCore/API/WebKitAvailability.h b/Source/JavaScriptCore/API/WebKitAvailability.h 2 + index ab53183..1310dec 100644 3 + --- a/Source/JavaScriptCore/API/WebKitAvailability.h 4 + +++ b/Source/JavaScriptCore/API/WebKitAvailability.h 5 + @@ -27,57 +27,12 @@ 6 + #define __WebKitAvailability__ 7 + 8 + #if defined(__APPLE__) 9 + - 10 + -#include <AvailabilityMacros.h> 11 + #include <CoreFoundation/CoreFoundation.h> 12 + - 13 + -#if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100 14 + -/* To support availability macros that mention newer OS X versions when building on older OS X versions, 15 + - we provide our own definitions of the underlying macros that the availability macros expand to. We're 16 + - free to expand the macros as no-ops since frameworks built on older OS X versions only ship bundled with 17 + - an application rather than as part of the system. 18 + -*/ 19 + - 20 + -#ifndef __NSi_10_10 // Building from trunk rather than SDK. 21 + -#define __NSi_10_10 introduced=10.0 // Use 10.0 to indicate that everything is available. 22 + -#endif 23 + - 24 + -#ifndef __NSi_10_11 // Building from trunk rather than SDK. 25 + -#define __NSi_10_11 introduced=10.0 // Use 10.0 to indicate that everything is available. 26 + -#endif 27 + - 28 + -#ifndef __NSi_10_12 // Building from trunk rather than SDK. 29 + -#define __NSi_10_12 introduced=10.0 // Use 10.0 to indicate that everything is available. 30 + -#endif 31 + - 32 + -#ifndef __AVAILABILITY_INTERNAL__MAC_10_9 33 + -#define __AVAILABILITY_INTERNAL__MAC_10_9 34 + -#endif 35 + - 36 + -#ifndef __AVAILABILITY_INTERNAL__MAC_10_10 37 + -#define __AVAILABILITY_INTERNAL__MAC_10_10 38 + #endif 39 + 40 + -#ifndef AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER 41 + -#define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER 42 + -#endif 43 + - 44 + -#ifndef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER 45 + -#define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER 46 + -#endif 47 + - 48 + -#endif /* __MAC_OS_X_VERSION_MIN_REQUIRED <= 101100 */ 49 + - 50 + -#if defined(BUILDING_GTK__) 51 + #undef CF_AVAILABLE 52 + #define CF_AVAILABLE(_mac, _ios) 53 + #undef CF_ENUM_AVAILABLE 54 + #define CF_ENUM_AVAILABLE(_mac, _ios) 55 + -#endif 56 + - 57 + -#else 58 + -#define CF_AVAILABLE(_mac, _ios) 59 + -#define CF_ENUM_AVAILABLE(_mac, _ios) 60 + -#endif 61 + 62 + #endif /* __WebKitAvailability__ */