From fd3e098a2b7ef6563b93ba0bbfb09c5ab40d9af8 Mon Sep 17 00:00:00 2001 From: jbu Date: Wed, 17 Jun 2015 09:43:42 +0200 Subject: [PATCH] webkit2gtk: unbreak musl --- srcpkgs/webkit2gtk/patches/musl-ctype_h.patch | 11 ++++++ .../webkit2gtk/patches/musl-execinfo.patch | 38 ++++++++++++++++++ srcpkgs/webkit2gtk/patches/musl-isnan.patch | 39 +++++++++++++++++++ .../webkit2gtk/patches/musl-malloc_trim.patch | 15 +++++++ srcpkgs/webkit2gtk/template | 2 +- 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/webkit2gtk/patches/musl-ctype_h.patch create mode 100644 srcpkgs/webkit2gtk/patches/musl-execinfo.patch create mode 100644 srcpkgs/webkit2gtk/patches/musl-isnan.patch create mode 100644 srcpkgs/webkit2gtk/patches/musl-malloc_trim.patch diff --git a/srcpkgs/webkit2gtk/patches/musl-ctype_h.patch b/srcpkgs/webkit2gtk/patches/musl-ctype_h.patch new file mode 100644 index 00000000000..84fd7606763 --- /dev/null +++ b/srcpkgs/webkit2gtk/patches/musl-ctype_h.patch @@ -0,0 +1,11 @@ +--- Source/WTF/wtf/DisallowCType.h ++++ Source/WTF/wtf/DisallowCType.h +@@ -40,7 +40,7 @@ + // are used from wx headers. On GTK+ for Mac many GTK+ files include + // or , which in turn include which uses + // isacii(). +-#if !(OS(DARWIN) && PLATFORM(GTK)) && !PLATFORM(EFL) && !defined(_LIBCPP_VERSION) ++#if !(OS(DARWIN) && PLATFORM(GTK)) && !PLATFORM(EFL) && !defined(_LIBCPP_VERSION) && defined(__GLIBC__) + + #include + diff --git a/srcpkgs/webkit2gtk/patches/musl-execinfo.patch b/srcpkgs/webkit2gtk/patches/musl-execinfo.patch new file mode 100644 index 00000000000..fbd4472d0c4 --- /dev/null +++ b/srcpkgs/webkit2gtk/patches/musl-execinfo.patch @@ -0,0 +1,38 @@ +There is no execinfo.h in musl. Disable backtrace code if +__GLIBC__ is not defined. + +--- Source/WTF/wtf/Assertions.cpp ++++ Source/WTF/wtf/Assertions.cpp +@@ -71,8 +71,10 @@ + #if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__)) + #include + #include ++#if defined(__GLIBC__) + #include + #endif ++#endif + + extern "C" { + +@@ -225,7 +227,7 @@ + + void WTFGetBacktrace(void** stack, int* size) + { +-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__)) ++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__)) + *size = backtrace(stack, *size); + #elif OS(WINDOWS) + // The CaptureStackBackTrace function is available in XP, but it is not defined +index 657ced4..ceb9c47 100644 +--- Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp ++++ Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp +@@ -46,7 +46,9 @@ + + #include + #include ++#if defined(__GLIBC__) + #include ++#endif + + #if ENABLE(REMOTE_INSPECTOR) + #include "JSGlobalObjectDebuggable.h" diff --git a/srcpkgs/webkit2gtk/patches/musl-isnan.patch b/srcpkgs/webkit2gtk/patches/musl-isnan.patch new file mode 100644 index 00000000000..7d66bc76c43 --- /dev/null +++ b/srcpkgs/webkit2gtk/patches/musl-isnan.patch @@ -0,0 +1,39 @@ +Explicitly use std::isnan() for musl libc + +--- Source/WTF/wtf/Stopwatch.h ++++ Source/WTF/wtf/Stopwatch.h +@@ -44,7 +44,7 @@ + + double elapsedTime(); + +- bool isActive() const { return !isnan(m_lastStartTime); } ++ bool isActive() const { return !std::isnan(m_lastStartTime); } + private: + Stopwatch() { reset(); } + +@@ -60,14 +60,14 @@ + + inline void Stopwatch::start() + { +- ASSERT_WITH_MESSAGE(isnan(m_lastStartTime), "Tried to start the stopwatch, but it is already running."); ++ ASSERT_WITH_MESSAGE(std::isnan(m_lastStartTime), "Tried to start the stopwatch, but it is already running."); + + m_lastStartTime = monotonicallyIncreasingTime(); + } + + inline void Stopwatch::stop() + { +- ASSERT_WITH_MESSAGE(!isnan(m_lastStartTime), "Tried to stop the stopwatch, but it is not running."); ++ ASSERT_WITH_MESSAGE(!std::isnan(m_lastStartTime), "Tried to stop the stopwatch, but it is not running."); + + m_elapsedTime += monotonicallyIncreasingTime() - m_lastStartTime; + m_lastStartTime = NAN; +@@ -75,7 +75,7 @@ + + inline double Stopwatch::elapsedTime() + { +- bool shouldSuspend = !isnan(m_lastStartTime); ++ bool shouldSuspend = !std::isnan(m_lastStartTime); + if (shouldSuspend) + stop(); + diff --git a/srcpkgs/webkit2gtk/patches/musl-malloc_trim.patch b/srcpkgs/webkit2gtk/patches/musl-malloc_trim.patch new file mode 100644 index 00000000000..2bd46816ecc --- /dev/null +++ b/srcpkgs/webkit2gtk/patches/musl-malloc_trim.patch @@ -0,0 +1,15 @@ +There is no malloc_trim() in musl libc + +--- Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp ++++ Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp +@@ -206,8 +206,10 @@ + + void MemoryPressureHandler::platformReleaseMemory(bool) + { ++#if defined(__GLIBC__) + ReliefLogger log("Run malloc_trim"); + malloc_trim(0); ++#endif + } + + void MemoryPressureHandler::ReliefLogger::platformLog() diff --git a/srcpkgs/webkit2gtk/template b/srcpkgs/webkit2gtk/template index 11c9aab119f..38df1078289 100644 --- a/srcpkgs/webkit2gtk/template +++ b/srcpkgs/webkit2gtk/template @@ -1,7 +1,7 @@ # Template file for 'webkit2gtk' pkgname=webkit2gtk version=2.8.3 -revision=1 +revision=2 build_style=cmake configure_args="-DPORT=GTK -DENABLE_GTKDOC=OFF -DCMAKE_LINKER=${XBPS_CROSS_TRIPLET}-gcc" short_desc="GTK+3 port of the WebKit2 browser engine"