This commit is contained in:
Barath Kannan 2017-10-15 22:22:17 +11:00
parent d7c60c2048
commit 2a94ee4c62
6 changed files with 287 additions and 0 deletions

4
ports/qt5base/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: qt5base
Version: 5.9.2-0
Description: Qt5 application framework base components. Webengine, examples and tests not included.
Build-Depends: zlib, libjpeg-turbo, libpng, freetype, pcre2, harfbuzz, sqlite3, libpq, double-conversion

View File

@ -0,0 +1,63 @@
function(configure_qt)
cmake_parse_arguments(_csc "" "SOURCE_PATH;PLATFORM" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN})
if (_csc_PLATFORM)
set(PLATFORM ${_csc_PLATFORM})
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v140")
set(PLATFORM "win32-msvc2015")
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v141")
set(PLATFORM "win32-msvc2017")
endif()
vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}")
if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
list(APPEND _csc_OPTIONS
"-static"
"-static-runtime"
)
endif()
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
vcpkg_execute_required_process(
COMMAND "${_csc_SOURCE_PATH}/configure.bat" ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG}
-debug
-prefix ${CURRENT_PACKAGES_DIR}/debug
-hostbindir ${CURRENT_PACKAGES_DIR}/debug/tools/qt5
-archdatadir ${CURRENT_PACKAGES_DIR}/debug/share/qt5
-datadir ${CURRENT_PACKAGES_DIR}/debug/share/qt5
-plugindir ${CURRENT_PACKAGES_DIR}/debug/plugins
-qmldir ${CURRENT_PACKAGES_DIR}/debug/qml
-I ${CURRENT_INSTALLED_DIR}/include
-L ${CURRENT_INSTALLED_DIR}/debug/lib
-platform ${PLATFORM}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME config-${TARGET_TRIPLET}-dbg
)
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
vcpkg_execute_required_process(
COMMAND "${_csc_SOURCE_PATH}/configure.bat" ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE}
-release
-prefix ${CURRENT_PACKAGES_DIR}
-hostbindir ${CURRENT_PACKAGES_DIR}/tools/qt5
-archdatadir ${CURRENT_PACKAGES_DIR}/share/qt5
-datadir ${CURRENT_PACKAGES_DIR}/share/qt5
-plugindir ${CURRENT_PACKAGES_DIR}/plugins
-qmldir ${CURRENT_PACKAGES_DIR}/qml
-I ${CURRENT_INSTALLED_DIR}/include
-L ${CURRENT_INSTALLED_DIR}/lib
-platform ${PLATFORM}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME config-${TARGET_TRIPLET}-rel
)
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
endfunction()

View File

@ -0,0 +1,18 @@
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index a5b69a2..01c5cde 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -159,7 +159,12 @@
]
},
"sources": [
- "-lpcre2-16"
+ {
+ "builds": {
+ "debug": "-lpcre2-16d",
+ "release": "-lpcre2-16"
+ }
+ }
]
},
"pps": {

48
ports/qt5base/fixcmake.py Normal file
View File

@ -0,0 +1,48 @@
import os
import re
from glob import glob
files = [y for x in os.walk('.') for y in glob(os.path.join(x[0], '*.cmake'))]
for f in files:
openedfile = open(f, "r")
builder = ""
dllpattern = re.compile("_install_prefix}/bin/Qt5.*d.dll")
libpattern = re.compile("_install_prefix}/lib/Qt5.*d.lib")
exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe")
for line in openedfile:
if "_install_prefix}/bin/${LIB_LOCATION}" in line:
builder += " if (${Configuration} STREQUAL \"RELEASE\")"
builder += "\n " + line
builder += " else()"
builder += "\n " + line.replace("/bin/", "/debug/bin/")
builder += " endif()\n"
elif "_install_prefix}/lib/${LIB_LOCATION}" in line:
builder += " if (${Configuration} STREQUAL \"RELEASE\")"
builder += "\n " + line
builder += " else()"
builder += "\n " + line.replace("/lib/", "/debug/lib/")
builder += " endif()\n"
elif "_install_prefix}/lib/${IMPLIB_LOCATION}" in line:
builder += " if (${Configuration} STREQUAL \"RELEASE\")"
builder += "\n " + line
builder += " else()"
builder += "\n " + line.replace("/lib/", "/debug/lib/")
builder += " endif()\n"
elif "_install_prefix}/plugins/${PLUGIN_LOCATION}" in line:
builder += " if (${Configuration} STREQUAL \"RELEASE\")"
builder += "\n " + line
builder += " else()"
builder += "\n " + line.replace("/plugins/", "/debug/plugins/")
builder += " endif()\n"
elif dllpattern.search(line) != None:
builder += line.replace("/bin/", "/debug/bin/")
elif libpattern.search(line) != None:
builder += line.replace("/lib/", "/debug/lib/")
elif exepattern.search(line) != None:
builder += line.replace("/bin/", "/tools/qt5/")
else:
builder += line
new_file = open(f, "w")
new_file.write(builder)
new_file.close()

View File

@ -0,0 +1,45 @@
function(install_qt)
cmake_parse_arguments(_bc "DISABLE_PARALLEL" "" "" ${ARGN})
if (_bc_DISABLE_PARALLEL)
set(JOBS "1")
else()
set(JOBS "$ENV{NUMBER_OF_PROCESSORS}")
endif()
vcpkg_find_acquire_program(JOM)
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY)
set(ENV{PATH} "${PYTHON3_EXE_PATH};$ENV{PATH}")
set(_path "$ENV{PATH}")
message(STATUS "Package ${TARGET_TRIPLET}-rel")
set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/bin;${_path}")
vcpkg_execute_required_process(
COMMAND ${JOM} /J ${JOBS}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME build-${TARGET_TRIPLET}-rel
)
vcpkg_execute_required_process(
COMMAND ${JOM} /J ${JOBS} install
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME package-${TARGET_TRIPLET}-rel
)
message(STATUS "Package ${TARGET_TRIPLET}-rel done")
message(STATUS "Package ${TARGET_TRIPLET}-dbg")
set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/debug/bin;${_path}")
vcpkg_execute_required_process(
COMMAND ${JOM} /J ${JOBS}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME build-${TARGET_TRIPLET}-dbg
)
vcpkg_execute_required_process(
COMMAND ${JOM} /J ${JOBS} install
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME package-${TARGET_TRIPLET}-dbg
)
set(ENV{PATH} "${_path}")
message(STATUS "Package ${TARGET_TRIPLET}-dbg done")
endfunction()

