From 89f522a548a80b90a4d1ba6073e0d226b4d3a64e Mon Sep 17 00:00:00 2001 From: as-shura <123847861+as-shura@users.noreply.github.com> Date: Mon, 13 Feb 2023 16:57:54 +0100 Subject: [PATCH] [mujs] Update to 1.3.2 and add export CMake-config (#29543) * New version with find_package. * Update database. * Update ports/mujs/portfile.cmake Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> * Update ports/mujs/portfile.cmake Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> * Update ports/mujs/portfile.cmake Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> * Update ports/mujs/vcpkg.json Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> * Update ports/mujs/portfile.cmake Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> * Update ports/mujs/vcpkg.json Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> * Update database. * Automatic versioning and db update. * Modify port version in portfile.cmake * x-add-version * Update mujs.json * Modify TARGETS_EXPORT_NAME * x-add-version --------- Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> Co-authored-by: Lily Wang <494550702@qq.com> --- ports/mujs/CMakeLists.txt | 32 ++++++++++++++++++++++++++++---- ports/mujs/mujsConfig.cmake.in | 8 ++++++++ ports/mujs/portfile.cmake | 22 +++++++++++++--------- ports/mujs/vcpkg.json | 16 +++++++++++++--- versions/baseline.json | 4 ++-- versions/m-/mujs.json | 5 +++++ 6 files changed, 69 insertions(+), 18 deletions(-) create mode 100644 ports/mujs/mujsConfig.cmake.in diff --git a/ports/mujs/CMakeLists.txt b/ports/mujs/CMakeLists.txt index 639d2a9652..e70f01c126 100644 --- a/ports/mujs/CMakeLists.txt +++ b/ports/mujs/CMakeLists.txt @@ -1,24 +1,48 @@ cmake_minimum_required(VERSION 3.9) -project(mujs) +project(mujs VERSION 1.3.2) if(MSVC) add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) endif() -file(GLOB libmujs_sources js*.c utf*.c regexp.c) +file(GLOB mujs_sources js*.c utf*.c regexp.c) include_directories(.) +add_library(mujs ${mujs_sources}) -add_library(libmujs ${libmujs_sources}) +target_include_directories(mujs PUBLIC "$") + +# Add CMake find_package() integration +set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +set(PROJECT_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake") +set(TARGETS_EXPORT_NAME "unofficial-${PROJECT_NAME}Targets") +set(NAMESPACE "unofficial::mujs::") install( - TARGETS libmujs + TARGETS mujs + EXPORT ${TARGETS_EXPORT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +export(TARGETS mujs NAMESPACE ${NAMESPACE} FILE mujsTargets.cmake) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + mujsConfigVersion.cmake + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion +) + +configure_package_config_file("mujsConfig.cmake.in" "${PROJECT_CONFIG}" INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}") +install(FILES "${PROJECT_CONFIG}" DESTINATION "${CONFIG_INSTALL_DIR}") + +install(EXPORT ${TARGETS_EXPORT_NAME} + NAMESPACE ${NAMESPACE} + DESTINATION "${CONFIG_INSTALL_DIR}") + if(NOT DISABLE_INSTALL_HEADERS) install(FILES mujs.h DESTINATION include) endif() diff --git a/ports/mujs/mujsConfig.cmake.in b/ports/mujs/mujsConfig.cmake.in new file mode 100644 index 0000000000..4a6fa4fdca --- /dev/null +++ b/ports/mujs/mujsConfig.cmake.in @@ -0,0 +1,8 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +# Any extra setup + +# Add the targets file +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") diff --git a/ports/mujs/portfile.cmake b/ports/mujs/portfile.cmake index 3475307dc2..fc89934c2c 100644 --- a/ports/mujs/portfile.cmake +++ b/ports/mujs/portfile.cmake @@ -3,20 +3,24 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ccxvii/mujs - REF c86267d8b2b5f9a6ae318dc69886109eee0c7b61 - SHA512 927b000cd6a28b785d510917445a5a39a4dbaf0e13eab920cf83c7838b111b8a0542cfab0110f8493dc65b88a48261deb6ba7a871cbe77fb46119b536a69d470 + REF "${VERSION}" + SHA512 ccffb04171f7ecec2cfa6f0e59859acc911836370a648e4c6703db174631ce316413a64ebf4b32eea3d3b09221ff01861cda91f4b1b9bebf495168f26f90daf5 HEAD_REF master ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/mujsConfig.cmake.in" DESTINATION "${SOURCE_PATH}") -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON -DDISABLE_INSTALL_TOOLS=ON +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS_DEBUG + -DDISABLE_INSTALL_HEADERS=ON + -DDISABLE_INSTALL_TOOLS=ON ) -vcpkg_install_cmake() +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() +vcpkg_cmake_config_fixup(PACKAGE_NAME mujs CONFIG_PATH lib/cmake/mujs) vcpkg_copy_pdbs() -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mujs RENAME copyright) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/ports/mujs/vcpkg.json b/ports/mujs/vcpkg.json index 689ad0d5b1..123be9531f 100644 --- a/ports/mujs/vcpkg.json +++ b/ports/mujs/vcpkg.json @@ -1,7 +1,17 @@ { "name": "mujs", - "version-string": "2018-07-30", - "port-version": 2, + "version": "1.3.2", "description": "An embeddable Javascript interpreter in C", - "homepage": "https://github.com/ccxvii/mujs" + "homepage": "https://github.com/ccxvii/mujs", + "license": "ISC", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] } diff --git a/versions/baseline.json b/versions/baseline.json index 0edd514502..09d89202cd 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5229,8 +5229,8 @@ "port-version": 3 }, "mujs": { - "baseline": "2018-07-30", - "port-version": 2 + "baseline": "1.3.2", + "port-version": 0 }, "munit": { "baseline": "2019-04-06", diff --git a/versions/m-/mujs.json b/versions/m-/mujs.json index a500b6acf3..c019af0d56 100644 --- a/versions/m-/mujs.json +++ b/versions/m-/mujs.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "9c67a4a21c48b6ad43918a526e539cf90d822e1a", + "version": "1.3.2", + "port-version": 0 + }, { "git-tree": "b08453227e8770baadeb826bb3cd711815e6a865", "version-string": "2018-07-30",