aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2018-10-18 02:52:23 +0800
committerRobert Schumacher <roschuma@microsoft.com>2018-10-17 11:52:23 -0700
commitd45c9779a7dbe1e6d9703fc4ef4523a8a8b3e874 (patch)
tree72d1ca5594abb0759949bd8e5a13236880927cb6
parent0fe909718c28d7377d07ed7130524d4a11a0c8bd (diff)
downloadvcpkg-d45c9779a7dbe1e6d9703fc4ef4523a8a8b3e874.tar.gz
vcpkg-d45c9779a7dbe1e6d9703fc4ef4523a8a8b3e874.zip
[docopt] Add new port to fix #3935 (#4343)
* [docopt] Add docopt.cpp to fix #3935 * [docopt] Cleanup * [docopt] Disable vcpkg_test_cmake due to misbehavior on x64 * [docopt] Install only one flavor (static/shared)
-rw-r--r--ports/docopt/001-fix-unresolved-symbol.patch28
-rw-r--r--ports/docopt/002-fix-install-path.patch16
-rw-r--r--ports/docopt/CONTROL3
-rw-r--r--ports/docopt/install-one-flavor.patch21
-rw-r--r--ports/docopt/portfile.cmake46
5 files changed, 114 insertions, 0 deletions
diff --git a/ports/docopt/001-fix-unresolved-symbol.patch b/ports/docopt/001-fix-unresolved-symbol.patch
new file mode 100644
index 000000000..3078fa44c
--- /dev/null
+++ b/ports/docopt/001-fix-unresolved-symbol.patch
@@ -0,0 +1,28 @@
+diff --git a/docopt.h b/docopt.h
+index 4c40741..06a04f8 100644
+--- a/docopt.h
++++ b/docopt.h
+@@ -85,6 +85,9 @@ namespace docopt {
+ bool help = true,
+ std::string const& version = {},
+ bool options_first = false) noexcept;
++
++ /// Write out the contents to the ostream
++ std::ostream DOCOPT_API & operator<<(std::ostream&, value const&);
+ }
+
+ #ifdef DOCOPT_HEADER_ONLY
+diff --git a/docopt_value.h b/docopt_value.h
+index a923219..7f0d6d6 100644
+--- a/docopt_value.h
++++ b/docopt_value.h
+@@ -102,9 +102,6 @@ namespace docopt {
+ Kind kind = Kind::Empty;
+ Variant variant {};
+ };
+-
+- /// Write out the contents to the ostream
+- std::ostream& operator<<(std::ostream&, value const&);
+ }
+
+ namespace std {
diff --git a/ports/docopt/002-fix-install-path.patch b/ports/docopt/002-fix-install-path.patch
new file mode 100644
index 000000000..332e6e4c2
--- /dev/null
+++ b/ports/docopt/002-fix-install-path.patch
@@ -0,0 +1,16 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1aba5ae..5407e4a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -113,7 +113,10 @@ endif()
+ set(export_name "docopt-targets")
+
+ # Runtime package
+-install(TARGETS docopt EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS docopt EXPORT ${export_name}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ # Development package
+ install(TARGETS docopt_s EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff --git a/ports/docopt/CONTROL b/ports/docopt/CONTROL
new file mode 100644
index 000000000..0fc6d09c8
--- /dev/null
+++ b/ports/docopt/CONTROL
@@ -0,0 +1,3 @@
+Source: docopt
+Version: 2018-04-16-2
+Description: Command line arguments parser that will make you smile (C++11 port).
diff --git a/ports/docopt/install-one-flavor.patch b/ports/docopt/install-one-flavor.patch
new file mode 100644
index 000000000..f6cda826a
--- /dev/null
+++ b/ports/docopt/install-one-flavor.patch
@@ -0,0 +1,21 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bff867c..cc7d706 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -113,13 +113,15 @@ endif()
+ set(export_name "docopt-targets")
+
+ # Runtime package
++if(BUILD_SHARED_LIBS)
+ install(TARGETS docopt EXPORT ${export_name}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+-
++else()
+ # Development package
+ install(TARGETS docopt_s EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
++endif()
+ install(FILES ${docopt_HEADERS} DESTINATION include/docopt)
+
+ # CMake Package
diff --git a/ports/docopt/portfile.cmake b/ports/docopt/portfile.cmake
new file mode 100644
index 000000000..5076bf742
--- /dev/null
+++ b/ports/docopt/portfile.cmake
@@ -0,0 +1,46 @@
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO docopt/docopt.cpp
+ REF 4f491249e6def236937dbfac7602852e7d99aff8
+ SHA512 d3a61f8d8a8c11723064f3405f03eb838a2ac9aa574f86771b1db89a2dd81996b639215fe5d4465343b893bf71502da178c7af8d883c112c1e45f43c17d473b7
+ HEAD_REF master
+ PATCHES
+ 001-fix-unresolved-symbol.patch
+ 002-fix-install-path.patch
+ install-one-flavor.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DWITH_EXAMPLE=OFF
+ -DWITH_TESTS=OFF
+ -DUSE_BOOST_REGEX=OFF
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/docopt)
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(READ ${CURRENT_PACKAGES_DIR}/include/docopt/docopt.h _contents)
+ string(REPLACE "#ifdef DOCOPT_DLL" "#if 1" _contents "${_contents}")
+ file(WRITE ${CURRENT_PACKAGES_DIR}/include/docopt/docopt.h "${_contents}")
+endif()
+
+# Header-only style when DOCOPT_HEADER_ONLY is defined
+file(COPY
+ ${SOURCE_PATH}/docopt.cpp
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include/docopt)
+
+# Handle copyright
+file(INSTALL
+ ${SOURCE_PATH}/LICENSE-MIT
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/docopt RENAME copyright)
+
+vcpkg_copy_pdbs()