From 8e17f439cf97a2343bbf307a69426e45a7134e7b Mon Sep 17 00:00:00 2001 From: Fukang Chen Date: Tue, 19 Jun 2018 03:40:38 +0000 Subject: [PATCH] lang/phantomjs: Allow building on armv6 and armv7 platforms - Patches for armv6 and armv7 are obtained from www/webkit-gtk3 - Allow building with non-default LOCALBASE - Fix build with Clang 6.0.0 [0] PR: 225482 [0] Reviewed by: koobs, feld Approved by: koobs (mentor), feld (maintainner) Differential Revision: https://reviews.freebsd.org/D15850 --- lang/phantomjs/Makefile | 4 +--- ...qt_qtbase_mkspecs_freebsd-clang_qmake.conf | 13 ++++++++++++ ...ce_JavaScriptCore_assembler_ARMAssembler.h | 17 ++++++++++++++++ ...-src_qt_qtwebkit_Source_WTF_wtf_Platform.h | 19 ++++++++++++++++++ ...raphics_cpu_arm_filters_FELightingNEON.cpp | 18 +++++++++++++++++ lang/phantomjs/files/patch-src_webpage.cpp | 20 +++++++++++++++++++ 6 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 lang/phantomjs/files/patch-src_qt_qtbase_mkspecs_freebsd-clang_qmake.conf create mode 100644 lang/phantomjs/files/patch-src_qt_qtwebkit_Source_JavaScriptCore_assembler_ARMAssembler.h create mode 100644 lang/phantomjs/files/patch-src_qt_qtwebkit_Source_WTF_wtf_Platform.h create mode 100644 lang/phantomjs/files/patch-src_qt_qtwebkit_Source_WebCore_platform_graphics_cpu_arm_filters_FELightingNEON.cpp create mode 100644 lang/phantomjs/files/patch-src_webpage.cpp diff --git a/lang/phantomjs/Makefile b/lang/phantomjs/Makefile index eec9d8ed4fa1..07d00abc2915 100644 --- a/lang/phantomjs/Makefile +++ b/lang/phantomjs/Makefile @@ -12,8 +12,6 @@ LICENSE= BSD3CLAUSE BROKEN_powerpc64= fails to build: g++48: not found BROKEN_sparc64= does not link on sparc64 -NOT_FOR_ARCHS= armv6 armv7 -NOT_FOR_ARCHS_REASON= Platform.h: Not supported ARM architecture BROKEN_SSL= openssl-devel BROKEN_SSL_REASON_openssl-devel= error: member access into incomplete type 'X509' (aka 'x509_st') @@ -52,7 +50,7 @@ post-extract: ${MKDIR} ${WRKSRC}/src/qt/qtwebkit/.git ${RM} ${WRKSRC}/src/qt/qtwebkit/Source/WebCore/DerivedSources.cpp -_ENV= CC=${CC} CXX=${CXX} GMAKE=${GMAKE} OSTYPE=freebsd MAKEFLAGS= +_ENV= CC=${CC} CXX=${CXX} GMAKE=${GMAKE} OSTYPE=freebsd MAKEFLAGS= LOCALBASE=${LOCALBASE} _BLD= ${PYTHON_CMD} build.py --jobs ${MAKE_JOBS_NUMBER} --confirm do-build: .if defined(_PHANTOMJS_USE_QT_SYSTEM) diff --git a/lang/phantomjs/files/patch-src_qt_qtbase_mkspecs_freebsd-clang_qmake.conf b/lang/phantomjs/files/patch-src_qt_qtbase_mkspecs_freebsd-clang_qmake.conf new file mode 100644 index 000000000000..350e88d5960f --- /dev/null +++ b/lang/phantomjs/files/patch-src_qt_qtbase_mkspecs_freebsd-clang_qmake.conf @@ -0,0 +1,13 @@ +--- src/qt/qtbase/mkspecs/freebsd-clang/qmake.conf.orig 2017-03-26 06:45:23 UTC ++++ src/qt/qtbase/mkspecs/freebsd-clang/qmake.conf +@@ -10,8 +10,8 @@ QMAKE_CFLAGS_THREAD = -pthread -D_TH + QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD + + # Addon software goes into /usr/local on the BSDs, by default we will look there +-QMAKE_INCDIR = /usr/local/include +-QMAKE_LIBDIR = /usr/local/lib ++QMAKE_INCDIR = $$(LOCALBASE)/include ++QMAKE_LIBDIR = $$(LOCALBASE)/lib + + QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined + QMAKE_LFLAGS_THREAD = -pthread diff --git a/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_JavaScriptCore_assembler_ARMAssembler.h b/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_JavaScriptCore_assembler_ARMAssembler.h new file mode 100644 index 000000000000..24cd58695ad4 --- /dev/null +++ b/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_JavaScriptCore_assembler_ARMAssembler.h @@ -0,0 +1,17 @@ +assembler/ARMAssembler.h:1073:2: error: "The cacheFlush support is missing on this platform." +#error "The cacheFlush support is missing on this platform." + ^ + +Obtained from: www/webkit-gtk3/files/patch-Source__JavaScriptCore__assembler__ARMAssembler.h + +--- src/qt/qtwebkit/Source/JavaScriptCore/assembler/ARMAssembler.h.orig 2016-01-08 10:07:46 UTC ++++ src/qt/qtwebkit/Source/JavaScriptCore/assembler/ARMAssembler.h +@@ -1069,6 +1069,8 @@ namespace JSC { + UNUSED_PARAM(size); + #elif OS(QNX) + msync(code, size, MS_INVALIDATE_ICACHE); ++#elif CPU(ARM_TRADITIONAL) && OS(FREEBSD) && COMPILER(CLANG) ++ __clear_cache(code, reinterpret_cast(code) + size); + #else + #error "The cacheFlush support is missing on this platform." + #endif diff --git a/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_WTF_wtf_Platform.h b/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_WTF_wtf_Platform.h new file mode 100644 index 000000000000..9ddc03e3b9af --- /dev/null +++ b/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_WTF_wtf_Platform.h @@ -0,0 +1,19 @@ +On armv6 platform: +./wtf/Platform.h:323:6: error: "Not supported ARM architecture" +# error "Not supported ARM architecture" + ^ + +Obtained from: www/webkit-gtk3/files/patch-Source_WTF_wtf_Platform.h + +This patch reportedly fixes build for ARM. See PR 208569 + +--- src/qt/qtwebkit/Source/WTF/wtf/Platform.h.orig 2018-06-14 11:03:55 UTC ++++ src/qt/qtwebkit/Source/WTF/wtf/Platform.h +@@ -232,6 +232,7 @@ + #elif defined(__ARM_ARCH_6__) \ + || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6K__) \ ++ || defined(__ARM_ARCH_6KZ__) \ + || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6T2__) \ diff --git a/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_WebCore_platform_graphics_cpu_arm_filters_FELightingNEON.cpp b/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_WebCore_platform_graphics_cpu_arm_filters_FELightingNEON.cpp new file mode 100644 index 000000000000..27b00b486ef5 --- /dev/null +++ b/lang/phantomjs/files/patch-src_qt_qtwebkit_Source_WebCore_platform_graphics_cpu_arm_filters_FELightingNEON.cpp @@ -0,0 +1,18 @@ +.obj/platform/graphics/cpu/arm/filters/FELightingNEON.o --- +:149:1: error: invalid instruction +vmov.u32 r2, r3, s8, s9 +^ + +Obtained from: www/webkit-gtk3/files/patch-Source_WebCore_platform_graphics_cpu_arm_filters_FELightingNEON.cpp + +--- src/qt/qtwebkit/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp.orig 2018-06-12 14:38:27 UTC ++++ src/qt/qtwebkit/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp +@@ -404,7 +404,7 @@ TOSTRING(neonDrawLighting) ":" NL + "vmin.f32 " TMP2_D0 ", " TMP2_D0 ", " CONST_ONE_HI_D NL + "vmul.f32 " TMP3_Q ", " COLOR_Q ", " TMP2_D0 "[1]" NL + "vcvt.u32.f32 " TMP3_Q ", " TMP3_Q NL +- "vmov.u32 r2, r3, " TMP3_S0 ", " TMP3_S1 NL ++ "vmov r2, r3, " TMP3_S0 ", " TMP3_S1 NL + // The color values are stored in-place. + "strb r2, [" PIXELS_R ", #-11]" NL + "strb r3, [" PIXELS_R ", #-10]" NL diff --git a/lang/phantomjs/files/patch-src_webpage.cpp b/lang/phantomjs/files/patch-src_webpage.cpp new file mode 100644 index 000000000000..2ef6b34951b3 --- /dev/null +++ b/lang/phantomjs/files/patch-src_webpage.cpp @@ -0,0 +1,20 @@ +webpage.cpp:80:89: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal] +#define CALLBACKS_OBJECT_INJECTION INPAGE_CALL_NAME" = function() { return window."CALLBACKS_OBJECT_NAME".call.call(_phantom, Array.prototype.slice.call(arguments, 0)); };" + ^ +webpage.cpp:81:57: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal] +#define CALLBACKS_OBJECT_PRESENT "typeof(window."CALLBACKS_OBJECT_NAME") !== \"undefined\";" + ^ + +--- src/webpage.cpp.orig 2018-01-26 07:17:31 UTC ++++ src/webpage.cpp +@@ -77,8 +77,8 @@ + #define BLANK_HTML "" + #define CALLBACKS_OBJECT_NAME "_phantom" + #define INPAGE_CALL_NAME "window.callPhantom" +-#define CALLBACKS_OBJECT_INJECTION INPAGE_CALL_NAME" = function() { return window."CALLBACKS_OBJECT_NAME".call.call(_phantom, Array.prototype.slice.call(arguments, 0)); };" +-#define CALLBACKS_OBJECT_PRESENT "typeof(window."CALLBACKS_OBJECT_NAME") !== \"undefined\";" ++#define CALLBACKS_OBJECT_INJECTION INPAGE_CALL_NAME" = function() { return window." CALLBACKS_OBJECT_NAME".call.call(_phantom, Array.prototype.slice.call(arguments, 0)); };" ++#define CALLBACKS_OBJECT_PRESENT "typeof(window." CALLBACKS_OBJECT_NAME") !== \"undefined\";" + + #define STDOUT_FILENAME "/dev/stdout" + #define STDERR_FILENAME "/dev/stderr"