From 8497b3b4f889e12bc5d95451975fc519eb38554a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Bornemann?= Date: Sun, 8 Sep 2024 20:47:43 +0200 Subject: [PATCH] [md4c] New port (#40799) (#40800) --- ports/md4c/cmake.patch | 21 +++++++++++++++++++++ ports/md4c/portfile.cmake | 23 +++++++++++++++++++++++ ports/md4c/usage | 4 ++++ ports/md4c/vcpkg.json | 17 +++++++++++++++++ versions/baseline.json | 4 ++++ versions/m-/md4c.json | 9 +++++++++ 6 files changed, 78 insertions(+) create mode 100644 ports/md4c/cmake.patch create mode 100644 ports/md4c/portfile.cmake create mode 100644 ports/md4c/usage create mode 100644 ports/md4c/vcpkg.json create mode 100644 versions/m-/md4c.json diff --git a/ports/md4c/cmake.patch b/ports/md4c/cmake.patch new file mode 100644 index 0000000000..29d046a425 --- /dev/null +++ b/ports/md4c/cmake.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aec8293..600d51b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,16 +51,6 @@ elseif(MSVC) + # Disable warnings about the so-called unsecured functions: + add_definitions(/D_CRT_SECURE_NO_WARNINGS) + add_compile_options(/W3) +- +- # Specify proper C runtime library: +- string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") +- string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") +- string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELWITHDEBINFO "{$CMAKE_C_FLAGS_RELWITHDEBINFO}") +- string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}") +- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") +- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") +- set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /MT") +- set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /MT") + endif() + + include(GNUInstallDirs) diff --git a/ports/md4c/portfile.cmake b/ports/md4c/portfile.cmake new file mode 100644 index 0000000000..6532cf090e --- /dev/null +++ b/ports/md4c/portfile.cmake @@ -0,0 +1,23 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mity/md4c + REF "release-${VERSION}" + SHA512 30607ba39d6c59329f5a56a90cd816ff60b82ea752ac2b9df356d756529cfc49170019fae5df32fa94afc0e2a186c66eaf56fa6373d18436c06ace670675ba85 + HEAD_REF master + PATCHES + "cmake.patch" +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS -DBUILD_MD2HTML_EXECUTABLE=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/md4c") +vcpkg_fixup_pkgconfig() +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) diff --git a/ports/md4c/usage b/ports/md4c/usage new file mode 100644 index 0000000000..ea22b43e34 --- /dev/null +++ b/ports/md4c/usage @@ -0,0 +1,4 @@ +md4c provides CMake targets: + +find_package(md4c CONFIG REQUIRED) +target_link_libraries(main PRIVATE md4c::md4c) diff --git a/ports/md4c/vcpkg.json b/ports/md4c/vcpkg.json new file mode 100644 index 0000000000..b2eb4bb164 --- /dev/null +++ b/ports/md4c/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "md4c", + "version": "0.5.2", + "description": "MD4C is a C library providing a Markdown parser.", + "homepage": "https://github.com/mity/md4c", + "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 928e96f14b..9bc2a1f77b 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5760,6 +5760,10 @@ "baseline": "2.7.2.14", "port-version": 5 }, + "md4c": { + "baseline": "0.5.2", + "port-version": 0 + }, "mdl-sdk": { "baseline": "2021.1.2", "port-version": 5 diff --git a/versions/m-/md4c.json b/versions/m-/md4c.json new file mode 100644 index 0000000000..c79134b4c5 --- /dev/null +++ b/versions/m-/md4c.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "3d6a0dd2cd6d89e4c83bebf016a978b82c0733c5", + "version": "0.5.2", + "port-version": 0 + } + ] +}