vcpkg/ports/jsonnet/portfile.cmake
Tetsuya Hayashi c8e1797c30
[jsonnet] Update to 0.18.0 (#25800)
* [jsonnet] Update to 0.18.0 (#20627)

* Update jsonnet to 0.18.0

* update patch files

* add 0005-use-upstream-rapidyaml.patch to use system rapidyaml

* use system rapidyaml

* update version

* Added license "Apache-2.0" to vcpkg.json

from https://github.com/google/jsonnet/blob/master/LICENSE
2022-07-19 10:00:08 -07:00

62 lines
1.9 KiB
CMake

if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/jsonnet
REF v0.18.0
SHA512 08a64a4b132df1519292378cef93deb3c60d21636b2a71bce6c13e29cfd93cab465cad77e11f000fb984c5c75a4ca1c92504654fd2e5201343df767ea0e610d1
HEAD_REF master
PATCHES
001-enable-msvc.patch
002-fix-dependency-and-install.patch
0003-use-upstream-nlohmann-json.patch
0004-incorporate-md5.patch
0005-use-upstream-rapidyaml.patch
)
# see https://github.com/google/jsonnet/blob/v0.18.0/Makefile#L220
if(VCPKG_TARGET_IS_WINDOWS)
find_program(PWSH_PATH pwsh)
vcpkg_execute_required_process(
COMMAND "${PWSH_PATH}" -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"
)
else()
vcpkg_execute_required_process(
COMMAND bash -c "((od -v -Anone -t u1 \"${SOURCE_PATH}/stdlib/std.jsonnet\" | tr ' ' '\\n' | grep -v '^$' | tr '\\n' ',' ) && echo '0') > \"${SOURCE_PATH}/core/std.jsonnet.h\""
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "std.jsonnet"
)
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_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_SHARED_BINARIES=${BUILD_SHARED}
-DBUILD_STATIC_LIBS=${BUILD_STATIC}
-DBUILD_JSONNET=OFF
-DBUILD_JSONNETFMT=OFF
-DBUILD_TESTS=OFF
-DUSE_SYSTEM_JSON=ON
-DUSE_SYSTEM_RYML=ON
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/jsonnet")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)