mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 05:49:08 +08:00
[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
This commit is contained in:
parent
73fa03965b
commit
8390d68837
4
ports/discount/CONTROL
Normal file
4
ports/discount/CONTROL
Normal file
@ -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.
|
34
ports/discount/blocktags
Normal file
34
ports/discount/blocktags
Normal file
@ -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
|
27
ports/discount/cmake.patch
Normal file
27
ports/discount/cmake.patch
Normal file
@ -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 */
|
16
ports/discount/disable-deprecated-warnings.patch
Normal file
16
ports/discount/disable-deprecated-warnings.patch
Normal file
@ -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)
|
29
ports/discount/generate-blocktags-command.patch
Normal file
29
ports/discount/generate-blocktags-command.patch
Normal file
@ -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"
|
45
ports/discount/portfile.cmake
Normal file
45
ports/discount/portfile.cmake
Normal file
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user