From 20a0c30dd8a44a3c876608824f0d7b4f2c2dbb21 Mon Sep 17 00:00:00 2001
From: JackBoosY <47264268+JackBoosY@users.noreply.github.com>
Date: Mon, 19 Aug 2019 23:55:29 +0800
Subject: [PATCH] [jsonnet]Upgrade version to 0.13.0 (#7374)
* [jsonnet]Upgrade version to 0.13.0
* [jsonnet]Use different commands depending on the version of powershell.
* [jsonnet]Fix merge error.
---
ports/jsonnet/001-enable-msvc.patch | 78 ++++++++++++++++-------------
ports/jsonnet/CONTROL | 2 +-
ports/jsonnet/portfile.cmake | 8 +--
3 files changed, 49 insertions(+), 39 deletions(-)
diff --git a/ports/jsonnet/001-enable-msvc.patch b/ports/jsonnet/001-enable-msvc.patch
index 3a666ee4b8..4bbcf08304 100644
--- a/ports/jsonnet/001-enable-msvc.patch
+++ b/ports/jsonnet/001-enable-msvc.patch
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8682cc8..88b95c1 100644
+index cdd5367..e982ee5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -11,6 +11,8 @@ set(GLOBAL_OUTPUT_PATH_SUFFIX "" CACHE STRING
+@@ -13,6 +13,8 @@ set(GLOBAL_OUTPUT_PATH_SUFFIX "" CACHE STRING
project(jsonnet C CXX)
@@ -11,26 +11,35 @@ index 8682cc8..88b95c1 100644
# Discourage in-source builds because they overwrite the hand-written Makefile.
# Use `cmake . -B
` or the CMake GUI to do an out-of-source build.
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} AND
-@@ -73,17 +75,6 @@ elseif (BUILD_TESTS AND USE_SYSTEM_GTEST)
- add_subdirectory(/usr/src/googletest ${GLOBAL_OUTPUT_PATH}/googletest-build)
+@@ -76,6 +78,7 @@ elseif (BUILD_TESTS AND USE_SYSTEM_GTEST)
endif()
--# Compiler flags.
--if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR
-- ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
-- set(OPT "-O3")
-- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Wextra -pedantic -std=c99 -O3 ${OPT}")
-- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC ${OPT}")
--else()
-- # TODO: Windows support.
-- message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported")
--endif()
--
+ # Compiler flags.
++if (0)
+ if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR
+ ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+ set(OPT "-O3")
+@@ -85,6 +88,7 @@ else()
+ # TODO: Windows support.
+ message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported")
+ endif()
++endif()
+
# Look for libraries in global output path.
link_directories(${GLOBAL_OUTPUT_PATH})
+diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
+index 66e6aa0..aedc87e 100644
+--- a/cmd/CMakeLists.txt
++++ b/cmd/CMakeLists.txt
+@@ -13,5 +13,5 @@ if (BUILD_JSONNETFMT OR BUILD_TESTS)
+ add_dependencies(jsonnetfmt libjsonnet_static)
+ target_link_libraries(jsonnetfmt libjsonnet_static)
+- install(TARGETS jsonnetfmt DESTINATION "${CMAKE_INSTALL_BINDIR}")
++ install(TARGETS jsonnetfmt DESTINATION tools/jsonnet)
+ endif()
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
-index f1c32b8..1a45a51 100644
+index e877015..5ec328b 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -28,7 +28,7 @@ set(LIBJSONNET_SOURCE
@@ -42,37 +51,38 @@ index f1c32b8..1a45a51 100644
add_dependencies(libjsonnet md5 stdlib)
target_link_libraries(libjsonnet md5)
-@@ -36,13 +36,12 @@ target_link_libraries(libjsonnet md5)
- # this step the output would be |liblibjsonnet|.
- set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet
- VERSION 0.12.1 SOVERSION 0)
--install(TARGETS libjsonnet DESTINATION lib)
-+install(TARGETS libjsonnet DESTINATION lib RUNTIME DESTINATION bin)
+@@ -41,13 +41,13 @@ set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet
+ install(TARGETS libjsonnet
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
# Static library for jsonnet command-line tool.
add_library(libjsonnet_static STATIC ${LIBJSONNET_SOURCE})
add_dependencies(libjsonnet_static md5 stdlib)
target_link_libraries(libjsonnet_static md5)
-set_target_properties(libjsonnet_static PROPERTIES OUTPUT_NAME jsonnet)
+ install(TARGETS libjsonnet_static DESTINATION "${CMAKE_INSTALL_LIBDIR}")
# Tests
-
diff --git a/stdlib/CMakeLists.txt b/stdlib/CMakeLists.txt
-index a481d9f..9fe768e 100644
+index a481d9f..bb8e418 100644
--- a/stdlib/CMakeLists.txt
+++ b/stdlib/CMakeLists.txt
-@@ -2,14 +2,6 @@
+@@ -2,6 +2,7 @@
add_executable(to_c_array to_c_array.cpp)
--# Custom command that will only build stdlib when it changes.
--add_custom_command(
-- OUTPUT ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h
-- COMMAND ${GLOBAL_OUTPUT_PATH}/to_c_array
-- ${PROJECT_SOURCE_DIR}/stdlib/std.jsonnet
-- ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h
-- DEPENDS to_c_array std.jsonnet)
--
++if (0)
+ # Custom command that will only build stdlib when it changes.
+ add_custom_command(
+ OUTPUT ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h
+@@ -9,6 +10,7 @@ add_custom_command(
+ ${PROJECT_SOURCE_DIR}/stdlib/std.jsonnet
+ ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h
+ DEPENDS to_c_array std.jsonnet)
++endif()
+
# Standard library build target that libjsonnet can depend on.
add_custom_target(stdlib ALL
- DEPENDS ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h)
diff --git a/ports/jsonnet/CONTROL b/ports/jsonnet/CONTROL
index 508f1e7afb..36c3d0c1b6 100644
--- a/ports/jsonnet/CONTROL
+++ b/ports/jsonnet/CONTROL
@@ -1,4 +1,4 @@
Source: jsonnet
-Version: 2019-05-08-1
+Version: 0.13.0
Homepage: https://github.com/google/jsonnet
Description: Jsonnet - The data templating language
diff --git a/ports/jsonnet/portfile.cmake b/ports/jsonnet/portfile.cmake
index ffa2973fbc..b321c6a75c 100644
--- a/ports/jsonnet/portfile.cmake
+++ b/ports/jsonnet/portfile.cmake
@@ -7,15 +7,15 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/jsonnet
- REF c323f5ce5b8aa663585d23dc0fb94d4b166c6f16
- SHA512 d9f84c39929e9e80272e2b834f68a13b48c1cb4d64b70f5b6fa16e677555d947f7cf57372453e23066a330faa6a429b9aa750271b46f763581977a223d238785
+ REF v0.13.0
+ SHA512 d19e5398763e37b79b0ef02368f6bd6215d2df234b5ff7a6d98e2306a0d47290600061c9f868c0c262570b4f0ee9eee6c309bcc93937b12f6c14f8d12339a7d5
HEAD_REF master
PATCHES
001-enable-msvc.patch
)
-if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
- vcpkg_execute_required_process(
+if (VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_execute_required_process(
COMMAND Powershell -Command "((Get-Content -AsByteStream \"${SOURCE_PATH}/stdlib/std.jsonnet\") -join ',') + ',0' | Out-File -Encoding Ascii \"${SOURCE_PATH}/core/std.jsonnet.h\""
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "std.jsonnet"