diff options
| author | LiGuilin <liguilin0522@qq.com> | 2016-10-08 08:34:12 +0800 |
|---|---|---|
| committer | LiGuilin <liguilin0522@qq.com> | 2016-10-08 08:34:12 +0800 |
| commit | c91da2b0c4c3d9218c0b4d1712d744bb35245a61 (patch) | |
| tree | e1ae0664a4f21f3948bde8c8f9f9e55dea0cb11f | |
| parent | 280d88b34033ab728e02f725d8d8ff5f9250c6de (diff) | |
| parent | a0f621c0fca2c3de8bd5249f023979b800c543cf (diff) | |
| download | vcpkg-c91da2b0c4c3d9218c0b4d1712d744bb35245a61.tar.gz vcpkg-c91da2b0c4c3d9218c0b4d1712d744bb35245a61.zip | |
Merge remote-tracking branch 'upstream/master'
156 files changed, 3991 insertions, 1122 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6815dd52c..9fa0b2b27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,52 @@ +vcpkg (0.0.40) +-------------- + * Add ports: + - ace 6.4.0 + - asio 1.10.6 + - bond 5.0.0 + - constexpr 1.0 + - doctest 1.1.0 + - eigen3 3.2.9 + - fmt 3.0.0 + - gflags 2.1.2 + - glm 0.9.8.1 + - grpc 1.1.0 + - gsl 0-fd5ad87bf + - gtest 1.8 + - libiconv 1.14 + - mpir 2.7.2 + - protobuf 3.0.2 + - ragel 6.9 + - rapidxml 1.13 + - sery 1.0.0 + - stb 1.0 + * Update ports: + - boost 1.62 + - glfw3 3.2.1 + - opencv 3.1.0-1 + * Various fixes in existing portfiles + * Introduce environment variable `VCPKG_DEFAULT_TRIPLET` + * Replace everything concerning MD5 with SHA512 + * Add mirror support + * `vcpkg` now checks for valid package names: only ASCII lowercase chars, digits, or dashes are allowed + * `vcpkg create` now also creates a templated CONTROL file + * `vcpkg create` now checks for invalid chars in the zip path + * `vcpkg edit` now throws an error if it cannot launch an editor + * Fix `vcpkg integrate` to only apply to C++ projects instead of all projects + * Fix `vcpkg integrate` locale-specific failures + * `vcpkg search` now does simple substring searching + * Fix path that assumed Visual Studio is installed in default location + * Enable multicore builds by default + * Add `.vcpkg-root` file to detect the root directory + * Fix `bootstrap.ps1` to work with older versions of powershell + * Add `SOURCE_PATH` variable to all portfiles. + * Many improvements in error messages shown by `vcpkg` + * Various updates in FAQ + * Move `CONTRIBUTING.md` to root + +-- vcpkg team <vcpkg@microsoft.com> WED, 05 Oct 2016 17:00:00 -0700 + + vcpkg (0.0.30) -------------- * DLLs are now accompanied with their corresponding PDBs. diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 3415dc754..d991d87f9 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -14,6 +14,7 @@ For short description of available commands, run `vcpkg help`. - <a href="#example-1-2-c">Option C: Other buildsystems</a> - <a href="#example-1-2-d">Option D: VS Project (Individual Project integration)</a> - <a href="#example-2">Example 2: Package a remote project (zlib)</a> +- <a href="example-3-patch-libpng.md">Example 3: Patching libpng to work for uwp-x86</a> <a name="example-1"></a> ## Example 1: C++ REST SDK diff --git a/docs/FAQ.md b/docs/FAQ.md index aff30468b..15608ae74 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -10,22 +10,27 @@ In the preview release, we do not have a supported way to distribute individual We instead recommend copying the entire system as a whole (which ensures that every package and its dependencies stay in sync with each other). -## How will the libs will be updated locally? +## How do I update libraries? The `vcpkg update` command lists all packages which are out-of-sync with your current portfiles. To update a package, follow the instructions in the command. +## How do I get more libraries? +The list of libraries is enumerated from the [`ports\`](../ports) directory. By design, you can add and remove libraries from this directory as you see fit for yourself or your company (see [Example #2](EXAMPLES.md#example-2)). + +We recommend cloning directly from [GitHub](https://github.com/microsoft/vcpkg) and using `git pull` to update the list of portfiles. Once you've updated your portfiles, `vcpkg update` will indicate any installed libraries that are now out of date. + ## Can I build a private library with this tool? Yes. Follow [Example #2](EXAMPLES.md#example-2) for creating a portfile using a fake URL. Then, either pre-seed the `downloads\` folder with a zip containing your private sources or replace the normal `vcpkg_download_distfile` and `vcpkg_extract_source_archive` with functions that unpack your source code. ## Can I use a prebuilt private library with this tool? Yes. The `portfile.cmake` for a library is fundamentally a script that places the headers and binaries into the correct arrangement in the `${CURRENT_PACKAGES_DIR}`, so to pull in prebuilt binaries you can write a portfile which directly downloads and arranges the files. -To see an example of this, look at the [`opengl`](../ports/opengl/portfile.cmake) package which simply copies files out of the Windows SDK. +To see an example of this, look at [`ports\opengl\portfile.cmake`](../ports/opengl/portfile.cmake) package which simply copies files out of the Windows SDK. ## Which platforms I can target with Vcpkg? We currently target Windows Desktop (x86 and x64) as well as the Universal Windows Platform (x86, x64, and ARM). See `vcpkg help triplet` for the current list. ## Does `vcpkg.exe` run on Linux/OSX? -No, for this preview we are focusing on Windows as a host platform. If you'd be interested in having Vcpkg run on Linux or OSX, please let us know in an [issue](https://github.com/microsoft/vcpkg/issues). +No, for this preview we are focusing on Windows as a host platform. If you'd be interested in having Vcpkg run on Linux or OSX, please let us know in [this issue](https://github.com/microsoft/vcpkg/issues/57). ## How do I use different versions of a library on one machine? Within a single instance of Vcpkg (e.g. one set of `installed\`, `packages\`, `ports\` and so forth), you can only have one version of a library installed (otherwise, the headers would conflict with each other!). This is because a package in Vcpkg corresponds to the `X-dev` or `X-devel` packages in other system package managers. @@ -48,13 +53,8 @@ By saving the changes to the portfile (and checking them in), you'll get the sam ## How is CMake used internally by Vcpkg? Vcpkg uses CMake internally as a build scripting language. This is because CMake is already an extremely common build system for cross-platform open source libraries and is becoming very popular for C++ projects in general. It is easy to acquire on Windows (does not require system-wide installation) and reasonably legible for unfamiliar users. -## How does my list of libraries get updated? -The list of libraries is enumerated from the `ports\` directory. By design, you can add and remove libraries from this directory as you see fit for yourself or your company (see [Example #2](EXAMPLES.md#example-2)). - -We recommend cloning directly from [GitHub](https://github.com/microsoft/vcpkg) and using `git pull` to update the list of portfiles. Once you've updated your portfiles, `vcpkg update` will indicate any installed libraries that are now out of date. - -## Will it support also downloading compiled binaries from a public or private server? -We do plan to eventually support downloading precompiled binaries, similar to other systems package managers. +## Will Vcpkg support downloading compiled binaries from a public or private server? +We do plan to eventually support downloading precompiled binaries, similar to other system package managers. In a corporate scenario, we currently recommend building the libraries once and distributing the entire vcpkg root directory to everyone else on the project through some raw file transport such as a network share or HTTP host. @@ -64,7 +64,7 @@ We plan to only support Visual Studio 2015 and above. ## Can I acquire my package's sources by Git url+tag? Yes, however we prefer compressed archives of the specific release/commit since the internal downloads and build trees are meant to be read only. Github provides archives for every commit, tag, and branch, so it's always possible to perform this substitution for repositories hosted there. -See `ports\cpprestsdk\portfile.cmake` and `ports\opencv\portfile.cmake` for examples of using git directly. +See [`ports\cpprestsdk\portfile.cmake`](../ports/cpprestsdk/portfile.cmake) for an example of using git directly. ## Why not NuGet? NuGet is a package manager for .NET libraries with a strong dependency on MSBuild. It does not meet the specific needs of Native C++ customers in at least three ways. diff --git a/docs/EXAMPLE_fix_libpng.md b/docs/example-3-patch-libpng.md index 535927c16..cc963cbfc 100644 --- a/docs/EXAMPLE_fix_libpng.md +++ b/docs/example-3-patch-libpng.md @@ -1,6 +1,6 @@ -Fixing libpng:x86-uwp -===================== +## Example 3: Patching libpng to work for uwp-x86 +### Initial error logs First, try building: ``` @@ -59,6 +59,9 @@ Next, looking at the above logs (build-...-out.log and build-...-err.log). Time Elapsed 00:00:04.19 ``` + +### Identify the problematic code + Taking a look at [MSDN](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx) shows that `ExitProcess` is only available for desktop apps. Additionally, it's useful to see the surrounding context: ```c @@ -107,7 +110,9 @@ This already gives us some great clues, but the full definition tells the comple #endif ``` -`abort()` is a standard CRT call and certainly available in UWP, so we just need to convince libpng to be more platform agnostic. The easiest and most reliable way to achive is to patch the code; while in this particular case we could pass in a compiler flag to override `PNG_ABORT` because this is a private header, in general it is more reliable to avoid adding more required compiler switches when possible (especially when it isn't already exposed as a CMake option). +`abort()` is a standard CRT call and certainly available in UWP, so we just need to convince libpng to be more platform agnostic. The easiest and most reliable way to achieve this is to patch the code; while in this particular case we could pass in a compiler flag to override `PNG_ABORT` because this is a private header, in general it is more reliable to avoid adding more required compiler switches when possible (especially when it isn't already exposed as a CMake option). + +### Patching the code to improve compatibility I recommend using git to create the patch file, since you'll already have it installed. ``` @@ -144,22 +149,18 @@ Finally, we need to apply the patch after extracting the source. ... vcpkg_extract_source_archive(${ARCHIVE}) -find_program(GIT git) -vcpkg_execute_required_process( - COMMAND ${GIT} init - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src/libpng-1.6.24 - LOGNAME git-init -) -execute_process( - COMMAND ${GIT} apply "${CMAKE_CURRENT_LIST_DIR}/use-abort-on-all-platforms.patch" --ignore-whitespace --whitespace=nowarn - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src/libpng-1.6.24 +vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libpng-1.6.24 + PATCHES "${CMAKE_CURRENT_LIST_DIR}/use-abort-on-all-platforms.patch" ) vcpkg_configure_cmake( ... ``` -To be completely sure this works from the top, we need to purge the package: +### Verification + +To be completely sure this works from scratch, we need to purge the package: ``` PS D:\src\vcpkg> vcpkg remove --purge libpng:x86-uwp diff --git a/ports/ace/CONTROL b/ports/ace/CONTROL new file mode 100644 index 000000000..352d2b74a --- /dev/null +++ b/ports/ace/CONTROL @@ -0,0 +1,3 @@ +Source: ace +Version: 6.4.0 +Description: The ADAPTIVE Communication Environment diff --git a/ports/ace/portfile.cmake b/ports/ace/portfile.cmake new file mode 100644 index 000000000..301354cae --- /dev/null +++ b/ports/ace/portfile.cmake @@ -0,0 +1,86 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ACE_wrappers/ace) +vcpkg_download_distfile(ARCHIVE + URL "http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.0.zip" + FILENAME "ACE-6.4.0.zip" + SHA512 3543291332b96cf06a966dedda617169e8db051cebbbc4f05cdc2c2c9e7908174f8ed67bc152bbcd57541279d3addb1138f1fc092468e856c2bb04ee6ad2b95a +) +vcpkg_extract_source_archive(${ARCHIVE}) + +if (TRIPLET_SYSTEM_ARCH MATCHES "arm") + message(FATAL_ERROR, "ARM is currently not supported.") + return() +elseif (TRIPLET_SYSTEM_ARCH MATCHES "x86") + set(MSBUILD_PLATFORM "Win32") +else () + set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH}) +endif() + +# Add ace/config.h file +# see http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/ACE-INSTALL.html#win32 +file(WRITE ${SOURCE_PATH}/config.h "#include \"ace/config-windows.h\"") +vcpkg_build_msbuild( + PROJECT_PATH ${SOURCE_PATH}/ace_vc14.sln + PLATFORM ${MSBUILD_PLATFORM} +) + +# ACE itself does not define an install target, so it is not clear which +# headers are public and which not. For the moment we install everything +# that is in the source path and ends in .h, .inl +function(install_ace_headers_subdirectory SOURCE_PATH RELATIVE_PATH) + file(GLOB HEADER_FILES ${SOURCE_PATH}/${RELATIVE_PATH}/*.h ${SOURCE_PATH}/${RELATIVE_PATH}/*.inl) + file(INSTALL ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ace/${RELATIVE_PATH}) +endfunction() + +# We manually install header found in the ace directory because in that case +# we are supposed to install also *cpp files, see ACE_wrappers\debian\libace-dev.install file +file(GLOB HEADER_FILES ${SOURCE_PATH}/*.h ${SOURCE_PATH}/*.inl ${SOURCE_PATH}/*.cpp) +file(INSTALL ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ace/) + +# Install headers in subdirectory +install_ace_headers_subdirectory(${SOURCE_PATH} "Compression") +install_ace_headers_subdirectory(${SOURCE_PATH} "Compression/rle") +install_ace_headers_subdirectory(${SOURCE_PATH} "ETCL") +install_ace_headers_subdirectory(${SOURCE_PATH} "Monitor_Control") +install_ace_headers_subdirectory(${SOURCE_PATH} "os_include") +install_ace_headers_subdirectory(${SOURCE_PATH} "os_include/arpa") +install_ace_headers_subdirectory(${SOURCE_PATH} "os_include/net") +install_ace_headers_subdirectory(${SOURCE_PATH} "os_include/netinet") +install_ace_headers_subdirectory(${SOURCE_PATH} "os_include/sys") + +# Install the libraries +function(install_ace_library SOURCE_PATH ACE_LIBRARY) + set(LIB_PATH ${SOURCE_PATH}/../lib/) + file(INSTALL + ${LIB_PATH}/${ACE_LIBRARY}d.dll + ${LIB_PATH}/${ACE_LIBRARY}d_dll.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin + ) + + file(INSTALL + ${LIB_PATH}/${ACE_LIBRARY}.dll + ${LIB_PATH}/${ACE_LIBRARY}.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/bin + ) + + file(INSTALL + ${LIB_PATH}/${ACE_LIBRARY}d.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib + ) + + file(INSTALL + ${LIB_PATH}/${ACE_LIBRARY}.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/lib + ) +endfunction() + +install_ace_library(${SOURCE_PATH} "ACE") +install_ace_library(${SOURCE_PATH} "ACE_Compression") +install_ace_library(${SOURCE_PATH} "ACE_ETCL") +install_ace_library(${SOURCE_PATH} "ACE_Monitor_Control") +install_ace_library(${SOURCE_PATH} "ACE_QoS") +install_ace_library(${SOURCE_PATH} "ACE_RLECompression") + +# Handle copyright +file(COPY ${SOURCE_PATH}/../COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/ace) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/ace/COPYING ${CURRENT_PACKAGES_DIR}/share/ace/copyright) diff --git a/ports/asio/CONTROL b/ports/asio/CONTROL new file mode 100644 index 000000000..466ef6cd0 --- /dev/null +++ b/ports/asio/CONTROL @@ -0,0 +1,3 @@ +Source: asio +Version: 1.10.6 +Description: Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach. diff --git a/ports/asio/portfile.cmake b/ports/asio/portfile.cmake new file mode 100644 index 000000000..8c28b951b --- /dev/null +++ b/ports/asio/portfile.cmake @@ -0,0 +1,16 @@ +include(vcpkg_common_functions) +SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/asio-asio-1-10-6/asio/) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/chriskohlhoff/asio/archive/asio-1-10-6.zip" + FILENAME "asio-1-10-6.zip" + SHA512 7e3fde7e88d305d19b88482b73c8b7a41751d65e81bd23dd8ef45eb4e3ef3a10629696b4d347e5a68f08d6fb2dede15a2f38c7ee8d18ac88be769215542da4c6 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +# Handle copyright +file(COPY ${CURRENT_BUILDTREES_DIR}/src/asio-asio-1-10-6/asio/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/asio) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/asio/COPYING ${CURRENT_PACKAGES_DIR}/share/asio/copyright) + +# Copy the asio header files +file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp" PATTERN "*.ipp") +vcpkg_copy_pdbs() diff --git a/ports/assimp/CONTROL b/ports/assimp/CONTROL new file mode 100644 index 000000000..2c4736563 --- /dev/null +++ b/ports/assimp/CONTROL @@ -0,0 +1,4 @@ +Source: assimp +Version: 3.3.1 +Description: The Open Asset import library +Build-Depends: zlib diff --git a/ports/assimp/portfile.cmake b/ports/assimp/portfile.cmake new file mode 100644 index 000000000..cb173702a --- /dev/null +++ b/ports/assimp/portfile.cmake @@ -0,0 +1,38 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +include(${CMAKE_TRIPLET_FILE}) +include(vcpkg_common_functions) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/assimp/assimp/archive/v3.3.1.zip" + FILENAME "assimp-3.3.1.zip" + SHA512 d8488702989629a80297b9aea1f91fd5f3d0736f91cc5d7991a41ade99a445e9897c752fbedb2829350fabb5439d4ea31d34bbedb771b3e66aef23cd40b02122 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_cmake( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/assimp-3.3.1 + OPTIONS -DASSIMP_BUILD_TESTS=False + -DASSIMP_BUILD_ASSIMP_VIEW=False + -DASSIMP_BUILD_ZLIB=False + -DASSIMP_BUILD_ASSIMP_TOOLS=False + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/assimp-3.3 ${CURRENT_PACKAGES_DIR}/share/assimp) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${CURRENT_BUILDTREES_DIR}/src/assimp-3.3.1/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/assimp) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/assimp/LICENSE ${CURRENT_PACKAGES_DIR}/share/assimp/copyright) diff --git a/ports/bond/CONTROL b/ports/bond/CONTROL new file mode 100644 index 000000000..70384f020 --- /dev/null +++ b/ports/bond/CONTROL @@ -0,0 +1,5 @@ +Source: bond +Maintainer: bond@microsoft.com +Version: 5.0.0-4-g53ea136 +Description: Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services. <https://github.com/Microsoft/bond> +Build-Depends: boost, rapidjson diff --git a/ports/bond/portfile.cmake b/ports/bond/portfile.cmake new file mode 100644 index 000000000..36a127738 --- /dev/null +++ b/ports/bond/portfile.cmake @@ -0,0 +1,58 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-53ea13692925bee4ba494ee9de3614f15c09d85d) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/Microsoft/bond/archive/53ea13692925bee4ba494ee9de3614f15c09d85d.zip" + FILENAME "bond-5.0.0-4-g53ea136.zip" + SHA512 fe39dc211f6b99cba3f2284d78a524305dfb8dcd1f597639c45625df369f96c3321cb6782fef9eb34d34fab69c8da9015024eee34be6d0a76d730729517183da +) +vcpkg_extract_source_archive(${ARCHIVE}) + +# To build Bond, you'll either need to have the Haskell toolchain installed +# or set the environment variable BOND_GBC_PATH to point to a directory that +# contains a pre-compiled version of gbc.exe. +# +# You can get a pre-compiled version of gbc from the Bond.Compiler NuGet +# package <http://www.nuget.org/packages/Bond.Compiler/>. +# +# For instructions on installing the Haskell toolchain and getting it to +# work with Bond, see the Bond README +# <https://github.com/Microsoft/bond/blob/master/README.md#windows> + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DBOND_LIBRARIES_ONLY=TRUE +) + +vcpkg_install_cmake() + +# Put the license file where vcpkg expects it +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/bond) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/bond/LICENSE ${CURRENT_PACKAGES_DIR}/share/bond/copyright) + +# vcpkg doesn't--as of version 0.0.30--like executables such as gbc.exe in +# the output. Just delete it for now. +file(REMOVE + ${CURRENT_PACKAGES_DIR}/bin/gbc.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/gbc.exe) + +# There's no way to supress installation of the headers in the debug build, +# so we just delete them. +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Bond's install target installs to lib/bond, but vcpkg expects the lib +# files to end up in lib/, so move them up a directory. +file(RENAME + ${CURRENT_PACKAGES_DIR}/lib/bond/bond.lib + ${CURRENT_PACKAGES_DIR}/lib/bond.lib) +file(RENAME + ${CURRENT_PACKAGES_DIR}/lib/bond/bond_apply.lib + ${CURRENT_PACKAGES_DIR}/lib/bond_apply.lib) +file(RENAME + ${CURRENT_PACKAGES_DIR}/debug/lib/bond/bond.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/bond.lib) +file(RENAME + ${CURRENT_PACKAGES_DIR}/debug/lib/bond/bond_apply.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/bond_apply.lib) + +vcpkg_copy_pdbs() diff --git a/ports/boost/CONTROL b/ports/boost/CONTROL index afd6748af..fc0f3cef7 100644 --- a/ports/boost/CONTROL +++ b/ports/boost/CONTROL @@ -1,3 +1,3 @@ Source: boost -Version: 1.61 +Version: 1.62 Description: Peer-reviewed portable C++ source libraries diff --git a/ports/boost/portfile.cmake b/ports/boost/portfile.cmake index b133b4275..276bbcbcc 100644 --- a/ports/boost/portfile.cmake +++ b/ports/boost/portfile.cmake @@ -1,16 +1,18 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/boost_1_62_0) + vcpkg_download_distfile(ARCHIVE_FILE - URL "http://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2" - FILENAME "boost_1_61_0.tar.bz2" - MD5 6095876341956f65f9d35939ccea1a9f + URLS "https://sourceforge.net/projects/boost/files/boost/1.62.0/boost_1_62_0.tar.bz2" + FILENAME "boost_1_62_0.tar.bz2" + SHA512 5385ae3d5255a433a704169ad454d8dc2b0b5bcae3fb23defd6570df4ff7d845cf9fcbeebccdc1c5db0eec9f82ee3d90040de9507c8167467c635d3b215463be ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) -if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0/b2.exe) +if(NOT EXISTS ${SOURCE_PATH}/b2.exe) message(STATUS "Bootstrapping") vcpkg_execute_required_process( - COMMAND "${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0/bootstrap.bat" - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0 + COMMAND "${SOURCE_PATH}/bootstrap.bat" + WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME bootstrap ) endif() @@ -34,42 +36,45 @@ if(TRIPLET_SYSTEM_NAME MATCHES "WindowsStore") set(ENV{BOOST_BUILD_PATH} ${CMAKE_CURRENT_LIST_DIR}) endif() + +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + message(STATUS "Building ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND "${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0/b2.exe" + COMMAND "${SOURCE_PATH}/b2.exe" --stagedir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/stage --build-dir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${B2_OPTIONS} variant=release - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0 + WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME build-${TARGET_TRIPLET}-rel ) message(STATUS "Building ${TARGET_TRIPLET}-rel done") message(STATUS "Building ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND "${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0/b2.exe" + COMMAND "${SOURCE_PATH}/b2.exe" --stagedir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/stage --build-dir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg ${B2_OPTIONS} variant=debug - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0 + WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME build-${TARGET_TRIPLET}-dbg ) message(STATUS "Building ${TARGET_TRIPLET}-dbg done") message(STATUS "Packaging headers") file( - COPY ${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0/boost + COPY ${SOURCE_PATH}/boost DESTINATION ${CURRENT_PACKAGES_DIR}/include PATTERN "config/user.hpp" EXCLUDE ) -file(COPY ${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0/boost/config/user.hpp +file(COPY ${SOURCE_PATH}/boost/config/user.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include/boost/config/ ) file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp "\n#define BOOST_ALL_DYN_LINK\n" ) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/boost_1_61_0/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost RENAME copyright) +file(INSTALL ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost RENAME copyright) message(STATUS "Packaging headers done") message(STATUS "Packaging ${TARGET_TRIPLET}-rel") diff --git a/ports/bullet3/CONTROL b/ports/bullet3/CONTROL new file mode 100644 index 000000000..fbbec8494 --- /dev/null +++ b/ports/bullet3/CONTROL @@ -0,0 +1,3 @@ +Source: bullet3 +Version: 2.83.7.98d4780 +Description: Bullet Physics is a professional collision detection, rigid body, and soft body dynamics library diff --git a/ports/bullet3/portfile.cmake b/ports/bullet3/portfile.cmake new file mode 100644 index 000000000..171b70bc6 --- /dev/null +++ b/ports/bullet3/portfile.cmake @@ -0,0 +1,36 @@ +include(${CMAKE_TRIPLET_FILE}) +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bullet3-98d47809b4273d97ea06c9b2137ada10af581bb9) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/bulletphysics/bullet3/archive/98d47809b4273d97ea06c9b2137ada10af581bb9.zip" + FILENAME "bullet3-98d47809b4273d97ea06c9b2137ada10af581bb9.zip" + SHA512 eaa3aa5ff124c87f153a9faeabe00955aaa2d87ed5d2297a96e02531eb7fd1286f2b654bd45401690747ca4391dd7c18486f4cbac0da7e835d52874345b9811d +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON + -DUSE_MSVC_RUNTIME_LIBRARY_DLL=ON + -DBUILD_DEMOS=OFF + -DBUILD_CPU_DEMOS=OFF + -DBUILD_BULLET2_DEMOS=OFF + -DBUILD_BULLET3=OFF + -DBUILD_EXTRAS=OFF + -DBUILD_UNIT_TESTS=OFF + -DBUILD_SHARED_LIBS=ON + -DINSTALL_LIBS=ON +) + +vcpkg_build_cmake() +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/bullet3) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/bullet3/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/bullet3/copyright) + +vcpkg_copy_pdbs() diff --git a/ports/cocos2d/portfile.cmake b/ports/cocos2d/portfile.cmake index b39180b40..a4048090b 100644 --- a/ports/cocos2d/portfile.cmake +++ b/ports/cocos2d/portfile.cmake @@ -1,18 +1,19 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10) vcpkg_download_distfile(ARCHIVE_FILE - URL "https://github.com/cocos2d/cocos2d-x/archive/cocos2d-x-3.10.tar.gz" + URLS "https://github.com/cocos2d/cocos2d-x/archive/cocos2d-x-3.10.tar.gz" FILENAME "cocos2d-x-3.10.tar.gz" MD5 7c67068675ad28374448e844b0e463ff ) vcpkg_download_distfile(DEPS_ARCHIVE_FILE - URL "https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-79.zip" + URLS "https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-79.zip" FILENAME "cocos2d-x-v3-deps-79.zip" MD5 5d88ff867205080b9ee8da532437e891 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) -if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10/external/unzip) +if(NOT EXISTS ${SOURCE_PATH}/external/unzip) message(STATUS "Extracting dependencies ${DEPS_ARCHIVE_FILE}") file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/deps) vcpkg_execute_required_process( @@ -20,15 +21,15 @@ if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10/external/un WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/deps LOGNAME extract-deps ) - file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10/external) - file(RENAME ${CURRENT_BUILDTREES_DIR}/deps/cocos2d-x-3rd-party-libs-bin-3-deps-79 ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10/external) + file(REMOVE_RECURSE ${SOURCE_PATH}/external) + file(RENAME ${CURRENT_BUILDTREES_DIR}/deps/cocos2d-x-3rd-party-libs-bin-3-deps-79 ${SOURCE_PATH}/external) endif() message(STATUS "Extracting dependencies done") -file(REMOVE ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10/cmake/Modules/FindGLFW3.cmake) +file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindGLFW3.cmake) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DUSE_CHIPMUNK=OFF -DUSE_BOX2D=OFF @@ -39,9 +40,8 @@ vcpkg_configure_cmake( -DUSE_PREBUILT_LIBS=OFF ) -vcpkg_build_cmake() vcpkg_install_cmake() -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10/licenses/LICENSE_cocos2d-x.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cocos2d-x RENAME copyright) +file(INSTALL ${SOURCE_PATH}/licenses/LICENSE_cocos2d-x.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cocos2d-x RENAME copyright) vcpkg_copy_pdbs() diff --git a/ports/constexpr/CONTROL b/ports/constexpr/CONTROL new file mode 100644 index 000000000..e8cb4749f --- /dev/null +++ b/ports/constexpr/CONTROL @@ -0,0 +1,3 @@ +Source: constexpr +Version: 1.0 +Description: Small MIT License Library of general stdlib functions written as C++11 constexpr functions. diff --git a/ports/constexpr/portfile.cmake b/ports/constexpr/portfile.cmake new file mode 100644 index 000000000..137bf0e60 --- /dev/null +++ b/ports/constexpr/portfile.cmake @@ -0,0 +1,16 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/constexpr-a98b1db39c909e0130d21d3910d4faf97035a625) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/elbeno/constexpr/archive/a98b1db39c909e0130d21d3910d4faf97035a625.zip" + FILENAME "constexpr-a98b1db39c909e0130d21d3910d4faf97035a625.zip" + SHA512 847e09f9df30cb5fbd8aa280679ff359d73c9e9454ffe3090f66975a15665080629e9a664d057f039b17430d42b5e5f5f3f92831e73c15024060991090209c2e +) +vcpkg_extract_source_archive(${ARCHIVE}) + +# Put the licence file where vcpkg expects it +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/constexpr/LICENSE) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/constexpr/LICENSE ${CURRENT_PACKAGES_DIR}/share/constexpr/copyright) + +# Copy the constexpr header files +file(GLOB HEADER_FILES ${SOURCE_PATH}/src/include/*.h) +file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include) diff --git a/ports/cpprestsdk/portfile.cmake b/ports/cpprestsdk/portfile.cmake index ba9ea77e3..11db7c379 100644 --- a/ports/cpprestsdk/portfile.cmake +++ b/ports/cpprestsdk/portfile.cmake @@ -41,7 +41,6 @@ vcpkg_configure_cmake( -DCASA_INSTALL_HEADERS=OFF ) -vcpkg_build_cmake() vcpkg_install_cmake() file(COPY ${CURRENT_BUILDTREES_DIR}/src/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cpprestsdk) diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index fc1115741..4c1a7bf3a 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -1,13 +1,14 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/curl-7.48.0) vcpkg_download_distfile(ARCHIVE_FILE - URL "https://curl.haxx.se/download/curl-7.48.0.tar.bz2" + URLS "https://curl.haxx.se/download/curl-7.48.0.tar.bz2" FILENAME "curl-7.48.0.tar.bz2" - MD5 d42e0fc34a5cace5739631cc040974fe + SHA512 9bb554eaf4ccaced0fa9b38de4f381eab84b96c1aa07a45d83ddfd38a925044d0fe9fac517263f67f009d2294a31c33dedb2267defbab0cb14f96091bbed5f92 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/curl-7.48.0 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DBUILD_CURL_TESTS=OFF -DBUILD_CURL_EXE=OFF @@ -16,9 +17,8 @@ vcpkg_configure_cmake( -DENABLE_DEBUG=ON ) -vcpkg_build_cmake() vcpkg_install_cmake() -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/curl-7.48.0/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/curl RENAME copyright) +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/curl RENAME copyright) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) vcpkg_copy_pdbs()
\ No newline at end of file diff --git a/ports/doctest/CONTROL b/ports/doctest/CONTROL new file mode 100644 index 000000000..df41ef19f --- /dev/null +++ b/ports/doctest/CONTROL @@ -0,0 +1,3 @@ +Source: doctest +Version: 1.1.0 +Description: The lightest feature-rich C++ single-header testing framework for unit tests and TDD diff --git a/ports/doctest/portfile.cmake b/ports/doctest/portfile.cmake new file mode 100644 index 000000000..c392b2467 --- /dev/null +++ b/ports/doctest/portfile.cmake @@ -0,0 +1,14 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/doctest-1.1.0) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/onqtam/doctest/archive/1.1.0.zip" + FILENAME "doctest-1.1.0.zip" + SHA512 3cbdbb82d2dceff5a34aaed45222832c5767f21b64b271c41c2da7bae1f9e364a60758a8b6ce64285999afc30dd76de980e287663fa3119d0bcc1d2b45514e0b +) +vcpkg_extract_source_archive(${ARCHIVE}) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/doctest RENAME copyright) + +# Copy header file +file(INSTALL ${SOURCE_PATH}/doctest/doctest.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/doctest) diff --git a/ports/eigen3/portfile.cmake b/ports/eigen3/portfile.cmake index 54e9c0c5a..fd62466a5 100644 --- a/ports/eigen3/portfile.cmake +++ b/ports/eigen3/portfile.cmake @@ -1,19 +1,21 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/eigen-eigen-dc6cfdf9bcec) vcpkg_download_distfile(ARCHIVE - URL "http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2" + URLS "http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2" FILENAME "eigen-3.2.9.tar.bz2" - MD5 de11bfbfe2fd2dc4b32e8f416f58ee98 + SHA512 2734ce70e0b04dc5839715a3cc9b8f90e05b341cfca42a7d586df213a9a14fe5642c76ccf36c16d020ae167c0d6e4d5cc306f0b3bf1f519c58372b0736ca7e63 ) vcpkg_extract_source_archive(${ARCHIVE}) +file(GLOB_RECURSE GARBAGE ${SOURCE_PATH}/Eigen/CMakeLists.*) +if(GARBAGE) + file(REMOVE ${GARBAGE}) +endif() + # Put the licence file where vcpkg expects it -file(RENAME ${CURRENT_BUILDTREES_DIR}/src/eigen-eigen-dc6cfdf9bcec ${CURRENT_BUILDTREES_DIR}/src/eigen) -file(COPY ${CURRENT_BUILDTREES_DIR}/src/eigen/COPYING.README DESTINATION ${CURRENT_PACKAGES_DIR}/share/eigen3/COPYING.README) +file(COPY ${SOURCE_PATH}/COPYING.README DESTINATION ${CURRENT_PACKAGES_DIR}/share/eigen3/COPYING.README) file(RENAME ${CURRENT_PACKAGES_DIR}/share/eigen3/COPYING.README ${CURRENT_PACKAGES_DIR}/share/eigen3/copyright) -file(GLOB_RECURSE GARBAGE ${CURRENT_BUILDTREES_DIR}/src/eigen/Eigen/CMakeLists.*) -file(REMOVE ${GARBAGE}) - # Copy the eigen header files -file(COPY ${CURRENT_BUILDTREES_DIR}/src/eigen/Eigen/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/Eigen/) +file(COPY ${SOURCE_PATH}/Eigen/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/Eigen/) vcpkg_copy_pdbs() diff --git a/ports/expat/portfile.cmake b/ports/expat/portfile.cmake index 9a396774d..7f547d091 100644 --- a/ports/expat/portfile.cmake +++ b/ports/expat/portfile.cmake @@ -1,22 +1,22 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/expat-2.1.1) vcpkg_download_distfile(ARCHIVE_FILE - URL "http://downloads.sourceforge.net/project/expat/expat/2.1.1/expat-2.1.1.tar.bz2" + URLS "http://downloads.sourceforge.net/project/expat/expat/2.1.1/expat-2.1.1.tar.bz2" FILENAME "expat-2.1.1.tar.bz2" - MD5 7380a64a8e3a9d66a9887b01d0d7ea81 + SHA512 088e2ef3434f2affd4fc79fe46f0e9826b9b4c3931ddc780cd18892f1cd1e11365169c6807f45916a56bb6abcc627dcd17a23f970be0bf464f048f5be2713628 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/expat-2.1.1 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DBUILD_examples=OFF -DBUILD_tests=OFF -DBUILD_tools=OFF ) -vcpkg_build_cmake() vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/expat-2.1.1/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/expat RENAME copyright) +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/expat RENAME copyright) vcpkg_copy_pdbs()
\ No newline at end of file diff --git a/ports/fmt/CONTROL b/ports/fmt/CONTROL index 9dfbac160..a84adbfc3 100644 --- a/ports/fmt/CONTROL +++ b/ports/fmt/CONTROL @@ -1,3 +1,3 @@ Source: fmt -Version: 3.0.0 +Version: 3.0.0-1 Description: Formatting library for C++. It can be used as a safe alternative to printf or as a fast alternative to IOStreams. diff --git a/ports/fmt/portfile.cmake b/ports/fmt/portfile.cmake index 9cf5ed4be..4e1c69903 100644 --- a/ports/fmt/portfile.cmake +++ b/ports/fmt/portfile.cmake @@ -1,22 +1,22 @@ include(vcpkg_common_functions) - +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/fmt-3.0.0) vcpkg_download_distfile(ARCHIVE_FILE - URL "https://github.com/fmtlib/fmt/archive/3.0.0.tar.gz" + URLS "https://github.com/fmtlib/fmt/archive/3.0.0.tar.gz" FILENAME "fmt-3.0.0.tar.gz" - MD5 deeac02aa6d00d6d04502087fdf88b6f + SHA512 20c9b1ffe8b46cb5d22015122fc698a75ad854709d3de1a1316b6040d86f54bada4e6d7263f2f1fd94cb13ac37ee9447c162c6aec3f3af650455e8a8a9804871 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/fmt-3.0.0 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DFMT_TEST=OFF + -DFMT_DOC=OFF ) -vcpkg_build_cmake() vcpkg_install_cmake() -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/fmt-3.0.0/LICENSE.rst DESTINATION ${CURRENT_PACKAGES_DIR}/share/fmt RENAME copyright) +file(INSTALL ${SOURCE_PATH}/LICENSE.rst DESTINATION ${CURRENT_PACKAGES_DIR}/share/fmt RENAME copyright) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE ${CURRENT_PACKAGES_DIR}/include/fmt/format.cc) file(REMOVE ${CURRENT_PACKAGES_DIR}/include/fmt/ostream.cc) diff --git a/ports/freetype/portfile.cmake b/ports/freetype/portfile.cmake index 641d2e5f9..390030551 100644 --- a/ports/freetype/portfile.cmake +++ b/ports/freetype/portfile.cmake @@ -1,23 +1,23 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freetype-2.6.3) vcpkg_download_distfile(ARCHIVE - URL "http://download.savannah.gnu.org/releases/freetype/freetype-2.6.3.tar.bz2" + URLS "http://download.savannah.gnu.org/releases/freetype/freetype-2.6.3.tar.bz2" FILENAME "freetype-2.6.3.tar.bz2" - MD5 0037b25a8c090bc8a1218e867b32beb1 + SHA512 e1f9018835fc88beeb4479537b59f866c52393ae18d24a1e0710a464cf948ab02b35c2c6043bc20c1db3a04871ee4eb0bb1d210550c0ea2780c8b1aea98fbf0d ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freetype-2.6.3 + SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Support-Windows-DLLs-via-CMAKE_WINDOWS_EXPORT_ALL_SY.patch ) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freetype-2.6.3 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DBUILD_SHARED_LIBS=ON ) -vcpkg_build_cmake() vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include) @@ -31,9 +31,9 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(COPY - ${CURRENT_BUILDTREES_DIR}/src/freetype-2.6.3/docs/LICENSE.TXT - ${CURRENT_BUILDTREES_DIR}/src/freetype-2.6.3/docs/FTL.TXT - ${CURRENT_BUILDTREES_DIR}/src/freetype-2.6.3/docs/GPLv2.TXT + ${SOURCE_PATH}/docs/LICENSE.TXT + ${SOURCE_PATH}/docs/FTL.TXT + ${SOURCE_PATH}/docs/GPLv2.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/freetype ) file(RENAME ${CURRENT_PACKAGES_DIR}/share/freetype/LICENSE.TXT ${CURRENT_PACKAGES_DIR}/share/freetype/copyright) diff --git a/ports/gflags/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch b/ports/gflags/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch new file mode 100644 index 000000000..d099ea616 --- /dev/null +++ b/ports/gflags/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch @@ -0,0 +1,51 @@ +From 5af642bdfe023a7c857d1d26593af586516bf696 Mon Sep 17 00:00:00 2001 +From: Sergey Sharybin <sergey.vfx@gmail.com> +Date: Thu, 31 Dec 2015 17:16:26 +0500 +Subject: [PATCH] Fix some compilation warnings with MSVC 2015 + +MSVC 2015 already defines vsnprintf() and va_copy(). +--- + src/windows_port.cc | 2 ++ + src/windows_port.h | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/src/windows_port.cc b/src/windows_port.cc +index 1f40458..b5b7194 100644 +--- a/src/windows_port.cc ++++ b/src/windows_port.cc +@@ -44,6 +44,7 @@ + + // These call the windows _vsnprintf, but always NUL-terminate. + #if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ ++#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */ + + #ifdef _MSC_VER + # pragma warning(push) +@@ -68,4 +69,5 @@ int snprintf(char *str, size_t size, const char *format, ...) { + return r; + } + ++#endif /* if !(defined(_MSC_VER) && _MSC_VER >= 1900) */ + #endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ +diff --git a/src/windows_port.h b/src/windows_port.h +index c8ff24f..554b9c9 100644 +--- a/src/windows_port.h ++++ b/src/windows_port.h +@@ -63,12 +63,14 @@ + * name vsnprintf, since windows defines that (but not snprintf (!)). + */ + #if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ ++#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */ + extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size, + const char *format, ...); + extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size, + const char *format, va_list ap); + #define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap) + #define va_copy(dst, src) (dst) = (src) ++#endif + #endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ + + #ifdef _MSC_VER +-- +2.10.0.windows.1 + diff --git a/ports/gflags/CONTROL b/ports/gflags/CONTROL new file mode 100644 index 000000000..03977243f --- /dev/null +++ b/ports/gflags/CONTROL @@ -0,0 +1,3 @@ +Source: gflags +Version: 2.1.2 +Description: A C++ library that implements commandline flags processing diff --git a/ports/gflags/portfile.cmake b/ports/gflags/portfile.cmake new file mode 100644 index 000000000..ca315ae31 --- /dev/null +++ b/ports/gflags/portfile.cmake @@ -0,0 +1,53 @@ +include(vcpkg_common_functions) +find_program(GIT git) + +set(GIT_URL "https://github.com/gflags/gflags.git") +set(GIT_TAG "v2.1.2") + +if(NOT EXISTS "${DOWNLOADS}/gflags.git") + message(STATUS "Cloning") + vcpkg_execute_required_process( + COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/gflags.git + WORKING_DIRECTORY ${DOWNLOADS} + LOGNAME clone + ) +endif() +message(STATUS "Cloning done") + +if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") + message(STATUS "Adding worktree and patching") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}) + vcpkg_execute_required_process( + COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_TAG} + WORKING_DIRECTORY ${DOWNLOADS}/gflags.git + LOGNAME worktree + ) + message(STATUS "Patching") + vcpkg_execute_required_process( + COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch --ignore-whitespace --whitespace=fix + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src + LOGNAME patch + ) +endif() +message(STATUS "Adding worktree and patching done") + +vcpkg_configure_cmake( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + OPTIONS + -DBUILD_SHARED_LIBS=ON +) + +vcpkg_install_cmake() + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +file(RENAME ${CURRENT_PACKAGES_DIR}/cmake ${CURRENT_PACKAGES_DIR}/share/gflags) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gflags.dll ${CURRENT_PACKAGES_DIR}/bin/gflags.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gflags_nothreads.dll ${CURRENT_PACKAGES_DIR}/bin/gflags_nothreads.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gflags.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gflags.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gflags_nothreads.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gflags_nothreads.dll) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) + +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/gflags RENAME copyright) + +vcpkg_copy_pdbs() diff --git a/ports/glew/portfile.cmake b/ports/glew/portfile.cmake index 29d857be4..3b35830f6 100644 --- a/ports/glew/portfile.cmake +++ b/ports/glew/portfile.cmake @@ -1,14 +1,24 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0) vcpkg_download_distfile(ARCHIVE_FILE - URL "http://downloads.sourceforge.net/project/glew/glew/1.13.0/glew-1.13.0.tgz" + URLS "http://downloads.sourceforge.net/project/glew/glew/1.13.0/glew-1.13.0.tgz" FILENAME "glew-1.13.0.tgz" - MD5 7cbada3166d2aadfc4169c4283701066 + SHA512 8fc8d7c0d2cd9235ea51db9972f492701827bff40642fdb3cc54c10b0737dba8e6d8d0dcd8c5aa5bfaaae39c6198ba3d4292cd1662fbe1977eb9a5d187ba635f ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) -if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/build/vc12/glew_shared14.vcxproj) +IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") + SET(BUILD_ARCH "Win32") +ELSEIF(TRIPLET_SYSTEM_ARCH MATCHES "arm") + MESSAGE(FATAL_ERROR, " ARM is currently not supported.") + RETURN() +ELSE() + SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) +ENDIF() + +if(NOT EXISTS ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj) message(STATUS "Upgrading projects") - file(READ ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/build/vc12/glew_shared.vcxproj PROJ) + file(READ ${SOURCE_PATH}/build/vc12/glew_shared.vcxproj PROJ) string(REPLACE "<PlatformToolset>v120</PlatformToolset>" "<PlatformToolset>v140</PlatformToolset>" @@ -17,45 +27,38 @@ if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/build/vc12/glew_shared14 "opengl32.lib%" "opengl32.lib\;%" PROJ ${PROJ}) - file(WRITE ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/build/vc12/glew_shared14.vcxproj ${PROJ}) + file(WRITE ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj ${PROJ}) endif() message(STATUS "Upgrading projects done") vcpkg_build_msbuild( - PROJECT_PATH ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/build/vc12/glew_shared14.vcxproj + PROJECT_PATH ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj ) message(STATUS "Installing") -IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") - SET(BUILD_ARCH "Win32") -ELSEIF(TRIPLET_SYSTEM_ARCH MATCHES "x64") - SET(BUILD_ARCH "x64") -ELSE() - MESSAGE(SEND_ERROR "Unknown TRIPLET_SYSTEM_ARCH") -ENDIF() file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/bin/Debug/${BUILD_ARCH}/glew32d.dll - ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/bin/Debug/${BUILD_ARCH}/glew32d.pdb + ${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.dll + ${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/bin/Release/${BUILD_ARCH}/glew32.dll - ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/bin/Release/${BUILD_ARCH}/glew32.pdb + ${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.dll + ${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/bin ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/lib/Debug/${BUILD_ARCH}/glew32d.lib + ${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32d.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/lib/Release/${BUILD_ARCH}/glew32.lib + ${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/include/GL + ${SOURCE_PATH}/include/GL DESTINATION ${CURRENT_PACKAGES_DIR}/include ) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glew RENAME copyright) +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glew RENAME copyright) vcpkg_copy_pdbs() message(STATUS "Installing done") diff --git a/ports/glfw3/CONTROL b/ports/glfw3/CONTROL index 0015a9105..1e8c1ac73 100644 --- a/ports/glfw3/CONTROL +++ b/ports/glfw3/CONTROL @@ -1,3 +1,3 @@ Source: glfw3 -Version: 3.1.2 +Version: 3.2.1 Description: GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc.
\ No newline at end of file diff --git a/ports/glfw3/portfile.cmake b/ports/glfw3/portfile.cmake index cbfa6134d..8c0a90601 100644 --- a/ports/glfw3/portfile.cmake +++ b/ports/glfw3/portfile.cmake @@ -1,26 +1,27 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glfw-3.2.1) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/glfw/glfw/releases/download/3.1.2/glfw-3.1.2.zip" - FILENAME "glfw-3.1.2.zip" - MD5 8023327bfe979b3fe735e449e2f54842 + URLS "https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.zip" + FILENAME "glfw-3.2.1.zip" + SHA512 73dd6d4a8d28a2b423f0fb25489659c1a845182b7ef09848d4f442cdc489528aea90f43ac84aeedb9d2301c4487f39782b647ee4959e67e83babb838372b980c ) vcpkg_extract_source_archive(${ARCHIVE}) if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/patch.stamp) - file(READ ${CURRENT_BUILDTREES_DIR}/src/glfw-3.1.2/src/glfw3Config.cmake.in CONFIG) + file(READ ${SOURCE_PATH}/src/glfw3Config.cmake.in CONFIG) string(REPLACE "\"@GLFW_LIB_NAME@\"" "NAMES @GLFW_LIB_NAME@ @GLFW_LIB_NAME@dll" CONFIG ${CONFIG} ) string(REPLACE "@PACKAGE_CMAKE_INSTALL_PREFIX@" "@PACKAGE_CMAKE_INSTALL_PREFIX@/../.." CONFIG ${CONFIG} ) - file(WRITE ${CURRENT_BUILDTREES_DIR}/src/glfw-3.1.2/src/glfw3Config.cmake.in ${CONFIG}) - file(APPEND ${CURRENT_BUILDTREES_DIR}/src/glfw-3.1.2/src/glfw3Config.cmake.in "set(GLFW3_LIBRARIES \${GLFW3_LIBRARY})\n") + file(WRITE ${SOURCE_PATH}/src/glfw3Config.cmake.in ${CONFIG}) + file(APPEND ${SOURCE_PATH}/src/glfw3Config.cmake.in "set(GLFW3_LIBRARIES \${GLFW3_LIBRARY})\n") file(WRITE ${CURRENT_BUILDTREES_DIR}/patch.stamp) endif() vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glfw-3.1.2 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DBUILD_SHARED_LIBS=ON -DGLFW_BUILD_EXAMPLES=OFF @@ -31,7 +32,6 @@ vcpkg_configure_cmake( # OPTIONS_DEBUG -DDEBUGGABLE=1 ) -vcpkg_build_cmake() vcpkg_install_cmake() file(MAKE_DIRECTORY @@ -42,9 +42,9 @@ file(MAKE_DIRECTORY file(RENAME ${CURRENT_PACKAGES_DIR}/lib/glfw3.dll ${CURRENT_PACKAGES_DIR}/bin/glfw3.dll) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/glfw3.dll ${CURRENT_PACKAGES_DIR}/debug/bin/glfw3.dll) -file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/glfw ${CURRENT_PACKAGES_DIR}/share/glfw3) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/glfw3 ${CURRENT_PACKAGES_DIR}/share/glfw3) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/glfw/glfwTargets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/glfw3/glfwTargets-debug.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/glfw3/glfw3Targets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/glfw3/glfw3Targets-debug.cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) @@ -52,7 +52,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/glfw3.lib) file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/glfw3.lib) -file(COPY ${CURRENT_BUILDTREES_DIR}/src/glfw-3.1.2/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glfw3) +file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glfw3) file(RENAME ${CURRENT_PACKAGES_DIR}/share/glfw3/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/glfw3/copyright) vcpkg_copy_pdbs() diff --git a/ports/glm/CONTROL b/ports/glm/CONTROL index 1ec4874a9..3e1f91148 100644 --- a/ports/glm/CONTROL +++ b/ports/glm/CONTROL @@ -1,3 +1,3 @@ Source: glm -Version: 0.9.8.0 +Version: 0.9.8.1 Description: OpenGL Mathematics (GLM) https://glm.g-truc.net diff --git a/ports/glm/portfile.cmake b/ports/glm/portfile.cmake index 0d4d08a6d..6b749b2de 100644 --- a/ports/glm/portfile.cmake +++ b/ports/glm/portfile.cmake @@ -1,18 +1,19 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glm) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/g-truc/glm/releases/download/0.9.8.0/glm-0.9.8.0.zip" - FILENAME "glm-0.9.8.0.zip" - MD5 b24613c1f7e16f504d936ae3ac1f4917 + URLS "https://github.com/g-truc/glm/releases/download/0.9.8.1/glm-0.9.8.1.zip" + FILENAME "glm-0.9.8.1.zip" + SHA512 93223ea7a08d969331a6b93d598c0b59dfc09e86770661c444f81939bd175053d3f6b1211a4aa4e59d732df39b97fe491eb35d4ac2efb286a1cf68ed29bfa80a ) vcpkg_extract_source_archive(${ARCHIVE}) # Remove glm/CMakeLists.txt -file(REMOVE ${CURRENT_BUILDTREES_DIR}/src/glm/glm/CMakeLists.txt) +file(REMOVE ${SOURCE_PATH}/glm/CMakeLists.txt) # Put the license file where vcpkg expects it -file(COPY ${CURRENT_BUILDTREES_DIR}/src/glm/copying.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glm/) +file(COPY ${SOURCE_PATH}/copying.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glm/) file(RENAME ${CURRENT_PACKAGES_DIR}/share/glm/copying.txt ${CURRENT_PACKAGES_DIR}/share/glm/copyright) # Copy the glm header files -file(GLOB HEADER_FILES ${CURRENT_BUILDTREES_DIR}/src/glm/glm/*) +file(GLOB HEADER_FILES ${SOURCE_PATH}/glm/*) file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/glm) diff --git a/ports/grpc/CONTROL b/ports/grpc/CONTROL new file mode 100644 index 000000000..ece5b96ce --- /dev/null +++ b/ports/grpc/CONTROL @@ -0,0 +1,4 @@ +Source: grpc +Version: 1.1.0-dev-1674f65 +Build-Depends: zlib, openssl, protobuf +Description: An RPC library and framework
\ No newline at end of file diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake new file mode 100644 index 000000000..53f262c7e --- /dev/null +++ b/ports/grpc/portfile.cmake @@ -0,0 +1,57 @@ +include(vcpkg_common_functions) +find_program(GIT git) + +set(GIT_URL "https://github.com/grpc/grpc.git") +set(GIT_REV "1674f650ad9411448a35b7c19c5dbdaf0ebd8916") + +if(NOT EXISTS "${DOWNLOADS}/grpc.git") + message(STATUS "Cloning") + vcpkg_execute_required_process( + COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/grpc.git + WORKING_DIRECTORY ${DOWNLOADS} + LOGNAME clone + ) +endif() +message(STATUS "Cloning done") + +if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") + message(STATUS "Adding worktree") + vcpkg_execute_required_process( + COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REV} + WORKING_DIRECTORY ${DOWNLOADS}/grpc.git + LOGNAME worktree + ) + message(STATUS "Updating sumbodules") + vcpkg_execute_required_process( + COMMAND ${GIT} submodule update --init third_party/nanopb + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src + LOGNAME submodule + ) +endif() +message(STATUS "Adding worktree and updating sumbodules done") + +vcpkg_configure_cmake( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + OPTIONS + -DgRPC_INSTALL=ON + -DgRPC_ZLIB_PROVIDER=package + -DgRPC_SSL_PROVIDER=package + -DgRPC_PROTOBUF_PROVIDER=package +) + +vcpkg_install_cmake() + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/grpc) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCConfig.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCConfig.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCConfigVersion.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCConfigVersion.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets-release.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-release.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake) + +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) + +vcpkg_copy_pdbs() diff --git a/ports/gsl/portfile.cmake b/ports/gsl/portfile.cmake index 5cf05c985..e674cf2e4 100644 --- a/ports/gsl/portfile.cmake +++ b/ports/gsl/portfile.cmake @@ -1,13 +1,14 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gsl-fd5ad87bf25cb5e87104ee58106dee9bc809cd93) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/Microsoft/GSL/archive/fd5ad87bf25cb5e87104ee58106dee9bc809cd93.zip" + URLS "https://github.com/Microsoft/GSL/archive/fd5ad87bf25cb5e87104ee58106dee9bc809cd93.zip" FILENAME "gsl-fd5ad87bf.zip" - MD5 30935befb50eb3742131ad1056d2d498 + SHA512 81887be57e12bfc4e67353713478e1638bf1bffb8f523cf7241acf5415c2e3fe82ea0c0128380dcb2008afb5f53ac0d4893660626a8cd1eb501da536e6af5692 ) vcpkg_extract_source_archive(${ARCHIVE}) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/gsl-fd5ad87bf25cb5e87104ee58106dee9bc809cd93/gsl DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN "*") +file(INSTALL ${SOURCE_PATH}/gsl DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN "*") # Handle copyright -file(COPY ${CURRENT_BUILDTREES_DIR}/src/gsl-fd5ad87bf25cb5e87104ee58106dee9bc809cd93/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/gsl) +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/gsl) file(RENAME ${CURRENT_PACKAGES_DIR}/share/gsl/LICENSE ${CURRENT_PACKAGES_DIR}/share/gsl/copyright) diff --git a/ports/gtest/0001-Enable-C-11-features-for-VS2015-fix-appveyor-fail.patch b/ports/gtest/0001-Enable-C-11-features-for-VS2015-fix-appveyor-fail.patch new file mode 100644 index 000000000..274942482 --- /dev/null +++ b/ports/gtest/0001-Enable-C-11-features-for-VS2015-fix-appveyor-fail.patch @@ -0,0 +1,177 @@ +From 1695708beda0306f3b4dffd66f4be142425894a0 Mon Sep 17 00:00:00 2001 +From: Arkady Shapkin <arkady.shapkin@gmail.com> +Date: Wed, 2 Mar 2016 02:53:10 +0300 +Subject: [PATCH] Enable C++11 features for VS2015 (fix appveyor fail) + +--- + .gitignore | 13 ++++++++ + googlemock/test/gmock-matchers_test.cc | 5 +++ + googletest/include/gtest/internal/gtest-port.h | 10 ++++-- + googletest/test/gtest-printers_test.cc | 43 ++++++++++++++++++++++--- + googletest/test/gtest_catch_exceptions_test_.cc | 2 +- + 5 files changed, 64 insertions(+), 9 deletions(-) + +diff --git a/.gitignore b/.gitignore +index ce310bc..08a67cd 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -1,2 +1,15 @@ + # Ignore CI build directory + build/ ++_build/ ++ ++# Visual Studio files ++*.sdf ++*.opensdf ++*.VC.opendb ++*.suo ++*.user ++_ReSharper.Caches/ ++Win32-Debug/ ++Win32-Release/ ++x64-Debug/ ++x64-Release/ +diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc +index 9f62c3d..eaba362 100644 +--- a/googlemock/test/gmock-matchers_test.cc ++++ b/googlemock/test/gmock-matchers_test.cc +@@ -58,6 +58,11 @@ + # include <forward_list> // NOLINT + #endif + ++// Disable MSVC warning: "decorated name length exceeded, name was truncated". ++#ifdef _MSC_VER ++# pragma warning(disable:4503) ++#endif ++ + namespace testing { + + namespace internal { +diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h +index 0094ed5..c07c455 100644 +--- a/googletest/include/gtest/internal/gtest-port.h ++++ b/googletest/include/gtest/internal/gtest-port.h +@@ -323,7 +323,7 @@ + // -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a + // value for __cplusplus, and recent versions of clang, gcc, and + // probably other compilers set that too in C++11 mode. +-# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L ++# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L || _MSC_VER >= 1900 + // Compiling in at least C++11 mode. + # define GTEST_LANG_CXX11 1 + # else +@@ -355,12 +355,16 @@ + #if GTEST_STDLIB_CXX11 + # define GTEST_HAS_STD_BEGIN_AND_END_ 1 + # define GTEST_HAS_STD_FORWARD_LIST_ 1 +-# define GTEST_HAS_STD_FUNCTION_ 1 ++# if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824) // works only with VS2015U2 and better ++# define GTEST_HAS_STD_FUNCTION_ 1 ++# endif + # define GTEST_HAS_STD_INITIALIZER_LIST_ 1 + # define GTEST_HAS_STD_MOVE_ 1 + # define GTEST_HAS_STD_SHARED_PTR_ 1 + # define GTEST_HAS_STD_TYPE_TRAITS_ 1 + # define GTEST_HAS_STD_UNIQUE_PTR_ 1 ++# define GTEST_HAS_UNORDERED_MAP_ 1 ++# define GTEST_HAS_UNORDERED_SET_ 1 + #endif + + // C++11 specifies that <tuple> provides std::tuple. +@@ -616,7 +620,7 @@ struct _RTL_CRITICAL_SECTION; + // Determines if hash_map/hash_set are available. + // Only used for testing against those containers. + #if !defined(GTEST_HAS_HASH_MAP_) +-# if _MSC_VER ++# if defined(_MSC_VER) && (_MSC_VER < 1900) + # define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available. + # define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available. + # endif // _MSC_VER +diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc +index 3e97cc2..6320563 100644 +--- a/googletest/test/gtest-printers_test.cc ++++ b/googletest/test/gtest-printers_test.cc +@@ -51,10 +51,15 @@ + #include "gtest/gtest.h" + + // hash_map and hash_set are available under Visual C++, or on Linux. +-#if GTEST_HAS_HASH_MAP_ ++#if GTEST_HAS_UNORDERED_MAP_ ++# include <unordered_map> // NOLINT ++#elif GTEST_HAS_HASH_MAP_ + # include <hash_map> // NOLINT + #endif // GTEST_HAS_HASH_MAP_ +-#if GTEST_HAS_HASH_SET_ ++ ++#if GTEST_HAS_UNORDERED_SET_ ++# include <unordered_set> // NOLINT ++#elif GTEST_HAS_HASH_SET_ + # include <hash_set> // NOLINT + #endif // GTEST_HAS_HASH_SET_ + +@@ -217,18 +222,46 @@ using ::testing::internal::string; + // The hash_* classes are not part of the C++ standard. STLport + // defines them in namespace std. MSVC defines them in ::stdext. GCC + // defines them in ::. ++#if GTEST_HAS_UNORDERED_MAP_ ++ ++#define GTEST_HAS_HASH_MAP_ 1 ++template<class Key, class T> ++using hash_map = ::std::unordered_map<Key, T>; ++template<class Key, class T> ++using hash_multimap = ::std::unordered_multimap<Key, T>; ++ ++#elif GTEST_HAS_HASH_MAP_ ++ + #ifdef _STLP_HASH_MAP // We got <hash_map> from STLport. + using ::std::hash_map; +-using ::std::hash_set; + using ::std::hash_multimap; +-using ::std::hash_multiset; + #elif _MSC_VER + using ::stdext::hash_map; +-using ::stdext::hash_set; + using ::stdext::hash_multimap; ++#endif ++ ++#endif ++ ++#if GTEST_HAS_UNORDERED_SET_ ++ ++#define GTEST_HAS_HASH_SET_ 1 ++template<class Key> ++using hash_set = ::std::unordered_set<Key>; ++template<class Key> ++using hash_multiset = ::std::unordered_multiset<Key>; ++ ++#elif GTEST_HAS_HASH_SET_ ++ ++#ifdef _STLP_HASH_MAP // We got <hash_map> from STLport. ++using ::std::hash_set; ++using ::std::hash_multiset; ++#elif _MSC_VER ++using ::stdext::hash_set; + using ::stdext::hash_multiset; + #endif + ++#endif ++ + // Prints a value to a string using the universal value printer. This + // is a helper for testing UniversalPrinter<T>::Print() for various types. + template <typename T> +diff --git a/googletest/test/gtest_catch_exceptions_test_.cc b/googletest/test/gtest_catch_exceptions_test_.cc +index d0fc82c..c6d953c 100644 +--- a/googletest/test/gtest_catch_exceptions_test_.cc ++++ b/googletest/test/gtest_catch_exceptions_test_.cc +@@ -138,7 +138,7 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) { + } + + // Exceptions in destructors are not supported in C++11. +-#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L ++#if !GTEST_LANG_CXX11 + class CxxExceptionInDestructorTest : public Test { + public: + static void TearDownTestCase() { +-- +2.10.0.windows.1 + diff --git a/ports/gtest/CONTROL b/ports/gtest/CONTROL new file mode 100644 index 000000000..07336b978 --- /dev/null +++ b/ports/gtest/CONTROL @@ -0,0 +1,3 @@ +Source: gtest +Version: 1.8 +Description: GoogleTest and GoogleMock testing frameworks.
\ No newline at end of file diff --git a/ports/gtest/portfile.cmake b/ports/gtest/portfile.cmake new file mode 100644 index 000000000..710736d0d --- /dev/null +++ b/ports/gtest/portfile.cmake @@ -0,0 +1,54 @@ +include(vcpkg_common_functions) + +find_program(GIT git) + +set(GIT_URL "https://github.com/google/googletest.git") +set(GIT_TAG "release-1.8.0") + +if(NOT EXISTS "${DOWNLOADS}/googletest.git") + message(STATUS "Cloning") + vcpkg_execute_required_process( + COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/googletest.git + WORKING_DIRECTORY ${DOWNLOADS} + LOGNAME clone + ) +endif() +message(STATUS "Cloning done") + +if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") + message(STATUS "Adding worktree and patching") + vcpkg_execute_required_process( + COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_TAG} + WORKING_DIRECTORY ${DOWNLOADS}/googletest.git + LOGNAME worktree + ) + message(STATUS "Patching") + vcpkg_execute_required_process( + COMMAND ${GIT} am ${CMAKE_CURRENT_LIST_DIR}/0001-Enable-C-11-features-for-VS2015-fix-appveyor-fail.patch --ignore-whitespace --whitespace=fix + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src + LOGNAME patch + ) +endif() +message(STATUS "Adding worktree and patching done") + +vcpkg_configure_cmake( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + OPTIONS + -DBUILD_SHARED_LIBS=ON +) + +vcpkg_install_cmake() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/googletest/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/gtest RENAME copyright) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin/) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gtest.dll ${CURRENT_PACKAGES_DIR}/bin/gtest.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gtest_main.dll ${CURRENT_PACKAGES_DIR}/bin/gtest_main.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gmock.dll ${CURRENT_PACKAGES_DIR}/bin/gmock.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gmock_main.dll ${CURRENT_PACKAGES_DIR}/bin/gmock_main.dll) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin/) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gtest.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest_main.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gtest_main.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gmock.dll) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gmock_main.dll) + +vcpkg_copy_pdbs() diff --git a/ports/libiconv/CMakeLists.txt b/ports/libiconv/CMakeLists.txt new file mode 100644 index 000000000..2afe89d1d --- /dev/null +++ b/ports/libiconv/CMakeLists.txt @@ -0,0 +1,128 @@ +## +## CMake support for libiconv +## based on the work here: https://github.com/vovythevov/libiconv-cmake +## + +cmake_minimum_required(VERSION 3.0.0) +project(Libiconv) + +# +# Options +# +set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries, Always ON since this code is LGPL" FORCE) + +# Config file +configure_file( + ${Libiconv_SOURCE_DIR}/new_config.h.in + ${Libiconv_BINARY_DIR}/config.h +) +include_directories(${Libiconv_SOURCE_DIR} ${Libiconv_BINARY_DIR}) + +macro(header_injection_hack) + include(CMakeParseArguments) + set(options) + set(oneValueArgs LIBRARY_NAME INPUT OUTPUT) + set(multiValueArgs) + cmake_parse_arguments(hack + "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} + ) + string(TOUPPER ${hack_LIBRARY_NAME} hack_library_name_upper) + set(HAVE_VISIBILITY + "WIN32 + #if defined(${hack_LIBRARY_NAME}_EXPORTS) + #define ${hack_library_name_upper}_DLL_EXPORTED __declspec(dllexport) + #else + #define ${hack_library_name_upper}_DLL_EXPORTED __declspec(dllimport) + #endif + #elif true" + ) + configure_file( + ${hack_INPUT} + ${hack_OUTPUT} + ) +endmacro() +# +# Build libcharset +# +set(libname libcharset) +set(libcharset_source_dir ${Libiconv_SOURCE_DIR}/libcharset) + +if(WIN32) + add_definitions(-DLIBDIR) +endif() + +# Hack: to be able to configure the localcharset.h.build.in correctly, we +# inject code in the variable have visibility +header_injection_hack( + LIBRARY_NAME ${libname} + INPUT ${Libiconv_SOURCE_DIR}/libcharset/include/localcharset.h.build.in + OUTPUT ${Libiconv_BINARY_DIR}/localcharset.h + ) + +set(${libname}_sources + ${libcharset_source_dir}/lib/relocatable.c + ${libcharset_source_dir}/lib/relocatable.h + ${libcharset_source_dir}/lib/localcharset.c + ${Libiconv_BINARY_DIR}/localcharset.h +) + +add_library(${libname} ${${libname}_sources}) +list(APPEND Libiconv_TARGETS ${libname}) +list(APPEND Libiconv_headers ${Libiconv_BINARY_DIR}/localcharset.h) + +# +# Build libiconv +# +set(libname libiconv) + +# Hack: same hack than for libcharset +set(HAVE_WCHAR_T "HAVE_WCHAR_T") +set(USE_MBSTATE_T "USE_MBSTATE_T") +set(BROKEN_WCHAR_H "BROKEN_WCHAR_H") + +header_injection_hack( + LIBRARY_NAME ${libname} + INPUT ${Libiconv_SOURCE_DIR}/include/iconv.h.build.in + OUTPUT ${Libiconv_BINARY_DIR}/iconv.h + ) + +list(APPEND simple_header_config + uniwidth + unitypes + ) +foreach(header ${simple_header_config}) + configure_file( + ${Libiconv_SOURCE_DIR}/srclib/${header}.in.h + ${Libiconv_BINARY_DIR}/${header}.h + ) +endforeach() + +set(${libname}_sources + ${Libiconv_SOURCE_DIR}/lib/iconv.c + ${Libiconv_BINARY_DIR}/iconv.h +) + +add_library(${libname} ${${libname}_sources}) +target_link_libraries(${libname} libcharset) +list(APPEND Libiconv_TARGETS ${libname}) +list(APPEND Libiconv_headers ${Libiconv_BINARY_DIR}/iconv.h) + +# +# Export targets +# +install(TARGETS ${Libiconv_TARGETS} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install(FILES ${Libiconv_headers} DESTINATION include) + +set(Libiconv_TARGETS_FILE ${Libiconv_BINARY_DIR}/LibiconvTargets.cmake) +export(TARGETS ${Libiconv_TARGETS} FILE ${Libiconv_TARGETS_FILE}) + +configure_file( + ${Libiconv_SOURCE_DIR}/LibiconvConfig.cmake.in + ${Libiconv_BINARY_DIR}/LibiconvConfig.cmake + @ONLY +) diff --git a/ports/libiconv/CONTROL b/ports/libiconv/CONTROL new file mode 100644 index 000000000..c79f06bb8 --- /dev/null +++ b/ports/libiconv/CONTROL @@ -0,0 +1,3 @@ +Source: libiconv +Version: 1.14 +Description: GNU Unicode text conversion diff --git a/ports/libiconv/LibiconvConfig.cmake.in b/ports/libiconv/LibiconvConfig.cmake.in new file mode 100644 index 000000000..ec0df8f70 --- /dev/null +++ b/ports/libiconv/LibiconvConfig.cmake.in @@ -0,0 +1,12 @@ +# +# Use file for libiconv. Auto-generated, any change here might be overwritten +# without any warning. +# + +set(Libiconv_SOURCE_DIR "@Libiconv_SOURCE_DIR@") +set(Libiconv_BINARY_DIR "@Libiconv_BINARY_DIR@") +set(Libiconv_LIBRARIES "@Libiconv_TARGETS@") + +if(EXISTS "@Libiconv_TARGETS_FILE@" AND NOT TARGET libcharset) + include("@Libiconv_TARGETS_FILE@") +endif()
\ No newline at end of file diff --git a/ports/libiconv/new_config.h.in b/ports/libiconv/new_config.h.in new file mode 100644 index 000000000..01db0075d --- /dev/null +++ b/ports/libiconv/new_config.h.in @@ -0,0 +1,933 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to the number of bits in type 'ptrdiff_t'. */ +#undef BITSIZEOF_PTRDIFF_T + +/* Define to the number of bits in type 'sig_atomic_t'. */ +#undef BITSIZEOF_SIG_ATOMIC_T + +/* Define to the number of bits in type 'size_t'. */ +#undef BITSIZEOF_SIZE_T + +/* Define to the number of bits in type 'wchar_t'. */ +#undef BITSIZEOF_WCHAR_T + +/* Define to the number of bits in type 'wint_t'. */ +#undef BITSIZEOF_WINT_T + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if // is a file system root distinct from /. */ +#undef DOUBLE_SLASH_IS_DISTINCT_ROOT + +/* Define as good substitute value for EILSEQ. */ +//not undefined on Windows 32/64 +#ifndef _WIN32 +#undef EILSEQ +#endif + +/* Define to 1 to enable a few rarely used encodings. */ +#undef ENABLE_EXTRA + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Define to 1 if the package shall run at any location in the file system. */ +#undef ENABLE_RELOCATABLE + +/* Define to 1 if realpath() can malloc memory, always gives an absolute path, + and handles trailing slash correctly. */ +#undef FUNC_REALPATH_WORKS + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module canonicalize-lgpl shall be considered present. */ +#undef GNULIB_CANONICALIZE_LGPL + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module sigpipe shall be considered present. */ +#undef GNULIB_SIGPIPE + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module strerror shall be considered present. */ +#undef GNULIB_STRERROR + +/* Define to 1 when the gnulib module canonicalize_file_name should be tested. + */ +#undef GNULIB_TEST_CANONICALIZE_FILE_NAME + +/* Define to 1 when the gnulib module environ should be tested. */ +#undef GNULIB_TEST_ENVIRON + +/* Define to 1 when the gnulib module lstat should be tested. */ +#undef GNULIB_TEST_LSTAT + +/* Define to 1 when the gnulib module read should be tested. */ +#undef GNULIB_TEST_READ + +/* Define to 1 when the gnulib module readlink should be tested. */ +#undef GNULIB_TEST_READLINK + +/* Define to 1 when the gnulib module realpath should be tested. */ +#undef GNULIB_TEST_REALPATH + +/* Define to 1 when the gnulib module sigprocmask should be tested. */ +#undef GNULIB_TEST_SIGPROCMASK + +/* Define to 1 when the gnulib module stat should be tested. */ +#undef GNULIB_TEST_STAT + +/* Define to 1 when the gnulib module strerror should be tested. */ +#undef GNULIB_TEST_STRERROR + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the `canonicalize_file_name' function. */ +#undef HAVE_CANONICALIZE_FILE_NAME + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +#undef HAVE_CFLOCALECOPYCURRENT + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +#undef HAVE_CFPREFERENCESCOPYAPPVALUE + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT + +/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_CLEARERR_UNLOCKED + +/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_FEOF_UNLOCKED + +/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FERROR_UNLOCKED + +/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FFLUSH_UNLOCKED + +/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FGETS_UNLOCKED + +/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FPUTC_UNLOCKED + +/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FPUTS_UNLOCKED + +/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FREAD_UNLOCKED + +/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FWRITE_UNLOCKED + +/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_GETCHAR_UNLOCKED + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_GETC_UNLOCKED + +/* Define to 1 if you have the declaration of `program_invocation_name', and + to 0 if you don't. */ +#undef HAVE_DECL_PROGRAM_INVOCATION_NAME + +/* Define to 1 if you have the declaration of `program_invocation_short_name', + and to 0 if you don't. */ +#undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME + +/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_PUTCHAR_UNLOCKED + +/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_PUTC_UNLOCKED + +/* Define to 1 if you have the declaration of `setenv', and to 0 if you don't. + */ +#undef HAVE_DECL_SETENV + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_R + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define if you have the declaration of environ. */ +#undef HAVE_ENVIRON_DECL + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getc_unlocked' function. */ +#undef HAVE_GETC_UNLOCKED + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define if you have the iconv() function and it works. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET + +/* Define to 1 if the system has the type `long long int'. */ +#undef HAVE_LONG_LONG_INT + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define to 1 if you have the <mach-o/dyld.h> header file. */ +#undef HAVE_MACH_O_DYLD_H + +/* Define to 1 if you have the `mbrtowc' function. */ +#undef HAVE_MBRTOWC + +/* Define to 1 if you have the `mbsinit' function. */ +#undef HAVE_MBSINIT + +/* Define to 1 if <wchar.h> declares mbstate_t. */ +#undef HAVE_MBSTATE_T + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if atoll is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ATOLL + +/* Define to 1 if canonicalize_file_name is declared even after undefining + macros. */ +#undef HAVE_RAW_DECL_CANONICALIZE_FILE_NAME + +/* Define to 1 if chown is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_CHOWN + +/* Define to 1 if dprintf is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_DPRINTF + +/* Define to 1 if dup2 is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_DUP2 + +/* Define to 1 if dup3 is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_DUP3 + +/* Define to 1 if endusershell is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ENDUSERSHELL + +/* Define to 1 if environ is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_ENVIRON + +/* Define to 1 if euidaccess is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_EUIDACCESS + +/* Define to 1 if faccessat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FACCESSAT + +/* Define to 1 if fchdir is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FCHDIR + +/* Define to 1 if fchmodat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FCHMODAT + +/* Define to 1 if fchownat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FCHOWNAT + +/* Define to 1 if fcntl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FCNTL + +/* Define to 1 if ffsl is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FFSL + +/* Define to 1 if ffsll is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FFSLL + +/* Define to 1 if fpurge is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FPURGE + +/* Define to 1 if fseeko is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FSEEKO + +/* Define to 1 if fstatat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FSTATAT + +/* Define to 1 if fsync is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FSYNC + +/* Define to 1 if ftello is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FTELLO + +/* Define to 1 if ftruncate is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FTRUNCATE + +/* Define to 1 if futimens is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_FUTIMENS + +/* Define to 1 if getcwd is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETCWD + +/* Define to 1 if getdelim is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETDELIM + +/* Define to 1 if getdomainname is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETDOMAINNAME + +/* Define to 1 if getdtablesize is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETDTABLESIZE + +/* Define to 1 if getgroups is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETGROUPS + +/* Define to 1 if gethostname is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETHOSTNAME + +/* Define to 1 if getline is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETLINE + +/* Define to 1 if getloadavg is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETLOADAVG + +/* Define to 1 if getlogin is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETLOGIN + +/* Define to 1 if getlogin_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETLOGIN_R + +/* Define to 1 if getpagesize is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETPAGESIZE + +/* Define to 1 if getsubopt is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETSUBOPT + +/* Define to 1 if getusershell is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GETUSERSHELL + +/* Define to 1 if grantpt is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GRANTPT + +/* Define to 1 if group_member is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_GROUP_MEMBER + +/* Define to 1 if initstat_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_INITSTAT_R + +/* Define to 1 if lchmod is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LCHMOD + +/* Define to 1 if lchown is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LCHOWN + +/* Define to 1 if link is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LINK + +/* Define to 1 if linkat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LINKAT + +/* Define to 1 if lseek is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LSEEK + +/* Define to 1 if lstat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_LSTAT + +/* Define to 1 if memmem is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MEMMEM + +/* Define to 1 if mempcpy is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MEMPCPY + +/* Define to 1 if memrchr is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MEMRCHR + +/* Define to 1 if mkdirat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKDIRAT + +/* Define to 1 if mkdtemp is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKDTEMP + +/* Define to 1 if mkfifo is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKFIFO + +/* Define to 1 if mkfifoat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKFIFOAT + +/* Define to 1 if mknod is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKNOD + +/* Define to 1 if mknodat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKNODAT + +/* Define to 1 if mkostemp is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKOSTEMP + +/* Define to 1 if mkostemps is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKOSTEMPS + +/* Define to 1 if mkstemp is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKSTEMP + +/* Define to 1 if mkstemps is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_MKSTEMPS + +/* Define to 1 if openat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_OPENAT + +/* Define to 1 if pipe is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PIPE + +/* Define to 1 if pipe2 is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PIPE2 + +/* Define to 1 if popen is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_POPEN + +/* Define to 1 if pread is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PREAD + +/* Define to 1 if pthread_sigmask is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PTHREAD_SIGMASK + +/* Define to 1 if ptsname is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PTSNAME + +/* Define to 1 if pwrite is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_PWRITE + +/* Define to 1 if random_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RANDOM_R + +/* Define to 1 if rawmemchr is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RAWMEMCHR + +/* Define to 1 if readlink is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_READLINK + +/* Define to 1 if readlinkat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_READLINKAT + +/* Define to 1 if realpath is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_REALPATH + +/* Define to 1 if renameat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RENAMEAT + +/* Define to 1 if rmdir is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RMDIR + +/* Define to 1 if rpmatch is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_RPMATCH + +/* Define to 1 if setenv is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SETENV + +/* Define to 1 if setstate_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SETSTATE_R + +/* Define to 1 if setusershell is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SETUSERSHELL + +/* Define to 1 if sigaction is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SIGACTION + +/* Define to 1 if sigaddset is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SIGADDSET + +/* Define to 1 if sigdelset is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SIGDELSET + +/* Define to 1 if sigemptyset is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SIGEMPTYSET + +/* Define to 1 if sigfillset is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SIGFILLSET + +/* Define to 1 if sigismember is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SIGISMEMBER + +/* Define to 1 if sigpending is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SIGPENDING + +/* Define to 1 if sigprocmask is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SIGPROCMASK + +/* Define to 1 if sleep is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SLEEP + +/* Define to 1 if snprintf is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SNPRINTF + +/* Define to 1 if srandom_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SRANDOM_R + +/* Define to 1 if stat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STAT + +/* Define to 1 if stpcpy is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STPCPY + +/* Define to 1 if stpncpy is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STPNCPY + +/* Define to 1 if strcasestr is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRCASESTR + +/* Define to 1 if strchrnul is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRCHRNUL + +/* Define to 1 if strdup is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRDUP + +/* Define to 1 if strerror_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRERROR_R + +/* Define to 1 if strncat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRNCAT + +/* Define to 1 if strndup is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRNDUP + +/* Define to 1 if strnlen is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRNLEN + +/* Define to 1 if strpbrk is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRPBRK + +/* Define to 1 if strsep is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRSEP + +/* Define to 1 if strsignal is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRSIGNAL + +/* Define to 1 if strtod is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRTOD + +/* Define to 1 if strtok_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRTOK_R + +/* Define to 1 if strtoll is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRTOLL + +/* Define to 1 if strtoull is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRTOULL + +/* Define to 1 if strverscmp is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_STRVERSCMP + +/* Define to 1 if symlink is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SYMLINK + +/* Define to 1 if symlinkat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_SYMLINKAT + +/* Define to 1 if tmpfile is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_TMPFILE + +/* Define to 1 if ttyname_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_TTYNAME_R + +/* Define to 1 if unlink is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UNLINK + +/* Define to 1 if unlinkat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UNLINKAT + +/* Define to 1 if unlockpt is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UNLOCKPT + +/* Define to 1 if unsetenv is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UNSETENV + +/* Define to 1 if usleep is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_USLEEP + +/* Define to 1 if utimensat is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_UTIMENSAT + +/* Define to 1 if vdprintf is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_VDPRINTF + +/* Define to 1 if vsnprintf is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_VSNPRINTF + +/* Define to 1 if _Exit is declared even after undefining macros. */ +#undef HAVE_RAW_DECL__EXIT + +/* Define to 1 if you have the `readlink' function. */ +#undef HAVE_READLINK + +/* Define to 1 if you have the `readlinkat' function. */ +#undef HAVE_READLINKAT + +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + +/* Define to 1 if you have the <search.h> header file. */ +#undef HAVE_SEARCH_H + +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +#undef HAVE_SIGNED_SIG_ATOMIC_T + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +#undef HAVE_SIGNED_WCHAR_T + +/* Define to 1 if 'wint_t' is a signed integer type. */ +#undef HAVE_SIGNED_WINT_T + +/* Define to 1 if the system has the type `sigset_t'. */ +#undef HAVE_SIGSET_T + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/bitypes.h> header file. */ +#undef HAVE_SYS_BITYPES_H + +/* Define to 1 if you have the <sys/inttypes.h> header file. */ +#undef HAVE_SYS_INTTYPES_H + +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `tsearch' function. */ +#undef HAVE_TSEARCH + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `unsigned long long int'. */ +#undef HAVE_UNSIGNED_LONG_LONG_INT + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#undef HAVE_VISIBILITY + +/* Define to 1 if you have the <wchar.h> header file. */ +#undef HAVE_WCHAR_H + +/* Define if you have the 'wchar_t' type. */ +#undef HAVE_WCHAR_T + +/* Define to 1 if you have the `wcrtomb' function. */ +#undef HAVE_WCRTOMB + +/* Define to 1 if you have the <winsock2.h> header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if O_NOATIME works. */ +#undef HAVE_WORKING_O_NOATIME + +/* Define to 1 if O_NOFOLLOW works. */ +#undef HAVE_WORKING_O_NOFOLLOW + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to 1 if you have the `_NSGetExecutablePath' function. */ +#undef HAVE__NSGETEXECUTABLEPATH + +/* Define as const if the declaration of iconv() needs const. */ +#ifdef _WIN32 +#define ICONV_CONST const +#else +#undef ICONV_CONST +#endif + +/* Define to the value of ${prefix}, as a string. */ +#undef INSTALLPREFIX + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ +#undef MALLOC_0_IS_NONNULL + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +#undef PTRDIFF_T_SUFFIX + +/* Define to 1 if readlink fails to recognize a trailing slash. */ +#undef READLINK_TRAILING_SLASH_BUG + +/* Define to 1 if stat needs help when passed a directory name with a trailing + slash */ +#undef REPLACE_FUNC_STAT_DIR + +/* Define to 1 if stat needs help when passed a file name with a trailing + slash */ +#undef REPLACE_FUNC_STAT_FILE + +/* Define to 1 if strerror(0) does not return a message implying success. */ +#undef REPLACE_STRERROR_0 + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +#undef SIG_ATOMIC_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +#undef SIZE_T_SUFFIX + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + +/* Define to the prefix of C symbols at the assembler and linker level, either + an underscore or empty. */ +#undef USER_LABEL_PREFIX + +/* Define to 1 if you want getc etc. to use unlocked I/O if available. + Unlocked I/O can improve performance in unithreaded apps, but it is not + safe for multithreaded apps. */ +#undef USE_UNLOCKED_IO + +/* Version number of package */ +#undef VERSION + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +#undef WCHAR_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +#undef WINT_T_SUFFIX + +/* Define if the machine's byte ordering is little endian. */ +#undef WORDS_LITTLEENDIAN + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* The _Noreturn keyword of draft C1X. */ +#ifndef _Noreturn +# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif + + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to 500 only on HP-UX. */ +#undef _XOPEN_SOURCE + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on MacOS X. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef gid_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports + the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of + earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. + __APPLE__ && __MACH__ test for MacOS X. + __APPLE_CC__ tests for the Apple compiler and its version. + __STDC_VERSION__ tests for the C99 mode. */ +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ +# define __GNUC_STDC_INLINE__ 1 +#endif + +/* Define to a type if <wchar.h> does not define. */ +#undef mbstate_t + +/* Define to the type of st_nlink in struct stat, or a supertype. */ +#undef nlink_t + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#undef restrict +/* Work around a bug in Sun C++: it does not support _Restrict or + __restrict__, even though the corresponding Sun C compiler ends up with + "#define restrict _Restrict" or "#define restrict __restrict__" in the + previous line. Perhaps some future version of Sun C++ will work with + restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +# define __restrict__ +#endif + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +#undef size_t + +/* Define as a signed type of the same size as size_t. */ +#undef ssize_t + +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef uid_t + +/* Define as a marker that can be attached to declarations that might not + be used. This helps to reduce warnings, such as from + GCC -Wunused-parameter. */ +#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_UNUSED __attribute__ ((__unused__)) +#else +# define _GL_UNUSED +#endif +/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name + is a misnomer outside of parameter lists. */ +#define _UNUSED_PARAMETER_ _GL_UNUSED + +/* The __pure__ attribute was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +/* The __const__ attribute was added in gcc 2.95. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + + + +/* On Windows, variables that may be in a DLL must be marked specially. */ +#if defined _MSC_VER && defined _DLL +# define DLL_VARIABLE __declspec (dllimport) +#else +# define DLL_VARIABLE +#endif + diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake new file mode 100644 index 000000000..4a18e79ce --- /dev/null +++ b/ports/libiconv/portfile.cmake @@ -0,0 +1,26 @@ +include(vcpkg_common_functions) +vcpkg_download_distfile(ARCHIVE + URLS "https://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz" + FILENAME "libiconv-1.14.tar.gz" + SHA512 b96774fefc4fa1d07948fcc667027701373c34ebf9c4101000428e048addd85a5bb5e05e59f80eb783a3054a3a8a3c0da909450053275bbbf3ffde511eb3f387 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +#Since libiconv uses automake, make and configure, we use a custom CMake file +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14/) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/LibiconvConfig.cmake.in DESTINATION ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14/) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/new_config.h.in DESTINATION ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14/) + +vcpkg_configure_cmake( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14 + +) + +vcpkg_install_cmake() + +# Handle copyright +file(COPY ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libiconv) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libiconv/COPYING ${CURRENT_PACKAGES_DIR}/share/libiconv/copyright) + +# clean out the debug include +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
\ No newline at end of file diff --git a/ports/libjpeg-turbo/portfile.cmake b/ports/libjpeg-turbo/portfile.cmake index 82e5c6ab1..ba68bc48b 100644 --- a/ports/libjpeg-turbo/portfile.cmake +++ b/ports/libjpeg-turbo/portfile.cmake @@ -2,9 +2,9 @@ include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libjpeg-turbo-1.4.90) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/1.4.90.zip" + URLS "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/1.4.90.zip" FILENAME "libjpeg-turbo-1.4.90.zip" - MD5 dcd49a7100e41870faae988f608471af + SHA512 43c3d26c70a7356bb0832276fe82eead040c3f4aa17df118f91a38615bfacfdfb25fab41965f9ca2b69d18e0b937a1bb753e93fa2c114e01d5174fc1100010b4 ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( @@ -27,7 +27,6 @@ vcpkg_configure_cmake( OPTIONS_DEBUG -DINSTALL_HEADERS=OFF ) -vcpkg_build_cmake() vcpkg_install_cmake() file(COPY diff --git a/ports/libpng/portfile.cmake b/ports/libpng/portfile.cmake index c5aa301bb..3b6768560 100644 --- a/ports/libpng/portfile.cmake +++ b/ports/libpng/portfile.cmake @@ -1,10 +1,11 @@ +include(${CMAKE_TRIPLET_FILE}) include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libpng-1.6.24) vcpkg_download_distfile(ARCHIVE - URL "http://download.sourceforge.net/libpng/libpng-1.6.24.tar.xz" + URLS "http://download.sourceforge.net/libpng/libpng-1.6.24.tar.xz" FILENAME "libpng-1.6.24.tar.xz" - MD5 ffcdbd549814787fa8010c372e35ff25 + SHA512 7eccb90f530a9c728e280b2b1776304a808b5deea559632e7bcf4ea219c7cb5e453aa810215465304501127595000717d4b7c5b26a9f8e22e236ec04af53a90f ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( @@ -12,10 +13,19 @@ vcpkg_apply_patches( PATCHES "${CMAKE_CURRENT_LIST_DIR}/use-abort-on-all-platforms.patch" ) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(PNG_STATIC_LIBS OFF) + set(PNG_SHARED_LIBS ON) +else() + set(PNG_STATIC_LIBS ON) + set(PNG_SHARED_LIBS OFF) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS - -DPNG_STATIC=OFF + -DPNG_STATIC=${PNG_STATIC_LIBS} + -DPNG_SHARED=${PNG_SHARED_LIBS} -DPNG_TESTS=OFF -DSKIP_INSTALL_PROGRAMS=ON -DSKIP_INSTALL_EXECUTABLES=ON @@ -24,19 +34,20 @@ vcpkg_configure_cmake( -DSKIP_INSTALL_HEADERS=ON ) -vcpkg_build_cmake() vcpkg_install_cmake() -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/debug/share -) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + vcpkg_copy_pdbs() +else() + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpng16_static.lib ${CURRENT_PACKAGES_DIR}/lib/libpng16.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpng16_staticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libpng16d.lib) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpng ${CURRENT_PACKAGES_DIR}/share/libpng) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpng/libpng16-debug.cmake ${CURRENT_PACKAGES_DIR}/share/libpng/libpng16-debug.cmake) -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/debug/lib/libpng -) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/libpng) file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpng) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpng/LICENSE ${CURRENT_PACKAGES_DIR}/share/libpng/copyright) -vcpkg_copy_pdbs() diff --git a/ports/libuv/portfile.cmake b/ports/libuv/portfile.cmake index 0a830b8e4..d5aafdb21 100644 --- a/ports/libuv/portfile.cmake +++ b/ports/libuv/portfile.cmake @@ -1,8 +1,9 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/libuv/libuv/archive/v1.9.1.zip" + URLS "https://github.com/libuv/libuv/archive/v1.9.1.zip" FILENAME "libuv-v1.9.1.zip" - MD5 4d1e74197920455203954cd8b75f0a2f + SHA512 3eb8711e3612fb3f5a1ddeb4614b2bec29c022ac5c6c2590bc5239825d758a73be0819c52747956a029859ef4e416bf3fce16665bac2c6c4890f736b47c38226 ) if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src) @@ -52,13 +53,13 @@ if(TRIPLET_SYSTEM_ARCH MATCHES "x86|x64") message(STATUS "Building Release") vcpkg_execute_required_process( COMMAND cmd /c vcbuild.bat release ${TRIPLET_SYSTEM_ARCH} shared - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1 + WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME ${TARGET_TRIPLET}-build-rel ) message(STATUS "Building Debug") vcpkg_execute_required_process( COMMAND cmd /c vcbuild.bat debug ${TRIPLET_SYSTEM_ARCH} shared - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1 + WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME ${TARGET_TRIPLET}-build-dbg ) else() @@ -75,28 +76,28 @@ file(MAKE_DIRECTORY ) file(COPY - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/include/tree.h - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/include/uv.h - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/include/uv-version.h - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/include/uv-errno.h - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/include/uv-threadpool.h - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/include/uv-win.h + ${SOURCE_PATH}/include/tree.h + ${SOURCE_PATH}/include/uv.h + ${SOURCE_PATH}/include/uv-version.h + ${SOURCE_PATH}/include/uv-errno.h + ${SOURCE_PATH}/include/uv-threadpool.h + ${SOURCE_PATH}/include/uv-win.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) file(COPY - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/Debug/libuv.dll + ${SOURCE_PATH}/Debug/libuv.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) file(COPY - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/Debug/libuv.lib + ${SOURCE_PATH}/Debug/libuv.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) file(COPY - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/Release/libuv.dll + ${SOURCE_PATH}/Release/libuv.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin) file(COPY - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/Release/libuv.lib + ${SOURCE_PATH}/Release/libuv.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) file(COPY - ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1/LICENSE + ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libuv) file(RENAME diff --git a/ports/libwebsockets/portfile.cmake b/ports/libwebsockets/portfile.cmake index 5aa1e3ff5..5253f6fa8 100644 --- a/ports/libwebsockets/portfile.cmake +++ b/ports/libwebsockets/portfile.cmake @@ -1,13 +1,14 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libwebsockets-2.0.0) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/warmcat/libwebsockets/archive/v2.0.0.zip" + URLS "https://github.com/warmcat/libwebsockets/archive/v2.0.0.zip" FILENAME "libwebsockets-v2.0.0.zip" - MD5 1947a1887dda5b5f9624048f4b6b1507 + SHA512 bf57a46f2c60095e7e6ec6656b185ffd2cf8f553bc22255ae8f6825d3613316d794f139cdefacbdf60ef997b0cd675fe356813d406c9b7c5a5ae838ce5326042 ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libwebsockets-2.0.0 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DLWS_WITH_STATIC=OFF -DLWS_USE_BUNDLED_ZLIB=OFF @@ -18,7 +19,6 @@ vcpkg_configure_cmake( # OPTIONS_DEBUG -DDEBUGGABLE=1 ) -vcpkg_build_cmake() vcpkg_install_cmake() file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) @@ -30,6 +30,6 @@ file(RENAME file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) -file(COPY ${CURRENT_BUILDTREES_DIR}/src/libwebsockets-2.0.0/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libwebsockets) +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libwebsockets) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libwebsockets/LICENSE ${CURRENT_PACKAGES_DIR}/share/libwebsockets/copyright) vcpkg_copy_pdbs() diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt new file mode 100644 index 000000000..76ee6e15c --- /dev/null +++ b/ports/lua/CMakeLists.txt @@ -0,0 +1,54 @@ +PROJECT ( lua ) + +IF( NOT WIN32 ) + message( FATAL_ERROR "Written for window only" ) +ENDIF() + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +SET (HDR_LIBLUA +src/lapi.h src/lauxlib.h src/lcode.h src/lctype.h src/ldebug.h src/ldo.h src/lfunc.h +src/lgc.h src/llex.h src/llimits.h src/lmem.h src/lobject.h src/lopcodes.h src/lparser.h +src/lstate.h src/lstring.h src/ltable.h src/ltm.h src/lua.h src/luaconf.h src/lualib.h +src/lundump.h src/lvm.h src/lzio.h +) + +# Build Libraries +SET (SRC_LIBLUA +src/lapi.c src/lauxlib.c src/lbaselib.c src/lbitlib.c src/lcode.c src/lcorolib.c +src/lctype.c src/ldblib.c src/ldebug.c src/ldo.c src/ldump.c src/lfunc.c src/lgc.c +src/linit.c src/liolib.c src/llex.c src/lmathlib.c src/lmem.c src/loadlib.c src/lobject.c +src/lopcodes.c src/loslib.c src/lparser.c src/lstate.c src/lstring.c src/lstrlib.c +src/ltable.c src/ltablib.c src/ltm.c src/lundump.c src/lutf8lib.c src/lvm.c src/lzio.c +) + +# append headers to sources to make them show up in MSVC GUI +LIST(APPEND SRC_LIBLUA ${HDR_LIBLUA}) + +IF (BUILD_SHARED_LIBS) + ADD_DEFINITIONS ( -DLUA_BUILD_AS_DLL ) +ENDIF () + +# remove warnings +ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS ) + +#DLL +ADD_LIBRARY ( lua ${SRC_LIBLUA} ) + +INSTALL ( TARGETS lua + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib +) + +IF (NOT DEFINED SKIP_INSTALL_HEADERS) + INSTALL( + FILES + src/lualib.h + src/lua.h + src/luaconf.h + src/lua.hpp + src/lauxlib.h + DESTINATION include + ) +ENDIF ()
\ No newline at end of file diff --git a/ports/lua/CONTROL b/ports/lua/CONTROL new file mode 100644 index 000000000..ae661f3f6 --- /dev/null +++ b/ports/lua/CONTROL @@ -0,0 +1,3 @@ +Source: lua +Version: 5.3.3 +Description: a powerful, fast, lightweight, embeddable scripting language diff --git a/ports/lua/COPYRIGHT b/ports/lua/COPYRIGHT new file mode 100644 index 000000000..729a2ccd5 --- /dev/null +++ b/ports/lua/COPYRIGHT @@ -0,0 +1,6 @@ +Copyright © 1994–2016 Lua.org, PUC-Rio. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake new file mode 100644 index 000000000..f8c1071f7 --- /dev/null +++ b/ports/lua/portfile.cmake @@ -0,0 +1,31 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +include(${CMAKE_TRIPLET_FILE}) +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lua-5.3.3) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.lua.org/ftp/lua-5.3.3.tar.gz" + FILENAME "lua-5.3.3.tar.gz" + SHA512 7b8122ed48ea2a9faa47d1b69b4a5b1523bb7be67e78f252bb4339bf75e957a88c5405156e22b4b63ccf607a5407bf017a4cee1ce12b1aa5262047655960a3cc +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG + -DSKIP_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +# Handle copyright +file(COPY ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lua) +vcpkg_copy_pdbs() diff --git a/ports/mpg123/portfile.cmake b/ports/mpg123/portfile.cmake index d7abb9bf8..68d0f7baa 100644 --- a/ports/mpg123/portfile.cmake +++ b/ports/mpg123/portfile.cmake @@ -1,8 +1,9 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3) vcpkg_download_distfile(ARCHIVE - URL "http://downloads.sourceforge.net/project/mpg123/mpg123/1.23.3/mpg123-1.23.3.tar.bz2" + URLS "http://downloads.sourceforge.net/project/mpg123/mpg123/1.23.3/mpg123-1.23.3.tar.bz2" FILENAME "mpg123-1.23.3.tar.bz2" - MD5 84e838650c4c593f4e66d1256e0468db + SHA512 a5ebfb36223a3966386bc8e5769b8543861872d20f9de037d07857e857000f20e198e0b1db04bdc56b18b19d5b4027d8261a104af0216d6ea45274b21a18dda4 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -11,44 +12,44 @@ get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) set(ENV{PATH} "${YASM_EXE_PATH};$ENV{PATH}") vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3 + SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Modify-2010-libmpg123.vcxproj-to-use-VS-2015-along-w.patch ) vcpkg_build_msbuild( - PROJECT_PATH ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj + PROJECT_PATH ${SOURCE_PATH}/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj RELEASE_CONFIGURATION Release_x86_Dll DEBUG_CONFIGURATION Debug_x86_Dll ) message(STATUS "Installing") file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/ports/MSVC++/2010/libmpg123/Debug/libmpg123.dll - ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/ports/MSVC++/2010/libmpg123/Debug/libmpg123.pdb + ${SOURCE_PATH}/ports/MSVC++/2010/libmpg123/Debug/libmpg123.dll + ${SOURCE_PATH}/ports/MSVC++/2010/libmpg123/Debug/libmpg123.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/ports/MSVC++/2010/libmpg123/Release/libmpg123.dll - ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/ports/MSVC++/2010/libmpg123/Release/libmpg123.pdb + ${SOURCE_PATH}/ports/MSVC++/2010/libmpg123/Release/libmpg123.dll + ${SOURCE_PATH}/ports/MSVC++/2010/libmpg123/Release/libmpg123.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/bin ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/ports/MSVC++/2010/libmpg123/Debug/libmpg123.lib + ${SOURCE_PATH}/ports/MSVC++/2010/libmpg123/Debug/libmpg123.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/ports/MSVC++/2010/libmpg123/Release/libmpg123.lib + ${SOURCE_PATH}/ports/MSVC++/2010/libmpg123/Release/libmpg123.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/ports/MSVC++/mpg123.h + ${SOURCE_PATH}/ports/MSVC++/mpg123.h DESTINATION ${CURRENT_PACKAGES_DIR}/include ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/src/libmpg123/mpg123.h.in + ${SOURCE_PATH}/src/libmpg123/mpg123.h.in DESTINATION ${CURRENT_PACKAGES_DIR}/include ) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/mpg123-1.23.3/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpg123 RENAME copyright) +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpg123 RENAME copyright) vcpkg_copy_pdbs() message(STATUS "Installing done") diff --git a/ports/mpir/portfile.cmake b/ports/mpir/portfile.cmake index 7ccc5ef92..e2f7040d6 100644 --- a/ports/mpir/portfile.cmake +++ b/ports/mpir/portfile.cmake @@ -1,13 +1,14 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2) vcpkg_download_distfile(ARCHIVE_FILE - URL "http://mpir.org/mpir-2.7.2.tar.lz" + URLS "http://mpir.org/mpir-2.7.2.tar.lz" FILENAME "mpir-2.7.2.tar.lz" - MD5 2d47419dac50cc4a89c8c23421e66db1 + SHA512 2635c167ddbba99364ec741373768e0675d34f94fad8912d5433b95e6fbfdb0510f5e94a707acc42048254bc658c52c6671bb0c0dac31267c4b82b00c3e74efa ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) vcpkg_build_msbuild( - PROJECT_PATH ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj + PROJECT_PATH ${SOURCE_PATH}/build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj ) IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") @@ -17,32 +18,32 @@ ELSE() ENDIF() file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Debug/gmp.h - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Debug/gmpxx.h - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Debug/mpir.h - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Debug/mpirxx.h + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/gmp.h + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/gmpxx.h + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.h + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpirxx.h DESTINATION ${CURRENT_PACKAGES_DIR}/include ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Debug/mpir.dll - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Debug/mpir.pdb + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.dll + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Release/mpir.dll - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Release/mpir.pdb + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.dll + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/bin ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Debug/mpir.lib + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib ) file(INSTALL - ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/dll/${BUILD_ARCH}/Release/mpir.lib + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright) +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright) vcpkg_copy_pdbs() message(STATUS "Installing done") diff --git a/ports/openal-soft/portfile.cmake b/ports/openal-soft/portfile.cmake index 5e24d1630..856ac9367 100644 --- a/ports/openal-soft/portfile.cmake +++ b/ports/openal-soft/portfile.cmake @@ -1,13 +1,15 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openal-soft-1.17.2) vcpkg_download_distfile(ARCHIVE - URL "http://openal-soft.org/openal-releases/openal-soft-1.17.2.tar.bz2" + URLS "http://openal-soft.org/openal-releases/openal-soft-1.17.2.tar.bz2" FILENAME "openal-soft-1.17.2.tar.bz2" MD5 1764e0d8fec499589b47ebc724e0913d + SHA512 50c20cd3ddada55d91643a79c2894d5a14315d5fc1ed8e870e3d8d3f410e8b7d8da29b838226e7fce37fbeca719ff919b51806f72e4cd529a18fbe8bd68860e3 ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openal-soft-1.17.2 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DALSOFT_UTILS=OFF -DALSOFT_NO_CONFIG_UTIL=ON @@ -17,11 +19,10 @@ vcpkg_configure_cmake( -DALSOFT_HRTF_DEFS=OFF ) -vcpkg_build_cmake() vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(COPY ${CURRENT_BUILDTREES_DIR}/src/openal-soft-1.17.2/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/openal-soft) +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/openal-soft) file(RENAME ${CURRENT_PACKAGES_DIR}/share/openal-soft/COPYING ${CURRENT_PACKAGES_DIR}/share/openal-soft/copyright) vcpkg_copy_pdbs() diff --git a/ports/opencv/CONTROL b/ports/opencv/CONTROL index a22785929..74cf1d3bc 100644 --- a/ports/opencv/CONTROL +++ b/ports/opencv/CONTROL @@ -1,4 +1,4 @@ Source: opencv -Version: 3.1.0 -Build-Depends: zlib, libpng, libjpeg-turbo +Version: 3.1.0-1 +Build-Depends: zlib, libpng, libjpeg-turbo, tiff Description: computer vision library diff --git a/ports/opencv/0001-OpenCV-should-follow-FHS-like-conventions.patch b/ports/opencv/opencv-installation-options.patch index 1824aa339..580334634 100644 --- a/ports/opencv/0001-OpenCV-should-follow-FHS-like-conventions.patch +++ b/ports/opencv/opencv-installation-options.patch @@ -1,31 +1,19 @@ -From e396a74da8e7c9c06f3145de65647d7d48524a07 Mon Sep 17 00:00:00 2001 -From: Robert Schumacher <roschuma@microsoft.com> -Date: Thu, 5 May 2016 04:16:18 -0700 -Subject: [PATCH] OpenCV should follow FHS-like conventions - ---- - CMakeLists.txt | 11 +++++++---- - cmake/OpenCVGenConfig.cmake | 11 +++++------ - cmake/OpenCVGenHeaders.cmake | 8 ++++++-- - cmake/OpenCVModule.cmake | 4 +++- - data/CMakeLists.txt | 6 ++++-- - include/CMakeLists.txt | 6 ++++-- - 6 files changed, 29 insertions(+), 17 deletions(-) - diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3ee50ff..8e3f57d 100644 +index 3ee50ff..64b0405 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -250,6 +250,8 @@ OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF ) +@@ -250,6 +250,10 @@ OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF ) OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID ) OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT APPLE_FRAMEWORK AND BUILD_SHARED_LIBS) ) OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binaries and test data" OFF) +OCV_OPTION(INSTALL_HEADERS "Install header files" ON) ++OCV_OPTION(INSTALL_LICENSE "Install license file" ON) +OCV_OPTION(INSTALL_OTHER "Install other files" ON) ++OCV_OPTION(INSTALL_FORCE_UNIX_PATHS "Force unix-style installation" OFF) # OpenCV build options # =================================================== -@@ -315,7 +317,9 @@ else() +@@ -315,7 +319,9 @@ else() endif() if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows) @@ -36,49 +24,55 @@ index 3ee50ff..8e3f57d 100644 set(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") else() message(STATUS "Can't detect runtime and/or arch") -@@ -379,7 +383,7 @@ else() +@@ -379,7 +385,7 @@ else() set(OPENCV_3P_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}") set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native) set(OPENCV_JAR_INSTALL_PATH java) - set(OPENCV_OTHER_INSTALL_PATH etc) -+ set(OPENCV_OTHER_INSTALL_PATH share/opencv) ++ set(OPENCV_OTHER_INSTALL_PATH etc CACHE STRING "") else() set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX}) set(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}) -@@ -736,8 +740,7 @@ endif() +@@ -393,7 +399,7 @@ else() + if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX) + set(OPENCV_CONFIG_INSTALL_PATH lib${LIB_SUFFIX}/cmake/opencv) + else() +- set(OPENCV_CONFIG_INSTALL_PATH share/OpenCV) ++ set(OPENCV_CONFIG_INSTALL_PATH share/OpenCV CACHE STRING "") + endif() + endif() + +@@ -734,7 +740,7 @@ if(NOT OPENCV_LICENSE_FILE) + endif() + # for UNIX it does not make sense as LICENSE and readme will be part of the package automatically - if(ANDROID OR NOT UNIX) +-if(ANDROID OR NOT UNIX) ++if(ANDROID OR NOT UNIX AND INSTALL_LICENSE) install(FILES ${OPENCV_LICENSE_FILE} -- PERMISSIONS OWNER_READ GROUP_READ WORLD_READ -- DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT libs) -+ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/opencv RENAME copyright CONFIGURATIONS Release COMPONENT libs) - if(OPENCV_README_FILE) - install(FILES ${OPENCV_README_FILE} - PERMISSIONS OWNER_READ GROUP_READ WORLD_READ + PERMISSIONS OWNER_READ GROUP_READ WORLD_READ + DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT libs) diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake -index dbfd7ca..94fc4a9 100644 +index dbfd7ca..8bfa448 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake -@@ -139,14 +139,13 @@ if(WIN32) - configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" @ONLY) - if (CMAKE_HOST_SYSTEM_NAME MATCHES Windows) - if(BUILD_SHARED_LIBS) -- install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" COMPONENT dev) -- install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) -+ install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "cmake" COMPONENT dev) -+ install(EXPORT OpenCVModules DESTINATION "cmake" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) - else() -- install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" COMPONENT dev) -- install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) -+ install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "cmake" COMPONENT dev) -+ install(EXPORT OpenCVModules DESTINATION "cmake" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) - endif() -- install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT dev) -- install(FILES "${OpenCV_SOURCE_DIR}/cmake/OpenCVConfig.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/" COMPONENT dev) -+ install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION "cmake" COMPONENT dev) - else () - install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib/cmake/opencv-${OPENCV_VERSION}" COMPONENT dev) - install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib/cmake/opencv-${OPENCV_VERSION}" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) +@@ -103,7 +103,7 @@ set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_ + set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"") + set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"") + +-if(UNIX) # ANDROID configuration is created here also ++if(UNIX OR INSTALL_FORCE_UNIX_PATHS) # ANDROID configuration is created here also + #http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference + # For a command "find_package(<name> [major[.minor]] [EXACT] [REQUIRED|QUIET])" + # cmake will look in the following dir on unix: +@@ -127,7 +127,7 @@ endif() + # -------------------------------------------------------------------------------------------- + # Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages + # -------------------------------------------------------------------------------------------- +-if(WIN32) ++if(WIN32 AND NOT INSTALL_FORCE_UNIX_PATHS) + set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/include\" \"\${OpenCV_CONFIG_PATH}/include/opencv\"") + set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"") + diff --git a/cmake/OpenCVGenHeaders.cmake b/cmake/OpenCVGenHeaders.cmake index 2988979..810871b 100644 --- a/cmake/OpenCVGenHeaders.cmake @@ -117,6 +111,19 @@ index 3385385..530e53f 100644 endif() endforeach() endif() +diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in +index 80ffbaf..0585c9f 100644 +--- a/cmake/templates/OpenCVConfig.cmake.in ++++ b/cmake/templates/OpenCVConfig.cmake.in +@@ -112,7 +112,7 @@ set(OpenCV_USE_MANGLED_PATHS @OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE@) + # Extract the directory where *this* file has been installed (determined at cmake run-time) + get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE) + +-if(NOT WIN32 OR ANDROID) ++if(NOT WIN32 OR ANDROID OR "@INSTALL_FORCE_UNIX_PATHS@") + if(ANDROID) + set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../../..") + else() diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 1f0d720..86b9d89 100644 --- a/data/CMakeLists.txt @@ -135,13 +142,14 @@ index 1f0d720..86b9d89 100644 if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests") diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt -index b4e48e6..58dccc7 100644 +index b4e48e6..6ea20d6 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,7 +1,9 @@ - file(GLOB old_hdrs "opencv/*.h*") +-file(GLOB old_hdrs "opencv/*.h*") -install(FILES ${old_hdrs} +if(INSTALL_HEADERS) ++ file(GLOB old_hdrs "opencv/*.h*") + install(FILES ${old_hdrs} DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv COMPONENT dev) @@ -150,7 +158,3 @@ index b4e48e6..58dccc7 100644 DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT dev) +endif() -\ No newline at end of file --- -2.8.1.windows.1 - diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 9dcf0fdf7..49fa463a2 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -1,62 +1,55 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv-92387b1ef8fad15196dd5f7fb4931444a68bc93a) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/opencv/opencv/archive/92387b1ef8fad15196dd5f7fb4931444a68bc93a.zip" + FILENAME "opencv-92387b1ef8fad15196dd5f7fb4931444a68bc93a.zip" + SHA512 b95fa1a5bce0ea9e9bd43173b904e5d779a2f640f4f8dbb36a12df462e8e4cdce3ff94b2fbd85cb96ddf338019f9888e9e7410c468c81b1de98d9c1da945a7eb +) +vcpkg_extract_source_archive(${ARCHIVE}) -find_program(GIT git) - -set(GIT_URL "https://github.com/Itseez/opencv") -set(GIT_REF "92387b1ef8fad15196dd5f7fb4931444a68bc93a") - -if(NOT EXISTS "${DOWNLOADS}/opencv.git") - message(STATUS "Cloning") - vcpkg_execute_required_process( - COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/opencv.git - WORKING_DIRECTORY ${DOWNLOADS} - LOGNAME clone - ) -endif() -message(STATUS "Cloning done") - -if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") - message(STATUS "Adding worktree and patching") - vcpkg_execute_required_process( - COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REF} - WORKING_DIRECTORY ${DOWNLOADS}/opencv.git - LOGNAME worktree - ) - message(STATUS "Patching") - vcpkg_execute_required_process( - COMMAND ${GIT} am ${CMAKE_CURRENT_LIST_DIR}/0001-OpenCV-should-follow-FHS-like-conventions.patch --ignore-whitespace --whitespace=fix - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src - LOGNAME patch - ) -endif() -message(STATUS "Adding worktree and patching done") +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/opencv-installation-options.patch" +) +file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/libjpeg ${SOURCE_PATH}/3rdparty/libpng ${SOURCE_PATH}/3rdparty/zlib ${SOURCE_PATH}/3rdparty/libtiff) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DBUILD_ZLIB=OFF + -DBUILD_TIFF=OFF + -DBUILD_JPEG=OFF + -DBUILD_PNG=OFF -DINSTALL_CREATE_DISTRIB=ON -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_opencv_apps=OFF -DBUILD_DOCS=OFF - -DBUILD_TESTS=OFF + -DBUILD_EXAMPLES=OFF + -DBUILD_PACKAGE=OFF -DBUILD_PERF_TESTS=OFF + -DBUILD_TESTS=OFF + -DBUILD_WITH_DEBUG_INFO=ON -DOpenCV_DISABLE_ARCH_PATH=ON -DWITH_FFMPEG=OFF + -DINSTALL_FORCE_UNIX_PATHS=ON + -DOPENCV_CONFIG_INSTALL_PATH=share/opencv + -DOPENCV_OTHER_INSTALL_PATH=share/opencv + -DINSTALL_LICENSE=OFF + -DWITH_CUDA=OFF OPTIONS_DEBUG -DINSTALL_HEADERS=OFF -DINSTALL_OTHER=OFF ) -vcpkg_build_cmake() vcpkg_install_cmake() -file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/OpenCVConfig-version.cmake ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig-version.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/OpenCVConfig.cmake ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/OpenCVModules.cmake ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/OpenCVModules-release.cmake ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-release.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/cmake/OpenCVModules-debug.cmake ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/opencv/OpenCVModules-debug.cmake OPENCV_DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" OPENCV_DEBUG_MODULE "${OPENCV_DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake "${OPENCV_DEBUG_MODULE}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/opencv/LICENSE ${CURRENT_PACKAGES_DIR}/share/opencv/copyright) vcpkg_copy_pdbs() diff --git a/ports/openssl/portfile.cmake b/ports/openssl/portfile.cmake index 3737b0e86..9f45f0ce4 100644 --- a/ports/openssl/portfile.cmake +++ b/ports/openssl/portfile.cmake @@ -1,4 +1,5 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-1.0.2h) vcpkg_find_acquire_program(PERL) find_program(NMAKE nmake) @@ -6,15 +7,15 @@ get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE - URL "https://www.openssl.org/source/openssl-1.0.2h.tar.gz" + URLS "https://www.openssl.org/source/openssl-1.0.2h.tar.gz" FILENAME "openssl-1.0.2h.tar.gz" - MD5 9392e65072ce4b614c1392eefc1f23d0 + SHA512 780601f6f3f32f42b6d7bbc4c593db39a3575f9db80294a10a68b2b0bb79448d9bd529ca700b9977354cbdfc65887c76af0aa7b90d3ee421f74ab53e6f15c303 ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${CURRENT_BUILDTREES_DIR}/src/openssl-1.0.2h) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-1.0.2h + SOURCE_PATH ${SOURCE_PATH} GENERATOR "NMake Makefiles" OPTIONS -DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR} diff --git a/ports/protobuf/CONTROL b/ports/protobuf/CONTROL new file mode 100644 index 000000000..795213a33 --- /dev/null +++ b/ports/protobuf/CONTROL @@ -0,0 +1,4 @@ +Source: protobuf +Version: 3.0.2 +Build-Depends: zlib +Description: Protocol Buffers - Google's data interchange format
\ No newline at end of file diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake new file mode 100644 index 000000000..522a68634 --- /dev/null +++ b/ports/protobuf/portfile.cmake @@ -0,0 +1,45 @@ +include(vcpkg_common_functions) +vcpkg_download_distfile(ARCHIVE_FILE + URLS "https://github.com/google/protobuf/releases/download/v3.0.2/protobuf-cpp-3.0.2.tar.gz" + FILENAME "protobuf-cpp-3.0.2.tar.gz" + SHA512 5c99fa5d20815f9333a1e30d4da7621375e179abab6e4369ef0827b6ea6a679afbfec445dda21a72b4ab11e1bdd72c0f17a4e86b153ea8e2d3298dc3bcfcd643 +) +vcpkg_download_distfile(TOOL_ARCHIVE_FILE + URLS "https://github.com/google/protobuf/releases/download/v3.0.2/protoc-3.0.2-win32.zip" + FILENAME "protoc-3.0.2-win32.zip" + SHA512 51c67bd8bdc35810da70786d873935814679c58b74e653923671bdf06b8b69a1c9a0793d090b17d25e91ddafff1726bcfcdd243373dd47c4aeb9ea83fbabaeb0 +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) +vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2-win32) + +vcpkg_configure_cmake( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2/cmake + OPTIONS + -Dprotobuf_BUILD_SHARED_LIBS=OFF + -Dprotobuf_MSVC_STATIC_RUNTIME=OFF + -Dprotobuf_WITH_ZLIB=ON + -Dprotobuf_BUILD_TESTS=OFF + -DCMAKE_INSTALL_CMAKEDIR=share/protobuf +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(READ ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake RELEASE_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}/bin/protoc.exe" "\${_IMPORT_PREFIX}/tools/protoc.exe" RELEASE_MODULE "${RELEASE_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake "${RELEASE_MODULE}") + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/protobuf/protobuf-targets-debug.cmake DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${DEBUG_MODULE}") +string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc.exe" "\${_IMPORT_PREFIX}/tools/protoc.exe" DEBUG_MODULE "${DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake "${DEBUG_MODULE}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/protoc.exe) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/protoc.exe) + +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2-win32/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +vcpkg_copy_pdbs() diff --git a/ports/ragel/0001-Remove-unistd.h-include-1.patch b/ports/ragel/0001-Remove-unistd.h-include-1.patch new file mode 100644 index 000000000..d024401fc --- /dev/null +++ b/ports/ragel/0001-Remove-unistd.h-include-1.patch @@ -0,0 +1,24 @@ +From 4a337ce9475c75497f4221cadd9d2dd8126835c7 Mon Sep 17 00:00:00 2001 +From: vlj <vljn.ovi@gmail.com> +Date: Tue, 4 Oct 2016 17:54:22 +0200 +Subject: [PATCH 1/2] Remove unistd.h include 1 + +--- + ragel-6.9/ragel/main.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/ragel-6.9/ragel/main.cpp b/ragel-6.9/ragel/main.cpp +index f5fbd7b..e3bcc18 100644 +--- a/ragel-6.9/ragel/main.cpp ++++ b/ragel-6.9/ragel/main.cpp +@@ -24,7 +24,6 @@ + #include <stdio.h> + #include <iostream> + #include <fstream> +-#include <unistd.h> + #include <sstream> + #include <unistd.h> + #include <sys/types.h> +-- +2.10.0.windows.1 + diff --git a/ports/ragel/0002-Remove-unistd.h-include-2.patch b/ports/ragel/0002-Remove-unistd.h-include-2.patch new file mode 100644 index 000000000..bade77889 --- /dev/null +++ b/ports/ragel/0002-Remove-unistd.h-include-2.patch @@ -0,0 +1,24 @@ +From 259bb8be3f66e32063652cb4f1a456b7327ca513 Mon Sep 17 00:00:00 2001 +From: vlj <vljn.ovi@gmail.com> +Date: Tue, 4 Oct 2016 17:54:38 +0200 +Subject: [PATCH 2/2] Remove unistd.h include 2 + +--- + ragel-6.9/ragel/main.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/ragel-6.9/ragel/main.cpp b/ragel-6.9/ragel/main.cpp +index e3bcc18..947b1c8 100644 +--- a/ragel-6.9/ragel/main.cpp ++++ b/ragel-6.9/ragel/main.cpp +@@ -25,7 +25,6 @@ + #include <iostream> + #include <fstream> + #include <sstream> +-#include <unistd.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> +-- +2.10.0.windows.1 + diff --git a/ports/ragel/0003-Fix-rsxgoto.cpp-build.patch b/ports/ragel/0003-Fix-rsxgoto.cpp-build.patch new file mode 100644 index 000000000..3ab8857e1 --- /dev/null +++ b/ports/ragel/0003-Fix-rsxgoto.cpp-build.patch @@ -0,0 +1,25 @@ +From 852aebf39d85964141cf9243d89abc2d5ee761ce Mon Sep 17 00:00:00 2001 +From: vlj <vljn.ovi@gmail.com> +Date: Tue, 4 Oct 2016 18:22:41 +0200 +Subject: [PATCH 3/3] Fix rsxgoto.cpp build. + +--- + ragel-6.9/ragel/rbxgoto.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ragel-6.9/ragel/rbxgoto.cpp b/ragel-6.9/ragel/rbxgoto.cpp +index c54cb00..9e33425 100644 +--- a/ragel-6.9/ragel/rbxgoto.cpp ++++ b/ragel-6.9/ragel/rbxgoto.cpp +@@ -658,7 +658,7 @@ void RbxGotoCodeGen::BREAK( ostream &ret, int targState ) + out << + " begin\n" + " " << P() << " += 1\n" +- " " << rbxGoto(ret, "_out") << "\n" ++ " "; rbxGoto(ret, "_out") << "\n" + " end\n"; + } + +-- +2.8.3.windows.1 + diff --git a/ports/ragel/CMakeLists.txt b/ports/ragel/CMakeLists.txt new file mode 100644 index 000000000..5c161194c --- /dev/null +++ b/ports/ragel/CMakeLists.txt @@ -0,0 +1,128 @@ +cmake_minimum_required(VERSION 3.0) +project(ragel CXX) + +file(GLOB HEADERS + ragel/buffer.h + ragel/cdgoto.h + ragel/cscodegen.h + ragel/csipgoto.h + ragel/inputdata.h + ragel/rbxgoto.h + ragel/rubyflat.h + ragel/cdcodegen.h + ragel/cdipgoto.h + ragel/csfflat.h + ragel/cssplit.h + ragel/javacodegen.h + ragel/redfsm.h + ragel/rubyftable.h + ragel/cdfflat.h + ragel/cdsplit.h + ragel/csfgoto.h + ragel/cstable.h + ragel/parsedata.h + ragel/rlparse.h + ragel/rubytable.h + ragel/cdfgoto.h + ragel/cdtable.h + ragel/csflat.h + ragel/dotcodegen.h + ragel/parsetree.h + ragel/rlscan.h + ragel/version.h + ragel/cdflat.h + ragel/common.h + ragel/csftable.h + ragel/fsmgraph.h + ragel/pcheck.h + ragel/rubycodegen.h + ragel/xmlcodegen.h + ragel/cdftable.h + ragel/csgoto.h + ragel/gendata.h + ragel/ragel.h + ragel/rubyfflat.h + ragel/gocodegen.h + ragel/gotable.h + ragel/goftable.h + ragel/goflat.h + ragel/gofflat.h + ragel/gogoto.h + ragel/gofgoto.h + ragel/goipgoto.h + ragel/gotablish.h + ragel/mlcodegen.h + ragel/mltable.h + ragel/mlftable.h + ragel/mlflat.h + ragel/mlfflat.h + ragel/mlgoto.h + ragel/mlfgoto.h +) + +file(GLOB SRC + ragel/main.cpp + ragel/parsetree.cpp + ragel/parsedata.cpp + ragel/fsmstate.cpp + ragel/fsmbase.cpp + ragel/fsmattach.cpp + ragel/fsmmin.cpp + ragel/fsmgraph.cpp + ragel/fsmap.cpp + ragel/rlscan.cpp + ragel/rlparse.cpp + ragel/inputdata.cpp + ragel/common.cpp + ragel/redfsm.cpp + ragel/gendata.cpp + ragel/cdcodegen.cpp + ragel/cdtable.cpp + ragel/cdftable.cpp + ragel/cdflat.cpp + ragel/cdfflat.cpp + ragel/cdgoto.cpp + ragel/cdfgoto.cpp + ragel/cdipgoto.cpp + ragel/cdsplit.cpp + ragel/javacodegen.cpp + ragel/rubycodegen.cpp + ragel/rubytable.cpp + ragel/rubyftable.cpp + ragel/rubyflat.cpp + ragel/rubyfflat.cpp + ragel/rbxgoto.cpp + ragel/cscodegen.cpp + ragel/cstable.cpp + ragel/csftable.cpp + ragel/csflat.cpp + ragel/csfflat.cpp + ragel/csgoto.cpp + ragel/csfgoto.cpp + ragel/csipgoto.cpp + ragel/cssplit.cpp + ragel/dotcodegen.cpp + ragel/xmlcodegen.cpp + ragel/gocodegen.cpp + ragel/gotable.cpp + ragel/goftable.cpp + ragel/goflat.cpp + ragel/gofflat.cpp + ragel/gogoto.cpp + ragel/gofgoto.cpp + ragel/goipgoto.cpp + ragel/gotablish.cpp + ragel/mlcodegen.cpp + ragel/mltable.cpp + ragel/mlftable.cpp + ragel/mlflat.cpp + ragel/mlfflat.cpp + ragel/mlgoto.cpp + ragel/mlfgoto.cpp +) + +include_directories(aapl) + +add_executable(ragel ${SRC}) + +install(TARGETS ragel DESTINATION tools CONFIGURATIONS Release) diff --git a/ports/ragel/CONTROL b/ports/ragel/CONTROL new file mode 100644 index 000000000..086159ab3 --- /dev/null +++ b/ports/ragel/CONTROL @@ -0,0 +1,3 @@ +Source: ragel +Version: 6.9 +Description: diff --git a/ports/ragel/config.h b/ports/ragel/config.h new file mode 100644 index 000000000..dbcd06dd9 --- /dev/null +++ b/ports/ragel/config.h @@ -0,0 +1,26 @@ +/* ragel/config.h. Generated from config.h.in by configure. */ +/* ragel/config.h.in. Generated from configure.in by autoheader. */ + +/* Name of package */ +#define PACKAGE "ragel" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "ragel" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "ragel 6.9" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "ragel" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "6.9" + +/* Version number of package */ +#define VERSION "6.9" diff --git a/ports/ragel/portfile.cmake b/ports/ragel/portfile.cmake new file mode 100644 index 000000000..2c1f09de9 --- /dev/null +++ b/ports/ragel/portfile.cmake @@ -0,0 +1,41 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ragel-6.9) +include(${CMAKE_TRIPLET_FILE}) +include(vcpkg_common_functions) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.colm.net/files/ragel/ragel-6.9.tar.gz" + FILENAME "ragel-6.9.tar.gz" + SHA512 46886a37fa0b785574c03ba6581d99bbeaa11ca65cf4fdc37ceef42f4869bd695694cd69b4b974a25cf539f004cb106e3debda17fc26e1a9a6a4295992733dbd +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h DESTINATION ${SOURCE_PATH}/ragel) + +vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + PATCHES + "${CMAKE_CURRENT_LIST_DIR}/0001-Remove-unistd.h-include-1.patch" + "${CMAKE_CURRENT_LIST_DIR}/0002-Remove-unistd.h-include-2.patch" + "${CMAKE_CURRENT_LIST_DIR}/0003-Fix-rsxgoto.cpp-build.patch" +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + GENERATOR "Visual Studio 14 2015" +) + +vcpkg_install_cmake() + +file(WRITE ${CURRENT_PACKAGES_DIR}/include/ragel.txt) + +# Handle copyright +file(COPY ${CURRENT_BUILDTREES_DIR}/src/ragel-6.9/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/ragel) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/ragel/COPYING ${CURRENT_PACKAGES_DIR}/share/ragel/copyright) diff --git a/ports/range-v3/portfile.cmake b/ports/range-v3/portfile.cmake index e71229d0f..692adf347 100644 --- a/ports/range-v3/portfile.cmake +++ b/ports/range-v3/portfile.cmake @@ -1,12 +1,13 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/Range-V3-VS2015-ede9ad367fd5ec764fecb039c874614bd908e6b6) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/Microsoft/Range-V3-VS2015/archive/ede9ad367fd5ec764fecb039c874614bd908e6b6.zip" + URLS "https://github.com/Microsoft/Range-V3-VS2015/archive/ede9ad367fd5ec764fecb039c874614bd908e6b6.zip" FILENAME "range-v3-ede9ad367fd5ec764fecb039c874614bd908e6b6.zip" - MD5 a33fcf63489d5c6d8fa92ef8746648ab + SHA512 e978c7694471d8616c248647b77689f377b3e2517347abde8629b140e5994de8bf686565a24cdd7dd222f325d43b775f5e478c91220dce75313985499b134637 ) vcpkg_extract_source_archive(${ARCHIVE}) -file(COPY ${CURRENT_BUILDTREES_DIR}/src/Range-V3-VS2015-ede9ad367fd5ec764fecb039c874614bd908e6b6/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/range-v3) +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/range-v3) file(RENAME ${CURRENT_PACKAGES_DIR}/share/range-v3/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/range-v3/copyright) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/Range-V3-VS2015-ede9ad367fd5ec764fecb039c874614bd908e6b6/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp") +file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp") vcpkg_copy_pdbs() diff --git a/ports/rapidjson/portfile.cmake b/ports/rapidjson/portfile.cmake index fdc3aaaf4..d907210d0 100644 --- a/ports/rapidjson/portfile.cmake +++ b/ports/rapidjson/portfile.cmake @@ -1,15 +1,16 @@ include(vcpkg_common_functions) +SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/miloyip/rapidjson/archive/879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip" + URLS "https://github.com/miloyip/rapidjson/archive/879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip" FILENAME "rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip" - MD5 5394c3bc23177b000e1992fb989edc53 + SHA512 4d9ef7cce7d179344c33245c081a142ca5fcb2a0cc170ed39e3d0add008efab8e7389feec03e1ea83b30c5778cd0600865b08bc1c23592e5154dbe1f21f9547d ) vcpkg_extract_source_archive(${ARCHIVE}) # Put the licence file where vcpkg expects it -file(COPY ${CURRENT_BUILDTREES_DIR}/src/rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/rapidjson) +file(COPY ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/rapidjson) file(RENAME ${CURRENT_PACKAGES_DIR}/share/rapidjson/license.txt ${CURRENT_PACKAGES_DIR}/share/rapidjson/copyright) # Copy the rapidjson header files -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.h") +file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.h") vcpkg_copy_pdbs() diff --git a/ports/rapidxml/portfile.cmake b/ports/rapidxml/portfile.cmake index 03422aa1d..90dd06911 100644 --- a/ports/rapidxml/portfile.cmake +++ b/ports/rapidxml/portfile.cmake @@ -1,14 +1,15 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rapidxml-1.13) vcpkg_download_distfile(ARCHIVE - URL "https://sourceforge.net/projects/rapidxml/files/rapidxml/rapidxml%201.13/rapidxml-1.13.zip/download" + URLS "https://sourceforge.net/projects/rapidxml/files/rapidxml/rapidxml%201.13/rapidxml-1.13.zip/download" FILENAME "rapidxml-1.13.zip" - MD5 7b4b42c9331c90aded23bb55dc725d6a + SHA512 6c10583e6631ccdb0217d0a5381172cb4c1046226de6ef1acf398d85e81d145228e14c3016aefcd7b70a1db8631505b048d8b4f5d4b0dbf1811d2482eefdd265 ) vcpkg_extract_source_archive(${ARCHIVE}) # Handle copyright -file(COPY ${CURRENT_BUILDTREES_DIR}/src/rapidxml-1.13/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/rapidxml) +file(COPY ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/rapidxml) file(RENAME ${CURRENT_PACKAGES_DIR}/share/rapidxml/license.txt ${CURRENT_PACKAGES_DIR}/share/rapidxml/copyright) # Copy the header files -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/rapidxml-1.13/ DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN "*.hpp") +file(INSTALL ${SOURCE_PATH}/ DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN "*.hpp") diff --git a/ports/sdl2/portfile.cmake b/ports/sdl2/portfile.cmake index 8d5a95feb..bfd4a8f63 100644 --- a/ports/sdl2/portfile.cmake +++ b/ports/sdl2/portfile.cmake @@ -1,43 +1,43 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4) vcpkg_download_distfile(ARCHIVE_FILE - URL "http://libsdl.org/release/SDL2-2.0.4.tar.gz" + URLS "http://libsdl.org/release/SDL2-2.0.4.tar.gz" FILENAME "SDL2-2.0.4.tar.gz" - MD5 44fc4a023349933e7f5d7a582f7b886e + SHA512 dd0a95878639856c0f4b8a579ace8071379ab64519fa139b22d3ed857a0f0db87a75bc8480c7207e02fbffd1fdbd448e3c0b882c451675b0e2f1a945af02e1d6 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) if(TRIPLET_SYSTEM_NAME MATCHES "WindowsStore") vcpkg_build_msbuild( - PROJECT_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj + PROJECT_PATH ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj ) file(COPY - ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.dll - ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.pdb + ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.dll + ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) file(COPY - ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.dll - ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.pdb + ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.dll + ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/bin) - file(COPY ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) - file(COPY ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) + file(COPY ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Debug/SDL-UWP/SDL2.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + file(COPY ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/Release/SDL-UWP/SDL2.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include) - file(COPY ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/include DESTINATION ${CURRENT_PACKAGES_DIR}/include) + file(COPY ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}/include) file(RENAME ${CURRENT_PACKAGES_DIR}/include/include ${CURRENT_PACKAGES_DIR}/include/SDL2) else() vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DSDL_STATIC=OFF ) - vcpkg_build_cmake() vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) endif() -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2 RENAME copyright) +file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2 RENAME copyright) vcpkg_copy_pdbs() diff --git a/ports/sery/portfile.cmake b/ports/sery/portfile.cmake index a6df423d3..900ca74e0 100644 --- a/ports/sery/portfile.cmake +++ b/ports/sery/portfile.cmake @@ -1,21 +1,19 @@ include(vcpkg_common_functions) +SET(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/Sery-1.0") vcpkg_download_distfile(ARCHIVE - URL "https://github.com/Ninetainedo/Sery/archive/v1.0.zip" + URLS "https://github.com/Ninetainedo/Sery/archive/v1.0.zip" FILENAME "sery-1.0.0.zip" - MD5 6af526fb1b029dd989a35e44a6fa59a8 + SHA512 15ef97bf094e8931049d8dd667a778e23847555f0f8d5b949b250e26edcc2541744fac5c34d935880d070546777fa787b1baf018d8ca2240fcd18a820aded04f ) vcpkg_extract_source_archive(${ARCHIVE}) -SET(SERY_ROOT_DIR "${CURRENT_BUILDTREES_DIR}/src/Sery-1.0") - vcpkg_configure_cmake( - SOURCE_PATH ${SERY_ROOT_DIR} + SOURCE_PATH ${SOURCE_PATH} # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 # OPTIONS_RELEASE -DOPTIMIZE=1 # OPTIONS_DEBUG -DDEBUGGABLE=1 ) -vcpkg_build_cmake() vcpkg_install_cmake() # Removes unnecessary directories @@ -23,7 +21,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) # Handle copyright -file(COPY ${SERY_ROOT_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/sery) +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/sery) file(RENAME ${CURRENT_PACKAGES_DIR}/share/sery/LICENSE ${CURRENT_PACKAGES_DIR}/share/sery/copyright) # Moves cmake files where appropriate diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake index b9cc6abe3..114a7186f 100644 --- a/ports/sqlite3/portfile.cmake +++ b/ports/sqlite3/portfile.cmake @@ -1,18 +1,18 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR}) vcpkg_download_distfile(ARCHIVE - URL "http://www.sqlite.org/2016/sqlite-amalgamation-3120200.zip" + URLS "http://www.sqlite.org/2016/sqlite-amalgamation-3120200.zip" FILENAME "sqlite-amalgamation-3120200.zip" - MD5 e3b10b952f075252169ac613068ccc97 + SHA512 92e1cc09dc4d4e9dd4c189e4a5061664f11971eb3e14c4c59e1f489f201411b08a31dae9e6fc50fffd49bb72f88ac3d99b7c7cd5e334b3079c165ee1c4f5a16e ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( - SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR} + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DSOURCE=${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-3120200 ) -vcpkg_build_cmake() vcpkg_install_cmake() file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/copyright "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n") diff --git a/ports/stb/portfile.cmake b/ports/stb/portfile.cmake index 79a599df6..432d84604 100644 --- a/ports/stb/portfile.cmake +++ b/ports/stb/portfile.cmake @@ -1,16 +1,16 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/stb-e713a69f1ea6ee1e0d55725ed0731520045a5993) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/nothings/stb/archive/e713a69f1ea6ee1e0d55725ed0731520045a5993.zip" + URLS "https://github.com/nothings/stb/archive/e713a69f1ea6ee1e0d55725ed0731520045a5993.zip" FILENAME "stb-e713a69f1ea6ee1e0d55725ed0731520045a5993.zip" - MD5 5d81d3036610045d5a8076728c4e2f7e + SHA512 28d73905e626bf286bc42e30bc50e8449912a9db5e421e09bfbd17790de1909fe9df19c96d6ad3125a6ae0947d45b11b83ee5965dab68d1eadd0c332e391400e ) vcpkg_extract_source_archive(${ARCHIVE}) # Put the licence file where vcpkg expects it -set(SOURCE_DIR ${CURRENT_BUILDTREES_DIR}/src/stb-e713a69f1ea6ee1e0d55725ed0731520045a5993) -file(COPY ${SOURCE_DIR}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/stb/README.md) +file(COPY ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/stb/README.md) file(RENAME ${CURRENT_PACKAGES_DIR}/share/stb/README.md ${CURRENT_PACKAGES_DIR}/share/stb/copyright) # Copy the stb header files -file(GLOB HEADER_FILES ${SOURCE_DIR}/*.h) +file(GLOB HEADER_FILES ${SOURCE_PATH}/*.h) file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include) diff --git a/ports/tcl/portfile.cmake b/ports/tcl/portfile.cmake index 16f9abdbd..d8b19097a 100644 --- a/ports/tcl/portfile.cmake +++ b/ports/tcl/portfile.cmake @@ -1,6 +1,6 @@ include(vcpkg_common_functions) vcpkg_download_distfile(ARCHIVE - URL "http://prdownloads.sourceforge.net/tcl/tcl8.6.5-src.tar.gz" + URLS "http://prdownloads.sourceforge.net/tcl/tcl8.6.5-src.tar.gz" FILENAME "tcl8.6.5-src.tar.gz" MD5 0e6426a4ca9401825fbc6ecf3d89a326 ) diff --git a/ports/tiff/portfile.cmake b/ports/tiff/portfile.cmake index c01914d87..647b61019 100644 --- a/ports/tiff/portfile.cmake +++ b/ports/tiff/portfile.cmake @@ -1,17 +1,17 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/tiff-4.0.6) vcpkg_download_distfile(ARCHIVE - URL "http://download.osgeo.org/libtiff/tiff-4.0.6.tar.gz" + URLS "http://download.osgeo.org/libtiff/tiff-4.0.6.tar.gz" FILENAME "tiff-4.0.6.tar.gz" - MD5 d1d2e940dea0b5ad435f21f03d96dd72 + SHA512 2c8dbaaaab9f82a7722bfe8cb6fcfcf67472beb692f1b7dafaf322759e7016dad1bc58457c0f03db50aa5bd088fef2b37358fcbc1524e20e9e14a9620373fdf8 ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/tiff-4.0.6 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -Dcxx=OFF ) -vcpkg_build_cmake() vcpkg_install_cmake() file(REMOVE_RECURSE @@ -20,7 +20,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share ) file(COPY - ${CURRENT_BUILDTREES_DIR}/src/tiff-4.0.6/COPYRIGHT + ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/tiff ) file(RENAME diff --git a/ports/tinyxml2/portfile.cmake b/ports/tinyxml2/portfile.cmake index 56c86d82a..656f4783f 100644 --- a/ports/tinyxml2/portfile.cmake +++ b/ports/tinyxml2/portfile.cmake @@ -1,22 +1,22 @@ include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/tinyxml2-3.0.0) vcpkg_download_distfile(ARCHIVE - URL "https://github.com/leethomason/tinyxml2/archive/3.0.0.zip" + URLS "https://github.com/leethomason/tinyxml2/archive/3.0.0.zip" FILENAME "tinyxml2-3.0.0.zip" - MD5 851ffc79097239cdc03a952094ddf437 + SHA512 3581e086e41ea01418fdf74e53b932c41cada9a45b73fb71c15424672182dc2a1e55110f030962ae44df6f5d9f060478c5b04373f886da843a78fcabae8b063c ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/tinyxml2-3.0.0 + SOURCE_PATH ${SOURCE_PATH} # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 # OPTIONS_RELEASE -DOPTIMIZE=1 # OPTIONS_DEBUG -DDEBUGGABLE=1 ) -vcpkg_build_cmake() vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(COPY ${CURRENT_BUILDTREES_DIR}/src/tinyxml2-3.0.0/readme.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/tinyxml2) +file(COPY ${SOURCE_PATH}/readme.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/tinyxml2) file(RENAME ${CURRENT_PACKAGES_DIR}/share/tinyxml2/readme.md ${CURRENT_PACKAGES_DIR}/share/tinyxml2/copyright) vcpkg_copy_pdbs() diff --git a/ports/tk/portfile.cmake b/ports/tk/portfile.cmake index 8b5f1f36e..0391b0b30 100644 --- a/ports/tk/portfile.cmake +++ b/ports/tk/portfile.cmake @@ -1,6 +1,6 @@ include(vcpkg_common_functions) vcpkg_download_distfile(ARCHIVE - URL "http://prdownloads.sourceforge.net/tcl/tk8.6.5-src.tar.gz" + URLS "http://prdownloads.sourceforge.net/tcl/tk8.6.5-src.tar.gz" FILENAME "tk8.6.5-src.tar.gz" MD5 11dbbd425c3e0201f20d6a51482ce6c4 ) diff --git a/ports/zlib/portfile.cmake b/ports/zlib/portfile.cmake index cbd942aeb..ef42536dc 100644 --- a/ports/zlib/portfile.cmake +++ b/ports/zlib/portfile.cmake @@ -1,22 +1,31 @@ +include(${CMAKE_TRIPLET_FILE}) include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/zlib-1.2.8) vcpkg_download_distfile(ARCHIVE_FILE - URL "http://zlib.net/zlib128.zip" + URLS "http://zlib.net/zlib128.zip" FILENAME "zlib128.zip" - MD5 126f8676442ffbd97884eb4d6f32afb4 + SHA512 b0d7e71eca9032910c56fc1de6adbdc4f915bdeafd9a114591fc05701893004ef3363add8ad0e576c956b6be158f2fc339ab393f2dd40e8cc8c2885d641d807b ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/zlib-1.2.8 + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DSKIP_INSTALL_FILES=ON OPTIONS_DEBUG -DSKIP_INSTALL_HEADERS=ON ) -vcpkg_build_cmake() vcpkg_install_cmake() -file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/zlibstatic.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibstaticd.lib) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/zlibstatic.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibstaticd.lib) + vcpkg_copy_pdbs() +else() + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/zlib.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibd.lib) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/zlibstatic.lib ${CURRENT_PACKAGES_DIR}/lib/zlib.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/zlibstaticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibd.lib) +endif() + file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zlib RENAME copyright) -vcpkg_copy_pdbs() diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 26cc8a57b..ca0900b89 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -21,29 +21,29 @@ if(NOT VCPKG_TOOLCHAIN) set(_VCPKG_TARGET_TRIPLET_PLAT windows) endif() - set(_VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT}) - + set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)") + set(_VCPKG_INSTALLED_DIR ${CMAKE_CURRENT_LIST_DIR}/../../installed) set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR}) if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE) list(APPEND CMAKE_PREFIX_PATH - ${CMAKE_CURRENT_LIST_DIR}/../installed/${_VCPKG_TARGET_TRIPLET}/debug + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug ) endif() list(APPEND CMAKE_PREFIX_PATH - ${CMAKE_CURRENT_LIST_DIR}/../installed/${_VCPKG_TARGET_TRIPLET} + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} ) - include_directories(${CMAKE_CURRENT_LIST_DIR}/../installed/${_VCPKG_TARGET_TRIPLET}/include) + include_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include) option(OVERRIDE_ADD_EXECUTABLE "Automatically copy dependencies into the output directory for executables." ON) if(OVERRIDE_ADD_EXECUTABLE) function(add_executable name) _add_executable(${ARGV}) add_custom_command(TARGET ${name} POST_BUILD - COMMAND powershell -executionpolicy remotesigned -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 + COMMAND powershell -executionpolicy UnRestricted -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 -targetBinary $<TARGET_FILE:${name}> - -installedDir "${_VCPKG_TOOLCHAIN_DIR}/../installed/${_VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin" + -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin" -OutVariable out ) endfunction() diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 33990d9b0..8ba4b9fae 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -1,7 +1,7 @@ function(vcpkg_build_cmake) message(STATUS "Build ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release -- /p:VCPkgLocalAppDataDisabled=true + COMMAND ${CMAKE_COMMAND} --build . --config Release -- /p:VCPkgLocalAppDataDisabled=true /m WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME build-${TARGET_TRIPLET}-rel ) @@ -9,7 +9,7 @@ function(vcpkg_build_cmake) message(STATUS "Build ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug -- /p:VCPkgLocalAppDataDisabled=true + COMMAND ${CMAKE_COMMAND} --build . --config Debug -- /p:VCPkgLocalAppDataDisabled=true /m WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME build-${TARGET_TRIPLET}-dbg ) diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake index bf7c1b546..5b422fe5e 100644 --- a/scripts/cmake/vcpkg_build_msbuild.cmake +++ b/scripts/cmake/vcpkg_build_msbuild.cmake @@ -1,5 +1,42 @@ +#.rst: +# .. command:: vcpkg_build_msbuild +# +# Build a msbuild-based project. +# +# :: +# vcpkg_build_msbuild(PROJECT_PATH <sln_project_path> +# [RELEASE_CONFIGURATION <release_configuration>] # (default = "Release") +# [DEBUG_CONFIGURATION <debug_configuration>] @ (default = "Debug") +# [PLATFORM <platform>] # (default = "${TRIPLET_SYSTEM_ARCH}") +# [OPTIONS arg1 [arg2 ...]] +# [OPTIONS_RELEASE arg1 [arg2 ...]] +# [OPTIONS_DEBUG arg1 [arg2 ...]] +# ) +# +# ``PROJECT_PATH`` +# The path to the *.sln msbuild project file. +# ``RELEASE_CONFIGURATION`` +# The configuration (``/p:Configuration`` msbuild parameter) +# used for Release builds. +# ``DEBUG_CONFIGURATION`` +# The configuration (``/p:Configuration`` msbuild parameter) +# used for Debug builds. +# ``DEBUG_CONFIGURATION`` +# The configuration (``/p:Configuration`` msbuild parameter) +# used for Debug builds. +# ``PLATFORM`` +# The platform (``/p:Platform`` msbuild parameter) +# used for the build. +# ``OPTIONS`` +# The options passed to msbuild for all builds. +# ``OPTIONS_RELEASE`` +# The options passed to msbuild for Release builds. +# ``OPTIONS_DEBUG`` +# The options passed to msbuild for Debug builds. +# + function(vcpkg_build_msbuild) - cmake_parse_arguments(_csc "" "PROJECT_PATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) + cmake_parse_arguments(_csc "" "PROJECT_PATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" ${ARGN}) if(NOT DEFINED _csc_RELEASE_CONFIGURATION) set(_csc_RELEASE_CONFIGURATION Release) @@ -7,13 +44,16 @@ function(vcpkg_build_msbuild) if(NOT DEFINED _csc_DEBUG_CONFIGURATION) set(_csc_DEBUG_CONFIGURATION Debug) endif() + if(NOT DEFINED _csc_PLATFORM) + set(_csc_PLATFORM ${TRIPLET_SYSTEM_ARCH}) + endif() message(STATUS "Building ${_csc_PROJECT_PATH} for Release") file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) vcpkg_execute_required_process( COMMAND msbuild ${_csc_PROJECT_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE} /p:Configuration=${_csc_RELEASE_CONFIGURATION} - /p:Platform=${TRIPLET_SYSTEM_ARCH} + /p:Platform=${_csc_PLATFORM} /p:VCPkgLocalAppDataDisabled=true WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME build-${TARGET_TRIPLET}-rel @@ -24,7 +64,7 @@ function(vcpkg_build_msbuild) vcpkg_execute_required_process( COMMAND msbuild ${_csc_PROJECT_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG} /p:Configuration=${_csc_DEBUG_CONFIGURATION} - /p:Platform=${TRIPLET_SYSTEM_ARCH} + /p:Platform=${_csc_PLATFORM} /p:VCPkgLocalAppDataDisabled=true WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME build-${TARGET_TRIPLET}-dbg diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index aa85c8ff4..954c75b82 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -22,6 +22,16 @@ function(vcpkg_configure_cmake) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + if(DEFINED VCPKG_CMAKE_SYSTEM_NAME) + list(APPEND _csc_OPTIONS -DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}) + endif() + if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION) + list(APPEND _csc_OPTIONS -DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}) + endif() + if(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=ON) + endif() + message(STATUS "Configuring ${TARGET_TRIPLET}-rel") file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) vcpkg_execute_required_process( @@ -29,7 +39,7 @@ function(vcpkg_configure_cmake) -G ${GENERATOR} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TRIPLET_FILE} -DCMAKE_PREFIX_PATH=${CURRENT_INSTALLED_DIR} -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel @@ -44,7 +54,7 @@ function(vcpkg_configure_cmake) -G ${GENERATOR} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TRIPLET_FILE} -DCMAKE_PREFIX_PATH=${CURRENT_INSTALLED_DIR}/debug\\\\\\\;${CURRENT_INSTALLED_DIR} -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 7c36f5d97..44b562573 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -1,20 +1,52 @@ -# Usage: vcpkg_download_distfile(<VAR> URL <http://...> FILENAME <output.zip> MD5 <5981de...>) +# Usage: vcpkg_download_distfile(<VAR> URLS <http://mainUrl> <http://mirror1> <http://mirror2> FILENAME <output.zip> SHA512 <5981de...>) function(vcpkg_download_distfile VAR) - set(oneValueArgs URL FILENAME MD5) - cmake_parse_arguments(vcpkg_download_distfile "" "${oneValueArgs}" "" ${ARGN}) + set(oneValueArgs FILENAME SHA512) + set(multipleValuesArgs URLS) + cmake_parse_arguments(vcpkg_download_distfile "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN}) + set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}) - if(EXISTS ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}) - message(STATUS "Using cached ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}") - file(MD5 ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME} FILE_HASH) - if(NOT FILE_HASH MATCHES ${vcpkg_download_distfile_MD5}) + function(test_hash FILE_KIND CUSTOM_ERROR_ADVICE) + message(STATUS "Testing integrity of ${FILE_KIND}...") + file(SHA512 ${downloaded_file_path} FILE_HASH) + if(NOT "${FILE_HASH}" STREQUAL "${vcpkg_download_distfile_SHA512}") message(FATAL_ERROR - "File does not have expected hash: ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}\n" - " ${FILE_HASH} <> ${vcpkg_download_distfile_MD5}\n" - "Please delete the file and try again if this file should be downloaded again.") + "\nFile does not have expected hash:\n" + " File path: [ ${downloaded_file_path} ]\n" + " Expected hash: [ ${vcpkg_download_distfile_SHA512} ]\n" + " Actual hash: [ ${FILE_HASH} ]\n" + "${CUSTOM_ERROR_ADVICE}\n") endif() + message(STATUS "Testing integrity of ${FILE_KIND}... OK") + endfunction() + + if(EXISTS ${downloaded_file_path}) + message(STATUS "Using cached ${downloaded_file_path}") + test_hash("cached file" "Please delete the file and retry if this file should be downloaded again.") else() - message(STATUS "Downloading ${vcpkg_download_distfile_URL}") - file(DOWNLOAD ${vcpkg_download_distfile_URL} ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME} EXPECTED_HASH MD5=${vcpkg_download_distfile_MD5}) + # Tries to download the file. + foreach(url IN LISTS vcpkg_download_distfile_URLS) + message(STATUS "Downloading ${url}...") + file(DOWNLOAD ${url} ${downloaded_file_path} STATUS download_status) + list(GET download_status 0 status_code) + if (NOT "${status_code}" STREQUAL "0") + message(STATUS "Downloading ${url}... Failed. Status: ${download_status}") + file(REMOVE ${downloaded_file_path}) + set(download_success 0) + else() + message(STATUS "Downloading ${url}... OK") + set(download_success 1) + break() + endif() + endforeach(url) + + if (NOT ${download_success}) + message(FATAL_ERROR + "\n" + " Failed to download file.\n" + " Add mirrors or submit an issue at https://github.com/Microsoft/vcpkg/issues\n") + else() + test_hash("downloaded file" "The file may be corrupted.") + endif() endif() - set(${VAR} ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME} PARENT_SCOPE) + set(${VAR} ${downloaded_file_path} PARENT_SCOPE) endfunction() diff --git a/scripts/cmake/vcpkg_extract_source_archive.cmake b/scripts/cmake/vcpkg_extract_source_archive.cmake index 7e4efde07..70c9fe06b 100644 --- a/scripts/cmake/vcpkg_extract_source_archive.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive.cmake @@ -1,16 +1,22 @@ include(vcpkg_execute_required_process) function(vcpkg_extract_source_archive ARCHIVE) + if(NOT ARGC EQUAL 2) + set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src) + else() + set(WORKING_DIRECTORY ${ARGV1}) + endif() + get_filename_component(ARCHIVE_FILENAME ${ARCHIVE} NAME) - if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_FILENAME}.extracted) + if(NOT EXISTS ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted) message(STATUS "Extracting source ${ARCHIVE}") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src) + file(MAKE_DIRECTORY ${WORKING_DIRECTORY}) vcpkg_execute_required_process( COMMAND ${CMAKE_COMMAND} -E tar xjf ${ARCHIVE} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src + WORKING_DIRECTORY ${WORKING_DIRECTORY} LOGNAME extract ) - file(WRITE ${CURRENT_BUILDTREES_DIR}/src/${ARCHIVE_FILENAME}.extracted) + file(WRITE ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted) endif() message(STATUS "Extracting done") endfunction() diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index ce2cdaa26..8f974240f 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -10,20 +10,20 @@ function(vcpkg_find_acquire_program VAR) set(PATHS ${DOWNLOADS}/tools/perl/perl/bin) set(URL "http://strawberryperl.com/download/5.20.2.1/strawberry-perl-5.20.2.1-64bit-portable.zip") set(ARCHIVE "strawberry-perl-5.20.2.1-64bit-portable.zip") - set(HASH 5fca4b3cfa7c9cc95e0c4fd8652eba80) + set(HASH 6e14e5580e52da5d35f29b67a52ef9db0e021af1575b4bbd84ebdbf18580522287890bdc21c0d21ddc1b2529d888f8e159dcaa017a3ff06d8fd23d16901bcc8b) elseif(VAR MATCHES "NASM") set(PROGNAME nasm) set(PATHS ${DOWNLOADS}/tools/nasm/nasm-2.11.08) set(URL "http://www.nasm.us/pub/nasm/releasebuilds/2.11.08/win32/nasm-2.11.08-win32.zip") set(ARCHIVE "nasm-2.11.08-win32.zip") - set(HASH 46a31e22be69637f7a9ccba12874133f) + set(HASH cd80b540530d3995d15dc636e97673f1d34f471baadf1dac993165232c61efefe7f8ec10625f8f718fc89f0dd3dcb6a4595e0cf40c5fd7cbac1b71672b644d2d) elseif(VAR MATCHES "YASM") set(PROGNAME yasm) set(PATHS ${DOWNLOADS}/tools/yasm) set(URL "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win32.exe") set(ARCHIVE "yasm.exe") set(NOEXTRACT ON) - set(HASH 51e967dceddd1f84e67bff255df977b3) + set(HASH 850b26be5bbbdaeaf45ac39dd27f69f1a85e600c35afbd16b9f621396b3c7a19863ea3ff316b025b578fce0a8280eef2203306a2b3e46ee1389abb65313fb720) else() message(FATAL "unknown tool ${VAR} -- unable to acquire.") endif() @@ -31,7 +31,7 @@ function(vcpkg_find_acquire_program VAR) find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) if(${VAR} MATCHES "-NOTFOUND") file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE} - EXPECTED_MD5 ${HASH} + EXPECTED_HASH SHA512=${HASH} SHOW_PROGRESS ) file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}) diff --git a/scripts/doVcpkgRelease.ps1 b/scripts/doVcpkgRelease.ps1 index 3b3021286..97656ba69 100644 --- a/scripts/doVcpkgRelease.ps1 +++ b/scripts/doVcpkgRelease.ps1 @@ -2,7 +2,7 @@ param( ) - +$ErrorActionPreference = "Stop" $version = git show HEAD:toolsrc/VERSION.txt #Remove the quotes from the string $version = $version.Substring(1, $version.length - 2) @@ -51,11 +51,9 @@ for ($disableMetrics = 0; $disableMetrics -le 1; $disableMetrics++) # Partial checkout for building vcpkg $dotGitDir = "$vcpkgRootDir\.git" $workTreeForBuildOnly = "$buildPath" - $checkoutThisDirForBuildOnly1 = ".\scripts" # Must be relative to the root of the repository - $checkoutThisDirForBuildOnly2 = ".\toolsrc" # Must be relative to the root of the repository + $checkoutForBuildOnly = ".\scripts",".\toolsrc",".vcpkg-root" # Must be relative to the root of the repository Write-Verbose("Creating partial temporary checkout: $buildPath") - git --git-dir="$dotGitDir" --work-tree="$workTreeForBuildOnly" checkout $gitHash -f -q -- $checkoutThisDirForBuildOnly1 - git --git-dir="$dotGitDir" --work-tree="$workTreeForBuildOnly" checkout $gitHash -f -q -- $checkoutThisDirForBuildOnly2 + git --git-dir="$dotGitDir" --work-tree="$workTreeForBuildOnly" checkout $gitHash -f -q -- $checkoutForBuildOnly & "$buildPath\scripts\bootstrap.ps1" -disableMetrics $disableMetrics @@ -81,5 +79,4 @@ for ($disableMetrics = 0; $disableMetrics -le 1; $disableMetrics++) Remove-Item -recurse $releasePath | Out-Null Write-Verbose("Redistributable archive is: $outputArchive") -} -git tag $gitTagString
\ No newline at end of file +}
\ No newline at end of file diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 51afc8d61..44cb386be 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -1,14 +1,24 @@ cmake_minimum_required(VERSION 3.5) -get_filename_component(VCPKG_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR} DIRECTORY) -string(REGEX REPLACE "([^-]*)-([^-]*)" "\\1" TRIPLET_SYSTEM_ARCH ${TARGET_TRIPLET}) -string(REGEX REPLACE "([^-]*)-([^-]*)" "\\2" TRIPLET_SYSTEM_NAME ${TARGET_TRIPLET}) +macro(debug_message) + if(DEFINED PORT_DEBUG AND PORT_DEBUG) + message(STATUS "[DEBUG] ${ARGN}") + endif() +endmacro() -if(NOT EXISTS ${VCPKG_ROOT_DIR}/triplets/${TARGET_TRIPLET}.cmake) - message(FATAL_ERROR "Unsupported target triplet. Toolchain file does not exist: ${VCPKG_ROOT_DIR}/triplets/${TARGET_TRIPLET}.cmake") -endif() +#Detect .vcpkg-root to figure VCPKG_ROOT_DIR +SET(VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) +while(IS_DIRECTORY ${VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") + get_filename_component(VCPKG_ROOT_DIR_TEMP ${VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) + if (VCPKG_ROOT_DIR_TEMP STREQUAL VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive + message(FATAL_ERROR "Could not find .vcpkg-root") + else() + SET(VCPKG_ROOT_DIR_CANDIDATE ${VCPKG_ROOT_DIR_TEMP}) + endif() +endwhile() + +set(VCPKG_ROOT_DIR ${VCPKG_ROOT_DIR_CANDIDATE}) -set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT_DIR}/triplets/${TARGET_TRIPLET}.cmake) list(APPEND CMAKE_MODULE_PATH ${VCPKG_ROOT_DIR}/scripts/cmake) set(CURRENT_INSTALLED_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET} CACHE PATH "Location to install final packages") set(DOWNLOADS ${VCPKG_ROOT_DIR}/downloads CACHE PATH "Location to download sources and tools") @@ -20,37 +30,16 @@ if(PORT) set(CURRENT_PACKAGES_DIR ${PACKAGES_DIR}/${PORT}_${TARGET_TRIPLET}) endif() -macro(debug_message) - if(DEFINED PORT_DEBUG AND PORT_DEBUG) - message(STATUS "[DEBUG] ${ARGN}") - endif() -endmacro() -if(CMD MATCHES "^SCAFFOLD$") - if(EXISTS ports/${PORT}/portfile.cmake) - message(FATAL_ERROR "Portfile already exists: '${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake'") - endif() - if(NOT FILENAME) - get_filename_component(FILENAME "${URL}" NAME) - endif() - string(REGEX REPLACE "(\\.(zip|gz|tar|tgz|bz2))+\$" "" ROOT_NAME ${FILENAME}) - if(EXISTS ${DOWNLOADS}/${FILENAME}) - message(STATUS "Using pre-downloaded: ${DOWNLOADS}/${FILENAME}") - message(STATUS "If this is not desired, delete the file and ${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake") - else() - include(vcpkg_download_distfile) - file(DOWNLOAD ${URL} ${DOWNLOADS}/${FILENAME} STATUS error_code) - if(NOT error_code MATCHES "0;") - message(FATAL_ERROR "Error downloading file: ${error_code}") - endif() - endif() - file(MD5 ${DOWNLOADS}/${FILENAME} MD5) +if(CMD MATCHES "^BUILD$") + string(REGEX REPLACE "([^-]*)-([^-]*)" "\\1" TRIPLET_SYSTEM_ARCH ${TARGET_TRIPLET}) + string(REGEX REPLACE "([^-]*)-([^-]*)" "\\2" TRIPLET_SYSTEM_NAME ${TARGET_TRIPLET}) - file(MAKE_DIRECTORY ports/${PORT}) - configure_file(scripts/templates/portfile.in.cmake ports/${PORT}/portfile.cmake @ONLY) + set(CMAKE_TRIPLET_FILE ${VCPKG_ROOT_DIR}/triplets/${TARGET_TRIPLET}.cmake) + if(NOT EXISTS ${CMAKE_TRIPLET_FILE}) + message(FATAL_ERROR "Unsupported target triplet. Triplet file does not exist: ${CMAKE_TRIPLET_FILE}") + endif() - message(STATUS "Generated portfile: ${VCPKG_ROOT_DIR}/ports/${PORT}/portfile.cmake") -elseif(CMD MATCHES "^BUILD$") if(NOT DEFINED CURRENT_PORT_DIR) message(FATAL_ERROR "CURRENT_PORT_DIR was not defined") endif() @@ -82,4 +71,34 @@ elseif(CMD MATCHES "^BUILD$") file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR} ${CURRENT_PACKAGES_DIR}) include(${CURRENT_PORT_DIR}/portfile.cmake) +elseif(CMD MATCHES "^CREATE$") + file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR) + file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS) + if(EXISTS ports/${PORT}/portfile.cmake) + message(FATAL_ERROR "Portfile already exists: '${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\portfile.cmake'") + endif() + if(NOT FILENAME) + get_filename_component(FILENAME "${URL}" NAME) + endif() + string(REGEX REPLACE "(\\.(zip|gz|tar|tgz|bz2))+\$" "" ROOT_NAME ${FILENAME}) + if(EXISTS ${DOWNLOADS}/${FILENAME}) + message(STATUS "Using pre-downloaded: ${NATIVE_DOWNLOADS}\\${FILENAME}") + message(STATUS "If this is not desired, delete the file and ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}") + else() + include(vcpkg_download_distfile) + file(DOWNLOAD ${URL} ${DOWNLOADS}/${FILENAME} STATUS error_code) + if(NOT error_code MATCHES "0;") + message(FATAL_ERROR "Error downloading file: ${error_code}") + endif() + endif() + file(SHA512 ${DOWNLOADS}/${FILENAME} SHA512) + + file(MAKE_DIRECTORY ports/${PORT}) + configure_file(scripts/templates/portfile.in.cmake ports/${PORT}/portfile.cmake @ONLY) + configure_file(scripts/templates/CONTROL.in ports/${PORT}/CONTROL @ONLY) + + message(STATUS "Generated portfile: ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\portfile.cmake") + message(STATUS "Generated CONTROL: ${NATIVE_VCPKG_ROOT_DIR}\\ports\\${PORT}\\CONTROL") + message(STATUS "To launch an editor for these new files, run") + message(STATUS " vcpkg edit ${PORT}") endif() diff --git a/scripts/templates/CONTROL.in b/scripts/templates/CONTROL.in new file mode 100644 index 000000000..c5b706861 --- /dev/null +++ b/scripts/templates/CONTROL.in @@ -0,0 +1,3 @@ +Source: @PORT@ +Version: +Description:
\ No newline at end of file diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake index b29e2b682..804d8d216 100644 --- a/scripts/templates/portfile.in.cmake +++ b/scripts/templates/portfile.in.cmake @@ -1,21 +1,30 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +include(${CMAKE_TRIPLET_FILE}) include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/@ROOT_NAME@) vcpkg_download_distfile(ARCHIVE - URL "@URL@" + URLS "@URL@" FILENAME "@FILENAME@" - MD5 @MD5@ + SHA512 @SHA512@ ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/@ROOT_NAME@ + SOURCE_PATH ${SOURCE_PATH} # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 # OPTIONS_RELEASE -DOPTIMIZE=1 # OPTIONS_DEBUG -DDEBUGGABLE=1 ) -vcpkg_build_cmake() vcpkg_install_cmake() # Handle copyright -#file(COPY ${CURRENT_BUILDTREES_DIR}/src/@ROOT_NAME@/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/@PORT@) +#file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/@PORT@) #file(RENAME ${CURRENT_PACKAGES_DIR}/share/@PORT@/LICENSE ${CURRENT_PACKAGES_DIR}/share/@PORT@/copyright)
\ No newline at end of file diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index f723d10e0..fe0104ac9 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.30"
\ No newline at end of file +"0.0.40"
\ No newline at end of file diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/BinaryParagraph.h index 88d6e84b1..01979c924 100644 --- a/toolsrc/include/BinaryParagraph.h +++ b/toolsrc/include/BinaryParagraph.h @@ -3,6 +3,7 @@ #include <unordered_map> #include "SourceParagraph.h" #include "triplet.h" +#include "package_spec.h" namespace vcpkg { @@ -18,11 +19,10 @@ namespace vcpkg std::string dir() const; - std::string name; + package_spec spec; std::string version; std::string description; std::string maintainer; - triplet target_triplet; std::vector<std::string> depends; }; diff --git a/toolsrc/include/package_spec.h b/toolsrc/include/package_spec.h index b8ed1e088..30dfca5c7 100644 --- a/toolsrc/include/package_spec.h +++ b/toolsrc/include/package_spec.h @@ -8,13 +8,20 @@ namespace vcpkg { struct package_spec { - std::string name; - triplet target_triplet; + static expected<package_spec> from_string(const std::string& spec_as_string, const triplet& default_target_triplet); + + static expected<package_spec> from_name_and_triplet(const std::string& name, const triplet& target_triplet); + + const std::string& name() const; + + const triplet& target_triplet() const; std::string dir() const; - }; - expected<package_spec> parse(const std::string& spec, const triplet& default_target_triplet); + private: + std::string m_name; + triplet m_target_triplet; + }; std::string to_string(const package_spec& spec); @@ -33,8 +40,8 @@ namespace std size_t operator()(const vcpkg::package_spec& value) const { size_t hash = 17; - hash = hash * 31 + std::hash<std::string>()(value.name); - hash = hash * 31 + std::hash<vcpkg::triplet>()(value.target_triplet); + hash = hash * 31 + std::hash<std::string>()(value.name()); + hash = hash * 31 + std::hash<vcpkg::triplet>()(value.target_triplet()); return hash; } }; diff --git a/toolsrc/include/package_spec_parse_result.h b/toolsrc/include/package_spec_parse_result.h index e59622951..5735c4f4c 100644 --- a/toolsrc/include/package_spec_parse_result.h +++ b/toolsrc/include/package_spec_parse_result.h @@ -5,8 +5,9 @@ namespace vcpkg { enum class package_spec_parse_result { - success = 0, - too_many_colons + SUCCESS = 0, + TOO_MANY_COLONS, + INVALID_CHARACTERS }; struct package_spec_parse_result_category_impl final : std::error_category @@ -30,5 +31,6 @@ namespace std { template <> struct is_error_code_enum<vcpkg::package_spec_parse_result> : ::std::true_type - {}; + { + }; } diff --git a/toolsrc/include/triplet.h b/toolsrc/include/triplet.h index f9d1e9483..bc99a17df 100644 --- a/toolsrc/include/triplet.h +++ b/toolsrc/include/triplet.h @@ -6,17 +6,30 @@ namespace vcpkg { struct triplet { + static triplet from_canonical_name(const std::string& triplet_as_string); + + enum class BuildType + { + DYNAMIC, + STATIC + }; + static const triplet X86_WINDOWS; static const triplet X64_WINDOWS; static const triplet X86_UWP; static const triplet X64_UWP; static const triplet ARM_UWP; - std::string value; + BuildType build_type() const; + + const std::string& canonical_name() const; std::string architecture() const; std::string system() const; + + private: + std::string m_canonical_name; }; bool operator==(const triplet& left, const triplet& right); @@ -39,7 +52,7 @@ namespace std { std::hash<std::string> hasher; size_t hash = 17; - hash = hash * 31 + hasher(t.value); + hash = hash * 31 + hasher(t.canonical_name()); return hash; } }; diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h index 264d61fa9..a4a0682cf 100644 --- a/toolsrc/include/vcpkg.h +++ b/toolsrc/include/vcpkg.h @@ -18,10 +18,6 @@ namespace vcpkg std::vector<std::unordered_map<std::string, std::string>> parse_paragraphs(const std::string& str); std::string shorten_description(const std::string& desc); - fs::path find_available_package(const vcpkg_paths& paths, const package_spec& spec); - fs::path find_available_port_file(const vcpkg_paths& paths, const package_spec& spec); - fs::path control_file_for_package(const fs::path& package_path); - StatusParagraphs database_load_check(const vcpkg_paths& paths); std::vector<std::string> get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db); diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index c706c131c..978519820 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -9,6 +9,7 @@ namespace vcpkg void print_usage(); void print_example(const char* command_and_arguments); + std::string create_example_string(const char* command_and_arguments); void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); @@ -16,8 +17,8 @@ namespace vcpkg void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h new file mode 100644 index 000000000..9dc32fc41 --- /dev/null +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -0,0 +1,13 @@ +#pragma once +#include <vector> +#include "package_spec.h" +#include "StatusParagraphs.h" +#include <unordered_set> +#include "vcpkg_paths.h" + +namespace vcpkg {namespace Dependencies +{ + std::vector<package_spec> create_dependency_ordered_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db); + + std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db); +}} diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h index d23742f74..445713965 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg_Files.h @@ -5,7 +5,13 @@ namespace vcpkg {namespace Files { + static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)"; + void check_is_directory(const std::tr2::sys::path& dirpath); + bool has_invalid_chars_for_filesystem(const std::string s); + expected<std::string> get_contents(const std::tr2::sys::path& file_path) noexcept; + + std::tr2::sys::path find_file_recursively_up(const std::tr2::sys::path& starting_dir, const std::string& filename); }} diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h new file mode 100644 index 000000000..bbf3adfbf --- /dev/null +++ b/toolsrc/include/vcpkg_Input.h @@ -0,0 +1,15 @@ +#pragma once +#include <vector> +#include "package_spec.h" +#include "vcpkg_paths.h" + +namespace vcpkg {namespace Input +{ + package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const char* example_text); + + std::vector<package_spec> check_and_get_package_specs(const std::vector<std::string>& package_specs_as_strings, const triplet& default_target_triplet, const char* example_text); + + void check_triplet(const triplet& t, const vcpkg_paths& paths); + + void check_triplets(std::vector<package_spec> triplets, const vcpkg_paths& paths); +}} diff --git a/toolsrc/include/vcpkg_Maps.h b/toolsrc/include/vcpkg_Maps.h new file mode 100644 index 000000000..5b7b8ed46 --- /dev/null +++ b/toolsrc/include/vcpkg_Maps.h @@ -0,0 +1,18 @@ +#pragma once + +#include <unordered_map> +#include <unordered_set> + +namespace vcpkg { namespace Maps +{ + template <typename K, typename V> + std::unordered_set<K> extract_key_set(const std::unordered_map<K, V>& input_map) + { + std::unordered_set<K> key_set; + for (auto const& element : input_map) + { + key_set.insert(element.first); + } + return key_set; + } +}} diff --git a/toolsrc/include/vcpkg_Sets.h b/toolsrc/include/vcpkg_Sets.h new file mode 100644 index 000000000..7b330f31c --- /dev/null +++ b/toolsrc/include/vcpkg_Sets.h @@ -0,0 +1,17 @@ +#pragma once + +#include "vcpkg_Checks.h" +#include <unordered_set> + +namespace vcpkg { namespace Sets +{ + template <typename T, typename Container> + void remove_all(std::unordered_set<T>* input_set, Container remove_these) + { + Checks::check_throw(input_set != nullptr, "Input set cannot be null"); + for (const T& r : remove_these) + { + input_set->erase(r); + } + } +}} diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index f4b989292..2aa99afe0 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -19,6 +19,11 @@ namespace vcpkg {namespace Strings {namespace details return s; } + inline size_t to_printf_arg(const size_t s) + { + return s; + } + std::string format_internal(const char* fmtstr, ...); inline const wchar_t* to_wprintf_arg(const std::wstring& s) @@ -31,7 +36,7 @@ namespace vcpkg {namespace Strings {namespace details return s; } - std::wstring format_internal(const wchar_t* fmtstr, ...); + std::wstring wformat_internal(const wchar_t* fmtstr, ...); }}} namespace vcpkg {namespace Strings @@ -44,15 +49,17 @@ namespace vcpkg {namespace Strings } template <class...Args> - std::wstring format(const wchar_t* fmtstr, const Args&...args) + std::wstring wformat(const wchar_t* fmtstr, const Args&...args) { using vcpkg::Strings::details::to_wprintf_arg; - return details::format_internal(fmtstr, to_wprintf_arg(to_wprintf_arg(args))...); + return details::wformat_internal(fmtstr, to_wprintf_arg(to_wprintf_arg(args))...); } std::wstring utf8_to_utf16(const std::string& s); std::string utf16_to_utf8(const std::wstring& w); - std::string::const_iterator case_insensitive_find(const std::string& s, const std::string& pattern); + std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern); + + std::string ascii_to_lowercase(const std::string& input); }} diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 0df3d1222..95feb4814 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -4,16 +4,13 @@ #include <vector> #include <unordered_set> #include "opt_bool.h" -#include "package_spec.h" #include "vcpkg_paths.h" -#include "StatusParagraphs.h" namespace vcpkg { struct vcpkg_cmd_arguments { static vcpkg_cmd_arguments create_from_command_line(const int argc, const wchar_t* const* const argv); - static vcpkg_cmd_arguments create_from_arg_sequence(const std::string* arg_begin, const std::string* arg_end); std::unique_ptr<std::string> vcpkg_root_dir; @@ -26,9 +23,12 @@ namespace vcpkg std::vector<std::string> command_arguments; std::unordered_set<std::string> check_and_get_optional_command_arguments(const std::vector<std::string>& valid_options) const; - void check_max_args(size_t arg_count, const char* example_text = nullptr) const; - std::vector<package_spec> parse_all_arguments_as_package_specs(const triplet& default_target_triplet, const char* example_text = nullptr) const; - std::vector<package_spec> extract_package_specs_with_unmet_dependencies(const vcpkg_paths& paths, const triplet& default_target_triplet, const StatusParagraphs& status_db) const; + void check_max_arg_count(const size_t expected_arg_count) const; + void check_max_arg_count(const size_t expected_arg_count, const char* example_text) const; + void check_min_arg_count(const size_t expected_arg_count) const; + void check_min_arg_count(const size_t expected_arg_count, const char* example_text) const; + void check_exact_arg_count(const size_t expected_arg_count) const; + void check_exact_arg_count(const size_t expected_arg_count, const char* example_text) const; private: std::unordered_set<std::string> optional_command_arguments; diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index 58ab45bc5..046b6836c 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -1,29 +1,36 @@ #pragma once #include <filesystem> #include "expected.h" +#include "package_spec.h" namespace vcpkg { + namespace fs = std::tr2::sys; + struct vcpkg_paths { - static expected<vcpkg_paths> create(const std::tr2::sys::path& vcpkg_root_dir); + static expected<vcpkg_paths> create(const fs::path& vcpkg_root_dir); + + fs::path package_dir(const package_spec& spec) const; + fs::path port_dir(const package_spec& spec) const; + bool is_valid_triplet(const triplet& t) const; - std::tr2::sys::path root; - std::tr2::sys::path packages; - std::tr2::sys::path buildtrees; - std::tr2::sys::path downloads; - std::tr2::sys::path ports; - std::tr2::sys::path installed; - std::tr2::sys::path triplets; + fs::path root; + fs::path packages; + fs::path buildtrees; + fs::path downloads; + fs::path ports; + fs::path installed; + fs::path triplets; - std::tr2::sys::path buildsystems; - std::tr2::sys::path buildsystems_msbuild_targets; + fs::path buildsystems; + fs::path buildsystems_msbuild_targets; - std::tr2::sys::path vcpkg_dir; - std::tr2::sys::path vcpkg_dir_status_file; - std::tr2::sys::path vcpkg_dir_info; - std::tr2::sys::path vcpkg_dir_updates; + fs::path vcpkg_dir; + fs::path vcpkg_dir_status_file; + fs::path vcpkg_dir_info; + fs::path vcpkg_dir_updates; - std::tr2::sys::path ports_cmake; + fs::path ports_cmake; }; } diff --git a/toolsrc/include/vcpkglib_helpers.h b/toolsrc/include/vcpkglib_helpers.h index e15b59b0b..72711d63b 100644 --- a/toolsrc/include/vcpkglib_helpers.h +++ b/toolsrc/include/vcpkglib_helpers.h @@ -4,9 +4,9 @@ namespace vcpkg {namespace details { - void optional_field(const std::unordered_map<std::string, std::string>& fields, std::string& out, const std::string& fieldname); + std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname); - void required_field(const std::unordered_map<std::string, std::string>& fields, std::string& out, const std::string& fieldname); + std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname); - void parse_depends(const std::string& depends_string, std::vector<std::string>& out); + std::vector<std::string> parse_depends(const std::string& depends_string); }} diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/BinaryParagraph.cpp index 274bd879e..48d04f686 100644 --- a/toolsrc/src/BinaryParagraph.cpp +++ b/toolsrc/src/BinaryParagraph.cpp @@ -8,55 +8,55 @@ namespace vcpkg { BinaryParagraph::BinaryParagraph() = default; - BinaryParagraph::BinaryParagraph(const std::unordered_map<std::string, std::string>& fields) + BinaryParagraph::BinaryParagraph(const std::unordered_map<std::string, std::string>& fields) : + version(required_field(fields, "Version")), + description(optional_field(fields, "Description")), + maintainer(optional_field(fields, "Maintainer")) { - details::required_field(fields, name, "Package"); - required_field(fields, version, "Version"); - required_field(fields, target_triplet.value, "Architecture"); + const std::string name = required_field(fields, "Package"); + const triplet target_triplet = triplet::from_canonical_name(required_field(fields, "Architecture")); + this->spec = package_spec::from_name_and_triplet(name, target_triplet).get_or_throw(); + { - std::string multi_arch; - required_field(fields, multi_arch, "Multi-Arch"); + std::string multi_arch = required_field(fields, "Multi-Arch"); Checks::check_throw(multi_arch == "same", "Multi-Arch must be 'same' but was %s", multi_arch); } - optional_field(fields, description, "Description"); - std::string deps; - optional_field(fields, deps, "Depends"); + + std::string deps = optional_field(fields, "Depends"); if (!deps.empty()) { - depends.clear(); - parse_depends(deps, depends); + this->depends.clear(); + this->depends = parse_depends(deps); } - optional_field(fields, maintainer, "Maintainer"); } BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet) { - this->name = spgh.name; + this->spec = package_spec::from_name_and_triplet(spgh.name, target_triplet).get_or_throw(); this->version = spgh.version; this->description = spgh.description; this->maintainer = spgh.maintainer; this->depends = spgh.depends; - this->target_triplet = target_triplet; } std::string BinaryParagraph::displayname() const { - return Strings::format("%s:%s", this->name, this->target_triplet); + return Strings::format("%s:%s", this->spec.name(), this->spec.target_triplet()); } std::string BinaryParagraph::dir() const { - return Strings::format("%s_%s", this->name, this->target_triplet); + return this->spec.dir(); } std::string BinaryParagraph::fullstem() const { - return Strings::format("%s_%s_%s", this->name, this->version, this->target_triplet); + return Strings::format("%s_%s_%s", this->spec.name(), this->version, this->spec.target_triplet()); } std::ostream& operator<<(std::ostream& os, const BinaryParagraph& p) { - os << "Package: " << p.name << "\n"; + os << "Package: " << p.spec.name() << "\n"; os << "Version: " << p.version << "\n"; if (!p.depends.empty()) { @@ -71,7 +71,7 @@ namespace vcpkg os << "\n"; } - os << "Architecture: " << p.target_triplet << "\n"; + os << "Architecture: " << p.spec.target_triplet() << "\n"; os << "Multi-Arch: same\n"; if (!p.maintainer.empty()) os << "Maintainer: " << p.maintainer << "\n"; diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp index 7e3b0403e..374121ae9 100644 --- a/toolsrc/src/SourceParagraph.cpp +++ b/toolsrc/src/SourceParagraph.cpp @@ -5,17 +5,16 @@ using namespace vcpkg::details; vcpkg::SourceParagraph::SourceParagraph() = default; -vcpkg::SourceParagraph::SourceParagraph(const std::unordered_map<std::string, std::string>& fields) +vcpkg::SourceParagraph::SourceParagraph(const std::unordered_map<std::string, std::string>& fields): + name(required_field(fields, "Source")), + version(required_field(fields, "Version")), + description(optional_field(fields, "Description")), + maintainer(optional_field(fields, "Maintainer")) { - required_field(fields, name, "Source"); - required_field(fields, version, "Version"); - optional_field(fields, description, "Description"); - std::string deps; - optional_field(fields, deps, "Build-Depends"); + std::string deps = optional_field(fields, "Build-Depends"); if (!deps.empty()) { - depends.clear(); - parse_depends(deps, depends); - } - optional_field(fields, maintainer, "Maintainer"); + this->depends.clear(); + this->depends = parse_depends(deps); + }; } diff --git a/toolsrc/src/StatusParagraph.cpp b/toolsrc/src/StatusParagraph.cpp index 09a3b4d45..5aa425969 100644 --- a/toolsrc/src/StatusParagraph.cpp +++ b/toolsrc/src/StatusParagraph.cpp @@ -19,8 +19,7 @@ namespace vcpkg StatusParagraph::StatusParagraph(const std::unordered_map<std::string, std::string>& fields) : package(fields) { - std::string status_field; - required_field(fields, status_field, "Status"); + std::string status_field = required_field(fields, "Status"); auto b = status_field.begin(); auto mark = b; diff --git a/toolsrc/src/StatusParagraphs.cpp b/toolsrc/src/StatusParagraphs.cpp index 463e3e3b8..3e23c519a 100644 --- a/toolsrc/src/StatusParagraphs.cpp +++ b/toolsrc/src/StatusParagraphs.cpp @@ -13,17 +13,19 @@ namespace vcpkg StatusParagraphs::const_iterator StatusParagraphs::find(const std::string& name, const triplet& target_triplet) const { - return std::find_if(begin(), end(), [&](const auto& pgh) + return std::find_if(begin(), end(), [&](const std::unique_ptr<StatusParagraph>& pgh) { - return pgh->package.name == name && pgh->package.target_triplet == target_triplet; + const package_spec& spec = pgh->package.spec; + return spec.name() == name && spec.target_triplet() == target_triplet; }); } StatusParagraphs::iterator StatusParagraphs::find(const std::string& name, const triplet& target_triplet) { - return std::find_if(begin(), end(), [&](const auto& pgh) + return std::find_if(begin(), end(), [&](const std::unique_ptr<StatusParagraph>& pgh) { - return pgh->package.name == name && pgh->package.target_triplet == target_triplet; + const package_spec& spec = pgh->package.spec; + return spec.name() == name && spec.target_triplet() == target_triplet; }); } @@ -41,18 +43,17 @@ namespace vcpkg StatusParagraphs::iterator StatusParagraphs::insert(std::unique_ptr<StatusParagraph> pgh) { Checks::check_throw(pgh != nullptr, "Inserted null paragraph"); - auto ptr = find(pgh->package.name, pgh->package.target_triplet); + const package_spec& spec = pgh->package.spec; + auto ptr = find(spec.name(), spec.target_triplet()); if (ptr == end()) { paragraphs.push_back(std::move(pgh)); return paragraphs.rbegin(); } - else - { - // consume data from provided pgh. - **ptr = std::move(*pgh); - return ptr; - } + + // consume data from provided pgh. + **ptr = std::move(*pgh); + return ptr; } std::ostream& vcpkg::operator<<(std::ostream& os, const StatusParagraphs& l) diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp new file mode 100644 index 000000000..0d70f0f29 --- /dev/null +++ b/toolsrc/src/commands_cache.cpp @@ -0,0 +1,39 @@ +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" +#include "vcpkg_Files.h" +#include "vcpkg.h" + +namespace vcpkg +{ + void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + args.check_exact_arg_count(0); + + auto begin_it = fs::directory_iterator(paths.packages); + auto end_it = fs::directory_iterator(); + + if (begin_it == end_it) + { + System::println("No packages are cached."); + exit(EXIT_SUCCESS); + } + + for (; begin_it != end_it; ++begin_it) + { + const auto& path = begin_it->path(); + + auto file_contents = Files::get_contents(path / "CONTROL"); + if (auto text = file_contents.get()) + { + auto pghs = parse_paragraphs(*text); + if (pghs.size() != 1) + continue; + + auto src = BinaryParagraph(pghs[0]); + System::println(src.displayname().c_str()); + } + } + + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp new file mode 100644 index 000000000..d1611eb5c --- /dev/null +++ b/toolsrc/src/commands_create.cpp @@ -0,0 +1,37 @@ +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" +#include "vcpkg_Environment.h" +#include "vcpkg_Files.h" +#include "vcpkg_Input.h" + +namespace vcpkg +{ + void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + static const std::string example = create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); + args.check_max_arg_count(3, example.c_str()); + args.check_min_arg_count(2, example.c_str()); + + const std::string port_name = args.command_arguments.at(0); + Environment::ensure_utilities_on_path(paths); + + // Space OR define the FILENAME with proper spacing + std::wstring custom_filename = L" "; + if (args.command_arguments.size() >= 3) + { + const std::string& zip_file_name = args.command_arguments.at(2); + Checks::check_exit(!Files::has_invalid_chars_for_filesystem(zip_file_name), + R"(Filename cannot contain invalid chars %s, but was %s)", + Files::FILESYSTEM_INVALID_CHARACTERS, zip_file_name); + custom_filename = Strings::wformat(LR"( -DFILENAME="%s" )", Strings::utf8_to_utf16(zip_file_name)); + } + + const std::wstring cmdline = Strings::wformat(LR"(cmake -DCMD=CREATE -DPORT=%s -DURL=%s%s-P "%s")", + Strings::utf8_to_utf16(port_name), + Strings::utf8_to_utf16(args.command_arguments.at(1)), + custom_filename, + paths.ports_cmake.generic_wstring()); + + exit(System::cmd_execute(cmdline)); + } +} diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp new file mode 100644 index 000000000..f07a15875 --- /dev/null +++ b/toolsrc/src/commands_edit.cpp @@ -0,0 +1,33 @@ +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" +#include "vcpkg_Input.h" + +namespace vcpkg +{ + void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + static const std::string example = create_example_string("edit zlib"); + args.check_exact_arg_count(1, example.c_str()); + const std::string port_name = args.command_arguments.at(0); + + const fs::path portpath = paths.ports / port_name; + + // Find editor + std::wstring env_EDITOR = System::wdupenv_str(L"EDITOR"); + if (env_EDITOR.empty()) + { + static const std::wstring CODE_EXE_PATH = LR"(C:\Program Files (x86)\Microsoft VS Code\Code.exe)"; + if (fs::exists(CODE_EXE_PATH)) + { + env_EDITOR = CODE_EXE_PATH; + } + else + { + Checks::exit_with_message("Visual Studio Code was not found and the environmental variable EDITOR is not set"); + } + } + + std::wstring cmdLine = Strings::wformat(LR"("%s" "%s" "%s")", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native()); + exit(System::cmd_execute(cmdLine)); + } +} diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index 4e1ae9c49..194e809b1 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -6,18 +6,17 @@ namespace vcpkg { void version_command(const vcpkg_cmd_arguments& args) { - args.check_max_args(0); + args.check_exact_arg_count(0); System::println("Vcpkg package management program version %s\n" "\n" - "Vcpkg is provided \"as-is\" without warranty of any kind, express or implied.\n" - "All rights reserved.", vcpkg::version() + "See LICENSE.txt for license information.", vcpkg::version() ); exit(EXIT_SUCCESS); } void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { - args.check_max_args(1); + args.check_max_arg_count(1); if (args.command_arguments.empty()) { print_usage(); @@ -37,8 +36,9 @@ namespace vcpkg exit(EXIT_SUCCESS); } - void contact_command(const vcpkg_cmd_arguments& /*args*/) + void contact_command(const vcpkg_cmd_arguments& args) { + args.check_exact_arg_count(0); System::println("Send an email to vcpkg@microsoft.com with any feedback."); exit(EXIT_SUCCESS); } diff --git a/toolsrc/src/commands_import.cpp b/toolsrc/src/commands_import.cpp new file mode 100644 index 000000000..9cfc53d6c --- /dev/null +++ b/toolsrc/src/commands_import.cpp @@ -0,0 +1,25 @@ +#include "vcpkg_Commands.h" +#include "vcpkg.h" + +namespace vcpkg +{ + void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + static const std::string example = create_example_string(R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"); + args.check_exact_arg_count(3, example.c_str()); + + const fs::path control_file_path(args.command_arguments[0]); + const fs::path include_directory(args.command_arguments[1]); + const fs::path project_directory(args.command_arguments[2]); + + auto pghs = get_paragraphs(control_file_path); + Checks::check_throw(pghs.size() == 1, "Invalid control file for package"); + + StatusParagraph spgh; + spgh.package = BinaryParagraph(pghs[0]); + auto& control_file_data = spgh.package; + + vcpkg::binary_import(paths, include_directory, project_directory, control_file_data); + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp index b70ab0249..6fe6aa9a1 100644 --- a/toolsrc/src/commands_installation.cpp +++ b/toolsrc/src/commands_installation.cpp @@ -1,13 +1,13 @@ #include "vcpkg_Commands.h" #include "vcpkg.h" -#include <iostream> #include <fstream> -#include <iomanip> #include "vcpkg_Environment.h" #include "metrics.h" #include "vcpkg_Files.h" #include "post_build_lint.h" #include "vcpkg_System.h" +#include "vcpkg_Dependencies.h" +#include "vcpkg_Input.h" namespace vcpkg { @@ -23,12 +23,13 @@ namespace vcpkg static void build_internal(const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) { const fs::path ports_cmake_script_path = paths.ports_cmake; - const std::wstring command = Strings::format(LR"("%%VS140COMNTOOLS%%..\..\VC\vcvarsall.bat" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", - Strings::utf8_to_utf16(spec.target_triplet.architecture()), - Strings::utf8_to_utf16(spec.name), - Strings::utf8_to_utf16(spec.target_triplet.value), - port_dir.generic_wstring(), - ports_cmake_script_path.generic_wstring()); + auto&& target_triplet = spec.target_triplet(); + const std::wstring command = Strings::wformat(LR"("%%VS140COMNTOOLS%%..\..\VC\vcvarsall.bat" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", + Strings::utf8_to_utf16(target_triplet.architecture()), + Strings::utf8_to_utf16(spec.name()), + Strings::utf8_to_utf16(target_triplet.canonical_name()), + port_dir.generic_wstring(), + ports_cmake_script_path.generic_wstring()); System::Stopwatch timer; timer.start(); @@ -38,15 +39,22 @@ namespace vcpkg if (return_code != 0) { - System::println(System::color::error, "Error: build command failed"); + System::println(System::color::error, "Error: building package %s failed", to_string(spec)); + System::println("Please ensure sure you're using the latest portfiles with `vcpkg update`, then\n" + "submit an issue at https://github.com/Microsoft/vcpkg/issues including:\n" + " Package: %s\n" + " Vcpkg version: %s\n" + "\n" + "Additionally, attach any relevant sections from the log files above." + , to_string(spec), version()); TrackProperty("error", "build failed"); - TrackProperty("build_error", std::to_string(return_code)); + TrackProperty("build_error", to_string(spec)); exit(EXIT_FAILURE); } perform_all_checks(spec, paths); - create_binary_control_file(paths, port_dir, spec.target_triplet); + create_binary_control_file(paths, port_dir, target_triplet); // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name; // delete_directory(port_buildtrees_dir); @@ -54,33 +62,37 @@ namespace vcpkg static void build_internal(const package_spec& spec, const vcpkg_paths& paths) { - return build_internal(spec, paths, paths.ports / spec.name); + return build_internal(spec, paths, paths.ports / spec.name()); } void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { + static const std::string example = create_example_string("install zlib zlib:x64-windows curl boost"); + args.check_min_arg_count(1, example.c_str()); StatusParagraphs status_db = database_load_check(paths); - std::vector<package_spec> specs = args.extract_package_specs_with_unmet_dependencies(paths, default_target_triplet, status_db); - Checks::check_exit(!specs.empty(), "Specs cannot be empty"); - std::string specs_string = to_string(specs[0]); - for (size_t i = 1; i < specs.size(); ++i) + std::vector<package_spec> specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example.c_str()); + Input::check_triplets(specs, paths); + std::vector<package_spec> install_plan = Dependencies::create_dependency_ordered_install_plan(paths, specs, status_db); + Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); + std::string specs_string = to_string(install_plan[0]); + for (size_t i = 1; i < install_plan.size(); ++i) { specs_string.push_back(','); - specs_string.append(to_string(specs[i])); + specs_string.append(to_string(install_plan[i])); } TrackProperty("installplan", specs_string); Environment::ensure_utilities_on_path(paths); - for (const package_spec& spec : specs) + for (const package_spec& spec : install_plan) { - if (status_db.find_installed(spec.name, spec.target_triplet) != status_db.end()) + if (status_db.find_installed(spec.name(), spec.target_triplet()) != status_db.end()) { System::println(System::color::success, "Package %s is already installed", spec); continue; } - fs::path package_path = find_available_package(paths, spec); + fs::path package_path = paths.package_dir(spec); expected<std::string> file_contents = Files::get_contents(package_path / "CONTROL"); @@ -111,98 +123,46 @@ namespace vcpkg exit(EXIT_SUCCESS); } - void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) - { - args.check_max_args(1); - - if (args.command_arguments.size() == 1) - { - System::println(System::color::warning, "Search strings are not yet implemented; showing full list of packages."); - } - - auto begin_it = fs::directory_iterator(paths.ports); - auto end_it = fs::directory_iterator(); - for (; begin_it != end_it; ++begin_it) - { - const auto& path = begin_it->path(); - - try - { - auto pghs = get_paragraphs(path / "CONTROL"); - if (pghs.empty()) - continue; - auto srcpgh = SourceParagraph(pghs[0]); - std::cout << std::left - << std::setw(20) << srcpgh.name << ' ' - << std::setw(16) << srcpgh.version << ' ' - << shorten_description(srcpgh.description) << '\n'; - } - catch (std::runtime_error const&) - { - } - } - - System::println("\nIf your library is not listed, please open an issue at:\n" - " https://github.com/Microsoft/vcpkg/issues"); - - exit(EXIT_SUCCESS); - } - - void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { - args.check_max_args(0); + static const std::string example = create_example_string("build zlib:x64-windows"); - auto begin_it = fs::directory_iterator(paths.packages); - auto end_it = fs::directory_iterator(); + // Installing multiple packages leads to unintuitive behavior if one of them depends on another. + // Allowing only 1 package for now. - if (begin_it == end_it) - { - System::println("No packages are cached."); - exit(EXIT_SUCCESS); - } + args.check_exact_arg_count(1, example.c_str()); + StatusParagraphs status_db = database_load_check(paths); - for (; begin_it != end_it; ++begin_it) + const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example.c_str()); + Input::check_triplet(spec.target_triplet(), paths); + std::unordered_set<package_spec> unmet_dependencies = Dependencies::find_unmet_dependencies(paths, spec, status_db); + if (!unmet_dependencies.empty()) { - const auto& path = begin_it->path(); - - auto file_contents = Files::get_contents(path / "CONTROL"); - if (auto text = file_contents.get()) + System::println(System::color::error, "The build command requires all dependencies to be already installed."); + System::println("The following dependencies are missing:"); + System::println(""); + for (const package_spec& p : unmet_dependencies) { - auto pghs = parse_paragraphs(*text); - if (pghs.size() != 1) - continue; - - auto src = BinaryParagraph(pghs[0]); - System::println(src.displayname().c_str()); + System::println(" %s", to_string(p)); } + System::println(""); + exit(EXIT_FAILURE); } - exit(EXIT_SUCCESS); - } - - void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) - { - std::vector<package_spec> specs = args.parse_all_arguments_as_package_specs(default_target_triplet); Environment::ensure_utilities_on_path(paths); - for (const package_spec& spec : specs) - { - build_internal(spec, paths); - } + build_internal(spec, paths); exit(EXIT_SUCCESS); } void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { - if (args.command_arguments.size() != 2) - { - System::println(System::color::error, "Error: buildexternal requires the package name and the directory containing the CONTROL file"); - print_example(R"(buildexternal mylib C:\path\to\mylib\)"); - exit(EXIT_FAILURE); - } + static const std::string example = create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); + args.check_exact_arg_count(2, example.c_str()); - expected<package_spec> current_spec = vcpkg::parse(args.command_arguments[0], default_target_triplet); + expected<package_spec> current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet); if (auto spec = current_spec.get()) { + Input::check_triplet(spec->target_triplet(), paths); Environment::ensure_utilities_on_path(paths); const fs::path port_dir = args.command_arguments.at(1); build_internal(*spec, paths, port_dir); diff --git a/toolsrc/src/commands_integration.cpp b/toolsrc/src/commands_integration.cpp index 178d40e83..6a11d6ec4 100644 --- a/toolsrc/src/commands_integration.cpp +++ b/toolsrc/src/commands_integration.cpp @@ -195,7 +195,7 @@ namespace vcpkg const fs::path sys_src_path = tmp_dir / "vcpkg.system.targets"; std::ofstream(sys_src_path) << create_system_targets_shortcut(); - const std::string param = Strings::format(R"(/c XCOPY "%s" "%s*" /Y > nul)", sys_src_path.string(), system_wide_targets_file.string()); + const std::string param = Strings::format(R"(/c mkdir "%s" & copy "%s" "%s" /Y > nul)", system_wide_targets_file.parent_path().string(), sys_src_path.string(), system_wide_targets_file.string()); elevation_prompt_user_choice user_choice = elevated_cmd_execute(param); switch (user_choice) { @@ -238,7 +238,7 @@ namespace vcpkg exit(EXIT_SUCCESS); } - const std::wstring cmd_line = Strings::format(LR"(DEL "%s")", get_appdata_targets_path().native()); + const std::wstring cmd_line = Strings::wformat(LR"(DEL "%s")", get_appdata_targets_path().native()); const int exit_code = System::cmd_execute(cmd_line); if (exit_code) { @@ -269,7 +269,7 @@ namespace vcpkg std::ofstream(nuspec_file_path) << create_nuspec_file(paths.root, nuget_id, nupkg_version); // Using all forward slashes for the command line - const std::wstring cmd_line = Strings::format(LR"(nuget.exe pack -OutputDirectory "%s" "%s" > nul)", buildsystems_dir.native(), nuspec_file_path.native()); + const std::wstring cmd_line = Strings::wformat(LR"(nuget.exe pack -OutputDirectory "%s" "%s" > nul)", buildsystems_dir.native(), nuspec_file_path.native()); const int exit_code = System::cmd_execute(cmd_line); @@ -297,13 +297,9 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console void integrate_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { - if (args.command_arguments.size() != 1) - { - std::cout << "Commands:\n" << - INTEGRATE_COMMAND_HELPSTRING << - "\n"; - exit(EXIT_FAILURE); - } + static const std::string example = Strings::format("Commands:\n" + "%s", INTEGRATE_COMMAND_HELPSTRING); + args.check_exact_arg_count(1, example.c_str()); if (args.command_arguments[0] == "install") { diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp new file mode 100644 index 000000000..194e4b435 --- /dev/null +++ b/toolsrc/src/commands_list.cpp @@ -0,0 +1,32 @@ +#include "vcpkg_Commands.h" +#include "vcpkg.h" +#include "vcpkg_System.h" + +namespace vcpkg +{ + void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + args.check_exact_arg_count(0); + + std::vector<std::string> packages_output; + for (auto&& pgh : database_load_check(paths)) + { + if (pgh->state == install_state_t::not_installed && pgh->want == want_t::purge) + continue; + packages_output.push_back(Strings::format("%-27s %-16s %s", + pgh->package.displayname(), + pgh->package.version, + shorten_description(pgh->package.description))); + } + std::sort(packages_output.begin(), packages_output.end()); + for (auto&& package : packages_output) + { + System::println(package.c_str()); + } + if (packages_output.empty()) + { + System::println("No packages are installed. Did you mean `search`?"); + } + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_other.cpp b/toolsrc/src/commands_other.cpp index c7dcc2586..07549a437 100644 --- a/toolsrc/src/commands_other.cpp +++ b/toolsrc/src/commands_other.cpp @@ -1,16 +1,13 @@ #include "vcpkg_Commands.h" -#include <iostream> -#include <unordered_set> -#include "vcpkg_Environment.h" -#include "vcpkg.h" #include "vcpkg_System.h" -#include "vcpkg_Files.h" +#include "vcpkg.h" namespace vcpkg { void print_usage() { - std::cout << "Commands:\n" + System::println( + "Commands:\n" " vcpkg search [pat] Search for packages available to be built\n" " vcpkg install <pkg> Install a package\n" " vcpkg remove <pkg> Uninstall a package. \n" @@ -18,9 +15,9 @@ namespace vcpkg " vcpkg list List installed packages\n" " vcpkg update Display list of packages for updating\n" "\n" - << INTEGRATE_COMMAND_HELPSTRING << + "%s" // Integration help "\n" - " vcpkg edit <pkg> Open up a port for editing (uses %EDITOR%, default 'code')\n" + " vcpkg edit <pkg> Open up a port for editing (uses %%EDITOR%%, default 'code')\n" " vcpkg import <pkg> Import a pre-built library\n" " vcpkg create <pkg> <url>\n" " [archivename] Create a new package\n" @@ -35,215 +32,25 @@ namespace vcpkg //"\n" "Options:\n" " --triplet <t> Specify the target architecture triplet.\n" - " (default: x86-windows, see 'vcpkg help triplet')\n" + " (default: %%VCPKG_DEFAULT_TRIPLET%%, see 'vcpkg help triplet')\n" "\n" " --vcpkg-root <path> Specify the vcpkg root directory\n" - " (default: %VCPKG_ROOT%)\n" + " (default: %%VCPKG_ROOT%%)\n" "\n" "For more help (including examples) see the accompanying README.md." - "\n"; + , INTEGRATE_COMMAND_HELPSTRING); } - void print_example(const char* command_and_arguments) + std::string create_example_string(const char* command_and_arguments) { - std::cout << - "Example:\n" - " vcpkg " << command_and_arguments << "\n"; + std::string cs = Strings::format("Example:\n" + " vcpkg %s", command_and_arguments); + return cs; } - void update_command(const vcpkg_cmd_arguments& /*args*/, const vcpkg_paths& paths) - { - auto status_db = database_load_check(paths); - - std::unordered_map<std::string, std::string> src_names_to_versions; - - auto begin_it = fs::directory_iterator(paths.ports); - auto end_it = fs::directory_iterator(); - for (; begin_it != end_it; ++begin_it) - { - const auto& path = begin_it->path(); - try - { - auto pghs = get_paragraphs(path / "CONTROL"); - if (pghs.empty()) - continue; - auto srcpgh = SourceParagraph(pghs[0]); - src_names_to_versions.emplace(srcpgh.name, srcpgh.version); - } - catch (std::runtime_error const&) - { - } - } - - std::string packages_list; - - std::vector<std::string> packages_output; - for (auto&& pgh : database_load_check(paths)) - { - if (pgh->state == install_state_t::not_installed && pgh->want == want_t::purge) - continue; - auto it = src_names_to_versions.find(pgh->package.name); - if (it == src_names_to_versions.end()) - { - // Package was not installed from portfile - continue; - } - if (it->second != pgh->package.version) - { - packages_output.push_back(Strings::format("%-27s %s -> %s", - pgh->package.displayname(), - pgh->package.version, - it->second)); - packages_list.append(" " + pgh->package.displayname()); - } - } - std::sort(packages_output.begin(), packages_output.end()); - if (packages_output.empty()) - { - System::println("No packages need updating."); - } - else - { - System::println("The following packages differ from their port versions:"); - for (auto&& package : packages_output) - { - System::println(" %s", package.c_str()); - } - System::println("\nTo update these packages, run\n vcpkg remove --purge <pkgs>...\n vcpkg install <pkgs>..."); - } - - auto version_file = Files::get_contents(paths.root / "toolsrc" / "VERSION.txt"); - if (auto version_contents = version_file.get()) - { - int maj1, min1, rev1; - auto num1 = sscanf_s(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1); - - int maj2, min2, rev2; - auto num2 = sscanf_s(version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2); - - if (num1 == 3 && num2 == 3) - { - if (maj1 != maj2 || min1 != min2 || rev1 != rev2) - { - System::println("Different source is available for vcpkg (%d.%d.%d -> %d.%d.%d). Use scripts\\bootstrap.ps1 to update.", - maj2, min2, rev2, - maj1, min1, rev1); - } - } - } - - exit(EXIT_SUCCESS); - } - - void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) - { - static auto example = "edit zlib"; - args.check_max_args(1, example); - package_spec spec = args.parse_all_arguments_as_package_specs(default_target_triplet, example).at(0); - - // Find editor - std::wstring env_EDITOR = System::wdupenv_str(L"EDITOR"); - if (env_EDITOR.empty()) - env_EDITOR = LR"(C:\Program Files (x86)\Microsoft VS Code\Code.exe)"; - - auto portpath = paths.ports / spec.name; - std::wstring cmdLine = Strings::format(LR"("%s" "%s" "%s")", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native()); - exit(System::cmd_execute(cmdLine)); - } - - void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) - { - args.check_max_args(3); - package_spec spec = args.parse_all_arguments_as_package_specs(default_target_triplet).at(0); - if (args.command_arguments.size() < 2) - { - System::println(System::color::error, "Error: create requires the archive's URL as the second argument."); - print_usage(); - exit(EXIT_FAILURE); - } - Environment::ensure_utilities_on_path(paths); - - // Space OR define the FILENAME with proper spacing - std::wstring custom_filename = L" "; - if (args.command_arguments.size() >= 3) - { - custom_filename = Strings::format(L" -DFILENAME=%s ", Strings::utf8_to_utf16(args.command_arguments.at(2))); - } - - const std::wstring cmdline = Strings::format(LR"(cmake -DCMD=SCAFFOLD -DPORT=%s -DTARGET_TRIPLET=%s -DURL=%s%s-P "%s")", - Strings::utf8_to_utf16(spec.name), - Strings::utf8_to_utf16(spec.target_triplet.value), - Strings::utf8_to_utf16(args.command_arguments.at(1)), - custom_filename, - paths.ports_cmake.generic_wstring()); - - exit(System::cmd_execute(cmdline)); - } - - void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) - { - args.check_max_args(0); - - std::vector<std::string> packages_output; - for (auto&& pgh : database_load_check(paths)) - { - if (pgh->state == install_state_t::not_installed && pgh->want == want_t::purge) - continue; - packages_output.push_back(Strings::format("%-27s %-16s %s", - pgh->package.displayname(), - pgh->package.version, - shorten_description(pgh->package.description))); - } - std::sort(packages_output.begin(), packages_output.end()); - for (auto&& package : packages_output) - { - System::println(package.c_str()); - } - if (packages_output.empty()) - { - System::println("No packages are installed. Did you mean `search`?"); - } - exit(EXIT_SUCCESS); - } - - void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) - { - if (args.command_arguments.size() != 3) - { - System::println(System::color::error, "Error: %s requires 3 parameters", args.command); - print_example(Strings::format(R"(%s C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)", args.command).c_str()); - exit(EXIT_FAILURE); - } - - const fs::path control_file_path(args.command_arguments[0]); - const fs::path include_directory(args.command_arguments[1]); - const fs::path project_directory(args.command_arguments[2]); - - auto pghs = get_paragraphs(control_file_path); - Checks::check_throw(pghs.size() == 1, "Invalid control file for package"); - - StatusParagraph spgh; - spgh.package = BinaryParagraph(pghs[0]); - auto& control_file_data = spgh.package; - - vcpkg::binary_import(paths, include_directory, project_directory, control_file_data); - exit(EXIT_SUCCESS); - } - - void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void print_example(const char* command_and_arguments) { - args.check_max_args(1); - if (args.command_arguments.size() == 0) - { - System::println(System::color::error, "Error: owns requires a pattern to search for as the first argument."); - std::cout << - "example:\n" - " vcpkg owns .dll\n"; - exit(EXIT_FAILURE); - } - StatusParagraphs status_db = database_load_check(paths); - search_file(paths, args.command_arguments[0], status_db); - exit(EXIT_SUCCESS); + System::println(create_example_string(command_and_arguments).c_str()); } void internal_test_command(const vcpkg_cmd_arguments& /*args*/, const vcpkg_paths& /*paths*/) @@ -259,8 +66,6 @@ namespace vcpkg {"install", install_command}, {"remove", remove_command}, {"build", build_command}, - {"edit", edit_command}, - {"create", create_command}, {"build_external", build_external_command} }; return t; @@ -275,6 +80,8 @@ namespace vcpkg {"integrate", integrate_command}, {"owns", owns_command}, {"update", update_command}, + {"edit", edit_command}, + {"create", create_command}, {"import", import_command}, {"cache", cache_command}, {"internal_test", internal_test_command}, diff --git a/toolsrc/src/commands_owns.cpp b/toolsrc/src/commands_owns.cpp new file mode 100644 index 000000000..b3dab2e44 --- /dev/null +++ b/toolsrc/src/commands_owns.cpp @@ -0,0 +1,16 @@ +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" +#include "vcpkg.h" + +namespace vcpkg +{ + void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + static const std::string example = Strings::format("The argument should be a pattern to search for. %s", create_example_string("owns zlib.dll")); + args.check_exact_arg_count(1, example.c_str()); + + StatusParagraphs status_db = database_load_check(paths); + search_file(paths, args.command_arguments[0], status_db); + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index f5315ccb1..5bb9ecc96 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -1,6 +1,7 @@ #include "vcpkg_Commands.h" #include "vcpkg.h" #include "vcpkg_System.h" +#include "vcpkg_Input.h" namespace vcpkg { @@ -22,10 +23,14 @@ namespace vcpkg void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { + static const std::string example = create_example_string("remove zlib zlib:x64-windows curl boost"); + args.check_min_arg_count(1, example.c_str()); + const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_PURGE}); auto status_db = database_load_check(paths); - std::vector<package_spec> specs = args.parse_all_arguments_as_package_specs(default_target_triplet); + std::vector<package_spec> specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example.c_str()); + Input::check_triplets(specs, paths); bool alsoRemoveFolderFromPackages = options.find(OPTION_PURGE) != options.end(); for (const package_spec& spec : specs) diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp new file mode 100644 index 000000000..c90538e86 --- /dev/null +++ b/toolsrc/src/commands_search.cpp @@ -0,0 +1,64 @@ +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" +#include "vcpkg.h" +#include <iostream> +#include <iomanip> + +namespace fs = std::tr2::sys; + +namespace vcpkg +{ + template <class Pred> + static void do_print(const vcpkg_paths& paths, Pred predicate) + { + for (auto it = fs::directory_iterator(paths.ports); it != fs::directory_iterator(); ++it) + { + const fs::path& path = it->path(); + + try + { + auto pghs = get_paragraphs(path / "CONTROL"); + if (pghs.empty()) + continue; + auto srcpgh = SourceParagraph(pghs[0]); + + if (predicate(srcpgh.name)) + { + std::cout << std::left + << std::setw(20) << srcpgh.name << ' ' + << std::setw(16) << srcpgh.version << ' ' + << shorten_description(srcpgh.description) << '\n'; + } + } + catch (std::runtime_error const&) + { + } + } + } + + void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + static const std::string example = Strings::format("The argument should be a substring to search for, or no argument to display all libraries.\n%s", create_example_string("search png")); + args.check_max_arg_count(1, example.c_str()); + + if (args.command_arguments.size() == 0) + { + do_print(paths, [](std::string&) -> bool + { + return true; + }); + exit(EXIT_SUCCESS); + } + + // At this point there is 1 argument + do_print(paths, [&](std::string& port_name) -> bool + { + return Strings::case_insensitive_ascii_find(port_name, args.command_arguments[0]) != port_name.end(); + }); + + System::println("\nIf your library is not listed, please open an issue at:\n" + " https://github.com/Microsoft/vcpkg/issues"); + + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp new file mode 100644 index 000000000..5d531ef39 --- /dev/null +++ b/toolsrc/src/commands_update.cpp @@ -0,0 +1,94 @@ +#include "vcpkg_Commands.h" +#include "vcpkg.h" +#include "vcpkg_System.h" +#include "vcpkg_Files.h" + +namespace vcpkg +{ + void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + args.check_exact_arg_count(0); + System::println("Using local portfile versions. To update the local portfiles, use `git pull`."); + + auto status_db = database_load_check(paths); + + std::unordered_map<std::string, std::string> src_names_to_versions; + + auto begin_it = fs::directory_iterator(paths.ports); + auto end_it = fs::directory_iterator(); + for (; begin_it != end_it; ++begin_it) + { + const auto& path = begin_it->path(); + try + { + auto pghs = get_paragraphs(path / "CONTROL"); + if (pghs.empty()) + continue; + auto srcpgh = SourceParagraph(pghs[0]); + src_names_to_versions.emplace(srcpgh.name, srcpgh.version); + } + catch (std::runtime_error const&) + { + } + } + + std::string packages_list; + + std::vector<std::string> packages_output; + for (auto&& pgh : database_load_check(paths)) + { + if (pgh->state == install_state_t::not_installed && pgh->want == want_t::purge) + continue; + auto it = src_names_to_versions.find(pgh->package.spec.name()); + if (it == src_names_to_versions.end()) + { + // Package was not installed from portfile + continue; + } + if (it->second != pgh->package.version) + { + packages_output.push_back(Strings::format("%-27s %s -> %s", + pgh->package.displayname(), + pgh->package.version, + it->second)); + packages_list.append(" " + pgh->package.displayname()); + } + } + std::sort(packages_output.begin(), packages_output.end()); + if (packages_output.empty()) + { + System::println("No packages need updating."); + } + else + { + System::println("The following packages differ from their port versions:"); + for (auto&& package : packages_output) + { + System::println(" %s", package.c_str()); + } + System::println("\nTo update these packages, run\n vcpkg remove --purge <pkgs>...\n vcpkg install <pkgs>..."); + } + + auto version_file = Files::get_contents(paths.root / "toolsrc" / "VERSION.txt"); + if (auto version_contents = version_file.get()) + { + int maj1, min1, rev1; + auto num1 = sscanf_s(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1); + + int maj2, min2, rev2; + auto num2 = sscanf_s(version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2); + + if (num1 == 3 && num2 == 3) + { + if (maj1 != maj2 || min1 != min2 || rev1 != rev2) + { + System::println("Different source is available for vcpkg (%d.%d.%d -> %d.%d.%d). Use scripts\\bootstrap.ps1 to update.", + maj2, min2, rev2, + maj1, min1, rev1); + } + } + } + + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/lib.cpp b/toolsrc/src/lib.cpp index 2a3b95182..45b73ee07 100644 --- a/toolsrc/src/lib.cpp +++ b/toolsrc/src/lib.cpp @@ -133,26 +133,6 @@ static std::string get_fullpkgname_from_listfile(const fs::path& path) return ret; } -fs::path vcpkg::control_file_for_package(const fs::path& package) -{ - return package / "CONTROL"; -} - -fs::path vcpkg::find_available_package(const vcpkg_paths& paths, const package_spec& spec) -{ - return paths.packages / Strings::format("%s_%s", spec.name, spec.target_triplet); -} - -fs::path vcpkg::find_available_port_file(const vcpkg_paths& paths, const package_spec& spec) -{ - return paths.ports / spec.name; -} - -static fs::path prefix_path_for_package(const vcpkg_paths& paths, const BinaryParagraph& pgh) -{ - return find_available_package(paths, {pgh.name, pgh.target_triplet}); -} - static void write_update(const vcpkg_paths& paths, const StatusParagraph& p) { static int update_id = 0; @@ -169,12 +149,14 @@ static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryPar { std::fstream listfile(listfile_path(paths, bpgh), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc); - auto package_prefix_path = prefix_path_for_package(paths, bpgh); + auto package_prefix_path = paths.package_dir(bpgh.spec); auto prefix_length = package_prefix_path.native().size(); + const triplet& target_triplet = bpgh.spec.target_triplet(); + const std::string& target_triplet_as_string = target_triplet.canonical_name(); std::error_code ec; - fs::create_directory(paths.installed / bpgh.target_triplet.value, ec); - listfile << bpgh.target_triplet << "\n"; + fs::create_directory(paths.installed / target_triplet_as_string, ec); + listfile << target_triplet << "\n"; for (auto it = fs::recursive_directory_iterator(package_prefix_path); it != fs::recursive_directory_iterator(); ++it) { @@ -186,12 +168,12 @@ static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryPar } auto suffix = it->path().generic_u8string().substr(prefix_length + 1); - auto target = paths.installed / bpgh.target_triplet.value / suffix; + auto target = paths.installed / target_triplet_as_string / suffix; auto status = it->status(ec); if (ec) { - System::println(System::color::error, "failed: %s", ec.message()); + System::println(System::color::error, "failed: %s: %s", it->path().u8string(), ec.message()); continue; } if (fs::is_directory(status)) @@ -199,26 +181,26 @@ static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryPar fs::create_directory(target, ec); if (ec) { - System::println(System::color::error, "failed: %s", ec.message()); + System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message()); } - listfile << bpgh.target_triplet << "/" << suffix << "\n"; + listfile << target_triplet << "/" << suffix << "\n"; } else if (fs::is_regular_file(status)) { fs::copy_file(*it, target, ec); if (ec) { - System::println(System::color::error, "failed: %s", ec.message()); + System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message()); } - listfile << bpgh.target_triplet << "/" << suffix << "\n"; + listfile << target_triplet << "/" << suffix << "\n"; } else if (!fs::status_known(status)) { - std::cout << "unknown status: " << *it << "\n"; + System::println(System::color::error, "failed: %s: unknown status", it->path().u8string()); } else - std::cout << "warning: file does not exist: " << *it << "\n"; + System::println(System::color::error, "failed: %s: cannot handle file type", it->path().u8string()); } listfile.close(); @@ -228,35 +210,40 @@ static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryPar std::vector<std::string> vcpkg::get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db) { std::vector<std::unordered_map<std::string, std::string>> pghs; - const fs::path packages_dir_control_file_path = find_available_package(paths, spec) / "CONTROL"; + { + const fs::path packages_dir_control_file_path = paths.package_dir(spec) / "CONTROL"; - if (fs::exists(packages_dir_control_file_path)) + auto control_contents_maybe = Files::get_contents(packages_dir_control_file_path); + if (auto control_contents = control_contents_maybe.get()) + { + try + { + pghs = parse_paragraphs(*control_contents); + } + catch (std::runtime_error) + { + } + Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", packages_dir_control_file_path.string()); + return BinaryParagraph(pghs[0]).depends; + } + } + + const fs::path ports_dir_control_file_path = paths.port_dir(spec) / "CONTROL"; + auto control_contents_maybe = Files::get_contents(ports_dir_control_file_path); + if (auto control_contents = control_contents_maybe.get()) { try { - pghs = get_paragraphs(packages_dir_control_file_path); + pghs = parse_paragraphs(*control_contents); } catch (std::runtime_error) { - // ?? } - - Checks::check_throw(pghs.size() == 1, "Invalid control file for package"); - return BinaryParagraph(pghs[0]).depends; + Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", ports_dir_control_file_path.string()); + return SourceParagraph(pghs[0]).depends; } - const fs::path ports_dir_control_file_path = find_available_port_file(paths, spec) / "CONTROL"; - try - { - pghs = get_paragraphs(ports_dir_control_file_path); - } - catch (std::runtime_error) - { - // ?? - } - - Checks::check_exit(pghs.size() == 1, "Invalid control file for package %s", spec); - return SourceParagraph(pghs[0]).depends; + Checks::exit_with_message("Could not find package named %s", spec); } void vcpkg::install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db) @@ -267,7 +254,7 @@ void vcpkg::install_package(const vcpkg_paths& paths, const BinaryParagraph& bin spgh.state = install_state_t::half_installed; for (const std::string& dependency : spgh.package.depends) { - if (status_db.find_installed(dependency, spgh.package.target_triplet) == status_db.end()) + if (status_db.find_installed(dependency, spgh.package.spec.target_triplet()) == status_db.end()) { std::abort(); } @@ -307,12 +294,12 @@ static deinstall_plan deinstall_package_plan( { if (inst_pkg->want != want_t::install) continue; - if (inst_pkg->package.target_triplet != pkg.target_triplet) + if (inst_pkg->package.spec.target_triplet() != pkg.spec.target_triplet()) continue; const auto& deps = inst_pkg->package.depends; - if (std::find(deps.begin(), deps.end(), pkg.name) != deps.end()) + if (std::find(deps.begin(), deps.end(), pkg.spec.name()) != deps.end()) { dependencies_out.push_back(inst_pkg.get()); } @@ -326,7 +313,7 @@ static deinstall_plan deinstall_package_plan( void vcpkg::deinstall_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs& status_db) { - auto package_it = status_db.find(spec.name, spec.target_triplet); + auto package_it = status_db.find(spec.name(), spec.target_triplet()); if (package_it == status_db.end()) { System::println(System::color::success, "Package %s is not installed", spec); @@ -389,16 +376,16 @@ void vcpkg::deinstall_package(const vcpkg_paths& paths, const package_spec& spec fs::remove(target, ec); if (ec) { - System::println(System::color::error, "failed: %s", ec.message()); + System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message()); } } else if (!fs::status_known(status)) { - System::println(System::color::warning, "Warning: unknown status: %s", target.string()); + System::println(System::color::warning, "Warning: unknown status: %s", target.u8string()); } else { - System::println(System::color::warning, "Warning: ???: %s", target.string()); + System::println(System::color::warning, "Warning: %s: cannot handle file type", target.u8string()); } } @@ -515,7 +502,7 @@ namespace void vcpkg::binary_import(const vcpkg_paths& paths, const fs::path& include_directory, const fs::path& project_directory, const BinaryParagraph& control_file_data) { - fs::path library_destination_path = prefix_path_for_package(paths, control_file_data); + fs::path library_destination_path = paths.package_dir(control_file_data.spec); fs::create_directory(library_destination_path); place_library_files_in(include_directory, project_directory, library_destination_path); diff --git a/toolsrc/src/main.cpp b/toolsrc/src/main.cpp index d3fb855d1..f3d68f5dd 100644 --- a/toolsrc/src/main.cpp +++ b/toolsrc/src/main.cpp @@ -11,6 +11,7 @@ #include <Shlobj.h> #include "vcpkg_Files.h" #include "vcpkg_System.h" +#include "vcpkg_Input.h" using namespace vcpkg; @@ -23,21 +24,6 @@ void invalid_command(const std::string& cmd) exit(EXIT_FAILURE); } -static fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename) -{ - fs::path current_dir = starting_dir; - for (; !current_dir.empty(); current_dir = current_dir.parent_path()) - { - const fs::path candidate = current_dir / filename; - if (fs::exists(candidate)) - { - break; - } - } - - return current_dir; -} - static void inner(const vcpkg_cmd_arguments& args) { TrackProperty("command", args.command); @@ -67,7 +53,7 @@ static void inner(const vcpkg_cmd_arguments& args) } else { - vcpkg_root_dir = find_file_recursively_up(fs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root"); + vcpkg_root_dir = Files::find_file_recursively_up(fs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root"); } } @@ -84,32 +70,26 @@ static void inner(const vcpkg_cmd_arguments& args) return command_function(args, paths); } - triplet default_target_triplet = triplet::X86_WINDOWS; - + triplet default_target_triplet; if (args.target_triplet != nullptr) { - const std::string& target_triplet = *args.target_triplet; - - auto it = fs::directory_iterator(paths.triplets); - for (; it != fs::directory_iterator(); ++it) + default_target_triplet = triplet::from_canonical_name(*args.target_triplet); + } + else + { + const auto vcpkg_default_triplet_env = System::wdupenv_str(L"VCPKG_DEFAULT_TRIPLET"); + if (!vcpkg_default_triplet_env.empty()) { - std::string triplet_file_name = it->path().stem().generic_u8string(); - if (target_triplet == triplet_file_name) // TODO: fuzzy compare - { - default_target_triplet = {triplet_file_name}; - break; - } + default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(vcpkg_default_triplet_env)); } - - if (it == fs::directory_iterator()) + else { - System::println(System::color::error, "Error: invalid triplet: %s", target_triplet); - TrackProperty("error", "invalid triplet: " + target_triplet); - help_topic_valid_triplet(paths); - exit(EXIT_FAILURE); + default_target_triplet = triplet::X86_WINDOWS; } } + Input::check_triplet(default_target_triplet, paths); + if (auto command_function = find_command(args.command, get_available_commands_type_a())) { return command_function(args, paths, default_target_triplet); diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/metrics.cpp index 610c71ed1..ada065fd6 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/metrics.cpp @@ -419,7 +419,7 @@ true const fs::path vcpkg_metrics_txt_path = temp_folder_path / ("vcpkg" + GenerateRandomUUID() + ".txt"); std::ofstream(vcpkg_metrics_txt_path) << payload; - const std::wstring cmdLine = Strings::format(L"start %s %s", temp_folder_path_exe.native(), vcpkg_metrics_txt_path.native()); + const std::wstring cmdLine = Strings::wformat(L"start %s %s", temp_folder_path_exe.native(), vcpkg_metrics_txt_path.native()); System::cmd_execute(cmdLine); } } diff --git a/toolsrc/src/package_spec.cpp b/toolsrc/src/package_spec.cpp index ece5f91e9..86d4393bd 100644 --- a/toolsrc/src/package_spec.cpp +++ b/toolsrc/src/package_spec.cpp @@ -1,32 +1,63 @@ #include "package_spec.h" +#include <algorithm> namespace vcpkg { - expected<package_spec> parse(const std::string& spec, const triplet& default_target_triplet) + static bool is_valid_package_spec_char(char c) { - auto pos = spec.find(':'); + return (c == '-') || isdigit(c) || (isalpha(c) && islower(c)); + } + + expected<package_spec> package_spec::from_string(const std::string& spec_as_string, const triplet& default_target_triplet) + { + auto pos = spec_as_string.find(':'); if (pos == std::string::npos) { - return package_spec{spec, default_target_triplet}; + return from_name_and_triplet(spec_as_string, default_target_triplet); } - auto pos2 = spec.find(':', pos + 1); + auto pos2 = spec_as_string.find(':', pos + 1); if (pos2 != std::string::npos) { - return std::error_code(package_spec_parse_result::too_many_colons); + return std::error_code(package_spec_parse_result::TOO_MANY_COLONS); } - return package_spec{spec.substr(0, pos), spec.substr(pos + 1)}; + const std::string name = spec_as_string.substr(0, pos); + const triplet target_triplet = triplet::from_canonical_name(spec_as_string.substr(pos + 1)); + return from_name_and_triplet(name, target_triplet); + } + + expected<package_spec> package_spec::from_name_and_triplet(const std::string& name, const triplet& target_triplet) + { + if (std::find_if_not(name.cbegin(), name.cend(), is_valid_package_spec_char) != name.end()) + { + return std::error_code(package_spec_parse_result::INVALID_CHARACTERS); + } + + package_spec p; + p.m_name = name; + p.m_target_triplet = target_triplet; + return p; + } + + const std::string& package_spec::name() const + { + return this->m_name; + } + + const triplet& package_spec::target_triplet() const + { + return this->m_target_triplet; } std::string package_spec::dir() const { - return Strings::format("%s_%s", this->name, this->target_triplet); + return Strings::format("%s_%s", this->m_name, this->m_target_triplet); } std::string to_string(const package_spec& spec) { - return Strings::format("%s:%s", spec.name, spec.target_triplet); + return Strings::format("%s:%s", spec.name(), spec.target_triplet()); } std::string to_printf_arg(const package_spec& spec) @@ -36,7 +67,7 @@ namespace vcpkg bool operator==(const package_spec& left, const package_spec& right) { - return left.name == right.name && left.target_triplet == right.target_triplet; + return left.name() == right.name() && left.target_triplet() == right.target_triplet(); } std::ostream& operator<<(std::ostream& os, const package_spec& spec) diff --git a/toolsrc/src/package_spec_parse_result.cpp b/toolsrc/src/package_spec_parse_result.cpp index 757b6df53..dc377f656 100644 --- a/toolsrc/src/package_spec_parse_result.cpp +++ b/toolsrc/src/package_spec_parse_result.cpp @@ -13,10 +13,12 @@ namespace vcpkg { switch (static_cast<package_spec_parse_result>(ev)) { - case package_spec_parse_result::success: + case package_spec_parse_result::SUCCESS: return "OK"; - case package_spec_parse_result::too_many_colons: + case package_spec_parse_result::TOO_MANY_COLONS: return "Too many colons"; + case package_spec_parse_result::INVALID_CHARACTERS: + return "Contains invalid characters. Only alphanumeric lowercase ASCII characters and dashes are allowed"; default: Checks::unreachable(); } diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp index 1d4ca0f67..2b2812d73 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/post_build_lint.cpp @@ -71,12 +71,10 @@ namespace vcpkg System::println(System::color::warning, "Include files should not be duplicated into the /debug/include directory. If this cannot be disabled in the project cmake, use\n" " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)" ); - return - lint_status::ERROR; + return lint_status::ERROR; } - return - lint_status::SUCCESS; + return lint_status::SUCCESS; } static lint_status check_for_files_in_debug_share_directory(const package_spec& spec, const vcpkg_paths& paths) @@ -115,7 +113,7 @@ namespace vcpkg if (!misplaced_cmake_files.empty()) { - System::println(System::color::warning, "The following cmake files were found outside /share/%s. Please place cmake files in /share/%s.", spec.name, spec.name); + System::println(System::color::warning, "The following cmake files were found outside /share/%s. Please place cmake files in /share/%s.", spec.name(), spec.name()); print_vector_of_files(misplaced_cmake_files); return lint_status::ERROR; } @@ -153,12 +151,12 @@ namespace vcpkg static lint_status check_for_copyright_file(const package_spec& spec, const vcpkg_paths& paths) { - const fs::path copyright_file = paths.packages / spec.dir() / "share" / spec.name / "copyright"; + const fs::path copyright_file = paths.packages / spec.dir() / "share" / spec.name() / "copyright"; if (fs::exists(copyright_file)) { return lint_status::SUCCESS; } - const fs::path current_buildtrees_dir = paths.buildtrees / spec.name; + const fs::path current_buildtrees_dir = paths.buildtrees / spec.name(); const fs::path current_buildtrees_dir_src = current_buildtrees_dir / "src"; std::vector<fs::path> potential_copyright_files; @@ -177,14 +175,14 @@ namespace vcpkg } } - System::println(System::color::warning, "The software license must be available at ${CURRENT_PACKAGES_DIR}/share/%s/copyright .", spec.name); + System::println(System::color::warning, "The software license must be available at ${CURRENT_PACKAGES_DIR}/share/%s/copyright .", spec.name()); if (potential_copyright_files.size() == 1) // if there is only one candidate, provide the cmake lines needed to place it in the proper location { const fs::path found_file = potential_copyright_files[0]; const fs::path relative_path = found_file.string().erase(0, current_buildtrees_dir.string().size() + 1); // The +1 is needed to remove the "/" System::println("\n file(COPY ${CURRENT_BUILDTREES_DIR}/%s DESTINATION ${CURRENT_PACKAGES_DIR}/share/%s)\n" " file(RENAME ${CURRENT_PACKAGES_DIR}/share/%s/%s ${CURRENT_PACKAGES_DIR}/share/%s/copyright)", - relative_path.generic_string(), spec.name, spec.name, found_file.filename().generic_string(), spec.name); + relative_path.generic_string(), spec.name(), spec.name(), found_file.filename().generic_string(), spec.name()); return lint_status::ERROR; } @@ -195,7 +193,7 @@ namespace vcpkg } const fs::path current_packages_dir = paths.packages / spec.dir(); - System::println(" %s/share/%s/copyright", current_packages_dir.generic_string(), spec.name); + System::println(" %s/share/%s/copyright", current_packages_dir.generic_string(), spec.name()); return lint_status::ERROR; } @@ -221,7 +219,7 @@ namespace vcpkg std::vector<fs::path> dlls_with_no_exports; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::format(LR"("%s" /exports "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /exports "%s")", DUMPBIN_EXE.native(), dll.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -252,7 +250,7 @@ namespace vcpkg std::vector<fs::path> dlls_with_improper_uwp_bit; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::format(LR"("%s" /headers "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s")", DUMPBIN_EXE.native(), dll.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -284,11 +282,11 @@ namespace vcpkg std::vector<file_and_arch> binaries_with_invalid_architecture; for (const fs::path& f : files) { - const std::wstring cmd_line = Strings::format(LR"("%s" /headers "%s" | findstr machine)", DUMPBIN_EXE.native(), f.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s" | findstr machine)", DUMPBIN_EXE.native(), f.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); - if (Strings::case_insensitive_find(ec_data.output, expected_architecture) == ec_data.output.end()) + if (Strings::case_insensitive_ascii_find(ec_data.output, expected_architecture) == ec_data.output.end()) { binaries_with_invalid_architecture.push_back({f, ec_data.output}); } @@ -311,15 +309,27 @@ namespace vcpkg return lint_status::SUCCESS; } - static void operator +=(unsigned int& left, const lint_status& right) + static lint_status check_no_dlls_present(const std::vector<fs::path>& dlls) + { + if (dlls.empty()) + { + return lint_status::SUCCESS; + } + + System::println(System::color::warning, "DLLs should not be present in a static build, but the following DLLs were found:"); + print_vector_of_files(dlls); + return lint_status::ERROR; + } + + static void operator +=(size_t& left, const lint_status& right) { - left += static_cast<unsigned int>(right); + left += static_cast<size_t>(right); } void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) { System::println("-- Performing post-build validation"); - unsigned int error_count = 0; + size_t error_count = 0; error_count += check_for_files_in_include_directory(spec, paths); error_count += check_for_files_in_debug_include_directory(spec, paths); error_count += check_for_files_in_debug_share_directory(spec, paths); @@ -330,24 +340,42 @@ namespace vcpkg error_count += check_for_copyright_file(spec, paths); error_count += check_for_exes(spec, paths); - std::vector<fs::path> dlls; - recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "bin", ".dll", dlls); - recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "bin", ".dll", dlls); - - error_count += check_exports_of_dlls(dlls); - error_count += check_uwp_bit_of_dlls(spec.target_triplet.system(), dlls); - error_count += check_architecture(spec.target_triplet.architecture(), dlls); + triplet::BuildType build_type = spec.target_triplet().build_type(); + switch (build_type) + { + case triplet::BuildType::DYNAMIC: + { + std::vector<fs::path> dlls; + recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "bin", ".dll", dlls); + recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "bin", ".dll", dlls); + + error_count += check_exports_of_dlls(dlls); + error_count += check_uwp_bit_of_dlls(spec.target_triplet().system(), dlls); + error_count += check_architecture(spec.target_triplet().architecture(), dlls); + break; + } + case triplet::BuildType::STATIC: + { + std::vector<fs::path> dlls; + recursive_find_files_with_extension_in_dir(paths.packages / spec.dir(), ".dll", dlls); + error_count += check_no_dlls_present(dlls); + break; + } + + default: + Checks::unreachable(); + } std::vector<fs::path> libs; recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "lib", ".lib", libs); recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "lib", ".lib", libs); - error_count += check_architecture(spec.target_triplet.architecture(), libs); + error_count += check_architecture(spec.target_triplet().architecture(), libs); if (error_count != 0) { - const fs::path portfile = paths.ports / spec.name / "portfile.cmake"; - System::println(System::color::error, "Found %d error(s). Please correct the portfile:\n %s", error_count, portfile.string()); + const fs::path portfile = paths.ports / spec.name() / "portfile.cmake"; + System::println(System::color::error, "Found %u error(s). Please correct the portfile:\n %s", error_count, portfile.string()); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/test.cpp b/toolsrc/src/test.cpp index 82113abaa..fc49b362d 100644 --- a/toolsrc/src/test.cpp +++ b/toolsrc/src/test.cpp @@ -87,11 +87,11 @@ namespace UnitTest1 {"Multi-Arch", "same"}, }); - Assert::AreEqual("zlib", pgh.name.c_str()); + Assert::AreEqual("zlib", pgh.spec.name().c_str()); Assert::AreEqual("1.2.8", pgh.version.c_str()); Assert::AreEqual("", pgh.maintainer.c_str()); Assert::AreEqual("", pgh.description.c_str()); - Assert::AreEqual("a", pgh.target_triplet.value.c_str()); + Assert::AreEqual("a", pgh.spec.target_triplet().canonical_name().c_str()); Assert::AreEqual(size_t(0), pgh.depends.size()); } @@ -106,7 +106,7 @@ namespace UnitTest1 {"Description", "d"}, {"Depends", "bd"} }); - Assert::AreEqual("s", pgh.name.c_str()); + Assert::AreEqual("s", pgh.spec.name().c_str()); Assert::AreEqual("v", pgh.version.c_str()); Assert::AreEqual("m", pgh.maintainer.c_str()); Assert::AreEqual("d", pgh.description.c_str()); @@ -308,24 +308,24 @@ namespace UnitTest1 TEST_METHOD(package_spec_parse) { - vcpkg::expected<vcpkg::package_spec> spec = vcpkg::parse("zlib", vcpkg::triplet::X86_WINDOWS); - Assert::AreEqual(vcpkg::package_spec_parse_result::success, vcpkg::to_package_spec_parse_result(spec.error_code())); - Assert::AreEqual("zlib", spec.get()->name.c_str()); - Assert::AreEqual(vcpkg::triplet::X86_WINDOWS.value, spec.get()->target_triplet.value); + vcpkg::expected<vcpkg::package_spec> spec = vcpkg::package_spec::from_string("zlib", vcpkg::triplet::X86_WINDOWS); + Assert::AreEqual(vcpkg::package_spec_parse_result::SUCCESS, vcpkg::to_package_spec_parse_result(spec.error_code())); + Assert::AreEqual("zlib", spec.get()->name().c_str()); + Assert::AreEqual(vcpkg::triplet::X86_WINDOWS.canonical_name(), spec.get()->target_triplet().canonical_name()); } TEST_METHOD(package_spec_parse_with_arch) { - vcpkg::expected<vcpkg::package_spec> spec = vcpkg::parse("zlib:x64-uwp", vcpkg::triplet::X86_WINDOWS); - Assert::AreEqual(vcpkg::package_spec_parse_result::success, vcpkg::to_package_spec_parse_result(spec.error_code())); - Assert::AreEqual("zlib", spec.get()->name.c_str()); - Assert::AreEqual(vcpkg::triplet::X64_UWP.value, spec.get()->target_triplet.value); + vcpkg::expected<vcpkg::package_spec> spec = vcpkg::package_spec::from_string("zlib:x64-uwp", vcpkg::triplet::X86_WINDOWS); + Assert::AreEqual(vcpkg::package_spec_parse_result::SUCCESS, vcpkg::to_package_spec_parse_result(spec.error_code())); + Assert::AreEqual("zlib", spec.get()->name().c_str()); + Assert::AreEqual(vcpkg::triplet::X64_UWP.canonical_name(), spec.get()->target_triplet().canonical_name()); } TEST_METHOD(package_spec_parse_with_multiple_colon) { - auto ec = vcpkg::parse("zlib:x86-uwp:", vcpkg::triplet::X86_WINDOWS).error_code(); - Assert::AreEqual(vcpkg::package_spec_parse_result::too_many_colons, vcpkg::to_package_spec_parse_result(ec)); + auto ec = vcpkg::package_spec::from_string("zlib:x86-uwp:", vcpkg::triplet::X86_WINDOWS).error_code(); + Assert::AreEqual(vcpkg::package_spec_parse_result::TOO_MANY_COLONS, vcpkg::to_package_spec_parse_result(ec)); } TEST_METHOD(utf8_to_utf16) diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp index 9ad3d8847..af2ca2a72 100644 --- a/toolsrc/src/triplet.cpp +++ b/toolsrc/src/triplet.cpp @@ -1,18 +1,18 @@ #include "triplet.h" -#include "vcpkg_System.h" #include "vcpkg_Checks.h" +#include <algorithm> namespace vcpkg { - const triplet triplet::X86_WINDOWS = {"x86-windows"}; - const triplet triplet::X64_WINDOWS = {"x64-windows"}; - const triplet triplet::X86_UWP = {"x86-uwp"}; - const triplet triplet::X64_UWP = {"x64-uwp"}; - const triplet triplet::ARM_UWP = {"arm-uwp"}; + const triplet triplet::X86_WINDOWS = from_canonical_name("x86-windows"); + const triplet triplet::X64_WINDOWS = from_canonical_name("x64-windows"); + const triplet triplet::X86_UWP = from_canonical_name("x86-uwp"); + const triplet triplet::X64_UWP = from_canonical_name("x64-uwp"); + const triplet triplet::ARM_UWP = from_canonical_name("arm-uwp"); std::string to_string(const triplet& t) { - return t.value; + return t.canonical_name(); } std::string to_printf_arg(const triplet& t) @@ -22,7 +22,7 @@ namespace vcpkg bool operator==(const triplet& left, const triplet& right) { - return left.value == right.value; + return left.canonical_name() == right.canonical_name(); } bool operator!=(const triplet& left, const triplet& right) @@ -35,25 +35,43 @@ namespace vcpkg return os << to_string(t); } - std::string triplet::architecture() const + triplet triplet::from_canonical_name(const std::string& triplet_as_string) + { + std::string s(triplet_as_string); + std::transform(s.begin(), s.end(), s.begin(), ::tolower); + + auto it = std::find(s.cbegin(), s.cend(), '-'); + Checks::check_exit(it != s.cend(), "Invalid triplet: %s", triplet_as_string); + + triplet t; + t.m_canonical_name = s; + return t; + } + + const std::string& triplet::canonical_name() const { - if (*this == X86_WINDOWS || *this == X86_UWP) - return "x86"; - if (*this == X64_WINDOWS || *this == X64_UWP) - return "x64"; - if (*this == ARM_UWP) - return "arm"; + return this->m_canonical_name; + } - Checks::exit_with_message("Unknown architecture: %s", value); + std::string triplet::architecture() const + { + auto it = std::find(this->m_canonical_name.cbegin(), this->m_canonical_name.cend(), '-'); + return std::string(this->m_canonical_name.cbegin(), it); } std::string triplet::system() const { - if (*this == X86_WINDOWS || *this == X64_WINDOWS) - return "windows"; - if (*this == X86_UWP || *this == X64_UWP || *this == ARM_UWP) - return "uwp"; + auto it = std::find(this->m_canonical_name.cbegin(), this->m_canonical_name.cend(), '-'); + return std::string(it + 1, this->m_canonical_name.cend()); + } + + triplet::BuildType triplet::build_type() const + { + if (this->m_canonical_name.find("static") != std::string::npos) + { + return BuildType::STATIC; + } - Checks::exit_with_message("Unknown system: %s", value); + return BuildType::DYNAMIC; } } diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp index d5433b1f5..db6c03480 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg_Checks.cpp @@ -34,8 +34,7 @@ namespace vcpkg {namespace Checks { if (!expression) { - System::println(System::color::error, errorMessage); - exit(EXIT_FAILURE); + exit_with_message(errorMessage); } } }} diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp new file mode 100644 index 000000000..54b37cd11 --- /dev/null +++ b/toolsrc/src/vcpkg_Dependencies.cpp @@ -0,0 +1,67 @@ +#include "vcpkg_Dependencies.h" +#include <vector> +#include "vcpkg_Graphs.h" +#include "vcpkg_paths.h" +#include "package_spec.h" +#include "StatusParagraphs.h" +#include <unordered_set> +#include "vcpkg.h" +#include "vcpkg_Maps.h" +#include "vcpkg_Sets.h" + +namespace vcpkg { namespace Dependencies +{ + static Graphs::Graph<package_spec> build_dependency_graph(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db) + { + std::vector<package_spec> examine_stack(specs); + std::unordered_set<package_spec> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies + Graphs::Graph<package_spec> graph; + graph.add_vertices(examine_stack); + + while (!examine_stack.empty()) + { + const package_spec spec = examine_stack.back(); + examine_stack.pop_back(); + + if (was_examined.find(spec) != was_examined.end()) + { + continue; + } + + std::vector<std::string> dependencies_as_string = get_unmet_package_dependencies(paths, spec, status_db); + + for (const std::string& dep_as_string : dependencies_as_string) + { + const package_spec current_dep = package_spec::from_name_and_triplet(dep_as_string, spec.target_triplet()).get_or_throw(); + auto it = status_db.find(current_dep.name(), current_dep.target_triplet()); + if (it != status_db.end() && (*it)->want == want_t::install) + { + continue; + } + + graph.add_edge(spec, current_dep); + if (was_examined.find(current_dep) == was_examined.end()) + { + examine_stack.push_back(std::move(current_dep)); + } + } + + was_examined.insert(spec); + } + + return graph; + } + + std::vector<package_spec> create_dependency_ordered_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db) + { + return build_dependency_graph(paths, specs, status_db).find_topological_sort(); + } + + std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db) + { + const Graphs::Graph<package_spec> dependency_graph = build_dependency_graph(paths, {spec}, status_db); + std::unordered_set<package_spec> key_set = Maps::extract_key_set(dependency_graph.adjacency_list()); + key_set.erase(spec); + return key_set; + } +}} diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index f70f2b893..d98b0f220 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -48,11 +48,11 @@ namespace vcpkg {namespace Environment void ensure_git_on_path(const vcpkg_paths& paths) { const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; - const std::wstring path_buf = Strings::format(L"%s;%s;%s;%s", - downloaded_git.native(), - System::wdupenv_str(L"PATH"), - default_git_installation_dir.native(), - default_git_installation_dir_x86.native()); + const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", + downloaded_git.native(), + System::wdupenv_str(L"PATH"), + default_git_installation_dir.native(), + default_git_installation_dir_x86.native()); _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array<int, 3> git_version = {2,0,0}; @@ -63,11 +63,11 @@ namespace vcpkg {namespace Environment void ensure_cmake_on_path(const vcpkg_paths& paths) { const fs::path downloaded_cmake = paths.downloads / "cmake-3.5.2-win32-x86" / "bin"; - const std::wstring path_buf = Strings::format(L"%s;%s;%s;%s", - downloaded_cmake.native(), - System::wdupenv_str(L"PATH"), - default_cmake_installation_dir.native(), - default_cmake_installation_dir_x86.native()); + const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", + downloaded_cmake.native(), + System::wdupenv_str(L"PATH"), + default_cmake_installation_dir.native(), + default_cmake_installation_dir_x86.native()); _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array<int, 3> cmake_version = {3,5,0}; @@ -77,7 +77,7 @@ namespace vcpkg {namespace Environment void ensure_nuget_on_path(const vcpkg_paths& paths) { - const std::wstring path_buf = Strings::format(L"%s;%s", paths.downloads.native(), System::wdupenv_str(L"PATH")); + const std::wstring path_buf = Strings::wformat(L"%s;%s", paths.downloads.native(), System::wdupenv_str(L"PATH")); _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array<int, 3> nuget_version = {1,0,0}; diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index 49a661157..611aa7450 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -1,16 +1,24 @@ #include "vcpkg_Files.h" #include <fstream> #include <filesystem> +#include <regex> namespace fs = std::tr2::sys; namespace vcpkg {namespace Files { + static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); + void check_is_directory(const fs::path& dirpath) { Checks::check_throw(fs::is_directory(dirpath), "The path %s is not a directory", dirpath.string()); } + bool has_invalid_chars_for_filesystem(const std::string s) + { + return std::regex_search(s, FILESYSTEM_INVALID_CHARACTERS_REGEX); + } + expected<std::string> get_contents(const fs::path& file_path) noexcept { std::fstream file_stream(file_path, std::ios_base::in | std::ios_base::binary); @@ -35,4 +43,19 @@ namespace vcpkg {namespace Files return std::move(output); } + + fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename) + { + fs::path current_dir = starting_dir; + for (; !current_dir.empty(); current_dir = current_dir.parent_path()) + { + const fs::path candidate = current_dir / filename; + if (fs::exists(candidate)) + { + break; + } + } + + return current_dir; + } }} diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg_Input.cpp new file mode 100644 index 000000000..f7aae1929 --- /dev/null +++ b/toolsrc/src/vcpkg_Input.cpp @@ -0,0 +1,52 @@ +#include "vcpkg_Input.h" +#include "vcpkg_System.h" +#include "metrics.h" +#include "vcpkg_Commands.h" + +namespace vcpkg {namespace Input +{ + package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const char* example_text) + { + const std::string as_lowercase = Strings::ascii_to_lowercase(package_spec_as_string); + expected<package_spec> expected_spec = package_spec::from_string(as_lowercase, default_target_triplet); + if (auto spec = expected_spec.get()) + { + return *spec; + } + + // Intentionally show the lowercased string + System::println(System::color::error, "Error: %s: %s", expected_spec.error_code().message(), as_lowercase); + System::print(example_text); + exit(EXIT_FAILURE); + } + + std::vector<package_spec> check_and_get_package_specs(const std::vector<std::string>& package_specs_as_strings, const triplet& default_target_triplet, const char* example_text) + { + std::vector<package_spec> specs; + for (const std::string& spec : package_specs_as_strings) + { + specs.push_back(check_and_get_package_spec(spec, default_target_triplet, example_text)); + } + + return specs; + } + + void check_triplet(const triplet& t, const vcpkg_paths& paths) + { + if (!paths.is_valid_triplet(t)) + { + System::println(System::color::error, "Error: invalid triplet: %s", t.canonical_name()); + TrackProperty("error", "invalid triplet: " + t.canonical_name()); + help_topic_valid_triplet(paths); + exit(EXIT_FAILURE); + } + } + + void check_triplets(std::vector<package_spec> triplets, const vcpkg_paths& paths) + { + for (const package_spec& spec : triplets) + { + check_triplet(spec.target_triplet(), paths); + } + } +}} diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index b0312536a..56eeae7a0 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -20,7 +20,7 @@ namespace vcpkg {namespace Strings {namespace details return output; } - std::wstring format_internal(const wchar_t* fmtstr, ...) + std::wstring wformat_internal(const wchar_t* fmtstr, ...) { va_list lst; va_start(lst, fmtstr); @@ -48,13 +48,20 @@ namespace vcpkg {namespace Strings return conversion.to_bytes(w); } - std::string::const_iterator case_insensitive_find(const std::string& s, const std::string& pattern) + std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern) { - std::string patter_as_lower_case; - std::transform(pattern.begin(), pattern.end(), back_inserter(patter_as_lower_case), tolower); - return search(s.begin(), s.end(), patter_as_lower_case.begin(), patter_as_lower_case.end(), [](const char a, const char b) + std::string pattern_as_lower_case; + std::transform(pattern.begin(), pattern.end(), back_inserter(pattern_as_lower_case), tolower); + return search(s.begin(), s.end(), pattern_as_lower_case.begin(), pattern_as_lower_case.end(), [](const char a, const char b) { - return (tolower(a) == b); + return tolower(a) == b; }); } + + std::string ascii_to_lowercase(const std::string& input) + { + std::string output = input; + std::transform(output.begin(), output.end(), output.begin(), ::tolower); + return output; + } }} diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 71b4087d2..4dc37857d 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -19,14 +19,14 @@ namespace vcpkg {namespace System int cmd_execute(const wchar_t* cmd_line) { // Basically we are wrapping it in quotes - const std::wstring& actual_cmd_line = Strings::format(LR"###("%s")###", cmd_line); + const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); int exit_code = _wsystem(actual_cmd_line.c_str()); return exit_code; } exit_code_and_output cmd_execute_and_capture_output(const wchar_t* cmd_line) { - const std::wstring& actual_cmd_line = Strings::format(LR"###("%s")###", cmd_line); + const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); std::string output; char buf[1024]; diff --git a/toolsrc/src/vcpkg_cmd_arguments.cpp b/toolsrc/src/vcpkg_cmd_arguments.cpp index 4cfc12716..a286ba9b7 100644 --- a/toolsrc/src/vcpkg_cmd_arguments.cpp +++ b/toolsrc/src/vcpkg_cmd_arguments.cpp @@ -166,90 +166,51 @@ namespace vcpkg return output; } - void vcpkg_cmd_arguments::check_max_args(size_t arg_count, const char* example_text) const + void vcpkg_cmd_arguments::check_max_arg_count(const size_t expected_arg_count) const { - if (command_arguments.size() > arg_count) - { - System::println(System::color::error, "Error: too many arguments to command %s", command); - if (example_text != nullptr) - print_example(example_text); - else - print_usage(); - exit(EXIT_FAILURE); - } + return check_max_arg_count(expected_arg_count, ""); } - std::vector<package_spec> vcpkg_cmd_arguments::extract_package_specs_with_unmet_dependencies(const vcpkg_paths& paths, const triplet& default_target_triplet, const StatusParagraphs& status_db) const + void vcpkg_cmd_arguments::check_min_arg_count(const size_t expected_arg_count) const { - std::vector<package_spec> specs = parse_all_arguments_as_package_specs(default_target_triplet); - std::unordered_set<package_spec> had_its_immediate_dependencies_added; - Graphs::Graph<package_spec> graph; - graph.add_vertices(specs); - - while (!specs.empty()) - { - package_spec spec = specs.back(); - specs.pop_back(); - - if (had_its_immediate_dependencies_added.find(spec) != had_its_immediate_dependencies_added.end()) - { - continue; - } - - std::vector<std::string> dependencies_as_string = get_unmet_package_dependencies(paths, spec, status_db); - - for (const std::string& dep_as_string : dependencies_as_string) - { - package_spec current_dep = {dep_as_string, spec.target_triplet}; - auto it = status_db.find(current_dep.name, current_dep.target_triplet); - if (it != status_db.end() && (*it)->want == want_t::install) - { - continue; - } + return check_min_arg_count(expected_arg_count, ""); + } - graph.add_edge(spec, current_dep); - if (had_its_immediate_dependencies_added.find(current_dep) == had_its_immediate_dependencies_added.end()) - { - specs.push_back(std::move(current_dep)); - } - } + void vcpkg_cmd_arguments::check_exact_arg_count(const size_t expected_arg_count) const + { + return check_exact_arg_count(expected_arg_count, ""); + } - had_its_immediate_dependencies_added.insert(spec); + void vcpkg_cmd_arguments::check_max_arg_count(const size_t expected_arg_count, const char* example_text) const + { + const size_t actual_arg_count = command_arguments.size(); + if (actual_arg_count > expected_arg_count) + { + System::println(System::color::error, "Error: `%s` requires at most %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count); + System::print(example_text); + exit(EXIT_FAILURE); } - - return graph.find_topological_sort(); } - std::vector<package_spec> vcpkg_cmd_arguments::parse_all_arguments_as_package_specs(const triplet& default_target_triplet, const char* example_text) const + void vcpkg_cmd_arguments::check_min_arg_count(const size_t expected_arg_count, const char* example_text) const { - size_t arg_count = command_arguments.size(); - if (arg_count < 1) + const size_t actual_arg_count = command_arguments.size(); + if (actual_arg_count < expected_arg_count) { - System::println(System::color::error, "Error: %s requires one or more package specifiers", this->command); - if (example_text == nullptr) - print_example(Strings::format("%s zlib zlib:x64-windows curl boost", this->command).c_str()); - else - print_example(example_text); + System::println(System::color::error, "Error: `%s` requires at least %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count); + System::print(example_text); exit(EXIT_FAILURE); } - std::vector<package_spec> specs; - specs.reserve(arg_count); + } - for (const std::string& command_argument : command_arguments) + void vcpkg_cmd_arguments::check_exact_arg_count(const size_t expected_arg_count, const char* example_text) const + { + const size_t actual_arg_count = command_arguments.size(); + if (actual_arg_count != expected_arg_count) { - expected<package_spec> current_spec = vcpkg::parse(command_argument, default_target_triplet); - if (auto spec = current_spec.get()) - { - specs.push_back(std::move(*spec)); - } - else - { - System::println(System::color::error, "Error: %s: %s", current_spec.error_code().message(), command_argument); - print_example(Strings::format("%s zlib:x64-windows", this->command).c_str()); - exit(EXIT_FAILURE); - } + System::println(System::color::error, "Error: `%s` requires %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count); + System::print(example_text); + exit(EXIT_FAILURE); } - - return specs; } } diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp index 10b6d992a..1f9eb0bc5 100644 --- a/toolsrc/src/vcpkg_paths.cpp +++ b/toolsrc/src/vcpkg_paths.cpp @@ -3,8 +3,7 @@ #include "vcpkg_paths.h" #include "metrics.h" #include "vcpkg_System.h" - -namespace fs = std::tr2::sys; +#include "package_spec.h" namespace vcpkg { @@ -45,4 +44,29 @@ namespace vcpkg paths.ports_cmake = paths.root / "scripts" / "ports.cmake"; return paths; } + + fs::path vcpkg_paths::package_dir(const package_spec& spec) const + { + return this->packages / spec.dir(); + } + + fs::path vcpkg_paths::port_dir(const package_spec& spec) const + { + return this->ports / spec.name(); + } + + bool vcpkg_paths::is_valid_triplet(const triplet& t) const + { + auto it = fs::directory_iterator(this->triplets); + for (; it != fs::directory_iterator(); ++it) + { + std::string triplet_file_name = it->path().stem().generic_u8string(); + if (t.canonical_name() == triplet_file_name) // TODO: fuzzy compare + { + //t.value = triplet_file_name; // NOTE: uncomment when implementing fuzzy compare + return true; + } + } + return false; + } } diff --git a/toolsrc/src/vcpkglib_helpers.cpp b/toolsrc/src/vcpkglib_helpers.cpp index e947dc647..3aa3735b0 100644 --- a/toolsrc/src/vcpkglib_helpers.cpp +++ b/toolsrc/src/vcpkglib_helpers.cpp @@ -4,29 +4,28 @@ namespace vcpkg {namespace details { - void optional_field(const std::unordered_map<std::string, std::string>& fields, std::string& out, const std::string& fieldname) + std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname) { auto it = fields.find(fieldname); if (it == fields.end()) { - out.clear(); + return std::string(); } - else - { - out = it->second; - } + return it->second; }; - void required_field(const std::unordered_map<std::string, std::string>& fields, std::string& out, const std::string& fieldname) + std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname) { auto it = fields.find(fieldname); vcpkg::Checks::check_throw(it != fields.end(), "Required field not present: %s", fieldname); - out = it->second; + return it->second; }; - void parse_depends(const std::string& depends_string, std::vector<std::string>& out) + std::vector<std::string> parse_depends(const std::string& depends_string) { + std::vector<std::string> out; + size_t cur = 0; do { @@ -34,17 +33,21 @@ namespace vcpkg {namespace details if (pos == std::string::npos) { out.push_back(depends_string.substr(cur)); - return; + break; } out.push_back(depends_string.substr(cur, pos - cur)); // skip comma and space ++pos; if (depends_string[pos] == ' ') + { ++pos; + } cur = pos; } while (cur != std::string::npos); + + return out; } }} diff --git a/toolsrc/vcpkg/vcpkg.vcxproj b/toolsrc/vcpkg/vcpkg.vcxproj index 15f5064d4..40c6f12cf 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj +++ b/toolsrc/vcpkg/vcpkg.vcxproj @@ -128,21 +128,33 @@ </Link> </ItemDefinitionGroup> <ItemGroup> + <ClCompile Include="..\src\commands_cache.cpp" /> + <ClCompile Include="..\src\commands_create.cpp" /> + <ClCompile Include="..\src\commands_edit.cpp" /> + <ClCompile Include="..\src\commands_import.cpp" /> + <ClCompile Include="..\src\commands_list.cpp" /> + <ClCompile Include="..\src\commands_owns.cpp" /> <ClCompile Include="..\src\commands_remove.cpp" /> + <ClCompile Include="..\src\commands_search.cpp" /> + <ClCompile Include="..\src\commands_update.cpp" /> <ClCompile Include="..\src\vcpkg_cmd_arguments.cpp" /> <ClCompile Include="..\src\commands_other.cpp" /> + <ClCompile Include="..\src\vcpkg_Dependencies.cpp" /> <ClCompile Include="..\src\vcpkg_Environment.cpp" /> <ClCompile Include="..\src\commands_installation.cpp" /> <ClCompile Include="..\src\commands_integration.cpp" /> <ClCompile Include="..\src\main.cpp" /> <ClCompile Include="..\src\commands_help.cpp" /> <ClCompile Include="..\src\post_build_lint.cpp" /> + <ClCompile Include="..\src\vcpkg_Input.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\include\vcpkg_cmd_arguments.h" /> <ClInclude Include="..\include\vcpkg_Commands.h" /> + <ClInclude Include="..\include\vcpkg_Dependencies.h" /> <ClInclude Include="..\include\vcpkg_Environment.h" /> <ClInclude Include="..\include\post_build_lint.h" /> + <ClInclude Include="..\include\vcpkg_Input.h" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\vcpkgcommon\vcpkgcommon.vcxproj"> diff --git a/toolsrc/vcpkg/vcpkg.vcxproj.filters b/toolsrc/vcpkg/vcpkg.vcxproj.filters index 3ae3bf3a9..3b836ab3c 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj.filters +++ b/toolsrc/vcpkg/vcpkg.vcxproj.filters @@ -42,6 +42,36 @@ <ClCompile Include="..\src\commands_remove.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="..\src\commands_search.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_cache.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_update.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_list.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_edit.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_create.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_owns.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_import.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_Dependencies.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_Input.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\include\post_build_lint.h"> @@ -56,5 +86,11 @@ <ClInclude Include="..\include\vcpkg_Environment.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\include\vcpkg_Dependencies.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Input.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj index 95cfd5764..d5e68fde3 100644 --- a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj +++ b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj @@ -131,6 +131,8 @@ <ClInclude Include="..\include\vcpkg_Checks.h" /> <ClInclude Include="..\include\vcpkg_Files.h" /> <ClInclude Include="..\include\vcpkg_Graphs.h" /> + <ClInclude Include="..\include\vcpkg_Maps.h" /> + <ClInclude Include="..\include\vcpkg_Sets.h" /> <ClInclude Include="..\include\vcpkg_Strings.h" /> <ClInclude Include="..\include\vcpkg_System.h" /> </ItemGroup> diff --git a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters index a7e98c853..ae747d687 100644 --- a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters +++ b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters @@ -50,5 +50,11 @@ <ClInclude Include="..\include\opt_bool.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\include\vcpkg_Maps.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Sets.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/triplets/arm-uwp.cmake b/triplets/arm-uwp.cmake index bf88711de..678643eb1 100644 --- a/triplets/arm-uwp.cmake +++ b/triplets/arm-uwp.cmake @@ -1,6 +1,7 @@ -set(CMAKE_SYSTEM_NAME WindowsStore) -set(CMAKE_SYSTEM_VERSION 10.0) +set(VCPKG_TARGET_ARCHITECTURE arm) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) -if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 14 2015 ARM") - message(FATAL_ERROR "Visual Studio Generator must be used to target UWP") -endif() +set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) +set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) +set(VCPKG_REQUIRE_GENERATOR "Visual Studio 14 2015 Win64") diff --git a/triplets/x64-uwp.cmake b/triplets/x64-uwp.cmake index 53c680bc8..ca6455fc8 100644 --- a/triplets/x64-uwp.cmake +++ b/triplets/x64-uwp.cmake @@ -1,6 +1,7 @@ -set(CMAKE_SYSTEM_NAME WindowsStore) -set(CMAKE_SYSTEM_VERSION 10.0) +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) -if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 14 2015 Win64") - message(FATAL_ERROR "Visual Studio Generator must be used to target UWP.") -endif() +set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) +set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) +set(VCPKG_REQUIRE_GENERATOR "Visual Studio 14 2015 Win64") diff --git a/triplets/x64-windows-static.cmake b/triplets/x64-windows-static.cmake new file mode 100644 index 000000000..75f9b9532 --- /dev/null +++ b/triplets/x64-windows-static.cmake @@ -0,0 +1,3 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) diff --git a/triplets/x64-windows.cmake b/triplets/x64-windows.cmake index e69de29bb..d0be7297f 100644 --- a/triplets/x64-windows.cmake +++ b/triplets/x64-windows.cmake @@ -0,0 +1,4 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) + diff --git a/triplets/x86-uwp.cmake b/triplets/x86-uwp.cmake index a0c5601bb..7e2d4d2c0 100644 --- a/triplets/x86-uwp.cmake +++ b/triplets/x86-uwp.cmake @@ -1,6 +1,7 @@ -set(CMAKE_SYSTEM_NAME WindowsStore) -set(CMAKE_SYSTEM_VERSION 10.0) +set(VCPKG_TARGET_ARCHITECTURE x86) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) -if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 14 2015") - message(FATAL_ERROR "Visual Studio Generator must be used to target UWP") -endif() +set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) +set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) +set(VCPKG_REQUIRE_GENERATOR "Visual Studio 14 2015 Win64") diff --git a/triplets/x86-windows-static.cmake b/triplets/x86-windows-static.cmake new file mode 100644 index 000000000..c855f0caa --- /dev/null +++ b/triplets/x86-windows-static.cmake @@ -0,0 +1,3 @@ +set(VCPKG_TARGET_ARCHITECTURE x86) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static)
\ No newline at end of file diff --git a/triplets/x86-windows.cmake b/triplets/x86-windows.cmake index e69de29bb..40ccbe152 100644 --- a/triplets/x86-windows.cmake +++ b/triplets/x86-windows.cmake @@ -0,0 +1,3 @@ +set(VCPKG_TARGET_ARCHITECTURE x86) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) |
