From 8f2cfe80a5fb6632b4bbb9181db28f0505058128 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Tue, 8 Nov 2016 15:51:03 +0300 Subject: Imported WebKit commit 26dda242e41e9b4d348fc3573d86f58b9e8b51b9 Change-Id: I00833927c575184923449ab99c85c46fec94dc19 Reviewed-by: Konstantin Tokarev --- Tools/qmake/mkspecs/features/functions.prf | 122 +++++++++++++++++++++ .../projects/generate_cmake_toolchain_file.pro | 50 +++++++++ Tools/qmake/projects/qtjpeg/qtjpeg.pro | 24 ++++ Tools/qmake/projects/qtpng/qtpng.pro | 49 +++++++++ Tools/qmake/projects/run_cmake.pro | 69 ++++++++++++ Tools/qt/manifest.txt | 4 +- 6 files changed, 317 insertions(+), 1 deletion(-) create mode 100644 Tools/qmake/mkspecs/features/functions.prf create mode 100644 Tools/qmake/projects/generate_cmake_toolchain_file.pro create mode 100644 Tools/qmake/projects/qtjpeg/qtjpeg.pro create mode 100644 Tools/qmake/projects/qtpng/qtpng.pro create mode 100644 Tools/qmake/projects/run_cmake.pro (limited to 'Tools') diff --git a/Tools/qmake/mkspecs/features/functions.prf b/Tools/qmake/mkspecs/features/functions.prf new file mode 100644 index 000000000..daab9b8b5 --- /dev/null +++ b/Tools/qmake/mkspecs/features/functions.prf @@ -0,0 +1,122 @@ +EOL = $$escape_expand(\\n) + +WEBKIT_SUBDIR = $$relative_path($$_PRO_FILE_PWD_, $$ROOT_WEBKIT_DIR) +QTBASE_DIR = $$ROOT_WEBKIT_DIR/../qtbase + +defineTest(isQtMinimum) { + !equals(QT_MAJOR_VERSION, $$1): return(false) + count(ARGS, 1, greaterThan) { + lessThan(QT_MINOR_VERSION, $$2): return(false) + } + return(true) +} + +!isQtMinimum(5, 8) { + defineTest(qtConfig) { + contains(QT_CONFIG, $$1): return(true) + return(false) + } +} + +defineTest(isVersionAtLeast) { + have_version = $$split(1, .) + want_version = $$split(2, .) + num_components = $$size(have_version) + + # FIXME: Off-by-one. Mostly harmless, but still replace it with 0..$$num_add($$num_digits, -1) when Qt 5.7 compatibility is dropped. + for (i, 0..$$num_components) { + have_component = $$member(have_version, $$i) + want_component = $$member(want_version, $$i) + greaterThan(have_component, $$want_component): return(true) + lessThan(have_component, $$want_component): return(false) + } + return(true) +} + +defineReplace(cmakeVersion) { + cmake_version_output = $$system("cmake --version", lines) + cmake_version_string = $$first(cmake_version_output) + # Format is "cmake version X.Y.Z" + cmake_version_words = $$split(cmake_version_string) + return($$last(cmake_version_words)) +} + +defineReplace(appleSdkVersion) { + return($$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version ProductVersion 2>/dev/null")) +} + +defineTest(isPlatformSupported) { + cross_compile: skipBuild("cross-compilation of QtWebKit with qmake is not supported yet") + + requiredPrograms = cmake gperf python perl bison ruby flex + for(program, requiredPrograms): \ + !programExistsInPath($$program): \ + skipBuild("Missing $$program from PATH") + + cmake_version = $$cmakeVersion() + !isVersionAtLeast($$cmake_version, "2.8.12") { + skipBuild("Using cmake version $$cmake_version, but at least cmake 2.8.12 is required to build QtWebKit.") + } + + win32 { + winrt { + skipBuild("WinRT is not supported.") + } + msvc { + !isVersionAtLeast($$MSVC_VER, "14.0") { + skipBuild("QtWebKit on Windows requires MSVC 2015.") + } + } else { + isGCCVersionSupported() + } + } else: macos { + # We require macOS 10.10 (darwin version 14.0.0) or newer + darwin_major_version = $$section(QMAKE_HOST.version, ., 0, 0) + lessThan(darwin_major_version, 14) { + skipBuild("QtWebKit requires macOS version 10.10 or newer.") + } + sdk_version = $$appleSdkVersion() + !isVersionAtLeast($$sdk_version, "10.10") { + skipBuild("QtWebKit requires an macOS SDK version of 10.10 or newer. Current version is $${sdk_version}.") + } + } else { + android: skipBuild("Android is not supported.") + uikit: skipBuild("UIKit platforms are not supported.") + qnx: skipBuild("QNX is not supported.") + + gcc:!clang: isGCCVersionSupported() + } + + !contains(QT_CONFIG, c++11) { + skipBuild("C++11 support is required in order to build QtWebKit.") + } + + isEmpty(skipBuildReason): return(true) + return(false) +} + +defineTest(isGCCVersionSupported) { + gcc_version = $${QT_GCC_MAJOR_VERSION}.$${QT_GCC_MINOR_VERSION} + isVersionAtLeast($$gcc_version, "4.9"): return(true) + skipBuild("Using gcc version $$gcc_version, but at least gcc version 4.9 is required to build QtWebKit.") + return(false) +} + +defineTest(programExistsInPath) { + equals(QMAKE_HOST.os, Windows): program = $${1}.exe + else: program = $$1 + + PATH = $$(PATH) + paths = $$split(PATH, $$QMAKE_DIRLIST_SEP) + + GNUTOOLS_DIR = $$ROOT_WEBKIT_DIR/../gnuwin32/bin + exists($$GNUTOOLS_DIR): paths += $$GNUTOOLS_DIR + + for(p, paths): exists($$p/$$program): return(true) + return(false) +} + +defineTest(skipBuild) { + skipBuildReason = "$$skipBuildReason$${EOL} * $$1" + export(skipBuildReason) +} diff --git a/Tools/qmake/projects/generate_cmake_toolchain_file.pro b/Tools/qmake/projects/generate_cmake_toolchain_file.pro new file mode 100644 index 000000000..db26391b0 --- /dev/null +++ b/Tools/qmake/projects/generate_cmake_toolchain_file.pro @@ -0,0 +1,50 @@ +load(functions) + +TEMPLATE = aux + +cross_compile { + linux { + SYSTEM_NAME = Linux + } else: macos { + # We don't support uikit platforms for now, and they certainly won't work + # with the simplistic toolchain file we are generating here. + SYSTEM_NAME = Darwin + } else: win32 { + SYSTEM_NAME = Windows + } else: freebsd { + SYSTEM_NAME = FreeBSD + } else: netbsd { + SYSTEM_NAME = NetBSD + } else: openbsd { + SYSTEM_NAME = OpenBSD + } else { + error("Unknown platform, cannot produce toolchain file for CMake") + } + + TOOLCHAIN_FILE_VARS += \ + "CMAKE_SYSTEM_NAME $$SYSTEM_NAME" \ + "CMAKE_SYSTEM_PROCESSOR $$QT_ARCH" + + isEmpty(CMAKE_SYSROOT): CMAKE_SYSROOT = $$[QT_SYSROOT] + !isEmpty(CMAKE_SYSROOT): TOOLCHAIN_FILE_VARS += \ + "CMAKE_FIND_ROOT_PATH $$CMAKE_SYSROOT" \ + "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER" \ + "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY" \ + "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY" +} + +TOOLCHAIN_FILE_VARS += \ + "CMAKE_C_COMPILER \"$$QMAKE_CC\"" \ + "CMAKE_CXX_COMPILER \"$$QMAKE_CXX\"" + +CONANBUILDINFO_PATH = $$ROOT_BUILD_DIR/conanbuildinfo.cmake +exists($$CONANBUILDINFO_PATH): TOOLCHAIN_FILE_VARS += "CONANBUILDINFO_PATH $$CONANBUILDINFO_PATH" + +for (var, TOOLCHAIN_FILE_VARS): TOOLCHAIN_FILE_CONTENTS += "set($$var)" + +TOOLCHAIN_FILE = $$ROOT_BUILD_DIR/qmake_toolchain.cmake + +!build_pass { + log("$${EOL}Generating CMake toolchain file $$TOOLCHAIN_FILE $${EOL}$${EOL}"$$join(TOOLCHAIN_FILE_CONTENTS, $${EOL})$${EOL}$${EOL}) + write_file($$TOOLCHAIN_FILE, TOOLCHAIN_FILE_CONTENTS)|error() +} diff --git a/Tools/qmake/projects/qtjpeg/qtjpeg.pro b/Tools/qmake/projects/qtjpeg/qtjpeg.pro new file mode 100644 index 000000000..89d3e6113 --- /dev/null +++ b/Tools/qmake/projects/qtjpeg/qtjpeg.pro @@ -0,0 +1,24 @@ +load(functions) + +TARGET = qtjpeg + +CONFIG += \ + static \ + hide_symbols \ + exceptions_off rtti_off warn_off \ + installed + +# Poor man's qt_helper_lib +TEMPLATE = lib +CONFIG += staticlib +CONFIG -= qt + +# In debug_and_release build we need only one copy of library, let it be release +debug_and_release { + CONFIG -= debug_and_release debug + CONFIG += release +} + +DESTDIR = $$ROOT_BUILD_DIR/lib + +include($$QTBASE_DIR/src/3rdparty/libjpeg.pri) diff --git a/Tools/qmake/projects/qtpng/qtpng.pro b/Tools/qmake/projects/qtpng/qtpng.pro new file mode 100644 index 000000000..88b6f9672 --- /dev/null +++ b/Tools/qmake/projects/qtpng/qtpng.pro @@ -0,0 +1,49 @@ +# This file was copied from qtbase/src/3rdparty/libpng/libpng.pro +# in order to build a copy of libqtpng specifically for QtWebKit module +# Must be kept in sync with qtbase + +load(functions) + +TARGET = qtpng + +CONFIG += \ + static \ + hide_symbols \ + exceptions_off rtti_off warn_off \ + installed + +# Poor man's qt_helper_lib +TEMPLATE = lib +CONFIG += staticlib +CONFIG -= qt + +# In debug_and_release build we need only one copy of library, let it be release +debug_and_release { + CONFIG -= debug_and_release debug + CONFIG += release +} + +DESTDIR = $$ROOT_BUILD_DIR/lib +PNGDIR = $$QTBASE_DIR/src/3rdparty/libpng + +DEFINES += PNG_ARM_NEON_OPT=0 +SOURCES += \ + $$PNGDIR/png.c \ + $$PNGDIR/pngerror.c \ + $$PNGDIR/pngget.c \ + $$PNGDIR/pngmem.c \ + $$PNGDIR/pngpread.c \ + $$PNGDIR/pngread.c \ + $$PNGDIR/pngrio.c \ + $$PNGDIR/pngrtran.c \ + $$PNGDIR/pngrutil.c \ + $$PNGDIR/pngset.c \ + $$PNGDIR/pngtrans.c \ + $$PNGDIR/pngwio.c \ + $$PNGDIR/pngwrite.c \ + $$PNGDIR/pngwtran.c \ + $$PNGDIR/pngwutil.c + +TR_EXCLUDE += $$PWD/* + +include($$QTBASE_DIR/src/3rdparty/zlib_dependency.pri) diff --git a/Tools/qmake/projects/run_cmake.pro b/Tools/qmake/projects/run_cmake.pro new file mode 100644 index 000000000..d564ad262 --- /dev/null +++ b/Tools/qmake/projects/run_cmake.pro @@ -0,0 +1,69 @@ +load(functions) + +ROOT_QT_BUILD_DIR = $$ROOT_BUILD_DIR/.. + +TEMPLATE = aux + +CONFIG(debug, debug|release) { + configuration = Debug +} else { + configuration = Release +} + +cmake_build_dir = $$system_quote($$system_path($$ROOT_BUILD_DIR/$$lower($$configuration))) +toolchain_file = $$system_quote($$system_path($$ROOT_BUILD_DIR/qmake_toolchain.cmake)) + +build_pass|!debug_and_release { + CMAKE_CONFIG += \ + PORT=Qt \ + CMAKE_BUILD_TYPE=$$configuration \ + CMAKE_TOOLCHAIN_FILE=$$toolchain_file \ + CMAKE_PREFIX_PATH=\"$$[QT_INSTALL_PREFIX];$$ROOT_QT_BUILD_DIR/qtbase;$$ROOT_QT_BUILD_DIR/qtlocation;$$ROOT_QT_BUILD_DIR/qtsensors\" \ + CMAKE_INSTALL_PREFIX=\"$$[QT_INSTALL_PREFIX]\" \ + KDE_INSTALL_LIBDIR=\"$$relative_path($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])\" \ + USE_LIBHYPHEN=OFF + + QT_FOR_CONFIG += gui-private + !qtConfig(system-jpeg):exists($$QTBASE_DIR) { + CMAKE_CONFIG += \ + QT_BUNDLED_JPEG=1 \ + JPEG_INCLUDE_DIR=$$system_path($$QTBASE_DIR/src/3rdparty/libjpeg) \ + JPEG_LIBRARIES=$$system_path($$ROOT_BUILD_DIR/lib/libqtjpeg.$$QMAKE_EXTENSION_STATICLIB) + } + + !qtConfig(system-png):qtConfig(png):exists($$QTBASE_DIR) { + CMAKE_CONFIG += \ + QT_BUNDLED_PNG=1 \ + PNG_INCLUDE_DIRS=$$system_path($$QTBASE_DIR/src/3rdparty/libpng) \ + PNG_LIBRARIES=$$system_path($$ROOT_BUILD_DIR/lib/libqtpng.$$QMAKE_EXTENSION_STATICLIB) + } + + !qtConfig(system-zlib):exists($$QTBASE_DIR) { + CMAKE_CONFIG += \ + QT_BUNDLED_ZLIB=1 \ + ZLIB_INCLUDE_DIRS=$$system_path($$QTBASE_DIR/src/3rdparty/zlib) + } + + equals(QMAKE_HOST.os, Windows): cmake_args += "-G \"NMake Makefiles JOM\"" + + !silent: make_args += "VERBOSE=1" + + # Append additional platform options defined in CMAKE_CONFIG + for (config, CMAKE_CONFIG): cmake_args += "-D$$config" + + cmake_cmd_base = "$$QMAKE_MKDIR $$cmake_build_dir && cd $$cmake_build_dir &&" + + log("$${EOL}Running $$cmake_env cmake $$ROOT_WEBKIT_DIR $$cmake_args $${EOL}$${EOL}") + !system("$$cmake_cmd_base $$cmake_env cmake $$ROOT_WEBKIT_DIR $$cmake_args"): error("Running cmake failed") + + log("$${EOL}WebKit is now configured for building. Just run 'make'.$${EOL}$${EOL}") + + + default_target.target = first + default_target.commands = cd $$cmake_build_dir && $(MAKE) $$make_args + QMAKE_EXTRA_TARGETS += default_target + + install_target.target = install + install_target.commands = cd $$cmake_build_dir && $(MAKE) install $$make_args DESTDIR=$(INSTALL_ROOT) + QMAKE_EXTRA_TARGETS += install_target +} diff --git a/Tools/qt/manifest.txt b/Tools/qt/manifest.txt index 5e7b65b76..211fc29f4 100644 --- a/Tools/qt/manifest.txt +++ b/Tools/qt/manifest.txt @@ -112,6 +112,7 @@ file Source/WebCore/Resources/aliasCursor.png file Source/WebCore/platform/audio/resources/Composite.wav directory Tools/qt +directory Tools/qmake directory Tools/ImageDiff directory Tools/MiniBrowser directory Tools/TestWebKitAPI @@ -135,4 +136,5 @@ file Tools/Scripts/webkit-build-directory file Tools/Scripts/webkitdirs.pm file Tools/Scripts/webkitperl/FeatureList.pm file Tools/jhbuild/jhbuildutils.py - +file WebKit.pro +file .qmake.conf -- cgit v1.2.3