aboutsummaryrefslogtreecommitdiff
path: root/ports/jsonnet
diff options
context:
space:
mode:
Diffstat (limited to 'ports/jsonnet')
-rw-r--r--ports/jsonnet/001-enable-msvc.patch92
-rw-r--r--ports/jsonnet/002-fix-dependency-and-install.patch61
-rw-r--r--ports/jsonnet/CONTROL2
-rw-r--r--ports/jsonnet/portfile.cmake35
4 files changed, 133 insertions, 57 deletions
diff --git a/ports/jsonnet/001-enable-msvc.patch b/ports/jsonnet/001-enable-msvc.patch
index 3a666ee4b..12ddbed86 100644
--- a/ports/jsonnet/001-enable-msvc.patch
+++ b/ports/jsonnet/001-enable-msvc.patch
@@ -1,36 +1,45 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8682cc8..88b95c1 100644
+index 0418d4a..ac8f0f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -11,6 +11,8 @@ set(GLOBAL_OUTPUT_PATH_SUFFIX "" CACHE STRING
-
+@@ -2,6 +2,8 @@
+ cmake_minimum_required(VERSION 2.8.7)
project(jsonnet C CXX)
+add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+
- # Discourage in-source builds because they overwrite the hand-written Makefile.
- # Use `cmake . -B<dir>` 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)
+ include(ExternalProject)
+ include(GNUInstallDirs)
+
+@@ -89,6 +91,7 @@ else()
+ endif()
+
+ # Compiler flags.
++if (0)
+ if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR
+ ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+ set(OPT "-O3")
+@@ -98,6 +101,7 @@ else()
+ # TODO: Windows support.
+ message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported")
endif()
++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()
--
# Look for libraries in global output path.
link_directories(${GLOBAL_OUTPUT_PATH})
+diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
+index c032f02..d80d2a0 100644
+--- a/cmd/CMakeLists.txt
++++ b/cmd/CMakeLists.txt
+@@ -13,5 +13,5 @@ if (BUILD_JSONNETFMT OR BUILD_TESTS)
+ add_dependencies(jsonnetfmt libjsonnet_for_binaries)
+ target_link_libraries(jsonnetfmt libjsonnet_for_binaries)
+- 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 60fdcb1..82fb7c2 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -28,7 +28,7 @@ set(LIBJSONNET_SOURCE
@@ -40,39 +49,32 @@ index f1c32b8..1a45a51 100644
-add_library(libjsonnet SHARED ${LIBJSONNET_HEADERS} ${LIBJSONNET_SOURCE})
+add_library(libjsonnet ${LIBJSONNET_HEADERS} ${LIBJSONNET_SOURCE})
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)
-
- # 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)
+ target_link_libraries(libjsonnet md5 nlohmann_json::nlohmann_json)
- # Tests
+@@ -46,7 +46,7 @@ set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet
+ PUBLIC_HEADER "${LIB_HEADER}")
+ install(TARGETS libjsonnet
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
++ ARCHIVE DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
+ if (BUILD_STATIC_LIBS)
diff --git a/stdlib/CMakeLists.txt b/stdlib/CMakeLists.txt
-index a481d9f..9fe768e 100644
+index a481d9f..0dc3ab6 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
+@@ -13,3 +14,4 @@ add_custom_command(
# Standard library build target that libjsonnet can depend on.
add_custom_target(stdlib ALL
DEPENDS ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h)
++endif()
+\ No newline at end of file
diff --git a/ports/jsonnet/002-fix-dependency-and-install.patch b/ports/jsonnet/002-fix-dependency-and-install.patch
new file mode 100644
index 000000000..cccdc9439
--- /dev/null
+++ b/ports/jsonnet/002-fix-dependency-and-install.patch
@@ -0,0 +1,61 @@
+diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
+index 82fb7c2..a94b4ff 100644
+--- a/core/CMakeLists.txt
++++ b/core/CMakeLists.txt
+@@ -28,6 +28,7 @@ set(LIBJSONNET_SOURCE
+ string_utils.cpp
+ vm.cpp)
+
++if (BUILD_SHARED_BINARIES)
+ add_library(libjsonnet ${LIBJSONNET_HEADERS} ${LIBJSONNET_SOURCE})
+ add_dependencies(libjsonnet md5 stdlib)
+ target_link_libraries(libjsonnet md5 nlohmann_json::nlohmann_json)
+@@ -48,6 +49,7 @@ install(TARGETS libjsonnet
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
++endif()
+
+ if (BUILD_STATIC_LIBS)
+ # Static library for jsonnet command-line tool.
+@@ -102,3 +104,6 @@ if (BUILD_TESTS)
+ add_test(jsonnet_test_snippet
+ ${GLOBAL_OUTPUT_PATH}/jsonnet -e ${TEST_SNIPPET})
+ endif()
++
++
++install(FILES ${LIBJSONNET_HEADERS} DESTINATION include)
+\ No newline at end of file
+diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
+index bf349df..6ed1442 100644
+--- a/cpp/CMakeLists.txt
++++ b/cpp/CMakeLists.txt
+@@ -8,9 +8,9 @@ set(LIBJSONNETPP_SOURCE
+ libjsonnet++.cpp
+ )
+
++if (BUILD_SHARED_BINARIES)
+ add_library(libjsonnet++ SHARED ${LIBJSONNETPP_HEADERS} ${LIBJSONNETPP_SOURCE})
+-add_dependencies(libjsonnet++ jsonnet)
+-# target_link_libraries(libjsonnet libjsonnet)
++target_link_libraries(libjsonnet++ libjsonnet)
+
+ # CMake prepends CMAKE_SHARED_LIBRARY_PREFIX to shared libraries, so without
+ # this step the output would be |liblibjsonnet|.
+@@ -22,6 +22,7 @@ install(TARGETS libjsonnet++
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
++endif()
+
+ if (BUILD_STATIC_LIBS)
+ # Static library for jsonnet command-line tool.
+@@ -38,6 +39,8 @@ else()
+ add_library(libjsonnet++_for_binaries ALIAS libjsonnet++_static)
+ endif()
+
++install(FILES ${LIBJSONNETPP_HEADERS} DESTINATION include)
++
+ # Tests
+ function(add_test_executablepp test_name)
+ if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/${test_name}.cpp)
diff --git a/ports/jsonnet/CONTROL b/ports/jsonnet/CONTROL
index 35c870658..2f6e669ef 100644
--- a/ports/jsonnet/CONTROL
+++ b/ports/jsonnet/CONTROL
@@ -1,4 +1,4 @@
Source: jsonnet
-Version: 2019-05-08
+Version: 0.14.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 5472445da..2840f513f 100644
--- a/ports/jsonnet/portfile.cmake
+++ b/ports/jsonnet/portfile.cmake
@@ -1,22 +1,21 @@
-include(vcpkg_common_functions)
-
-if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME)
+if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/jsonnet
- REF c323f5ce5b8aa663585d23dc0fb94d4b166c6f16
- SHA512 d9f84c39929e9e80272e2b834f68a13b48c1cb4d64b70f5b6fa16e677555d947f7cf57372453e23066a330faa6a429b9aa750271b46f763581977a223d238785
+ REF 552d8ec6f6b973a6357b83eb9bacd707366d28f0 # v0.14.0
+ SHA512 a4a9c6285155addbc5b7ef1a0c02b99b4d941bfc8e6536eaf029bff77c9c303a5c36f654ca8ab6b9757d2710c100c3e4a05f310269d82b0385ae55ea6ead14ef
HEAD_REF master
PATCHES
- 001-enable-msvc.patch
+ 001-enable-msvc.patch
+ 002-fix-dependency-and-install.patch
)
-if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
- vcpkg_execute_required_process(
- COMMAND Powershell -Command "((Get-Content -Encoding Byte \"${SOURCE_PATH}/stdlib/std.jsonnet\") -join ',') + ',0' > \"${SOURCE_PATH}/core/std.jsonnet.h\""
+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"
)
@@ -28,15 +27,29 @@ else()
)
endif()
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(BUILD_SHARED ON)
+ set(BUILD_STATIC OFF)
+else()
+ set(BUILD_SHARED OFF)
+ set(BUILD_STATIC ON)
+endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
- OPTIONS -DBUILD_JSONNET=OFF -DBUILD_TESTS=OFF
+ OPTIONS
+ -DBUILD_SHARED_BINARIES=${BUILD_SHARED}
+ -DBUILD_STATIC_LIBS=${BUILD_STATIC}
+ -DBUILD_JSONNET=OFF
+ -DBUILD_JSONNETFMT=OFF
+ -DBUILD_TESTS=OFF
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/jsonnet)
-file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/jsonnet RENAME copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)