From 6a6d89ffd80f28c9bd7ad170d0a08657a10fa9d6 Mon Sep 17 00:00:00 2001 From: cDc Date: Wed, 7 Aug 2019 19:14:35 +0300 Subject: [PATCH 01/30] fix linux/mac (#7575) --- ports/tinyexif/CONTROL | 2 +- ports/tinyexif/portfile.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/tinyexif/CONTROL b/ports/tinyexif/CONTROL index 24350d8be91..7d2da6da045 100644 --- a/ports/tinyexif/CONTROL +++ b/ports/tinyexif/CONTROL @@ -1,5 +1,5 @@ Source: tinyexif -Version: 1.0.2-5 +Version: 1.0.2-6 Build-Depends: tinyxml2 Homepage: https://github.com/cdcseacave/TinyEXIF Description: tiny ISO-compliant C++ EXIF and XMP parsing library for JPEG images diff --git a/ports/tinyexif/portfile.cmake b/ports/tinyexif/portfile.cmake index b6e48938440..b1940ad9446 100644 --- a/ports/tinyexif/portfile.cmake +++ b/ports/tinyexif/portfile.cmake @@ -20,7 +20,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/tinyexif) +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/TinyEXIF) vcpkg_copy_pdbs() From 3405bfd2fb0a4c7c4fc8fa2025d115a24acdb85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20T=C3=A4schner?= Date: Wed, 7 Aug 2019 18:29:14 +0200 Subject: [PATCH 02/30] [libcerf] Add new port (#7320) * Add port for libcerf. * Indicate that static linkage is not available. * Patch to enable static build. --- ports/libcerf/001-fix-static-build.patch | 13 +++++++++ ports/libcerf/CONTROL | 4 +++ ports/libcerf/portfile.cmake | 35 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 ports/libcerf/001-fix-static-build.patch create mode 100644 ports/libcerf/CONTROL create mode 100644 ports/libcerf/portfile.cmake diff --git a/ports/libcerf/001-fix-static-build.patch b/ports/libcerf/001-fix-static-build.patch new file mode 100644 index 00000000000..ffaeaedfbf4 --- /dev/null +++ b/ports/libcerf/001-fix-static-build.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f79581f..4fc9457 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -56,6 +56,8 @@ if(MSVC) + # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/$) + if(BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ++ else() ++ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + endif() + else() + add_compile_options(-O2 -Wno-sign-compare -fno-omit-frame-pointer) diff --git a/ports/libcerf/CONTROL b/ports/libcerf/CONTROL new file mode 100644 index 00000000000..72b1324d346 --- /dev/null +++ b/ports/libcerf/CONTROL @@ -0,0 +1,4 @@ +Source: libcerf +Version: 1.13 +Description: A self-contained numeric library that provides an efficient and accurate implementation of complex error functions, along with Dawson, Faddeeva, and Voigt functions. +Homepage: https://jugit.fz-juelich.de/mlz/libcerf diff --git a/ports/libcerf/portfile.cmake b/ports/libcerf/portfile.cmake new file mode 100644 index 00000000000..20e3c7c7084 --- /dev/null +++ b/ports/libcerf/portfile.cmake @@ -0,0 +1,35 @@ +include(vcpkg_common_functions) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(BUILD_SHARED_LIBS ON) +else() + set(BUILD_SHARED_LIBS OFF) +endif() + +vcpkg_download_distfile(ARCHIVE + URLS "https://jugit.fz-juelich.de/mlz/libcerf/uploads/924b8d245ad3461107ec630734dfc781/libcerf-1.13.tgz" + FILENAME "libcerf-1.13.tgz" + SHA512 4df711d3e9fd00de99959c3253a9565d1dc2c41f75a5800ced9c52f89cbd13185fbdca3ad75de788fd16c044082738ab345b7fb6a8820ac588edafe1812944aa +) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + PATCHES 001-fix-static-build.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DCERF_CPP=ON + -DLIB_MAN=OFF + -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libcerf RENAME copyright) + +vcpkg_test_cmake(PACKAGE_NAME libcerf) From d4fbdf21c4618a07089a8e6388e01b144e5c2baa Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Wed, 7 Aug 2019 18:30:42 +0200 Subject: [PATCH 03/30] [itk] Support legacy user code by default (#7241) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No longer specify `ITK_LEGACY_REMOVE` and `ITK_FUTURE_LEGACY_REMOVE` options for `vcpkg_configure_cmake`. By default, these two flags are `OFF`, for ITK 5.0.0: https://github.com/InsightSoftwareConsortium/ITK/blob/v5.0.0/CMakeLists.txt#L261 This commit will allow legacy ITK user code to build with vcpkg, and it will ease adding vcpkg support to https://github.com/SuperElastix/elastix Dženan Zukić @dzenanz suggested this change: https://discourse.itk.org/t/how-to-avoid-rebuilding-itk-by-azure-ci-at-the-github-of-another-project-elastix/2002/7 CONTROL version bumped as requested by Phil Christensen @Rastaban --- ports/itk/CONTROL | 2 +- ports/itk/portfile.cmake | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ports/itk/CONTROL b/ports/itk/CONTROL index b77968554c1..328137e0ea5 100644 --- a/ports/itk/CONTROL +++ b/ports/itk/CONTROL @@ -1,5 +1,5 @@ Source: itk -Version: 5.0.0-2 +Version: 5.0.0-3 Description: Insight Segmentation and Registration Toolkit (ITK) is used for image processing and analysis. Homepage: https://github.com/InsightSoftwareConsortium/ITK Build-Depends: double-conversion, libjpeg-turbo, zlib, libpng, tiff, expat, eigen3, hdf5[cpp], openjpeg diff --git a/ports/itk/portfile.cmake b/ports/itk/portfile.cmake index a83527a51f6..3b2094079c9 100644 --- a/ports/itk/portfile.cmake +++ b/ports/itk/portfile.cmake @@ -35,8 +35,6 @@ vcpkg_configure_cmake( -DITK_INSTALL_DATA_DIR=share/itk/data -DITK_INSTALL_DOC_DIR=share/itk/doc -DITK_INSTALL_PACKAGE_DIR=share/itk - -DITK_LEGACY_REMOVE=ON - -DITK_FUTURE_LEGACY_REMOVE=ON -DITK_USE_64BITS_IDS=ON -DITK_USE_CONCEPT_CHECKING=ON #-DITK_USE_SYSTEM_LIBRARIES=ON # enables USE_SYSTEM for all third party libraries, some of which do not have vcpkg ports such as CastXML, SWIG, MINC etc From 45ad86d5c9d3b2247bfdc9bcd1e390da82b0a647 Mon Sep 17 00:00:00 2001 From: Daniele Lupo Date: Wed, 7 Aug 2019 18:32:48 +0200 Subject: [PATCH 04/30] [stxxl] compilation fix (#7330) * stxxl fixed. * CONTROL updated. --- ports/stxxl/0001-fix-visual-studio.patch | 272 +++++++++++++++++++++++ ports/stxxl/portfile.cmake | 3 +- 2 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 ports/stxxl/0001-fix-visual-studio.patch diff --git a/ports/stxxl/0001-fix-visual-studio.patch b/ports/stxxl/0001-fix-visual-studio.patch new file mode 100644 index 00000000000..3506c51abfd --- /dev/null +++ b/ports/stxxl/0001-fix-visual-studio.patch @@ -0,0 +1,272 @@ +diff --git a/include/stxxl/bits/algo/ksort.h b/include/stxxl/bits/algo/ksort.h +index 33ec8cf..4079a57 100644 +--- a/include/stxxl/bits/algo/ksort.h ++++ b/include/stxxl/bits/algo/ksort.h +@@ -299,11 +299,7 @@ create_runs( + template +-struct run_cursor2_cmp : public std::binary_function< +- run_cursor2, +- run_cursor2, +- bool +- > ++struct run_cursor2_cmp + { + typedef run_cursor2 cursor_type; + KeyExtractor keyobj; +@@ -327,7 +323,7 @@ private: + }; + + template +-class key_comparison : public std::binary_function ++class key_comparison + { + KeyExtractor ke; + +diff --git a/include/stxxl/bits/algo/sort_helper.h b/include/stxxl/bits/algo/sort_helper.h +index 524e40d..69234c4 100644 +--- a/include/stxxl/bits/algo/sort_helper.h ++++ b/include/stxxl/bits/algo/sort_helper.h +@@ -51,7 +51,6 @@ struct trigger_entry + + template + struct trigger_entry_cmp +- : public std::binary_function + { + typedef TriggerEntryType trigger_entry_type; + ValueCmp cmp; +@@ -67,11 +66,6 @@ template + struct run_cursor2_cmp +- : public std::binary_function< +- run_cursor2, +- run_cursor2, +- bool +- > + { + typedef BlockType block_type; + typedef PrefetcherType prefetcher_type; +diff --git a/include/stxxl/bits/compat/unique_ptr.h b/include/stxxl/bits/compat/unique_ptr.h +index 9df12ff..7110246 100644 +--- a/include/stxxl/bits/compat/unique_ptr.h ++++ b/include/stxxl/bits/compat/unique_ptr.h +@@ -22,12 +22,7 @@ STXXL_BEGIN_NAMESPACE + + template + struct compat_unique_ptr { +-#if __cplusplus >= 201103L && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40400) + typedef std::unique_ptr result; +-#else +- // auto_ptr is inherently broken and is deprecated by unique_ptr in c++0x +- typedef std::auto_ptr result; +-#endif + }; + + STXXL_END_NAMESPACE +diff --git a/include/stxxl/bits/containers/btree/leaf.h b/include/stxxl/bits/containers/btree/leaf.h +index d7c619f..c6b2fcc 100644 +--- a/include/stxxl/bits/containers/btree/leaf.h ++++ b/include/stxxl/bits/containers/btree/leaf.h +@@ -66,7 +66,7 @@ public: + typedef node_cache leaf_cache_type; + + public: +- struct value_compare : public std::binary_function ++ struct value_compare + { + key_compare comp; + +diff --git a/include/stxxl/bits/containers/btree/node.h b/include/stxxl/bits/containers/btree/node.h +index 13dec7b..a4c47d8 100644 +--- a/include/stxxl/bits/containers/btree/node.h ++++ b/include/stxxl/bits/containers/btree/node.h +@@ -71,7 +71,7 @@ public: + typedef node_cache node_cache_type; + + private: +- struct value_compare : public std::binary_function ++ struct value_compare + { + key_compare comp; + +diff --git a/include/stxxl/bits/containers/hash_map/hash_map.h b/include/stxxl/bits/containers/hash_map/hash_map.h +index 0759bd2..ecf19cd 100644 +--- a/include/stxxl/bits/containers/hash_map/hash_map.h ++++ b/include/stxxl/bits/containers/hash_map/hash_map.h +@@ -1258,10 +1258,7 @@ protected: + * lexicographically by Note: the hash-value has already + * been computed. + */ +- struct Cmp : public std::binary_function< +- std::pair, +- std::pair, bool +- > ++ struct Cmp + { + self_type& map_; + Cmp(self_type& map) : map_(map) { } +@@ -1520,7 +1517,7 @@ protected: + + public: + //! Construct an equality predicate from the comparison operator +- struct equal_to : public std::binary_function ++ struct equal_to + { + //! reference to hash_map + const self_type& m_map; +diff --git a/include/stxxl/bits/io/wbtl_file.h b/include/stxxl/bits/io/wbtl_file.h +index 933a216..30828a0 100644 +--- a/include/stxxl/bits/io/wbtl_file.h ++++ b/include/stxxl/bits/io/wbtl_file.h +@@ -65,7 +65,7 @@ class wbtl_file : public disk_queued_file + size_type curpos; + request_ptr backend_request; + +- struct FirstFit : public std::binary_function ++ struct FirstFit + { + bool operator () ( + const place& entry, +diff --git a/include/stxxl/bits/mng/block_alloc.h b/include/stxxl/bits/mng/block_alloc.h +index 19ade8b..887f0e6 100644 +--- a/include/stxxl/bits/mng/block_alloc.h ++++ b/include/stxxl/bits/mng/block_alloc.h +@@ -138,7 +138,7 @@ private: + perm[i] = i; + + stxxl::random_number rnd; +- std::random_shuffle(perm.begin(), perm.end(), rnd _STXXL_FORCE_SEQUENTIAL); ++ std::shuffle(perm.begin(), perm.end(), std::mt19937(std::random_device()())); + } + + public: +diff --git a/include/stxxl/bits/mng/block_alloc_interleaved.h b/include/stxxl/bits/mng/block_alloc_interleaved.h +index a82ee34..5aba23a 100644 +--- a/include/stxxl/bits/mng/block_alloc_interleaved.h ++++ b/include/stxxl/bits/mng/block_alloc_interleaved.h +@@ -93,7 +93,7 @@ struct interleaved_RC : public interleaved_striping + perms[i][j] = j; + + random_number rnd; +- std::random_shuffle(perms[i].begin(), perms[i].end(), rnd _STXXL_FORCE_SEQUENTIAL); ++ std::shuffle(perms[i].begin(), perms[i].end(), std::mt19937(std::random_device()())); + } + } + +diff --git a/include/stxxl/bits/mng/disk_allocator.h b/include/stxxl/bits/mng/disk_allocator.h +index 59ad085..c1e0f83 100644 +--- a/include/stxxl/bits/mng/disk_allocator.h ++++ b/include/stxxl/bits/mng/disk_allocator.h +@@ -44,7 +44,7 @@ class disk_allocator : private noncopyable + { + typedef std::pair place; + +- struct first_fit : public std::binary_function ++ struct first_fit + { + bool operator () ( + const place& entry, +@@ -189,7 +189,7 @@ void disk_allocator::new_blocks(BID* begin, BID* end) + + sortseq::iterator space; + space = std::find_if(free_space.begin(), free_space.end(), +- bind2nd(first_fit(), requested_size) _STXXL_FORCE_SEQUENTIAL); ++ std::bind(first_fit(), std::placeholders::_1, requested_size) _STXXL_FORCE_SEQUENTIAL); + + if (space == free_space.end() && requested_size == BlockSize) + { +@@ -207,7 +207,7 @@ void disk_allocator::new_blocks(BID* begin, BID* end) + grow_file(BlockSize); + + space = std::find_if(free_space.begin(), free_space.end(), +- bind2nd(first_fit(), requested_size) _STXXL_FORCE_SEQUENTIAL); ++ std::bind(first_fit(), std::placeholders::_1, requested_size) _STXXL_FORCE_SEQUENTIAL); + } + + if (space != free_space.end()) +diff --git a/include/stxxl/bits/parallel.h b/include/stxxl/bits/parallel.h +index d973861..c858d87 100644 +--- a/include/stxxl/bits/parallel.h ++++ b/include/stxxl/bits/parallel.h +@@ -121,7 +121,6 @@ using __gnu_parallel::random_shuffle; + #elif STXXL_PARALLEL + + using std::sort; +-using std::random_shuffle; + + #else + +diff --git a/include/stxxl/bits/parallel/base.h b/include/stxxl/bits/parallel/base.h +index 141d515..7dae74f 100644 +--- a/include/stxxl/bits/parallel/base.h ++++ b/include/stxxl/bits/parallel/base.h +@@ -33,7 +33,6 @@ namespace parallel { + */ + template + class binary_negate +- : public std::binary_function + { + protected: + Predicate pred; +@@ -80,7 +79,7 @@ static inline void decode2(lcas_t x, int& a, int& b) + * Constructs predicate for equality from strict weak ordering predicate + */ + template +-class equal_from_less : public std::binary_function ++class equal_from_less + { + private: + Comparator& comp; +@@ -126,7 +125,7 @@ median_of_three_iterators(RandomAccessIterator a, RandomAccessIterator b, + + /** Similar to std::equal_to, but allows two different types. */ + template +-struct equal_to : std::binary_function ++struct equal_to + { + bool operator () (const T1& t1, const T2& t2) const + { +@@ -136,7 +135,7 @@ struct equal_to : std::binary_function + + /** Similar to std::less, but allows two different types. */ + template +-struct less : std::binary_function ++struct less + { + bool operator () (const T1& t1, const T2& t2) const + { +diff --git a/include/stxxl/bits/parallel/multiseq_selection.h b/include/stxxl/bits/parallel/multiseq_selection.h +index 57e7599..f41d9aa 100644 +--- a/include/stxxl/bits/parallel/multiseq_selection.h ++++ b/include/stxxl/bits/parallel/multiseq_selection.h +@@ -35,7 +35,6 @@ namespace parallel { + //! Compare a pair of types lexcigraphically, ascending. + template + class lexicographic +- : public std::binary_function, std::pair, bool> + { + protected: + Comparator& m_comp; +@@ -60,7 +59,6 @@ public: + //! Compare a pair of types lexcigraphically, descending. + template + class lexicographic_rev +- : public std::binary_function, std::pair, bool> + { + protected: + Comparator& m_comp; +diff --git a/lib/io/wbtl_file.cpp b/lib/io/wbtl_file.cpp +index 310d76a..6d52e2e 100644 +--- a/lib/io/wbtl_file.cpp ++++ b/lib/io/wbtl_file.cpp +@@ -304,7 +304,7 @@ wbtl_file::offset_type wbtl_file::get_next_write_block() + // mapping_lock has to be aquired by caller + sortseq::iterator space = + std::find_if(free_space.begin(), free_space.end(), +- bind2nd(FirstFit(), write_block_size) _STXXL_FORCE_SEQUENTIAL); ++ std::bind(FirstFit(), std::placeholders::_1, write_block_size) _STXXL_FORCE_SEQUENTIAL); + + if (space != free_space.end()) + { diff --git a/ports/stxxl/portfile.cmake b/ports/stxxl/portfile.cmake index 23414f08eb6..01d072d0929 100644 --- a/ports/stxxl/portfile.cmake +++ b/ports/stxxl/portfile.cmake @@ -11,6 +11,7 @@ vcpkg_from_github( PATCHES # This patch can be removed when stxxl/stxxl/#95 is accepted fix-include-dir.patch + 0001-fix-visual-studio.patch ) vcpkg_configure_cmake( @@ -32,7 +33,7 @@ vcpkg_configure_cmake( OPTIONS_DEBUG -DSTXXL_DEBUG_ASSERTIONS=ON OPTIONS_RELEASE - -DSTXXL_DEBUG_ASSERTIONS=OFF + -DSTXXL_DEBUG_ASSERTIONS=OFF ) vcpkg_install_cmake() From ad187df6de63d81366abacf9268c08649a9d966f Mon Sep 17 00:00:00 2001 From: Ehsan Date: Wed, 7 Aug 2019 21:05:04 +0430 Subject: [PATCH 05/30] [chakracore] Update library to 1.11.11 (#7576) --- ports/chakracore/CONTROL | 2 +- ports/chakracore/portfile.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/chakracore/CONTROL b/ports/chakracore/CONTROL index 919391eb697..44c6fe4c4a9 100644 --- a/ports/chakracore/CONTROL +++ b/ports/chakracore/CONTROL @@ -1,4 +1,4 @@ Source: chakracore -Version: 1.11.9 +Version: 1.11.11 Homepage: https://github.com/Microsoft/ChakraCore Description: Core part of the Chakra Javascript engine diff --git a/ports/chakracore/portfile.cmake b/ports/chakracore/portfile.cmake index 04b253b15c3..5263b3a16f0 100644 --- a/ports/chakracore/portfile.cmake +++ b/ports/chakracore/portfile.cmake @@ -9,8 +9,8 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Microsoft/ChakraCore - REF v1.11.9 - SHA512 4703e28f04925074bfc2057dcccee0427aacdd48f7b9f715d08a9385e4de9e804e1620cd49e8b3db7cd330d00ecd374bfaa3205dbe1f3cfce51ed0eea439a55e + REF v1.11.11 + SHA512 67fd364090632c4187c43dc7bb50d2a6cd18ebb2963f86b7f07c6394c243a94963dd9a1e2dc8f4ab9653ab1316921dbac2c1f5fa235e241e9c605e63f2551a10 HEAD_REF master ) From 2bf8b26aa48e53b243fd8be588d92eca8e2673f4 Mon Sep 17 00:00:00 2001 From: contre Date: Wed, 7 Aug 2019 09:43:13 -0700 Subject: [PATCH 06/30] [qhull] fix UWP building (#7370) --- ports/qhull/CONTROL | 2 +- ports/qhull/portfile.cmake | 1 + ports/qhull/uwp.patch | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 ports/qhull/uwp.patch diff --git a/ports/qhull/CONTROL b/ports/qhull/CONTROL index 9ea30f0115c..67812997bac 100644 --- a/ports/qhull/CONTROL +++ b/ports/qhull/CONTROL @@ -1,4 +1,4 @@ Source: qhull -Version: 7.3.2 +Version: 7.3.2-1 Homepage: https://github.com/qhull/qhull Description: computes the convex hull, Delaunay triangulation, Voronoi diagram diff --git a/ports/qhull/portfile.cmake b/ports/qhull/portfile.cmake index a9c68992310..ade241dc8ad 100644 --- a/ports/qhull/portfile.cmake +++ b/ports/qhull/portfile.cmake @@ -6,6 +6,7 @@ vcpkg_from_github( REF v7.3.2 # Qhull 2019.1 SHA512 aea2c70179de10f648aba960129a3b9a3fe309a0eb085bdb86f697e3d4b214570c241e88d4f0b4d2974137759ee7086452d0a3957c4b2a256708402fb3c9eb3d HEAD_REF master + PATCHES uwp.patch ) if(${TARGET_TRIPLET} STREQUAL "x64-windows-static") # workaround for visual studio toolset regression LNK1201 (remove if solved) diff --git a/ports/qhull/uwp.patch b/ports/qhull/uwp.patch new file mode 100644 index 00000000000..98c74564efd --- /dev/null +++ b/ports/qhull/uwp.patch @@ -0,0 +1,26 @@ +diff --git a/src/libqhull/global.c b/src/libqhull/global.c +index e7de8e6..81be9df 100644 +--- a/src/libqhull/global.c ++++ b/src/libqhull/global.c +@@ -636,7 +636,7 @@ void qh_init_qhull_command(int argc, char *argv[]) { + */ + void qh_initflags(char *command) { + int k, i, lastproject; +- char *s= command, *t, *prev_s, *start, key, *lastwarning= NULL; ++ char *s= command, *t = NULL, *prev_s, *start, key, *lastwarning= NULL; + boolT isgeom= False, wasproject; + realT r; + +diff --git a/src/libqhull_r/global_r.c b/src/libqhull_r/global_r.c +index 3e6919f..8d13e47 100644 +--- a/src/libqhull_r/global_r.c ++++ b/src/libqhull_r/global_r.c +@@ -610,7 +610,7 @@ void qh_init_qhull_command(qhT *qh, int argc, char *argv[]) { + */ + void qh_initflags(qhT *qh, char *command) { + int k, i, lastproject; +- char *s= command, *t, *prev_s, *start, key, *lastwarning= NULL; ++ char *s= command, *t = NULL, *prev_s, *start, key, *lastwarning= NULL; + boolT isgeom= False, wasproject; + realT r; + From 77c3e0aa2eb020e7b9602f8f373be7bb8d1b5aa6 Mon Sep 17 00:00:00 2001 From: crusader-mike Date: Wed, 7 Aug 2019 11:46:34 -0500 Subject: [PATCH 07/30] [xalan-c] switch to https://github.com/apache/xalan-c (#7489) (#7505) * [xalan-c] switch to https://github.com/apache/xalan-c (#7489) * [xalan-c] updated homepage --- ports/xalan-c/0001-ALLOW_RTCc_IN_STL.patch | 65 ------ ports/xalan-c/0002-no-mfc.patch | 21 -- ports/xalan-c/0003-char16_t.patch | 45 ----- ports/xalan-c/0004-macosx-dyld-fallback.patch | 12 -- .../xalan-c/0005-fix-ftbfs-ld-as-needed.patch | 186 ------------------ .../xalan-c/0006-fix-testxslt-segfault.patch | 12 -- ports/xalan-c/0007-fix-readme-typos.patch | 21 -- ports/xalan-c/CONTROL | 4 +- ports/xalan-c/fix-missing-dll-error.patch | 48 +++++ ports/xalan-c/fix-win-deprecated-err.patch | 15 ++ ports/xalan-c/portfile.cmake | 148 +++----------- 11 files changed, 94 insertions(+), 483 deletions(-) delete mode 100644 ports/xalan-c/0001-ALLOW_RTCc_IN_STL.patch delete mode 100644 ports/xalan-c/0002-no-mfc.patch delete mode 100644 ports/xalan-c/0003-char16_t.patch delete mode 100644 ports/xalan-c/0004-macosx-dyld-fallback.patch delete mode 100644 ports/xalan-c/0005-fix-ftbfs-ld-as-needed.patch delete mode 100644 ports/xalan-c/0006-fix-testxslt-segfault.patch delete mode 100644 ports/xalan-c/0007-fix-readme-typos.patch create mode 100644 ports/xalan-c/fix-missing-dll-error.patch create mode 100644 ports/xalan-c/fix-win-deprecated-err.patch diff --git a/ports/xalan-c/0001-ALLOW_RTCc_IN_STL.patch b/ports/xalan-c/0001-ALLOW_RTCc_IN_STL.patch deleted file mode 100644 index a01096b0da8..00000000000 --- a/ports/xalan-c/0001-ALLOW_RTCc_IN_STL.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff --git a/c/Projects/Win32/VC10/AllInOne/AllInOne.vcxproj b/c/Projects/Win32/VC10/AllInOne/AllInOne.vcxproj -index 5a9d6a0..a0d12e8 100644 ---- a/c/Projects/Win32/VC10/AllInOne/AllInOne.vcxproj -+++ b/c/Projects/Win32/VC10/AllInOne/AllInOne.vcxproj -@@ -159,7 +159,7 @@ - - Disabled - $(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\src\;$(OutDir)Nls\Include;%(AdditionalIncludeDirectories) -- XALAN_BUILD_DLL;XALAN_INMEM_MSG_LOADER;%(PreprocessorDefinitions) -+ _ALLOW_RTCc_IN_STL;XALAN_BUILD_DLL;XALAN_INMEM_MSG_LOADER;%(PreprocessorDefinitions) - true - true - EnableFastChecks -@@ -197,7 +197,7 @@ - - Disabled - $(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\src\;$(OutDir)Nls\Include;%(AdditionalIncludeDirectories) -- XALAN_BUILD_DLL;XALAN_INMEM_MSG_LOADER;%(PreprocessorDefinitions) -+ _ALLOW_RTCc_IN_STL;XALAN_BUILD_DLL;XALAN_INMEM_MSG_LOADER;%(PreprocessorDefinitions) - true - true - EnableFastChecks -diff --git a/c/Projects/Win32/VC10/Utils/MsgCreator/MsgCreator.vcxproj b/c/Projects/Win32/VC10/Utils/MsgCreator/MsgCreator.vcxproj -index 27958b5..9f7767b 100644 ---- a/c/Projects/Win32/VC10/Utils/MsgCreator/MsgCreator.vcxproj -+++ b/c/Projects/Win32/VC10/Utils/MsgCreator/MsgCreator.vcxproj -@@ -159,6 +159,7 @@ - - Disabled - $(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\..\src;%(AdditionalIncludeDirectories) -+ _ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) - true - true - EnableFastChecks -@@ -191,7 +192,7 @@ - - Disabled - $(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\..\src;%(AdditionalIncludeDirectories) -- %(PreprocessorDefinitions) -+ _ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) - true - true - EnableFastChecks -diff --git a/c/Projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj b/c/Projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj -index facbbc1..53b83a8 100644 ---- a/c/Projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj -+++ b/c/Projects/Win32/VC10/Utils/XalanMsgLib/XalanMsgLib.vcxproj -@@ -144,7 +144,7 @@ - Disabled - false - $(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\..\src;$(OutDir)Nls\Include;%(AdditionalIncludeDirectories) -- XALAN_XALANMSGLIB_BUILD_DLL;%(PreprocessorDefinitions) -+ _ALLOW_RTCc_IN_STL;XALAN_XALANMSGLIB_BUILD_DLL;%(PreprocessorDefinitions) - true - EnableFastChecks - true -@@ -170,7 +170,7 @@ - Disabled - false - $(XERCESCROOT)\include;$(XERCESCROOT)\src;..\..\..\..\..\src;$(OutDir)Nls\Include;%(AdditionalIncludeDirectories) -- XALAN_XALANMSGLIB_BUILD_DLL;%(PreprocessorDefinitions) -+ _ALLOW_RTCc_IN_STL;XALAN_XALANMSGLIB_BUILD_DLL;%(PreprocessorDefinitions) - true - EnableFastChecks - true diff --git a/ports/xalan-c/0002-no-mfc.patch b/ports/xalan-c/0002-no-mfc.patch deleted file mode 100644 index 3935251f59c..00000000000 --- a/ports/xalan-c/0002-no-mfc.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -urN a/c/Projects/Win32/Res/AllInOne/AllInOne.rc b/c/Projects/Win32/Res/AllInOne/AllInOne.rc ---- a/c/Projects/Win32/Res/AllInOne/AllInOne.rc 2012-03-19 16:18:11.000000000 +0000 -+++ b/c/Projects/Win32/Res/AllInOne/AllInOne.rc 2018-09-07 16:08:59.871434376 +0100 -@@ -7,7 +7,7 @@ - // - // Generated from the TEXTINCLUDE 2 resource. - // --#include "afxres.h" -+#include "windows.h" - - - ///////////////////////////////////////////////////////////////////////////// -@@ -75,7 +75,7 @@ - - 2 TEXTINCLUDE - BEGIN -- "#include ""afxres.h""\r\n" -+ "#include ""windows.h""\r\n" - "\r\n" - "\0" - END diff --git a/ports/xalan-c/0003-char16_t.patch b/ports/xalan-c/0003-char16_t.patch deleted file mode 100644 index e8ed83bb0f6..00000000000 --- a/ports/xalan-c/0003-char16_t.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -urN a/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp b/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp ---- a/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp 2012-03-19 16:18:10.000000000 +0000 -+++ b/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp 2018-09-07 16:08:39.207316486 +0100 -@@ -84,7 +84,7 @@ - const XalanDOMChar* - getName() const - { -- return name; -+ return const_cast(reinterpret_cast(&name[0])); - } - - /** -@@ -261,7 +261,7 @@ - #pragma warning(disable: 4244) - theHandleType theSearchHandle = - _wfindfirst( -- const_cast(theConversionFunction(theFullSearchSpec)), -+ reinterpret_cast(const_cast(theConversionFunction(theFullSearchSpec))), - &theFindData); - #pragma warning(pop) - -diff -urN a/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp b/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp ---- a/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp 2012-03-19 16:18:10.000000000 +0000 -+++ b/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp 2018-09-07 16:08:39.207316486 +0100 -@@ -868,7 +868,7 @@ - const XalanDOMChar* theRHS) - { - #if defined(XALAN_USE_WINDOWS_COLLATION) -- return _wcscoll_l(theLHS, theRHS, s_locale); -+ return _wcscoll_l(reinterpret_cast(theLHS), reinterpret_cast(theRHS), s_locale); - #else - return doCollationCompare( - theLHS, -diff -urN a/c/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp b/c/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp ---- a/c/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp 2012-03-19 16:18:10.000000000 +0000 -+++ b/c/src/xalanc/PlatformSupport/XalanFileOutputStream.cpp 2018-09-07 16:08:39.207316486 +0100 -@@ -123,7 +123,7 @@ - - #if defined(XALAN_WINDOWS) - HandleType theFileHandle = CreateFileW( -- theFileName.c_str(), -+ reinterpret_cast(theFileName.c_str()), - GENERIC_WRITE, - 0, - 0, diff --git a/ports/xalan-c/0004-macosx-dyld-fallback.patch b/ports/xalan-c/0004-macosx-dyld-fallback.patch deleted file mode 100644 index db087169850..00000000000 --- a/ports/xalan-c/0004-macosx-dyld-fallback.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN a/c/Makefile.incl.in b/c/Makefile.incl.in ---- a/c/Makefile.incl.in 2012-10-14 21:54:01.000000000 +0100 -+++ b/c/Makefile.incl.in 2018-09-07 16:08:15.559182228 +0100 -@@ -598,7 +598,7 @@ - MAKE_SHARED = ${CXX} $(CXXFLAGS) -D${PLATFORM} -dynamiclib -prebind -seg1addr 0x38000000 -compatibility_version 1 -current_version $(LIB_MAJOR_DOT_VER) -install_name ${LINK_NAME} ${LDFLAGS} - LINK = ${CXX} $(CXXFLAGS) ${PLATFORM_COMPILE_OPTIONS} ${LDFLAGS} - -- export DYLD_LIBRARY_PATH := $(XERCESCROOT)/lib:$(ICULIB_LOC):$(DYLD_LIBRARY_PATH) -+ export DYLD_FALLBACK_LIBRARY_PATH := $(XERCESCROOT)/lib:$(ICULIB_LOC):$(DYLD_FALLBACK_LIBRARY_PATH) - LOC_LIB = ${LOC_LIBNAME}.${LIB_MAJOR_VER}.${LIB_MINOR_VER}$(SHLIBSUFFIX) - LOC_SONAME = ${LOC_LIBNAME}.${LIB_MAJOR_VER}${SHLIBSUFFIX} - MAKE_SHARED_LOC= ${CXX} $(CXXFLAGS) -D${PLATFORM} -dynamiclib -prebind -seg1addr 0x40000000 -compatibility_version 1 -current_version $(LIB_MAJOR_DOT_VER) -install_name ${LOC_LIBNAME}${SHLIBSUFFIX} ${LDFLAGS} diff --git a/ports/xalan-c/0005-fix-ftbfs-ld-as-needed.patch b/ports/xalan-c/0005-fix-ftbfs-ld-as-needed.patch deleted file mode 100644 index 43487721406..00000000000 --- a/ports/xalan-c/0005-fix-ftbfs-ld-as-needed.patch +++ /dev/null @@ -1,186 +0,0 @@ -diff -urN a/c/samples/Makefile.in b/c/samples/Makefile.in ---- a/c/samples/Makefile.in 2012-03-19 16:18:12.000000000 +0000 -+++ b/c/samples/Makefile.in 2018-09-07 16:07:59.063089005 +0100 -@@ -88,7 +88,7 @@ - - $(XSL_LIB_DIR)/mod_xslt$(SHLIBSUFFIX) : $(XSL_OBJ_DIR)/mod_xslt.o - $(MAKE_SHARED) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/ApacheModuleXSLT/%.c - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) -I/usr/include/apache/ $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -96,7 +96,7 @@ - - $(XSL_BIN_DIR)/CompileStylesheet: $(XSL_OBJ_DIR)/CompileStylesheet.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/CompileStylesheet/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -104,7 +104,7 @@ - - $(XSL_BIN_DIR)/DocumentBuilder: $(XSL_OBJ_DIR)/DocumentBuilder.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/DocumentBuilder/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -112,7 +112,7 @@ - - $(XSL_BIN_DIR)/EntityResolver: $(XSL_OBJ_DIR)/EntityResolver.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/EntityResolver/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -120,7 +120,7 @@ - - $(XSL_BIN_DIR)/ExternalFunction: $(XSL_OBJ_DIR)/ExternalFunction.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/ExternalFunction/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -128,7 +128,7 @@ - - $(XSL_BIN_DIR)/ParsedSourceWrappers: $(XSL_OBJ_DIR)/ParsedSourceWrappers.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/ParsedSourceWrappers/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -136,7 +136,7 @@ - - $(XSL_BIN_DIR)/SerializeNodeSet: $(XSL_OBJ_DIR)/SerializeNodeSet.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/SerializeNodeSet/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -144,7 +144,7 @@ - - $(XSL_BIN_DIR)/SimpleTransform: $(XSL_OBJ_DIR)/SimpleTransform.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/SimpleTransform/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -152,7 +152,7 @@ - - $(XSL_BIN_DIR)/SimpleXPathAPI: $(XSL_OBJ_DIR)/SimpleXPathAPI.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/SimpleXPathAPI/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -160,7 +160,7 @@ - - $(XSL_BIN_DIR)/SimpleXPathCAPI: $(XSL_OBJ_DIR)/SimpleXPathCAPI.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/SimpleXPathCAPI/%.c - $(CC4) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -168,7 +168,7 @@ - - $(XSL_BIN_DIR)/StreamTransform: $(XSL_OBJ_DIR)/StreamTransform.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/StreamTransform/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -176,7 +176,7 @@ - - $(XSL_BIN_DIR)/TraceListen: $(XSL_OBJ_DIR)/TraceListen.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/TraceListen/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -184,7 +184,7 @@ - - $(XSL_BIN_DIR)/TransformToXercesDOM: $(XSL_OBJ_DIR)/TransformToXercesDOM.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/TransformToXercesDOM/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -192,7 +192,7 @@ - - $(XSL_BIN_DIR)/UseStylesheetParam: $(XSL_OBJ_DIR)/UseStylesheetParam.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/UseStylesheetParam/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -200,7 +200,7 @@ - - $(XSL_BIN_DIR)/XalanTransform: $(XSL_OBJ_DIR)/XalanTransform.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/XalanTransform/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -208,7 +208,7 @@ - - $(XSL_BIN_DIR)/XalanTransformerCallback: $(XSL_OBJ_DIR)/XalanTransformerCallback.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/XalanTransformerCallback/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -216,7 +216,7 @@ - - $(XSL_BIN_DIR)/ThreadSafe: $(XSL_OBJ_DIR)/ThreadSafe.o - $(LINK) $(XSL_BUILD_OPTIONS) $(PLATFORM_LIB_LINK_OPTIONS) \ -- $(EXTRA_LINK_OPTIONS) $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ $(EXTRA_LINK_OPTIONS) $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - $(XSL_OBJ_DIR)/%.o:$(SAMPLES_DIR)/ThreadSafe/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -diff -urN a/c/Tests/Makefile.in b/c/Tests/Makefile.in ---- a/c/Tests/Makefile.in 2012-03-19 16:18:12.000000000 +0000 -+++ b/c/Tests/Makefile.in 2018-09-07 16:07:59.063089005 +0100 -@@ -62,7 +62,7 @@ - - $(XSL_BIN_DIR)/ThreadTest: ${XSL_OBJ_DIR}/ThreadTest.o - ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \ -- ${EXTRA_LINK_OPTIONS} $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ ${EXTRA_LINK_OPTIONS} $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - ${XSL_OBJ_DIR}/%.o:$(TESTS_DIR)/Threads/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -70,7 +70,7 @@ - - $(XSL_BIN_DIR)/Conf: ${XSL_OBJ_DIR}/conf.o - ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \ -- ${EXTRA_LINK_OPTIONS} $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ ${EXTRA_LINK_OPTIONS} $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - ${XSL_OBJ_DIR}/%.o:$(TESTS_DIR)/Conf/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< - -@@ -92,7 +92,7 @@ - - $(XSL_BIN_DIR)/Perf: $(PERF_OBJECTS) - ${LINK} $(XSL_BUILD_OPTIONS) ${PLATFORM_LIB_LINK_OPTIONS} \ -- ${EXTRA_LINK_OPTIONS} $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) $^ -o $@ $(OTHER_LINK_PARAMETERS) -+ ${EXTRA_LINK_OPTIONS} $^ $(XALAN_LIB) $(ALLLIBS) $(CXXFLAGS) -o $@ $(OTHER_LINK_PARAMETERS) - - ${XSL_OBJ_DIR}/%.o:$(TESTS_DIR)/Performance/%.cpp - $(CC1) $(XSL_BUILD_OPTIONS) -c $(XSL_INCL) $(EXTRA_COMPILE_OPTIONS) -o $@ $< diff --git a/ports/xalan-c/0006-fix-testxslt-segfault.patch b/ports/xalan-c/0006-fix-testxslt-segfault.patch deleted file mode 100644 index b8f9b09aba1..00000000000 --- a/ports/xalan-c/0006-fix-testxslt-segfault.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN a/c/src/xalanc/PlatformSupport/XalanLocator.hpp b/c/src/xalanc/PlatformSupport/XalanLocator.hpp ---- a/c/src/xalanc/PlatformSupport/XalanLocator.hpp 2012-09-27 07:59:33.000000000 +0100 -+++ b/c/src/xalanc/PlatformSupport/XalanLocator.hpp 2018-09-07 16:07:11.070819930 +0100 -@@ -91,7 +91,7 @@ - const XalanDOMChar* theAlternateId = getEmptyPtr()) - { - return theLocator == 0 ? theAlternateId : (theLocator->getSystemId() ? -- theLocator->getPublicId() : theAlternateId); -+ theLocator->getSystemId() : theAlternateId); - } - - /** diff --git a/ports/xalan-c/0007-fix-readme-typos.patch b/ports/xalan-c/0007-fix-readme-typos.patch deleted file mode 100644 index e97d1674975..00000000000 --- a/ports/xalan-c/0007-fix-readme-typos.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -urN a/c/README b/c/README ---- a/c/README 2012-10-13 05:52:45.000000000 +0100 -+++ b/c/README 2018-09-07 16:06:24.602562653 +0100 -@@ -3,7 +3,7 @@ - - Project Description: - The Apache Xalan C/C++ Project provides a library and a -- comand line program to transform XML documents using a -+ command line program to transform XML documents using a - stylesheet that conforms to XSLT 1.0 standards. - - The source package contains all the code to create the library, -@@ -84,7 +84,7 @@ - XalanMessages_1_11.exp - Windows DLL export definitions - XalanMessages_1_11.lib - Windows DLL library definitions - XalanMessages_1_11D.exp - Windows DLL export definitions -- XalanMessages_1_11D.lib - Windows DLL library defnitions -+ XalanMessages_1_11D.lib - Windows DLL library definitions - - SUPPORTED PLATFORMS: - - This is only a partial list diff --git a/ports/xalan-c/CONTROL b/ports/xalan-c/CONTROL index 3748326b76e..6a6ead6ad63 100644 --- a/ports/xalan-c/CONTROL +++ b/ports/xalan-c/CONTROL @@ -1,5 +1,5 @@ Source: xalan-c -Version: 1.11-6 -Homepage: https://www-us.apache.org/dist/xalan/xalan-c/ +Version: 1.11-7 +Homepage: https://github.com/apache/xalan-c Description: Xalan is an XSLT processor for transforming XML documents into HTML, text, or other XML document types Build-Depends: xerces-c diff --git a/ports/xalan-c/fix-missing-dll-error.patch b/ports/xalan-c/fix-missing-dll-error.patch new file mode 100644 index 00000000000..db49a2be67d --- /dev/null +++ b/ports/xalan-c/fix-missing-dll-error.patch @@ -0,0 +1,48 @@ +diff --git a/src/xalanc/Utils/CMakeLists.txt b/src/xalanc/Utils/CMakeLists.txt +index dc39ad0..2d78685 100644 +--- a/src/xalanc/Utils/CMakeLists.txt ++++ b/src/xalanc/Utils/CMakeLists.txt +@@ -40,6 +40,13 @@ set(SUPPORTMSGINDEX "${GEN_SUPPORTDIR}/LocalMsgIndex.hpp") + add_custom_target(locale ALL) + set_target_properties(locale PROPERTIES FOLDER "Message Library") + ++# workaround for case of missing xerces-c dll ++if(EXISTS ${XercesC_INCLUDE_DIR}/../bin) ++ set(MsgCreator_WD $/../bin) ++else() ++ set(MsgCreator_WD "${XSL_NLS_GEN_DIR}") ++endif() ++ + if(msgloader STREQUAL "inmemory") + add_custom_command( + OUTPUT "${GENMSGINDEX}" +@@ -48,7 +55,8 @@ if(msgloader STREQUAL "inmemory") + "${XLIFF_FILE_NAME}" + -TYPE inmem + -LOCALE ${LOCALE} +- WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}" ++ -OUTDIR "${XSL_NLS_GEN_DIR}" ++ WORKING_DIRECTORY "${MsgCreator_WD}" + COMMENT "Generating inmemory locale message data" + DEPENDS MsgCreator "${XLIFF_FILE_NAME}") + +@@ -92,7 +100,8 @@ if(msgloader STREQUAL "icu") + "${XLIFF_FILE_NAME}" + -TYPE icu + -LOCALE ${LOCALE} +- WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}" ++ -OUTDIR "${XSL_NLS_GEN_DIR}" ++ WORKING_DIRECTORY "${MsgCreator_WD}" + COMMENT "Generating ICU locale message data" + DEPENDS MsgCreator "${XLIFF_FILE_NAME}") + +@@ -141,7 +150,8 @@ if(msgloader STREQUAL "nls") + "${XLIFF_FILE_NAME}" + -TYPE nls + -LOCALE ${LOCALE} +- WORKING_DIRECTORY "${XSL_NLS_GEN_DIR}" ++ -OUTDIR "${XSL_NLS_GEN_DIR}" ++ WORKING_DIRECTORY "${MsgCreator_WD}" + COMMENT "Generating nls locale message data" + DEPENDS MsgCreator "${XLIFF_FILE_NAME}") + diff --git a/ports/xalan-c/fix-win-deprecated-err.patch b/ports/xalan-c/fix-win-deprecated-err.patch new file mode 100644 index 00000000000..1484f4e2764 --- /dev/null +++ b/ports/xalan-c/fix-win-deprecated-err.patch @@ -0,0 +1,15 @@ +diff --git a/src/xalanc/Utils/MsgCreator/CMakeLists.txt b/src/xalanc/Utils/MsgCreator/CMakeLists.txt +index 20215d4..dc74c1b 100644 +--- a/src/xalanc/Utils/MsgCreator/CMakeLists.txt ++++ b/src/xalanc/Utils/MsgCreator/CMakeLists.txt +@@ -37,6 +37,10 @@ set(msgcreator_headers + NLSHandler.hpp + SAX2Handler.hpp) + ++if(MSVC) ++ add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) ++endif() ++ + add_executable(MsgCreator ${msgcreator_sources} ${msgcreator_headers}) + target_include_directories(MsgCreator PUBLIC + $ diff --git a/ports/xalan-c/portfile.cmake b/ports/xalan-c/portfile.cmake index 114a9a2b811..0460c746430 100644 --- a/ports/xalan-c/portfile.cmake +++ b/ports/xalan-c/portfile.cmake @@ -1,132 +1,42 @@ include(vcpkg_common_functions) -string(LENGTH "${CURRENT_BUILDTREES_DIR}" BUILDTREES_PATH_LENGTH) -if(BUILDTREES_PATH_LENGTH GREATER 37 AND CMAKE_HOST_WIN32) - message(WARNING "${PORT}'s buildsystem uses very long paths and may fail on your system.\n" - "We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command." - ) -endif() - -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) - -set(XALANC_VERSION 1.11) - -vcpkg_download_distfile(ARCHIVE - URLS "http://www-us.apache.org/dist/xalan/xalan-c/sources/xalan_c-${XALANC_VERSION}-src.zip" - FILENAME "xalan_c-${XALANC_VERSION}-src.zip" - SHA512 2e79a2c8f755c9660ffc94b26b6bd4b140685e05a88d8e5abb19a2f271383a3f2f398b173ef403f65dc33af75206214bd21ac012c39b4c0051b3a9f61f642fe6 -) - -vcpkg_download_distfile(XALAN_PATCH8 - URLS "https://github.com/rleigh-codelibre/vcpkg-patches/raw/ca09d69280469ce8f787c67b48f86e46a463ef5d/xalan-c/0008-remove-unary-binary-function.patch" - FILENAME "0008-remove-unary-binary-function.patch" - SHA512 059d9a39b29125ae770369e4c44ab7804ae16d4ff5c90e35f25b7990dc987161bf1187ceb2dcbab181ffb72490a9d9f45e30ab5928644734e7627cb74b03e201 -) - -vcpkg_download_distfile(XALAN_PATCH9 - URLS "https://raw.githubusercontent.com/rleigh-codelibre/vcpkg-patches/ca09d69280469ce8f787c67b48f86e46a463ef5d/xalan-c/0009-remove-select-workaround.patch" - FILENAME "0009-remove-select-workaround.patch" - SHA512 73730736cd1f1809ebcc35562017402d606cbfd5a64665d104a21d89d679ab3274f6f5685ab63305c57fffab74e62084c0e18c76d19eb5f9c2e36be6679fd4d3 -) - -vcpkg_extract_source_archive_ex( +vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} - REF ${XALANC_VERSION} + REPO apache/xalan-c + REF 177da75646a80fae2c22a315c0d987a5eadba143 + SHA512 e0f095b7031394c39c8e0fdca1f820c4222466f8c6e9df7bc40a21f9ca0e9291b7b6cdfb0a2d67db275ae97d7a7cdd447637102639e74716f0fb23a946b30ebe PATCHES - 0001-ALLOW_RTCc_IN_STL.patch - 0002-no-mfc.patch - 0003-char16_t.patch - 0004-macosx-dyld-fallback.patch - 0005-fix-ftbfs-ld-as-needed.patch - 0006-fix-testxslt-segfault.patch - 0007-fix-readme-typos.patch - ${XALAN_PATCH8} - ${XALAN_PATCH9} + fix-win-deprecated-err.patch + fix-missing-dll-error.patch ) -if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86") - set(BITS 32) -elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64") - set(BITS 64) +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +if(EXISTS ${CURRENT_PACKAGES_DIR}/cmake) + vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/xalan-c) else() - message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}") + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/XalanC TARGET_PATH share/xalan-c) endif() -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - list(APPEND BUILD_TYPES "release") - endif() - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - list(APPEND BUILD_TYPES "debug") - endif() +# cleanup +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/debug/include + ${CURRENT_PACKAGES_DIR}/debug/share +) - set(XALANCROOT ${SOURCE_PATH}/c) - set(ENV{XALANCROOT} ${XALANCROOT}) - foreach(BUILD_TYPE IN LISTS BUILD_TYPES) - if(BUILD_TYPE STREQUAL "release") - set(P ${CURRENT_PACKAGES_DIR}) - set(SHORT rel) - set(OPTS) - set(ENV{XERCESCROOT} ${CURRENT_INSTALLED_DIR}) - else() - set(P ${CURRENT_PACKAGES_DIR}/debug) - set(SHORT dbg) - set(OPTS -d -z -I${CURRENT_INSTALLED_DIR}/include) - set(ENV{XERCESCROOT} ${CURRENT_INSTALLED_DIR}/debug) - endif() - set(DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT}) - file(REMOVE_RECURSE ${DIR}) - file(MAKE_DIRECTORY ${DIR}) - message(STATUS "Configuring ${TARGET_TRIPLET}-${SHORT}") - vcpkg_execute_required_process( - COMMAND ${XALANCROOT}/runConfigure -p linux -c gcc -x g++ -b ${BITS} -P ${P} ${OPTS} - WORKING_DIRECTORY ${DIR} - LOGNAME configure-${TARGET_TRIPLET}-${SHORT} - ) - message(STATUS "Building ${TARGET_TRIPLET}-${SHORT}") - vcpkg_execute_required_process( - COMMAND make -i -j${VCPKG_CONCURRENCY} - WORKING_DIRECTORY ${DIR} - LOGNAME make-${TARGET_TRIPLET}-${SHORT} - ) - message(STATUS "Installing ${TARGET_TRIPLET}-${SHORT}") - vcpkg_execute_required_process( - COMMAND make install - WORKING_DIRECTORY ${DIR} - LOGNAME install-${TARGET_TRIPLET}-${SHORT} - ) - endforeach() - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/debug/include) - file(COPY ${SOURCE_PATH}/c/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) - file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) else() - set(ENV{CL} "$ENV{CL} \"/I${CURRENT_INSTALLED_DIR}/include\"") - set(ENV{PATH} "$ENV{PATH};${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/debug/bin") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/Xalan.exe ${CURRENT_PACKAGES_DIR}/debug/bin/Xalan.exe) +endif() - vcpkg_install_msbuild( - SOURCE_PATH ${SOURCE_PATH} - PROJECT_SUBPATH c/projects/Win32/VC10/AllInOne/AllInOne.vcxproj - OPTIONS_RELEASE /p:XERCESCROOT=${CURRENT_INSTALLED_DIR} - OPTIONS_DEBUG /p:XERCESCROOT=${CURRENT_INSTALLED_DIR}/debug - LICENSE_SUBPATH c/LICENSE - SKIP_CLEAN - ) +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/xalan-c) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/xalan-c/LICENSE ${CURRENT_PACKAGES_DIR}/share/xalan-c/copyright) - file(COPY ${SOURCE_PATH}/c/src/xalanc DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.hpp) - - # LocalMsgIndex.hpp and LocalMsgData.hpp are here - file(GLOB NLS_INCLUDES "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/c/Build/*/VC10/Release/Nls/Include/*.hpp") - if(NOT NLS_INCLUDES) - message(FATAL_ERROR "Could not locate LocalMsgIndex.hpp") - endif() - file(COPY ${NLS_INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/xalanc/PlatformSupport) - - vcpkg_clean_msbuild() - - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/NLS) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/util/MsgLoaders/ICU/resources) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/TestXSLT) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/XalanExe) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xalanc/XPathCAPI) -endif() +vcpkg_copy_pdbs() From 7352fab1e426336310de24d0c02c4cc6c0b702fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 7 Aug 2019 16:34:07 -0400 Subject: [PATCH 08/30] [itk] Update library from 5.0.0 to 5.0.1 (#7586) --- ports/itk/CONTROL | 2 +- ports/itk/portfile.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/itk/CONTROL b/ports/itk/CONTROL index 328137e0ea5..d9e0bde62e0 100644 --- a/ports/itk/CONTROL +++ b/ports/itk/CONTROL @@ -1,5 +1,5 @@ Source: itk -Version: 5.0.0-3 +Version: 5.0.1 Description: Insight Segmentation and Registration Toolkit (ITK) is used for image processing and analysis. Homepage: https://github.com/InsightSoftwareConsortium/ITK Build-Depends: double-conversion, libjpeg-turbo, zlib, libpng, tiff, expat, eigen3, hdf5[cpp], openjpeg diff --git a/ports/itk/portfile.cmake b/ports/itk/portfile.cmake index 3b2094079c9..e0ebaaecfa2 100644 --- a/ports/itk/portfile.cmake +++ b/ports/itk/portfile.cmake @@ -10,8 +10,8 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO InsightSoftwareConsortium/ITK - REF v5.0.0 - SHA512 7eecd62ab3124147f0abce482699dfdc43610703959d4a3f667c8ce12a6ecacf836a863d146f3cc7d5220b4aa05adf70a0d4dc6fa8e87bac215565badc96acff + REF v5.0.1 + SHA512 242ce66cf83f82d26f20d2099108295e28c8875e7679126ba023834bf0e94454460ba86452a94c8ddaea93d2314befc399f2b151d7294370d4b47f0e9798e77f HEAD_REF master PATCHES fix_openjpeg_search.patch From 8157d8503c2c346d0e09d3405609aeefefb64012 Mon Sep 17 00:00:00 2001 From: cDc Date: Wed, 7 Aug 2019 23:36:27 +0300 Subject: [PATCH 09/30] [TinyNPY] Add new port (#7393) * [TinyNPY] new port * expose type and order * fix linux/mac --- ports/tinynpy/CONTROL | 4 ++++ ports/tinynpy/portfile.cmake | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 ports/tinynpy/CONTROL create mode 100644 ports/tinynpy/portfile.cmake diff --git a/ports/tinynpy/CONTROL b/ports/tinynpy/CONTROL new file mode 100644 index 00000000000..ccef53ad8e7 --- /dev/null +++ b/ports/tinynpy/CONTROL @@ -0,0 +1,4 @@ +Source: tinynpy +Version: 1.0.0-2 +Build-Depends: zlib +Description: tiny C++ loader/exporter of python numpy array NPY/NPZ files diff --git a/ports/tinynpy/portfile.cmake b/ports/tinynpy/portfile.cmake new file mode 100644 index 00000000000..7daf6f7a3e1 --- /dev/null +++ b/ports/tinynpy/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO cdcseacave/TinyNPY + REF 721a498ebff5ba537a136c9df330158f5c85c00c + SHA512 c22382306ed7c33b147a93093cfb1217504e6dee8172b1684c0519e3b95bb3ac7ed48de7c6b6759db5187ce85301880702e28e08f149f369dbc630e5b646a06a + HEAD_REF master +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS} + -DBUILD_DEMO=OFF +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/TinyNPY") + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/tinynpy RENAME copyright) From c89dcc15a9b93b022990c972b7e0beb8d20b6629 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Wed, 7 Aug 2019 22:40:33 +0200 Subject: [PATCH 10/30] [netcdf-c] correctly fix hdf5 linkage (#7578) --- ports/netcdf-c/CONTROL | 2 +- ports/netcdf-c/hdf5_3.patch | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ports/netcdf-c/CONTROL b/ports/netcdf-c/CONTROL index 684c54ba62c..f69dc61ad4f 100644 --- a/ports/netcdf-c/CONTROL +++ b/ports/netcdf-c/CONTROL @@ -1,5 +1,5 @@ Source: netcdf-c -Version: 4.7.0-3 +Version: 4.7.0-4 Build-Depends: hdf5, curl Homepage: https://github.com/Unidata/netcdf-c Description: a set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. diff --git a/ports/netcdf-c/hdf5_3.patch b/ports/netcdf-c/hdf5_3.patch index ba9a168c8a2..502a8ea9941 100644 --- a/ports/netcdf-c/hdf5_3.patch +++ b/ports/netcdf-c/hdf5_3.patch @@ -2,11 +2,13 @@ diff --git a/libhdf5/CMakeLists.txt b/libhdf5/CMakeLists.txt index f3c7bbc..34fc2ab 100644 --- a/libhdf5/CMakeLists.txt +++ b/libhdf5/CMakeLists.txt -@@ -20,3 +20,7 @@ add_library(netcdfhdf5 OBJECT ${libnchdf5_SOURCES}) +@@ -20,3 +20,9 @@ add_library(netcdfhdf5 OBJECT ${libnchdf5_SOURCES}) # Remember to package this file for CMake builds. ADD_EXTRA_DIST(${libnchdf5_SOURCES} CMakeLists.txt) + -+if(BUILD_SHARED_LIBS) -+target_link_libraries(netcdfhdf5 PRIVATE hdf5::hdf5-shared hdf5::hdf5-static hdf5::hdf5_hl-shared hdf5::hdf5_hl-static) ++if(HDF5_BUILD_SHARED_LIBS) ++ target_link_libraries(netcdfhdf5 PRIVATE hdf5::hdf5-shared hdf5::hdf5_hl-shared) ++else() ++ target_link_libraries(netcdfhdf5 PRIVATE hdf5::hdf5-static hdf5::hdf5_hl-static) +endif() From 65cb5cd00cba333e3a41433058e42a114f61fb78 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Wed, 7 Aug 2019 19:43:35 -0400 Subject: [PATCH 11/30] Update google-cloud-cpp to 0.12.0. (#7557) * Add googleapis proto libraries port. Compile protos from github.com/googleapis/googleapis into C++ libraries. * Updated google-cloud-cpp to 0.12.0 * [google-cloud-cpp] Fix flaky build --- ports/google-cloud-cpp/CONTROL | 5 +++-- ports/google-cloud-cpp/portfile.cmake | 7 +++--- ports/googleapis/CONTROL | 5 +++++ ports/googleapis/portfile.cmake | 32 +++++++++++++++++++++++++++ ports/googleapis/usage | 6 +++++ 5 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 ports/googleapis/CONTROL create mode 100644 ports/googleapis/portfile.cmake create mode 100644 ports/googleapis/usage diff --git a/ports/google-cloud-cpp/CONTROL b/ports/google-cloud-cpp/CONTROL index 0adc8a16ba0..a844f9749bd 100644 --- a/ports/google-cloud-cpp/CONTROL +++ b/ports/google-cloud-cpp/CONTROL @@ -1,4 +1,5 @@ Source: google-cloud-cpp -Version: 0.11.0 -Build-Depends: grpc, curl[ssl], crc32c +Version: 0.12.0 +Build-Depends: grpc, curl[ssl], crc32c, googleapis Description: C++ Client Libraries for Google Cloud Platform APIs. +Homepage: https://github.com/googleapis/google-cloud-cpp diff --git a/ports/google-cloud-cpp/portfile.cmake b/ports/google-cloud-cpp/portfile.cmake index 0ae85412a80..e9ffdd0146e 100644 --- a/ports/google-cloud-cpp/portfile.cmake +++ b/ports/google-cloud-cpp/portfile.cmake @@ -5,18 +5,19 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO googleapis/google-cloud-cpp - REF v0.11.0 - SHA512 059322c73a9632644faec7dc33fc9e390cd5aeb1576a2e6ddeeb6e4078040c47f71fe687702f04173ee86638886872046ea22e60fae3f6a8bf16f6bfb9478962 + REF v0.12.0 + SHA512 14d83e099b9d425475b963b6b4fe11c1881988afc90d87a63b2a0d17cd18f3000f725fa230b6b7487e14e383e7f3c5803122dbadd9dacdeeadc541b55074a805 HEAD_REF master ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA + DISABLE_PARALLEL_CONFIGURE OPTIONS -DGOOGLE_CLOUD_CPP_DEPENDENCY_PROVIDER=package -DGOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK=OFF - -DBUILD_TESTING=OFF + -DBUILD_TESTING=OFF ) vcpkg_install_cmake(ADD_BIN_TO_PATH) diff --git a/ports/googleapis/CONTROL b/ports/googleapis/CONTROL new file mode 100644 index 00000000000..b77e35eed98 --- /dev/null +++ b/ports/googleapis/CONTROL @@ -0,0 +1,5 @@ +Source: googleapis +Version: 0.1.1 +Build-Depends: grpc, protobuf +Description: C++ Proto Libraries for Google APIs. +Homepage: https://github.com/googleapis/cpp-cmakefiles diff --git a/ports/googleapis/portfile.cmake b/ports/googleapis/portfile.cmake new file mode 100644 index 00000000000..684b4cbdbe9 --- /dev/null +++ b/ports/googleapis/portfile.cmake @@ -0,0 +1,32 @@ +include(vcpkg_common_functions) + +if (VCPKG_TARGET_IS_UWP) + message(FATAL_ERROR "Package `googleapis` doesn't support UWP") +endif() + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO googleapis/cpp-cmakefiles + REF v0.1.1 + SHA512 e23af2d0d36d4e13da761473b78b958326b9c7fd4aaf0c4b6742ae498b65aafe73976f7c858365b041aa667f280c10eca6df7e87644c260fc022ec4eee7a7bc6 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake(ADD_BIN_TO_PATH) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/googleapis RENAME copyright) + +vcpkg_copy_pdbs() + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) diff --git a/ports/googleapis/usage b/ports/googleapis/usage new file mode 100644 index 00000000000..00ca628e56f --- /dev/null +++ b/ports/googleapis/usage @@ -0,0 +1,6 @@ +The package googleapis is compatible with built-in CMake targets: + + find_package(googleapis CONFIG REQUIRED) + + # Then link against the proto libraries that you want to use, for example: + target_link_libraries(main PRIVATE googleapis-c++::bigtable_protos gRPC::grpc gRPC::grpc++) From e79f0dc5328f28b2b3942e2cd0e9b0c1accca4a1 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Fri, 2 Aug 2019 16:49:45 -0700 Subject: [PATCH 12/30] [vcpkg] Make Filesystem::remove_all faster #7570 I added benchmarks to measure how fast the parallel remove_all code was -- it turns out, about 3x slower than stdfs::remove_all. Since this was the case, I removed all of the parallelism and rewrote it serially, and ended up about 30% faster than stdfs::remove_all (in addition to supporting symlinks). In addition, I did the following three orthogonal changes: - simplified the work queue, basing it on Billy O'Neal's idea - Fix warnings on older versions of compilers in tests, by splitting the pragmas out of pch.h. - Ran clang-format on some files In fixing up remove_all, the following changes were made: - On Windows, regular symlinks and directory symlinks are distinct; as an example, to remove directory symlinks (and junctions, for that matter), one must use RemoveDirectory. Only on Windows, I added new `file_type` and `file_status` types, with `file_type` including a new `directory_symlink` enumerator, and `file_status` being exactly the same as the old one except using the new `file_type`. On Unix, I didn't make that change since they don't make a distinction. - I added new `symlink_status` and `status` functions which use the new `file_status` on Windows. - I made `Filesystem::exists` call `fs::exists(status(p))`, as opposed to the old version which called `stdfs::exists` directly. - Added benchmarks to `vcpkg-test/files.cpp`. They test the performance of `remove_all` on small directories (~20 files), with symlinks and without, and on large directories (~2000 files), with symlinks and without. --- .gitignore | 2 +- toolsrc/CMakeLists.txt | 5 + toolsrc/include/pch.h | 12 +- toolsrc/include/vcpkg-test/util.h | 94 ++++--- toolsrc/include/vcpkg/base/files.h | 106 +++++++- toolsrc/include/vcpkg/base/strings.h | 4 +- toolsrc/include/vcpkg/base/util.h | 6 +- toolsrc/include/vcpkg/base/work_queue.h | 222 +++++----------- toolsrc/include/vcpkg/binaryparagraph.h | 2 +- toolsrc/include/vcpkg/build.h | 4 +- toolsrc/include/vcpkg/dependencies.h | 11 +- toolsrc/include/vcpkg/logicexpression.h | 6 +- toolsrc/include/vcpkg/pragmas.h | 11 + toolsrc/include/vcpkg/sourceparagraph.h | 6 +- toolsrc/include/vcpkg/vcpkgpaths.h | 2 +- toolsrc/src/vcpkg-test/files.cpp | 196 +++++++++++--- toolsrc/src/vcpkg-test/util.cpp | 26 +- toolsrc/src/vcpkg.cpp | 14 +- toolsrc/src/vcpkg/base/files.cpp | 307 ++++++++++++---------- toolsrc/src/vcpkg/build.cpp | 127 ++++----- toolsrc/src/vcpkg/commands.ci.cpp | 18 +- toolsrc/src/vcpkg/commands.dependinfo.cpp | 17 +- toolsrc/src/vcpkg/commands.search.cpp | 8 +- toolsrc/src/vcpkg/dependencies.cpp | 80 +++--- toolsrc/src/vcpkg/install.cpp | 6 +- toolsrc/src/vcpkg/logicexpression.cpp | 91 +++---- toolsrc/src/vcpkg/paragraphs.cpp | 9 +- toolsrc/src/vcpkg/parse.cpp | 3 +- toolsrc/src/vcpkg/remove.cpp | 4 +- toolsrc/src/vcpkg/sourceparagraph.cpp | 25 +- toolsrc/src/vcpkg/userconfig.cpp | 2 +- toolsrc/src/vcpkg/vcpkgcmdarguments.cpp | 33 +-- toolsrc/src/vcpkg/vcpkgpaths.cpp | 39 ++- 33 files changed, 812 insertions(+), 686 deletions(-) create mode 100644 toolsrc/include/vcpkg/pragmas.h diff --git a/.gitignore b/.gitignore index f38bc90a9b8..dbc8019016f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ *.userosscache *.sln.docstates -toolsrc/out +toolsrc/out* toolsrc/CMakeSettings.json # User-specific files (MonoDevelop/Xamarin Studio) diff --git a/toolsrc/CMakeLists.txt b/toolsrc/CMakeLists.txt index 3874412db94..7a41874a68f 100644 --- a/toolsrc/CMakeLists.txt +++ b/toolsrc/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.3) project(vcpkg C CXX) OPTION(BUILD_TESTING "Option for enabling testing" ON) +OPTION(VCPKG_BUILD_BENCHMARKING "Option for enabling benchmarking" OFF) OPTION(DEFINE_DISABLE_METRICS "Option for disabling metrics" OFF) OPTION(VCPKG_ALLOW_APPLE_CLANG "Option for allowing apple clang" OFF) @@ -77,6 +78,10 @@ if (BUILD_TESTING) $) add_test(NAME default COMMAND vcpkg-test [${TEST_NAME}]) + + if (VCPKG_BUILD_BENCHMARKING) + target_compile_options(vcpkg-test PRIVATE -DCATCH_CONFIG_ENABLE_BENCHMARKING) + endif() endif() if(MSVC) diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 15ec25e766b..ce2a7c9c53c 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -1,14 +1,6 @@ #pragma once -#if defined(_MSC_VER) && _MSC_VER < 1911 -// [[nodiscard]] is not recognized before VS 2017 version 15.3 -#pragma warning(disable : 5030) -#endif - -#if defined(__GNUC__) && __GNUC__ < 7 -// [[nodiscard]] is not recognized before GCC version 7 -#pragma GCC diagnostic ignored "-Wattributes" -#endif +#include #if defined(_WIN32) #define NOMINMAX @@ -38,8 +30,8 @@ #include #include #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING -#include #include +#include #include #include #include diff --git a/toolsrc/include/vcpkg-test/util.h b/toolsrc/include/vcpkg-test/util.h index fa650abc850..8a458a3e597 100644 --- a/toolsrc/include/vcpkg-test/util.h +++ b/toolsrc/include/vcpkg-test/util.h @@ -1,42 +1,68 @@ +#include +#include + #include #include #include -namespace vcpkg::Test { +#define CHECK_EC(ec) \ + do \ + { \ + if (ec) \ + { \ + FAIL(ec.message()); \ + } \ + } while (0) -std::unique_ptr make_status_pgh(const char* name, - const char* depends = "", - const char* default_features = "", - const char* triplet = "x86-windows"); - -std::unique_ptr make_status_feature_pgh(const char* name, - const char* feature, - const char* depends = "", - const char* triplet = "x86-windows"); - -vcpkg::PackageSpec unsafe_pspec(std::string name, vcpkg::Triplet t = vcpkg::Triplet::X86_WINDOWS); - -template -T&& unwrap(vcpkg::ExpectedT&& p) +namespace vcpkg::Test { - REQUIRE(p.has_value()); - return std::move(*p.get()); -} - -template -T&& unwrap(vcpkg::Optional&& opt) -{ - REQUIRE(opt.has_value()); - return std::move(*opt.get()); -} - -extern const bool SYMLINKS_ALLOWED; - -extern const fs::path TEMPORARY_DIRECTORY; - -void create_symlink(const fs::path& file, const fs::path& target, std::error_code& ec); - -void create_directory_symlink(const fs::path& file, const fs::path& target, std::error_code& ec); - + std::unique_ptr make_status_pgh(const char* name, + const char* depends = "", + const char* default_features = "", + const char* triplet = "x86-windows"); + + std::unique_ptr make_status_feature_pgh(const char* name, + const char* feature, + const char* depends = "", + const char* triplet = "x86-windows"); + + vcpkg::PackageSpec unsafe_pspec(std::string name, vcpkg::Triplet t = vcpkg::Triplet::X86_WINDOWS); + + template + T&& unwrap(vcpkg::ExpectedT&& p) + { + REQUIRE(p.has_value()); + return std::move(*p.get()); + } + + template + T&& unwrap(vcpkg::Optional&& opt) + { + REQUIRE(opt.has_value()); + return std::move(*opt.get()); + } + + struct AllowSymlinks + { + enum Tag : bool + { + No = false, + Yes = true, + } tag; + + constexpr AllowSymlinks(Tag tag) noexcept : tag(tag) {} + + constexpr explicit AllowSymlinks(bool b) noexcept : tag(b ? Yes : No) {} + + constexpr operator bool() const noexcept { return tag == Yes; } + }; + + AllowSymlinks can_create_symlinks() noexcept; + + const fs::path& base_temporary_directory() noexcept; + + void create_symlink(const fs::path& file, const fs::path& target, std::error_code& ec); + + void create_directory_symlink(const fs::path& file, const fs::path& target, std::error_code& ec); } diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index ae699036ce4..19e4f78fd57 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -10,24 +10,68 @@ namespace fs namespace stdfs = std::experimental::filesystem; using stdfs::copy_options; - using stdfs::file_status; - using stdfs::file_type; using stdfs::path; using stdfs::perms; using stdfs::u8path; +#if defined(_WIN32) + enum class file_type + { + none = 0, + not_found = -1, + regular = 1, + directory = 2, + symlink = 3, + block = 4, + character = 5, + fifo = 6, + socket = 7, + unknown = 8, + // also stands for a junction + directory_symlink = 42 + }; + + struct file_status + { + explicit file_status(file_type type = file_type::none, perms permissions = perms::unknown) noexcept + : m_type(type), m_permissions(permissions) + { + } + + file_type type() const noexcept { return m_type; } + void type(file_type type) noexcept { m_type = type; } + + perms permissions() const noexcept { return m_permissions; } + void permissions(perms perm) noexcept { m_permissions = perm; } + + private: + file_type m_type; + perms m_permissions; + }; + +#else + + using stdfs::file_status; + using stdfs::file_type; + +#endif + /* std::experimental::filesystem's file_status and file_type are broken in the presence of symlinks -- a symlink is treated as the object it points to for `symlink_status` and `symlink_type` */ - using stdfs::status; - // we want to poison ADL with these niebloids namespace detail { + struct status_t + { + file_status operator()(const path& p, std::error_code& ec) const noexcept; + file_status operator()(vcpkg::LineInfo li, const path& p) const noexcept; + file_status operator()(const path& p) const; + }; struct symlink_status_t { file_status operator()(const path& p, std::error_code& ec) const noexcept; @@ -35,22 +79,56 @@ namespace fs }; struct is_symlink_t { - inline bool operator()(file_status s) const { return stdfs::is_symlink(s); } + bool operator()(file_status s) const + { +#if defined(_WIN32) + return s.type() == file_type::directory_symlink || s.type() == file_type::symlink; +#else + return stdfs::is_symlink(s); +#endif + } }; struct is_regular_file_t { - inline bool operator()(file_status s) const { return stdfs::is_regular_file(s); } + inline bool operator()(file_status s) const + { +#if defined(_WIN32) + return s.type() == file_type::regular; +#else + return stdfs::is_regular_file(s); +#endif + } }; struct is_directory_t { - inline bool operator()(file_status s) const { return stdfs::is_directory(s); } + inline bool operator()(file_status s) const + { +#if defined(_WIN32) + return s.type() == file_type::directory; +#else + return stdfs::is_directory(s); +#endif + } + }; + struct exists_t + { + inline bool operator()(file_status s) const + { +#if defined(_WIN32) + return s.type() != file_type::not_found && s.type() != file_type::none; +#else + return stdfs::exists(s); +#endif + } }; } + constexpr detail::status_t status{}; constexpr detail::symlink_status_t symlink_status{}; constexpr detail::is_symlink_t is_symlink{}; constexpr detail::is_regular_file_t is_regular_file{}; constexpr detail::is_directory_t is_directory{}; + constexpr detail::exists_t exists{}; } /* @@ -59,12 +137,14 @@ namespace fs Therefore, put `symlink_status` in the global namespace, so that they get our symlink_status. - We also want to poison the ADL on is_regular_file and is_directory, because + We also want to poison the ADL on the other functions, because we don't want people calling these functions on paths */ +using fs::exists; using fs::is_directory; using fs::is_regular_file; using fs::is_symlink; +using fs::status; using fs::symlink_status; namespace vcpkg::Files @@ -92,9 +172,13 @@ namespace vcpkg::Files bool remove(const fs::path& path, LineInfo linfo); virtual bool remove(const fs::path& path, std::error_code& ec) = 0; - virtual std::uintmax_t remove_all(const fs::path& path, std::error_code& ec, fs::path& failure_point) = 0; - std::uintmax_t remove_all(const fs::path& path, LineInfo li); - virtual bool exists(const fs::path& path) const = 0; + virtual void remove_all(const fs::path& path, std::error_code& ec, fs::path& failure_point) = 0; + void remove_all(const fs::path& path, LineInfo li); + bool exists(const fs::path& path, std::error_code& ec) const; + bool exists(LineInfo li, const fs::path& path) const; + // this should probably not exist, but would require a pass through of + // existing code to fix + bool exists(const fs::path& path) const; virtual bool is_directory(const fs::path& path) const = 0; virtual bool is_regular_file(const fs::path& path) const = 0; virtual bool is_empty(const fs::path& path) const = 0; diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index d7de9b0b235..dde4e9693fd 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -185,8 +185,6 @@ namespace vcpkg::Strings bool contains(StringView haystack, StringView needle); - // base 32 encoding, since base64 encoding requires lowercase letters, - // which are not distinct from uppercase letters on macOS or Windows filesystems. - // follows RFC 4648 + // base 32 encoding, following IETC RFC 4648 std::string b32_encode(std::uint64_t x) noexcept; } diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h index e629ef0b211..90c947aa9d2 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -3,19 +3,19 @@ #include #include #include +#include #include #include #include -#include namespace vcpkg::Util { - template + template constexpr std::add_const_t& as_const(T& t) noexcept { return t; } - template + template void as_const(const T&&) = delete; template diff --git a/toolsrc/include/vcpkg/base/work_queue.h b/toolsrc/include/vcpkg/base/work_queue.h index 1c49cc1a738..a60613a3c90 100644 --- a/toolsrc/include/vcpkg/base/work_queue.h +++ b/toolsrc/include/vcpkg/base/work_queue.h @@ -1,114 +1,46 @@ #pragma once +#include + #include #include -#include +#include namespace vcpkg { - template - struct WorkQueue; - - namespace detail - { - // for SFINAE purposes, keep out of the class - // also this sfinae is so weird because Backwards Compatibility with VS2015 - template()(std::declval(), - std::declval&>()))> - void call_moved_action(Action& action, - const WorkQueue& work_queue, - ThreadLocalData& tld) - { - std::move(action)(tld, work_queue); - } - - template()(std::declval())), - class = void> - void call_moved_action(Action& action, const WorkQueue&, ThreadLocalData& tld) - { - std::move(action)(tld); - } - } - - template + template struct WorkQueue { - template - WorkQueue(LineInfo li, std::uint16_t num_threads, const F& tld_init) noexcept - { - m_line_info = li; - - set_unjoined_workers(num_threads); - m_threads.reserve(num_threads); - for (std::size_t i = 0; i < num_threads; ++i) - { - m_threads.push_back(std::thread(Worker{this, tld_init()})); - } - } - - WorkQueue(WorkQueue const&) = delete; - WorkQueue(WorkQueue&&) = delete; + WorkQueue(LineInfo li) : m_line_info(li) {} + WorkQueue(const WorkQueue&) = delete; ~WorkQueue() { - auto lck = std::unique_lock(m_mutex); - if (!is_joined(m_state)) + auto lck = std::unique_lock(m_mutex, std::try_to_lock); + /* + if we don't own the lock, there isn't much we can do + it is likely a spurious failure + */ + if (lck && m_running_workers != 0) { - Checks::exit_with_message(m_line_info, "Failed to call join() on a WorkQueue that was destroyed"); + Checks::exit_with_message( + m_line_info, "Internal error -- outstanding workers (%u) at destruct point", m_running_workers); } } - // should only be called once; anything else is an error - void run(LineInfo li) + template + void run_and_join(unsigned num_threads, const F& tld_init) noexcept { - // this should _not_ be locked before `run()` is called; however, we - // want to terminate if someone screws up, rather than cause UB - auto lck = std::unique_lock(m_mutex); + if (m_actions.empty()) return; - if (m_state != State::BeforeRun) + std::vector threads; + threads.reserve(num_threads); + for (unsigned i = 0; i < num_threads; ++i) { - Checks::exit_with_message(li, "Attempted to run() twice"); + threads.emplace_back(Worker{this, tld_init()}); } - m_state = State::Running; - } - - // runs all remaining tasks, and blocks on their finishing - // if this is called in an existing task, _will block forever_ - // DO NOT DO THAT - // thread-unsafe - void join(LineInfo li) - { - { - auto lck = std::unique_lock(m_mutex); - if (is_joined(m_state)) - { - Checks::exit_with_message(li, "Attempted to call join() more than once"); - } - else if (m_state == State::Terminated) - { - m_state = State::TerminatedJoined; - } - else - { - m_state = State::Joined; - } - } - - while (unjoined_workers()) - { - if (!running_workers()) - { - m_cv.notify_one(); - } - } - - // wait for all threads to join - for (auto& thrd : m_threads) + for (auto& thrd : threads) { thrd.join(); } @@ -117,18 +49,12 @@ namespace vcpkg // useful in the case of errors // doesn't stop any existing running tasks // returns immediately, so that one can call this in a task - void terminate() const + void cancel() const { { - auto lck = std::unique_lock(m_mutex); - if (is_joined(m_state)) - { - m_state = State::TerminatedJoined; - } - else - { - m_state = State::Terminated; - } + auto lck = std::lock_guard(m_mutex); + m_cancelled = true; + m_actions.clear(); } m_cv.notify_all(); } @@ -136,15 +62,16 @@ namespace vcpkg void enqueue_action(Action a) const { { - auto lck = std::unique_lock(m_mutex); - m_actions.push_back(std::move(a)); + auto lck = std::lock_guard(m_mutex); + if (m_cancelled) return; - if (m_state == State::BeforeRun) return; + m_actions.push_back(std::move(a)); } m_cv.notify_one(); } private: + template struct Worker { const WorkQueue* work_queue; @@ -152,85 +79,62 @@ namespace vcpkg void operator()() { - // unlocked when waiting, or when in the action - // locked otherwise auto lck = std::unique_lock(work_queue->m_mutex); - - work_queue->m_cv.wait(lck, [&] { return work_queue->m_state != State::BeforeRun; }); - - work_queue->increment_running_workers(); for (;;) { - const auto state = work_queue->m_state; + const auto& w = *work_queue; + work_queue->m_cv.wait(lck, [&w] { + if (w.m_cancelled) + return true; + else if (!w.m_actions.empty()) + return true; + else if (w.m_running_workers == 0) + return true; + else + return false; + }); - if (is_terminated(state)) + if (work_queue->m_cancelled || work_queue->m_actions.empty()) { + /* + if we've been cancelled, or if the work queue is empty + and there are no other workers, we want to return + immediately; we don't check for the latter condition + since if we're at this point, then either the queue + is not empty, or there are no other workers, or both. + We can't have an empty queue, and other workers, or + we would still be in the wait. + */ break; } - if (work_queue->m_actions.empty()) - { - if (state == State::Running || work_queue->running_workers() > 1) - { - work_queue->decrement_running_workers(); - work_queue->m_cv.wait(lck); - work_queue->increment_running_workers(); - continue; - } + ++work_queue->m_running_workers; - // the queue is joining, and we are the only worker running - // no more work! - break; - } - - Action action = std::move(work_queue->m_actions.back()); + auto action = std::move(work_queue->m_actions.back()); work_queue->m_actions.pop_back(); lck.unlock(); work_queue->m_cv.notify_one(); - detail::call_moved_action(action, *work_queue, tld); + std::move(action)(tld, *work_queue); lck.lock(); - } - work_queue->decrement_running_workers(); - work_queue->decrement_unjoined_workers(); + const auto after = --work_queue->m_running_workers; + if (work_queue->m_actions.empty() && after == 0) + { + work_queue->m_cv.notify_all(); + return; + } + } } }; - enum class State : std::int16_t - { - // can only exist upon construction - BeforeRun = -1, - - Running, - Joined, - Terminated, - TerminatedJoined, - }; - - static bool is_terminated(State st) { return st == State::Terminated || st == State::TerminatedJoined; } - - static bool is_joined(State st) { return st == State::Joined || st == State::TerminatedJoined; } - mutable std::mutex m_mutex{}; // these are all under m_mutex - mutable State m_state = State::BeforeRun; + mutable bool m_cancelled = false; mutable std::vector m_actions{}; mutable std::condition_variable m_cv{}; + mutable unsigned long m_running_workers = 0; - mutable std::atomic m_workers; - // = unjoined_workers << 16 | running_workers - - void set_unjoined_workers(std::uint16_t threads) { m_workers = std::uint32_t(threads) << 16; } - void decrement_unjoined_workers() const { m_workers -= 1 << 16; } - - std::uint16_t unjoined_workers() const { return std::uint16_t(m_workers >> 16); } - - void increment_running_workers() const { ++m_workers; } - void decrement_running_workers() const { --m_workers; } - std::uint16_t running_workers() const { return std::uint16_t(m_workers); } - - std::vector m_threads{}; LineInfo m_line_info; }; } diff --git a/toolsrc/include/vcpkg/binaryparagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h index 4052da6d190..7734859f700 100644 --- a/toolsrc/include/vcpkg/binaryparagraph.h +++ b/toolsrc/include/vcpkg/binaryparagraph.h @@ -1,8 +1,8 @@ #pragma once #include -#include #include +#include #include diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index f4cd3b0ef4a..c57cbfad333 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -126,8 +126,8 @@ namespace vcpkg::Build /// Runs the triplet file in a "capture" mode to create a PreBuildInfo /// static PreBuildInfo from_triplet_file(const VcpkgPaths& paths, - const Triplet& triplet, - Optional port = nullopt); + const Triplet& triplet, + Optional port = nullopt); std::string triplet_abi_tag; std::string target_architecture; diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index 9641580268b..e9018b1b892 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -145,7 +145,7 @@ namespace vcpkg::Dependencies struct PathsPortFileProvider : Util::ResourceBase, PortFileProvider { - explicit PathsPortFileProvider(const vcpkg::VcpkgPaths& paths, + explicit PathsPortFileProvider(const vcpkg::VcpkgPaths& paths, const std::vector* ports_dirs_paths); Optional get_control_file(const std::string& src_name) const override; std::vector load_all_control_files() const override; @@ -186,9 +186,10 @@ namespace vcpkg::Dependencies std::vector create_export_plan(const std::vector& specs, const StatusParagraphs& status_db); - std::vector create_feature_install_plan(const std::unordered_map& map, - const std::vector& specs, - const StatusParagraphs& status_db); + std::vector create_feature_install_plan( + const std::unordered_map& map, + const std::vector& specs, + const StatusParagraphs& status_db); /// Figure out which actions are required to install features specifications in `specs`. /// Contains the ports of the current environment. @@ -199,7 +200,7 @@ namespace vcpkg::Dependencies const StatusParagraphs& status_db, const CreateInstallPlanOptions& options = {}); - void print_plan(const std::vector& action_plan, + void print_plan(const std::vector& action_plan, const bool is_recursive = true, const fs::path& default_ports_dir = ""); } diff --git a/toolsrc/include/vcpkg/logicexpression.h b/toolsrc/include/vcpkg/logicexpression.h index 4e6367b9056..8795971b9de 100644 --- a/toolsrc/include/vcpkg/logicexpression.h +++ b/toolsrc/include/vcpkg/logicexpression.h @@ -4,7 +4,7 @@ namespace vcpkg { - // Evaluate simple vcpkg logic expressions. An identifier in the expression is considered 'true' - // if it is a substring of the evaluation_context (typically the name of the triplet) - bool evaluate_expression(const std::string& expression, const std::string& evaluation_context); + // Evaluate simple vcpkg logic expressions. An identifier in the expression is considered 'true' + // if it is a substring of the evaluation_context (typically the name of the triplet) + bool evaluate_expression(const std::string& expression, const std::string& evaluation_context); } \ No newline at end of file diff --git a/toolsrc/include/vcpkg/pragmas.h b/toolsrc/include/vcpkg/pragmas.h new file mode 100644 index 00000000000..fa1039bce0d --- /dev/null +++ b/toolsrc/include/vcpkg/pragmas.h @@ -0,0 +1,11 @@ +#pragma once + +#if defined(_MSC_VER) && _MSC_VER < 1911 +// [[nodiscard]] is not recognized before VS 2017 version 15.3 +#pragma warning(disable : 5030) +#endif + +#if defined(__GNUC__) && __GNUC__ < 7 +// [[nodiscard]] is not recognized before GCC version 7 +#pragma GCC diagnostic ignored "-Wattributes" +#endif diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h index 9fbd83475d8..95347770aa2 100644 --- a/toolsrc/include/vcpkg/sourceparagraph.h +++ b/toolsrc/include/vcpkg/sourceparagraph.h @@ -23,8 +23,7 @@ namespace vcpkg std::vector filter_dependencies(const std::vector& deps, const Triplet& t); std::vector filter_dependencies_to_specs(const std::vector& deps, const Triplet& t); - std::vector filter_dependencies_to_features(const std::vector& deps, - const Triplet& t); + std::vector filter_dependencies_to_features(const std::vector& deps, const Triplet& t); // zlib[uwp] becomes Dependency{"zlib", "uwp"} std::vector expand_qualified_dependencies(const std::vector& depends); @@ -71,7 +70,8 @@ namespace vcpkg }; /// - /// Full metadata of a package: core and other features. As well as the location the SourceControlFile was loaded from. + /// Full metadata of a package: core and other features. As well as the location the SourceControlFile was loaded + /// from. /// struct SourceControlFileLocation { diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index ce442858bd3..8107b8201f3 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -55,7 +55,7 @@ namespace vcpkg fs::path package_dir(const PackageSpec& spec) const; fs::path build_info_file_path(const PackageSpec& spec) const; fs::path listfile_path(const BinaryParagraph& pgh) const; - + bool is_valid_triplet(const Triplet& t) const; const std::vector& get_available_triplets() const; const fs::path get_triplet_file_path(const Triplet& triplet) const; diff --git a/toolsrc/src/vcpkg-test/files.cpp b/toolsrc/src/vcpkg-test/files.cpp index ff0176a934c..a2faf455cd3 100644 --- a/toolsrc/src/vcpkg-test/files.cpp +++ b/toolsrc/src/vcpkg-test/files.cpp @@ -9,29 +9,63 @@ #include -using vcpkg::Test::SYMLINKS_ALLOWED; -using vcpkg::Test::TEMPORARY_DIRECTORY; +using vcpkg::Test::AllowSymlinks; +using vcpkg::Test::base_temporary_directory; +using vcpkg::Test::can_create_symlinks; + +#define CHECK_EC_ON_FILE(file, ec) \ + do \ + { \ + if (ec) \ + { \ + FAIL(file << ": " << ec.message()); \ + } \ + } while (0) namespace { - using uid = std::uniform_int_distribution; + using uid_t = std::uniform_int_distribution; + using urbg_t = std::mt19937_64; - std::mt19937_64 get_urbg(std::uint64_t index) + urbg_t get_urbg(std::uint64_t index) { // smallest prime > 2**63 - 1 - return std::mt19937_64{index + 9223372036854775837ULL}; + return urbg_t{index + 9223372036854775837ULL}; } - std::string get_random_filename(std::mt19937_64& urbg) { return vcpkg::Strings::b32_encode(uid{}(urbg)); } + std::string get_random_filename(urbg_t& urbg) { return vcpkg::Strings::b32_encode(uid_t{}(urbg)); } - void create_directory_tree(std::mt19937_64& urbg, + struct MaxDepth + { + std::uint64_t i; + explicit MaxDepth(std::uint64_t i) : i(i) {} + operator uint64_t() const { return i; } + }; + + struct Width + { + std::uint64_t i; + explicit Width(std::uint64_t i) : i(i) {} + operator uint64_t() const { return i; } + }; + + struct CurrentDepth + { + std::uint64_t i; + explicit CurrentDepth(std::uint64_t i) : i(i) {} + operator uint64_t() const { return i; } + CurrentDepth incremented() const { return CurrentDepth{i + 1}; } + }; + + void create_directory_tree(urbg_t& urbg, vcpkg::Files::Filesystem& fs, - std::uint64_t depth, - const fs::path& base) + const fs::path& base, + MaxDepth max_depth, + AllowSymlinks allow_symlinks = AllowSymlinks::Yes, + Width width = Width{5}, + CurrentDepth current_depth = CurrentDepth{0}) { std::random_device rd; - constexpr std::uint64_t max_depth = 5; - constexpr std::uint64_t width = 5; // we want ~70% of our "files" to be directories, and then a third // each of the remaining ~30% to be regular files, directory symlinks, @@ -42,18 +76,24 @@ namespace constexpr std::uint64_t regular_symlink_tag = 8; constexpr std::uint64_t directory_symlink_tag = 9; + allow_symlinks = AllowSymlinks{allow_symlinks && can_create_symlinks()}; + // if we're at the max depth, we only want to build non-directories std::uint64_t file_type; - if (depth < max_depth) + if (current_depth >= max_depth) { - file_type = uid{directory_min_tag, regular_symlink_tag}(urbg); + file_type = uid_t{regular_file_tag, directory_symlink_tag}(urbg); + } + else if (current_depth < 2) + { + file_type = directory_min_tag; } else { - file_type = uid{regular_file_tag, regular_symlink_tag}(urbg); + file_type = uid_t{directory_min_tag, regular_symlink_tag}(urbg); } - if (!SYMLINKS_ALLOWED && file_type > regular_file_tag) + if (!allow_symlinks && file_type > regular_file_tag) { file_type = regular_file_tag; } @@ -62,14 +102,20 @@ namespace if (file_type <= directory_max_tag) { fs.create_directory(base, ec); - if (ec) { - INFO("File that failed: " << base); - REQUIRE_FALSE(ec); + if (ec) + { + CHECK_EC_ON_FILE(base, ec); } for (int i = 0; i < width; ++i) { - create_directory_tree(urbg, fs, depth + 1, base / get_random_filename(urbg)); + create_directory_tree(urbg, + fs, + base / get_random_filename(urbg), + max_depth, + allow_symlinks, + width, + current_depth.incremented()); } } else if (file_type == regular_file_tag) @@ -80,19 +126,34 @@ namespace else if (file_type == regular_symlink_tag) { // regular symlink - fs.write_contents(base, "", ec); - REQUIRE_FALSE(ec); auto base_link = base; - base_link.replace_filename(base.filename().u8string() + "-link"); - vcpkg::Test::create_symlink(base, base_link, ec); + base_link.replace_filename(base.filename().u8string() + "-orig"); + fs.write_contents(base_link, "", ec); + CHECK_EC_ON_FILE(base_link, ec); + vcpkg::Test::create_symlink(base_link, base, ec); } else // type == directory_symlink_tag { // directory symlink - vcpkg::Test::create_directory_symlink(base / "..", base, ec); + auto parent = base; + parent.remove_filename(); + vcpkg::Test::create_directory_symlink(parent, base, ec); } - REQUIRE_FALSE(ec); + CHECK_EC_ON_FILE(base, ec); + REQUIRE(fs::exists(fs.symlink_status(base, ec))); + CHECK_EC_ON_FILE(base, ec); + } + + vcpkg::Files::Filesystem& setup(urbg_t& urbg) + { + auto& fs = vcpkg::Files::get_real_filesystem(); + + std::error_code ec; + fs.create_directory(base_temporary_directory(), ec); + CHECK_EC_ON_FILE(base_temporary_directory(), ec); + + return fs; } } @@ -100,24 +161,83 @@ TEST_CASE ("remove all", "[files]") { auto urbg = get_urbg(0); - fs::path temp_dir = TEMPORARY_DIRECTORY / get_random_filename(urbg); - - auto& fs = vcpkg::Files::get_real_filesystem(); - - std::error_code ec; - fs.create_directory(TEMPORARY_DIRECTORY, ec); - - REQUIRE_FALSE(ec); + auto& fs = setup(urbg); + fs::path temp_dir = base_temporary_directory() / get_random_filename(urbg); INFO("temp dir is: " << temp_dir); - create_directory_tree(urbg, fs, 0, temp_dir); + create_directory_tree(urbg, fs, temp_dir, MaxDepth{5}); + std::error_code ec; fs::path fp; fs.remove_all(temp_dir, ec, fp); - if (ec) { - FAIL("remove_all failure on file: " << fp); - } + CHECK_EC_ON_FILE(fp, ec); - REQUIRE_FALSE(fs.exists(temp_dir)); + REQUIRE_FALSE(fs.exists(temp_dir, ec)); + CHECK_EC_ON_FILE(temp_dir, ec); } + +#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +TEST_CASE ("remove all -- benchmarks", "[files][!benchmark]") +{ + auto urbg = get_urbg(1); + auto& fs = setup(urbg); + + struct + { + urbg_t& urbg; + vcpkg::Files::Filesystem& fs; + + void operator()(Catch::Benchmark::Chronometer& meter, MaxDepth max_depth, AllowSymlinks allow_symlinks) const + { + std::vector temp_dirs; + temp_dirs.resize(meter.runs()); + + std::generate(begin(temp_dirs), end(temp_dirs), [&] { + fs::path temp_dir = base_temporary_directory() / get_random_filename(urbg); + create_directory_tree(urbg, fs, temp_dir, max_depth, allow_symlinks); + return temp_dir; + }); + + meter.measure([&](int run) { + std::error_code ec; + fs::path fp; + const auto& temp_dir = temp_dirs[run]; + + fs.remove_all(temp_dir, ec, fp); + CHECK_EC_ON_FILE(fp, ec); + }); + + for (const auto& dir : temp_dirs) + { + std::error_code ec; + REQUIRE_FALSE(fs.exists(dir, ec)); + CHECK_EC_ON_FILE(dir, ec); + } + } + } do_benchmark = {urbg, fs}; + + BENCHMARK_ADVANCED("small directory, no symlinks")(Catch::Benchmark::Chronometer meter) + { + do_benchmark(meter, MaxDepth{2}, AllowSymlinks::No); + }; + + BENCHMARK_ADVANCED("large directory, no symlinks")(Catch::Benchmark::Chronometer meter) + { + do_benchmark(meter, MaxDepth{5}, AllowSymlinks::No); + }; + + if (can_create_symlinks()) + { + BENCHMARK_ADVANCED("small directory, symlinks")(Catch::Benchmark::Chronometer meter) + { + do_benchmark(meter, MaxDepth{2}, AllowSymlinks::Yes); + }; + + BENCHMARK_ADVANCED("large directory, symlinks")(Catch::Benchmark::Chronometer meter) + { + do_benchmark(meter, MaxDepth{5}, AllowSymlinks::Yes); + }; + } +} +#endif diff --git a/toolsrc/src/vcpkg-test/util.cpp b/toolsrc/src/vcpkg-test/util.cpp index 5359b0fadc8..384954b4e75 100644 --- a/toolsrc/src/vcpkg-test/util.cpp +++ b/toolsrc/src/vcpkg-test/util.cpp @@ -74,14 +74,14 @@ namespace vcpkg::Test return m_ret.value_or_exit(VCPKG_LINE_INFO); } - static bool system_allows_symlinks() + static AllowSymlinks internal_can_create_symlinks() noexcept { #if FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_NONE - return false; + return AllowSymlinks::No; #elif FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_UNIX - return true; + return AllowSymlinks::Yes; #elif !defined(_WIN32) // FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD - return true; + return AllowSymlinks::Yes; #else HKEY key; bool allow_symlinks = true; @@ -97,11 +97,14 @@ namespace vcpkg::Test if (status == ERROR_SUCCESS) RegCloseKey(key); - return allow_symlinks; + return allow_symlinks ? AllowSymlinks::Yes : AllowSymlinks::No; #endif } + const static AllowSymlinks CAN_CREATE_SYMLINKS = internal_can_create_symlinks(); - static fs::path internal_temporary_directory() + AllowSymlinks can_create_symlinks() noexcept { return CAN_CREATE_SYMLINKS; } + + static fs::path internal_base_temporary_directory() { #if defined(_WIN32) wchar_t* tmp = static_cast(std::calloc(32'767, 2)); @@ -121,8 +124,9 @@ namespace vcpkg::Test #endif } - const bool SYMLINKS_ALLOWED = system_allows_symlinks(); - const fs::path TEMPORARY_DIRECTORY = internal_temporary_directory(); + const static fs::path BASE_TEMPORARY_DIRECTORY = internal_base_temporary_directory(); + + const fs::path& base_temporary_directory() noexcept { return BASE_TEMPORARY_DIRECTORY; } #if FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_NONE constexpr char no_filesystem_message[] = @@ -132,7 +136,7 @@ namespace vcpkg::Test void create_symlink(const fs::path& target, const fs::path& file, std::error_code& ec) { #if FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD - if (SYMLINKS_ALLOWED) + if (can_create_symlinks()) { std::filesystem::path targetp = target.native(); std::filesystem::path filep = file.native(); @@ -156,12 +160,12 @@ namespace vcpkg::Test void create_directory_symlink(const fs::path& target, const fs::path& file, std::error_code& ec) { #if FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD - if (SYMLINKS_ALLOWED) + if (can_create_symlinks()) { std::filesystem::path targetp = target.native(); std::filesystem::path filep = file.native(); - std::filesystem::create_symlink(targetp, filep); + std::filesystem::create_directory_symlink(targetp, filep); } else { diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 46ec8c013cd..3fdbd0d3e98 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -125,12 +125,8 @@ static void inner(const VcpkgCmdArguments& args) auto default_vs_path = System::get_environment_variable("VCPKG_VISUAL_STUDIO_PATH").value_or(""); - - - const Expected expected_paths = VcpkgPaths::create(vcpkg_root_dir, - vcpkg_scripts_root_dir, - default_vs_path, - args.overlay_triplets.get()); + const Expected expected_paths = + VcpkgPaths::create(vcpkg_root_dir, vcpkg_scripts_root_dir, default_vs_path, args.overlay_triplets.get()); Checks::check_exit(VCPKG_LINE_INFO, !expected_paths.error(), "Error: Invalid vcpkg root directory %s: %s", @@ -143,7 +139,11 @@ static void inner(const VcpkgCmdArguments& args) #else const int exit_code = chdir(paths.root.c_str()); #endif - Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Changing the working directory to the vcpkg root directory failed. Did you incorrectly define the VCPKG_ROOT environment variable, or did you mistakenly create a file named .vcpkg-root somewhere?"); + Checks::check_exit( + VCPKG_LINE_INFO, + exit_code == 0, + "Changing the working directory to the vcpkg root directory failed. Did you incorrectly define the VCPKG_ROOT " + "environment variable, or did you mistakenly create a file named .vcpkg-root somewhere?"); if (args.command == "install" || args.command == "remove" || args.command == "export" || args.command == "update") { diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 4446042f127..4a0a52f06d4 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -23,22 +23,35 @@ namespace fs::detail { - file_status symlink_status_t::operator()(const path& p, std::error_code& ec) const noexcept + static file_status status_implementation(bool follow_symlinks, const path& p, std::error_code& ec) { #if defined(_WIN32) - static_cast(ec); - WIN32_FILE_ATTRIBUTE_DATA file_attributes; file_type ft = file_type::unknown; perms permissions = perms::unknown; if (!GetFileAttributesExW(p.c_str(), GetFileExInfoStandard, &file_attributes)) { - ft = file_type::not_found; + const auto err = GetLastError(); + if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) + { + ft = file_type::not_found; + } + else + { + ec.assign(err, std::system_category()); + } } - else if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) + else if (!follow_symlinks && file_attributes.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { - // check for reparse point -- if yes, then symlink - ft = file_type::symlink; + // this also gives junctions file_type::directory_symlink + if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + ft = file_type::directory_symlink; + } + else + { + ft = file_type::symlink; + } } else if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { @@ -50,17 +63,60 @@ namespace fs::detail ft = file_type::regular; } + if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_READONLY) + { + constexpr auto all_write = perms::group_write | perms::owner_write | perms::others_write; + permissions = perms::all & ~all_write; + } + else if (ft != file_type::none && ft != file_type::none) + { + permissions = perms::all; + } + return file_status(ft, permissions); #else - return stdfs::symlink_status(p, ec); + auto result = symlink ? stdfs::symlink_status(p, ec) : stdfs::status(p, ec); + // libstdc++ doesn't correctly not-set ec on nonexistent paths + if (ec.value() == ENOENT) + { + ec.clear(); + result = file_status(file_type::not_found, perms::unknown); + } + return result; #endif } + file_status status_t::operator()(const path& p, std::error_code& ec) const noexcept + { + return status_implementation(false, p, ec); + } + file_status status_t::operator()(vcpkg::LineInfo li, const path& p) const noexcept + { + std::error_code ec; + auto result = (*this)(p, ec); + if (ec) vcpkg::Checks::exit_with_message(li, "error getting status of path %s: %s", p.string(), ec.message()); + + return result; + } + file_status status_t::operator()(const path& p) const + { +#if defined(_WIN32) + return (*this)(VCPKG_LINE_INFO, p); +#else + return fs::stdfs::status(p); +#endif + } + + file_status symlink_status_t::operator()(const path& p, std::error_code& ec) const noexcept + { + return status_implementation(true, p, ec); + } + file_status symlink_status_t::operator()(vcpkg::LineInfo li, const path& p) const noexcept { std::error_code ec; - auto result = symlink_status(p, ec); + auto result = (*this)(p, ec); if (ec) vcpkg::Checks::exit_with_message(li, "error getting status of path %s: %s", p.string(), ec.message()); return result; @@ -71,34 +127,41 @@ namespace vcpkg::Files { static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); - namespace { + namespace + { // does _not_ follow symlinks - void set_writeable(const fs::path& path, std::error_code& ec) noexcept { + void set_writeable(const fs::path& path, std::error_code& ec) noexcept + { #if defined(_WIN32) auto const file_name = path.c_str(); WIN32_FILE_ATTRIBUTE_DATA attributes; - if (!GetFileAttributesExW(file_name, GetFileExInfoStandard, &attributes)) { + if (!GetFileAttributesExW(file_name, GetFileExInfoStandard, &attributes)) + { ec.assign(GetLastError(), std::system_category()); return; } auto dw_attributes = attributes.dwFileAttributes; dw_attributes &= ~FILE_ATTRIBUTE_READONLY; - if (!SetFileAttributesW(file_name, dw_attributes)) { + if (!SetFileAttributesW(file_name, dw_attributes)) + { ec.assign(GetLastError(), std::system_category()); } #else struct stat s; - if (lstat(path.c_str(), &s)) { + if (lstat(path.c_str(), &s)) + { ec.assign(errno, std::system_category()); return; } auto mode = s.st_mode; // if the file is a symlink, perms don't matter - if (!(mode & S_IFLNK)) { + if (!(mode & S_IFLNK)) + { mode |= S_IWUSR; - if (chmod(path.c_str(), mode)) { + if (chmod(path.c_str(), mode)) + { ec.assign(errno, std::system_category()); } } @@ -138,6 +201,25 @@ namespace vcpkg::Files return r; } + bool Filesystem::exists(const fs::path& path, std::error_code& ec) const + { + return fs::exists(this->symlink_status(path, ec)); + } + + bool Filesystem::exists(LineInfo li, const fs::path& path) const + { + std::error_code ec; + auto result = this->exists(path, ec); + if (ec) Checks::exit_with_message(li, "error checking existence of file %s: %s", path.u8string(), ec.message()); + return result; + } + bool Filesystem::exists(const fs::path& path) const + { + std::error_code ec; + // drop this on the floor, for compatibility with existing code + return exists(path, ec); + } + void Filesystem::write_lines(const fs::path& path, const std::vector& lines, LineInfo linfo) { std::error_code ec; @@ -145,12 +227,12 @@ namespace vcpkg::Files if (ec) Checks::exit_with_message(linfo, "error writing lines: %s: %s", path.u8string(), ec.message()); } - std::uintmax_t Filesystem::remove_all(const fs::path& path, LineInfo li) + void Filesystem::remove_all(const fs::path& path, LineInfo li) { std::error_code ec; fs::path failure_point; - const auto result = this->remove_all(path, ec, failure_point); + this->remove_all(path, ec, failure_point); if (ec) { @@ -160,8 +242,6 @@ namespace vcpkg::Files failure_point.string(), ec.message()); } - - return result; } struct RealFilesystem final : Filesystem @@ -203,8 +283,7 @@ namespace vcpkg::Files while (std::getline(file_stream, line)) { // Remove the trailing \r to accomodate Windows line endings. - if ((!line.empty()) && (line.back() == '\r')) - line.pop_back(); + if ((!line.empty()) && (line.back() == '\r')) line.pop_back(); output.push_back(line); } @@ -216,7 +295,7 @@ namespace vcpkg::Files const std::string& filename) const override { fs::path current_dir = starting_dir; - if (exists(current_dir / filename)) + if (exists(VCPKG_LINE_INFO, current_dir / filename)) { return current_dir; } @@ -241,7 +320,7 @@ namespace vcpkg::Files current_dir = std::move(parent); const fs::path candidate = current_dir / filename; - if (exists(candidate)) + if (exists(VCPKG_LINE_INFO, candidate)) { return current_dir; } @@ -359,92 +438,96 @@ namespace vcpkg::Files #endif } virtual bool remove(const fs::path& path, std::error_code& ec) override { return fs::stdfs::remove(path, ec); } - virtual std::uintmax_t remove_all(const fs::path& path, std::error_code& ec, fs::path& failure_point) override + virtual void remove_all(const fs::path& path, std::error_code& ec, fs::path& failure_point) override { /* - does not use the std::filesystem call since it is buggy, and can - have spurious errors before VS 2017 update 6, and on later versions - (as well as on macOS and Linux), this is just as fast and will have - fewer spurious errors due to locks. + does not use the std::experimental::filesystem call since this is + quite a bit faster, and also supports symlinks */ - /* - `remove` doesn't actually remove anything -- it simply moves the - files into a parent directory (which ends up being at `path`), - and then inserts `actually_remove{current_path}` into the work - queue. - */ struct remove { - struct tld + struct ErrorInfo : Util::ResourceBase { - const fs::path& tmp_directory; - std::uint64_t index; - - std::atomic& files_deleted; - - std::mutex& ec_mutex; - std::error_code& ec; - fs::path& failure_point; + std::error_code ec; + fs::path failure_point; }; - - struct actually_remove; - using queue = WorkQueue; - /* if `current_path` is a directory, first `remove`s all - elements of the directory, then calls remove. + elements of the directory, then removes current_path. - else, just calls remove. + else if `current_path` exists, removes current_path + + else does nothing */ - struct actually_remove + static void do_remove(const fs::path& current_path, ErrorInfo& err) { - fs::path current_path; + std::error_code ec; + const auto path_status = fs::symlink_status(current_path, ec); + if (check_ec(ec, current_path, err)) return; + if (!fs::exists(path_status)) return; - void operator()(tld& info, const queue& queue) const + const auto path_type = path_status.type(); + + if ((path_status.permissions() & fs::perms::owner_write) != fs::perms::owner_write) { - std::error_code ec; - const auto path_type = fs::symlink_status(current_path, ec).type(); - - if (check_ec(ec, info, queue, current_path)) return; - - if (path_type == fs::file_type::directory) - { - for (const auto& entry : fs::stdfs::directory_iterator(current_path)) - { - remove{}(entry, info, queue); - } - } - set_writeable(current_path, ec); - if (check_ec(ec, info, queue, current_path)) return; + if (check_ec(ec, current_path, err)) return; + } - if (fs::stdfs::remove(current_path, ec)) + if (path_type == fs::file_type::directory) + { + for (const auto& entry : fs::stdfs::directory_iterator(current_path)) { - info.files_deleted.fetch_add(1, std::memory_order_relaxed); + do_remove(entry, err); + if (err.ec) return; } - else +#if defined(_WIN32) + if (!RemoveDirectoryW(current_path.c_str())) { - check_ec(ec, info, queue, current_path); + ec.assign(GetLastError(), std::system_category()); + } +#else + if (rmdir(current_path.c_str())) + { + ec.assign(errno, std::system_category()); + } +#endif + } +#if defined(_WIN32) + else if (path_type == fs::file_type::directory_symlink) + { + if (!RemoveDirectoryW(current_path.c_str())) + { + ec.assign(GetLastError(), std::system_category()); } } - }; + else + { + if (!DeleteFileW(current_path.c_str())) + { + ec.assign(GetLastError(), std::system_category()); + } + } +#else + else + { + if (unlink(current_path.c_str())) + { + ec.assign(errno, std::system_category()); + } + } +#endif - static bool check_ec(const std::error_code& ec, - tld& info, - const queue& queue, - const fs::path& failure_point) + check_ec(ec, current_path, err); + } + + static bool check_ec(const std::error_code& ec, const fs::path& current_path, ErrorInfo& err) { if (ec) { - queue.terminate(); - - auto lck = std::unique_lock(info.ec_mutex); - if (!info.ec) - { - info.ec = ec; - info.failure_point = failure_point; - } + err.ec = ec; + err.failure_point = current_path; return true; } @@ -453,55 +536,15 @@ namespace vcpkg::Files return false; } } - - void operator()(const fs::path& current_path, tld& info, const queue& queue) const - { - std::error_code ec; - - const auto tmp_name = Strings::b32_encode(info.index++); - const auto tmp_path = info.tmp_directory / tmp_name; - - fs::stdfs::rename(current_path, tmp_path, ec); - if (check_ec(ec, info, queue, current_path)) return; - - queue.enqueue_action(actually_remove{std::move(tmp_path)}); - } }; - const auto path_type = fs::symlink_status(path, ec).type(); - - std::atomic files_deleted{0}; - - if (path_type == fs::file_type::directory) - { - std::uint64_t index = 0; - std::mutex ec_mutex; - - auto const tld_gen = [&] { - index += static_cast(1) << 32; - return remove::tld{path, index, files_deleted, ec_mutex, ec, failure_point}; - }; - - remove::queue queue{VCPKG_LINE_INFO, 4, tld_gen}; - - // note: we don't actually start the queue running until the - // `join()`. This allows us to rename all the top-level files in - // peace, so that we don't get collisions. - auto main_tld = tld_gen(); - for (const auto& entry : fs::stdfs::directory_iterator(path)) - { - remove{}(entry, main_tld, queue); - } - - queue.join(VCPKG_LINE_INFO); - } - /* we need to do backoff on the removal of the top level directory, - since we need to place all moved files into that top level - directory, and so we can only delete the directory after all the + so we can only delete the directory after all the lower levels have been deleted. */ + + remove::ErrorInfo err; for (int backoff = 0; backoff < 5; ++backoff) { if (backoff) @@ -511,16 +554,16 @@ namespace vcpkg::Files std::this_thread::sleep_for(backoff_time); } - if (fs::stdfs::remove(path, ec)) + remove::do_remove(path, err); + if (!err.ec) { - files_deleted.fetch_add(1, std::memory_order_relaxed); break; } } - return files_deleted; + ec = std::move(err.ec); + failure_point = std::move(err.failure_point); } - virtual bool exists(const fs::path& path) const override { return fs::stdfs::exists(path); } virtual bool is_directory(const fs::path& path) const override { return fs::stdfs::is_directory(path); } virtual bool is_regular_file(const fs::path& path) const override { return fs::stdfs::is_regular_file(path); } virtual bool is_empty(const fs::path& path) const override { return fs::stdfs::is_empty(path); } @@ -598,7 +641,7 @@ namespace vcpkg::Files for (auto&& ext : EXTS) { auto p = fs::u8path(base + ext.c_str()); - if (Util::find(ret, p) == ret.end() && this->exists(p)) + if (Util::find(ret, p) == ret.end() && this->exists(VCPKG_LINE_INFO, p)) { ret.push_back(p); Debug::print("Found path: ", p.u8string(), '\n'); diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 54a69145424..02d4c4a7199 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -63,8 +63,7 @@ namespace vcpkg::Build::Command std::set features_as_set(full_spec.features.begin(), full_spec.features.end()); features_as_set.emplace("core"); - const Build::BuildPackageConfig build_config{ - scfl, spec.triplet(), build_package_options, features_as_set}; + const Build::BuildPackageConfig build_config{scfl, spec.triplet(), build_package_options, features_as_set}; const auto build_timer = Chrono::ElapsedTimer::create_started(); const auto result = Build::build_package(paths, build_config, status_db); @@ -293,19 +292,17 @@ namespace vcpkg::Build const std::set& feature_list, const Triplet& triplet) { - return Util::fmap_flatten( - feature_list, - [&](std::string const& feature) -> std::vector { - if (feature == "core") - { - return filter_dependencies_to_features(scf.core_paragraph->depends, triplet); - } + return Util::fmap_flatten(feature_list, [&](std::string const& feature) -> std::vector { + if (feature == "core") + { + return filter_dependencies_to_features(scf.core_paragraph->depends, triplet); + } - auto maybe_feature = scf.find_feature(feature); - Checks::check_exit(VCPKG_LINE_INFO, maybe_feature.has_value()); + auto maybe_feature = scf.find_feature(feature); + Checks::check_exit(VCPKG_LINE_INFO, maybe_feature.has_value()); - return filter_dependencies_to_features(maybe_feature.get()->depends, triplet); - }); + return filter_dependencies_to_features(maybe_feature.get()->depends, triplet); + }); } static std::vector get_dependency_names(const SourceControlFile& scf, @@ -313,10 +310,7 @@ namespace vcpkg::Build const Triplet& triplet) { return Util::fmap(get_dependencies(scf, feature_list, triplet), - [&](const Features& feat) { - return feat.name; - } - ); + [&](const Features& feat) { return feat.name; }); } static std::vector compute_required_feature_specs(const BuildPackageConfig& config, @@ -324,8 +318,7 @@ namespace vcpkg::Build { const Triplet& triplet = config.triplet; - const std::vector dep_strings = - get_dependency_names(config.scf, config.feature_list, triplet); + const std::vector dep_strings = get_dependency_names(config.scf, config.feature_list, triplet); auto dep_fspecs = FeatureSpec::from_strings_and_triplet(dep_strings, triplet); Util::sort_unique_erase(dep_fspecs); @@ -428,8 +421,7 @@ namespace vcpkg::Build { const Toolset& toolset = paths.get_toolset(pre_build_info); const fs::path& cmake_exe_path = paths.get_tool_exe(Tools::CMAKE); - std::vector variables = - get_cmake_vars(paths, config, triplet, toolset); + std::vector variables = get_cmake_vars(paths, config, triplet, toolset); const std::string cmd_launch_cmake = System::make_cmake_cmd(cmake_exe_path, paths.ports_cmake, variables); @@ -521,13 +513,10 @@ namespace vcpkg::Build const auto timer = Chrono::ElapsedTimer::create_started(); - std::string command = - make_build_cmd(paths, pre_build_info, config, triplet); - std::unordered_map env = - make_env_passthrough(pre_build_info); + std::string command = make_build_cmd(paths, pre_build_info, config, triplet); + std::unordered_map env = make_env_passthrough(pre_build_info); - const int return_code = - System::cmd_execute_clean(command, env); + const int return_code = System::cmd_execute_clean(command, env); const auto buildtimeus = timer.microseconds(); const auto spec_string = spec.to_string(); @@ -785,8 +774,7 @@ namespace vcpkg::Build AbiEntry{status_it->get()->package.spec.name(), status_it->get()->package.abi}); } - const auto pre_build_info = - PreBuildInfo::from_triplet_file(paths, triplet, config.scfl); + const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet, config.scfl); auto maybe_abi_tag_and_file = compute_abi_tag(paths, config, pre_build_info, dependency_abis); @@ -995,8 +983,7 @@ namespace vcpkg::Build BuildInfo read_build_info(const Files::Filesystem& fs, const fs::path& filepath) { - const Expected pghs = - Paragraphs::get_single_paragraph(fs, filepath); + const Expected pghs = Paragraphs::get_single_paragraph(fs, filepath); Checks::check_exit(VCPKG_LINE_INFO, pghs.get() != nullptr, "Invalid BUILD_INFO file for package"); return inner_create_buildinfo(*pghs.get()); } @@ -1015,14 +1002,11 @@ namespace vcpkg::Build if (port) { - args.emplace_back( - "CMAKE_ENV_OVERRIDES_FILE", - port.value_or_exit(VCPKG_LINE_INFO).source_location / "environment-overrides.cmake"); + args.emplace_back("CMAKE_ENV_OVERRIDES_FILE", + port.value_or_exit(VCPKG_LINE_INFO).source_location / "environment-overrides.cmake"); } - const auto cmd_launch_cmake = System::make_cmake_cmd(cmake_exe_path, - ports_cmake_script_path, - args); + const auto cmd_launch_cmake = System::make_cmake_cmd(cmake_exe_path, ports_cmake_script_path, args); const auto ec_data = System::cmd_execute_and_capture_output(cmd_launch_cmake); Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, ec_data.output); @@ -1054,41 +1038,39 @@ namespace vcpkg::Build { switch (maybe_option->second) { - case VcpkgTripletVar::TARGET_ARCHITECTURE : - pre_build_info.target_architecture = variable_value; - break; - case VcpkgTripletVar::CMAKE_SYSTEM_NAME : - pre_build_info.cmake_system_name = variable_value; - break; - case VcpkgTripletVar::CMAKE_SYSTEM_VERSION : - pre_build_info.cmake_system_version = variable_value; - break; - case VcpkgTripletVar::PLATFORM_TOOLSET : - pre_build_info.platform_toolset = - variable_value.empty() ? nullopt : Optional{variable_value}; - break; - case VcpkgTripletVar::VISUAL_STUDIO_PATH : - pre_build_info.visual_studio_path = - variable_value.empty() ? nullopt : Optional{variable_value}; - break; - case VcpkgTripletVar::CHAINLOAD_TOOLCHAIN_FILE : - pre_build_info.external_toolchain_file = - variable_value.empty() ? nullopt : Optional{variable_value}; - break; - case VcpkgTripletVar::BUILD_TYPE : - if (variable_value.empty()) - pre_build_info.build_type = nullopt; - else if (Strings::case_insensitive_ascii_equals(variable_value, "debug")) - pre_build_info.build_type = ConfigurationType::DEBUG; - else if (Strings::case_insensitive_ascii_equals(variable_value, "release")) - pre_build_info.build_type = ConfigurationType::RELEASE; - else - Checks::exit_with_message( + case VcpkgTripletVar::TARGET_ARCHITECTURE: + pre_build_info.target_architecture = variable_value; + break; + case VcpkgTripletVar::CMAKE_SYSTEM_NAME: pre_build_info.cmake_system_name = variable_value; break; + case VcpkgTripletVar::CMAKE_SYSTEM_VERSION: + pre_build_info.cmake_system_version = variable_value; + break; + case VcpkgTripletVar::PLATFORM_TOOLSET: + pre_build_info.platform_toolset = + variable_value.empty() ? nullopt : Optional{variable_value}; + break; + case VcpkgTripletVar::VISUAL_STUDIO_PATH: + pre_build_info.visual_studio_path = + variable_value.empty() ? nullopt : Optional{variable_value}; + break; + case VcpkgTripletVar::CHAINLOAD_TOOLCHAIN_FILE: + pre_build_info.external_toolchain_file = + variable_value.empty() ? nullopt : Optional{variable_value}; + break; + case VcpkgTripletVar::BUILD_TYPE: + if (variable_value.empty()) + pre_build_info.build_type = nullopt; + else if (Strings::case_insensitive_ascii_equals(variable_value, "debug")) + pre_build_info.build_type = ConfigurationType::DEBUG; + else if (Strings::case_insensitive_ascii_equals(variable_value, "release")) + pre_build_info.build_type = ConfigurationType::RELEASE; + else + Checks::exit_with_message( VCPKG_LINE_INFO, "Unknown setting for VCPKG_BUILD_TYPE: %s", variable_value); - break; - case VcpkgTripletVar::ENV_PASSTHROUGH : - pre_build_info.passthrough_env_vars = Strings::split(variable_value, ";"); - break; + break; + case VcpkgTripletVar::ENV_PASSTHROUGH: + pre_build_info.passthrough_env_vars = Strings::split(variable_value, ";"); + break; } } else @@ -1097,8 +1079,7 @@ namespace vcpkg::Build } } - pre_build_info.triplet_abi_tag = - get_triplet_abi(paths, pre_build_info, triplet); + pre_build_info.triplet_abi_tag = get_triplet_abi(paths, pre_build_info, triplet); return pre_build_info; } diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index b4290baab21..f0f162f5ce2 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -236,12 +236,7 @@ namespace vcpkg::Commands::CI { auto triplet = p->spec.triplet(); - const Build::BuildPackageConfig build_config{ - *scfl, - triplet, - build_options, - p->feature_list - }; + const Build::BuildPackageConfig build_config{*scfl, triplet, build_options, p->feature_list}; auto dependency_abis = Util::fmap(p->computed_dependencies, [&](const PackageSpec& spec) -> Build::AbiEntry { @@ -253,14 +248,7 @@ namespace vcpkg::Commands::CI return {spec.name(), it->second}; }); const auto& pre_build_info = pre_build_info_cache.get_lazy( - triplet, - [&]() { - return Build::PreBuildInfo::from_triplet_file( - paths, - triplet, - *scfl); - } - ); + triplet, [&]() { return Build::PreBuildInfo::from_triplet_file(paths, triplet, *scfl); }); auto maybe_tag_and_file = Build::compute_abi_tag(paths, build_config, pre_build_info, dependency_abis); @@ -362,7 +350,7 @@ namespace vcpkg::Commands::CI } StatusParagraphs status_db = database_load_check(paths); - + Dependencies::PathsPortFileProvider provider(paths, args.overlay_ports.get()); const Build::BuildPackageOptions install_plan_options = { diff --git a/toolsrc/src/vcpkg/commands.dependinfo.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp index 8394e0166d1..7c04a5a2f3c 100644 --- a/toolsrc/src/vcpkg/commands.dependinfo.cpp +++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp @@ -5,12 +5,12 @@ #include #include #include -#include #include +#include -#include #include #include +#include using vcpkg::Dependencies::PathsPortFileProvider; @@ -171,14 +171,14 @@ namespace vcpkg::Commands::DependInfo { if (requested_feature_name == "*") { - for (auto &&feature_paragraph : (*source_control_file)->feature_paragraphs) + for (auto&& feature_paragraph : (*source_control_file)->feature_paragraphs) { collected_features.insert(std::addressof(Util::as_const(*feature_paragraph))); } continue; } auto maybe_feature = (*source_control_file)->find_feature(requested_feature_name); - if (auto &&feature_paragraph = maybe_feature.get()) + if (auto&& feature_paragraph = maybe_feature.get()) { collected_features.insert(std::addressof(Util::as_const(*feature_paragraph))); } @@ -197,7 +197,8 @@ namespace vcpkg::Commands::DependInfo { for (const auto& dependency : feature_paragraph->depends) { - build_dependencies_list(packages_to_keep, dependency.depend.name, source_control_files, switches); + build_dependencies_list( + packages_to_keep, dependency.depend.name, source_control_files, switches); } } } @@ -214,9 +215,9 @@ namespace vcpkg::Commands::DependInfo // TODO: Optimize implementation, current implementation needs to load all ports from disk which is too slow. PathsPortFileProvider provider(paths, args.overlay_ports.get()); - auto source_control_files = Util::fmap(provider.load_all_control_files(), [](auto&& scfl) -> const SourceControlFile * { - return scfl->source_control_file.get(); - }); + auto source_control_files = + Util::fmap(provider.load_all_control_files(), + [](auto&& scfl) -> const SourceControlFile* { return scfl->source_control_file.get(); }); if (args.command_arguments.size() >= 1) { diff --git a/toolsrc/src/vcpkg/commands.search.cpp b/toolsrc/src/vcpkg/commands.search.cpp index 3d8387ee128..943233502cd 100644 --- a/toolsrc/src/vcpkg/commands.search.cpp +++ b/toolsrc/src/vcpkg/commands.search.cpp @@ -2,12 +2,12 @@ #include #include +#include #include #include #include #include #include -#include using vcpkg::Dependencies::PathsPortFileProvider; @@ -67,9 +67,9 @@ namespace vcpkg::Commands::Search const bool full_description = Util::Sets::contains(options.switches, OPTION_FULLDESC); PathsPortFileProvider provider(paths, args.overlay_ports.get()); - auto source_paragraphs = Util::fmap(provider.load_all_control_files(), [](auto&& port) -> const SourceControlFile * { - return port->source_control_file.get(); - }); + auto source_paragraphs = + Util::fmap(provider.load_all_control_files(), + [](auto&& port) -> const SourceControlFile* { return port->source_control_file.get(); }); if (args.command_arguments.empty()) { diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index b604c9acfe3..65c5cc98541 100644 --- a/toolsrc/src/vcpkg/dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -108,9 +108,8 @@ namespace vcpkg::Dependencies static ClusterSource cluster_from_scf(const SourceControlFileLocation& scfl, Triplet t) { ClusterSource ret; - ret.build_edges.emplace("core", - filter_dependencies_to_specs(scfl.source_control_file->core_paragraph->depends, - t)); + ret.build_edges.emplace("core", + filter_dependencies_to_specs(scfl.source_control_file->core_paragraph->depends, t)); for (const auto& feature : scfl.source_control_file->feature_paragraphs) ret.build_edges.emplace(feature->name, filter_dependencies_to_specs(feature->depends, t)); @@ -123,22 +122,23 @@ namespace vcpkg::Dependencies const PortFileProvider& m_provider; }; - std::string to_output_string(RequestType request_type, - const CStringView s, - const Build::BuildPackageOptions& options, + std::string to_output_string(RequestType request_type, + const CStringView s, + const Build::BuildPackageOptions& options, const fs::path& install_port_path, const fs::path& default_port_path) { - if (!default_port_path.empty() - && !Strings::case_insensitive_ascii_starts_with(install_port_path.u8string(), - default_port_path.u8string())) + if (!default_port_path.empty() && + !Strings::case_insensitive_ascii_starts_with(install_port_path.u8string(), default_port_path.u8string())) { const char* const from_head = options.use_head_version == Build::UseHeadVersion::YES ? " (from HEAD)" : ""; switch (request_type) { - case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s -- %s", s, from_head, install_port_path.u8string()); - case RequestType::USER_REQUESTED: return Strings::format(" %s%s -- %s", s, from_head, install_port_path.u8string()); - default: Checks::unreachable(VCPKG_LINE_INFO); + case RequestType::AUTO_SELECTED: + return Strings::format(" * %s%s -- %s", s, from_head, install_port_path.u8string()); + case RequestType::USER_REQUESTED: + return Strings::format(" %s%s -- %s", s, from_head, install_port_path.u8string()); + default: Checks::unreachable(VCPKG_LINE_INFO); } } return to_output_string(request_type, s, options); @@ -152,7 +152,7 @@ namespace vcpkg::Dependencies switch (request_type) { - case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s", s, from_head); + case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s", s, from_head); case RequestType::USER_REQUESTED: return Strings::format(" %s%s", s, from_head); default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -162,7 +162,7 @@ namespace vcpkg::Dependencies { switch (request_type) { - case RequestType::AUTO_SELECTED: return Strings::format(" * %s", s); + case RequestType::AUTO_SELECTED: return Strings::format(" * %s", s); case RequestType::USER_REQUESTED: return Strings::format(" %s", s); default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -293,7 +293,8 @@ namespace vcpkg::Dependencies MapPortFileProvider::MapPortFileProvider(const std::unordered_map& map) : ports(map) - {} + { + } Optional MapPortFileProvider::get_control_file(const std::string& spec) const { @@ -304,11 +305,11 @@ namespace vcpkg::Dependencies std::vector MapPortFileProvider::load_all_control_files() const { - return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileLocation * { return &kvpair.second; }); + return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileLocation* { return &kvpair.second; }); } PathsPortFileProvider::PathsPortFileProvider(const vcpkg::VcpkgPaths& paths, - const std::vector* ports_dirs_paths) + const std::vector* ports_dirs_paths) : filesystem(paths.get_filesystem()) { if (ports_dirs_paths) @@ -325,7 +326,7 @@ namespace vcpkg::Dependencies overlay.string()); Checks::check_exit(VCPKG_LINE_INFO, - fs::stdfs::is_directory(overlay), + fs::is_directory(status(overlay)), "Error: Path \"%s\" must be a directory", overlay.string()); @@ -354,7 +355,7 @@ namespace vcpkg::Dependencies { if (scf->get()->core_paragraph->name == spec) { - SourceControlFileLocation scfl{ std::move(*scf), ports_dir }; + SourceControlFileLocation scfl{std::move(*scf), ports_dir}; auto it = cache.emplace(spec, std::move(scfl)); return it.first->second; } @@ -362,9 +363,8 @@ namespace vcpkg::Dependencies else { vcpkg::print_error_message(maybe_scf.error()); - Checks::exit_with_message(VCPKG_LINE_INFO, - "Error: Failed to load port from %s", - spec, ports_dir.u8string()); + Checks::exit_with_message( + VCPKG_LINE_INFO, "Error: Failed to load port from %s", spec, ports_dir.u8string()); } } @@ -373,7 +373,7 @@ namespace vcpkg::Dependencies { if (scf->get()->core_paragraph->name == spec) { - SourceControlFileLocation scfl{ std::move(*scf), ports_dir / spec }; + SourceControlFileLocation scfl{std::move(*scf), ports_dir / spec}; auto it = cache.emplace(spec, std::move(scfl)); return it.first->second; } @@ -399,7 +399,7 @@ namespace vcpkg::Dependencies auto port_name = scf->get()->core_paragraph->name; if (cache.find(port_name) == cache.end()) { - SourceControlFileLocation scfl{ std::move(*scf), ports_dir }; + SourceControlFileLocation scfl{std::move(*scf), ports_dir}; auto it = cache.emplace(port_name, std::move(scfl)); ret.emplace_back(&it.first->second); } @@ -407,9 +407,8 @@ namespace vcpkg::Dependencies else { vcpkg::print_error_message(maybe_scf.error()); - Checks::exit_with_message(VCPKG_LINE_INFO, - "Error: Failed to load port from %s", - ports_dir.u8string()); + Checks::exit_with_message( + VCPKG_LINE_INFO, "Error: Failed to load port from %s", ports_dir.u8string()); } continue; } @@ -421,7 +420,7 @@ namespace vcpkg::Dependencies auto port_name = scf->core_paragraph->name; if (cache.find(port_name) == cache.end()) { - SourceControlFileLocation scfl{ std::move(scf), ports_dir / port_name }; + SourceControlFileLocation scfl{std::move(scf), ports_dir / port_name}; auto it = cache.emplace(port_name, std::move(scfl)); ret.emplace_back(&it.first->second); } @@ -768,9 +767,10 @@ namespace vcpkg::Dependencies /// Map of all source control files in the current environment. /// Feature specifications to resolve dependencies for. /// Status of installed packages in the current environment. - std::vector create_feature_install_plan(const std::unordered_map& map, - const std::vector& specs, - const StatusParagraphs& status_db) + std::vector create_feature_install_plan( + const std::unordered_map& map, + const std::vector& specs, + const StatusParagraphs& status_db) { MapPortFileProvider provider(map); return create_feature_install_plan(provider, specs, status_db); @@ -832,9 +832,8 @@ namespace vcpkg::Dependencies { // If it will be transiently uninstalled, we need to issue a full installation command auto* pscfl = p_cluster->source.value_or_exit(VCPKG_LINE_INFO).scfl; - Checks::check_exit(VCPKG_LINE_INFO, - pscfl != nullptr, - "Error: Expected a SourceControlFileLocation to exist"); + Checks::check_exit( + VCPKG_LINE_INFO, pscfl != nullptr, "Error: Expected a SourceControlFileLocation to exist"); auto&& scfl = *pscfl; auto dep_specs = Util::fmap(m_graph_plan->install_graph.adjacency_list(p_cluster), @@ -914,7 +913,9 @@ namespace vcpkg::Dependencies PackageGraph::~PackageGraph() = default; - void print_plan(const std::vector& action_plan, const bool is_recursive, const fs::path& default_ports_dir) + void print_plan(const std::vector& action_plan, + const bool is_recursive, + const fs::path& default_ports_dir) { std::vector remove_plans; std::vector rebuilt_plans; @@ -971,13 +972,10 @@ namespace vcpkg::Dependencies static auto actions_to_output_string = [&](const std::vector& v) { return Strings::join("\n", v, [&](const InstallPlanAction* p) { - if (auto * pscfl = p->source_control_file_location.get()) + if (auto* pscfl = p->source_control_file_location.get()) { - return to_output_string(p->request_type, - p->displayname(), - p->build_options, - pscfl->source_location, - default_ports_dir); + return to_output_string( + p->request_type, p->displayname(), p->build_options, pscfl->source_location, default_ports_dir); } return to_output_string(p->request_type, p->displayname(), p->build_options); diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 32af57b39df..165f13126a6 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -331,10 +331,8 @@ namespace vcpkg::Install auto result = [&]() -> Build::ExtendedBuildResult { const auto& scfl = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO); - const Build::BuildPackageConfig build_config{scfl, - action.spec.triplet(), - action.build_options, - action.feature_list}; + const Build::BuildPackageConfig build_config{ + scfl, action.spec.triplet(), action.build_options, action.feature_list}; return Build::build_package(paths, build_config, status_db); }(); diff --git a/toolsrc/src/vcpkg/logicexpression.cpp b/toolsrc/src/vcpkg/logicexpression.cpp index fc8c4ef56dd..0cf08ee0395 100644 --- a/toolsrc/src/vcpkg/logicexpression.cpp +++ b/toolsrc/src/vcpkg/logicexpression.cpp @@ -1,21 +1,18 @@ #include "pch.h" -#include #include #include +#include #include #include - namespace vcpkg { struct ParseError { - ParseError(int column, std::string line, std::string message) - :column(column), line(line), message(message) - {} + ParseError(int column, std::string line, std::string message) : column(column), line(line), message(message) {} const int column; const std::string line; @@ -24,9 +21,15 @@ namespace vcpkg void print_error() const { System::print2(System::Color::error, - "Error: ", message, "\n" - " on expression: \"", line, "\"\n", - " ", std::string(column, ' '), "^\n"); + "Error: ", + message, + "\n" + " on expression: \"", + line, + "\"\n", + " ", + std::string(column, ' '), + "^\n"); Checks::exit_fail(VCPKG_LINE_INFO); } }; @@ -36,7 +39,7 @@ namespace vcpkg // ( logic-expression ) // identifier // identifier: - // alpha-numeric string of characters + // alpha-numeric string of characters // logic-expression: <- this is the entry point // not-expression // not-expression | logic-expression @@ -69,27 +72,20 @@ namespace vcpkg } } - bool get_result() const - { - return final_result; - } + bool get_result() const { return final_result; } - bool has_error() const - { - return err == nullptr; - } + bool has_error() const { return err == nullptr; } private: - bool final_result; std::string::const_iterator current_iter; const std::string& raw_text; - char current_char; + char current_char; - const std::string& evaluation_context; + const std::string& evaluation_context; - std::unique_ptr err; + std::unique_ptr err; void add_error(std::string message, int column = -1) { @@ -107,10 +103,7 @@ namespace vcpkg skip_to_end(); } - int current_column() const - { - return static_cast(current_iter - raw_text.begin()); - } + int current_column() const { return static_cast(current_iter - raw_text.begin()); } void go_to_begin() { @@ -127,10 +120,7 @@ namespace vcpkg current_iter = raw_text.end(); current_char = '\0'; } - char current() const - { - return current_char; - } + char current() const { return current_char; } char next() { if (current_char != '\0') @@ -165,7 +155,7 @@ namespace vcpkg } // identifier: - // alpha-numeric string of characters + // alpha-numeric string of characters bool identifier_expression() { auto curr = current(); @@ -181,7 +171,7 @@ namespace vcpkg add_error("Invalid logic expression, unexpected character"); return false; } - + bool result = evaluate_identifier(name); skip_whitespace(); return result; @@ -201,14 +191,15 @@ namespace vcpkg return primary_expression(); } - - template + template bool logic_expression_helper(bool seed) { do { // Support chains of the operator to avoid breaking backwards compatability - while (next() == oper) {}; + while (next() == oper) + { + }; seed = operation(not_expression(), seed); } while (current() == oper); @@ -218,17 +209,11 @@ namespace vcpkg add_error("Mixing & and | is not allowed, Use () to specify order of operations."); } - skip_whitespace(); + skip_whitespace(); return seed; } - static bool and_helper(bool left, bool right) - { - return left && right; - } - static bool or_helper(bool left, bool right) - { - return left || right; - } + static bool and_helper(bool left, bool right) { return left && right; } + static bool or_helper(bool left, bool right) { return left || right; } // logic-expression: <- entry point // not-expression @@ -240,16 +225,15 @@ namespace vcpkg switch (current()) { - case '|': - { - return logic_expression_helper< '|', '&', or_helper > (result); - } - case '&': - { - return logic_expression_helper< '&', '|', and_helper > (result); - } - default: - return result; + case '|': + { + return logic_expression_helper<'|', '&', or_helper>(result); + } + case '&': + { + return logic_expression_helper<'&', '|', and_helper>(result); + } + default: return result; } } @@ -275,7 +259,6 @@ namespace vcpkg } }; - bool evaluate_expression(const std::string& expression, const std::string& evaluation_context) { ExpressionParser parser(expression, evaluation_context); diff --git a/toolsrc/src/vcpkg/paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp index b08a6b805c0..1232b940a91 100644 --- a/toolsrc/src/vcpkg/paragraphs.cpp +++ b/toolsrc/src/vcpkg/paragraphs.cpp @@ -166,8 +166,7 @@ namespace vcpkg::Paragraphs Expected parse_single_paragraph(const std::string& str) { - const std::vector p = - Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); + const std::vector p = Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); if (p.size() == 1) { @@ -177,8 +176,7 @@ namespace vcpkg::Paragraphs return std::error_code(ParagraphParseResult::EXPECTED_ONE_PARAGRAPH); } - Expected get_single_paragraph(const Files::Filesystem& fs, - const fs::path& control_path) + Expected get_single_paragraph(const Files::Filesystem& fs, const fs::path& control_path) { const Expected contents = fs.read_contents(control_path); if (auto spgh = contents.get()) @@ -189,8 +187,7 @@ namespace vcpkg::Paragraphs return contents.error(); } - Expected> get_paragraphs(const Files::Filesystem& fs, - const fs::path& control_path) + Expected> get_paragraphs(const Files::Filesystem& fs, const fs::path& control_path) { const Expected contents = fs.read_contents(control_path); if (auto spgh = contents.get()) diff --git a/toolsrc/src/vcpkg/parse.cpp b/toolsrc/src/vcpkg/parse.cpp index 68fac0b0f5e..9c9968249a3 100644 --- a/toolsrc/src/vcpkg/parse.cpp +++ b/toolsrc/src/vcpkg/parse.cpp @@ -6,8 +6,7 @@ namespace vcpkg::Parse { - static Optional remove_field(RawParagraph* fields, - const std::string& fieldname) + static Optional remove_field(RawParagraph* fields, const std::string& fieldname) { auto it = fields->find(fieldname); if (it == fields->end()) diff --git a/toolsrc/src/vcpkg/remove.cpp b/toolsrc/src/vcpkg/remove.cpp index 84ec6c981b9..65e00668af9 100644 --- a/toolsrc/src/vcpkg/remove.cpp +++ b/toolsrc/src/vcpkg/remove.cpp @@ -73,7 +73,7 @@ namespace vcpkg::Remove if (ec) { #if defined(_WIN32) - fs::stdfs::permissions(target, fs::stdfs::perms::owner_all | fs::stdfs::perms::group_all, ec); + fs::stdfs::permissions(target, fs::perms::owner_all | fs::perms::group_all, ec); fs.remove(target, ec); if (ec) { @@ -86,7 +86,7 @@ namespace vcpkg::Remove #endif } } - else if (!fs::stdfs::exists(status)) + else if (!fs::exists(status)) { System::printf(System::Color::warning, "Warning: %s: file not found\n", target.u8string()); } diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp index a5054eb3b25..298095df60d 100644 --- a/toolsrc/src/vcpkg/sourceparagraph.cpp +++ b/toolsrc/src/vcpkg/sourceparagraph.cpp @@ -1,9 +1,9 @@ #include "pch.h" +#include #include #include #include -#include #include #include @@ -223,26 +223,25 @@ namespace vcpkg std::vector ret; for (auto&& dep : deps) { - const auto & qualifier = dep.qualifier; - if (qualifier.empty() || evaluate_expression(qualifier, t.canonical_name())) - { - ret.emplace_back(dep.name()); - } + const auto& qualifier = dep.qualifier; + if (qualifier.empty() || evaluate_expression(qualifier, t.canonical_name())) + { + ret.emplace_back(dep.name()); + } } return ret; } - std::vector filter_dependencies_to_features(const std::vector& deps, - const Triplet& t) + std::vector filter_dependencies_to_features(const std::vector& deps, const Triplet& t) { std::vector ret; for (auto&& dep : deps) { - const auto & qualifier = dep.qualifier; - if (qualifier.empty() || evaluate_expression(qualifier, t.canonical_name())) - { - ret.emplace_back(dep.depend); - } + const auto& qualifier = dep.qualifier; + if (qualifier.empty() || evaluate_expression(qualifier, t.canonical_name())) + { + ret.emplace_back(dep.depend); + } } return ret; } diff --git a/toolsrc/src/vcpkg/userconfig.cpp b/toolsrc/src/vcpkg/userconfig.cpp index 3551ae81e30..a3c019be7e8 100644 --- a/toolsrc/src/vcpkg/userconfig.cpp +++ b/toolsrc/src/vcpkg/userconfig.cpp @@ -51,7 +51,7 @@ namespace vcpkg { const auto& pghs = *p_pghs; - Parse::RawParagraph keys; + Parse::RawParagraph keys; if (pghs.size() > 0) keys = pghs[0]; for (size_t x = 1; x < pghs.size(); ++x) diff --git a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index 452c7ca19be..e48340df7a3 100644 --- a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -148,9 +148,8 @@ namespace vcpkg } if (Strings::starts_with(arg, "--scripts-root=")) { - parse_cojoined_value(arg.substr(sizeof("--scripts-root=") - 1), - "--scripts-root", - args.scripts_root_dir); + parse_cojoined_value( + arg.substr(sizeof("--scripts-root=") - 1), "--scripts-root", args.scripts_root_dir); continue; } if (arg == "--triplet") @@ -161,16 +160,14 @@ namespace vcpkg } if (Strings::starts_with(arg, "--overlay-ports=")) { - parse_cojoined_multivalue(arg.substr(sizeof("--overlay-ports=") - 1), - "--overlay-ports", - args.overlay_ports); + parse_cojoined_multivalue( + arg.substr(sizeof("--overlay-ports=") - 1), "--overlay-ports", args.overlay_ports); continue; } if (Strings::starts_with(arg, "--overlay-triplets=")) { - parse_cojoined_multivalue(arg.substr(sizeof("--overlay-triplets=") - 1), - "--overlay-triplets", - args.overlay_triplets); + parse_cojoined_multivalue( + arg.substr(sizeof("--overlay-triplets=") - 1), "--overlay-triplets", args.overlay_triplets); continue; } if (arg == "--debug") @@ -224,11 +221,11 @@ namespace vcpkg { const auto& key = arg.substr(0, eq_pos); const auto& value = arg.substr(eq_pos + 1); - + auto it = args.optional_command_arguments.find(key); if (args.optional_command_arguments.end() == it) { - args.optional_command_arguments.emplace(key, std::vector { value }); + args.optional_command_arguments.emplace(key, std::vector{value}); } else { @@ -370,8 +367,9 @@ namespace vcpkg { if (v.empty()) { - System::printf( - System::Color::error, "Error: The option '%s' must be passed an argument.\n", option.name); + System::printf(System::Color::error, + "Error: The option '%s' must be passed an argument.\n", + option.name); failed = true; } else @@ -425,12 +423,9 @@ namespace vcpkg System::printf(" %-40s %s\n", (option.name + "=..."), option.short_help_text); } System::printf(" %-40s %s\n", "--triplet ", "Set the default triplet for unqualified packages"); - System::printf(" %-40s %s\n", - "--overlay-ports=", - "Specify directories to be used when searching for ports"); - System::printf(" %-40s %s\n", - "--overlay-triplets=", - "Specify directories containing triplets files"); + System::printf( + " %-40s %s\n", "--overlay-ports=", "Specify directories to be used when searching for ports"); + System::printf(" %-40s %s\n", "--overlay-triplets=", "Specify directories containing triplets files"); System::printf(" %-40s %s\n", "--vcpkg-root ", "Specify the vcpkg directory to use instead of current directory or tool directory"); diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index d16acf2e8b1..c5b5749ffd6 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -42,7 +42,7 @@ namespace vcpkg if (auto odp = overriddenDownloadsPath.get()) { auto asPath = fs::u8path(*odp); - if (!fs::stdfs::is_directory(asPath)) + if (!fs::is_directory(status(asPath))) { Metrics::g_metrics.lock()->track_property("error", "Invalid VCPKG_DOWNLOADS override directory."); Checks::exit_with_message( @@ -71,12 +71,12 @@ namespace vcpkg { if (scripts_dir->empty() || !fs::stdfs::is_directory(*scripts_dir)) { - Metrics::g_metrics.lock()->track_property("error", "Invalid scripts override directory."); - Checks::exit_with_message( - VCPKG_LINE_INFO, - "Invalid scripts override directory: %s; " - "create that directory or unset --scripts-root to use the default scripts location.", - scripts_dir->u8string()); + Metrics::g_metrics.lock()->track_property("error", "Invalid scripts override directory."); + Checks::exit_with_message( + VCPKG_LINE_INFO, + "Invalid scripts override directory: %s; " + "create that directory or unset --scripts-root to use the default scripts location.", + scripts_dir->u8string()); } paths.scripts = *scripts_dir; @@ -147,26 +147,25 @@ namespace vcpkg } Util::sort_unique_erase(output); return output; - }); + }); } const fs::path VcpkgPaths::get_triplet_file_path(const Triplet& triplet) const { - return m_triplets_cache.get_lazy(triplet, [&]()-> auto { - for (auto&& triplet_dir : triplets_dirs) - { - auto&& path = triplet_dir / (triplet.canonical_name() + ".cmake"); - if (this->get_filesystem().exists(path)) + return m_triplets_cache.get_lazy( + triplet, [&]() -> auto { + for (auto&& triplet_dir : triplets_dirs) { - return path; + auto&& path = triplet_dir / (triplet.canonical_name() + ".cmake"); + if (this->get_filesystem().exists(path)) + { + return path; + } } - } - Checks::exit_with_message(VCPKG_LINE_INFO, - "Error: Triplet file %s.cmake not found", - triplet.canonical_name()); - }); - + Checks::exit_with_message( + VCPKG_LINE_INFO, "Error: Triplet file %s.cmake not found", triplet.canonical_name()); + }); } const fs::path& VcpkgPaths::get_tool_exe(const std::string& tool) const From f27820fa863fe17b98abf869477459609c69b32d Mon Sep 17 00:00:00 2001 From: Stijn Herfst Date: Thu, 8 Aug 2019 14:29:31 +0200 Subject: [PATCH 13/30] [stormlib] Add targets and streamline build (#7409) * Add targets and streamline build * Removed vendored dependencies * add back definition * updated version and removed duplication * [stormlib] update cmakelists * added unicode definitions * added win32 guard clause --- ports/stormlib/CMakeLists.txt | 279 ++++++++++++++++++++ ports/stormlib/CONTROL | 2 +- ports/stormlib/disable-building-tests.patch | 15 -- ports/stormlib/portfile.cmake | 13 +- 4 files changed, 287 insertions(+), 22 deletions(-) create mode 100644 ports/stormlib/CMakeLists.txt delete mode 100644 ports/stormlib/disable-building-tests.patch diff --git a/ports/stormlib/CMakeLists.txt b/ports/stormlib/CMakeLists.txt new file mode 100644 index 00000000000..6b0e2a66cd5 --- /dev/null +++ b/ports/stormlib/CMakeLists.txt @@ -0,0 +1,279 @@ +cmake_minimum_required(VERSION 3.9) +project(stormlib) + +set(SRC_FILES + stormlib_dll/StormLib.def + src/adpcm/adpcm.cpp + src/huffman/huff.cpp + src/jenkins/lookup3.c + src/lzma/C/LzFind.c + src/lzma/C/LzmaDec.c + src/lzma/C/LzmaEnc.c + src/pklib/explode.c + src/pklib/implode.c + src/sparse/sparse.cpp + src/FileStream.cpp + src/SBaseCommon.cpp + src/SBaseDumpData.cpp + src/SBaseFileTable.cpp + src/SBaseSubTypes.cpp + src/SCompression.cpp + src/SFileAddFile.cpp + src/SFileAttributes.cpp + src/SFileCompactArchive.cpp + src/SFileCreateArchive.cpp + src/SFileExtractFile.cpp + src/SFileFindFile.cpp + src/SFileGetFileInfo.cpp + src/SFileListFile.cpp + src/SFileOpenArchive.cpp + src/SFileOpenFileEx.cpp + src/SFilePatchArchives.cpp + src/SFileReadFile.cpp + src/SFileVerify.cpp + src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c + src/libtomcrypt/src/misc/crypt_libc.c +) + +if(MSVC) + # This file is used to create a DLL on windows + # Use BUILD_SHARED_LIBS to create StormLib.dll + set(STORM_DEF_FILES + stormlib_dll/StormLib.def + ) +endif() + +set(TOMCRYPT_FILES + src/libtomcrypt/src/hashes/hash_memory.c + src/libtomcrypt/src/hashes/md5.c + src/libtomcrypt/src/hashes/sha1.c + src/libtomcrypt/src/math/ltm_desc.c + src/libtomcrypt/src/math/multi.c + src/libtomcrypt/src/math/rand_prime.c + src/libtomcrypt/src/misc/base64_decode.c + src/libtomcrypt/src/misc/crypt_argchk.c + src/libtomcrypt/src/misc/crypt_find_hash.c + src/libtomcrypt/src/misc/crypt_find_prng.c + src/libtomcrypt/src/misc/crypt_hash_descriptor.c + src/libtomcrypt/src/misc/crypt_hash_is_valid.c + src/libtomcrypt/src/misc/crypt_ltc_mp_descriptor.c + src/libtomcrypt/src/misc/crypt_prng_descriptor.c + src/libtomcrypt/src/misc/crypt_prng_is_valid.c + src/libtomcrypt/src/misc/crypt_register_hash.c + src/libtomcrypt/src/misc/crypt_register_prng.c + src/libtomcrypt/src/misc/zeromem.c + src/libtomcrypt/src/pk/asn1/der_decode_bit_string.c + src/libtomcrypt/src/pk/asn1/der_decode_boolean.c + src/libtomcrypt/src/pk/asn1/der_decode_choice.c + src/libtomcrypt/src/pk/asn1/der_decode_ia5_string.c + src/libtomcrypt/src/pk/asn1/der_decode_integer.c + src/libtomcrypt/src/pk/asn1/der_decode_object_identifier.c + src/libtomcrypt/src/pk/asn1/der_decode_octet_string.c + src/libtomcrypt/src/pk/asn1/der_decode_printable_string.c + src/libtomcrypt/src/pk/asn1/der_decode_sequence_ex.c + src/libtomcrypt/src/pk/asn1/der_decode_sequence_flexi.c + src/libtomcrypt/src/pk/asn1/der_decode_sequence_multi.c + src/libtomcrypt/src/pk/asn1/der_decode_short_integer.c + src/libtomcrypt/src/pk/asn1/der_decode_utctime.c + src/libtomcrypt/src/pk/asn1/der_decode_utf8_string.c + src/libtomcrypt/src/pk/asn1/der_encode_bit_string.c + src/libtomcrypt/src/pk/asn1/der_encode_boolean.c + src/libtomcrypt/src/pk/asn1/der_encode_ia5_string.c + src/libtomcrypt/src/pk/asn1/der_encode_integer.c + src/libtomcrypt/src/pk/asn1/der_encode_object_identifier.c + src/libtomcrypt/src/pk/asn1/der_encode_octet_string.c + src/libtomcrypt/src/pk/asn1/der_encode_printable_string.c + src/libtomcrypt/src/pk/asn1/der_encode_sequence_ex.c + src/libtomcrypt/src/pk/asn1/der_encode_sequence_multi.c + src/libtomcrypt/src/pk/asn1/der_encode_set.c + src/libtomcrypt/src/pk/asn1/der_encode_setof.c + src/libtomcrypt/src/pk/asn1/der_encode_short_integer.c + src/libtomcrypt/src/pk/asn1/der_encode_utctime.c + src/libtomcrypt/src/pk/asn1/der_encode_utf8_string.c + src/libtomcrypt/src/pk/asn1/der_length_bit_string.c + src/libtomcrypt/src/pk/asn1/der_length_boolean.c + src/libtomcrypt/src/pk/asn1/der_length_ia5_string.c + src/libtomcrypt/src/pk/asn1/der_length_integer.c + src/libtomcrypt/src/pk/asn1/der_length_object_identifier.c + src/libtomcrypt/src/pk/asn1/der_length_octet_string.c + src/libtomcrypt/src/pk/asn1/der_length_printable_string.c + src/libtomcrypt/src/pk/asn1/der_length_sequence.c + src/libtomcrypt/src/pk/asn1/der_length_utctime.c + src/libtomcrypt/src/pk/asn1/der_sequence_free.c + src/libtomcrypt/src/pk/asn1/der_length_utf8_string.c + src/libtomcrypt/src/pk/asn1/der_length_short_integer.c + src/libtomcrypt/src/pk/ecc/ltc_ecc_map.c + src/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c + src/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c + src/libtomcrypt/src/pk/ecc/ltc_ecc_points.c + src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c + src/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c + src/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c + src/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c + src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c + src/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c + src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c + src/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c + src/libtomcrypt/src/pk/rsa/rsa_exptmod.c + src/libtomcrypt/src/pk/rsa/rsa_free.c + src/libtomcrypt/src/pk/rsa/rsa_import.c + src/libtomcrypt/src/pk/rsa/rsa_make_key.c + src/libtomcrypt/src/pk/rsa/rsa_sign_hash.c + src/libtomcrypt/src/pk/rsa/rsa_verify_hash.c +) + +set(TOMMATH_FILES + src/libtommath/bncore.c + src/libtommath/bn_fast_mp_invmod.c + src/libtommath/bn_fast_mp_montgomery_reduce.c + src/libtommath/bn_fast_s_mp_mul_digs.c + src/libtommath/bn_fast_s_mp_mul_high_digs.c + src/libtommath/bn_fast_s_mp_sqr.c + src/libtommath/bn_mp_2expt.c + src/libtommath/bn_mp_abs.c + src/libtommath/bn_mp_add.c + src/libtommath/bn_mp_addmod.c + src/libtommath/bn_mp_add_d.c + src/libtommath/bn_mp_and.c + src/libtommath/bn_mp_clamp.c + src/libtommath/bn_mp_clear.c + src/libtommath/bn_mp_clear_multi.c + src/libtommath/bn_mp_cmp.c + src/libtommath/bn_mp_cmp_d.c + src/libtommath/bn_mp_cmp_mag.c + src/libtommath/bn_mp_cnt_lsb.c + src/libtommath/bn_mp_copy.c + src/libtommath/bn_mp_count_bits.c + src/libtommath/bn_mp_div.c + src/libtommath/bn_mp_div_2.c + src/libtommath/bn_mp_div_2d.c + src/libtommath/bn_mp_div_3.c + src/libtommath/bn_mp_div_d.c + src/libtommath/bn_mp_dr_is_modulus.c + src/libtommath/bn_mp_dr_reduce.c + src/libtommath/bn_mp_dr_setup.c + src/libtommath/bn_mp_exch.c + src/libtommath/bn_mp_exptmod.c + src/libtommath/bn_mp_exptmod_fast.c + src/libtommath/bn_mp_expt_d.c + src/libtommath/bn_mp_exteuclid.c + src/libtommath/bn_mp_fread.c + src/libtommath/bn_mp_fwrite.c + src/libtommath/bn_mp_gcd.c + src/libtommath/bn_mp_get_int.c + src/libtommath/bn_mp_grow.c + src/libtommath/bn_mp_init.c + src/libtommath/bn_mp_init_copy.c + src/libtommath/bn_mp_init_multi.c + src/libtommath/bn_mp_init_set.c + src/libtommath/bn_mp_init_set_int.c + src/libtommath/bn_mp_init_size.c + src/libtommath/bn_mp_invmod.c + src/libtommath/bn_mp_invmod_slow.c + src/libtommath/bn_mp_is_square.c + src/libtommath/bn_mp_jacobi.c + src/libtommath/bn_mp_karatsuba_mul.c + src/libtommath/bn_mp_karatsuba_sqr.c + src/libtommath/bn_mp_lcm.c + src/libtommath/bn_mp_lshd.c + src/libtommath/bn_mp_mod.c + src/libtommath/bn_mp_mod_2d.c + src/libtommath/bn_mp_mod_d.c + src/libtommath/bn_mp_montgomery_calc_normalization.c + src/libtommath/bn_mp_montgomery_reduce.c + src/libtommath/bn_mp_montgomery_setup.c + src/libtommath/bn_mp_mul.c + src/libtommath/bn_mp_mulmod.c + src/libtommath/bn_mp_mul_2.c + src/libtommath/bn_mp_mul_2d.c + src/libtommath/bn_mp_mul_d.c + src/libtommath/bn_mp_neg.c + src/libtommath/bn_mp_n_root.c + src/libtommath/bn_mp_or.c + src/libtommath/bn_mp_prime_fermat.c + src/libtommath/bn_mp_prime_is_divisible.c + src/libtommath/bn_mp_prime_is_prime.c + src/libtommath/bn_mp_prime_miller_rabin.c + src/libtommath/bn_mp_prime_next_prime.c + src/libtommath/bn_mp_prime_rabin_miller_trials.c + src/libtommath/bn_mp_prime_random_ex.c + src/libtommath/bn_mp_radix_size.c + src/libtommath/bn_mp_radix_smap.c + src/libtommath/bn_mp_rand.c + src/libtommath/bn_mp_read_radix.c + src/libtommath/bn_mp_read_signed_bin.c + src/libtommath/bn_mp_read_unsigned_bin.c + src/libtommath/bn_mp_reduce.c + src/libtommath/bn_mp_reduce_2k.c + src/libtommath/bn_mp_reduce_2k_l.c + src/libtommath/bn_mp_reduce_2k_setup.c + src/libtommath/bn_mp_reduce_2k_setup_l.c + src/libtommath/bn_mp_reduce_is_2k.c + src/libtommath/bn_mp_reduce_is_2k_l.c + src/libtommath/bn_mp_reduce_setup.c + src/libtommath/bn_mp_rshd.c + src/libtommath/bn_mp_set.c + src/libtommath/bn_mp_set_int.c + src/libtommath/bn_mp_shrink.c + src/libtommath/bn_mp_signed_bin_size.c + src/libtommath/bn_mp_sqr.c + src/libtommath/bn_mp_sqrmod.c + src/libtommath/bn_mp_sqrt.c + src/libtommath/bn_mp_sub.c + src/libtommath/bn_mp_submod.c + src/libtommath/bn_mp_sub_d.c + src/libtommath/bn_mp_toom_mul.c + src/libtommath/bn_mp_toom_sqr.c + src/libtommath/bn_mp_toradix.c + src/libtommath/bn_mp_toradix_n.c + src/libtommath/bn_mp_to_signed_bin.c + src/libtommath/bn_mp_to_signed_bin_n.c + src/libtommath/bn_mp_to_unsigned_bin.c + src/libtommath/bn_mp_to_unsigned_bin_n.c + src/libtommath/bn_mp_unsigned_bin_size.c + src/libtommath/bn_mp_xor.c + src/libtommath/bn_mp_zero.c + src/libtommath/bn_prime_tab.c + src/libtommath/bn_reverse.c + src/libtommath/bn_s_mp_add.c + src/libtommath/bn_s_mp_exptmod.c + src/libtommath/bn_s_mp_mul_digs.c + src/libtommath/bn_s_mp_mul_high_digs.c + src/libtommath/bn_s_mp_sqr.c + src/libtommath/bn_s_mp_sub.c +) + +find_package(ZLIB REQUIRED) +find_package(BZip2 REQUIRED) + +if(WIN32) + set(LINK_LIBS wininet) +endif() + +list(APPEND LINK_LIBS ZLIB::ZLIB BZip2::BZip2) + +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + message(STATUS "Using FreeBSD port") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DO_LARGEFILE=0 -Dstat64=stat -Dlstat64=lstat -Dlseek64=lseek -Doff64_t=off_t -Dfstat64=fstat -Dftruncate64=ftruncate") +endif() + +add_library(stormlib ${LIB_TYPE} ${SRC_FILES} ${TOMCRYPT_FILES} ${TOMMATH_FILES} ${STORM_DEF_FILES}) +add_definitions(-D__SYS_ZLIB -D__SYS_BZLIB) + +target_link_libraries(stormlib PRIVATE ${LINK_LIBS}) + +target_compile_definitions(stormlib PRIVATE _7ZIP_ST BZ_STRICT_ANSI) + +if(WIN32) + target_compile_definitions(stormlib PRIVATE UNICODE _UNICODE) +endif() + +set_target_properties(stormlib PROPERTIES PUBLIC_HEADER "src/StormLib.h;src/StormPort.h") + +install(TARGETS stormlib EXPORT stormlibConfig + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib +) + +install(EXPORT stormlibConfig NAMESPACE stormlib:: DESTINATION share/stormlib) \ No newline at end of file diff --git a/ports/stormlib/CONTROL b/ports/stormlib/CONTROL index 348e096167e..beb6fd3c12f 100644 --- a/ports/stormlib/CONTROL +++ b/ports/stormlib/CONTROL @@ -1,4 +1,4 @@ Source: stormlib -Version: 9.22 +Version: 2019-05-10 Build-Depends: zlib, bzip2 Description: StormLib is a library for opening and manipulating Blizzard MPQ files diff --git a/ports/stormlib/disable-building-tests.patch b/ports/stormlib/disable-building-tests.patch deleted file mode 100644 index fe0d7f70c6a..00000000000 --- a/ports/stormlib/disable-building-tests.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f5211b1..4025ea1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -358,10 +358,4 @@ install(TARGETS ${LIBRARY_NAME} - - INCLUDE(CPack) - --if(STORM_BUILD_TESTS) -- target_link_libraries(storm_test ${LIBRARY_NAME}) -- install(TARGETS storm_test DESTINATION bin) --endif() - --add_executable(storm_test ${SRC_FILES} ${TOMCRYPT_FILES} ${TOMMATH_FILES} ${ZLIB_BZIP2_FILES} ${TEST_SRC_FILES}) --install(TARGETS storm_test RUNTIME DESTINATION bin) diff --git a/ports/stormlib/portfile.cmake b/ports/stormlib/portfile.cmake index 82e0aedf9f8..d0e9e36a491 100644 --- a/ports/stormlib/portfile.cmake +++ b/ports/stormlib/portfile.cmake @@ -3,15 +3,14 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ladislav-zezula/StormLib - REF v9.22 - SHA512 e08571fca21be2e853d390b8feda32001df810b8f4b60d36822a9de2a877f2be9d3dadacfeec181a2eb80e00b8fed66d0dc9a0d8d9e043e2959478a41ed4d13a + REF 2f0e0e69e6b3739d7c450ac3d38816aee45ac3c2 + SHA512 54cbe4270963944edf3d75b845047add2b004e0d95b20b75a4c4790c2a12a41bf19cc4f55aaeaec697a0a913827e11cfabde2123b2b13730556310dd89eef1e9 HEAD_REF master ) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/disable-building-tests.patch +file(COPY + ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt + DESTINATION ${SOURCE_PATH} ) vcpkg_configure_cmake( @@ -20,5 +19,7 @@ vcpkg_configure_cmake( ) vcpkg_install_cmake() + file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/stormlib RENAME copyright) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +vcpkg_fixup_cmake_targets() \ No newline at end of file From 945717ce513081e381746763646eb504d7a68cac Mon Sep 17 00:00:00 2001 From: Phoebe <925731795@qq.com> Date: Thu, 8 Aug 2019 20:44:17 +0800 Subject: [PATCH 14/30] [openimageio] Fix feature libraw build errors (#7419) * [openimageio] Fix feature libraw build errors * Update to master latest commit --- ports/openimageio/CONTROL | 2 +- ports/openimageio/portfile.cmake | 4 +-- .../openimageio/remove_wrong_dependency.patch | 30 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ports/openimageio/CONTROL b/ports/openimageio/CONTROL index ceb4b94085e..3b864bea032 100644 --- a/ports/openimageio/CONTROL +++ b/ports/openimageio/CONTROL @@ -1,5 +1,5 @@ Source: openimageio -Version: 2.0.8 +Version: 2019-08-08 Homepage: https://github.com/OpenImageIO/oiio Description: A library for reading and writing images, and a bunch of related classes, utilities, and application Build-Depends: libjpeg-turbo, tiff, libpng, openexr, boost-thread, boost-smart-ptr, boost-foreach, boost-regex, boost-type-traits, boost-static-assert, boost-unordered, boost-config, boost-algorithm, boost-filesystem, boost-system, boost-thread, boost-asio, boost-random, robin-map, boost-stacktrace diff --git a/ports/openimageio/portfile.cmake b/ports/openimageio/portfile.cmake index e40441e4cb1..3053af3fa48 100644 --- a/ports/openimageio/portfile.cmake +++ b/ports/openimageio/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO OpenImageIO/oiio - REF Release-2.0.8 - SHA512 412d240916780b784b89d9eeb36b5b9451e8448100fce494c0d95f0b274506d2946cae0eb929dbe8118b8b04a8bd2a926270a971aad7d0542abcff5f35404953 + REF ad1ab61a56c63d770e4beb335efe8b1f1a9e36cd + SHA512 48ee7862583e7adb86b56b20634c34aebf83ef0a3a14ad96182494ce6a84cb027334840a6c4c335e9342110c3a36532e3eeae22a3ed7363cd91b27cb7ca58154 HEAD_REF master PATCHES fix_libraw.patch diff --git a/ports/openimageio/remove_wrong_dependency.patch b/ports/openimageio/remove_wrong_dependency.patch index 307ef1decfe..5338c6563c9 100644 --- a/ports/openimageio/remove_wrong_dependency.patch +++ b/ports/openimageio/remove_wrong_dependency.patch @@ -1,15 +1,15 @@ -diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt -index 61ed97b..4435426 100644 ---- a/src/libOpenImageIO/CMakeLists.txt -+++ b/src/libOpenImageIO/CMakeLists.txt -@@ -164,10 +164,6 @@ if (WIN32) - target_link_libraries (OpenImageIO psapi.lib) - endif () - --if (VISIBILITY_MAP_FILE) -- add_dependencies (OpenImageIO "${VISIBILITY_MAP_FILE}") --endif () -- - if (USE_EXTERNAL_PUGIXML) - target_link_libraries (OpenImageIO ${PUGIXML_LIBRARIES}) - endif () +diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt +index 5449675..cdd5235 100644 +--- a/src/libOpenImageIO/CMakeLists.txt ++++ b/src/libOpenImageIO/CMakeLists.txt +@@ -171,10 +171,6 @@ elseif(MINGW) + target_link_libraries (OpenImageIO psapi ws2_32) + endif () + +-if (VISIBILITY_MAP_FILE) +- add_dependencies (OpenImageIO "${VISIBILITY_MAP_FILE}") +-endif () +- + if (USE_EXTERNAL_PUGIXML) + target_link_libraries (OpenImageIO ${PUGIXML_LIBRARIES}) + endif () From 0857d713a088bff086f7b008e5d7670329733f94 Mon Sep 17 00:00:00 2001 From: Lily <47812810+wangli28@users.noreply.github.com> Date: Thu, 8 Aug 2019 23:15:09 +0800 Subject: [PATCH 15/30] [pdqsort] Add new port (#7464) * [pdqsort] Add new port * [pdqsort] Add new port --- ports/pdqsort/CONTROL | 4 ++++ ports/pdqsort/portfile.cmake | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 ports/pdqsort/CONTROL create mode 100644 ports/pdqsort/portfile.cmake diff --git a/ports/pdqsort/CONTROL b/ports/pdqsort/CONTROL new file mode 100644 index 00000000000..6d1d9e6601b --- /dev/null +++ b/ports/pdqsort/CONTROL @@ -0,0 +1,4 @@ +Source: pdqsort +Version: 2019-07-30 +Homepage: https://github.com/orlp/pdqsort +Description: Pattern-defeating quicksort (pdqsort) is a novel sorting algorithm diff --git a/ports/pdqsort/portfile.cmake b/ports/pdqsort/portfile.cmake new file mode 100644 index 00000000000..a9c6a92118e --- /dev/null +++ b/ports/pdqsort/portfile.cmake @@ -0,0 +1,15 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO orlp/pdqsort + REF 08879029ab8dcb80a70142acb709e3df02de5d37 + SHA512 38e8b6e35edf1e88e26850a13ce892d8adc0d3e1d7954287d024b3bb858a6b2284e25fbf7c92a694b3ec77cacaf6bbc27fc365187115f7cca6bc88088f67a18f + HEAD_REF master +) + +file(COPY ${SOURCE_PATH}/pdqsort.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/pdqsort) + +# Handle copyright +file(COPY ${SOURCE_PATH}/license.txt ${SOURCE_PATH}/readme.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/pdqsort) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/pdqsort/license.txt ${CURRENT_PACKAGES_DIR}/share/pdqsort/copyright) \ No newline at end of file From 73fa03965bf1a54a779f24ea1be1660e246db6ab Mon Sep 17 00:00:00 2001 From: Rodrigo Trida <44525262+rotrida@users.noreply.github.com> Date: Thu, 8 Aug 2019 17:02:10 +0100 Subject: [PATCH 16/30] Librdkafka snappy (#7469) * Adding snappy support. * Building without win 32 config. * Restoring original state. * Changing version and replacing tab with spaces. * Remove snappy as a build-depends The snappy feature does not require any external sources. --- ports/librdkafka/CONTROL | 5 ++++- ports/librdkafka/portfile.cmake | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/librdkafka/CONTROL b/ports/librdkafka/CONTROL index f4030ff086a..9b520bbe3cb 100644 --- a/ports/librdkafka/CONTROL +++ b/ports/librdkafka/CONTROL @@ -1,5 +1,5 @@ Source: librdkafka -Version: 1.1.0 +Version: 1.1.0-1 Description: The Apache Kafka C/C++ library Homepage: https://github.com/edenhill/librdkafka @@ -18,3 +18,6 @@ Build-Depends: zlib Feature: zstd Description: Build with zstd Build-Depends: zstd + +Feature: snappy +Description: Build with snappy diff --git a/ports/librdkafka/portfile.cmake b/ports/librdkafka/portfile.cmake index 5bc66fdfa9e..84c50c8faed 100644 --- a/ports/librdkafka/portfile.cmake +++ b/ports/librdkafka/portfile.cmake @@ -17,6 +17,7 @@ vcpkg_check_features( ssl WITH_SSL zlib WITH_ZLIB zstd WITH_ZSTD + snappy WITH_SNAPPY ) vcpkg_configure_cmake( From 8390d68837a8d538dffa19d00b56e33a940b50f6 Mon Sep 17 00:00:00 2001 From: Tri Tran Date: Thu, 8 Aug 2019 11:04:39 -0500 Subject: [PATCH 17/30] [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 --- ports/discount/CONTROL | 4 ++ ports/discount/blocktags | 34 ++++++++++++++ ports/discount/cmake.patch | 27 +++++++++++ .../disable-deprecated-warnings.patch | 16 +++++++ .../discount/generate-blocktags-command.patch | 29 ++++++++++++ ports/discount/portfile.cmake | 45 +++++++++++++++++++ 6 files changed, 155 insertions(+) create mode 100644 ports/discount/CONTROL create mode 100644 ports/discount/blocktags create mode 100644 ports/discount/cmake.patch create mode 100644 ports/discount/disable-deprecated-warnings.patch create mode 100644 ports/discount/generate-blocktags-command.patch create mode 100644 ports/discount/portfile.cmake diff --git a/ports/discount/CONTROL b/ports/discount/CONTROL new file mode 100644 index 00000000000..51c8b5e90b3 --- /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 00000000000..dfd3957c30a --- /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 00000000000..8a2278cf7e7 --- /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 + $ + ) +- 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 00000000000..e8f4f0fb772 --- /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 00000000000..13d63a25dec --- /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 00000000000..6a40d51051a --- /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) + From 9d53b869a59572e088383f36e0a46795c0dbc667 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Thu, 8 Aug 2019 16:43:39 -0700 Subject: [PATCH 18/30] [open62541] Fix flakiness/bugginess (#7607) - We used to `get-pip` on all non-Linux systems; we should be downloading and running it only on Windows. - `get-pip`'s download link was volatile, and the SHA would change. We now download it from a versioned link, which should not change As part of these, we bumped the number from 0.30.0-2 to 0.30.0-3 --- ports/open62541/CONTROL | 2 +- ports/open62541/portfile.cmake | 29 ++++++++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/ports/open62541/CONTROL b/ports/open62541/CONTROL index 28bfd2c0bd0..bff3217bb61 100644 --- a/ports/open62541/CONTROL +++ b/ports/open62541/CONTROL @@ -1,3 +1,3 @@ Source: open62541 -Version: 0.3.0-2 +Version: 0.3.0-3 Description: open62541 is an open source C (C99) implementation of OPC UA licensed under the Mozilla Public License v2.0. diff --git a/ports/open62541/portfile.cmake b/ports/open62541/portfile.cmake index 5132fa7f053..d0e26df3f6c 100644 --- a/ports/open62541/portfile.cmake +++ b/ports/open62541/portfile.cmake @@ -1,6 +1,6 @@ include(vcpkg_common_functions) -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") +if(NOT CMAKE_HOST_WIN32) message("${PORT} currently requires the following tools from the system package manager:\n python-six\n\nThis can be installed on Ubuntu systems via apt-get install python-six python3-six (depending on your current python default interpreter)") endif() @@ -31,21 +31,24 @@ endif() vcpkg_find_acquire_program(PYTHON3) get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) -get_filename_component(PYTHON3_DIR_NAME "${PYTHON3_DIR}" NAME) vcpkg_add_to_path("${PYTHON3_DIR}") -if(NOT EXISTS ${PYTHON3_DIR}/easy_install${EXECUTABLE_SUFFIX}) - if(NOT EXISTS ${PYTHON3_DIR}/Scripts/pip${EXECUTABLE_SUFFIX}) - vcpkg_download_distfile(GET_PIP - URLS "https://bootstrap.pypa.io/get-pip.py" - FILENAME "tools/python/${PYTHON3_DIR_NAME}/get-pip.py" - SHA512 99520d223819708b8f6e4b839d1fa215e4e8adc7fcd0db6c25a0399cf2fa10034b35673cf450609303646d12497f301ef53b7e7cc65c78e7bce4af0c673555ad - ) - execute_process(COMMAND ${PYTHON3_DIR}/python${EXECUTABLE_SUFFIX} ${PYTHON3_DIR}/get-pip.py) +if(CMAKE_HOST_WIN32) + # Must not modify system copy of python3 -- on CMAKE_HOST_WIN32, we have our own private copy + if(NOT EXISTS ${PYTHON3_DIR}/easy_install.exe) + if(NOT EXISTS ${PYTHON3_DIR}/Scripts/pip.exe) + get_filename_component(PYTHON3_DIR_NAME "${PYTHON3_DIR}" NAME) + vcpkg_download_distfile(GET_PIP + URLS "https://bootstrap.pypa.io/3.3/get-pip.py" + FILENAME "tools/python/${PYTHON3_DIR_NAME}/get-pip.py" + SHA512 92e68525830bb23955a31cb19ebc3021ef16b6337eab83d5db2961b791283d2867207545faf83635f6027f2f7b7f8fee2c85f2cfd8e8267df25406474571c741 + ) + execute_process(COMMAND ${PYTHON3_DIR}/python.exe ${GET_PIP}) + endif() + execute_process(COMMAND ${PYTHON3_DIR}/Scripts/pip.exe install six) + else() + execute_process(COMMAND ${PYTHON3_DIR}/easy_install.exe six) endif() - execute_process(COMMAND ${PYTHON3_DIR}/Scripts/pip${EXECUTABLE_SUFFIX} install six) -else() - execute_process(COMMAND ${PYTHON3_DIR}/easy_install${EXECUTABLE_SUFFIX} six) endif() vcpkg_configure_cmake( From 743e168ef5c7705e44d1d5cab5b9cca22328345e Mon Sep 17 00:00:00 2001 From: Griffin Downs <35574547+grdowns@users.noreply.github.com> Date: Thu, 8 Aug 2019 17:46:04 -0700 Subject: [PATCH 19/30] [openimageio] find_package support (#7588) * Copy find module to share; Append share to module path * Bump version --- ports/openimageio/CONTROL | 2 +- ports/openimageio/portfile.cmake | 3 +++ ports/openimageio/vcpkg-cmake-wrapper.cmake | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 ports/openimageio/vcpkg-cmake-wrapper.cmake diff --git a/ports/openimageio/CONTROL b/ports/openimageio/CONTROL index 3b864bea032..94ae8654e52 100644 --- a/ports/openimageio/CONTROL +++ b/ports/openimageio/CONTROL @@ -1,5 +1,5 @@ Source: openimageio -Version: 2019-08-08 +Version: 2019-08-08-1 Homepage: https://github.com/OpenImageIO/oiio Description: A library for reading and writing images, and a bunch of related classes, utilities, and application Build-Depends: libjpeg-turbo, tiff, libpng, openexr, boost-thread, boost-smart-ptr, boost-foreach, boost-regex, boost-type-traits, boost-static-assert, boost-unordered, boost-config, boost-algorithm, boost-filesystem, boost-system, boost-thread, boost-asio, boost-random, robin-map, boost-stacktrace diff --git a/ports/openimageio/portfile.cmake b/ports/openimageio/portfile.cmake index 3053af3fa48..7284d58b830 100644 --- a/ports/openimageio/portfile.cmake +++ b/ports/openimageio/portfile.cmake @@ -71,6 +71,9 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/doc) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(COPY ${SOURCE_PATH}/src/cmake/modules/FindOpenImageIO.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) + # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/openimageio) file(RENAME ${CURRENT_PACKAGES_DIR}/share/openimageio/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/openimageio/copyright) diff --git a/ports/openimageio/vcpkg-cmake-wrapper.cmake b/ports/openimageio/vcpkg-cmake-wrapper.cmake new file mode 100644 index 00000000000..82dc991f066 --- /dev/null +++ b/ports/openimageio/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,8 @@ +set(OPENIMAGEIO_PREV_MODULE_PATH ${CMAKE_MODULE_PATH}) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +if(NOT OPENIMAGEIO_LIBRARIES) + _find_package(${ARGS}) +endif() + +set(CMAKE_MODULE_PATH ${OPENIMAGEIO_PREV_MODULE_PATH}) From 14c792441dc5963d0d17cb2e7a6dc1b2f7665d9b Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 23 Jul 2019 01:46:36 -0700 Subject: [PATCH 20/30] [vcpkg] Revert accidental removal of powershell-core usage in bb3a9ddb6ec917f54 --- ports/jsonnet/CONTROL | 2 +- ports/jsonnet/portfile.cmake | 6 ++--- toolsrc/src/vcpkg/build.cpp | 17 +++++++++++++- toolsrc/src/vcpkg/tools.cpp | 45 +++++++++++++----------------------- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/ports/jsonnet/CONTROL b/ports/jsonnet/CONTROL index 35c8706585f..508f1e7afb2 100644 --- a/ports/jsonnet/CONTROL +++ b/ports/jsonnet/CONTROL @@ -1,4 +1,4 @@ Source: jsonnet -Version: 2019-05-08 +Version: 2019-05-08-1 Homepage: https://github.com/google/jsonnet Description: Jsonnet - The data templating language diff --git a/ports/jsonnet/portfile.cmake b/ports/jsonnet/portfile.cmake index 5472445da6e..ffa2973fbc7 100644 --- a/ports/jsonnet/portfile.cmake +++ b/ports/jsonnet/portfile.cmake @@ -11,12 +11,12 @@ vcpkg_from_github( SHA512 d9f84c39929e9e80272e2b834f68a13b48c1cb4d64b70f5b6fa16e677555d947f7cf57372453e23066a330faa6a429b9aa750271b46f763581977a223d238785 HEAD_REF master PATCHES - 001-enable-msvc.patch + 001-enable-msvc.patch ) if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") vcpkg_execute_required_process( - COMMAND Powershell -Command "((Get-Content -Encoding Byte \"${SOURCE_PATH}/stdlib/std.jsonnet\") -join ',') + ',0' > \"${SOURCE_PATH}/core/std.jsonnet.h\"" + COMMAND Powershell -Command "((Get-Content -AsByteStream \"${SOURCE_PATH}/stdlib/std.jsonnet\") -join ',') + ',0' | Out-File -Encoding Ascii \"${SOURCE_PATH}/core/std.jsonnet.h\"" WORKING_DIRECTORY "${SOURCE_PATH}" LOGNAME "std.jsonnet" ) @@ -31,7 +31,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS -DBUILD_JSONNET=OFF -DBUILD_TESTS=OFF + OPTIONS -DBUILD_JSONNET=OFF -DBUILD_JSONNETFMT=OFF -DBUILD_TESTS=OFF ) vcpkg_install_cmake() diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 02d4c4a7199..5b93242a10b 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -499,6 +499,14 @@ namespace vcpkg::Build const BuildPackageConfig& config) { auto& fs = paths.get_filesystem(); +#if defined(_WIN32) + const fs::path& powershell_exe_path = paths.get_tool_exe("powershell-core"); + if (!fs.exists(powershell_exe_path.parent_path() / "powershell.exe")) + { + fs.copy(powershell_exe_path, powershell_exe_path.parent_path() / "powershell.exe", fs::copy_options::none); + } +#endif + const Triplet& triplet = spec.triplet(); const auto& triplet_file_path = paths.get_triplet_file_path(spec.triplet()).u8string(); @@ -516,8 +524,12 @@ namespace vcpkg::Build std::string command = make_build_cmd(paths, pre_build_info, config, triplet); std::unordered_map env = make_env_passthrough(pre_build_info); +#if defined(_WIN32) + const int return_code = + System::cmd_execute_clean(command, env, powershell_exe_path.parent_path().u8string() + ";"); +#else const int return_code = System::cmd_execute_clean(command, env); - +#endif const auto buildtimeus = timer.microseconds(); const auto spec_string = spec.to_string(); @@ -597,6 +609,9 @@ namespace vcpkg::Build std::vector abi_tag_entries(dependency_abis.begin(), dependency_abis.end()); +#if defined(_WIN32) + abi_tag_entries.emplace_back(AbiEntry{"powershell", paths.get_tool_version("powershell-core")}); +#endif abi_tag_entries.emplace_back(AbiEntry{"cmake", paths.get_tool_version(Tools::CMAKE)}); // If there is an unusually large number of files in the port then diff --git a/toolsrc/src/vcpkg/tools.cpp b/toolsrc/src/vcpkg/tools.cpp index 4f4b23055e7..7d56854c649 100644 --- a/toolsrc/src/vcpkg/tools.cpp +++ b/toolsrc/src/vcpkg/tools.cpp @@ -294,20 +294,6 @@ CMake suite maintained and supported by Kitware (kitware.com/cmake). } }; - static fs::path get_7za_path(const VcpkgPaths& paths) - { -#if defined(_WIN32) - static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "7zip").value_or_exit(VCPKG_LINE_INFO); - if (!paths.get_filesystem().exists(TOOL_DATA.exe_path)) - { - return fetch_tool(paths, "7zip", TOOL_DATA); - } - return TOOL_DATA.exe_path; -#else - Checks::exit_with_message(VCPKG_LINE_INFO, "Cannot download 7zip for non-Windows platforms."); -#endif - } - struct NinjaProvider : ToolProvider { std::string m_exe = "ninja"; @@ -443,31 +429,21 @@ git version 2.17.1.windows.2 virtual const fs::path& get_tool_path(const VcpkgPaths& paths, const std::string& tool) const override { return path_only_cache.get_lazy(tool, [&]() { - // First deal with specially handled tools. - // For these we may look in locations like Program Files, the PATH etc as well as the auto-downloaded - // location. - if (tool == Tools::SEVEN_ZIP) return get_7za_path(paths); - if (tool == Tools::CMAKE || tool == Tools::GIT || tool == Tools::NINJA || tool == Tools::NUGET || - tool == Tools::IFW_INSTALLER_BASE) - return get_tool_pathversion(paths, tool).path; if (tool == Tools::IFW_BINARYCREATOR) return get_tool_path(paths, Tools::IFW_INSTALLER_BASE).parent_path() / "binarycreator.exe"; if (tool == Tools::IFW_REPOGEN) return get_tool_path(paths, Tools::IFW_INSTALLER_BASE).parent_path() / "repogen.exe"; - // For other tools, we simply always auto-download them. - const ToolData tool_data = parse_tool_data_from_xml(paths, tool).value_or_exit(VCPKG_LINE_INFO); - if (paths.get_filesystem().exists(tool_data.exe_path)) - { - return tool_data.exe_path; - } - return fetch_tool(paths, tool, tool_data); + return get_tool_pathversion(paths, tool).path; }); } const PathAndVersion& get_tool_pathversion(const VcpkgPaths& paths, const std::string& tool) const { return path_version_cache.get_lazy(tool, [&]() -> PathAndVersion { + // First deal with specially handled tools. + // For these we may look in locations like Program Files, the PATH etc as well as the auto-downloaded + // location. if (tool == Tools::CMAKE) { if (System::get_environment_variable("VCPKG_FORCE_SYSTEM_BINARIES").has_value()) @@ -495,7 +471,18 @@ git version 2.17.1.windows.2 if (tool == Tools::NUGET) return get_path(paths, NuGetProvider()); if (tool == Tools::IFW_INSTALLER_BASE) return get_path(paths, IfwInstallerBaseProvider()); - Checks::exit_with_message(VCPKG_LINE_INFO, "Finding version for %s is not implemented yet.", tool); + // For other tools, we simply always auto-download them. + auto maybe_tool_data = parse_tool_data_from_xml(paths, tool); + if (auto p_tool_data = maybe_tool_data.get()) + { + if (paths.get_filesystem().exists(p_tool_data->exe_path)) + { + return {p_tool_data->exe_path, p_tool_data->sha512}; + } + return {fetch_tool(paths, tool, *p_tool_data), p_tool_data->sha512}; + } + + Checks::exit_with_message(VCPKG_LINE_INFO, "Unknown or unavailable tool: %s", tool); }); } From 67643a0ea34aa58337680266024fecb9f04b3eb5 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Fri, 9 Aug 2019 10:29:02 -0700 Subject: [PATCH 21/30] [vcpkg] fix 7616 There's a bug in `std::experimental::filesystem::status` on libstdc++ -- it incorrectly sets its `error_code` when a file doesn't exist, or when a path doesn't exist. In order to get around this, `error_code` was cleared when the file doesn't exist, but it was not cleared when the path didn't exist. Note: in this case, I say "the file doesn't exist" when, if you look up "a/b/c", "a/b" exists but "c" doesn't. I say "the path doesn't exist" when, if you look up "a/b/c", either "a" or "a/b" doesn't exist. --- toolsrc/src/vcpkg/base/files.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 4a0a52f06d4..eb6119f1807 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -78,7 +78,7 @@ namespace fs::detail #else auto result = symlink ? stdfs::symlink_status(p, ec) : stdfs::status(p, ec); // libstdc++ doesn't correctly not-set ec on nonexistent paths - if (ec.value() == ENOENT) + if (ec.value() == ENOENT || ec.value() == ENOTDIR) { ec.clear(); result = file_status(file_type::not_found, perms::unknown); From d329b58c749463e7603ab2f987e2fc56408e97bb Mon Sep 17 00:00:00 2001 From: Ehsan Date: Sat, 10 Aug 2019 01:01:36 +0430 Subject: [PATCH 22/30] [expat] Update library to 2.2.7 (#7596) --- ports/expat/CONTROL | 2 +- ports/expat/portfile.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/expat/CONTROL b/ports/expat/CONTROL index f01b5b9e18c..68629eb2d49 100644 --- a/ports/expat/CONTROL +++ b/ports/expat/CONTROL @@ -1,4 +1,4 @@ Source: expat -Version: 2.2.6 +Version: 2.2.7 Homepage: https://github.com/libexpat/libexpat Description: XML parser library written in C diff --git a/ports/expat/portfile.cmake b/ports/expat/portfile.cmake index 7e2c322db91..7b97fb3de8f 100644 --- a/ports/expat/portfile.cmake +++ b/ports/expat/portfile.cmake @@ -6,8 +6,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libexpat/libexpat - REF R_2_2_6 - SHA512 727fbd24041c9af71b32353448583a6d8b38ddf93b10c97510e847939c2ad2be9b40ff6e6e27b725bff277982c2fc96c75f19c4a3ac4a246133eb62870c963d8 + REF R_2_2_7 + SHA512 11b1f9a135c4501ef0112e17da8381e956366165a11a384daedd4cdef9a00c3112c8f6ff8c8f6d3b5e7b71b9a73041f23beac0f27e9cfafe1ec0266d95870408 HEAD_REF master) if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) From 9dfab115aaee2550ad8cf23bfb28a84ff581c936 Mon Sep 17 00:00:00 2001 From: Lily <47812810+wangli28@users.noreply.github.com> Date: Sat, 10 Aug 2019 06:02:57 +0800 Subject: [PATCH 23/30] [duckx] Add new port (#7561) * [duckx] Add new port * [duckx] Add new port --- ports/duckx/CONTROL | 4 ++++ ports/duckx/portfile.cmake | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 ports/duckx/CONTROL create mode 100644 ports/duckx/portfile.cmake diff --git a/ports/duckx/CONTROL b/ports/duckx/CONTROL new file mode 100644 index 00000000000..59dda99b72e --- /dev/null +++ b/ports/duckx/CONTROL @@ -0,0 +1,4 @@ +Source: duckx +Version: 2019-08-06 +Homepage: https://github.com/amiremohamadi/DuckX +Description: DuckX is a library for creation of Office docx files. diff --git a/ports/duckx/portfile.cmake b/ports/duckx/portfile.cmake new file mode 100644 index 00000000000..66bcdff2508 --- /dev/null +++ b/ports/duckx/portfile.cmake @@ -0,0 +1,20 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO amiremohamadi/DuckX + REF 98c946ad13559c03e9c7f2b050b9f70d5caf509e + SHA512 20e8970a1faff6e2ff5bc106bd038396d05ace3517ac83583712263870c4b007ebc407b5d69c482f7117ac155aa85f9928d5ee524f75897e8e12eb3659d16c15 +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) + +file(COPY ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/duckx) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/duckx RENAME copyright) From 52b2e740de81d58fbe5fa535c1f66aa82e80951e Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Fri, 9 Aug 2019 12:00:43 -0700 Subject: [PATCH 24/30] [vcpkg] Fix build under /W4 I was building under /W3, because CMake hadn't been set up to build under /W4 -- therefore, I didn't see some warnings. We also decided to remove the niebloids and instead break ADL by using `= delete`, since otherwise we get warnings when we define a local variable with the same name as a niebloid. I also removed `status` and `symlink_status` from the `files` header, since it's unnecessary now, and they're just implementation details of `RealFilesystem`. I also removed some existing uses of unqualified `status(path)`, since that no longer compiles. I also added `Filesystem::canonical`, to remove another use of `fs::stdfs` in a function I was already working in. --- toolsrc/include/vcpkg/base/files.h | 112 ++++++--------- toolsrc/src/vcpkg-test/files.cpp | 6 +- toolsrc/src/vcpkg-test/util.cpp | 6 +- toolsrc/src/vcpkg/base/files.cpp | 216 +++++++++++++++-------------- toolsrc/src/vcpkg/build.cpp | 2 +- toolsrc/src/vcpkg/dependencies.cpp | 3 +- toolsrc/src/vcpkg/vcpkgpaths.cpp | 5 +- 7 files changed, 164 insertions(+), 186 deletions(-) diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index 19e4f78fd57..2b33835c0e8 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -51,8 +51,14 @@ namespace fs #else - using stdfs::file_status; using stdfs::file_type; + // to set up ADL correctly on `file_status` objects, we are defining + // this in our own namespace + struct file_status : private stdfs::file_status { + using stdfs::file_status::file_status; + using stdfs::file_status::type; + using stdfs::file_status::permissions; + }; #endif @@ -61,91 +67,49 @@ namespace fs the presence of symlinks -- a symlink is treated as the object it points to for `symlink_status` and `symlink_type` */ + #if 0 + #endif - // we want to poison ADL with these niebloids - - namespace detail + inline bool is_symlink(file_status s) noexcept { - struct status_t - { - file_status operator()(const path& p, std::error_code& ec) const noexcept; - file_status operator()(vcpkg::LineInfo li, const path& p) const noexcept; - file_status operator()(const path& p) const; - }; - struct symlink_status_t - { - file_status operator()(const path& p, std::error_code& ec) const noexcept; - file_status operator()(vcpkg::LineInfo li, const path& p) const noexcept; - }; - struct is_symlink_t - { - bool operator()(file_status s) const - { #if defined(_WIN32) - return s.type() == file_type::directory_symlink || s.type() == file_type::symlink; -#else - return stdfs::is_symlink(s); + if (s.type() == file_type::directory_symlink) return true; #endif - } - }; - struct is_regular_file_t - { - inline bool operator()(file_status s) const - { -#if defined(_WIN32) - return s.type() == file_type::regular; -#else - return stdfs::is_regular_file(s); -#endif - } - }; - struct is_directory_t - { - inline bool operator()(file_status s) const - { -#if defined(_WIN32) - return s.type() == file_type::directory; -#else - return stdfs::is_directory(s); -#endif - } - }; - struct exists_t - { - inline bool operator()(file_status s) const - { -#if defined(_WIN32) - return s.type() != file_type::not_found && s.type() != file_type::none; -#else - return stdfs::exists(s); -#endif - } - }; + return s.type() == file_type::symlink; + } + inline bool is_regular_file(file_status s) + { + return s.type() == file_type::regular; + } + inline bool is_directory(file_status s) + { + return s.type() == file_type::directory; + } + inline bool exists(file_status s) + { + return s.type() != file_type::not_found && s.type() != file_type::none; } - - constexpr detail::status_t status{}; - constexpr detail::symlink_status_t symlink_status{}; - constexpr detail::is_symlink_t is_symlink{}; - constexpr detail::is_regular_file_t is_regular_file{}; - constexpr detail::is_directory_t is_directory{}; - constexpr detail::exists_t exists{}; } /* if someone attempts to use unqualified `symlink_status` or `is_symlink`, they might get the ADL version, which is broken. - Therefore, put `symlink_status` in the global namespace, so that they get - our symlink_status. + Therefore, put `(symlink_)?status` as deleted in the global namespace, so + that they get an error. We also want to poison the ADL on the other functions, because we don't want people calling these functions on paths */ -using fs::exists; -using fs::is_directory; -using fs::is_regular_file; -using fs::is_symlink; -using fs::status; -using fs::symlink_status; +void status(const fs::path& p) = delete; +void status(const fs::path& p, std::error_code& ec) = delete; +void symlink_status(const fs::path& p) = delete; +void symlink_status(const fs::path& p, std::error_code& ec) = delete; +void is_symlink(const fs::path& p) = delete; +void is_symlink(const fs::path& p, std::error_code& ec) = delete; +void is_regular_file(const fs::path& p) = delete; +void is_regular_file(const fs::path& p, std::error_code& ec) = delete; +void is_directory(const fs::path& p) = delete; +void is_directory(const fs::path& p, std::error_code& ec) = delete; namespace vcpkg::Files { @@ -192,6 +156,10 @@ namespace vcpkg::Files virtual void copy_symlink(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec) = 0; virtual fs::file_status status(const fs::path& path, std::error_code& ec) const = 0; virtual fs::file_status symlink_status(const fs::path& path, std::error_code& ec) const = 0; + fs::file_status status(LineInfo li, const fs::path& p) const noexcept; + fs::file_status symlink_status(LineInfo li, const fs::path& p) const noexcept; + virtual fs::path canonical(const fs::path& path, std::error_code& ec) const = 0; + fs::path canonical(LineInfo li, const fs::path& path) const; virtual std::vector find_from_PATH(const std::string& name) const = 0; }; diff --git a/toolsrc/src/vcpkg-test/files.cpp b/toolsrc/src/vcpkg-test/files.cpp index a2faf455cd3..d40edb3bdaa 100644 --- a/toolsrc/src/vcpkg-test/files.cpp +++ b/toolsrc/src/vcpkg-test/files.cpp @@ -145,7 +145,7 @@ namespace CHECK_EC_ON_FILE(base, ec); } - vcpkg::Files::Filesystem& setup(urbg_t& urbg) + vcpkg::Files::Filesystem& setup() { auto& fs = vcpkg::Files::get_real_filesystem(); @@ -161,7 +161,7 @@ TEST_CASE ("remove all", "[files]") { auto urbg = get_urbg(0); - auto& fs = setup(urbg); + auto& fs = setup(); fs::path temp_dir = base_temporary_directory() / get_random_filename(urbg); INFO("temp dir is: " << temp_dir); @@ -181,7 +181,7 @@ TEST_CASE ("remove all", "[files]") TEST_CASE ("remove all -- benchmarks", "[files][!benchmark]") { auto urbg = get_urbg(1); - auto& fs = setup(urbg); + auto& fs = setup(); struct { diff --git a/toolsrc/src/vcpkg-test/util.cpp b/toolsrc/src/vcpkg-test/util.cpp index 384954b4e75..379b253b187 100644 --- a/toolsrc/src/vcpkg-test/util.cpp +++ b/toolsrc/src/vcpkg-test/util.cpp @@ -141,7 +141,7 @@ namespace vcpkg::Test std::filesystem::path targetp = target.native(); std::filesystem::path filep = file.native(); - std::filesystem::create_symlink(targetp, filep); + std::filesystem::create_symlink(targetp, filep, ec); } else { @@ -153,6 +153,7 @@ namespace vcpkg::Test ec.assign(errno, std::system_category()); } #else + std::ignore = ec; vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message); #endif } @@ -165,7 +166,7 @@ namespace vcpkg::Test std::filesystem::path targetp = target.native(); std::filesystem::path filep = file.native(); - std::filesystem::create_directory_symlink(targetp, filep); + std::filesystem::create_directory_symlink(targetp, filep, ec); } else { @@ -174,6 +175,7 @@ namespace vcpkg::Test #elif FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_UNIX ::vcpkg::Test::create_symlink(target, file, ec); #else + std::ignore = ec; vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message); #endif } diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index eb6119f1807..583adbbb8c7 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -21,114 +21,87 @@ #include #endif -namespace fs::detail -{ - static file_status status_implementation(bool follow_symlinks, const path& p, std::error_code& ec) - { -#if defined(_WIN32) - WIN32_FILE_ATTRIBUTE_DATA file_attributes; - file_type ft = file_type::unknown; - perms permissions = perms::unknown; - if (!GetFileAttributesExW(p.c_str(), GetFileExInfoStandard, &file_attributes)) - { - const auto err = GetLastError(); - if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) - { - ft = file_type::not_found; - } - else - { - ec.assign(err, std::system_category()); - } - } - else if (!follow_symlinks && file_attributes.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) - { - // this also gives junctions file_type::directory_symlink - if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - ft = file_type::directory_symlink; - } - else - { - ft = file_type::symlink; - } - } - else if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - ft = file_type::directory; - } - else - { - // otherwise, the file is a regular file - ft = file_type::regular; - } - - if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_READONLY) - { - constexpr auto all_write = perms::group_write | perms::owner_write | perms::others_write; - permissions = perms::all & ~all_write; - } - else if (ft != file_type::none && ft != file_type::none) - { - permissions = perms::all; - } - - return file_status(ft, permissions); - -#else - auto result = symlink ? stdfs::symlink_status(p, ec) : stdfs::status(p, ec); - // libstdc++ doesn't correctly not-set ec on nonexistent paths - if (ec.value() == ENOENT || ec.value() == ENOTDIR) - { - ec.clear(); - result = file_status(file_type::not_found, perms::unknown); - } - return result; -#endif - } - - file_status status_t::operator()(const path& p, std::error_code& ec) const noexcept - { - return status_implementation(false, p, ec); - } - file_status status_t::operator()(vcpkg::LineInfo li, const path& p) const noexcept - { - std::error_code ec; - auto result = (*this)(p, ec); - if (ec) vcpkg::Checks::exit_with_message(li, "error getting status of path %s: %s", p.string(), ec.message()); - - return result; - } - file_status status_t::operator()(const path& p) const - { -#if defined(_WIN32) - return (*this)(VCPKG_LINE_INFO, p); -#else - return fs::stdfs::status(p); -#endif - } - - file_status symlink_status_t::operator()(const path& p, std::error_code& ec) const noexcept - { - return status_implementation(true, p, ec); - } - - file_status symlink_status_t::operator()(vcpkg::LineInfo li, const path& p) const noexcept - { - std::error_code ec; - auto result = (*this)(p, ec); - if (ec) vcpkg::Checks::exit_with_message(li, "error getting status of path %s: %s", p.string(), ec.message()); - - return result; - } -} - namespace vcpkg::Files { static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); namespace { + fs::file_status status_implementation(bool follow_symlinks, const fs::path& p, std::error_code& ec) noexcept + { + using fs::file_type; + using fs::perms; +#if defined(_WIN32) + WIN32_FILE_ATTRIBUTE_DATA file_attributes; + auto ft = file_type::unknown; + auto permissions = perms::unknown; + if (!GetFileAttributesExW(p.c_str(), GetFileExInfoStandard, &file_attributes)) + { + const auto err = GetLastError(); + if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) + { + ft = file_type::not_found; + } + else + { + ec.assign(err, std::system_category()); + } + } + else if (!follow_symlinks && file_attributes.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) + { + // this also gives junctions file_type::directory_symlink + if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + ft = file_type::directory_symlink; + } + else + { + ft = file_type::symlink; + } + } + else if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + ft = file_type::directory; + } + else + { + // otherwise, the file is a regular file + ft = file_type::regular; + } + + if (file_attributes.dwFileAttributes & FILE_ATTRIBUTE_READONLY) + { + constexpr auto all_write = perms::group_write | perms::owner_write | perms::others_write; + permissions = perms::all & ~all_write; + } + else if (ft != file_type::none && ft != file_type::none) + { + permissions = perms::all; + } + + return fs::file_status(ft, permissions); + +#else + auto result = symlink ? stdfs::symlink_status(p, ec) : stdfs::status(p, ec); + // libstdc++ doesn't correctly not-set ec on nonexistent paths + if (ec.value() == ENOENT || ec.value() == ENOTDIR) + { + ec.clear(); + result = fs::file_status(file_type::not_found, perms::unknown); + } + return result; +#endif + } + + fs::file_status status(const fs::path& p, std::error_code& ec) noexcept + { + return status_implementation(false, p, ec); + } + fs::file_status symlink_status(const fs::path& p, std::error_code& ec) noexcept + { + return status_implementation(false, p, ec); + } + // does _not_ follow symlinks void set_writeable(const fs::path& path, std::error_code& ec) noexcept { @@ -220,6 +193,24 @@ namespace vcpkg::Files return exists(path, ec); } + fs::file_status Filesystem::status(vcpkg::LineInfo li, const fs::path& p) const noexcept + { + std::error_code ec; + auto result = this->status(p, ec); + if (ec) vcpkg::Checks::exit_with_message(li, "error getting status of path %s: %s", p.string(), ec.message()); + + return result; + } + + fs::file_status Filesystem::symlink_status(vcpkg::LineInfo li, const fs::path& p) const noexcept + { + std::error_code ec; + auto result = this->symlink_status(p, ec); + if (ec) vcpkg::Checks::exit_with_message(li, "error getting status of path %s: %s", p.string(), ec.message()); + + return result; + } + void Filesystem::write_lines(const fs::path& path, const std::vector& lines, LineInfo linfo) { std::error_code ec; @@ -244,6 +235,16 @@ namespace vcpkg::Files } } + fs::path Filesystem::canonical(LineInfo li, const fs::path& path) const + { + std::error_code ec; + + const auto result = this->canonical(path, ec); + + if (ec) Checks::exit_with_message(li, "Error getting canonicalization of %s: %s", path.string(), ec.message()); + return result; + } + struct RealFilesystem final : Filesystem { virtual Expected read_contents(const fs::path& file_path) const override @@ -463,7 +464,7 @@ namespace vcpkg::Files static void do_remove(const fs::path& current_path, ErrorInfo& err) { std::error_code ec; - const auto path_status = fs::symlink_status(current_path, ec); + const auto path_status = Files::symlink_status(current_path, ec); if (check_ec(ec, current_path, err)) return; if (!fs::exists(path_status)) return; @@ -593,11 +594,11 @@ namespace vcpkg::Files virtual fs::file_status status(const fs::path& path, std::error_code& ec) const override { - return fs::status(path, ec); + return Files::status(path, ec); } virtual fs::file_status symlink_status(const fs::path& path, std::error_code& ec) const override { - return fs::symlink_status(path, ec); + return Files::symlink_status(path, ec); } virtual void write_contents(const fs::path& file_path, const std::string& data, std::error_code& ec) override { @@ -628,6 +629,11 @@ namespace vcpkg::Files } } + virtual fs::path canonical(const fs::path& path, std::error_code& ec) const override + { + return fs::stdfs::canonical(path, ec); + } + virtual std::vector find_from_PATH(const std::string& name) const override { #if defined(_WIN32) diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 5b93242a10b..b809db0bc0b 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -623,7 +623,7 @@ namespace vcpkg::Build std::vector port_files; for (auto& port_file : fs::stdfs::recursive_directory_iterator(config.port_dir)) { - if (fs::is_regular_file(status(port_file))) + if (fs::is_regular_file(fs.status(VCPKG_LINE_INFO, port_file))) { port_files.push_back(port_file); if (port_files.size() > max_port_file_count) diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index 65c5cc98541..9fccf950e20 100644 --- a/toolsrc/src/vcpkg/dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -312,6 +312,7 @@ namespace vcpkg::Dependencies const std::vector* ports_dirs_paths) : filesystem(paths.get_filesystem()) { + auto& fs = Files::get_real_filesystem(); if (ports_dirs_paths) { for (auto&& overlay_path : *ports_dirs_paths) @@ -326,7 +327,7 @@ namespace vcpkg::Dependencies overlay.string()); Checks::check_exit(VCPKG_LINE_INFO, - fs::is_directory(status(overlay)), + fs::is_directory(fs.status(VCPKG_LINE_INFO, overlay)), "Error: Path \"%s\" must be a directory", overlay.string()); diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index c5b5749ffd6..bc46d2cfcce 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -18,8 +18,9 @@ namespace vcpkg const std::string& default_vs_path, const std::vector* triplets_dirs) { + auto& fs = Files::get_real_filesystem(); std::error_code ec; - const fs::path canonical_vcpkg_root_dir = fs::stdfs::canonical(vcpkg_root_dir, ec); + const fs::path canonical_vcpkg_root_dir = fs.canonical(vcpkg_root_dir, ec); if (ec) { return ec; @@ -42,7 +43,7 @@ namespace vcpkg if (auto odp = overriddenDownloadsPath.get()) { auto asPath = fs::u8path(*odp); - if (!fs::is_directory(status(asPath))) + if (!fs::is_directory(fs.status(VCPKG_LINE_INFO, asPath))) { Metrics::g_metrics.lock()->track_property("error", "Invalid VCPKG_DOWNLOADS override directory."); Checks::exit_with_message( From a6ae888f4ef69cda5212e7459debf6b620fa4a69 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Fri, 9 Aug 2019 12:21:25 -0700 Subject: [PATCH 25/30] fix the build on unix --- toolsrc/src/vcpkg/base/files.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 583adbbb8c7..7c29c8e1099 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -82,14 +82,14 @@ namespace vcpkg::Files return fs::file_status(ft, permissions); #else - auto result = symlink ? stdfs::symlink_status(p, ec) : stdfs::status(p, ec); + auto result = symlink ? fs::stdfs::symlink_status(p, ec) : fs::stdfs::status(p, ec); // libstdc++ doesn't correctly not-set ec on nonexistent paths if (ec.value() == ENOENT || ec.value() == ENOTDIR) { ec.clear(); - result = fs::file_status(file_type::not_found, perms::unknown); + return fs::file_status(file_type::not_found, perms::unknown); } - return result; + return fs::file_status(result.type(), result.permissions()); #endif } From 420dbffaa0f7138ecc935aa06138d46a19b4ce6f Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Sat, 10 Aug 2019 11:57:15 -0700 Subject: [PATCH 26/30] clang-format, and fix a leftover --- toolsrc/include/vcpkg/base/files.h | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index 2b33835c0e8..e9d3d33bf7b 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -54,22 +54,15 @@ namespace fs using stdfs::file_type; // to set up ADL correctly on `file_status` objects, we are defining // this in our own namespace - struct file_status : private stdfs::file_status { + struct file_status : private stdfs::file_status + { using stdfs::file_status::file_status; - using stdfs::file_status::type; using stdfs::file_status::permissions; + using stdfs::file_status::type; }; #endif - /* - std::experimental::filesystem's file_status and file_type are broken in - the presence of symlinks -- a symlink is treated as the object it points - to for `symlink_status` and `symlink_type` - */ - #if 0 - #endif - inline bool is_symlink(file_status s) noexcept { #if defined(_WIN32) @@ -77,18 +70,9 @@ namespace fs #endif return s.type() == file_type::symlink; } - inline bool is_regular_file(file_status s) - { - return s.type() == file_type::regular; - } - inline bool is_directory(file_status s) - { - return s.type() == file_type::directory; - } - inline bool exists(file_status s) - { - return s.type() != file_type::not_found && s.type() != file_type::none; - } + inline bool is_regular_file(file_status s) { return s.type() == file_type::regular; } + inline bool is_directory(file_status s) { return s.type() == file_type::directory; } + inline bool exists(file_status s) { return s.type() != file_type::not_found && s.type() != file_type::none; } } /* From 58f95cc856cdb026eeadeb29d30e5ea2fd5b252c Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Sat, 10 Aug 2019 12:25:22 -0700 Subject: [PATCH 27/30] fix two bugs in status --- toolsrc/src/vcpkg/base/files.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 7c29c8e1099..bbf37fd25c1 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -82,7 +82,7 @@ namespace vcpkg::Files return fs::file_status(ft, permissions); #else - auto result = symlink ? fs::stdfs::symlink_status(p, ec) : fs::stdfs::status(p, ec); + auto result = follow_symlinks ? fs::stdfs::status(p, ec) : fs::stdfs::symlink_status(p, ec); // libstdc++ doesn't correctly not-set ec on nonexistent paths if (ec.value() == ENOENT || ec.value() == ENOTDIR) { @@ -95,7 +95,7 @@ namespace vcpkg::Files fs::file_status status(const fs::path& p, std::error_code& ec) noexcept { - return status_implementation(false, p, ec); + return status_implementation(true, p, ec); } fs::file_status symlink_status(const fs::path& p, std::error_code& ec) noexcept { From 29ddf1a5c2711161a5642ab515f6cae5f01ca3e9 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Sat, 10 Aug 2019 12:27:49 -0700 Subject: [PATCH 28/30] remove clever use of std::ignore --- toolsrc/src/vcpkg-test/util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/vcpkg-test/util.cpp b/toolsrc/src/vcpkg-test/util.cpp index 379b253b187..a2343c21b99 100644 --- a/toolsrc/src/vcpkg-test/util.cpp +++ b/toolsrc/src/vcpkg-test/util.cpp @@ -153,7 +153,7 @@ namespace vcpkg::Test ec.assign(errno, std::system_category()); } #else - std::ignore = ec; + static_cast(ec); vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message); #endif } @@ -175,7 +175,7 @@ namespace vcpkg::Test #elif FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_UNIX ::vcpkg::Test::create_symlink(target, file, ec); #else - std::ignore = ec; + static_cast(ec); vcpkg::Checks::exit_with_message(VCPKG_LINE_INFO, no_filesystem_message); #endif } From cabbe165259bbde86103e8764d67d122f84eb13e Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Mon, 12 Aug 2019 08:24:20 +0200 Subject: [PATCH 29/30] [vcpkg/cmake] Added a function to fail from portfiles in a default way (#7601) * added function vcpkg_fail_port_install to fail the portfile under requested circumstances and display a standarized failure message * added always option. * fix linux regressions * bump control for ci tu rerun --- ports/aws-lambda-cpp/CONTROL | 2 +- ports/aws-lambda-cpp/portfile.cmake | 7 +- scripts/cmake/vcpkg_common_functions.cmake | 1 + scripts/cmake/vcpkg_fail_port_install.cmake | 92 +++++++++++++++++++++ 4 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 scripts/cmake/vcpkg_fail_port_install.cmake diff --git a/ports/aws-lambda-cpp/CONTROL b/ports/aws-lambda-cpp/CONTROL index 048f28facc3..53d7a917f2a 100644 --- a/ports/aws-lambda-cpp/CONTROL +++ b/ports/aws-lambda-cpp/CONTROL @@ -1,4 +1,4 @@ Source: aws-lambda-cpp -Version: 0.1.0-1 +Version: 0.1.0-2 Build-Depends: curl Description: C++ Runtime for AWS Lambda. diff --git a/ports/aws-lambda-cpp/portfile.cmake b/ports/aws-lambda-cpp/portfile.cmake index 4a4cddafd82..7ba33e8f1c7 100644 --- a/ports/aws-lambda-cpp/portfile.cmake +++ b/ports/aws-lambda-cpp/portfile.cmake @@ -1,8 +1,9 @@ include(vcpkg_common_functions) -if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") - message(FATAL_ERROR "aws-lambda-cpp currently only supports Linux and Mac platforms") -endif() +vcpkg_fail_port_install(MESSAGE "aws-lambda-cpp currently only supports Linux and Mac platforms" ON_TARGET "Windows") +#if(NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") +# message(FATAL_ERROR "aws-lambda-cpp currently only supports Linux and Mac platforms") +#endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index 515b2bafe46..e9e52bad841 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -9,6 +9,7 @@ include(vcpkg_extract_source_archive_ex) include(vcpkg_execute_required_process) include(vcpkg_execute_required_process_repeat) include(vcpkg_execute_build_process) +include(vcpkg_fail_port_install) include(vcpkg_find_acquire_program) include(vcpkg_fixup_cmake_targets) include(vcpkg_from_github) diff --git a/scripts/cmake/vcpkg_fail_port_install.cmake b/scripts/cmake/vcpkg_fail_port_install.cmake new file mode 100644 index 00000000000..0fdacb639b3 --- /dev/null +++ b/scripts/cmake/vcpkg_fail_port_install.cmake @@ -0,0 +1,92 @@ +## # vcpkg_fail_port_install +## +## Fails the current portfile with a (default) error message +## +## ## Usage +## ```cmake +## vcpkg_fail_port_install([MESSAGE ] [ON_TARGET [ ...]] +## [ON_ARCH [ ...]] +## [ON_CRT_LINKAGE [ ...]]) +## [ON_LIBRARY_LINKAGE [ ...]]) +## ``` +## +## ## Parameters +## ### MESSAGE +## Additional failure message. If non is given a default message will be displayed depending on the failure condition +## +## ### ALWAYS +## will always fail early +## +## ### ON_TARGET +## targets for which the build should fail early. Valid targets are from VCPKG_IS_TARGET_ (see vcpkg_common_definitions.cmake) +## +## ### ON_ARCH +## architecture for which the build should fail early. +## +## ### ON_CRT_LINKAGE +## CRT linkage for which the build should fail early. +## +## ### ON_LIBRARY_LINKAGE +## library linkage for which the build should fail early. +## +## ## Examples +## +## * [aws-lambda-cpp](https://github.com/Microsoft/vcpkg/blob/master/ports/aws-lambda-cpp/portfile.cmake) +function(vcpkg_fail_port_install) + cmake_parse_arguments(PARSE_ARGV 0 _csc "ALWAYS" "MESSAGE" "ON_TARGET;ON_ARCH;ON_CRT_LINKAGE;ON_LIBRARY_LINKAGE") + if(DEFINED _csc_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown arguments passed to vcpkg_fail_port_install. Please correct the portfile!") + endif() + if(DEFINED _csc_MESSAGE) + set(_csc_MESSAGE "${_csc_MESSAGE}\n") + else() + set(_csc_MESSAGE "") + endif() + + unset(_fail_port) + #Target fail check + if(DEFINED _csc_ON_TARGET) + foreach(_target ${_csc_ON_TARGET}) + string(TOUPPER ${_target} _target_upper) + if(VCPKG_TARGET_IS_${_target_upper}) + set(_fail_port TRUE) + set(_csc_MESSAGE "${_csc_MESSAGE}Target '${_target}' not supported by ${PORT}!\n") + endif() + endforeach() + endif() + + #Architecture fail check + if(DEFINED _csc_ON_ARCH) + foreach(_arch ${_csc_ON_ARCH}) + if(${VCPKG_TARGET_ARCHITECTURE} MATCHES ${_arch}) + set(_fail_port TRUE) + set(_csc_MESSAGE "${_csc_MESSAGE}Architecture '${_arch}' not supported by ${PORT}!\n") + endif() + endforeach() + endif() + + #CRT linkage fail check + if(DEFINED _csc_ON_CRT_LINKAGE) + foreach(_crt_link ${_csc_ON_CRT_LINKAGE}) + if("${VCPKG_CRT_LINKAGE}" MATCHES "${_crt_link}") + set(_fail_port TRUE) + set(_csc_MESSAGE "${_csc_MESSAGE}CRT linkage '${VCPKG_CRT_LINKAGE}' not supported by ${PORT}!\n") + endif() + endforeach() + endif() + + #Library linkage fail check + if(DEFINED _csc_ON_LIBRARY_LINKAGE) + foreach(_lib_link ${_csc_ON_LIBRARY_LINKAGE}) + if("${VCPKG_LIBRARY_LINKAGE}" MATCHES "${_lib_link}") + set(_fail_port TRUE) + set(_csc_MESSAGE "${_csc_MESSAGE}Library linkage '${VCPKG_LIBRARY_LINKAGE}' not supported by ${PORT}!\n") + endif() + endforeach() + endif() + + if(_fail_port OR _csc_ALWAYS) + message(FATAL_ERROR ${_csc_MESSAGE}) + endif() + +endfunction() \ No newline at end of file From fffcd0a5ae21d0b7ae0c8cdbd7bd1210f5a29031 Mon Sep 17 00:00:00 2001 From: JackBoosY <47264268+JackBoosY@users.noreply.github.com> Date: Mon, 12 Aug 2019 14:55:09 +0800 Subject: [PATCH 30/30] [rocksdb]Change linkage type to static. (#7452) --- ports/rocksdb/CONTROL | 2 +- ports/rocksdb/portfile.cmake | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/rocksdb/CONTROL b/ports/rocksdb/CONTROL index 6daf694b5b7..1d37c85cae5 100644 --- a/ports/rocksdb/CONTROL +++ b/ports/rocksdb/CONTROL @@ -1,5 +1,5 @@ Source: rocksdb -Version: 6.1.2 +Version: 6.1.2-1 Homepage: https://github.com/facebook/rocksdb Description: A library that provides an embeddable, persistent key-value store for fast storage Default-Features: zlib diff --git a/ports/rocksdb/portfile.cmake b/ports/rocksdb/portfile.cmake index 7cab8b7d94f..535f3708cac 100644 --- a/ports/rocksdb/portfile.cmake +++ b/ports/rocksdb/portfile.cmake @@ -1,5 +1,7 @@ include(vcpkg_common_functions) +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO facebook/rocksdb