From 585ff442dd855378eefcff972c75b35587b5235e Mon Sep 17 00:00:00 2001 From: Thomas1664 <46387399+Thomas1664@users.noreply.github.com> Date: Fri, 29 Apr 2022 05:50:41 +0200 Subject: [PATCH] [jansson] Fix UWP build (#24466) * [jansson] cleanup * version * Roll back version * version * Unsupported on UWP * version * patch * Remove supports * version --- ports/jansson/fix-linker-flags.patch | 13 ++++++++++ ports/jansson/portfile.cmake | 36 ++++++++++------------------ ports/jansson/vcpkg.json | 14 ++++++++++- versions/baseline.json | 2 +- versions/j-/jansson.json | 5 ++++ 5 files changed, 45 insertions(+), 25 deletions(-) create mode 100644 ports/jansson/fix-linker-flags.patch diff --git a/ports/jansson/fix-linker-flags.patch b/ports/jansson/fix-linker-flags.patch new file mode 100644 index 0000000000..57d889005c --- /dev/null +++ b/ports/jansson/fix-linker-flags.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 39b9ad3..ed33e3c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -342,7 +342,7 @@ if(JANSSON_BUILD_SHARED_LIBS) + ) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/jansson.sym") + if (VSCRIPT_WORKS) +- set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/jansson.sym") ++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/jansson.sym") + endif() + endif() + diff --git a/ports/jansson/portfile.cmake b/ports/jansson/portfile.cmake index 80e6a8bb18..e6c17c148a 100644 --- a/ports/jansson/portfile.cmake +++ b/ports/jansson/portfile.cmake @@ -4,47 +4,37 @@ vcpkg_from_github( REF 684e18c927e89615c2d501737e90018f4930d6c5 # v2.14 SHA512 e2cac3567bc860d10d9aa386ce370876cb21ff083a970abeb48112b6586b91cd101694a98cb05a06795fb04498e6bc2df3615fedb86635f5a998b68e5670e5b3 HEAD_REF master + PATCHES + fix-linker-flags.patch ) -if(VCPKG_CRT_LINKAGE STREQUAL static) - set(JANSSON_STATIC_CRT ON) -else() - set(JANSSON_STATIC_CRT OFF) -endif() - - -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set(JANSSON_BUILD_SHARED_LIBS ON) -else() - set(JANSSON_BUILD_SHARED_LIBS OFF) -endif() +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" JANSSON_STATIC_CRT) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" JANSSON_BUILD_SHARED_LIBS) # Jansson tries to random-seed its hash table with system-provided entropy. # This is not ported to UWP yet. -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_UWP) set(USE_WINDOWS_CRYPTOAPI OFF) else() set(USE_WINDOWS_CRYPTOAPI ON) endif() -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DJANSSON_STATIC_CRT=${JANSSON_STATIC_CRT} -DJANSSON_EXAMPLES=OFF -DJANSSON_WITHOUT_TESTS=ON + -DJANSSON_BUILD_DOCS=OFF -DJANSSON_BUILD_SHARED_LIBS=${JANSSON_BUILD_SHARED_LIBS} -DUSE_WINDOWS_CRYPTOAPI=${USE_WINDOWS_CRYPTOAPI} -DJANSSON_INSTALL_CMAKE_DIR:STRING=share/jansson ) -vcpkg_install_cmake() -vcpkg_fixup_cmake_targets() - -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) - +vcpkg_cmake_install() vcpkg_copy_pdbs() - +vcpkg_cmake_config_fixup() vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/jansson/vcpkg.json b/ports/jansson/vcpkg.json index 244dffa2e6..cd99df0271 100644 --- a/ports/jansson/vcpkg.json +++ b/ports/jansson/vcpkg.json @@ -1,6 +1,18 @@ { "name": "jansson", "version": "2.14", + "port-version": 1, "description": "Jansson is a C library for encoding, decoding and manipulating JSON data", - "homepage": "https://github.com/akheron/jansson" + "homepage": "https://github.com/akheron/jansson", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] } diff --git a/versions/baseline.json b/versions/baseline.json index 6a6b2588cd..38d7d3c34f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3018,7 +3018,7 @@ }, "jansson": { "baseline": "2.14", - "port-version": 0 + "port-version": 1 }, "jasper": { "baseline": "2.0.33", diff --git a/versions/j-/jansson.json b/versions/j-/jansson.json index 0d4d12b399..50a364af94 100644 --- a/versions/j-/jansson.json +++ b/versions/j-/jansson.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f284c9aba6b994cb6fe175b675976d34257b4c85", + "version": "2.14", + "port-version": 1 + }, { "git-tree": "1a5c55feab368e4bfb40be993b9ea5a39fc82f51", "version": "2.14",