View File

@ -0,0 +1,109 @@
include(vcpkg_common_functions)
string(LENGTH "${CURRENT_BUILDTREES_DIR}" BUILDTREES_PATH_LENGTH)
if(BUILDTREES_PATH_LENGTH GREATER 27)
message(WARNING "Qt5's buildsystem uses very long paths and may fail on your system.\n"
"We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command."
)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
message(FATAL_ERROR "Qt5 doesn't currently support static builds. Please use a dynamic triplet instead.")
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
include(configure_qt)
include(install_qt)
set(SRCDIR_NAME "qt-5.9.2")
set(ARCHIVE_NAME "qtbase-opensource-src-5.9.2")
set(ARCHIVE_EXTENSION ".tar.xz")
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME})
vcpkg_download_distfile(ARCHIVE_FILE
URLS "http://download.qt.io/official_releases/qt/5.9/5.9.2/submodules/${ARCHIVE_NAME}${ARCHIVE_EXTENSION}"
FILENAME ${SRCDIR_NAME}${ARCHIVE_EXTENSION}
SHA512 a2f965871645256f3d019f71f3febb875455a29d03fccc7a3371ddfeb193b0af12394e779df05adf69fd10fe7b0d966f3915a24528ec7eb3bc36c2db6af2b6e7
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
if (EXISTS ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME})
file(RENAME ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_NAME} ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME})
endif()
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${SRCDIR_NAME}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-system-pcre2.patch"
)
# This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings
set(ENV{_CL_} "/utf-8")
configure_qt(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-confirm-license
-opensource
-system-zlib
-system-libjpeg
-system-libpng
-system-freetype
-system-pcre
-system-harfbuzz
-system-doubleconversion
-system-sqlite
-sql-sqlite
-sql-psql
-feature-freetype
-nomake examples -nomake tests
-opengl desktop # other options are "-no-opengl" and "-opengl angle"
-mp
LIBJPEG_LIBS="-ljpeg"
OPTIONS_RELEASE
ZLIB_LIBS="-lzlib"
LIBPNG_LIBS="-llibpng16"
OPTIONS_DEBUG
ZLIB_LIBS="-lzlibd"
LIBPNG_LIBS="-llibpng16d"
PSQL_LIBS="-llibpqd"
FREETYPE_LIBS="-lfreetyped"
)
install_qt()
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(GLOB BINARY_TOOLS "${CURRENT_PACKAGES_DIR}/bin/*.exe")
file(INSTALL ${BINARY_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/qt5)
file(REMOVE ${BINARY_TOOLS})
file(GLOB BINARY_TOOLS "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe")
file(REMOVE ${BINARY_TOOLS})
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
vcpkg_execute_required_process(
COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py
WORKING_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/cmake
LOGNAME fix-cmake
)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
#---------------------------------------------------------------------------
# Qt5Bootstrap: a release-only dependency
#---------------------------------------------------------------------------
# Remove release-only Qt5Bootstrap.lib from debug folders:
#file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.lib)
#file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.prl)
# Above approach does not work:
# check_matching_debug_and_release_binaries(dbg_libs, rel_libs)
# requires the two sets to be of equal size!
# Alt. approach, create dummy folder instead:
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/dont-use)
file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/dont-use)
file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.prl DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/dont-use)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrap.prl)
#---------------------------------------------------------------------------
file(INSTALL ${SOURCE_PATH}/LICENSE.LGPLv3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5base RENAME copyright)