aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/discount
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/discount')
-rw-r--r--vcpkg/ports/discount/blocktags34
-rw-r--r--vcpkg/ports/discount/cmake.patch27
-rw-r--r--vcpkg/ports/discount/disable-deprecated-warnings.patch16
-rw-r--r--vcpkg/ports/discount/generate-blocktags-command.patch29
-rw-r--r--vcpkg/ports/discount/portfile.cmake42
-rw-r--r--vcpkg/ports/discount/vcpkg.json16
6 files changed, 164 insertions, 0 deletions
diff --git a/vcpkg/ports/discount/blocktags b/vcpkg/ports/discount/blocktags
new file mode 100644
index 0000000..dfd3957
--- /dev/null
+++ b/vcpkg/ports/discount/blocktags
@@ -0,0 +1,34 @@
+static struct kw blocktags[] = {
+ { "P", 1, 0 },
+ { "DL", 2, 0 },
+ { "H1", 2, 0 },
+ { "H2", 2, 0 },
+ { "H3", 2, 0 },
+ { "H4", 2, 0 },
+ { "H5", 2, 0 },
+ { "H6", 2, 0 },
+ { "HR", 2, 1 },
+ { "OL", 2, 0 },
+ { "UL", 2, 0 },
+ { "BDO", 3, 0 },
+ { "DFN", 3, 0 },
+ { "DIV", 3, 0 },
+ { "MAP", 3, 0 },
+ { "PRE", 3, 0 },
+ { "WBR", 3, 0 },
+ { "XMP", 3, 0 },
+ { "FORM", 4, 0 },
+ { "NOBR", 4, 0 },
+ { "STYLE", 5, 0 },
+ { "TABLE", 5, 0 },
+ { "CENTER", 6, 0 },
+ { "IFRAME", 6, 0 },
+ { "OBJECT", 6, 0 },
+ { "SCRIPT", 6, 0 },
+ { "ADDRESS", 7, 0 },
+ { "LISTING", 7, 0 },
+ { "PLAINTEXT", 9, 0 },
+ { "BLOCKQUOTE", 10, 0 },
+};
+
+#define NR_blocktags 30
diff --git a/vcpkg/ports/discount/cmake.patch b/vcpkg/ports/discount/cmake.patch
new file mode 100644
index 0000000..8a2278c
--- /dev/null
+++ b/vcpkg/ports/discount/cmake.patch
@@ -0,0 +1,27 @@
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index 3895fdb..a183836 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -182,7 +182,10 @@ if(${PROJECT_NAME}_MAKE_INSTALL)
+ target_include_directories(libmarkdown INTERFACE
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+ )
+- set(_TARGETS libmarkdown markdown)
++ set(_TARGETS libmarkdown)
++ if(NOT ${PROJECT_NAME}_ONLY_LIBRARY)
++ set(_TARGETS ${_TARGETS} markdown)
++ endif()
+ if(${PROJECT_NAME}_INSTALL_SAMPLES)
+ list(APPEND _TARGETS mkd2html makepage)
+ endif()
+diff --git a/cmake/config.h.in b/cmake/config.h.in
+index e08220d..e630934 100644
+--- a/cmake/config.h.in
++++ b/cmake/config.h.in
+@@ -74,4 +74,6 @@
+
+ #define TABSTOP @TABSTOP@
+
++#define DESTRUCTOR
++
+ #endif /* _CONFIG_D */
diff --git a/vcpkg/ports/discount/disable-deprecated-warnings.patch b/vcpkg/ports/discount/disable-deprecated-warnings.patch
new file mode 100644
index 0000000..1684c74
--- /dev/null
+++ b/vcpkg/ports/discount/disable-deprecated-warnings.patch
@@ -0,0 +1,16 @@
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index ae859a3..77a936a 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -23,6 +23,11 @@ set(${PROJECT_NAME}_ONLY_LIBRARY OFF CACHE BOOL
+ set(${PROJECT_NAME}_CXX_BINDING OFF CACHE BOOL
+ "Set to ON to install header files with c++ wrappers (default is OFF)")
+
++# MSVC deprecated warnings (C4996,strdup, ...)
++if(MSVC)
++ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
++endif()
++
+ # Check headers
+ include(CheckIncludeFile)
+ check_include_file(libgen.h HAVE_LIBGEN_H)
diff --git a/vcpkg/ports/discount/generate-blocktags-command.patch b/vcpkg/ports/discount/generate-blocktags-command.patch
new file mode 100644
index 0000000..13d63a2
--- /dev/null
+++ b/vcpkg/ports/discount/generate-blocktags-command.patch
@@ -0,0 +1,29 @@
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index a183836..e9deef5 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -113,12 +115,19 @@ configure_file("${_ROOT}/mkdio.h.in"
+
+ include_directories("${_ROOT}")
+
+-add_executable(mktags
+- "${_ROOT}/mktags.c")
+
+-add_custom_command(OUTPUT "${_ROOT}/blocktags"
+- COMMAND mktags > blocktags
+- WORKING_DIRECTORY "${_ROOT}")
++if(NOT GENERATE_BLOCKTAGS)
++ message(STATUS "Not generating blocktags")
++else()
++ message(STATUS "Using mktags to generate blocktags")
++
++ add_executable(mktags
++ "${_ROOT}/mktags.c")
++
++ add_custom_command(OUTPUT "${_ROOT}/blocktags"
++ COMMAND mktags > blocktags
++ WORKING_DIRECTORY "${_ROOT}")
++endif()
+
+ add_library(libmarkdown
+ "${_ROOT}/mkdio.c"
diff --git a/vcpkg/ports/discount/portfile.cmake b/vcpkg/ports/discount/portfile.cmake
new file mode 100644
index 0000000..2cf70ff
--- /dev/null
+++ b/vcpkg/ports/discount/portfile.cmake
@@ -0,0 +1,42 @@
+# No dynamic link for MSVC
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Orc/discount
+ REF "v${VERSION}"
+ SHA512 ab24722bb8513f64eed59bb2770276b91615033b494a0492a331f36c5fcd2e32b7a9f3bd7ef0bb74c107f1e0e955522c83ddba6c482fca7f18cf275334707c4d
+ HEAD_REF master
+ PATCHES
+ generate-blocktags-command.patch
+ disable-deprecated-warnings.patch
+)
+
+set(GENERATE_BLOCKTAGS ON)
+if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" OR VCPKG_TARGET_ARCHITECTURE MATCHES "arm64" OR VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
+ set(GENERATE_BLOCKTAGS OFF)
+endif()
+
+if(NOT GENERATE_BLOCKTAGS)
+ configure_file("${CURRENT_PORT_DIR}/blocktags" "${SOURCE_PATH}/blocktags" COPYONLY)
+ message(STATUS "Copied blocktags")
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}/cmake"
+ DISABLE_PARALLEL_CONFIGURE
+ OPTIONS
+ -DDISCOUNT_ONLY_LIBRARY=ON
+ -DGENERATE_BLOCKTAGS=${GENERATE_BLOCKTAGS}
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/discount)
+vcpkg_fixup_pkgconfig()
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/discount" RENAME copyright)
+
diff --git a/vcpkg/ports/discount/vcpkg.json b/vcpkg/ports/discount/vcpkg.json
new file mode 100644
index 0000000..d11f44d
--- /dev/null
+++ b/vcpkg/ports/discount/vcpkg.json
@@ -0,0 +1,16 @@
+{
+ "name": "discount",
+ "version-string": "3.0.0d",
+ "description": "DISCOUNT is a implementation of John Gruber & Aaron Swartz's Markdown markup language.",
+ "homepage": "https://github.com/Orc/discount",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}