diff options
| author | Tri Tran <lepnit205@gmail.com> | 2019-08-08 11:04:39 -0500 |
|---|---|---|
| committer | Curtis J Bezault <curtbezault@gmail.com> | 2019-08-08 12:04:39 -0400 |
| commit | 8390d68837a8d538dffa19d00b56e33a940b50f6 (patch) | |
| tree | 7acfd0e865a5b568c1053724046e6aa18636c33b | |
| parent | 73fa03965bf1a54a779f24ea1be1660e246db6ab (diff) | |
| download | vcpkg-8390d68837a8d538dffa19d00b56e33a940b50f6.tar.gz vcpkg-8390d68837a8d538dffa19d00b56e33a940b50f6.zip | |
[discount] Add new package Discount (#7400)
* [discount] Add new package Discount
* [discount] Add new package Discount
* New package [Discount](https://github.com/Orc/discount)
* Static build only
* [discount] Fix arm* and *uwp builds
* Discount needs to run `mktags.exe` to generate `blocktags`. This fix copy generated `blocktags` to `SOURCE_PATH` for arm\* builds and \*uwp builds.
* [discount] Fix UWP and ARM check
* [discount] Another fix for blocktags
* [discount] And another one
* [discount] And another one. Please squash these PR commits.
Sorry I don't have UWP or ARM compiler installed on my machine.
* [discount] Use definitions in msvc/Makefile
* [discount] Add homepage
| -rw-r--r-- | ports/discount/CONTROL | 4 | ||||
| -rw-r--r-- | ports/discount/blocktags | 34 | ||||
| -rw-r--r-- | ports/discount/cmake.patch | 27 | ||||
| -rw-r--r-- | ports/discount/disable-deprecated-warnings.patch | 16 | ||||
| -rw-r--r-- | ports/discount/generate-blocktags-command.patch | 29 | ||||
| -rw-r--r-- | ports/discount/portfile.cmake | 45 |
6 files changed, 155 insertions, 0 deletions
diff --git a/ports/discount/CONTROL b/ports/discount/CONTROL new file mode 100644 index 000000000..51c8b5e90 --- /dev/null +++ b/ports/discount/CONTROL @@ -0,0 +1,4 @@ +Source: discount
+Version: 2.2.6
+Homepage: https://github.com/Orc/discount
+Description: DISCOUNT is a implementation of John Gruber & Aaron Swartz's Markdown markup language.
diff --git a/ports/discount/blocktags b/ports/discount/blocktags new file mode 100644 index 000000000..dfd3957c3 --- /dev/null +++ b/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/ports/discount/cmake.patch b/ports/discount/cmake.patch new file mode 100644 index 000000000..8a2278cf7 --- /dev/null +++ b/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/ports/discount/disable-deprecated-warnings.patch b/ports/discount/disable-deprecated-warnings.patch new file mode 100644 index 000000000..e8f4f0fb7 --- /dev/null +++ b/ports/discount/disable-deprecated-warnings.patch @@ -0,0 +1,16 @@ +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 11fa675..34cc9ed 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -20,6 +20,11 @@ set(${PROJECT_NAME}_INSTALL_SAMPLES OFF CACHE BOOL + set(${PROJECT_NAME}_ONLY_LIBRARY OFF CACHE BOOL + "Set to ON to only build markdown library (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/ports/discount/generate-blocktags-command.patch b/ports/discount/generate-blocktags-command.patch new file mode 100644 index 000000000..13d63a25d --- /dev/null +++ b/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/ports/discount/portfile.cmake b/ports/discount/portfile.cmake new file mode 100644 index 000000000..6a40d5105 --- /dev/null +++ b/ports/discount/portfile.cmake @@ -0,0 +1,45 @@ +include(vcpkg_common_functions)
+
+# No dynamic link for MSVC
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Orc/discount
+ REF v2.2.6
+ SHA512 4c5956dea78aacd3a105ddac13f1671d811a5b2b04990cdf8485c36190c8872c4b1b9432a7236f669c34b07564ecd0096632dced54d67de9eaf4f23641417ecc
+ HEAD_REF master
+ PATCHES
+ cmake.patch
+ 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_configure_cmake(
+ SOURCE_PATH "${SOURCE_PATH}/cmake"
+ PREFER_NINJA
+ DISABLE_PARALLEL_CONFIGURE
+ OPTIONS
+ -DDISCOUNT_ONLY_LIBRARY=ON
+ -DGENERATE_BLOCKTAGS=${GENERATE_BLOCKTAGS}
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/discount)
+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)
+
|
