diff options
| author | Thomas Fussell <thomas.fussell@gmail.com> | 2017-03-12 17:44:06 -0400 |
|---|---|---|
| committer | Thomas Fussell <thomas.fussell@gmail.com> | 2017-03-12 17:44:06 -0400 |
| commit | 2f42035ab43dd50cd863b51944aa099a99ae60f0 (patch) | |
| tree | 4b6cfd43955e946721c58028fd8564c861d5c331 | |
| parent | e02e85626f3206feda86a6f5757009005e0cfe3e (diff) | |
| parent | 1c9873a0daf625f67474aaf3e163c592c27ecb65 (diff) | |
| download | vcpkg-2f42035ab43dd50cd863b51944aa099a99ae60f0.tar.gz vcpkg-2f42035ab43dd50cd863b51944aa099a99ae60f0.zip | |
Merge branch 'master' of git://github.com/Microsoft/vcpkg
462 files changed, 17527 insertions, 4320 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 464d5c3e7..2cf843111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,265 @@ +vcpkg (0.0.76) +-------------- + * Add ports: + - ffmpeg 3.2.4-2 + - fftw3 3.3.6-p11 + - flatbuffers 1.6.0 + - netcdf-c 4.4.1.1-1 + - netcdf-cxx4 4.3.0 + - portaudio 19.0.6.00 + - vtk 7.1.0 + * Update ports: + - azure-storage-cpp 2.6.0 -> 3.0.0 + - boost 1.63 -> 1.63-2 + - bullet3 2.83.7.98d4780 -> 2.86.1 + - catch 1.5.7 -> 1.8.1 + - cppwinrt 1.010.0.14393.0 -> feb2017_refresh-14393 + - hdf5 1.8.18 -> 1.10.0-patch1-1 + - libflac 1.3.2 -> 1.3.2-1 + - libpng 1.6.24-1 -> 1.6.28 + - lua 5.3.3-2 -> 5.3.4 + - msmpi 8.0 -> 8.0-1 + - openjpeg 2.1.2 -> 2.1.2-1 + - poco 1.7.6-3 -> 1.7.6-4 + - szip 2.1 -> 2.1-1 + - zeromq 4.2.0 -> 4.2.2 + * `vcpkg` now launches external commands (most notably builds) in a sanitized environment + * Better proxy handling when fetching dependencies (cmake/git/nuget) + * Fix more VS2017 issues + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> MON, 10 Mar 2017 17:45:00 -0800 + + +vcpkg (0.0.75) +-------------- + * Add ports: + - dlib 19.2 + - gtk 3.22.8 + - pqp 1.3 + - pugixml 1.8.1 + * Update ports: + - clockutils 1.1.1 -> 1.1.1-3651f232c27074c4ceead169e223edf5f00247c5 + - grpc 1.1.0-dev-1674f65-2 -> 1.1.2-1 + - libflac 1.3.1-1 -> 1.3.2 + - liblzma 5.2.2 -> 5.2.3 + - libmysql 5.7.17 -> 5.7.17-1 + - lz4 1.7.4.2 -> 1.7.5 + - mongo-cxx-driver 3.0.3 -> 3.0.3-1 + - nana 1.4.1 -> 1.4.1-66be23c9204c5567d1c51e6f57ba23bffa517a7c + - opengl 10.0.10240.0 -> 0.0-3 + - protobuf 3.0.2 -> 3.2.0 + - qt5 5.7.1-2 -> 5.7.1-5 + - spdlog 0.11.0 -> 0.12.0 + * Numerous improvements in Visual Studio, MSBuild and Windows SDK auto-detection + * `vcpkg integrate install` now outputs the specific toolchain file to use for CMake integration + * All commands now checks for `--options` and will issue an error on unknown options. + - Previously only commands with options would do this (for example `vcpkg remove --purge <pkg>`) and commands with no options would ignore them, for example `vcpkg install --purge <pkg>` + * Update version of the automatically acquired JOM, python + - Also, for python: automatically acquire the 32-bit versions instead of the 64-bit ones + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> MON, 27 Feb 2017 14:00:00 -0800 + + +vcpkg (0.0.74) +-------------- + * Bump required version & auto-downloaded version of `cmake` to 3.8.0 (was 3.7.x). This fixes UWP builds with Visual Studio 2017 + * Fix `vcpkg build` not printing out the missing dependencies on fail + * Fixes and improvements in the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> THU, 16 Feb 2017 18:15:00 -0800 + + +vcpkg (0.0.73) +-------------- + * Add ports: + - gdk-pixbuf 2.36.5 + - openvr 1.0.5 + * Update ports: + - lmdb 0.9.18-1 -> 0.9.18-2 + - opencv 3.1.0-1 -> 3.2.0 + - sqlite3 3.15.0 -> 3.17.0 + * Add functions to correctly find the "Program Files" folders in all parts of `vcpkg` (C++, CMake, powershell) + * Flush std::cout before launching an external process. Fixes issues when redirecting std::cout to a file + * Update version of the automatically acquired nasm. Resolves build failure with libjpeg-turbo + * Change the format of the listfile. The file is now sorted and directories now have a trailing slash so they can easily be identified. + - Old listfiles will be automatically updated on first access. This will happen to all old listfiles when a new package is installed (`vcpkg install`) or after a call to `vcpkg owns`. + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> WED, 15 Feb 2017 19:30:00 -0800 + + +vcpkg (0.0.72) +-------------- + * Add ports: + - cuda 8.0 + - hdf5 1.8.18 + - lcms 2.8 + - libepoxy 1.4.0-2432daf-1 + - libnice 0.1.13 + - msmpi 8.0 + - parmetis 4.0.3 + - sqlite-modern-cpp 2.4 + - websocketpp 0.7.0 + * Update ports: + - asio 1.10.6 -> 1.10.8 + - aws-sdk-cpp 1.0.47 -> 1.0.61 + - bond 5.0.0-4-g53ea136 -> 5.2.0 + - cpprestsdk 2.9.0-1 -> 2.9.0-2 + - fmt 3.0.1-1 -> 3.0.1-4 + - grpc 1.1.0-dev-1674f65-1 -> 1.1.0-dev-1674f65-2 + - libraw 0.17.2-2 -> 0.18.0-1 + - libvorbis 1.3.5-143caf4023a90c09a5eb685fdd46fb9b9c36b1ee -> 1.3.5-1-143caf4023a90c09a5eb685fdd46fb9b9c36b1ee + - poco 1.7.6-2 -> 1.7.6-3 + - rapidjson 1.0.2-1 -> 1.1.0 + - sfml 2.4.1 -> 2.4.2 + - wt 3.3.6-2 -> 3.3.6-3 + * Introduce Build Policies: + - Packages with special characteristics (e.g. CUDA) can now use Build Policies to control which post-build checks apply to them. + * Improve support for Visual Studio 2017 + - Add auto-detection for Windows SDK + - Fixed various issues with `bootstrap.ps1` and VS2017 support + * Automatic acquisition of perl now uses the 32-bit version isntead of the 64-bit version + * Fix `vcpkg remove --purge` not applying to non-installed packages + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> TUE, 14 Feb 2017 11:30:00 -0800 + + +vcpkg (0.0.71) +-------------- + * Add ports: + - atk 2.22.0 + - fontconfig 2.12.1 + - opus 1.1.4 + - pango 1.40.3 + - xerces-c 3.1.4 + * Update ports: + - boost 1.62-11 -> 1.63 + - cairo 1.14.6 -> 1.15.4 + - directxtk dec2016 -> dec2016-1 + - fltk 1.3.4-1 -> 1.3.4-2 + - gdal 1.11.3 -> 1.11.3-1 + - harfbuzz 1.3.4 -> 1.3.4-2 + - libarchive 3.2.2 -> 3.2.2-2 + - libmariadb 2.3.1 -> 2.3.2 + - mpir 2.7.2 -> 2.7.2-1 + - openssl 1.0.2j-2 -> 1.0.2k-2 + - wt 3.3.6 -> 3.3.6-2 + * Improve `vcpkg remove`: + - Now shows all dependencies that need to be removed instead of just the immediate dependencies + - Add `--recurse` option that removes all dependencies + - Improve messages + * Improve support for Visual Studio 2017 + - Better VS2017 detection + - Fixed various issues with `bootstrap.ps1` and VS2017 support + * Fix `vcpkg_copy_pdbs()` under non-English locale + * Notable changes for buiding the `vcpkg` tool: + - Restructure `vcpkg` project hierarchy. Now only has 4 projects (down from 6). Most of the code now lives under vcpkglib.vcxproj + - Enable multiprocessor compilation + - Disable MinimalRebuild + - Use precompiled headers + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> MON, 30 Jan 2017 23:00:00 -0800 + + +vcpkg (0.0.70) +-------------- + * Add ports: + - fltk 1.3.4-1 + - glib 2.50.2 + - lzo 2.09 + - uvatlas sept2016 + * Update ports: + - dx 1.0.0 -> 1.0.1 + - libmysql 5.7.16 -> 5.7.17 + * Add support for Visual Studio 2017 + - Previously, you could use Visual Studio 2017 for your own application and `vcpkg` integration would work, but you needed to have Visual Studio 2015 to build `vcpkg` itself as well as the libraries. This requirement has now been removed + - If both Visual Studio 2015 and Visual Studio 2017 are installed, Visual Studio 2017 tools will be preferred over those of Visual Studio 2015 + * Bump required version & auto-downloaded version of `cmake` to 3.7.2 (was 3.5.x), which includes generators for Visual Studio 2017 + * Bump auto-downloaded version of `nuget` to 3.5.0 (was 3.4.3) + * Bump auto-downloaded version of `git` to 2.11.0 (was 2.8.3) + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> MON, 23 Jan 2017 19:50:00 -0800 + + +vcpkg (0.0.67) +-------------- + * Add ports: + - cereal 1.2.1 + - directxmesh oct2016 + - directxtex dec2016 + - metis 5.1.0 + - sdl2-image 2.0.1 + - szip 2.1 + * Update ports: + - ace 6.4.0 -> 6.4.2 + - boost 1.62-9 -> 1.62-11 + - curl 7.51.0-2 -> 7.51.0-3 + - directxtk oct2016-1 -> dec2016 + - directxtk12 oct2016 -> dec2016 + - freetype 2.6.3-3 -> 2.6.3-4 + - glew 2.0.0 -> 2.0.0-1 + - grpc 1.1.0-dev-1674f65 -> 1.1.0-dev-1674f65-1 + - http-parser 2.7.1 -> 2.7.1-1 + - libssh2 1.8.0 -> 1.8.0-1 + - libwebsockets 2.0.0 -> 2.0.0-1 + - openssl 1.0.2j-1 -> 1.0.2j-2 + - tiff 4.0.6-1 -> 4.0.6-2 + - zlib 1.2.10 -> 1.2.11 + * Add 7z to `vcpkg_find_acquire_program.cmake` + * Enhance `vcpkg_build_cmake.cmake` and `vcpkg_install_cmake.cmake`: + - Add option to disable parallel building (it is enabled by default) + - Add option to use the 64-bit toolset (for the 32-bit builds; output binaries are still 32-bit) + * Fix bug in `applocal.ps1` that would infinitely recurse when there were no depenndencies + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> WED, 18 Jan 2017 13:45:00 -0800 + + +vcpkg (0.0.66) +-------------- + * Add ports: + - antlr4 4.6 + - bzip2 1.0.6 + - dx 1.0.0 + - gli 0.8.2 + - libarchive 3.2.2 + - libffi 3.1 + - liblzma 5.2.2 + - libmodplug 0.8.8.5-bb25b05 + - libsigcpp 2.10 + - lmdb 0.9.18-1 + - lz4 1.7.4.2 + - ogre 1.9.0 + - qwt 6.1.3 + - smpeg2 2.0.0 + - spirv-tools 1.1-f72189c249ba143c6a89a4cf1e7d53337b2ddd40 + * Update ports: + - aws-sdk-cpp 1.0.34-1 -> 1.0.47 + - azure-storage-cpp 2.5.0 -> 2.6.0 + - boost 1.62-8 -> 1.62-9 + - chakracore 1.3.1 -> 1.4.0 + - freetype 2.6.3-2 -> 2.6.3-3 + - icu 58.1 -> 58.2-1 + - libbson 1.5.0-rc6 -> 1.5.1 + - libvorbis -> 1.3.5-143caf4023a90c09a5eb685fdd46fb9b9c36b1ee + - lua 5.3.3-1 -> 5.3.3-2 + - mongo-c-driver 1.5.0-rc6 -> 1.5.1 + - pixman 0.34.0 -> 0.34.0-1 + - qt5 5.7-1 -> 5.7.1-2 + - sdl2 2.0.5 -> 2.0.5-2 + - zlib 1.2.8 -> 1.2.10 + * Improvements in pre-install checks: + - Refactor file-exists-check. Improved clarity and performance. + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> TUE, 10 Jan 2017 17:15:00 -0800 + + vcpkg (0.0.65) -------------- * Add ports: @@ -7,7 +7,9 @@ For short description of available commands, run `vcpkg help`. ## Quick Start Prerequisites: -- Visual Studio 2015 Update 3 +- Visual Studio 2015 Update 3 or +- Visual Studio 2017 +- CMake 3.8.0 or higher (note: downloaded automatically if not found) - `git.exe` available in your path Clone this repository, then run @@ -22,7 +24,7 @@ Install any packages with ``` C:\src\vcpkg> .\vcpkg install sdl2 curl ``` -Finally, create a New Project (or open an existing one) in Visual Studio 2015 or Visual Studio "15" Preview. You can now `#include` and use any of the installed libraries. +Finally, create a New Project (or open an existing one) in Visual Studio 2015 or Visual Studio 2017. You can now `#include` and use any of the installed libraries. ## Examples See the [`docs\EXAMPLES.md`](docs/EXAMPLES.md) document for specific walkthroughs, including using a package and adding a new package. diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 7862ba354..1a2bacc99 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -3,7 +3,7 @@ ## Overview Vcpkg helps you get C and C++ libraries on Windows. -For short description of available commands, run `vcpkg help`. +For short description of available commands, run `.\vcpkg help`. ## Table of Contents - <a href="#example-1">Example 1: Using Sqlite</a> @@ -64,7 +64,7 @@ Package sqlite3:x86-windows is installed ``` In addition to installing, `vcpkg` caches a pristine copy of the built library inside the `packages\` directory -- in this case, `packages\sqlite3_x86-windows`. This allows you to quickly uninstall and reinstall the library in the future using the `remove` and `install` commands. -We can check that cpprestsdk was successfully installed for x86 windows desktop by running the `list` command. +We can check that sqlite3 was successfully installed for x86 windows desktop by running the `list` command. ``` PS D:\src\vcpkg> .\vcpkg list sqlite3:x86-windows 3.15.0 SQLite is a software library that implements a se... @@ -72,10 +72,10 @@ sqlite3:x86-windows 3.15.0 SQLite is a software library that i To install for other architectures and platforms such as Universal Windows Platform or x64 Desktop, you can suffix the package name with `:<target>`. ``` -PS D:\src\vcpkg> .\vcpkg install cpprestsdk:x86-uwp zlib:x64-windows +PS D:\src\vcpkg> .\vcpkg install sqlite3:x86-uwp zlib:x64-windows ``` -See `vcpkg help triplet` for all supported targets. +See `.\vcpkg help triplet` for all supported targets. <a name="example-1-2"></a> ### Step 2: Use @@ -95,7 +95,7 @@ Installing new libraries will make them instantly available. You can now simply use File -> New Project in Visual Studio 2015 or Visual Studio "15" Preview and the library will be automatically available. For Sqlite, you can try out their [C/C++ sample](https://sqlite.org/quickstart.html). -To remove the integration for your user, you can use `vcpkg integrate remove`. +To remove the integration for your user, you can use `.\vcpkg integrate remove`. <a name="example-1-2-b"></a> #### Option B: CMake (Toolchain File) @@ -150,9 +150,9 @@ PS D:\src\cmake-test\build> .\Debug\main.exe Libraries are installed into the `installed\` subfolder, partitioned by architecture (e.g. x86-windows): * The header files are installed to `installed\x86-windows\include` -* Release `.lib` files are installed to `installed\x86-windows\lib` +* Release `.lib` files are installed to `installed\x86-windows\lib` or `installed\x86-windows\lib\manual-link` * Release `.dll` files are installed to `installed\x86-windows\bin` -* Debug `.lib` files are installed to `installed\x86-windows\debug\lib` +* Debug `.lib` files are installed to `installed\x86-windows\debug\lib` or `installed\x86-windows\debug\lib\manual-link` * Debug `.dll` files are installed to `installed\x86-windows\debug\bin` See your build system specific documentation for how to use prebuilt binaries. diff --git a/docs/PRIVACY.md b/docs/PRIVACY.md index f50c2938f..ad345c809 100644 --- a/docs/PRIVACY.md +++ b/docs/PRIVACY.md @@ -5,14 +5,14 @@ ## Do you collect telemetry data? What is it used for? We do collect telemetry data from usage of "vcpkg.exe". We explicitly ONLY collect information from invocations of the tool itself; we do NOT add any tracking information into the produced libraries. -We use this information to understand the usage the issue and what we can do to improve the tool. +We use this information to understand usage issues and to guide tool improvements. ## What telemetry is collected? We collect the command line used, the time of invocation, and how long the command took. Some commands also add additional calculated information (such as the full set of libraries to install). We generate a completely random UUID on first use and attach it to each event. For this preview, we do not offer a mechanism to disable this data collection since it is critical for improving the product. In the full release, you will be able to opt-out with a simple configuration. For more information about how Microsoft protects your privacy, see https://privacy.microsoft.com/en-us/privacy. -Here is an example of an event for the command line "vcpkg install zlib": +Here is an example of an event for the command line `vcpkg install zlib`: ``` [{ "ver": 1, @@ -40,7 +40,7 @@ Here is an example of an event for the command line "vcpkg install zlib": } }] ``` -In the source code (included in every release), you can search for calls to the functions "TrackProperty" and "TrackMetric" to see every specific data point we collect. +In the source code (included in `toolsrc\`), you can search for calls to the functions `TrackProperty()` and `TrackMetric()` to see every specific data point we collect. ## Is the data stored on my system? diff --git a/ports/ace/CONTROL b/ports/ace/CONTROL index 352d2b74a..9cc7ae116 100644 --- a/ports/ace/CONTROL +++ b/ports/ace/CONTROL @@ -1,3 +1,3 @@ Source: ace -Version: 6.4.0 +Version: 6.4.2 Description: The ADAPTIVE Communication Environment diff --git a/ports/ace/portfile.cmake b/ports/ace/portfile.cmake index 8301fb232..a06016abd 100644 --- a/ports/ace/portfile.cmake +++ b/ports/ace/portfile.cmake @@ -5,9 +5,9 @@ endif() include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ACE_wrappers/ace) vcpkg_download_distfile(ARCHIVE - URLS "http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.0.zip" - FILENAME "ACE-6.4.0.zip" - SHA512 3543291332b96cf06a966dedda617169e8db051cebbbc4f05cdc2c2c9e7908174f8ed67bc152bbcd57541279d3addb1138f1fc092468e856c2bb04ee6ad2b95a + URLS "http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.2.zip" + FILENAME "ACE-6.4.2.zip" + SHA512 587872ef1fb197829a085f4449d7beb2f161a782a2a552d26324154ae85fd463092e3c2a4dd0c6d93079ae798cc43269117ea069855b0af6804b49cad0a8c2ca ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/antlr4/portfile.cmake b/ports/antlr4/portfile.cmake index 8b11c95b0..d10513064 100644 --- a/ports/antlr4/portfile.cmake +++ b/ports/antlr4/portfile.cmake @@ -6,69 +6,70 @@ vcpkg_download_distfile(ARCHIVE FILENAME "antlr4-cpp-runtime-4.6-source.zip"
SHA512 e123c2227e41ce80da5a3758725a018690ed70a4e10c23da26c966259e6bdafa192f4363f5a7e1181ef9a47bf3cc50d6b0ca7b26c8dd2b19222a7edf54de8de2
)
+
+# license not exist in antlr folder.
+vcpkg_download_distfile(LICENSE
+ URLS https://raw.githubusercontent.com/antlr/antlr4/4.6/LICENSE.txt
+ FILENAME "antlr4-copyright"
+ SHA512 c72ae3d5c9f3f07160405b5ca44f01116a9602d82291d6cd218fcc5ec6e8baf985e4baa2acf3d621079585385708bd171c96ef44dd808e60c40a48bc1f56c9ae
+)
+
vcpkg_extract_source_archive(${ARCHIVE})
-vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src - PATCHES ${CMAKE_CURRENT_LIST_DIR}/crt_mt.patch +vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/crt_mt.patch
)
if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
- set(DEBUG_CONFIG "Debug Static")
- set(RELEASE_CONFIG "Release Static")
+ set(DEBUG_CONFIG "Debug Static")
+ set(RELEASE_CONFIG "Release Static")
else()
- set(DEBUG_CONFIG "Debug DLL")
- set(RELEASE_CONFIG "Release DLL")
+ set(DEBUG_CONFIG "Debug DLL")
+ set(RELEASE_CONFIG "Release DLL")
endif()
-vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/antlr4cpp-vs2015.vcxproj - DEBUG_CONFIGURATION ${DEBUG_CONFIG} - RELEASE_CONFIGURATION ${RELEASE_CONFIG} +vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/antlr4cpp-vs2015.vcxproj
+ DEBUG_CONFIGURATION ${DEBUG_CONFIG}
+ RELEASE_CONFIGURATION ${RELEASE_CONFIG}
)
-file (MAKE_DIRECTORY
- ${CURRENT_PACKAGES_DIR}/include)
-FILE(COPY ${SOURCE_PATH}/src/ - DESTINATION ${CURRENT_PACKAGES_DIR}/include +file (MAKE_DIRECTORY
+ ${CURRENT_PACKAGES_DIR}/include)
+FILE(COPY ${SOURCE_PATH}/src/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
FILES_MATCHING PATTERN "*.h")
-file (MAKE_DIRECTORY
- ${CURRENT_PACKAGES_DIR}/lib
- ${CURRENT_PACKAGES_DIR}/debug/lib)
+file (MAKE_DIRECTORY
+ ${CURRENT_PACKAGES_DIR}/lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
- vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include - PATCHES ${CMAKE_CURRENT_LIST_DIR}/static.patch - )
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/static.patch
+ )
else()
- file (MAKE_DIRECTORY
- ${CURRENT_PACKAGES_DIR}/bin
- ${CURRENT_PACKAGES_DIR}/debug/bin)
-
- file(COPY
- ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.dll
- ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.pdb
- DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
- file(COPY
- ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.dll
- ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.pdb
- DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
-endif()
+ file (MAKE_DIRECTORY
+ ${CURRENT_PACKAGES_DIR}/bin
+ ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(COPY
+ ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.dll
+ ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(COPY
+ ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.dll
+ ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+endif()
-# license not exist in antlr folder.
-vcpkg_download_distfile(LICENSE
- URLS https://raw.githubusercontent.com/antlr/antlr4/master/LICENSE.txt
- FILENAME "antlr4-copyright"
- SHA512 c72ae3d5c9f3f07160405b5ca44f01116a9602d82291d6cd218fcc5ec6e8baf985e4baa2acf3d621079585385708bd171c96ef44dd808e60c40a48bc1f56c9ae
-)
file(INSTALL ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/antlr4 RENAME copyright)
message(STATUS "Installing done")
\ No newline at end of file diff --git a/ports/asio/CONTROL b/ports/asio/CONTROL index 466ef6cd0..18d9692f5 100644 --- a/ports/asio/CONTROL +++ b/ports/asio/CONTROL @@ -1,3 +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. +Source: asio
+Version: 1.10.8
+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 index 345ddd673..39fefa012 100644 --- a/ports/asio/portfile.cmake +++ b/ports/asio/portfile.cmake @@ -1,10 +1,10 @@ #header-only library include(vcpkg_common_functions) -SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/asio-asio-1-10-6/asio/) +SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/asio-asio-1-10-8/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 + URLS "https://github.com/chriskohlhoff/asio/archive/asio-1-10-8.zip" + FILENAME "asio-1-10-8.zip" + SHA512 bc9794a20fc7844a2a9d22bfa418005f61defbcecdd612daba0d317e6f8fc5a61d3a3b2d7d557b92584294b8adfccc3c47a8f0441f3e34a47a0f715ca1ba0e5b ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/atk/CMakeLists.txt b/ports/atk/CMakeLists.txt new file mode 100644 index 000000000..3762ee27f --- /dev/null +++ b/ports/atk/CMakeLists.txt @@ -0,0 +1,129 @@ +cmake_minimum_required(VERSION 3.0) +project(atk) + +set(ATK_LIB_SUFFIX 1.0) +set(ATK_DLL_SUFFIX 1) +set(GLIB_LIB_VERSION 2.0) + +if(BUILD_SHARED_LIBS) + set(ATK_EXPORT_MACRO DLL_EXPORT) +endif() + +# generate atkmarshal.c and atkmarshal.h source files +# glib-genmarshal should be installed along with glib +if(NOT EXISTS ${CMAKE_SOURCE_DIR}/atk/atkmarshal.h OR NOT EXISTS ${CMAKE_SOURCE_DIR}/atk/atkmarshal.c) + find_program(GLIB_GENMARSHAL glib-genmarshal PATH_SUFFIXES glib) + execute_process( + COMMAND ${GLIB_GENMARSHAL} --prefix=atk_marshal atkmarshal.list --header + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/atk + OUTPUT_FILE ${CMAKE_SOURCE_DIR}/atk/atkmarshal.h) + execute_process( + COMMAND ${GLIB_GENMARSHAL} --prefix=atk_marshal atkmarshal.list --body + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/atk + OUTPUT_FILE ${CMAKE_SOURCE_DIR}/atk/atkmarshal.c) +endif() + +configure_file(config.h.win32 ${CMAKE_SOURCE_DIR}/config.h COPYONLY) +add_definitions(-DHAVE_CONFIG_H) +include_directories(. ./atk) + +find_path(GLIB_INCLUDE_DIR glib.h) +find_library(GLIB_GLIB_LIBRARY glib-${GLIB_LIB_VERSION}) +find_library(GLIB_GOBJECT_LIBRARY gobject-${GLIB_LIB_VERSION}) +find_library(GLIB_GMODULE_LIBRARY gmodule-${GLIB_LIB_VERSION}) +set(GLIB_LIBRARIES ${GLIB_GLIB_LIBRARY} ${GLIB_GOBJECT_LIBRARY} ${GLIB_GMODULE_LIBRARY}) + +find_path(LIBINTL_INCLUDE_DIR libintl.h) +find_library(LIBINTL_LIBRARY NAMES libintl intl) + +set(ATK_SOURCES + atk/atkaction.c + atk/atkcomponent.c + atk/atkdocument.c + atk/atkeditabletext.c + atk/atkgobjectaccessible.c + atk/atkhyperlink.c + atk/atkhyperlinkimpl.c + atk/atkhypertext.c + atk/atkimage.c + atk/atknoopobject.c + atk/atknoopobjectfactory.c + atk/atkobject.c + atk/atkobjectfactory.c + atk/atkplug.c + atk/atkprivate.c + atk/atkrange.c + atk/atkregistry.c + atk/atkrelation.c + atk/atkrelationset.c + atk/atkselection.c + atk/atksocket.c + atk/atkstate.c + atk/atkstateset.c + atk/atkstreamablecontent.c + atk/atktable.c + atk/atktablecell.c + atk/atktext.c + atk/atkutil.c + atk/atkmisc.c + atk/atkvalue.c + atk/atkversion.c + atk/atkwindow.c + atk/atk-enum-types.c) + +add_library(atk ${ATK_SOURCES}) +target_compile_definitions(atk PRIVATE ATK_COMPILATION ${ATK_EXPORT_MACRO} G_DISABLE_SINGLE_INCLUDES ATK_LOCALEDIR="/dummy/share/locale") +target_link_libraries(atk ${LIBINTL_LIBRARY} ${GLIB_LIBRARIES}) +target_include_directories(atk PRIVATE ${GLIB_INCLUDE_DIR} ${LIBINTL_INCLUDE_DIR}) + +set_target_properties(atk PROPERTIES + OUTPUT_NAME atk-${ATK_DLL_SUFFIX} + ARCHIVE_OUTPUT_NAME atk-${ATK_LIB_SUFFIX}) + +install(TARGETS atk RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + +if(NOT ATK_SKIP_HEADERS) + install(FILES + atk/atk.h + atk/atkaction.h + atk/atkcomponent.h + atk/atkdocument.h + atk/atkeditabletext.h + atk/atkgobjectaccessible.h + atk/atkhyperlink.h + atk/atkhyperlinkimpl.h + atk/atkhypertext.h + atk/atknoopobject.h + atk/atknoopobjectfactory.h + atk/atkobject.h + atk/atkobjectfactory.h + atk/atkplug.h + atk/atkimage.h + atk/atkrange.h + atk/atkregistry.h + atk/atkrelation.h + atk/atkrelationtype.h + atk/atkrelationset.h + atk/atkselection.h + atk/atksocket.h + atk/atkstate.h + atk/atkstateset.h + atk/atkstreamablecontent.h + atk/atktable.h + atk/atktablecell.h + atk/atktext.h + atk/atkutil.h + atk/atkmisc.h + atk/atkvalue.h + atk/atkwindow.h + atk/atkversion.h + atk/atk-enum-types.h + atk/atkversion.h + DESTINATION include/atk) +endif() + +message(STATUS "Link-time dependencies:") +message(STATUS " " ${LIBINTL_LIBRARY}) +foreach(GL ${GLIB_LIBRARIES}) + message(STATUS " " ${GL}) +endforeach() diff --git a/ports/atk/CONTROL b/ports/atk/CONTROL new file mode 100644 index 000000000..7ac71a0c3 --- /dev/null +++ b/ports/atk/CONTROL @@ -0,0 +1,4 @@ +Source: atk
+Version: 2.22.0
+Description: GNOME Accessibility Toolkit
+Build-Depends: glib, gettext
diff --git a/ports/atk/portfile.cmake b/ports/atk/portfile.cmake new file mode 100644 index 000000000..08f4d6593 --- /dev/null +++ b/ports/atk/portfile.cmake @@ -0,0 +1,28 @@ +# ATK uses DllMain
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ message(STATUS "Warning: Static building not supported. Building dynamic.")
+ set(VCPKG_LIBRARY_LINKAGE dynamic)
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/atk-2.22.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://ftp.gnome.org/pub/GNOME/sources/atk/2.22/atk-2.22.0.tar.xz"
+ FILENAME "atk-2.22.0.tar.xz"
+ SHA512 af3f6197eb97de869ee706f19564449b02c1444c413e5418323e4bf4c8cf1d98c7c8baa25189f6879d63606d4bc75f33799cb901f4697c087e868bb9a5643cba
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DCMAKE_PROGRAM_PATH=${CURRENT_INSTALLED_DIR}/tools/glib
+ OPTIONS_DEBUG
+ -DATK_SKIP_HEADERS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/atk)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/atk/COPYING ${CURRENT_PACKAGES_DIR}/share/atk/copyright)
diff --git a/ports/aws-sdk-cpp/CONTROL b/ports/aws-sdk-cpp/CONTROL index 989d3a9eb..18de04d46 100644 --- a/ports/aws-sdk-cpp/CONTROL +++ b/ports/aws-sdk-cpp/CONTROL @@ -1,3 +1,3 @@ Source: aws-sdk-cpp -Version: 1.0.47 +Version: 1.0.61 Description: AWS SDK for C++ diff --git a/ports/aws-sdk-cpp/disable_warning_as_error.patch b/ports/aws-sdk-cpp/disable_warning_as_error.patch new file mode 100644 index 000000000..ec5587eb8 --- /dev/null +++ b/ports/aws-sdk-cpp/disable_warning_as_error.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/compiler_settings.cmake b/cmake/compiler_settings.cmake +index 36795a2..77334ee 100644 +--- a/cmake/compiler_settings.cmake ++++ b/cmake/compiler_settings.cmake +@@ -57,7 +57,7 @@ endif() + if(MSVC) + # warnings as errors, max warning level (4) + if(NOT CMAKE_CXX_FLAGS MATCHES "/WX") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") ++ #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + endif() + + # taken from http://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake diff --git a/ports/aws-sdk-cpp/portfile.cmake b/ports/aws-sdk-cpp/portfile.cmake index 5313e85b7..93c7a7265 100644 --- a/ports/aws-sdk-cpp/portfile.cmake +++ b/ports/aws-sdk-cpp/portfile.cmake @@ -1,9 +1,9 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/aws-sdk-cpp-1.0.47) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/aws-sdk-cpp-1.0.61) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/aws/aws-sdk-cpp/archive/1.0.47.tar.gz" - FILENAME "aws-sdk-cpp-1.0.47.tar.gz" - SHA512 ce7471bafe2763f1c382eed8afeaf6422058599a3aa11ae52909da668c45d12827fcd06b9b3ce34e3c2fa33297fd2e09421b8a89833d581efaf62b7108232acf + URLS "https://github.com/aws/aws-sdk-cpp/archive/1.0.61.tar.gz" + FILENAME "aws-sdk-cpp-1.0.61.tar.gz" + SHA512 aef0a85a32db24dc4fba0fc49c2533074580f3df628e787ff0808f03deea5dac42e19b1edc966706784e98cfed17a350c3eff4f222df7cc756065be56d1fc6a6 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -11,6 +11,7 @@ vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/drop_git.patch + ${CMAKE_CURRENT_LIST_DIR}/disable_warning_as_error.patch ) if(VCPKG_CRT_LINKAGE STREQUAL static) @@ -21,6 +22,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DENABLE_TESTING=OFF -DFORCE_SHARED_CRT=${FORCE_SHARED_CRT} @@ -44,11 +46,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(COPY ${DEBUG_LIB_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) file(REMOVE ${LIB_FILES} ${DEBUG_LIB_FILES}) - vcpkg_apply_patches( #define USE_IMPORT_EXPORT in SDKConfig.h - SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/shared_define.patch - ) + file(APPEND ${CURRENT_PACKAGES_DIR}/include/aws/core/SDKConfig.h "#define USE_IMPORT_EXPORT") endif() # Handle copyright diff --git a/ports/aws-sdk-cpp/shared_define.patch b/ports/aws-sdk-cpp/shared_define.patch deleted file mode 100644 index 96657b33e..000000000 --- a/ports/aws-sdk-cpp/shared_define.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff --git a/aws/core/SDKConfig.h b/aws/core/SDKConfig.h -index 130c9dd..66b2630 100644 ---- a/aws/core/SDKConfig.h -+++ b/aws/core/SDKConfig.h -@@ -17,3 +17,4 @@ - - #define JSON_USE_EXCEPTION 0 - -+#define USE_IMPORT_EXPORT -\ No newline at end of file diff --git a/ports/azure-storage-cpp/CONTROL b/ports/azure-storage-cpp/CONTROL index 29c80c703..fd3275538 100644 --- a/ports/azure-storage-cpp/CONTROL +++ b/ports/azure-storage-cpp/CONTROL @@ -1,5 +1,5 @@ Source: azure-storage-cpp -Version: 2.6.0 +Version: 3.0.0 Build-Depends: cpprestsdk Description: Microsoft Azure Storage Client SDK for C++ A client library for working with Microsoft Azure storage services including blobs, files, tables, and queues. This client library enables working with the Microsoft Azure storage services which include the blob service for storing binary and text data, the file service for storing binary and text data, the table service for storing structured non-relational data, and the queue service for storing messages that may be accessed by a client. Microsoft Azure Storage team's blog - http://blogs.msdn.com/b/windowsazurestorage/
\ No newline at end of file diff --git a/ports/azure-storage-cpp/portfile.cmake b/ports/azure-storage-cpp/portfile.cmake index d83a6d854..06df886ac 100644 --- a/ports/azure-storage-cpp/portfile.cmake +++ b/ports/azure-storage-cpp/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/azure-storage-cpp-2.6.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/azure-storage-cpp-3.0.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Azure/azure-storage-cpp/archive/v2.6.0.tar.gz" - FILENAME "azure-storage-cpp/v2.6.0.tar.gz" - SHA512 383fc709b04b7a116b553575f27a95b95a66105fe9b96d412fc4f1938e51288f81e49a9578c02993d0bc2a4771265694117b82fd5beaeaf4c32f81eeb8f9be6a + URLS "https://github.com/Azure/azure-storage-cpp/archive/v3.0.0.tar.gz" + FILENAME "azure-storage-cpp/v3.0.0.tar.gz" + SHA512 45d0d7f8cc350a16cff0371cdd442e851912c89061acfec559482e8f79cebafffd8681b32a30b878e329235cd3aaad5d2ff797d1148302e3109cf5111df14b97 ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/bond/0001_boost_static_libs.patch b/ports/bond/0001_boost_static_libs.patch new file mode 100644 index 000000000..cc712b6c7 --- /dev/null +++ b/ports/bond/0001_boost_static_libs.patch @@ -0,0 +1,23 @@ +diff --git a/cmake/Config.cmake b/cmake/Config.cmake +index ed225d14..1573c915 100644 +--- a/cmake/Config.cmake ++++ b/cmake/Config.cmake +@@ -19,7 +19,7 @@ if (MSVC) + # disable MSVC warnings + add_compile_options (/bigobj /FIbond/core/warning.h /W4 /WX) + add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) +- set (Boost_USE_STATIC_LIBS ON) ++ set (Boost_USE_STATIC_LIBS OFF) + endif (MSVC) + + if (WIN32) +@@ -90,9 +90,6 @@ if (DEFINED ENV{APPVEYOR} AND ("$ENV{BOND_BUILD}" STREQUAL "C++")) + endif() + endif() + +-# disable Boost auto-linking +-add_definitions (-DBOOST_ALL_NO_LIB) +- + # VS2015U2 fixed a bug with atomics and emits a warning without this definition. + add_definitions (-D_ENABLE_ATOMIC_ALIGNMENT_FIX) + diff --git a/ports/bond/0002_omit_rapidjson.patch b/ports/bond/0002_omit_rapidjson.patch new file mode 100644 index 000000000..3e4a0571b --- /dev/null +++ b/ports/bond/0002_omit_rapidjson.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d743da4..92f91103 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,7 +39,6 @@ install (DIRECTORY + cpp/inc/bond + cpp/generated/bond + python/inc/bond +- thirdparty/rapidjson/include/rapidjson + DESTINATION include + PATTERN *.cpp EXCLUDE) + diff --git a/ports/bond/0003_rename_gbc_during_install.patch b/ports/bond/0003_rename_gbc_during_install.patch new file mode 100644 index 000000000..edbce6c0a --- /dev/null +++ b/ports/bond/0003_rename_gbc_during_install.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d743da4..72d62c5e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,7 +49,14 @@ install (EXPORT bond + + # if BOND_GBC_PATH is set we must copy over that gbc to the install location + if (BOND_GBC_PATH) +- install (FILES +- ${BOND_GBC_PATH} +- DESTINATION bin) ++ if (WIN32) ++ set(INSTALLED_GBC_NAME gbc.exe) ++ else() ++ set(INSTALLED_GBC_NAME gbc) ++ endif() ++ ++ install ( ++ FILES ${BOND_GBC_PATH} ++ DESTINATION bin ++ RENAME ${INSTALLED_GBC_NAME}) + endif() diff --git a/ports/bond/CONTROL b/ports/bond/CONTROL index 70384f020..0e804025a 100644 --- a/ports/bond/CONTROL +++ b/ports/bond/CONTROL @@ -1,5 +1,5 @@ Source: bond Maintainer: bond@microsoft.com -Version: 5.0.0-4-g53ea136 +Version: 5.2.0 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 index 8dbf7cf53..d806173f1 100644 --- a/ports/bond/portfile.cmake +++ b/ports/bond/portfile.cmake @@ -1,31 +1,51 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) endif() + include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-53ea13692925bee4ba494ee9de3614f15c09d85d) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-5.2.0) + vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Microsoft/bond/archive/53ea13692925bee4ba494ee9de3614f15c09d85d.zip" - FILENAME "bond-5.0.0-4-g53ea136.zip" - SHA512 fe39dc211f6b99cba3f2284d78a524305dfb8dcd1f597639c45625df369f96c3321cb6782fef9eb34d34fab69c8da9015024eee34be6d0a76d730729517183da + URLS "https://github.com/Microsoft/bond/archive/5.2.0.zip" + FILENAME "bond-5.2.0.zip" + SHA512 bc533d9e7431d0690b555aa4a42ca947f8025fc388f698c40cfeacf4286892ac5fd86d93df187009d4791e3eae240eb60886947cfe600838c6058274eb4d625c +) +vcpkg_download_distfile(GBC_ARCHIVE + URLS "https://github.com/Microsoft/bond/releases/download/5.2.0/gbc-5.2.0-amd64.zip" + FILENAME "gbc-5.2.0-amd64.zip" + SHA512 9413c0035939788724e08ac858bfc3b2ccefbba74ed737b22eca35ec0da576aa2bf8403e606d2ac20b3fbc827933c289630266824613e04b1921b66fef00e132 ) + 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> +# Extract the precompiled gbc +vcpkg_extract_source_archive(${GBC_ARCHIVE} ${CURRENT_BUILDTREES_DIR}/tools/) +set(FETCHED_GBC_PATH ${CURRENT_BUILDTREES_DIR}/tools/gbc-5.2.0-amd64.exe) + +if (NOT EXISTS ${FETCHED_GBC_PATH}) + message(FATAL_ERROR "Fetching GBC failed. Expected '${FETCHED_GBC_PATH}' to exists, but it doesn't.") +endif() + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + # Change Boost_USE_STATIC_LIBS to be compatible with vcpkg's treatment + # of Boost + ${CMAKE_CURRENT_LIST_DIR}/0001_boost_static_libs.patch + # Don't install rapidjson from the (empty) submodule. With vcpkg, we get + # rapidjson from vcpkg + ${CMAKE_CURRENT_LIST_DIR}/0002_omit_rapidjson.patch + # Temporary until this is committed upstream. See + # https://github.com/Microsoft/bond/pull/324 for details. + ${CMAKE_CURRENT_LIST_DIR}/0003_rename_gbc_during_install.patch +) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS -DBOND_LIBRARIES_ONLY=TRUE + -DBOND_GBC_PATH=${FETCHED_GBC_PATH} ) vcpkg_install_cmake() @@ -34,11 +54,14 @@ vcpkg_install_cmake() 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) +# Drop a copy of gbc in tools/ so that it can be used +file(COPY ${CURRENT_PACKAGES_DIR}/bin/gbc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools/) + # 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) +# the output. Just delete the bin/ directories for now. +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/bin/ + ${CURRENT_PACKAGES_DIR}/debug/bin/) # There's no way to supress installation of the headers in the debug build, # so we just delete them. diff --git a/ports/boost/CONTROL b/ports/boost/CONTROL index 9e2afdf8a..3f1127ab0 100644 --- a/ports/boost/CONTROL +++ b/ports/boost/CONTROL @@ -1,4 +1,4 @@ Source: boost -Version: 1.62-9 +Version: 1.63-2 Description: Peer-reviewed portable C++ source libraries -Build-Depends: zlib +Build-Depends: zlib, bzip2 diff --git a/ports/boost/portfile.cmake b/ports/boost/portfile.cmake index 6cc21a091..343e0c5b0 100644 --- a/ports/boost/portfile.cmake +++ b/ports/boost/portfile.cmake @@ -1,22 +1,22 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/boost_1_62_0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/boost_1_63_0) vcpkg_download_distfile(ARCHIVE_FILE - 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 + URLS "https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.bz2" + FILENAME "boost_1_63_0.tar.bz2" + SHA512 c915c5f5778dee49b8e9d0a40f37f90f56fb1fdb1d8ce92d97bf48bc7bc462212487badfe4bbe30b06196d1149cfb221da12ac54e97499b0d4cb6466813bb4ad ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) # apply boost range hotfix vcpkg_download_distfile(DIFF URLS "https://github.com/boostorg/range/commit/e7ebe14707130cda7b72e0ae5e93b17157fdb6a2.diff" - FILENAME "boost-range-has_range_interator-hotfix_e7ebe14707130cda7b72e0ae5e93b17157fdb6a2.diff" + FILENAME "boost-range-has_range_iterator-hotfix_e7ebe14707130cda7b72e0ae5e93b17157fdb6a2.diff" SHA512 77dad42bfd9bbab2bbddf361d5b7ad3dd6f812f4294c6dd1a677bb4d0191a4fff43bca32fdd4fce05d428562abb6e38afd0fd33ca6a8b5f28481d70cd2f3dd67 ) FILE(READ "${DIFF}" content) STRING(REGEX REPLACE "include/" "" content "${content}") -set(DIFF2 ${CURRENT_BUILDTREES_DIR}/src/boost-range-has_range_interator-hotfix_e7ebe14707130cda7b72e0ae5e93b17157fdb6a2.diff.fixed) +set(DIFF2 ${CURRENT_BUILDTREES_DIR}/src/boost-range-has_range_iterator-hotfix_e7ebe14707130cda7b72e0ae5e93b17157fdb6a2.diff.fixed) FILE(WRITE ${DIFF2} "${content}") vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} PATCHES ${DIFF2}) @@ -31,16 +31,14 @@ endif() message(STATUS "Bootstrapping done") set(B2_OPTIONS - -sZLIB_BINARY=zlib -sZLIB_INCLUDE="${CURRENT_INSTALLED_DIR}\\include" - -sZLIB_LIBPATH="${CURRENT_INSTALLED_DIR}\\lib" - -sNO_BZIP2=1 + -sBZIP2_INCLUDE="${CURRENT_INSTALLED_DIR}\\include" -j$ENV{NUMBER_OF_PROCESSORS} --debug-configuration --hash + -q --without-python - toolset=msvc threading=multi ) @@ -59,22 +57,55 @@ endif() if(TRIPLET_SYSTEM_ARCH MATCHES "x64") list(APPEND B2_OPTIONS address-model=64) endif() + +if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + message(WARNING "Combination of VS2017 and UWP is partially supported; using reference Winmd's from VS2015") +endif() if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore") list(APPEND B2_OPTIONS windows-api=store) - set(ENV{BOOST_BUILD_PATH} ${CMAKE_CURRENT_LIST_DIR}) + set(ENV{BOOST_BUILD_PATH} ${CMAKE_CURRENT_LIST_DIR}/uwp) +else() + set(ENV{BOOST_BUILD_PATH} ${CMAKE_CURRENT_LIST_DIR}/vs2017) +endif() + +if(VCPKG_PLATFORM_TOOLSET MATCHES "v141") + list(APPEND B2_OPTIONS toolset=msvc-14.1) +elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v140") + list(APPEND B2_OPTIONS toolset=msvc-14.0) +else() + message(FATAL_ERROR "Unsupported value for VCPKG_PLATFORM_TOOLSET: '${VCPKG_PLATFORM_TOOLSET}'") endif() # Add build type specific options set(B2_OPTIONS_DBG - ${B2_OPTIONS} + ${B2_OPTIONS} + -sZLIB_BINARY=zlibd -sZLIB_LIBPATH="${CURRENT_INSTALLED_DIR}\\debug\\lib" + -sBZIP2_BINARY=bz2 + -sBZIP2_LIBPATH="${CURRENT_INSTALLED_DIR}\\debug\\lib" ) + set(B2_OPTIONS_REL - ${B2_OPTIONS} + ${B2_OPTIONS} + -sZLIB_BINARY=zlib -sZLIB_LIBPATH="${CURRENT_INSTALLED_DIR}\\lib" + -sBZIP2_BINARY=bz2 + -sBZIP2_LIBPATH="${CURRENT_INSTALLED_DIR}\\lib" ) -file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) +if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + message(FATAL_ERROR "Unable to remove directory: ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel\n Files are likely in use.") +endif() + +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) +if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + message(FATAL_ERROR "Unable to remove directory: ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg\n Files are likely in use.") +endif() + +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug) + message(FATAL_ERROR "Error: directory exists: ${CURRENT_PACKAGES_DIR}/debug\n The previous package was not fully cleared. This is an internal error.") +endif() message(STATUS "Building ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process_repeat( @@ -108,6 +139,11 @@ file( DESTINATION ${CURRENT_PACKAGES_DIR}/include ) +# Disable Boost auto-link. +file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp + "\n#define BOOST_ALL_NO_LIB\n" +) + if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp "\n#define BOOST_ALL_DYN_LINK\n" @@ -118,15 +154,18 @@ file(INSTALL ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/ message(STATUS "Packaging headers done") # This function makes the static build lib names match the dynamic build lib names which FindBoost.cmake is looking for by default. -# It also renames a couple of "libboost" lib files in the dynamic build (for example libboost_exception-vc140-mt-1_62.lib). +# It also renames a couple of "libboost" lib files in the dynamic build (for example libboost_exception-vc140-mt-1_63.lib). function(boost_rename_libs LIBS) foreach(LIB ${${LIBS}}) get_filename_component(OLD_FILENAME ${LIB} NAME) get_filename_component(DIRECTORY_OF_LIB_FILE ${LIB} DIRECTORY) string(REPLACE "libboost_" "boost_" NEW_FILENAME ${OLD_FILENAME}) string(REPLACE "-s-" "-" NEW_FILENAME ${NEW_FILENAME}) # For Release libs + string(REPLACE "-vc141-" "-vc140-" NEW_FILENAME ${NEW_FILENAME}) # To merge VS2017 and VS2015 binaries string(REPLACE "-sgd-" "-gd-" NEW_FILENAME ${NEW_FILENAME}) # For Debug libs - if (EXISTS ${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}) + if ("${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}" STREQUAL "${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}") + # nothing to do + elseif (EXISTS ${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}) file(REMOVE ${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME}) else() file(RENAME ${DIRECTORY_OF_LIB_FILE}/${OLD_FILENAME} ${DIRECTORY_OF_LIB_FILE}/${NEW_FILENAME}) @@ -143,7 +182,7 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) DESTINATION ${CURRENT_PACKAGES_DIR}/bin FILES_MATCHING PATTERN "*.dll") endif() -file(GLOB RELEASE_LIBS ${CURRENT_PACKAGES_DIR}/lib/libboost*.lib) +file(GLOB RELEASE_LIBS ${CURRENT_PACKAGES_DIR}/lib/*.lib) boost_rename_libs(RELEASE_LIBS) message(STATUS "Packaging ${TARGET_TRIPLET}-rel done") @@ -156,7 +195,7 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin FILES_MATCHING PATTERN "*.dll") endif() -file(GLOB DEBUG_LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/libboost*.lib) +file(GLOB DEBUG_LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/*.lib) boost_rename_libs(DEBUG_LIBS) message(STATUS "Packaging ${TARGET_TRIPLET}-dbg done") diff --git a/ports/boost/user-config.jam b/ports/boost/user-config.jam deleted file mode 100644 index 58184920a..000000000 --- a/ports/boost/user-config.jam +++ /dev/null @@ -1,10 +0,0 @@ -using msvc : 14.0 : : -<compileflags>"\"/AIC:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\LIB\\store\\references\"" -<linkflags>/appcontainer -<linkflags>/nodefaultlibs -<linkflags>WindowsApp.lib -<variant>release:<linkflags>vcruntime.lib -<variant>debug:<linkflags>vcruntimed.lib -<variant>release:<linkflags>ucrt.lib -<variant>debug:<linkflags>ucrtd.lib -; diff --git a/ports/boost/uwp/user-config.jam b/ports/boost/uwp/user-config.jam new file mode 100644 index 000000000..9dbbb352f --- /dev/null +++ b/ports/boost/uwp/user-config.jam @@ -0,0 +1,23 @@ +using msvc : 14.0 : : +<setup>echo +<compileflags>"\"/AIC:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\LIB\\store\\references\"" +<linkflags>/appcontainer +<linkflags>/nodefaultlibs +<linkflags>WindowsApp.lib +<variant>release:<linkflags>vcruntime.lib +<variant>debug:<linkflags>vcruntimed.lib +<variant>release:<linkflags>ucrt.lib +<variant>debug:<linkflags>ucrtd.lib +; + +using msvc : 14.1 : cl.exe : +<setup>echo +<compileflags>"\"/AIC:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\LIB\\store\\references\"" +<linkflags>/appcontainer +<linkflags>/nodefaultlibs +<linkflags>WindowsApp.lib +<variant>release:<linkflags>vcruntime.lib +<variant>debug:<linkflags>vcruntimed.lib +<variant>release:<linkflags>ucrt.lib +<variant>debug:<linkflags>ucrtd.lib +; diff --git a/ports/boost/vs2017/user-config.jam b/ports/boost/vs2017/user-config.jam new file mode 100644 index 000000000..8faba6d72 --- /dev/null +++ b/ports/boost/vs2017/user-config.jam @@ -0,0 +1,7 @@ +using msvc : 14.0 : cl.exe : +<setup>echo +; + +using msvc : 14.1 : cl.exe : +<setup>echo +; diff --git a/ports/bullet3/CONTROL b/ports/bullet3/CONTROL index fbbec8494..6320c6578 100644 --- a/ports/bullet3/CONTROL +++ b/ports/bullet3/CONTROL @@ -1,3 +1,3 @@ Source: bullet3 -Version: 2.83.7.98d4780 +Version: 2.86.1 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 index 2cd60a45f..17d6f8ea7 100644 --- a/ports/bullet3/portfile.cmake +++ b/ports/bullet3/portfile.cmake @@ -1,9 +1,9 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bullet3-98d47809b4273d97ea06c9b2137ada10af581bb9) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bullet3-2.86.1) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/bulletphysics/bullet3/archive/98d47809b4273d97ea06c9b2137ada10af581bb9.zip" - FILENAME "bullet3-98d47809b4273d97ea06c9b2137ada10af581bb9.zip" - SHA512 eaa3aa5ff124c87f153a9faeabe00955aaa2d87ed5d2297a96e02531eb7fd1286f2b654bd45401690747ca4391dd7c18486f4cbac0da7e835d52874345b9811d + URLS "https://github.com/bulletphysics/bullet3/archive/2.86.1.zip" + FILENAME "bullet3-2.86.1.zip" + SHA512 96c67bed63db4b7d46196cebda57b80543ea37bd19f013adcfe19ee6c2c3319ed007bcd1ebbe345d8c75b7e80588f4a7d85cb6a07e1a5eea759d97ce4d94f972 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -32,4 +32,4 @@ 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()
\ No newline at end of file +vcpkg_copy_pdbs() diff --git a/ports/bzip2/CMakeLists.txt b/ports/bzip2/CMakeLists.txt new file mode 100644 index 000000000..d5407cc5f --- /dev/null +++ b/ports/bzip2/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.0) +project(bzip2) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + add_definitions(-DBZ_DEBUG) # enable extra assertions +endif() + +set(LIBBZ2_SOURCES + blocksort.c + huffman.c + crctable.c + randtable.c + compress.c + decompress.c + bzlib.c) + +add_library(libbz2 ${LIBBZ2_SOURCES}) +set_target_properties(libbz2 PROPERTIES ARCHIVE_OUTPUT_NAME bz2) # reqiured for FindBzip2 to work +if(BUILD_SHARED_LIBS) + target_compile_definitions(libbz2 PRIVATE -DBZ_BUILD_DLL) +endif() + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +endif() + +install(TARGETS libbz2 + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +if(NOT BZIP2_SKIP_TOOLS) + add_executable(bzip2 bzip2.c ${LIBBZ2_SOURCES}) + add_executable(bzip2recover bzip2recover.c ${LIBBZ2_SOURCES}) + install(TARGETS bzip2 bzip2recover DESTINATION tools) +endif() + +if(NOT BZIP2_SKIP_HEADERS) + install(FILES bzlib.h DESTINATION include) +endif() diff --git a/ports/bzip2/CONTROL b/ports/bzip2/CONTROL new file mode 100644 index 000000000..365527454 --- /dev/null +++ b/ports/bzip2/CONTROL @@ -0,0 +1,3 @@ +Source: bzip2
+Version: 1.0.6
+Description: High-quality data compressor.
diff --git a/ports/bzip2/auto-define-import-macro.patch b/ports/bzip2/auto-define-import-macro.patch new file mode 100644 index 000000000..81492d3a5 --- /dev/null +++ b/ports/bzip2/auto-define-import-macro.patch @@ -0,0 +1,13 @@ +diff --git a/bzlib.h b/bzlib.h
+index e3ba1d6..d3bed44 100644
+--- a/bzlib.h
++++ b/bzlib.h
+@@ -26,6 +26,8 @@
+ extern "C" {
+ #endif
+
++#define BZ_IMPORT
++
+ #define BZ_RUN 0
+ #define BZ_FLUSH 1
+ #define BZ_FINISH 2
diff --git a/ports/bzip2/fix-import-export-macros.patch b/ports/bzip2/fix-import-export-macros.patch new file mode 100644 index 000000000..e3ee8494b --- /dev/null +++ b/ports/bzip2/fix-import-export-macros.patch @@ -0,0 +1,40 @@ +diff --git a/bzlib.h b/bzlib.h
+index 8277123..84fbd0a 100644
+--- a/bzlib.h
++++ b/bzlib.h
+@@ -65,29 +65,23 @@ typedef
+ }
+ bz_stream;
+
+-
+-#ifndef BZ_IMPORT
+-#define BZ_EXPORT
+-#endif
+-
+ #ifndef BZ_NO_STDIO
+ /* Need a definitition for FILE */
+ #include <stdio.h>
+ #endif
+
+ #ifdef _WIN32
+-# include <windows.h>
+ # ifdef small
+ /* windows.h define small to char */
+ # undef small
+ # endif
+-# ifdef BZ_EXPORT
+-# define BZ_API(func) WINAPI func
+-# define BZ_EXTERN extern
++# define BZ_API(func) func
++# if defined(BZ_BUILD_DLL)
++# define BZ_EXTERN __declspec(dllexport)
++# elif defined(BZ_IMPORT)
++# define BZ_EXTERN __declspec(dllimport)
+ # else
+- /* import windows dll dynamically */
+-# define BZ_API(func) (WINAPI * func)
+-# define BZ_EXTERN
++# define BZ_EXTERN
+ # endif
+ #else
+ # define BZ_API(func) func
diff --git a/ports/bzip2/portfile.cmake b/ports/bzip2/portfile.cmake new file mode 100644 index 000000000..67f56b6d8 --- /dev/null +++ b/ports/bzip2/portfile.cmake @@ -0,0 +1,35 @@ +
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bzip2-1.0.6)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
+ FILENAME "bzip2-1.0.6.tar.gz"
+ SHA512 00ace5438cfa0c577e5f578d8a808613187eff5217c35164ffe044fbafdfec9e98f4192c02a7d67e01e5a5ccced630583ad1003c37697219b0f147343a3fdd12)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/fix-import-export-macros.patch)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS_DEBUG
+ -DBZIP2_SKIP_HEADERS=ON
+ -DBZIP2_SKIP_TOOLS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/auto-define-import-macro.patch)
+endif()
+
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/bzip2)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/bzip2/LICENSE ${CURRENT_PACKAGES_DIR}/share/bzip2/copyright)
diff --git a/ports/cairo/CMakeLists_cairo.txt b/ports/cairo/CMakeLists_cairo.txt index f445605b9..85cf9457c 100644 --- a/ports/cairo/CMakeLists_cairo.txt +++ b/ports/cairo/CMakeLists_cairo.txt @@ -101,6 +101,8 @@ file(GLOB SOURCES "cairo-tor-scan-converter.c" "cairo-tor22-scan-converter.c" "cairo-clip-tor-scan-converter.c" +"cairo-tag-attributes.c" +"cairo-tag-stack.c" "cairo-toy-font-face.c" "cairo-traps.c" "cairo-tristrip.c" @@ -127,6 +129,7 @@ file(GLOB SOURCES "cairo-type1-subset.c" "cairo-type3-glyph-surface.c" # pdf +"cairo-pdf-interchange.c" "cairo-pdf-operators.c" "cairo-pdf-shading.c" "cairo-pdf-surface.c" @@ -140,6 +143,8 @@ file(GLOB SOURCES "cairo-svg-surface.c" # script surface "cairo-script-surface.c" +# fontconfig + freetype +"cairo-ft-font.c" ) set(CMAKE_DEBUG_POSTFIX "d") @@ -222,11 +227,36 @@ endif() add_library(user32 UNKNOWN IMPORTED) set_property(TARGET user32 PROPERTY IMPORTED_LOCATION "${USER32_LIBRARY}") +# Find dependencies of optional modules + +# Find FreeType +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(FREETYPE_SUFFIX d) +endif() +find_library(FREETYPE_LIBRARY freetype${FREETYPE_SUFFIX}) +if (FREETYPE_LIBRARY MATCHES NOTFOUND) + message(FATAL_ERROR "The freetype library could not be found. Check to ensure that it is properly installed.") +endif() + +# Cairo needs to be told which features of FreeType are availible +add_definitions( + -DHAVE_FT_GLYPHSLOT_EMBOLDEN=1 + -DHAVE_FT_LIBRARY_SETLCDFILTER=1 + -DHAVE_FT_GLYPHSLOT_OBLIQUE=1 + -DHAVE_FT_LOAD_SFNT_TABLE=1 + -DHAVE_FT_GET_X11_FONT_FORMAT=1) + +# Find FontConfig +find_library(FONTCONFIG_LIBRARY fontconfig) +if (FONTCONFIG_LIBRARY MATCHES NOTFOUND) + message(FATAL_ERROR "The fontconfig library could not be found. Check to ensure that it is properly installed.") +endif() + if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) add_library(cairo ${SOURCES}) # cairo produces a lot of warnings which are disabled here because they otherwise fill up the log files target_compile_options(cairo PUBLIC "/wd4244" PUBLIC "/wd4146" PUBLIC "/wd4312" PUBLIC "/wd4267" PUBLIC "/wd4996" PUBLIC "/wd4311" PUBLIC "/wd4334" PUBLIC "/wd4101") - target_link_libraries(cairo gdi32 msimg32 user32 zlib libpng pixman) + target_link_libraries(cairo gdi32 msimg32 user32 zlib libpng pixman ${FREETYPE_LIBRARY} ${FONTCONFIG_LIBRARY}) install(TARGETS cairo RUNTIME DESTINATION bin @@ -238,7 +268,7 @@ elseif (VCPKG_LIBRARY_LINKAGE STREQUAL static) target_compile_options(cairo-static PUBLIC "/DCAIRO_WIN32_STATIC_BUILD=1") # cairo produces a lot of warnings which are disabled here because they otherwise fill up the log files target_compile_options(cairo-static PUBLIC "/wd4244" PUBLIC "/wd4146" PUBLIC "/wd4312" PUBLIC "/wd4267" PUBLIC "/wd4996" PUBLIC "/wd4311" PUBLIC "/wd4334" PUBLIC "/wd4101") - target_link_libraries(cairo-static gdi32 msimg32 user32 zlib libpng pixman) + target_link_libraries(cairo-static gdi32 msimg32 user32 zlib libpng pixman ${FREETYPE_LIBRARY} ${FONTCONFIG_LIBRARY}) install(TARGETS cairo-static RUNTIME DESTINATION bin @@ -248,3 +278,36 @@ elseif (VCPKG_LIBRARY_LINKAGE STREQUAL static) else() message(FATAL_ERROR "VCPKG_LIBRARY_LINKAGE is not defined or has an unexpected value") endif() + +# GObject support module + +set(CAIRO_GOBJECT_SOURCES + "../util/cairo-gobject/cairo-gobject-enums.c" + "../util/cairo-gobject/cairo-gobject-structs.c") + +# GObject support sources do not include header with export macro +if(BUILD_SHARED_LIBS) + set_source_files_properties( + "../util/cairo-gobject/cairo-gobject-enums.c" + "../util/cairo-gobject/cairo-gobject-structs.c" + PROPERTIES COMPILE_DEFINITIONS cairo_public=__declspec\(dllexport\)) +endif() + +# Make GLib's GObject available +find_library(GLIB_LIBRARY NAMES glib-2.0) +find_library(GOBJECT_LIBRARY NAMES gobject-2.0) +set(GLIB_LIBRARIES ${GLIB_LIBRARY} ${GOBJECT_LIBRARY}) +if (GLIB_LIBRARIES MATCHES NOTFOUND) + message(FATAL_ERROR "The glib library could not be found. Check to ensure that it is properly installed.") +endif() + +add_library(cairo-gobject ${CAIRO_GOBJECT_SOURCES}) +if(BUILD_SHARED_LIBS) + target_link_libraries(cairo-gobject cairo ${GLIB_LIBRARIES}) +else() + target_link_libraries(cairo-gobject cairo-static ${GLIB_LIBRARIES}) +endif() +install(TARGETS cairo-gobject + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) diff --git a/ports/cairo/CONTROL b/ports/cairo/CONTROL index 017569c50..89ba03b79 100644 --- a/ports/cairo/CONTROL +++ b/ports/cairo/CONTROL @@ -1,4 +1,4 @@ Source: cairo -Version: 1.14.6 +Version: 1.15.4 Description: Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System (via both Xlib and XCB), Quartz, Win32, image buffers, PostScript, PDF, and SVG file output. Experimental backends include OpenGL, BeOS, OS/2, and DirectFB. -Build-Depends: zlib, libpng, pixman +Build-Depends: zlib, libpng, pixman, glib, freetype, fontconfig diff --git a/ports/cairo/cairo-features.h b/ports/cairo/cairo-features.h index b9277b7f7..3a1963974 100644 --- a/ports/cairo/cairo-features.h +++ b/ports/cairo/cairo-features.h @@ -24,4 +24,13 @@ #define CAIRO_HAS_OBSERVER_SURFACE 1 #define CAIRO_HAS_USER_FONT 1 +/* Require GObject */ +#define CAIRO_HAS_GOBJECT_FUNCTIONS 1 + +/* Require FreeType */ +#define CAIRO_HAS_FT_FONT 1 + +/* Require FontConfig */ +#define CAIRO_HAS_FC_FONT 1 + #endif diff --git a/ports/cairo/portfile.cmake b/ports/cairo/portfile.cmake index 2131bd146..57b45e91c 100644 --- a/ports/cairo/portfile.cmake +++ b/ports/cairo/portfile.cmake @@ -7,11 +7,11 @@ # include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cairo-1.14.6) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cairo-1.15.4) vcpkg_download_distfile(ARCHIVE - URLS "https://www.cairographics.org/releases/cairo-1.14.6.tar.xz" - FILENAME "cairo-1.14.6.tar.xz" - SHA512 e2aa17a33b95b68d407b53ac321cca15b0c148eb49b8639c75b2af1e75e7b417a2168ea978dabb8581b341f0f45dc042d3b1a56b01ab525b1984015f0865316b + URLS "http://cairographics.org/snapshots/cairo-1.15.4.tar.xz" + FILENAME "cairo-1.15.4.tar.xz" + SHA512 ac3e6879fcf0876bca9f801cdf9e970ef1822644228cdd21962d0bf5db5fc074973f4ae651eb9c76b44fffd405cf0a0c7cbb228dba96b835ea137a2740277ee9 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -43,6 +43,8 @@ file(COPY "${SOURCE_PATH}/src/cairo-svg.h" "${SOURCE_PATH}/cairo-version.h" "${SOURCE_PATH}/src/cairo-win32.h" +"${SOURCE_PATH}/util/cairo-gobject/cairo-gobject.h" +"${SOURCE_PATH}/src/cairo-ft.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include ) diff --git a/ports/catch/CONTROL b/ports/catch/CONTROL index 893563e15..148369add 100644 --- a/ports/catch/CONTROL +++ b/ports/catch/CONTROL @@ -1,3 +1,3 @@ Source: catch -Version: 1.5.7 +Version: 1.8.1 Description: C++ Automated Test Cases in Headers diff --git a/ports/catch/portfile.cmake b/ports/catch/portfile.cmake index 5575af742..1f3472c34 100644 --- a/ports/catch/portfile.cmake +++ b/ports/catch/portfile.cmake @@ -10,9 +10,9 @@ include(vcpkg_common_functions) vcpkg_download_distfile(HEADER - URLS "https://raw.githubusercontent.com/philsquared/Catch/e27c4ee04282f60aefcc9b1062a74f92cf6c1a2b/single_include/catch.hpp" + URLS "https://github.com/philsquared/Catch/releases/download/v1.8.1/catch.hpp" FILENAME "catch.hpp" - SHA512 c2fec38227bb1725c30f955583dbd012f86eef83512a0c154e91b77249df372db067710ae110463eb07adec722d214114fd6a2cebff7ee43c5fd567a6a1ba221 + SHA512 942acee9ac54d170a79f4624ce62bc5d9327a863f5565352eb71f2c028d35c2042bf0416530cb8288b27ed78a46d0d02dfaba47e1d79ae9b394943771543ea3f ) vcpkg_download_distfile(LICENSE diff --git a/ports/cereal/CONTROL b/ports/cereal/CONTROL new file mode 100644 index 000000000..3c598a735 --- /dev/null +++ b/ports/cereal/CONTROL @@ -0,0 +1,3 @@ +Source: cereal +Version: 1.2.1 +Description: a header-only C++11 serialization library (built in support for binary, XML and JSon) diff --git a/ports/cereal/portfile.cmake b/ports/cereal/portfile.cmake new file mode 100644 index 000000000..f6555416c --- /dev/null +++ b/ports/cereal/portfile.cmake @@ -0,0 +1,16 @@ +#header-only library +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cereal-1.2.1) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/USCiLab/cereal/archive/v1.2.1.tar.gz" + FILENAME "cereal-1.2.1.tar.gz" + SHA512 f0050f27433a4b544e7785aa94fc7b14a57eed6d542e25d3d0fda4d27cf55ea55e796be2138bf80809c96c392436513fe42764b3a456938395bf7f7177dd1c73 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cereal) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/cereal/LICENSE ${CURRENT_PACKAGES_DIR}/share/cereal/copyright) + +# Copy the cereal header files +file(COPY ${SOURCE_PATH}/include/cereal DESTINATION ${CURRENT_PACKAGES_DIR}/include)
\ No newline at end of file diff --git a/ports/chakracore/CONTROL b/ports/chakracore/CONTROL index 593691bbf..24300fdfa 100644 --- a/ports/chakracore/CONTROL +++ b/ports/chakracore/CONTROL @@ -1,3 +1,3 @@ Source: chakracore -Version: 1.3.1 +Version: 1.4.0 Description: Core part of the Chakra Javascript engine
\ No newline at end of file diff --git a/ports/chakracore/disable_warning_as_error.patch b/ports/chakracore/disable_warning_as_error.patch new file mode 100644 index 000000000..da7b5da77 --- /dev/null +++ b/ports/chakracore/disable_warning_as_error.patch @@ -0,0 +1,20 @@ +diff --git a/bin/NativeTests/NativeTests.vcxproj b/bin/NativeTests/NativeTests.vcxproj +index d020992..ac70a65 100644 +--- a/bin/NativeTests/NativeTests.vcxproj ++++ b/bin/NativeTests/NativeTests.vcxproj +@@ -30,6 +30,15 @@ + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <SmallerTypeCheck>false</SmallerTypeCheck> + <MinimalRebuild>false</MinimalRebuild> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</TreatWarningAsError> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</TreatWarningAsError> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Test|Win32'">false</TreatWarningAsError> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</TreatWarningAsError> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</TreatWarningAsError> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Test|ARM'">false</TreatWarningAsError> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</TreatWarningAsError> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</TreatWarningAsError> ++ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Test|x64'">false</TreatWarningAsError> + <!-- <CallingConvention Condition="'$(Platform)'=='Win32'">CDecl</CallingConvention> --> + </ClCompile> + <Link> diff --git a/ports/chakracore/portfile.cmake b/ports/chakracore/portfile.cmake index 639cf0f65..b6aa94b4a 100644 --- a/ports/chakracore/portfile.cmake +++ b/ports/chakracore/portfile.cmake @@ -4,14 +4,20 @@ endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ChakraCore-1.3.1) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ChakraCore-1.4.1) vcpkg_download_distfile(ARCHIVE_FILE - URLS "https://github.com/Microsoft/ChakraCore/archive/v1.3.1.tar.gz" - FILENAME "ChakraCore-1.3.1.tar.gz" - SHA512 52216a03333e44bce235917cfae5ccd6a756056678d9b81c63ec272d9ce5c6afabc673e7910dd3da54fda7927ea62ede980a4371dbb08f6ce4907121c27dbc53 + URLS "https://github.com/Microsoft/ChakraCore/archive/v1.4.1.tar.gz" + FILENAME "ChakraCore-1.4.1.tar.gz" + SHA512 9ca89de88a4d6102826ce4e301ea81b70296cca72131043f9942de715dee2862791c6f33ebce1f12fcafc1554a872a2cf9317313d56c57abff0a6d814a77f2d5 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/disable_warning_as_error.patch +) + vcpkg_build_msbuild( PROJECT_PATH ${SOURCE_PATH}/Build/Chakra.Core.sln ) @@ -19,6 +25,8 @@ vcpkg_build_msbuild( file(INSTALL ${SOURCE_PATH}/lib/jsrt/ChakraCore.h ${SOURCE_PATH}/lib/jsrt/ChakraCommon.h + ${SOURCE_PATH}/lib/jsrt/ChakraCommonWindows.h + ${SOURCE_PATH}/lib/jsrt/ChakraDebug.h DESTINATION ${CURRENT_PACKAGES_DIR}/include ) file(INSTALL @@ -40,5 +48,11 @@ file(INSTALL DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) file(INSTALL + ${SOURCE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/ch.exe + ${SOURCE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/GCStress.exe + ${SOURCE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/rl.exe + DESTINATION ${CURRENT_PACKAGES_DIR}/tools/chakracore) +vcpkg_copy_pdbs() +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/ChakraCore RENAME copyright) diff --git a/ports/clockutils/CONTROL b/ports/clockutils/CONTROL index 4ade8d5f0..8f88e71ec 100644 --- a/ports/clockutils/CONTROL +++ b/ports/clockutils/CONTROL @@ -1,3 +1,3 @@ Source: clockutils -Version: 1.1.1 +Version: 1.1.1-3651f232c27074c4ceead169e223edf5f00247c5 Description: A lightweight c++ library for commonly needed tasks. Optimized for simplicity and speed. diff --git a/ports/clockutils/portfile.cmake b/ports/clockutils/portfile.cmake index c078673a6..33f0b1f83 100644 --- a/ports/clockutils/portfile.cmake +++ b/ports/clockutils/portfile.cmake @@ -1,9 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/clockUtils-1.1.1) +set(VERSION 3651f232c27074c4ceead169e223edf5f00247c5) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/clockUtils-${VERSION}) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/ClockworkOrigins/clockUtils/archive/1.1.1.tar.gz" - FILENAME "clockUtils-1.1.1.tar.gz" - SHA512 6b0c57862baf04c0c5529549ba13983e53445172d9a272571aa20968ba6dba15f1cf480096ca100d450218fef090805366d0564c77a4aa4721a4fe694a0481c9 + URLS "https://github.com/ClockworkOrigins/clockUtils/archive/${VERSION}.tar.gz" + FILENAME "clockUtils-${VERSION}.tar.gz" + SHA512 ddb70cae9ced25de77a2df1854dac15e58a77347042ba3ee9c691f85f49edbc6539c84929a7477d429fb9161ba24c57d24d767793b8b1180216d5ddfc5d3ed6a ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -33,5 +34,6 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/clockUtils) file(RENAME ${CURRENT_PACKAGES_DIR}/share/clockUtils/LICENSE ${CURRENT_PACKAGES_DIR}/share/clockUtils/copyright) file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE) vcpkg_copy_pdbs()
\ No newline at end of file diff --git a/ports/cpprestsdk/CONTROL b/ports/cpprestsdk/CONTROL index b3438026f..f284f2b53 100644 --- a/ports/cpprestsdk/CONTROL +++ b/ports/cpprestsdk/CONTROL @@ -1,5 +1,5 @@ Source: cpprestsdk -Version: 2.9.0-1 -Build-Depends: zlib [windows], openssl [windows], boost [windows] +Version: 2.9.0-2 +Build-Depends: zlib [windows], openssl [windows], boost [windows], websocketpp [windows] Description: C++11 JSON, REST, and OAuth library The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
\ No newline at end of file diff --git a/ports/cpprestsdk/portfile.cmake b/ports/cpprestsdk/portfile.cmake index d1b5fa7f6..f92c5147a 100644 --- a/ports/cpprestsdk/portfile.cmake +++ b/ports/cpprestsdk/portfile.cmake @@ -15,9 +15,13 @@ vcpkg_apply_patches( ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch ) +SET(WEBSOCKETPP_PATH "${CURRENT_INSTALLED_DIR}/share/websocketpp") + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/Release OPTIONS + -DWEBSOCKETPP_CONFIG=${WEBSOCKETPP_PATH} + -DWEBSOCKETPP_CONFIG_VERSION=${WEBSOCKETPP_PATH} -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DCPPREST_EXCLUDE_WEBSOCKETS=OFF diff --git a/ports/cppwinrt/CONTROL b/ports/cppwinrt/CONTROL index 7833d33ee..e49eefe99 100644 --- a/ports/cppwinrt/CONTROL +++ b/ports/cppwinrt/CONTROL @@ -1,3 +1,3 @@ Source: cppwinrt -Version: 1.010.0.14393.0 +Version: feb2017_refresh-14393 Description: C++/WinRT is a standard C++ language projection for the Windows Runtime. diff --git a/ports/cppwinrt/portfile.cmake b/ports/cppwinrt/portfile.cmake index 452911172..b0e808c84 100644 --- a/ports/cppwinrt/portfile.cmake +++ b/ports/cppwinrt/portfile.cmake @@ -1,32 +1,13 @@ -#header-only library include(vcpkg_common_functions) find_program(GIT git) -set(GIT_URL "https://github.com/Microsoft/cppwinrt") -set(GIT_REF "9e01842") - -if(NOT EXISTS "${DOWNLOADS}/cppwinrt.git") - message(STATUS "Cloning") - vcpkg_execute_required_process( - COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/cppwinrt.git - WORKING_DIRECTORY ${DOWNLOADS} - LOGNAME clone - ) -endif() -message(STATUS "Cloning done") - -if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") - message(STATUS "Adding worktree") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}) - vcpkg_execute_required_process( - COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REF} - WORKING_DIRECTORY ${DOWNLOADS}/cppwinrt.git - LOGNAME worktree - ) -endif() -message(STATUS "Adding worktree done") - -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cppwinrt-february_2017_refresh) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/Microsoft/cppwinrt/archive/february_2017_refresh.tar.gz" + FILENAME "cppwinrt-february_2017_refresh.tar.gz" + SHA512 0e2ed94d65ae4c7297ae4d82d64a43fa59fac7b35fbe42ea939f135f0f6eb867f57fac70b6a9cc9a78912de75aa4482d48007f83a3781b147d237ae637fdaa0e +) +vcpkg_extract_source_archive(${ARCHIVE}) # Put the licence file where vcpkg expects it file(COPY ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cppwinrt/license.txt) diff --git a/ports/cuda/CONTROL b/ports/cuda/CONTROL new file mode 100644 index 000000000..00df3011c --- /dev/null +++ b/ports/cuda/CONTROL @@ -0,0 +1,3 @@ +Source: cuda +Version: 8.0 +Description: A parallel computing platform and programming model
\ No newline at end of file diff --git a/ports/cuda/portfile.cmake b/ports/cuda/portfile.cmake new file mode 100644 index 000000000..3b20afe0f --- /dev/null +++ b/ports/cuda/portfile.cmake @@ -0,0 +1,34 @@ +# Due to the complexity involved, this package doesn't install CUDA. It instead verifies that CUDA is installed. +# Other packages can depend on this package to declare a dependency on CUDA. +# If this package is installed, we assume that CUDA is properly installed. + +execute_process( + COMMAND nvcc --version + OUTPUT_VARIABLE NVCC_OUTPUT + RESULT_VARIABLE error_code) + +# Sample output +# NVIDIA (R) Cuda compiler driver +# Copyright (c) 2005-2016 NVIDIA Corporation +# Built on Sat_Sep__3_19:05:48_CDT_2016 +# Cuda compilation tools, release 8.0, V8.0.44 +set(CUDA_REQUIRED_VERSION "V8.0.0") + +if (${error_code}) + message(FATAL_ERROR "CUDA is not installed. Before continuing, please download and install CUDA (${CUDA_REQUIRED_VERSION} or higher) from:" + "\n https://developer.nvidia.com/cuda-downloads \n") +endif() + +string(REGEX MATCH "V([0-9]+)\\.([0-9]+)\\.([0-9]+)" CUDA_VERSION ${NVCC_OUTPUT}) +message(STATUS "Found CUDA ${CUDA_VERSION}") +set(CUDA_VERSION_MAJOR ${CMAKE_MATCH_1}) +#set(CUDA_VERSION_MINOR ${CMAKE_MATCH_2}) +#set(CUDA_VERSION_PATCH ${CMAKE_MATCH_3}) + + +if (${CUDA_VERSION_MAJOR} LESS 8) + message(FATAL_ERROR "CUDA ${CUDA_VERSION} but ${CUDA_REQUIRED_VERSION} is required. Please download and install a more recent version of CUDA from:" + "\n https://developer.nvidia.com/cuda-downloads \n") +endif() + +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
\ No newline at end of file diff --git a/ports/curl/0002_fix_uwp.patch b/ports/curl/0002_fix_uwp.patch new file mode 100644 index 000000000..5cd0678cf --- /dev/null +++ b/ports/curl/0002_fix_uwp.patch @@ -0,0 +1,109 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ed3f38a..d6480b7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1010,7 +1010,9 @@ include(CMake/OtherTests.cmake) + add_definitions(-DHAVE_CONFIG_H) + + # For windows, do not allow the compiler to use default target (Vista). +-if(WIN32) ++if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") ++ add_definitions(-D_WIN32_WINNT=0x0A00 -DHAVE_STRUCT_POLLFD -D_WINSOCK_DEPRECATED_NO_WARNINGS) ++elseif(WIN32) + add_definitions(-D_WIN32_WINNT=0x0501) + endif(WIN32) + +diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c +index 2591fd8..cef38ac 100644 +--- a/lib/curl_gethostname.c ++++ b/lib/curl_gethostname.c +@@ -21,6 +21,7 @@ + ***************************************************************************/ + + #include "curl_setup.h" ++#include "curl/curl.h" + + #include "curl_gethostname.h" + +@@ -64,9 +65,10 @@ int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) { + #ifdef DEBUGBUILD + + /* Override host name when environment variable CURL_GETHOSTNAME is set */ +- const char *force_hostname = getenv("CURL_GETHOSTNAME"); ++ char *force_hostname = curl_getenv("CURL_GETHOSTNAME"); + if(force_hostname) { + strncpy(name, force_hostname, namelen); ++ free(force_hostname); + err = 0; + } + else { +diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c +index 812a073..02c8416 100644 +--- a/lib/curl_ntlm_core.c ++++ b/lib/curl_ntlm_core.c +@@ -696,9 +696,12 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, + + /* Calculate the timestamp */ + #ifdef DEBUGBUILD +- char *force_timestamp = getenv("CURL_FORCETIME"); +- if(force_timestamp) ++ char *force_timestamp = curl_getenv("CURL_FORCETIME"); ++ if (force_timestamp) ++ { + tw = CURL_OFF_T_C(11644473600) * 10000000; ++ free(force_timestamp); ++ } + else + #endif + tw = ((curl_off_t)time(NULL) + CURL_OFF_T_C(11644473600)) * 10000000; +diff --git a/lib/ftp.c b/lib/ftp.c +index b231731..d50779f 100644 +--- a/lib/ftp.c ++++ b/lib/ftp.c +@@ -3250,7 +3250,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status, + ssize_t nread; + int ftpcode; + CURLcode result = CURLE_OK; +- char *path; ++ char *path = NULL; + const char *path_to_use = data->state.path; + + if(!ftp) +diff --git a/lib/smb.c b/lib/smb.c +index 7cb0c96..2f43d3c 100644 +--- a/lib/smb.c ++++ b/lib/smb.c +@@ -32,8 +32,12 @@ + + #ifdef HAVE_PROCESS_H + #include <process.h> ++#if defined(CURL_WINDOWS_APP) ++#define getpid GetCurrentProcessId ++#else + #define getpid _getpid + #endif ++#endif + + #include "smb.h" + #include "urldata.h" +diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c +index 56a8823..5a895ed 100644 +--- a/lib/vtls/vtls.c ++++ b/lib/vtls/vtls.c +@@ -197,7 +197,7 @@ unsigned int Curl_rand(struct Curl_easy *data) + static bool seeded = FALSE; + + #ifdef CURLDEBUG +- char *force_entropy = getenv("CURL_ENTROPY"); ++ char *force_entropy = curl_getenv("CURL_ENTROPY"); + if(force_entropy) { + if(!seeded) { + size_t elen = strlen(force_entropy); +@@ -208,6 +208,7 @@ unsigned int Curl_rand(struct Curl_easy *data) + } + else + randseed++; ++ free(force_entropy); + return randseed; + } + #endif diff --git a/ports/curl/CONTROL b/ports/curl/CONTROL index e18ea2f67..9ae7e7e52 100644 --- a/ports/curl/CONTROL +++ b/ports/curl/CONTROL @@ -1,4 +1,4 @@ Source: curl -Version: 7.51.0-2 +Version: 7.51.0-3 Build-Depends: zlib, openssl, libssh2 Description: A library for transferring data with URLs diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index 01c76718b..35bfbd592 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -11,6 +11,7 @@ vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch + ${CMAKE_CURRENT_LIST_DIR}/0002_fix_uwp.patch ) if (VCPKG_CRT_LINKAGE STREQUAL dynamic) @@ -19,16 +20,34 @@ else() SET(CURL_STATICLIB ON) endif() -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - -DBUILD_TESTING=OFF - -DBUILD_CURL_EXE=OFF - -DENABLE_MANUAL=OFF - -DCURL_STATICLIB=${CURL_STATICLIB} - OPTIONS_DEBUG - -DENABLE_DEBUG=ON -) +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DBUILD_TESTING=OFF + -DBUILD_CURL_EXE=OFF + -DENABLE_MANUAL=OFF + -DUSE_WIN32_LDAP=OFF + -DCURL_DISABLE_TELNET=ON + -DENABLE_IPV6=OFF + -DENABLE_UNIX_SOCKETS=OFF + -DCMAKE_USE_OPENSSL=ON + -DCURL_STATICLIB=${CURL_STATICLIB} + OPTIONS_DEBUG + -DENABLE_DEBUG=ON + ) +else() + vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DBUILD_TESTING=OFF + -DBUILD_CURL_EXE=OFF + -DENABLE_MANUAL=OFF + -DCURL_STATICLIB=${CURL_STATICLIB} + OPTIONS_DEBUG + -DENABLE_DEBUG=ON + ) +endif() vcpkg_install_cmake() diff --git a/ports/directxmesh/CONTROL b/ports/directxmesh/CONTROL new file mode 100644 index 000000000..13401f80d --- /dev/null +++ b/ports/directxmesh/CONTROL @@ -0,0 +1,3 @@ +Source: directxmesh
+Version: oct2016
+Description: DirectXMesh geometry processing library
\ No newline at end of file diff --git a/ports/directxmesh/portfile.cmake b/ports/directxmesh/portfile.cmake new file mode 100644 index 000000000..184784d48 --- /dev/null +++ b/ports/directxmesh/portfile.cmake @@ -0,0 +1,52 @@ +# 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}
+#
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ message(STATUS "Warning: Dynamic building not supported yet. Building static.")
+ set(VCPKG_LIBRARY_LINKAGE static)
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXMesh-oct2016)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Microsoft/DirectXMesh/archive/oct2016.tar.gz"
+ FILENAME "DirectXMesh-oct2016.tar.gz"
+ SHA512 8aaf9749766afd23709ce6c6f8d74b008fe9f96789e4d97cb387633dad34b4132ef28dfe028d13c779ea366428d53076a881c0d63c4f0c2c74d552293c8d6bf1
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ SET(BUILD_ARCH "Win32")
+ELSE()
+ SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
+ENDIF()
+
+vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/DirectXMesh_Desktop_2015.sln
+ PLATFORM ${BUILD_ARCH}
+)
+
+file(INSTALL
+ ${SOURCE_PATH}/DirectXMesh/DirectXMesh.h
+ ${SOURCE_PATH}/DirectXMesh/DirectXMesh.inl
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+)
+file(INSTALL
+ ${SOURCE_PATH}/DirectXMesh/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DirectXMesh.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+file(INSTALL
+ ${SOURCE_PATH}/DirectXMesh/Bin/Desktop_2015/${BUILD_ARCH}/Release/DirectXMesh.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+
+set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools)
+file(INSTALL
+ ${SOURCE_PATH}/Meshconvert/Bin/Desktop_2015/${BUILD_ARCH}/Release/Meshconvert.exe
+ DESTINATION ${TOOL_PATH})
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/directxmesh)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/directxmesh/LICENSE ${CURRENT_PACKAGES_DIR}/share/directxmesh/copyright)
diff --git a/ports/directxtex/CONTROL b/ports/directxtex/CONTROL new file mode 100644 index 000000000..b11daa8d4 --- /dev/null +++ b/ports/directxtex/CONTROL @@ -0,0 +1,3 @@ +Source: directxtex
+Version: dec2016
+Description: DirectXTex texture processing library
\ No newline at end of file diff --git a/ports/directxtex/portfile.cmake b/ports/directxtex/portfile.cmake new file mode 100644 index 000000000..70bb16658 --- /dev/null +++ b/ports/directxtex/portfile.cmake @@ -0,0 +1,59 @@ +# 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}
+#
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ message(STATUS "Warning: Dynamic building not supported yet. Building static.")
+ set(VCPKG_LIBRARY_LINKAGE static)
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/directxtex-dec2016)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Microsoft/DirectXTex/archive/dec2016.tar.gz"
+ FILENAME "directxtex-dec2016.tar.gz"
+ SHA512 87797340c40a98a7b11b6eb7da17d0b93bc01ba48deed50e99ce74e0e33387cac2ec18f2f14d0148c2a79f97ca98d6b2a228dad2f16010b6dcf03c0d24a79d20
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ SET(BUILD_ARCH "Win32")
+ELSE()
+ SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
+ENDIF()
+
+vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/DirectXTex_Desktop_2015.sln
+ PLATFORM ${BUILD_ARCH}
+)
+
+file(INSTALL
+ ${SOURCE_PATH}/DirectXTex/DirectXTex.h
+ ${SOURCE_PATH}/DirectXTex/DirectXTex.inl
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+)
+file(INSTALL
+ ${SOURCE_PATH}/DirectXTex/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DirectXTex.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+file(INSTALL
+ ${SOURCE_PATH}/DirectXTex/Bin/Desktop_2015/${BUILD_ARCH}/Release/DirectXTex.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+
+set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools)
+file(MAKE_DIRECTORY ${TOOL_PATH})
+file(INSTALL
+ ${SOURCE_PATH}/Texdiag/Bin/Desktop_2015/${BUILD_ARCH}/Release/texdiag.exe
+ DESTINATION ${TOOL_PATH})
+file(INSTALL
+ ${SOURCE_PATH}/Texconv/Bin/Desktop_2015/${BUILD_ARCH}/Release/Texconv.exe
+ DESTINATION ${TOOL_PATH})
+file(INSTALL
+ ${SOURCE_PATH}/Texassemble/Bin/Desktop_2015/${BUILD_ARCH}/Release/Texassemble.exe
+ DESTINATION ${TOOL_PATH})
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/DirectXTex)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/DirectXTex/LICENSE ${CURRENT_PACKAGES_DIR}/share/DirectXTex/copyright)
diff --git a/ports/directxtk/CONTROL b/ports/directxtk/CONTROL index b5e0bcb7d..97f97ecd9 100644 --- a/ports/directxtk/CONTROL +++ b/ports/directxtk/CONTROL @@ -1,3 +1,3 @@ Source: directxtk -Version: oct2016-1 +Version: dec2016-1 Description: A collection of helper classes for writing DirectX 11.x code in C++. diff --git a/ports/directxtk/portfile.cmake b/ports/directxtk/portfile.cmake index c14b7c6aa..fc4418d75 100644 --- a/ports/directxtk/portfile.cmake +++ b/ports/directxtk/portfile.cmake @@ -4,11 +4,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK-oct2016) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK-dec2016) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Microsoft/DirectXTK/archive/oct2016.tar.gz" - FILENAME "oct2016.tar.gz" - SHA512 b44ee28518ca65d38a3c915881ef79533b48b07d3738b616f1935d7c00a26d5e48b2292cde6acc34e933f85ba2a6362c585c60b2bbc704745d43cef53769a112 + URLS "https://github.com/Microsoft/DirectXTK/archive/dec2016.tar.gz" + FILENAME "DirectXTK-dec2016.tar.gz" + SHA512 efb8a98d0872bf1835b274ba88615e88c4a58ab753c5ebef5a407c54d5f9a2197d1521f14651c60ea16c047918db6f54bf2ac58a6eb7330490b9bae619e8dad3 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -19,16 +19,16 @@ ELSE() ENDIF() vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/DirectXTK_Desktop_2015_Win10.sln + PROJECT_PATH ${SOURCE_PATH}/DirectXTK_Desktop_2015.sln PLATFORM ${BUILD_ARCH} ) file(INSTALL - ${SOURCE_PATH}/Bin/Desktop_2015_Win10/${BUILD_ARCH}/Release/DirectXTK.lib + ${SOURCE_PATH}/Bin/Desktop_2015/${BUILD_ARCH}/Release/DirectXTK.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) file(INSTALL - ${SOURCE_PATH}/Bin/Desktop_2015_Win10/${BUILD_ARCH}/Debug/DirectXTK.lib + ${SOURCE_PATH}/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DirectXTK.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) set(DXTK_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/directxtk) diff --git a/ports/directxtk12/CONTROL b/ports/directxtk12/CONTROL index dd9ca5620..60393a1d9 100644 --- a/ports/directxtk12/CONTROL +++ b/ports/directxtk12/CONTROL @@ -1,3 +1,3 @@ Source: directxtk12 -Version: oct2016 +Version: dec2016 Description: A collection of helper classes for writing DirectX 12 code in C++. diff --git a/ports/directxtk12/portfile.cmake b/ports/directxtk12/portfile.cmake index 19372a3b1..e6f2fb4d8 100644 --- a/ports/directxtk12/portfile.cmake +++ b/ports/directxtk12/portfile.cmake @@ -4,11 +4,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK12-oct2016) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK12-dec2016) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Microsoft/DirectXTK12/archive/oct2016.tar.gz" - FILENAME "DirectXTK12-oct2016.tar.gz" - SHA512 f33af80dc018c1fda117eeef66bd08046b48572806d879651187cbed9d5ceb402b1798ecc0e1089b54ddb879e5355b45f2b67e3be99fbe270c5216a945a9924b + URLS "https://github.com/Microsoft/DirectXTK12/archive/dec2016.tar.gz" + FILENAME "DirectXTK12-dec2016.tar.gz" + SHA512 7c98fbf1d7ef96807a38d396a87dacdc60fdcd7e461210d246cc424789c4c5c5fb1390db958c1bd1f77da8af756a9eae36813e5da6bbb0ea1432ff4004f1d010 ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/dlib/CONTROL b/ports/dlib/CONTROL new file mode 100644 index 000000000..91ce3eb57 --- /dev/null +++ b/ports/dlib/CONTROL @@ -0,0 +1,3 @@ +Source: dlib +Version: 19.2 +Description: Modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ diff --git a/ports/dlib/portfile.cmake b/ports/dlib/portfile.cmake new file mode 100644 index 000000000..3ef3f840e --- /dev/null +++ b/ports/dlib/portfile.cmake @@ -0,0 +1,45 @@ +# 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(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/dlib-19.2) +vcpkg_download_distfile(ARCHIVE + URLS "http://dlib.net/files/dlib-19.2.tar.bz2" + FILENAME "dlib-19.2.tar.bz2" + SHA512 dcef5c8be52fe2650c1eccac6c7ac4050075dc07ee504a8bf3df6c9a597da5fdc09506e631abfa979d71c74940ce39ec5267be4c3a676a01ac66fcb14cbfe854 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +# There is no way to suppress installation of the headers and resource files in debug build. +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/test) + +# Remove other files not required in package +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/all) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/external/libpng/arm) + +# Handle copyright +#file(COPY ${SOURCE_PATH}/docs/license.html DESTINATION ${CURRENT_PACKAGES_DIR}/share/dlib) +file(COPY ${CURRENT_PACKAGES_DIR}/share/doc/dlib/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/dlib) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/dlib/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/dlib/COPYRIGHT) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
\ No newline at end of file diff --git a/ports/dx/CONTROL b/ports/dx/CONTROL new file mode 100644 index 000000000..ac226a66a --- /dev/null +++ b/ports/dx/CONTROL @@ -0,0 +1,3 @@ +Source: dx
+Version: 1.0.1
+Description: A modern C++ library for DirectX programming
\ No newline at end of file diff --git a/ports/dx/portfile.cmake b/ports/dx/portfile.cmake new file mode 100644 index 000000000..d607e5ed0 --- /dev/null +++ b/ports/dx/portfile.cmake @@ -0,0 +1,20 @@ +#header-only library
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/dx-1.0.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/sdcb/dx/archive/v1.0.1.tar.gz"
+ FILENAME "dx-1.0.1.tar.gz"
+ SHA512 b40eb4daf774bfdb394b207bb29652fbf44361f5d8f9b60509c7a3215cd403dbf0c10454979c0c2e97d839496ef20940070a42837375993cd67d58afacc990e0
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(INSTALL
+ ${SOURCE_PATH}/dx.h
+ ${SOURCE_PATH}/debug.h
+ ${SOURCE_PATH}/handle.h
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include/dx
+)
+
+file(INSTALL
+ ${SOURCE_PATH}/LICENSE
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/dx RENAME copyright)
\ No newline at end of file diff --git a/ports/eigen3/portfile.cmake b/ports/eigen3/portfile.cmake index 0a1e88e47..5b80225d8 100644 --- a/ports/eigen3/portfile.cmake +++ b/ports/eigen3/portfile.cmake @@ -1,10 +1,10 @@ #header-only library include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/eigen-eigen-26667be4f70b) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/eigen-eigen-67e894c6cd8f) vcpkg_download_distfile(ARCHIVE - URLS "http://bitbucket.org/eigen/eigen/get/3.3.0.tar.bz2" - FILENAME "eigen-3.3.0.tar.bz2" - SHA512 a1919accc9fcf64eca17b3e60a78eefeb1a187c261c28b8480604f36cf366cd6323e966d6b948f8a4ce0ae3213a3815bccd34661d1d8fb33315def4304bf163e + URLS "http://bitbucket.org/eigen/eigen/get/3.3.3.tar.bz2" + FILENAME "eigen-3.3.3.tar.bz2" + SHA512 bb5a8b761371e516f0a344a7c9f6e369e21c2907c8548227933ca6010fc607a66c8d6ff7c41b1aec3dea7d482ce8c2a09e38ae5c7a2c5b16bdd8007e7a81ecc3 ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/ffmpeg/CONTROL b/ports/ffmpeg/CONTROL new file mode 100644 index 000000000..eea91d568 --- /dev/null +++ b/ports/ffmpeg/CONTROL @@ -0,0 +1,4 @@ +Source: ffmpeg +Version: 3.2.4-2 +Description: a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. + FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
\ No newline at end of file diff --git a/ports/ffmpeg/build.sh b/ports/ffmpeg/build.sh new file mode 100644 index 000000000..3474a111e --- /dev/null +++ b/ports/ffmpeg/build.sh @@ -0,0 +1,17 @@ +#!/usr/bin/bash +set -e +export PATH=/usr/bin:$PATH +pacman -Sy --noconfirm --needed diffutils make + +PATH_TO_BUILD_DIR="`cygpath "$1"`" +PATH_TO_SRC_DIR="`cygpath "$2"`" +PATH_TO_PACKAGE_DIR="`cygpath "$3"`" +# Note: $4 is extra configure options + +cd "$PATH_TO_BUILD_DIR" +echo "=== CONFIGURING ===" +"$PATH_TO_SRC_DIR/configure" --toolchain=msvc "--prefix=$PATH_TO_PACKAGE_DIR" $4 +echo "=== BUILDING ===" +make -j6 +echo "=== INSTALLING ===" +make install diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake new file mode 100644 index 000000000..7b45fc898 --- /dev/null +++ b/ports/ffmpeg/portfile.cmake @@ -0,0 +1,105 @@ +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + message(STATUS "Building as static libraries not currently supported. Building as DLLs instead.") + set(VCPKG_LIBRARY_LINKAGE "dynamic") +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ffmpeg-3.2.4) +vcpkg_download_distfile(ARCHIVE + URLS "http://ffmpeg.org/releases/ffmpeg-3.2.4.tar.bz2" + FILENAME "ffmpeg-3.2.4.tar.bz2" + SHA512 ba5004d0f2659faa139c7dbf2f0fc6bab1d4e017d919f4ac271a5d2e8e4a3478909176e3a4d1ad33ddf2f62ab28dd9e00ce9be1399efb7cb3276dde79134cdaa +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_find_acquire_program(YASM) +get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) +set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") + +vcpkg_acquire_msys(MSYS_ROOT) +set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) + +set(_csc_PROJECT_PATH ffmpeg) + +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + +set(OPTIONS "--disable-ffmpeg --disable-ffprobe --disable-doc --enable-debug") +set(OPTIONS "${OPTIONS} --enable-runtime-cpudetect") +set(OPTIONS_DEBUG "") # Note: --disable-optimizations can't be used due to http://ffmpeg.org/pipermail/libav-user/2013-March/003945.html + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(OPTIONS "${OPTIONS} --disable-static --enable-shared") +endif() + +if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") + set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MDd --extra-cxxflags=-MDd --extra-ldflags=-NODEFAULTLIB:libcmt") +else() + set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MTd --extra-cxxflags=-MTd --extra-ldflags=-NODEFAULTLIB:libcmt") +endif() + +message(STATUS "Building ${_csc_PROJECT_PATH} for Release") +file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) +vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc "${CMAKE_CURRENT_LIST_DIR}\\build.sh" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" # BUILD DIR + "${SOURCE_PATH}" # SOURCE DIR + "${CURRENT_PACKAGES_DIR}" # PACKAGE DIR + "${OPTIONS}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME build-${TARGET_TRIPLET}-rel +) + +message(STATUS "Building ${_csc_PROJECT_PATH} for Debug") +file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) +vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc "${CMAKE_CURRENT_LIST_DIR}\\build.sh" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" # BUILD DIR + "${SOURCE_PATH}" # SOURCE DIR + "${CURRENT_PACKAGES_DIR}/debug" # PACKAGE DIR + "${OPTIONS} ${OPTIONS_DEBUG}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME build-${TARGET_TRIPLET}-dbg +) + +file(GLOB DEF_FILES ${CURRENT_PACKAGES_DIR}/lib/*.def ${CURRENT_PACKAGES_DIR}/debug/lib/*.def) + +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + set(LIB_MACHINE_ARG /machine:ARM) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(LIB_MACHINE_ARG /machine:x86) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(LIB_MACHINE_ARG /machine:x64) +else() + message(FATAL_ERROR "Unsupported target architecture") +endif() + +foreach(DEF_FILE ${DEF_FILES}) + get_filename_component(DEF_FILE_DIR "${DEF_FILE}" DIRECTORY) + get_filename_component(DEF_FILE_NAME "${DEF_FILE}" NAME) + string(REGEX REPLACE "-[0-9]*\\.def" ".lib" OUT_FILE_NAME "${DEF_FILE_NAME}") + file(TO_NATIVE_PATH "${DEF_FILE}" DEF_FILE_NATIVE) + file(TO_NATIVE_PATH "${DEF_FILE_DIR}/${OUT_FILE_NAME}" OUT_FILE_NATIVE) + message(STATUS "Generating ${OUT_FILE_NATIVE}") + vcpkg_execute_required_process( + COMMAND lib.exe /def:${DEF_FILE_NATIVE} /out:${OUT_FILE_NATIVE} ${LIB_MACHINE_ARG} + WORKING_DIRECTORY ${CURRENT_PACKAGES_DIR} + LOGNAME libconvert-${TARGET_TRIPLET} + ) +endforeach() + +file(GLOB EXP_FILES ${CURRENT_PACKAGES_DIR}/lib/*.exp ${CURRENT_PACKAGES_DIR}/debug/lib/*.exp) +file(GLOB LIB_FILES ${CURRENT_PACKAGES_DIR}/bin/*.lib ${CURRENT_PACKAGES_DIR}/debug/bin/*.lib) +file(GLOB EXE_FILES ${CURRENT_PACKAGES_DIR}/bin/*.exe ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) +set(FILES_TO_REMOVE ${EXP_FILES} ${LIB_FILES} ${DEF_FILES} ${EXE_FILES}) +list(LENGTH FILES_TO_REMOVE FILES_TO_REMOVE_LEN) +if(FILES_TO_REMOVE_LEN GREATER 0) + file(REMOVE ${FILES_TO_REMOVE}) +endif() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) + +vcpkg_copy_pdbs() + +# Handle copyright +# TODO: Examine build log and confirm that this license matches the build output +file(COPY ${SOURCE_PATH}/COPYING.LGPLv2.1 DESTINATION ${CURRENT_PACKAGES_DIR}/share/ffmpeg) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/ffmpeg/COPYING.LGPLv2.1 ${CURRENT_PACKAGES_DIR}/share/ffmpeg/copyright) diff --git a/ports/fftw3/CMakeLists.txt b/ports/fftw3/CMakeLists.txt new file mode 100644 index 000000000..6e0626f4b --- /dev/null +++ b/ports/fftw3/CMakeLists.txt @@ -0,0 +1,96 @@ +cmake_minimum_required (VERSION 3.0)
+project (fftw3)
+
+# From: http://stackoverflow.com/questions/10252336/fftw-in-visual-studio-2010
+
+# Standard: /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR
+if (WIN32)
+ add_definitions(-D_OPENMP -DLIBFFTWF33_EXPORTS /openmp /bigobj) # Visual Studio 2005 and up supports OpenMP
+endif (WIN32)
+
+if (BUILD_SHARED_LIBS)
+ add_definitions(-DFFTW_DLL)
+endif()
+
+
+file(GLOB fftw_api_SOURCE api/*.c api/*.h)
+file(GLOB fftw_dft_SOURCE dft/*.c dft/*.h)
+file(GLOB fftw_dft_scalar_SOURCE dft/scalar/*.c dft/scalar/*.h)
+file(GLOB fftw_dft_scalar_codelets_SOURCE dft/scalar/codelets/*.c dft/scalar/codelets/*.h)
+file(GLOB fftw_dft_simd_SOURCE dft/simd/*.c dft/simd/*.h)
+
+file(GLOB fftw_dft_simd_sse2_SOURCE dft/simd/sse2/*.c dft/simd/sse2/*.h)
+file(GLOB fftw_kernel_SOURCE kernel/*.c kernel/*.h)
+file(GLOB fftw_rdft_SOURCE rdft/*.c rdft/*.h)
+file(GLOB fftw_rdft_scalar_SOURCE rdft/scalar/*.c rdft/scalar/*.h)
+
+file(GLOB fftw_rdft_scalar_r2cb_SOURCE rdft/scalar/r2cb/*.c
+ rdft/scalar/r2cb/*.h)
+file(GLOB fftw_rdft_scalar_r2cf_SOURCE rdft/scalar/r2cf/*.c
+ rdft/scalar/r2cf/*.h)
+file(GLOB fftw_rdft_scalar_r2r_SOURCE rdft/scalar/r2r/*.c
+ rdft/scalar/r2r/*.h)
+
+file(GLOB fftw_rdft_simd_SOURCE rdft/simd/*.c rdft/simd/*.h)
+file(GLOB fftw_rdft_simd_sse2_SOURCE rdft/simd/sse2/*.c rdft/simd/sse2/*.h)
+
+file(GLOB fftw_reodft_SOURCE reodft/*.c reodft/*.h)
+file(GLOB fftw_simd_support_SOURCE simd-support/*.c simd-support/*.h)
+#file(GLOB fftw_threads_SOURCE threads/*.c threads/*.h)
+
+
+set(${fftw_threads_SOURCE}
+ threads/api.c
+ threads/conf.c
+ threads/ct.c
+ threads/dft-vrank-qeq1.c
+ threads/f77api.c
+ threads/hc2hc.c
+ threads/openmp.c
+ threads/rdft-vrank-geq1.c
+ threads/vrank-geq1-rdft2.c)
+
+
+include_directories(
+ kernel
+ api
+ dft
+ dft/scalar
+ dft/scalar/codelets # really needed?
+ dft/simd
+ dft/simd/sse2
+ rdft
+ rdft/scalar
+ rdft/simd
+ reodft
+ ${CMAKE_CURRENT_SOURCE_DIR} # thats where the config.h is located
+ simd-support
+)
+
+# Create a target for the library
+add_library(fftw3
+ ${fftw_api_SOURCE}
+ ${fftw_dft_SOURCE}
+ ${fftw_dft_scalar_SOURCE}
+ ${fftw_dft_scalar_codelets_SOURCE}
+ ${fftw_dft_simd_SOURCE}
+ ${fftw_dft_simd_sse2_SOURCE}
+ ${fftw_kernel_SOURCE}
+ ${fftw_rdft_SOURCE}
+ ${fftw_rdft_scalar_SOURCE}
+
+ ${fftw_rdft_scalar_r2cb_SOURCE}
+ ${fftw_rdft_scalar_r2cf_SOURCE}
+ ${fftw_rdft_scalar_r2r_SOURCE}
+
+ ${fftw_rdft_simd_SOURCE}
+ ${fftw_rdft_simd_sse2_SOURCE}
+ ${fftw_reodft_SOURCE}
+ ${fftw_simd_support_SOURCE}
+ ${fftw_threads_SOURCE}
+)
+
+install(TARGETS fftw3
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
diff --git a/ports/fftw3/CONTROL b/ports/fftw3/CONTROL new file mode 100644 index 000000000..e7a464d65 --- /dev/null +++ b/ports/fftw3/CONTROL @@ -0,0 +1,3 @@ +Source: fftw3
+Version: 3.3.6-p11
+Description: FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST).
diff --git a/ports/fftw3/config.h b/ports/fftw3/config.h new file mode 100644 index 000000000..3fbe33864 --- /dev/null +++ b/ports/fftw3/config.h @@ -0,0 +1,393 @@ +/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to compile in long-double precision. */
+#undef BENCHFFT_LDOUBLE
+
+/* Define to compile in quad precision. */
+#undef BENCHFFT_QUAD
+
+/* Define to compile in single precision. */
+#undef BENCHFFT_SINGLE
+
+/* 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 disable Fortran wrappers. */
+#define DISABLE_FORTRAN 1
+
+/* Define to dummy `main' function (if any) required to link to the Fortran
+ libraries. */
+#undef F77_DUMMY_MAIN
+
+/* Define to a macro mangling the given C identifier (in lower and upper
+ case), which must not contain underscores, for linking with Fortran. */
+#undef F77_FUNC
+
+/* As F77_FUNC, but for C identifiers containing underscores. */
+#undef F77_FUNC_
+
+/* Define if F77_FUNC and F77_FUNC_ are equivalent. */
+#undef F77_FUNC_EQUIV
+
+/* Define if F77 and FC dummy `main' functions are identical. */
+#undef FC_DUMMY_MAIN_EQ_F77
+
+/* C compiler name and flags */
+#define FFTW_CC "cl"
+
+/* Define to enable extra FFTW debugging code. */
+#undef FFTW_DEBUG
+
+/* Define to enable alignment debugging hacks. */
+#undef FFTW_DEBUG_ALIGNMENT
+
+/* Define to enable debugging malloc. */
+#undef FFTW_DEBUG_MALLOC
+
+/* Define to enable the use of alloca(). */
+#undef FFTW_ENABLE_ALLOCA
+
+/* Define to compile in long-double precision. */
+#undef FFTW_LDOUBLE
+
+/* Define to compile in quad precision. */
+#undef FFTW_QUAD
+
+/* Define to enable pseudorandom estimate planning for debugging. */
+#undef FFTW_RANDOM_ESTIMATOR
+
+/* Define to compile in single precision. */
+#undef FFTW_SINGLE
+
+/* Define to 1 if you have the `abort' function. */
+#define HAVE_ABORT 1
+
+/* 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 enable Altivec optimizations. */
+#undef HAVE_ALTIVEC
+
+/* Define to 1 if you have the <altivec.h> header file. */
+#undef HAVE_ALTIVEC_H
+
+/* Define to enable AVX optimizations. */
+#undef HAVE_AVX
+
+/* Define to 1 if you have the `BSDgettimeofday' function. */
+#undef HAVE_BSDGETTIMEOFDAY
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the `cosl' function. */
+#define HAVE_COSL 1
+
+/* Define to 1 if you have the <c_asm.h> header file. */
+#undef HAVE_C_ASM_H
+
+/* Define to 1 if you have the declaration of `cosl', and to 0 if you don't.
+ */
+#define HAVE_DECL_COSL 1
+
+/* Define to 1 if you have the declaration of `cosq', and to 0 if you don't. */
+#define HAVE_DECL_COSQ 0
+
+/* Define to 1 if you have the declaration of `drand48', and to 0 if you don't. */
+#define HAVE_DECL_DRAND48 0
+
+/* Define to 1 if you have the declaration of `memalign', and to 0 if you don't. */
+#define HAVE_DECL_MEMALIGN 0
+
+/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if you don't. */
+#define HAVE_DECL_POSIX_MEMALIGN 0
+
+/* Define to 1 if you have the declaration of `sinl', and to 0 if you don't. */
+#define HAVE_DECL_SINL 1
+
+/* Define to 1 if you have the declaration of `sinq', and to 0 if you don't.
+ */
+#define HAVE_DECL_SINQ 0
+
+/* Define to 1 if you have the declaration of `srand48', and to 0 if you
+ don't. */
+#define HAVE_DECL_SRAND48 0
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the `drand48' function. */
+#undef HAVE_DRAND48
+
+/* Define if you have a machine with fused multiply-add */
+#undef HAVE_FMA
+
+/* Define to 1 if you have the `gethrtime' function. */
+#undef HAVE_GETHRTIME
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if hrtime_t is defined in <sys/time.h> */
+#undef HAVE_HRTIME_T
+
+/* Define to 1 if you have the <intrinsics.h> header file. */
+#undef HAVE_INTRINSICS_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define if the isnan() function/macro is available. */
+#undef HAVE_ISNAN
+
+/* Define to 1 if you have the <libintl.h> header file. */
+#undef HAVE_LIBINTL_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `quadmath' library (-lquadmath). */
+#undef HAVE_LIBQUADMATH
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if the compiler supports `long double' */
+#define HAVE_LONG_DOUBLE 1
+
+/* Define to 1 if you have the `mach_absolute_time' function. */
+#undef HAVE_MACH_ABSOLUTE_TIME
+
+/* Define to 1 if you have the <mach/mach_time.h> header file. */
+#undef HAVE_MACH_MACH_TIME_H
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define to 1 if you have the `memalign' function. */
+#undef HAVE_MEMALIGN
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to enable MIPS paired-single optimizations. */
+#undef HAVE_MIPS_PS
+
+/* Define to enable use of MIPS ZBus cycle-counter. */
+#undef HAVE_MIPS_ZBUS_TIMER
+
+/* Define if you have the MPI library. */
+#undef HAVE_MPI
+
+/* Define if OpenMP is enabled */
+#define HAVE_OPENMP 1
+
+/* Define to 1 if you have the `posix_memalign' function. */
+#undef HAVE_POSIX_MEMALIGN
+
+/* Define if you have POSIX threads libraries and header files. */
+#undef HAVE_PTHREAD
+
+/* Define to 1 if you have the `read_real_time' function. */
+#undef HAVE_READ_REAL_TIME
+
+/* Define to 1 if you have the `sinl' function. */
+#define HAVE_SINL 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the `sqrt' function. */
+#define HAVE_SQRT 1
+
+/* Define to enable SSE/SSE2 optimizations. */
+#define HAVE_SSE2 1
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* 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. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `sysctl' function. */
+#undef HAVE_SYSCTL
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+#undef HAVE_SYS_SYSCTL_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. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `tanl' function. */
+#define HAVE_TANL 1
+
+/* Define if we have a threads library. */
+#undef HAVE_THREADS
+
+/* Define to 1 if you have the `time_base_to_time' function. */
+#undef HAVE_TIME_BASE_TO_TIME
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the `_mm_free' function. */
+#undef HAVE__MM_FREE
+
+/* Define to 1 if you have the `_mm_malloc' function. */
+#undef HAVE__MM_MALLOC
+
+/* Define if you have the UNICOS _rtc() intrinsic. */
+#undef HAVE__RTC
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#define PACKAGE "fftw"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "fftw@fftw.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "fftw"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "fftw-3.3"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "fftw"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL "http://www.fftw.org"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "3.3"
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+#undef PTHREAD_CREATE_JOINABLE
+
+/* The size of `double', as computed by sizeof. */
+#undef SIZEOF_DOUBLE
+
+/* The size of `fftw_r2r_kind', as computed by sizeof. */
+#undef SIZEOF_FFTW_R2R_KIND
+
+/* The size of `float', as computed by sizeof. */
+#undef SIZEOF_FLOAT
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
+/* The size of `MPI_Fint', as computed by sizeof. */
+#undef SIZEOF_MPI_FINT
+
+/* The size of `ptrdiff_t', as computed by sizeof. */
+#undef SIZEOF_PTRDIFF_T
+
+/* The size of `size_t', as computed by sizeof. */
+#undef SIZEOF_SIZE_T
+
+/* The size of `unsigned int', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_INT
+
+/* The size of `unsigned long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG
+
+/* The size of `unsigned long long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG_LONG
+
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
+
+/* 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 you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define if we have and are using POSIX threads. */
+#undef USING_POSIX_THREADS
+
+/* Version number of package */
+#define VERSION "3.3"
+
+/* Use common Windows Fortran mangling styles for the Fortran interfaces. */
+#undef WINDOWS_F77_MANGLING
+
+/* Include g77-compatible wrappers in addition to any other Fortran wrappers.
+ */
+#undef WITH_G77_WRAPPERS
+
+/* Use our own aligned malloc routine; mainly helpful for Windows systems
+ lacking aligned allocation system-library routines. */
+#define WITH_OUR_MALLOC 1
+
+/* Use low-precision timers, making planner very slow */
+#undef WITH_SLOW_TIMER
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* 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
+#define inline __inline
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
\ No newline at end of file diff --git a/ports/fftw3/fix-dynamic.patch b/ports/fftw3/fix-dynamic.patch new file mode 100644 index 000000000..a39d1b968 --- /dev/null +++ b/ports/fftw3/fix-dynamic.patch @@ -0,0 +1,11 @@ +--- a/fftw3.h 2017-01-15 13:03:24.000000000 +0100 ++++ b/fftw3.h 2017-02-24 04:05:36.051091700 +0100 +@@ -47,6 +47,8 @@ + #ifndef FFTW3_H + #define FFTW3_H + ++#define FFTW_DLL ++ + #include <stdio.h> + + #ifdef __cplusplus diff --git a/ports/fftw3/portfile.cmake b/ports/fftw3/portfile.cmake new file mode 100644 index 000000000..fe97533b4 --- /dev/null +++ b/ports/fftw3/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}
+#
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/fftw-3.3.6-pl1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.fftw.org/fftw-3.3.6-pl1.tar.gz"
+ FILENAME "fftw-3.3.6-pl1.tar.gz"
+ SHA512 e2ed33fcb068a36a841bbd898d12ceec74f4e9a0a349e7c55959878b50224a69a0f87656347dad7d7e1448ebc50d28d8f34f6da7992c43072d26942fd97c0134
+)
+
+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})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+file(COPY ${SOURCE_PATH}/api/fftw3.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/fix-dynamic.patch)
+endif()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/fftw3)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/fftw3/COPYING ${CURRENT_PACKAGES_DIR}/share/fftw3/copyright)
diff --git a/ports/flatbuffers/CONTROL b/ports/flatbuffers/CONTROL new file mode 100644 index 000000000..1fbe5d628 --- /dev/null +++ b/ports/flatbuffers/CONTROL @@ -0,0 +1,4 @@ +Source: flatbuffers +Version: 1.6.0 +Description: Memory Efficient Serialization Library http://google.github.io/flatbuffers/ + FlatBuffers is an efficient cross platform serialization library for games and other memory constrained apps. It allows you to directly access serialized data without unpacking/parsing it first, while still having great forwards/backwards compatibility.
\ No newline at end of file diff --git a/ports/flatbuffers/portfile.cmake b/ports/flatbuffers/portfile.cmake new file mode 100644 index 000000000..03e0e9c28 --- /dev/null +++ b/ports/flatbuffers/portfile.cmake @@ -0,0 +1,62 @@ +# 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} +# + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + message("Building DLLs not supported. Building static instead.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/flatbuffers-1.6.0) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/google/flatbuffers/archive/v1.6.0.zip" + FILENAME "flatbuffers-1.6.0.zip" + SHA512 c23043a54d7055f4e0a0164fdafd3f1d60292e57d62d20d30f641c9da90935d14da847f86239a19f777e68b707cfb25452da9192607a3a399ab25ce06b31c282 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +set(OPTIONS) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + list(APPEND OPTIONS -DFLATBUFFERS_BUILD_SHAREDLIB=ON) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DFLATBUFFERS_BUILD_TESTS=OFF + -DFLATBUFFERS_BUILD_GRPCTEST=OFF + ${OPTIONS} + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/bin) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() +if(EXISTS ${CURRENT_PACKAGES_DIR}/bin/flatc.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/flatc.exe ${CURRENT_PACKAGES_DIR}/tools/flatc.exe) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) +endif() +if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/flatbuffers.dll) + make_directory(${CURRENT_PACKAGES_DIR}/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/flatbuffers.dll ${CURRENT_PACKAGES_DIR}/bin/flatbuffers.dll) +endif() +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/flatbuffers.dll) + make_directory(${CURRENT_PACKAGES_DIR}/debug/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/flatbuffers.dll ${CURRENT_PACKAGES_DIR}/debug/bin/flatbuffers.dll) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/flatbuffers) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/flatbuffers/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/flatbuffers/copyright) diff --git a/ports/fltk/CONTROL b/ports/fltk/CONTROL new file mode 100644 index 000000000..985c6b1c0 --- /dev/null +++ b/ports/fltk/CONTROL @@ -0,0 +1,4 @@ +Source: fltk
+Version: 1.3.4-2
+Description: FLTK (pronounced fulltick) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. FLTK provides modern GUI functionality without the bloat and supports 3D graphics via OpenGL and its built-in GLUT emulation.
+Build-Depends: zlib, libpng, libjpeg-turbo
\ No newline at end of file diff --git a/ports/fltk/findlibsfix.patch b/ports/fltk/findlibsfix.patch new file mode 100644 index 000000000..6c2a7158a --- /dev/null +++ b/ports/fltk/findlibsfix.patch @@ -0,0 +1,51 @@ +diff --git a/CMake/resources.cmake b/CMake/resources.cmake +index 37c0c08..b1f52d1 100644 +--- a/CMake/resources.cmake ++++ b/CMake/resources.cmake +@@ -26,10 +26,10 @@ find_file(HAVE_DLFCN_H dlfcn.h) + find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2 freetype2/freetype) + find_file(HAVE_GL_GL_H GL/gl.h) + find_file(HAVE_GL_GLU_H GL/glu.h) +-find_file(HAVE_LIBPNG_PNG_H libpng/png.h) ++#find_file(HAVE_LIBPNG_PNG_H libpng/png.h) + find_file(HAVE_LOCALE_H locale.h) + find_file(HAVE_OPENGL_GLU_H OpenGL/glu.h) +-find_file(HAVE_PNG_H png.h) ++#find_file(HAVE_PNG_H png.h) + find_file(HAVE_PTHREAD_H pthread.h) + find_file(HAVE_STDIO_H stdio.h) + find_file(HAVE_STRINGS_H strings.h) +@@ -38,6 +38,17 @@ find_file(HAVE_SYS_STDTYPES_H sys/stdtypes.h) + find_file(HAVE_X11_XREGION_H X11/Xregion.h) + find_path(HAVE_XDBE_H Xdbe.h PATH_SUFFIXES X11/extensions extensions) + ++find_package(PNG REQUIRED) ++if(PNG_FOUND) ++ set(LIB_png ${PNG_LIBRARIES}) ++ set(HAVE_PNG_H ${PNG_FOUND}) ++ ++endif() ++find_package(ZLIB REQUIRED) ++if(ZLIB_FOUND) ++ set(LIB_zlib ${ZLIB_LIBRARIES}) ++endif() ++ + if (MSVC) + message(STATUS "Note: The following three headers should all be found!") + message(STATUS "HAVE_GL_GL_H = '${HAVE_GL_GL_H}'") +@@ -92,12 +103,12 @@ find_library(LIB_freetype freetype) + find_library(LIB_GL GL) + find_library(LIB_MesaGL MesaGL) + find_library(LIB_jpeg jpeg) +-find_library(LIB_png png) +-find_library(LIB_zlib z) ++#find_library(LIB_png png) ++#find_library(LIB_zlib z) + + mark_as_advanced(LIB_CAIRO LIB_dl LIB_fontconfig LIB_freetype) + mark_as_advanced(LIB_GL LIB_MesaGL) +-mark_as_advanced(LIB_jpeg LIB_png LIB_zlib) ++mark_as_advanced(LIB_jpeg) + + ####################################################################### + # functions diff --git a/ports/fltk/portfile.cmake b/ports/fltk/portfile.cmake new file mode 100644 index 000000000..261a03c7f --- /dev/null +++ b/ports/fltk/portfile.cmake @@ -0,0 +1,68 @@ +# 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(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/fltk-1.3.4-1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://fltk.org/pub/fltk/1.3.4/fltk-1.3.4-1-source.tar.gz"
+ FILENAME "fltk.tar.gz"
+ SHA512 0be1c8e6bb7a8c7ef484941a73868d5e40b90e97a8e5dc747bac2be53a350621975406ecfd4a9bcee8eeb7afd886e75bf7a6d6478fd6c56d16e54059f22f0891
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/fltk-1.3.4-1
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/findlibsfix.patch"
+)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(BUILD_SHARED ON)
+else()
+ set(BUILD_SHARED OFF)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DOPTION_BUILD_EXAMPLES=OFF
+ -DOPTION_BUILD_SHARED_LIBS=${BUILD_SHARED}
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/CMAKE
+ ${CURRENT_PACKAGES_DIR}/debug/CMAKE
+ ${CURRENT_PACKAGES_DIR}/debug/include
+)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/fluid.exe)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/fltk-config)
+
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/fluid.exe)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/fltk-config)
+vcpkg_copy_pdbs()
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+
+
+else()
+ file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/bin
+ ${CURRENT_PACKAGES_DIR}/bin
+ )
+
+
+endif()
+
+
+
+file(INSTALL
+ ${SOURCE_PATH}/COPYING
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/fltk
+ RENAME copyright
+)
diff --git a/ports/fmt/CONTROL b/ports/fmt/CONTROL index adcb2def4..4e980b4d5 100644 --- a/ports/fmt/CONTROL +++ b/ports/fmt/CONTROL @@ -1,3 +1,3 @@ Source: fmt -Version: 3.0.1-1 +Version: 3.0.1-4 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 3470dbedb..959a0ebe7 100644 --- a/ports/fmt/portfile.cmake +++ b/ports/fmt/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_extract_source_archive(${ARCHIVE_FILE}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DFMT_CMAKE_DIR=share/fmt -DFMT_TEST=OFF @@ -29,10 +30,14 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/fmt.dll ${CURRENT_PACKAGES_DIR}/bin/fmt.dll) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/fmt.dll ${CURRENT_PACKAGES_DIR}/debug/bin/fmt.dll) + # Force FMT_SHARED to 1 + file(READ ${CURRENT_PACKAGES_DIR}/include/fmt/format.h FMT_FORMAT_H) + string(REPLACE "defined(FMT_SHARED)" "1" FMT_FORMAT_H "${FMT_FORMAT_H}") + file(WRITE ${CURRENT_PACKAGES_DIR}/include/fmt/format.h "${FMT_FORMAT_H}") endif() 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) +#file(REMOVE ${CURRENT_PACKAGES_DIR}/include/fmt/format.cc) +#file(REMOVE ${CURRENT_PACKAGES_DIR}/include/fmt/ostream.cc) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/share/fmt/fmt-targets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake) file(READ ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake FMT_DEBUG_MODULE) string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" FMT_DEBUG_MODULE "${FMT_DEBUG_MODULE}") diff --git a/ports/fontconfig/CMakeLists.txt b/ports/fontconfig/CMakeLists.txt new file mode 100644 index 000000000..f8412ac94 --- /dev/null +++ b/ports/fontconfig/CMakeLists.txt @@ -0,0 +1,80 @@ +cmake_minimum_required(VERSION 3.0) +project(fontconfig) + +add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) +add_definitions(-FI${FC_INCLUDE_DIR}/config.h) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(LIB_SUFFIX d) +endif() + +# find dependencies +find_path(ICONV_INCLUDE_DIR iconv.h) +find_library(ICONV_LIBRARY NAMES iconv libiconv) +find_path(FREETYPE_INCLUDE_DIR ft2build.h) +find_library(FREETYPE_LIBRARY freetype${LIB_SUFFIX}) +find_path(EXPAT_INCLUDE_DIR expat.h) +find_library(EXPAT_LIBRARY expat) + +add_library(fontconfig + src/fcatomic.c + src/fcblanks.c + src/fccache.c + src/fccfg.c + src/fccharset.c + src/fccompat.c + src/fcdbg.c + src/fcdefault.c + src/fcdir.c + src/fcformat.c + src/fcfreetype.c + src/fcfs.c + src/fcinit.c + src/fclang.c + src/fclist.c + src/fcmatch.c + src/fcmatrix.c + src/fcname.c + src/fcobjs.c + src/fcpat.c + src/fcrange.c + src/fcserialize.c + src/fcstat.c + src/fcstr.c + src/fcweight.c + src/fcxml.c + src/ftglue.c) + +target_include_directories(fontconfig PRIVATE . + ${FC_INCLUDE_DIR} + ${FREETYPE_INCLUDE_DIR} + ${EXPAT_INCLUDE_DIR} + ${ICONV_INCLUDE_DIR}) + +target_link_libraries(fontconfig + ${FREETYPE_LIBRARY} + ${ICONV_LIBRARY} + ${EXPAT_LIBRARY}) + +install(TARGETS fontconfig + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +if(NOT FC_SKIP_HEADERS) + install(FILES + fontconfig/fontconfig.h + fontconfig/fcfreetype.h + fontconfig/fcprivate.h + DESTINATION include/fontconfig) +endif() + +if(NOT FC_SKIP_TOOLS) + set(FC_DEFAULT_FONTS WINDOWSFONTDIR) + set(FC_FONTPATH) + set(FC_CACHEDIR WINDOWSTEMPDIR_FONTCONFIG_CACHE) + set(CONFIGDIR ./fonts/conf.d) + configure_file(fonts.conf.in ${CMAKE_SOURCE_DIR}/fonts.conf @ONLY) + install(FILES fonts.conf DESTINATION tools/fontconfig/fonts) + install(DIRECTORY conf.d DESTINATION tools/fontconfig/fonts FILES_MATCHING PATTERN "*.conf") +endif() diff --git a/ports/fontconfig/CONTROL b/ports/fontconfig/CONTROL new file mode 100644 index 000000000..ecb371f15 --- /dev/null +++ b/ports/fontconfig/CONTROL @@ -0,0 +1,4 @@ +Source: fontconfig
+Version: 2.12.1
+Description: Library for configuring and customizing font access.
+Build-Depends: freetype, expat, libiconv
diff --git a/ports/fontconfig/include/config.h b/ports/fontconfig/include/config.h new file mode 100644 index 000000000..8f21dda01 --- /dev/null +++ b/ports/fontconfig/include/config.h @@ -0,0 +1,267 @@ + +#define FC_CACHEDIR "./" + +/* The normal alignment of `double', in bytes. */ +#define ALIGNOF_DOUBLE 8 + +/* Use libxml2 instead of Expat */ +/* #undef ENABLE_LIBXML2 */ + +/* Additional font directories */ +#define FC_ADD_FONTS "yes" + +/* Architecture prefix to use for cache file names */ +/* #undef FC_ARCHITECTURE */ + +/* System font directory */ +#define FC_DEFAULT_FONTS "c:/windows/fonts" + +/* Define to nothing if C supports flexible array members, and to 1 if it does + not. That way, with a declaration like `struct s { int n; double + d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 + compilers. When computing the size of such an object, don't use 'sizeof + (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' + instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with + MSVC and with C++ compilers. */ +#define FLEXIBLE_ARRAY_MEMBER /**/ + +/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the <dlfcn.h> header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fstatfs' function. */ +/* #undef HAVE_FSTATFS */ + +/* Define to 1 if you have the `fstatvfs' function. */ +/* #undef HAVE_FSTATVFS */ + +/* FT_Bitmap_Size structure includes y_ppem field */ +#define HAVE_FT_BITMAP_SIZE_Y_PPEM 1 + +/* Define to 1 if you have the `FT_Get_BDF_Property' function. */ +#define HAVE_FT_GET_BDF_PROPERTY 1 + +/* Define to 1 if you have the `FT_Get_Next_Char' function. */ +#define HAVE_FT_GET_NEXT_CHAR 1 + +/* Define to 1 if you have the `FT_Get_PS_Font_Info' function. */ +#define HAVE_FT_GET_PS_FONT_INFO 1 + +/* Define to 1 if you have the `FT_Get_X11_Font_Format' function. */ +#define HAVE_FT_GET_X11_FONT_FORMAT 1 + +/* Define to 1 if you have the `FT_Has_PS_Glyph_Names' function. */ +#define HAVE_FT_HAS_PS_GLYPH_NAMES 1 + +/* Define to 1 if you have the `FT_Select_Size' function. */ +#define HAVE_FT_SELECT_SIZE 1 + +/* Define to 1 if you have the `getexecname' function. */ +/* #undef HAVE_GETEXECNAME */ + +/* Define to 1 if you have the `getopt' function. */ +#define HAVE_GETOPT 1 + +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `getprogname' function. */ +/* #undef HAVE_GETPROGNAME */ + +/* Have Intel __sync_* atomic primitives */ +#define HAVE_INTEL_ATOMIC_PRIMITIVES 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `link' function. */ +/* #undef HAVE_LINK */ + +/* Define to 1 if you have the `lrand48' function. */ +/* #undef HAVE_LRAND48 */ + +/* Define to 1 if you have the `lstat' function. */ +/* #undef HAVE_LSTAT */ + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkdtemp' function. */ +/* #undef HAVE_MKDTEMP */ + +/* Define to 1 if you have the `mkostemp' function. */ +/* #undef HAVE_MKOSTEMP */ + +/* Define to 1 if you have the `mkstemp' function. */ +/* #undef HAVE_MKSTEMP */ + +/* Define to 1 if you have a working `mmap' system call. */ +/* #undef HAVE_MMAP */ + +/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the 'posix_fadvise' function. */ +/* #undef HAVE_POSIX_FADVISE */ + +/* Have POSIX threads */ +/* #undef HAVE_PTHREAD */ + +/* Have PTHREAD_PRIO_INHERIT. */ +/* #undef HAVE_PTHREAD_PRIO_INHERIT */ + +/* Define to 1 if you have the `rand' function. */ +#define HAVE_RAND 1 + +/* Define to 1 if you have the `random' function. */ +/* #undef HAVE_RANDOM */ + +/* Define to 1 if you have the `random_r' function. */ +/* #undef HAVE_RANDOM_R */ + +/* Define to 1 if you have the `rand_r' function. */ +/* #undef HAVE_RAND_R */ + +/* Define to 1 if you have the `readlink' function. */ +/* #undef HAVE_READLINK */ + +/* Define to 1 if you have the 'scandir' function. */ +/* #undef HAVE_SCANDIR */ + +/* Define to 1 if you have the 'scandir' function with int (* compar)(const + void *, const void *) */ +/* #undef HAVE_SCANDIR_VOID_P */ + +/* Define to 1 if you have the <sched.h> header file. */ +/* #undef HAVE_SCHED_H */ + +/* Have sched_yield */ +/* #undef HAVE_SCHED_YIELD */ + +/* Have Solaris __machine_*_barrier and atomic_* operations */ +/* #undef HAVE_SOLARIS_ATOMIC_OPS */ + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* 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. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if `d_type' is a member of `struct dirent'. */ +/* #undef HAVE_STRUCT_DIRENT_D_TYPE */ + +/* Define to 1 if `st_mtim' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIM */ + +/* Define to 1 if `f_flags' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_FLAGS */ + +/* Define to 1 if `f_fstypename' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_FSTYPENAME */ + +/* Define to 1 if `f_basetype' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_BASETYPE */ + +/* Define to 1 if `f_fstypename' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_FSTYPENAME */ + +/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the <sys/mount.h> header file. */ +/* #undef HAVE_SYS_MOUNT_H */ + +/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_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/statfs.h> header file. */ +/* #undef HAVE_SYS_STATFS_H */ + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <sys/vfs.h> header file. */ +/* #undef HAVE_SYS_VFS_H */ + +/* Define to 1 if `usLowerOpticalPointSize' is a member of `TT_OS2'. */ +/* #undef HAVE_TT_OS2_USLOWEROPTICALPOINTSIZE */ + +/* Define to 1 if `usUpperOpticalPointSize' is a member of `TT_OS2'. */ +/* #undef HAVE_TT_OS2_USUPPEROPTICALPOINTSIZE */ + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Can use #warning in C files */ +#define HAVE_WARNING_CPP_DIRECTIVE 1 + +/* Use xmlparse.h instead of expat.h */ +/* #undef HAVE_XMLPARSE_H */ + +/* Define to 1 if you have the `XML_SetDoctypeDeclHandler' function. */ +#define HAVE_XML_SETDOCTYPEDECLHANDLER 1 + +/* Define to 1 if you have the `_mktemp_s' function. */ +#define HAVE__MKTEMP_S 1 + +/* Define to necessary symbol if this constant + uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* The size of `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `void*', as computed by sizeof. */ +/* The size of `void *', as computed by sizeof. */ +#if defined(_WIN64) +#define SIZEOF_VOIDP 8 +#define SIZEOF_VOID_P 8 +#else +#define SIZEOF_VOIDP 4 +#define SIZEOF_VOID_P 4 +#endif + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Use iconv. */ +#define USE_ICONV 1
\ No newline at end of file diff --git a/ports/fontconfig/include/fcaliastail.h b/ports/fontconfig/include/fcaliastail.h new file mode 100644 index 000000000..a9eae81f2 --- /dev/null +++ b/ports/fontconfig/include/fcaliastail.h @@ -0,0 +1 @@ +/* intentionally empty */ diff --git a/ports/fontconfig/include/fcftaliastail.h b/ports/fontconfig/include/fcftaliastail.h new file mode 100644 index 000000000..a9eae81f2 --- /dev/null +++ b/ports/fontconfig/include/fcftaliastail.h @@ -0,0 +1 @@ +/* intentionally empty */ diff --git a/ports/fontconfig/include/fcobjshash.h b/ports/fontconfig/include/fcobjshash.h new file mode 100644 index 000000000..1fe860a2f --- /dev/null +++ b/ports/fontconfig/include/fcobjshash.h @@ -0,0 +1,328 @@ +/* ANSI-C code produced by gperf version 3.0.4 */ +/* Command-line: gperf -m 100 src/fcobjshash.gperf */ +/* Computed positions: -k'2-3' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + +#line 1 "src/fcobjshash.gperf" + +#line 13 "src/fcobjshash.gperf" +struct FcObjectTypeInfo { +int name; +int id; +}; +#include <string.h> +/* maximum key range = 56, duplicates = 0 */ + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static unsigned int +FcObjectTypeHash (register const char *str, register unsigned int len) +{ + static const unsigned char asso_values[] = + { + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 21, 30, 3, + 36, 45, 60, 3, 15, 0, 60, 60, 0, 9, + 9, 0, 21, 60, 0, 0, 15, 0, 60, 60, + 0, 15, 24, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60 + }; + return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[1]]; +} + +struct FcObjectTypeNamePool_t + { + char FcObjectTypeNamePool_str4[sizeof("file")]; + char FcObjectTypeNamePool_str5[sizeof("color")]; + char FcObjectTypeNamePool_str7[sizeof("foundry")]; + char FcObjectTypeNamePool_str8[sizeof("fullname")]; + char FcObjectTypeNamePool_str9[sizeof("pixelsize")]; + char FcObjectTypeNamePool_str10[sizeof("prgname")]; + char FcObjectTypeNamePool_str12[sizeof("fullnamelang")]; + char FcObjectTypeNamePool_str13[sizeof("globaladvance")]; + char FcObjectTypeNamePool_str14[sizeof("postscriptname")]; + char FcObjectTypeNamePool_str16[sizeof("hinting")]; + char FcObjectTypeNamePool_str17[sizeof("minspace")]; + char FcObjectTypeNamePool_str18[sizeof("hintstyle")]; + char FcObjectTypeNamePool_str19[sizeof("fontformat")]; + char FcObjectTypeNamePool_str20[sizeof("fontversion")]; + char FcObjectTypeNamePool_str21[sizeof("fontfeatures")]; + char FcObjectTypeNamePool_str22[sizeof("outline")]; + char FcObjectTypeNamePool_str23[sizeof("autohint")]; + char FcObjectTypeNamePool_str24[sizeof("dpi")]; + char FcObjectTypeNamePool_str25[sizeof("hash")]; + char FcObjectTypeNamePool_str26[sizeof("slant")]; + char FcObjectTypeNamePool_str27[sizeof("aspect")]; + char FcObjectTypeNamePool_str28[sizeof("size")]; + char FcObjectTypeNamePool_str29[sizeof("scale")]; + char FcObjectTypeNamePool_str30[sizeof("symbol")]; + char FcObjectTypeNamePool_str31[sizeof("rasterizer")]; + char FcObjectTypeNamePool_str32[sizeof("scalable")]; + char FcObjectTypeNamePool_str33[sizeof("antialias")]; + char FcObjectTypeNamePool_str34[sizeof("lang")]; + char FcObjectTypeNamePool_str35[sizeof("style")]; + char FcObjectTypeNamePool_str36[sizeof("family")]; + char FcObjectTypeNamePool_str37[sizeof("rgba")]; + char FcObjectTypeNamePool_str38[sizeof("namelang")]; + char FcObjectTypeNamePool_str39[sizeof("stylelang")]; + char FcObjectTypeNamePool_str40[sizeof("familylang")]; + char FcObjectTypeNamePool_str41[sizeof("width")]; + char FcObjectTypeNamePool_str42[sizeof("matrix")]; + char FcObjectTypeNamePool_str43[sizeof("charset")]; + char FcObjectTypeNamePool_str45[sizeof("charwidth")]; + char FcObjectTypeNamePool_str46[sizeof("charheight")]; + char FcObjectTypeNamePool_str47[sizeof("embolden")]; + char FcObjectTypeNamePool_str48[sizeof("lcdfilter")]; + char FcObjectTypeNamePool_str49[sizeof("spacing")]; + char FcObjectTypeNamePool_str50[sizeof("index")]; + char FcObjectTypeNamePool_str51[sizeof("weight")]; + char FcObjectTypeNamePool_str52[sizeof("capability")]; + char FcObjectTypeNamePool_str53[sizeof("embeddedbitmap")]; + char FcObjectTypeNamePool_str58[sizeof("decorative")]; + char FcObjectTypeNamePool_str59[sizeof("verticallayout")]; + }; +static const struct FcObjectTypeNamePool_t FcObjectTypeNamePool_contents = + { + "file", + "color", + "foundry", + "fullname", + "pixelsize", + "prgname", + "fullnamelang", + "globaladvance", + "postscriptname", + "hinting", + "minspace", + "hintstyle", + "fontformat", + "fontversion", + "fontfeatures", + "outline", + "autohint", + "dpi", + "hash", + "slant", + "aspect", + "size", + "scale", + "symbol", + "rasterizer", + "scalable", + "antialias", + "lang", + "style", + "family", + "rgba", + "namelang", + "stylelang", + "familylang", + "width", + "matrix", + "charset", + "charwidth", + "charheight", + "embolden", + "lcdfilter", + "spacing", + "index", + "weight", + "capability", + "embeddedbitmap", + "decorative", + "verticallayout" + }; +#define FcObjectTypeNamePool ((const char *) &FcObjectTypeNamePool_contents) +#ifdef __GNUC__ +__inline +#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif +#endif +const struct FcObjectTypeInfo * +FcObjectTypeLookup (register const char *str, register unsigned int len) +{ + enum + { + TOTAL_KEYWORDS = 48, + MIN_WORD_LENGTH = 3, + MAX_WORD_LENGTH = 14, + MIN_HASH_VALUE = 4, + MAX_HASH_VALUE = 59 + }; + + static const struct FcObjectTypeInfo wordlist[] = + { + {-1}, {-1}, {-1}, {-1}, +#line 38 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str4,FC_FILE_OBJECT}, +#line 64 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str5,FC_COLOR_OBJECT}, + {-1}, +#line 31 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str7,FC_FOUNDRY_OBJECT}, +#line 22 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str8,FC_FULLNAME_OBJECT}, +#line 29 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str9,FC_PIXEL_SIZE_OBJECT}, +#line 61 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str10,FC_PRGNAME_OBJECT}, + {-1}, +#line 23 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str12,FC_FULLNAMELANG_OBJECT}, +#line 37 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str13,FC_GLOBAL_ADVANCE_OBJECT}, +#line 63 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str14,FC_POSTSCRIPT_NAME_OBJECT}, + {-1}, +#line 34 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str16,FC_HINTING_OBJECT}, +#line 46 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str17,FC_MINSPACE_OBJECT}, +#line 33 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str18,FC_HINT_STYLE_OBJECT}, +#line 54 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str19,FC_FONTFORMAT_OBJECT}, +#line 52 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str20,FC_FONTVERSION_OBJECT}, +#line 60 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str21,FC_FONT_FEATURES_OBJECT}, +#line 41 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str22,FC_OUTLINE_OBJECT}, +#line 36 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str23,FC_AUTOHINT_OBJECT}, +#line 43 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str24,FC_DPI_OBJECT}, +#line 62 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str25,FC_HASH_OBJECT}, +#line 24 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str26,FC_SLANT_OBJECT}, +#line 28 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str27,FC_ASPECT_OBJECT}, +#line 27 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str28,FC_SIZE_OBJECT}, +#line 45 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str29,FC_SCALE_OBJECT}, +#line 65 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str30,FC_SYMBOL_OBJECT}, +#line 40 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str31,FC_RASTERIZER_OBJECT}, +#line 42 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str32,FC_SCALABLE_OBJECT}, +#line 32 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str33,FC_ANTIALIAS_OBJECT}, +#line 51 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str34,FC_LANG_OBJECT}, +#line 20 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str35,FC_STYLE_OBJECT}, +#line 18 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str36,FC_FAMILY_OBJECT}, +#line 44 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str37,FC_RGBA_OBJECT}, +#line 59 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str38,FC_NAMELANG_OBJECT}, +#line 21 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str39,FC_STYLELANG_OBJECT}, +#line 19 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str40,FC_FAMILYLANG_OBJECT}, +#line 26 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str41,FC_WIDTH_OBJECT}, +#line 49 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str42,FC_MATRIX_OBJECT}, +#line 50 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str43,FC_CHARSET_OBJECT}, + {-1}, +#line 47 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str45,FC_CHAR_WIDTH_OBJECT}, +#line 48 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str46,FC_CHAR_HEIGHT_OBJECT}, +#line 55 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str47,FC_EMBOLDEN_OBJECT}, +#line 58 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str48,FC_LCD_FILTER_OBJECT}, +#line 30 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str49,FC_SPACING_OBJECT}, +#line 39 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str50,FC_INDEX_OBJECT}, +#line 25 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str51,FC_WEIGHT_OBJECT}, +#line 53 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str52,FC_CAPABILITY_OBJECT}, +#line 56 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str53,FC_EMBEDDED_BITMAP_OBJECT}, + {-1}, {-1}, {-1}, {-1}, +#line 57 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str58,FC_DECORATIVE_OBJECT}, +#line 35 "src/fcobjshash.gperf" + {(int)(long)&((struct FcObjectTypeNamePool_t *)0)->FcObjectTypeNamePool_str59,FC_VERTICAL_LAYOUT_OBJECT} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = FcObjectTypeHash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + { + register int o = wordlist[key].name; + if (o >= 0) + { + register const char *s = o + FcObjectTypeNamePool; + + if (*str == *s && !strcmp (str + 1, s + 1)) + return &wordlist[key]; + } + } + } + return 0; +} diff --git a/ports/fontconfig/include/fcstdint.h b/ports/fontconfig/include/fcstdint.h new file mode 100644 index 000000000..1a8be6ef0 --- /dev/null +++ b/ports/fontconfig/include/fcstdint.h @@ -0,0 +1,8 @@ +#ifndef _FONTCONFIG_SRC_FCSTDINT_H +#define _FONTCONFIG_SRC_FCSTDINT_H 1 +#ifndef _GENERATED_STDINT_H +#define _GENERATED_STDINT_H "fontconfig 2.12.1" +#define _STDINT_HAVE_STDINT_H 1 +#include <stdint.h> +#endif +#endif diff --git a/ports/fontconfig/include/unistd.h b/ports/fontconfig/include/unistd.h new file mode 100644 index 000000000..7d04abe29 --- /dev/null +++ b/ports/fontconfig/include/unistd.h @@ -0,0 +1,21 @@ +/* Minimal unistd.h, just to get fontconfig to compile */ +#ifndef UNISTD_H +#define UNISTD_H + +#include <io.h> + +#ifndef R_OK +#define R_OK 4 +#endif + +#ifndef W_OK +#define W_OK 2 +#endif + +#ifndef F_OK +#define F_OK 0 +#endif + +typedef int mode_t; + +#endif
\ No newline at end of file diff --git a/ports/fontconfig/portfile.cmake b/ports/fontconfig/portfile.cmake new file mode 100644 index 000000000..8755ad733 --- /dev/null +++ b/ports/fontconfig/portfile.cmake @@ -0,0 +1,39 @@ +
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/fontconfig-2.12.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.1.tar.gz"
+ FILENAME "fontconfig-2.12.1.tar.gz"
+ SHA512 0959a80522e09551e49ec7b2383b7dfb319d4e1c058ad0b55bb35d3f675acbb7ff08c9c30a8798b731070687f84dd3d2ff7e28aafac6ecfa9d3f85c5847c0955)
+
+# Download single-header implementation of dirent API for Windows and it's license
+vcpkg_download_distfile(DIRENT_H
+ URLS "https://raw.githubusercontent.com/tronkko/dirent/8b1db5092479a73d47eafd3de739b27e876e6bf3/include/dirent.h"
+ FILENAME "fontconfig-dirent.h"
+ SHA512 dc9e63fd9cf4ccffdc052f92933633ef9d09dfcfe3b1d15f1f32c99349babd36a62d02283e3d8ba7766d92817be015eb211f11efc4fa52cc90d532a34d1ae785)
+vcpkg_download_distfile(DIRENT_LICENSE
+ URLS "https://raw.githubusercontent.com/tronkko/dirent/8b1db5092479a73d47eafd3de739b27e876e6bf3/LICENSE"
+ FILENAME "fontconfig-dirent-license"
+ SHA512 58c294f80b679252dbee9687ff6bda660fe1ed6f94506e1b9edc19358de98b274b25b3697bdcd34becb28a4f186c6d321a16ab616164e2fb378b37357fc71e4f)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${DIRENT_H} DESTINATION ${SOURCE_PATH})
+file(RENAME ${SOURCE_PATH}/fontconfig-dirent.h ${SOURCE_PATH}/dirent.h)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
+ -DFC_INCLUDE_DIR=${CMAKE_CURRENT_LIST_DIR}/include
+ OPTIONS_DEBUG
+ -DFC_SKIP_TOOLS=ON
+ -DFC_SKIP_HEADERS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/fontconfig)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/fontconfig/COPYING ${CURRENT_PACKAGES_DIR}/share/fontconfig/copyright)
+file(COPY ${DIRENT_LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/fontconfig)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/fontconfig/fontconfig-dirent-license ${CURRENT_PACKAGES_DIR}/share/fontconfig/dirent-for-vs-copyright)
diff --git a/ports/freetype/0003-Fix-UWP.patch b/ports/freetype/0003-Fix-UWP.patch new file mode 100644 index 000000000..253f91e6a --- /dev/null +++ b/ports/freetype/0003-Fix-UWP.patch @@ -0,0 +1,63 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 744b2d5..d114b9b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -312,6 +312,9 @@ else () + set(BASE_SRCS ${BASE_SRCS} src/base/ftdebug.c) + endif () + ++if(MSVC) ++ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS) ++endif() + + if (BUILD_FRAMEWORK) + set(BASE_SRCS +diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h +index 4666d48..382a915 100644 +--- a/include/freetype/freetype.h ++++ b/include/freetype/freetype.h +@@ -845,6 +845,9 @@ FT_BEGIN_HEADER + /*************************************************************************/ + /*************************************************************************/ + ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) ++#define generic GenericFromFreeTypeLibrary ++#endif + + /*************************************************************************/ + /* */ +@@ -1777,6 +1780,10 @@ FT_BEGIN_HEADER + + } FT_GlyphSlotRec; + ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) ++#undef generic ++#endif ++ + + /*************************************************************************/ + /*************************************************************************/ +diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c +index fa05347..ae2754b 100644 +--- a/src/base/ftobjs.c ++++ b/src/base/ftobjs.c +@@ -457,6 +457,9 @@ + return error; + } + ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) ++#define generic GenericFromFreeTypeLibrary ++#endif + + /* documentation is in ftobjs.h */ + +@@ -971,6 +974,9 @@ + FT_FREE( face ); + } + ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) ++#undef generic ++#endif + + static void + Destroy_Driver( FT_Driver driver ) diff --git a/ports/freetype/CONTROL b/ports/freetype/CONTROL index 614017c81..866033e3c 100644 --- a/ports/freetype/CONTROL +++ b/ports/freetype/CONTROL @@ -1,4 +1,4 @@ Source: freetype -Version: 2.6.3-2 -Build-Depends: zlib +Version: 2.6.3-4 +Build-Depends: zlib, bzip2, libpng Description: A library to render fonts.
\ No newline at end of file diff --git a/ports/freetype/portfile.cmake b/ports/freetype/portfile.cmake index 8d7bf158f..360345f1c 100644 --- a/ports/freetype/portfile.cmake +++ b/ports/freetype/portfile.cmake @@ -11,12 +11,17 @@ vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Support-Windows-DLLs-via-CMAKE_WINDOWS_EXPORT_ALL_SY.patch ${CMAKE_CURRENT_LIST_DIR}/0002-Add-CONFIG_INSTALL_PATH-option.patch + ${CMAKE_CURRENT_LIST_DIR}/0003-Fix-UWP.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS -DCONFIG_INSTALL_PATH=share/freetype + -DWITH_ZLIB=ON + -DWITH_BZip2=ON + -DWITH_PNG=ON + -DWITH_HarfBuzz=OFF ) vcpkg_install_cmake() diff --git a/ports/gdal/CONTROL b/ports/gdal/CONTROL index 38eccc46d..16b1caa7e 100644 --- a/ports/gdal/CONTROL +++ b/ports/gdal/CONTROL @@ -1,4 +1,4 @@ Source: gdal -Version: 1.11.3 +Version: 1.11.3-1 Description: The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data. -Build-Depends: proj +Build-Depends: proj, libpng diff --git a/ports/gdal/portfile.cmake b/ports/gdal/portfile.cmake index f198f4f0c..9bf301664 100644 --- a/ports/gdal/portfile.cmake +++ b/ports/gdal/portfile.cmake @@ -32,15 +32,23 @@ file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR) file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/share/gdal" NATIVE_DATA_DIR) file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/share/gdal/html" NATIVE_HTML_DIR) +# Setup proj4 libraries + include path file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" PROJ_INCLUDE_DIR) file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/proj.lib" PROJ_LIBRARY_REL) file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/projd.lib" PROJ_LIBRARY_DBG) +# Setup libpng libraries + include path +file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" PNG_INCLUDE_DIR) +file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libpng16.lib" PNG_LIBRARY_REL) +file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libpng16d.lib" PNG_LIBRARY_DBG) + set(NMAKE_OPTIONS GDAL_HOME=${NATIVE_PACKAGES_DIR} DATADIR=${NATIVE_DATA_DIR} HTMLDIR=${NATIVE_HTML_DIR} PROJ_INCLUDE=-I${PROJ_INCLUDE_DIR} + PNG_EXTERNAL_LIB=1 + PNGDIR=${PNG_INCLUDE_DIR} MSVC_VER=1900 ) @@ -65,12 +73,14 @@ set(NMAKE_OPTIONS_REL "${NMAKE_OPTIONS}" CXX_CRT_FLAGS=${LINKAGE_FLAGS} PROJ_LIBRARY=${PROJ_LIBRARY_REL} + PNG_LIB=${PNG_LIBRARY_REL} ) set(NMAKE_OPTIONS_DBG "${NMAKE_OPTIONS}" CXX_CRT_FLAGS="${LINKAGE_FLAGS}d" PROJ_LIBRARY=${PROJ_LIBRARY_DBG} + PNG_LIB=${PNG_LIBRARY_DBG} DEBUG=1 ) ################ diff --git a/ports/gdk-pixbuf/CMakeLists.txt b/ports/gdk-pixbuf/CMakeLists.txt new file mode 100644 index 000000000..a26e59fb4 --- /dev/null +++ b/ports/gdk-pixbuf/CMakeLists.txt @@ -0,0 +1,128 @@ +cmake_minimum_required(VERSION 3.0) +project(gdk-pixbuf) + +set(GDK_PIXBUF_LIB_SUFFIX 2.0) +set(GDK_PIXBUF_DLL_SUFFIX 2) +set(GDK_PIXBUF_BINARY_VERSION 2.10.0) +set(GLIB_LIB_VERSION 2.0) + +find_package(ZLIB REQUIRED) +find_package(PNG REQUIRED) + +find_path(GLIB_INCLUDE_DIR glib.h) +find_library(GLIB_GLIB_LIBRARY glib-${GLIB_LIB_VERSION}) +find_library(GLIB_GIO_LIBRARY gio-${GLIB_LIB_VERSION}) +find_library(GLIB_GOBJECT_LIBRARY gobject-${GLIB_LIB_VERSION}) +find_library(GLIB_GMODULE_LIBRARY gmodule-${GLIB_LIB_VERSION}) +set(GLIB_LIBRARIES ${GLIB_GLIB_LIBRARY} ${GLIB_GOBJECT_LIBRARY} ${GLIB_GMODULE_LIBRARY} ${GLIB_GIO_LIBRARY}) + +find_path(LIBINTL_INCLUDE_DIR libintl.h) +find_library(LIBINTL_LIBRARY NAMES libintl intl) + +configure_file(./config.h.win32 ${CMAKE_SOURCE_DIR}/config.h COPYONLY) +include_directories(. ./gdk-pixbuf) + +add_library(gdk-pixbuf + gdk-pixbuf/gdk-pixbuf.c + gdk-pixbuf/gdk-pixbuf-animation.c + gdk-pixbuf/gdk-pixbuf-data.c + gdk-pixbuf/gdk-pixbuf-io.c + gdk-pixbuf/gdk-pixbuf-loader.c + gdk-pixbuf/gdk-pixbuf-scale.c + gdk-pixbuf/gdk-pixbuf-simple-anim.c + gdk-pixbuf/gdk-pixbuf-scaled-anim.c + gdk-pixbuf/gdk-pixbuf-util.c + gdk-pixbuf/gdk-pixdata.c + gdk-pixbuf/gdk-pixbuf-enum-types.c + gdk-pixbuf/io-ani.c + gdk-pixbuf/io-ani-animation.c + gdk-pixbuf/io-icns.c + gdk-pixbuf/io-pnm.c + gdk-pixbuf/io-png.c + gdk-pixbuf/io-qtif.c + gdk-pixbuf/io-tga.c + gdk-pixbuf/gdk-pixbuf-buffer-queue.c + gdk-pixbuf/io-xpm.c + gdk-pixbuf/io-xbm.c + gdk-pixbuf/pixops/pixops.c + gdk-pixbuf/io-gdip-animation.c + gdk-pixbuf/io-gdip-bmp.c + gdk-pixbuf/io-gdip-emf.c + gdk-pixbuf/io-gdip-gif.c + gdk-pixbuf/io-gdip-ico.c + gdk-pixbuf/io-gdip-jpeg.c + gdk-pixbuf/io-gdip-tiff.c + gdk-pixbuf/io-gdip-utils.c + gdk-pixbuf/io-gdip-wmf.c) + +target_include_directories(gdk-pixbuf PRIVATE + ${GLIB_INCLUDE_DIR} + ${PNG_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} + ${LIBINTL_INCLUDE_DIR}) + +target_link_libraries(gdk-pixbuf + ${GLIB_LIBRARIES} + ${ZLIB_LIBRARIES} + ${PNG_LIBRARIES} + ${LIBINTL_LIBRARY} + Gdiplus) + +target_compile_definitions(gdk-pixbuf PRIVATE + HAVE_CONFIG_H + GDK_PIXBUF_COMPILATION + GDK_PIXBUF_ENABLE_BACKEND + DLL_EXPORT + GDK_PIXBUF_RELOCATABLE + GDK_PIXBUF_PREFIX="/dummy" + GDK_PIXBUF_BINARY_VERSION="${GDK_PIXBUF_BINARY_VERSION}" + INCLUDE_ani + INCLUDE_tga + INCLUDE_xbm + INCLUDE_png + INCLUDE_qtif + INCLUDE_pnm + INCLUDE_icns + INCLUDE_xpm + INCLUDE_gdiplus + G_DISABLE_SINGLE_INCLUDES + GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) + +set_target_properties(gdk-pixbuf PROPERTIES + OUTPUT_NAME gdk_pixbuf-${GDK_PIXBUF_DLL_SUFFIX} + ARCHIVE_OUTPUT_NAME gdk_pixbuf-${GDK_PIXBUF_LIB_SUFFIX}) + +install(TARGETS gdk-pixbuf + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +macro(gdk_add_tool TOOL_NAME) + add_executable(${TOOL_NAME} ${ARGN}) + target_include_directories(${TOOL_NAME} PRIVATE ${GLIB_INCLUDE_DIR}) + target_link_libraries(${TOOL_NAME} gdk-pixbuf ${GLIB_LIBRARIES}) + install(TARGETS ${TOOL_NAME} RUNTIME DESTINATION tools/gdk-pixbuf) +endmacro() + +if(NOT GDK_SKIP_TOOLS) + gdk_add_tool(gdk-pixbuf-csource gdk-pixbuf/gdk-pixbuf-csource.c) + gdk_add_tool(gdk-pixbuf-pixdata gdk-pixbuf/gdk-pixbuf-pixdata.c) +endif() + +if(NOT GDK_SKIP_HEADERS) + INSTALL(FILES + gdk-pixbuf/gdk-pixbuf.h + gdk-pixbuf/gdk-pixbuf-autocleanups.h + gdk-pixbuf/gdk-pixbuf-core.h + gdk-pixbuf/gdk-pixbuf-transform.h + gdk-pixbuf/gdk-pixbuf-io.h + gdk-pixbuf/gdk-pixbuf-animation.h + gdk-pixbuf/gdk-pixbuf-simple-anim.h + gdk-pixbuf/gdk-pixbuf-loader.h + gdk-pixbuf/gdk-pixbuf-enum-types.h + gdk-pixbuf/gdk-pixbuf-marshal.h + gdk-pixbuf/gdk-pixbuf-features.h + gdk-pixbuf/gdk-pixdata.h + gdk-pixbuf/gdk-pixbuf-macros.h + DESTINATION include/gdk-pixbuf) +endif() diff --git a/ports/gdk-pixbuf/CONTROL b/ports/gdk-pixbuf/CONTROL new file mode 100644 index 000000000..8c32ddeff --- /dev/null +++ b/ports/gdk-pixbuf/CONTROL @@ -0,0 +1,4 @@ +Source: gdk-pixbuf +Version: 2.36.5 +Description: Image loading library. +Build-Depends: gettext, zlib, libpng, glib diff --git a/ports/gdk-pixbuf/portfile.cmake b/ports/gdk-pixbuf/portfile.cmake new file mode 100644 index 000000000..7d104a9fe --- /dev/null +++ b/ports/gdk-pixbuf/portfile.cmake @@ -0,0 +1,28 @@ +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(STATUS "Warning: Static building not supported. Building dynamic.") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gdk-pixbuf-2.36.5) +vcpkg_download_distfile(ARCHIVE + URLS "http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.36/gdk-pixbuf-2.36.5.tar.xz" + FILENAME "gdk-pixbuf-2.36.5.tar.xz" + SHA512 27c39bace7bc6cf713915dcb1f35eebfb80ae599d1c9106f48af4cd447050c41e37adee76d29d6b42fbe3d0123b054c8701f2d1b4b99060b4869aa7871523b70) + +vcpkg_extract_source_archive(${ARCHIVE}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG + -DGDK_SKIP_HEADERS=ON + -DGDK_SKIP_TOOLS=ON) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/gdk-pixbuf) + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gdk-pixbuf) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/gdk-pixbuf/COPYING ${CURRENT_PACKAGES_DIR}/share/gdk-pixbuf/copyright) diff --git a/ports/glbinding/portfile.cmake b/ports/glbinding/portfile.cmake index 165c8d889..6f6dfcc68 100644 --- a/ports/glbinding/portfile.cmake +++ b/ports/glbinding/portfile.cmake @@ -53,6 +53,19 @@ file(REMOVE ${CURRENT_PACKAGES_DIR}/AUTHORS ${CURRENT_PACKAGES_DIR}/debug/VERSION ) +# There are some executables that are only built if glfw is found by CMake (see source/tools/*/CMakeLists.txt). +# glfw is not listed as a dependency for glbinding, so this only happen on systems where package glfw3 is present. +# glbinding's CMake doesn't offer the choice to exlude those tools from the build process, so deleting them here: +file(REMOVE ${CURRENT_PACKAGES_DIR}/glcontexts.exe + ${CURRENT_PACKAGES_DIR}/glfunctions.exe + ${CURRENT_PACKAGES_DIR}/glmeta.exe + ${CURRENT_PACKAGES_DIR}/glqueries.exe + ${CURRENT_PACKAGES_DIR}/debug/glcontextsd.exe + ${CURRENT_PACKAGES_DIR}/debug/glfunctionsd.exe + ${CURRENT_PACKAGES_DIR}/debug/glmetad.exe + ${CURRENT_PACKAGES_DIR}/debug/glqueriesd.exe +) + # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/glbinding) file(RENAME ${CURRENT_PACKAGES_DIR}/share/glbinding/LICENSE ${CURRENT_PACKAGES_DIR}/share/glbinding/copyright) diff --git a/ports/glew/CONTROL b/ports/glew/CONTROL index 13eb3262e..21051a475 100644 --- a/ports/glew/CONTROL +++ b/ports/glew/CONTROL @@ -1,3 +1,3 @@ Source: glew -Version: 2.0.0 +Version: 2.0.0-1 Description: The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.
\ No newline at end of file diff --git a/ports/glew/portfile.cmake b/ports/glew/portfile.cmake index e7cf16cf2..c975ca099 100644 --- a/ports/glew/portfile.cmake +++ b/ports/glew/portfile.cmake @@ -57,17 +57,15 @@ message(STATUS "Installing") if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(INSTALL ${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.dll - ${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin ) file(INSTALL ${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.dll - ${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/bin ) file(INSTALL ${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32d.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME glew32.lib ) file(INSTALL ${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32.lib @@ -76,13 +74,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) else() file(INSTALL ${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32sd.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib - RENAME glew32d.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME glew32.lib ) file(INSTALL ${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32s.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib - RENAME glew32.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/lib RENAME glew32.lib ) endif() diff --git a/ports/glib/CMakeLists.txt b/ports/glib/CMakeLists.txt new file mode 100644 index 000000000..341ab1a62 --- /dev/null +++ b/ports/glib/CMakeLists.txt @@ -0,0 +1,166 @@ +cmake_minimum_required(VERSION 3.0) +project(glib) + +set(GLIB_VERSION 2.50.2) +set(GLIB_DLL_SUFFIX 2) +set(GLIB_LIB_SUFFIX 2.0) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + add_definitions(-DG_ENABLE_DEBUG) +endif() + +if(BUILD_SHARED_LIBS) + set(GLIB_EXPORT_MACRO DLL_EXPORT) +endif() + +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + +# find dependencies + +# zlib +find_package(ZLIB REQUIRED) +# pcre +find_path(PCRE_INCLUDE_DIR pcre.h) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(PCRE_SUFFIX d) +endif() +find_library(PCRE_LIBRARY pcre${PCRE_SUFFIX}) +# libiconv +find_path(ICONV_INCLUDE_DIR iconv.h) +find_library(ICONV_LIBRARY NAMES iconv libiconv) +# libffi +find_path(FFI_INCLUDE_DIR ffi.h) +find_library(FFI_LIBRARY NAMES ffi libffi) +# libintl(gettext) +find_path(LIBINTL_INCLUDE_DIR libintl.h) +find_library(LIBINTL_LIBRARY NAMES intl libintl) + +#prepare config files +configure_file(config.h.win32 ${CMAKE_SOURCE_DIR}/config.h COPYONLY) +configure_file(glib/glibconfig.h.win32 ${CMAKE_SOURCE_DIR}/glib/glibconfig.h COPYONLY) +configure_file(gmodule/gmoduleconf.h.win32 ${CMAKE_SOURCE_DIR}/gmodule/gmoduleconf.h COPYONLY) +configure_file(gio/gnetworking.h.win32 ${CMAKE_SOURCE_DIR}/gio/gnetworking.h COPYONLY) +add_definitions(-DHAVE_CONFIG_H) + +include_directories(. ./glib) + +# This macro purposely doesn't find nodes with sources that have additional properties set +# Most of such files in glib are PCRE sources which we don't use anyway +macro(extract_vcproj_sources VC_PROJECT OUT_VAR) + file(READ ${VC_PROJECT} ${VC_PROJECT}-CONTENTS) + STRING(REPLACE "\n" ";" ${VC_PROJECT}-CONTENTS "${${VC_PROJECT}-CONTENTS}") # split by lines + foreach(LINE ${${VC_PROJECT}-CONTENTS}) + if(LINE MATCHES "<ClCompile Include=\\\".*\\\" />") + string(REPLACE "<ClCompile Include=\"..\\..\\..\\" "" LINE ${LINE}) + string(REPLACE "\" />" "" LINE ${LINE}) + string(STRIP ${LINE} LINE) + file(TO_CMAKE_PATH ${LINE} LINE) + list(APPEND ${OUT_VAR} ${LINE}) + endif() + endforeach() +endmacro() + +# main module +extract_vcproj_sources(build/win32/vs14/glib.vcxproj GLIB_SOURCES) +list(APPEND GLIB_SOURCES glib/libcharset/localcharset.c) # modified internal version with prefixed symbols +add_library(glib ${GLIB_SOURCES}) +target_compile_definitions(glib PRIVATE USE_SYSTEM_PCRE ${GLIB_EXPORT_MACRO} GLIB_COMPILATION G_LOG_DOMAIN="GLib" LIBDIR) +target_link_libraries(glib ws2_32 winmm ${PCRE_LIBRARY} ${ICONV_LIBRARY} ${LIBINTL_LIBRARY}) +target_include_directories(glib PRIVATE ${PCRE_INCLUDE_DIR} ${ICONV_INCLUDE_DIR}) +target_include_directories(glib PUBLIC ${LIBINTL_INCLUDE_DIR}) +list(APPEND GLIB_TARGETS glib) + +# gthread +add_library(gthread gthread/gthread-impl.c) +target_compile_definitions(gthread PRIVATE G_LOG_DOMAIN="GThread") +target_link_libraries(gthread glib ${LIBINTL_LIBRARY}) +target_include_directories(gthread PRIVATE ${LIBINTL_INCLUDE_DIR}) +list(APPEND GLIB_TARGETS gthread) + +# gobject +extract_vcproj_sources(build/win32/vs14/gobject.vcxproj GOBJECT_SOURCES) +add_library(gobject ${GOBJECT_SOURCES}) +target_compile_definitions(gobject PRIVATE GOBJECT_COMPILATION ${GLIB_EXPORT_MACRO} G_LOG_DOMAIN="GLib-GObject") +target_link_libraries(gobject gthread glib ${FFI_LIBRARY}) +target_include_directories(gobject PRIVATE ${FFI_INCLUDE_DIR}) +list(APPEND GLIB_TARGETS gobject) + +# gmodule +add_library(gmodule gmodule/gmodule.c) +target_compile_definitions(gmodule PRIVATE G_LOG_DOMAIN="GModule") +target_link_libraries(gmodule glib ${LIBINTL_LIBRARY}) +target_include_directories(gmodule PRIVATE ${LIBINTL_INCLUDE_DIR}) +list(APPEND GLIB_TARGETS gmodule) + +# gio +extract_vcproj_sources(build/win32/vs14/gio.vcxproj GIO_SOURCES) +add_library(gio ${GIO_SOURCES}) +target_compile_definitions(gio PRIVATE GIO_COMPILATION ${GLIB_EXPORT_MACRO} G_LOG_DOMAIN="GLib-GIO") +target_link_libraries(gio glib gmodule gobject ws2_32 shlwapi dnsapi iphlpapi ${ZLIB_LIBRARIES}) +target_include_directories(gio PRIVATE ./gio ./gmodule ${ZLIB_INCLUDE_DIRS}) +list(APPEND GLIB_TARGETS gio) + +foreach(GTARGET ${GLIB_TARGETS}) + set_target_properties(${GTARGET} PROPERTIES + OUTPUT_NAME ${GTARGET}-${GLIB_DLL_SUFFIX} + ARCHIVE_OUTPUT_NAME ${GTARGET}-${GLIB_LIB_SUFFIX}) +endforeach() + +macro(add_glib_tool TOOL_NAME) + add_executable(${TOOL_NAME} ${ARGN}) + target_link_libraries(${TOOL_NAME} glib) + target_compile_definitions(${TOOL_NAME} PRIVATE GLIB_COMPILATION) + list(APPEND GLIB_TOOLS ${TOOL_NAME}) +endmacro() + +macro(add_gio_tool TOOL_NAME) + add_executable(${TOOL_NAME} ${ARGN}) + target_link_libraries(${TOOL_NAME} glib gio gobject gmodule) + target_include_directories(${TOOL_NAME} PRIVATE ./gmodule ./gio) + target_compile_definitions(${TOOL_NAME} PRIVATE GIO_COMPILATION) + list(APPEND GLIB_TOOLS ${TOOL_NAME}) +endmacro() + +if(NOT GLIB_SKIP_TOOLS) + configure_file(gobject/glib-mkenums.in ${CMAKE_SOURCE_DIR}/gobject/glib-mkenums @ONLY) # uses GLIB_VERSION + install(FILES gobject/glib-mkenums DESTINATION tools/glib) + + configure_file(gio/gdbus-2.0/codegen/gdbus-codegen.in ${CMAKE_SOURCE_DIR}/gio/gdbus-2.0/codegen/gdbus-codegen COPYONLY) + install(FILES gio/gdbus-2.0/codegen/gdbus-codegen DESTINATION tools/glib) + file(GLOB CODEGEN_SOURCES gio/gdbus-2.0/codegen/*.py) + install(FILES ${CODEGEN_SOURCES} DESTINATION tools/glib/codegen) + + add_gio_tool(gdbus gio/gdbus-tool.c) + add_gio_tool(gio-querymodules gio/gio-querymodules.c) + file(GLOB GIO_TOOL_SOURCES gio/gio-tool*.c) + add_gio_tool(gio-tool ${GIO_TOOL_SOURCES}) + set_target_properties(gio-tool PROPERTIES OUTPUT_NAME gio) + add_gio_tool(glib-compile-resources gio/glib-compile-resources.c gio/gvdb/gvdb-builder.c) + add_gio_tool(glib-compile-schemas gio/glib-compile-schemas.c gio/gvdb/gvdb-builder.c) + add_gio_tool(gresource gio/gresource-tool.c) + add_gio_tool(gsettings gio/gsettings-tool.c) + + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(WIN win32) + else() + set(WIN win64) + endif() + + add_glib_tool(glib-genmarshal gobject/glib-genmarshal.c) + add_glib_tool(gspawn-${WIN}-helper WIN32 glib/gspawn-win32-helper.c) + add_glib_tool(gspawn-${WIN}-helper-console glib/gspawn-win32-helper-console.c) + + install(TARGETS ${GLIB_TOOLS} RUNTIME DESTINATION tools/glib) +endif() + +install(TARGETS ${GLIB_TARGETS} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) +if(NOT GLIB_SKIP_HEADERS) + include(install_headers) +endif() + +message(STATUS "Link-time dependencies:") +message(STATUS " " ${ZLIB_LIBRARIES}) +message(STATUS " " ${PCRE_LIBRARY}) +message(STATUS " " ${ICONV_LIBRARY}) +message(STATUS " " ${FFI_LIBRARY}) +message(STATUS " " ${LIBINTL_LIBRARY}) diff --git a/ports/glib/CONTROL b/ports/glib/CONTROL new file mode 100644 index 000000000..984d7576a --- /dev/null +++ b/ports/glib/CONTROL @@ -0,0 +1,4 @@ +Source: glib +Version: 2.50.2 +Description: Portable, general-purpose utility library. +Build-Depends: zlib, pcre, libffi, gettext, libiconv diff --git a/ports/glib/cmake/install_headers.cmake b/ports/glib/cmake/install_headers.cmake new file mode 100644 index 000000000..e94a12e49 --- /dev/null +++ b/ports/glib/cmake/install_headers.cmake @@ -0,0 +1,255 @@ +# generated from glib-install.props +install(FILES glib/glib.h DESTINATION include) +install(FILES glib/glibconfig.h DESTINATION include) +install(FILES glib/glib.h DESTINATION include) +install(FILES glib/glib-object.h DESTINATION include) +install(FILES glib/deprecated/gallocator.h DESTINATION include/glib/deprecated) +install(FILES glib/deprecated/gcache.h DESTINATION include/glib/deprecated) +install(FILES glib/deprecated/gcompletion.h DESTINATION include/glib/deprecated) +install(FILES glib/deprecated/gmain.h DESTINATION include/glib/deprecated) +install(FILES glib/deprecated/grel.h DESTINATION include/glib/deprecated) +install(FILES glib/deprecated/gthread.h DESTINATION include/glib/deprecated) +install(FILES glib/glib-autocleanups.h DESTINATION include/glib) +install(FILES glib/galloca.h DESTINATION include/glib) +install(FILES glib/garray.h DESTINATION include/glib) +install(FILES glib/gasyncqueue.h DESTINATION include/glib) +install(FILES glib/gatomic.h DESTINATION include/glib) +install(FILES glib/gbacktrace.h DESTINATION include/glib) +install(FILES glib/gbase64.h DESTINATION include/glib) +install(FILES glib/gbitlock.h DESTINATION include/glib) +install(FILES glib/gbookmarkfile.h DESTINATION include/glib) +install(FILES glib/gbytes.h DESTINATION include/glib) +install(FILES glib/gcharset.h DESTINATION include/glib) +install(FILES glib/gchecksum.h DESTINATION include/glib) +install(FILES glib/gconvert.h DESTINATION include/glib) +install(FILES glib/gdataset.h DESTINATION include/glib) +install(FILES glib/gdate.h DESTINATION include/glib) +install(FILES glib/gdatetime.h DESTINATION include/glib) +install(FILES glib/gdir.h DESTINATION include/glib) +install(FILES glib/genviron.h DESTINATION include/glib) +install(FILES glib/gerror.h DESTINATION include/glib) +install(FILES glib/gfileutils.h DESTINATION include/glib) +install(FILES glib/ggettext.h DESTINATION include/glib) +install(FILES glib/ghash.h DESTINATION include/glib) +install(FILES glib/ghmac.h DESTINATION include/glib) +install(FILES glib/ghook.h DESTINATION include/glib) +install(FILES glib/ghostutils.h DESTINATION include/glib) +install(FILES glib/gi18n.h DESTINATION include/glib) +install(FILES glib/gi18n-lib.h DESTINATION include/glib) +install(FILES glib/giochannel.h DESTINATION include/glib) +install(FILES glib/gkeyfile.h DESTINATION include/glib) +install(FILES glib/glist.h DESTINATION include/glib) +install(FILES glib/gmacros.h DESTINATION include/glib) +install(FILES glib/gmain.h DESTINATION include/glib) +install(FILES glib/gmappedfile.h DESTINATION include/glib) +install(FILES glib/gmarkup.h DESTINATION include/glib) +install(FILES glib/gmem.h DESTINATION include/glib) +install(FILES glib/gmessages.h DESTINATION include/glib) +install(FILES glib/gnode.h DESTINATION include/glib) +install(FILES glib/goption.h DESTINATION include/glib) +install(FILES glib/gpattern.h DESTINATION include/glib) +install(FILES glib/gpoll.h DESTINATION include/glib) +install(FILES glib/gprimes.h DESTINATION include/glib) +install(FILES glib/gqsort.h DESTINATION include/glib) +install(FILES glib/gquark.h DESTINATION include/glib) +install(FILES glib/gqueue.h DESTINATION include/glib) +install(FILES glib/grand.h DESTINATION include/glib) +install(FILES glib/gregex.h DESTINATION include/glib) +install(FILES glib/gscanner.h DESTINATION include/glib) +install(FILES glib/gsequence.h DESTINATION include/glib) +install(FILES glib/gshell.h DESTINATION include/glib) +install(FILES glib/gslice.h DESTINATION include/glib) +install(FILES glib/gslist.h DESTINATION include/glib) +install(FILES glib/gspawn.h DESTINATION include/glib) +install(FILES glib/gstdio.h DESTINATION include/glib) +install(FILES glib/gstrfuncs.h DESTINATION include/glib) +install(FILES glib/gtestutils.h DESTINATION include/glib) +install(FILES glib/gstring.h DESTINATION include/glib) +install(FILES glib/gstringchunk.h DESTINATION include/glib) +install(FILES glib/gthread.h DESTINATION include/glib) +install(FILES glib/gthreadpool.h DESTINATION include/glib) +install(FILES glib/gtimer.h DESTINATION include/glib) +install(FILES glib/gtimezone.h DESTINATION include/glib) +install(FILES glib/gtrashstack.h DESTINATION include/glib) +install(FILES glib/gtree.h DESTINATION include/glib) +install(FILES glib/gtypes.h DESTINATION include/glib) +install(FILES glib/gunicode.h DESTINATION include/glib) +install(FILES glib/gurifuncs.h DESTINATION include/glib) +install(FILES glib/gutils.h DESTINATION include/glib) +install(FILES glib/gvarianttype.h DESTINATION include/glib) +install(FILES glib/gvariant.h DESTINATION include/glib) +install(FILES glib/gversion.h DESTINATION include/glib) +install(FILES glib/gversionmacros.h DESTINATION include/glib) +install(FILES glib/gwin32.h DESTINATION include/glib) +install(FILES glib/gprintf.h DESTINATION include/glib) +install(FILES gmodule/gmodule.h DESTINATION include) +install(FILES gobject/gobject-autocleanups.h DESTINATION include/gobject) +install(FILES gobject/glib-types.h DESTINATION include/gobject) +install(FILES gobject/gbinding.h DESTINATION include/gobject) +install(FILES gobject/gboxed.h DESTINATION include/gobject) +install(FILES gobject/gclosure.h DESTINATION include/gobject) +install(FILES gobject/genums.h DESTINATION include/gobject) +install(FILES gobject/gmarshal.h DESTINATION include/gobject) +install(FILES gobject/gobject.h DESTINATION include/gobject) +install(FILES gobject/gparam.h DESTINATION include/gobject) +install(FILES gobject/gparamspecs.h DESTINATION include/gobject) +install(FILES gobject/gsignal.h DESTINATION include/gobject) +install(FILES gobject/gsourceclosure.h DESTINATION include/gobject) +install(FILES gobject/gtype.h DESTINATION include/gobject) +install(FILES gobject/gtypemodule.h DESTINATION include/gobject) +install(FILES gobject/gtypeplugin.h DESTINATION include/gobject) +install(FILES gobject/gvalue.h DESTINATION include/gobject) +install(FILES gobject/gvaluearray.h DESTINATION include/gobject) +install(FILES gobject/gvaluecollector.h DESTINATION include/gobject) +install(FILES gobject/gvaluetypes.h DESTINATION include/gobject) +install(FILES gobject/gobjectnotifyqueue.c DESTINATION include/gobject) +install(FILES gio/gappinfo.h DESTINATION include/gio) +install(FILES gio/gasyncinitable.h DESTINATION include/gio) +install(FILES gio/gasyncresult.h DESTINATION include/gio) +install(FILES gio/gbufferedinputstream.h DESTINATION include/gio) +install(FILES gio/gbufferedoutputstream.h DESTINATION include/gio) +install(FILES gio/gbytesicon.h DESTINATION include/gio) +install(FILES gio/gcancellable.h DESTINATION include/gio) +install(FILES gio/gcontenttype.h DESTINATION include/gio) +install(FILES gio/gcharsetconverter.h DESTINATION include/gio) +install(FILES gio/gconverter.h DESTINATION include/gio) +install(FILES gio/gconverterinputstream.h DESTINATION include/gio) +install(FILES gio/gconverteroutputstream.h DESTINATION include/gio) +install(FILES gio/gdatagrambased.h DESTINATION include/gio) +install(FILES gio/gdatainputstream.h DESTINATION include/gio) +install(FILES gio/gdataoutputstream.h DESTINATION include/gio) +install(FILES gio/gdrive.h DESTINATION include/gio) +install(FILES gio/gemblem.h DESTINATION include/gio) +install(FILES gio/gemblemedicon.h DESTINATION include/gio) +install(FILES gio/gfile.h DESTINATION include/gio) +install(FILES gio/gfileattribute.h DESTINATION include/gio) +install(FILES gio/gfileenumerator.h DESTINATION include/gio) +install(FILES gio/gfileicon.h DESTINATION include/gio) +install(FILES gio/gfileinfo.h DESTINATION include/gio) +install(FILES gio/gfileinputstream.h DESTINATION include/gio) +install(FILES gio/gfilemonitor.h DESTINATION include/gio) +install(FILES gio/gfilenamecompleter.h DESTINATION include/gio) +install(FILES gio/gfileoutputstream.h DESTINATION include/gio) +install(FILES gio/gfileiostream.h DESTINATION include/gio) +install(FILES gio/gfilterinputstream.h DESTINATION include/gio) +install(FILES gio/gfilteroutputstream.h DESTINATION include/gio) +install(FILES gio/gicon.h DESTINATION include/gio) +install(FILES gio/ginetaddress.h DESTINATION include/gio) +install(FILES gio/ginetaddressmask.h DESTINATION include/gio) +install(FILES gio/ginetsocketaddress.h DESTINATION include/gio) +install(FILES gio/ginputstream.h DESTINATION include/gio) +install(FILES gio/ginitable.h DESTINATION include/gio) +install(FILES gio/gio.h DESTINATION include/gio) +install(FILES gio/gio-autocleanups.h DESTINATION include/gio) +install(FILES gio/giotypes.h DESTINATION include/gio) +install(FILES gio/gioenums.h DESTINATION include/gio) +install(FILES gio/gioerror.h DESTINATION include/gio) +install(FILES gio/giomodule.h DESTINATION include/gio) +install(FILES gio/gioscheduler.h DESTINATION include/gio) +install(FILES gio/giostream.h DESTINATION include/gio) +install(FILES gio/gloadableicon.h DESTINATION include/gio) +install(FILES gio/gmount.h DESTINATION include/gio) +install(FILES gio/gmemoryinputstream.h DESTINATION include/gio) +install(FILES gio/gmemoryoutputstream.h DESTINATION include/gio) +install(FILES gio/gmountoperation.h DESTINATION include/gio) +install(FILES gio/gnativevolumemonitor.h DESTINATION include/gio) +install(FILES gio/gnetworkaddress.h DESTINATION include/gio) +install(FILES gio/gnetworkmonitor.h DESTINATION include/gio) +install(FILES gio/gnetworkservice.h DESTINATION include/gio) +install(FILES gio/goutputstream.h DESTINATION include/gio) +install(FILES gio/gpermission.h DESTINATION include/gio) +install(FILES gio/gpollableinputstream.h DESTINATION include/gio) +install(FILES gio/gpollableoutputstream.h DESTINATION include/gio) +install(FILES gio/gpollableutils.h DESTINATION include/gio) +install(FILES gio/gproxyaddress.h DESTINATION include/gio) +install(FILES gio/gproxy.h DESTINATION include/gio) +install(FILES gio/gproxyaddressenumerator.h DESTINATION include/gio) +install(FILES gio/gproxyresolver.h DESTINATION include/gio) +install(FILES gio/gresolver.h DESTINATION include/gio) +install(FILES gio/gresource.h DESTINATION include/gio) +install(FILES gio/gseekable.h DESTINATION include/gio) +install(FILES gio/gsimpleasyncresult.h DESTINATION include/gio) +install(FILES gio/gsimpleiostream.h DESTINATION include/gio) +install(FILES gio/gsimplepermission.h DESTINATION include/gio) +install(FILES gio/gsocket.h DESTINATION include/gio) +install(FILES gio/gsocketaddress.h DESTINATION include/gio) +install(FILES gio/gsocketaddressenumerator.h DESTINATION include/gio) +install(FILES gio/gsocketclient.h DESTINATION include/gio) +install(FILES gio/gsocketconnectable.h DESTINATION include/gio) +install(FILES gio/gsocketconnection.h DESTINATION include/gio) +install(FILES gio/gsocketcontrolmessage.h DESTINATION include/gio) +install(FILES gio/gsocketlistener.h DESTINATION include/gio) +install(FILES gio/gsocketservice.h DESTINATION include/gio) +install(FILES gio/gsrvtarget.h DESTINATION include/gio) +install(FILES gio/gsimpleproxyresolver.h DESTINATION include/gio) +install(FILES gio/gtask.h DESTINATION include/gio) +install(FILES gio/gsubprocess.h DESTINATION include/gio) +install(FILES gio/gsubprocesslauncher.h DESTINATION include/gio) +install(FILES gio/gtcpconnection.h DESTINATION include/gio) +install(FILES gio/gtcpwrapperconnection.h DESTINATION include/gio) +install(FILES gio/gthreadedsocketservice.h DESTINATION include/gio) +install(FILES gio/gthemedicon.h DESTINATION include/gio) +install(FILES gio/gtlsbackend.h DESTINATION include/gio) +install(FILES gio/gtlscertificate.h DESTINATION include/gio) +install(FILES gio/gtlsclientconnection.h DESTINATION include/gio) +install(FILES gio/gtlsconnection.h DESTINATION include/gio) +install(FILES gio/gtlsdatabase.h DESTINATION include/gio) +install(FILES gio/gtlsfiledatabase.h DESTINATION include/gio) +install(FILES gio/gtlsinteraction.h DESTINATION include/gio) +install(FILES gio/gtlspassword.h DESTINATION include/gio) +install(FILES gio/gtlsserverconnection.h DESTINATION include/gio) +install(FILES gio/gdtlsconnection.h DESTINATION include/gio) +install(FILES gio/gdtlsclientconnection.h DESTINATION include/gio) +install(FILES gio/gdtlsserverconnection.h DESTINATION include/gio) +install(FILES gio/gvfs.h DESTINATION include/gio) +install(FILES gio/gvolume.h DESTINATION include/gio) +install(FILES gio/gvolumemonitor.h DESTINATION include/gio) +install(FILES gio/gzlibcompressor.h DESTINATION include/gio) +install(FILES gio/gzlibdecompressor.h DESTINATION include/gio) +install(FILES gio/glistmodel.h DESTINATION include/gio) +install(FILES gio/gliststore.h DESTINATION include/gio) +install(FILES gio/gapplication.h DESTINATION include/gio) +install(FILES gio/gapplicationcommandline.h DESTINATION include/gio) +install(FILES gio/gactiongroup.h DESTINATION include/gio) +install(FILES gio/gactionmap.h DESTINATION include/gio) +install(FILES gio/gsimpleactiongroup.h DESTINATION include/gio) +install(FILES gio/gremoteactiongroup.h DESTINATION include/gio) +install(FILES gio/gactiongroupexporter.h DESTINATION include/gio) +install(FILES gio/gdbusactiongroup.h DESTINATION include/gio) +install(FILES gio/gaction.h DESTINATION include/gio) +install(FILES gio/gpropertyaction.h DESTINATION include/gio) +install(FILES gio/gsimpleaction.h DESTINATION include/gio) +install(FILES gio/gmenumodel.h DESTINATION include/gio) +install(FILES gio/gmenu.h DESTINATION include/gio) +install(FILES gio/gmenuexporter.h DESTINATION include/gio) +install(FILES gio/gdbusmenumodel.h DESTINATION include/gio) +install(FILES gio/gnotification.h DESTINATION include/gio) +install(FILES gio/gsettingsbackend.h DESTINATION include/gio) +install(FILES gio/gsettingsschema.h DESTINATION include/gio) +install(FILES gio/gsettings.h DESTINATION include/gio) +install(FILES gio/gdbusauthobserver.h DESTINATION include/gio) +install(FILES gio/gcredentials.h DESTINATION include/gio) +install(FILES gio/gdbusutils.h DESTINATION include/gio) +install(FILES gio/gdbuserror.h DESTINATION include/gio) +install(FILES gio/gdbusaddress.h DESTINATION include/gio) +install(FILES gio/gdbusconnection.h DESTINATION include/gio) +install(FILES gio/gdbusmessage.h DESTINATION include/gio) +install(FILES gio/gdbusnameowning.h DESTINATION include/gio) +install(FILES gio/gdbusnamewatching.h DESTINATION include/gio) +install(FILES gio/gdbusproxy.h DESTINATION include/gio) +install(FILES gio/gdbusintrospection.h DESTINATION include/gio) +install(FILES gio/gdbusmethodinvocation.h DESTINATION include/gio) +install(FILES gio/gdbusserver.h DESTINATION include/gio) +install(FILES gio/gdbusinterface.h DESTINATION include/gio) +install(FILES gio/gdbusinterfaceskeleton.h DESTINATION include/gio) +install(FILES gio/gdbusobject.h DESTINATION include/gio) +install(FILES gio/gdbusobjectskeleton.h DESTINATION include/gio) +install(FILES gio/gdbusobjectproxy.h DESTINATION include/gio) +install(FILES gio/gdbusobjectmanager.h DESTINATION include/gio) +install(FILES gio/gdbusobjectmanagerclient.h DESTINATION include/gio) +install(FILES gio/gdbusobjectmanagerserver.h DESTINATION include/gio) +install(FILES gio/gtestdbus.h DESTINATION include/gio) +install(FILES gio/gioenumtypes.h DESTINATION include/gio) +install(FILES gio/gnetworking.h DESTINATION include/gio) +install(FILES gio/gwin32inputstream.h DESTINATION include/gio) +install(FILES gio/gwin32outputstream.h DESTINATION include/gio) diff --git a/ports/glib/portfile.cmake b/ports/glib/portfile.cmake new file mode 100644 index 000000000..71f1f366c --- /dev/null +++ b/ports/glib/portfile.cmake @@ -0,0 +1,42 @@ + # Glib uses winapi functions not available in WindowsStore +if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore) + message(FATAL_ERROR "Error: UWP builds are currently not supported.") +endif() + +# Glib relies on DllMain +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(STATUS "Warning: Static building not supported. Building dynamic.") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glib-2.50.2) +vcpkg_download_distfile(ARCHIVE + URLS "https://ftp.gnome.org/pub/gnome/sources/glib/2.50/glib-2.50.2.tar.xz" + FILENAME "glib-2.50.2.tar.xz" + SHA512 63d7b5ece8d7d15b10e06ef10a8e0a4446f30a8d9c97daa3352ec00dfef622728bd42ed24cbf67e553166a0f9e29a3e3d024d1d085b9804fd67608db438b6771) + +vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/use-libiconv-on-windows.patch) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake DESTINATION ${SOURCE_PATH}) +file(REMOVE_RECURSE ${SOURCE_PATH}/glib/pcre) +file(REMOVE ${SOURCE_PATH}/glib/win_iconv.c) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG + -DGLIB_SKIP_HEADERS=ON + -DGLIB_SKIP_TOOLS=ON) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/glib) + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/glib) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/glib/COPYING ${CURRENT_PACKAGES_DIR}/share/glib/copyright) + diff --git a/ports/glib/use-libiconv-on-windows.patch b/ports/glib/use-libiconv-on-windows.patch new file mode 100644 index 000000000..927de0bb1 --- /dev/null +++ b/ports/glib/use-libiconv-on-windows.patch @@ -0,0 +1,14 @@ +diff --git a/glib/gconvert.c b/glib/gconvert.c +index 3deac78..134ded9 100644 +--- a/glib/gconvert.c ++++ b/glib/gconvert.c +@@ -30,7 +30,8 @@ + #include <stdlib.h> + + #ifdef G_OS_WIN32 +-#include "win_iconv.c" ++#define USE_LIBICONV_GNU ++#include <iconv.h> + #endif + + #ifdef G_PLATFORM_WIN32 diff --git a/ports/grpc/CONTROL b/ports/grpc/CONTROL index ece5b96ce..3a248b448 100644 --- a/ports/grpc/CONTROL +++ b/ports/grpc/CONTROL @@ -1,4 +1,4 @@ Source: grpc -Version: 1.1.0-dev-1674f65 +Version: 1.1.2-1 Build-Depends: zlib, openssl, protobuf Description: An RPC library and framework
\ No newline at end of file diff --git a/ports/grpc/grpc-fix-cmake-build.patch b/ports/grpc/grpc-fix-cmake-build.patch new file mode 100644 index 000000000..95e345036 --- /dev/null +++ b/ports/grpc/grpc-fix-cmake-build.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d52e199..30ed816 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2072,6 +2072,8 @@ foreach(_hdr + include/grpc/impl/codegen/sync_generic.h + include/grpc/impl/codegen/sync_posix.h + include/grpc/impl/codegen/sync_windows.h ++ include/grpc++/impl/codegen/proto_utils.h ++ include/grpc++/impl/codegen/config_protobuf.h + ) + string(REPLACE "include/" "" _path ${_hdr}) + get_filename_component(_path ${_path} PATH) diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index a54af6e55..c6239d8c3 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -1,41 +1,30 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) endif() 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 - ) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/grpc-1.1.2) + +if(EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src) endif() -message(STATUS "Adding worktree and updating sumbodules done") + +vcpkg_download_distfile(ARCHIVE_FILE + URLS "https://github.com/grpc/grpc/archive/v1.1.2.zip" + FILENAME "grpc-v1.1.2.tar.gz" + SHA512 6e0666ecb72f0a78148fadf627e05b5ba0f1c893919f1e691775d09374e7c4b9b05ff1d276e716ac2a81eb2a3fb88c4a095928589286d2f083bd60539050f5d9 +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) + +# patch is from https://github.com/grpc/grpc/commit/a5fac1f8a00b0ba6ca784baa4783ab947579693b +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/grpc-fix-cmake-build.patch +) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DgRPC_INSTALL=ON -DgRPC_ZLIB_PROVIDER=package @@ -48,14 +37,39 @@ 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) +# Update import target prefix in gRPCTargets.cmake +file(READ ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets.cmake _contents) +set(pattern "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n") +string(REPLACE "${pattern}${pattern}" "${pattern}" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets.cmake "${_contents}") + +# Update paths in gRPCTargets-release.cmake +file(READ ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets-release.cmake _contents) +string(REPLACE "\${_IMPORT_PREFIX}/bin/" "\${_IMPORT_PREFIX}/tools/" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-release.cmake "${_contents}") + +# Update paths in gRPCTargets-debug.cmake +file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake _contents) +string(REPLACE "\${_IMPORT_PREFIX}/bin/" "\${_IMPORT_PREFIX}/tools/" _contents "${_contents}") +string(REPLACE "\${_IMPORT_PREFIX}/lib/" "\${_IMPORT_PREFIX}/debug/lib/" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake "${_contents}") + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/grpc_cpp_plugin.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) + +# Install tools and plugins +file( + INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/ + DESTINATION ${CURRENT_PACKAGES_DIR}/tools + FILES_MATCHING PATTERN "*.exe" +) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) vcpkg_copy_pdbs() diff --git a/ports/gtest/portfile.cmake b/ports/gtest/portfile.cmake index d1ba722d7..33db3b2ba 100644 --- a/ports/gtest/portfile.cmake +++ b/ports/gtest/portfile.cmake @@ -1,7 +1,3 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() include(vcpkg_common_functions) find_program(GIT git) @@ -42,16 +38,19 @@ vcpkg_configure_cmake( 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) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + 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) +endif() file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gtest.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gtest.lib) diff --git a/ports/gtk/CMakeLists.txt b/ports/gtk/CMakeLists.txt new file mode 100644 index 000000000..94bf37abb --- /dev/null +++ b/ports/gtk/CMakeLists.txt @@ -0,0 +1,171 @@ +cmake_minimum_required(VERSION 3.0) +project(gtk+ C) + +configure_file(config.h.win32 ${CMAKE_CURRENT_SOURCE_DIR}/config.h COPYONLY) +configure_file(gdk/gdkconfig.h.win32_broadway ${CMAKE_CURRENT_SOURCE_DIR}/gdk/gdkconfig.h COPYONLY) + +set(GTK_VERSION 3.22.8) + +set(GLIB_LIB_SUFFIX 2.0) +set(PANGO_LIB_SUFFIX 1.0) +set(ATK_LIB_SUFFIX 1.0) +set(GDK_PIXBUF_LIB_SUFFIX 2.0) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(CAIRO_LIB_SUFFIX d) +endif() + +# find dependencies +# glib +find_path(GLIB_INCLUDE_DIR glib.h) +find_library(GLIB_GLIB_LIBRARY glib-${GLIB_LIB_SUFFIX}) +find_library(GLIB_GIO_LIBRARY gio-${GLIB_LIB_SUFFIX}) +find_library(GLIB_GMODULE_LIBRARY gmodule-${GLIB_LIB_SUFFIX}) +find_library(GLIB_GOBJECT_LIBRARY gobject-${GLIB_LIB_SUFFIX}) +set(GLIB_LIBRARIES ${GLIB_GLIB_LIBRARY} ${GLIB_GIO_LIBRARY} ${GLIB_GMODULE_LIBRARY} ${GLIB_GOBJECT_LIBRARY}) + +# pango +find_path(PANGO_INCLUDE_DIR pango/pango.h) +find_library(PANGO_LIBRARY pango-${PANGO_LIB_SUFFIX}) +find_library(PANGO_CAIRO_LIBRARY pangocairo-${PANGO_LIB_SUFFIX}) +find_library(PANGO_WIN32_LIBRARY pangowin32-${PANGO_LIB_SUFFIX}) +set(PANGO_LIBRARIES ${PANGO_LIBRARY} ${PANGO_CAIRO_LIBRARY} ${PANGO_WIN32_LIBRARY}) +# cairo +find_library(CAIRO_LIBRARY cairo${CAIRO_LIB_SUFFIX}) +find_library(CAIRO_GOBJECT_LIBRARY cairo-gobject${CAIRO_LIB_SUFFIX}) +set(CAIRO_LIBRARIES ${CAIRO_LIBRARY} ${CAIRO_GOBJECT_LIBRARY}) +find_path(CAIRO_INCLUDE_DIR cairo.h) + +# atk +find_path(ATK_INCLUDE_DIR atk/atk.h) +find_library(ATK_LIBRARY atk-${ATK_LIB_SUFFIX}) + +# gdk-pixbuf +find_path(GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h) +find_library(GDK_PIXBUF_LIBRARY gdk_pixbuf-${GDK_PIXBUF_LIB_SUFFIX}) + +# epoxy +find_path(EPOXY_INCLUDE_DIR epoxy/common.h) +find_library(EPOXY_LIBRARY epoxy) + +# gettext +find_path(LIBINTL_INCLUDE_DIR libintl.h) +find_library(LIBINTL_LIBRARY NAMES intl libintl) + +set(GTK_REQUIRED_LIBRARIES + ${LIBINTL_LIBRARY} + ${EPOXY_LIBRARY} + ${GLIB_LIBRARIES} + ${CAIRO_LIBRARIES} + ${PANGO_LIBRARIES} + ${GDK_PIXBUF_LIBRARY} + ${ATK_LIBRARY}) + +set(GTK_REQUIRED_INCLUDE_DIR + ${LIBINTL_INCLUDE_DIR} + ${EPOXY_INCLUDE_DIR} + ${GLIB_INCLUDE_DIR} + ${GDK_PIXBUF_INCLUDE_DIR} + ${CAIRO_INCLUDE_DIR} + ${PANGO_INCLUDE_DIR} + ${ATK_INCLUDE_DIR}) + +# defines expected by all modules +add_definitions( + -DHAVE_CONFIG_H + -DG_DISABLE_SINGLE_INCLUDES + -DATK_DISABLE_SINGLE_INCLUDES + -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES + -DGTK_DISABLE_SINGLE_INCLUDES + -D_USE_MATH_DEFINES) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + add_definitions(-DG_ENABLE_DEBUG) +endif() + +macro(extract_vcproj_sources VC_PROJECT OUT_VAR) + file(READ ${VC_PROJECT} ${VC_PROJECT}-CONTENTS) + STRING(REPLACE "\n" ";" ${VC_PROJECT}-CONTENTS "${${VC_PROJECT}-CONTENTS}") # split by lines + foreach(LINE ${${VC_PROJECT}-CONTENTS}) + if(LINE MATCHES "<ClCompile Include=\\\".*\\\" />") + string(REPLACE "<ClCompile Include=\"..\\..\\..\\" "" LINE ${LINE}) + string(REPLACE "\" />" "" LINE ${LINE}) + string(STRIP ${LINE} LINE) + file(TO_CMAKE_PATH ${LINE} LINE) + list(APPEND ${OUT_VAR} ${LINE}) + endif() + endforeach() +endmacro() + +# build 'win32' gdk backend +extract_vcproj_sources(build/win32/vs14/gdk3-win32.vcxproj GDK_WIN32_SOURCES) +add_library(gdk-3-win32 STATIC ${GDK_WIN32_SOURCES}) +target_compile_definitions(gdk-3-win32 PRIVATE + GDK_COMPILATION G_LOG_DOMAIN="Gdk" INSIDE_GDK_WIN32) +target_include_directories(gdk-3-win32 PRIVATE . ./gdk ./gdk/win32 ${GTK_REQUIRED_INCLUDE_DIR}) + +# build 'broadway' gdk backend +extract_vcproj_sources(build/win32/vs14/gdk3-broadway.vcxproj GDK_BROADWAY_SOURCES) +add_library(gdk-3-broadway STATIC ${GDK_BROADWAY_SOURCES}) +target_compile_definitions(gdk-3-broadway PRIVATE + GDK_COMPILATION G_LOG_DOMAIN="Gdk") +target_include_directories(gdk-3-broadway PRIVATE . ./gdk ./gdk/broadway ${GTK_REQUIRED_INCLUDE_DIR}) + +macro(gtk_add_module MODULE_NAME) + add_library(${MODULE_NAME} ${ARGN}) + target_include_directories(${MODULE_NAME} PRIVATE . ./gdk ./gtk ${GTK_REQUIRED_INCLUDE_DIR}) + target_link_libraries(${MODULE_NAME} ${GTK_REQUIRED_LIBRARIES}) + set_target_properties(${MODULE_NAME} PROPERTIES + ARCHIVE_OUTPUT_NAME ${MODULE_NAME}.0) + install(TARGETS ${MODULE_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) +endmacro() + +extract_vcproj_sources(build/win32/vs14/gdk-3.vcxproj GDK_SOURCES) +gtk_add_module(gdk-3 ${GDK_SOURCES}) +target_compile_definitions(gdk-3 PRIVATE GDK_COMPILATION) +target_include_directories(gdk-3 PRIVATE ./gdk/win32 ./gdk/broadway) +target_link_libraries(gdk-3 gdk-3-win32 gdk-3-broadway winmm dwmapi setupapi imm32 ws2_32) + +extract_vcproj_sources(build/win32/vs14/gtk-3.vcxproj GTK_SOURCES) +set_source_files_properties(gtk/inspector/visual.c PROPERTIES COMPILE_FLAGS "/FImath.h") +gtk_add_module(gtk-3 ${GTK_SOURCES}) +target_compile_definitions(gtk-3 PRIVATE + GTK_COMPILATION + G_LOG_DOMAIN="Gtk" + GTK_HOST="i686-pc" + GTK_PRINT_BACKENDS="file" + GTK_PRINT_BACKEND_ENABLE_UNSUPPORTED + INCLUDE_IM_am_et + INCLUDE_IM_cedilla + INCLUDE_IM_cyrillic_translit + INCLUDE_IM_ime + INCLUDE_IM_inuktitut + INCLUDE_IM_ipa + INCLUDE_IM_multipress + INCLUDE_IM_thai + INCLUDE_IM_ti_er + INCLUDE_IM_ti_et + INCLUDE_IM_viqr + GTK_LIBDIR="/dummy/lib" + GTK_DATADIR="/dummy/share" + GTK_DATA_PREFIX="/dummy" + GTK_SYSCONFDIR="/dummy/etc" + MULTIPRESS_CONFDIR="/dummy/etc/gtk-3.0" + MULTIPRESS_LOCALEDIR="/dummy/share/locale" + GTK_VERSION="${GTK_VERSION}/etc" + GTK_BINARY_VERSION="3.0.0/etc" + GDK_DISABLE_DEPRECATED + ISOLATION_AWARE_ENABLED) +target_link_libraries(gtk-3 gdk-3 winspool comctl32 imm32) +target_compile_options(gtk-3 PRIVATE "/wd4828" PRIVATE "/wd4244" PRIVATE "/wd4305" PRIVATE "/wd4018") + +extract_vcproj_sources(build/win32/vs14/gailutil-3.vcxproj GAILUTIL_SOURCES) +gtk_add_module(gailutil-3 ${GAILUTIL_SOURCES}) +target_compile_definitions(gailutil-3 PRIVATE GTK_DISABLE_DEPRECATED GDK_DISABLE_DEPRECATED) +target_link_libraries(gailutil-3 gtk-3 gdk-3) +set_target_properties(gailutil-3 PROPERTIES + LINK_FLAGS \"/DEF:${CMAKE_CURRENT_SOURCE_DIR}/libgail-util/gailutil.def\") + +if(NOT GTK_SKIP_HEADERS) + set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + include(install_headers) +endif() diff --git a/ports/gtk/CONTROL b/ports/gtk/CONTROL new file mode 100644 index 000000000..01eee28cf --- /dev/null +++ b/ports/gtk/CONTROL @@ -0,0 +1,4 @@ +Source: gtk +Version: 3.22.8 +Description: Portable library for creating graphical user interfaces. +Build-Depends: glib, atk, gdk-pixbuf, pango, cairo, libepoxy, gettext diff --git a/ports/gtk/cmake/install_headers.cmake b/ports/gtk/cmake/install_headers.cmake new file mode 100644 index 000000000..ca2a273e4 --- /dev/null +++ b/ports/gtk/cmake/install_headers.cmake @@ -0,0 +1,376 @@ +install(FILES gdk/win32/gdkwin32.h DESTINATION include/gdk) +install(FILES gdk/gdk.h DESTINATION include/gdk) +install(FILES gdk/gdk-autocleanup.h DESTINATION include/gdk) +install(FILES gdk/gdkapplaunchcontext.h DESTINATION include/gdk) +install(FILES gdk/gdkcairo.h DESTINATION include/gdk) +install(FILES gdk/gdkcursor.h DESTINATION include/gdk) +install(FILES gdk/gdkdevice.h DESTINATION include/gdk) +install(FILES gdk/gdkdevicepad.h DESTINATION include/gdk) +install(FILES gdk/gdkdevicetool.h DESTINATION include/gdk) +install(FILES gdk/gdkdevicemanager.h DESTINATION include/gdk) +install(FILES gdk/gdkdisplay.h DESTINATION include/gdk) +install(FILES gdk/gdkdisplaymanager.h DESTINATION include/gdk) +install(FILES gdk/gdkdnd.h DESTINATION include/gdk) +install(FILES gdk/gdkdrawingcontext.h DESTINATION include/gdk) +install(FILES gdk/gdkevents.h DESTINATION include/gdk) +install(FILES gdk/gdkframetimings.h DESTINATION include/gdk) +install(FILES gdk/gdkglcontext.h DESTINATION include/gdk) +install(FILES gdk/gdkkeys.h DESTINATION include/gdk) +install(FILES gdk/gdkkeysyms.h DESTINATION include/gdk) +install(FILES gdk/gdkkeysyms-compat.h DESTINATION include/gdk) +install(FILES gdk/gdkmain.h DESTINATION include/gdk) +install(FILES gdk/gdkmonitor.h DESTINATION include/gdk) +install(FILES gdk/gdkpango.h DESTINATION include/gdk) +install(FILES gdk/gdkframeclock.h DESTINATION include/gdk) +install(FILES gdk/gdkpixbuf.h DESTINATION include/gdk) +install(FILES gdk/gdkprivate.h DESTINATION include/gdk) +install(FILES gdk/gdkproperty.h DESTINATION include/gdk) +install(FILES gdk/gdkrectangle.h DESTINATION include/gdk) +install(FILES gdk/gdkrgba.h DESTINATION include/gdk) +install(FILES gdk/gdkscreen.h DESTINATION include/gdk) +install(FILES gdk/gdkseat.h DESTINATION include/gdk) +install(FILES gdk/gdkselection.h DESTINATION include/gdk) +install(FILES gdk/gdktestutils.h DESTINATION include/gdk) +install(FILES gdk/gdkthreads.h DESTINATION include/gdk) +install(FILES gdk/gdktypes.h DESTINATION include/gdk) +install(FILES gdk/gdkvisual.h DESTINATION include/gdk) +install(FILES gdk/gdkwindow.h DESTINATION include/gdk) +install(FILES gdk/deprecated/gdkcolor.h DESTINATION include/gdk/deprecated) +install(FILES gdk/gdkconfig.h DESTINATION include/gdk) +install(FILES gdk/gdkenumtypes.h DESTINATION include/gdk) +install(FILES gdk/gdkversionmacros.h DESTINATION include/gdk) +install(FILES gdk/win32/gdkwin32cursor.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32display.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32displaymanager.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32dnd.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32glcontext.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32keys.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32misc.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32monitor.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32screen.h DESTINATION include/gdk/win32) +install(FILES gdk/win32/gdkwin32window.h DESTINATION include/gdk/win32) +install(FILES gtk/gtk.h DESTINATION include/gtk) +install(FILES gtk/gtk-autocleanups.h DESTINATION include/gtk) +install(FILES gtk/gtkx.h DESTINATION include/gtk) +install(FILES gtk/gtkx-autocleanups.h DESTINATION include/gtk) +install(FILES gtk/gtk-a11y.h DESTINATION include/gtk) +install(FILES gtk/gtkaboutdialog.h DESTINATION include/gtk) +install(FILES gtk/gtkaccelgroup.h DESTINATION include/gtk) +install(FILES gtk/gtkaccellabel.h DESTINATION include/gtk) +install(FILES gtk/gtkaccelmap.h DESTINATION include/gtk) +install(FILES gtk/gtkaccessible.h DESTINATION include/gtk) +install(FILES gtk/gtkactionable.h DESTINATION include/gtk) +install(FILES gtk/gtkactionbar.h DESTINATION include/gtk) +install(FILES gtk/gtkadjustment.h DESTINATION include/gtk) +install(FILES gtk/gtkappchooser.h DESTINATION include/gtk) +install(FILES gtk/gtkappchooserbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkappchooserdialog.h DESTINATION include/gtk) +install(FILES gtk/gtkappchooserwidget.h DESTINATION include/gtk) +install(FILES gtk/gtkapplication.h DESTINATION include/gtk) +install(FILES gtk/gtkapplicationwindow.h DESTINATION include/gtk) +install(FILES gtk/gtkaspectframe.h DESTINATION include/gtk) +install(FILES gtk/gtkassistant.h DESTINATION include/gtk) +install(FILES gtk/gtkbbox.h DESTINATION include/gtk) +install(FILES gtk/gtkbin.h DESTINATION include/gtk) +install(FILES gtk/gtkbindings.h DESTINATION include/gtk) +install(FILES gtk/gtkborder.h DESTINATION include/gtk) +install(FILES gtk/gtkbox.h DESTINATION include/gtk) +install(FILES gtk/gtkbuilder.h DESTINATION include/gtk) +install(FILES gtk/gtkbuildable.h DESTINATION include/gtk) +install(FILES gtk/gtkbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkcalendar.h DESTINATION include/gtk) +install(FILES gtk/gtkcellarea.h DESTINATION include/gtk) +install(FILES gtk/gtkcellareacontext.h DESTINATION include/gtk) +install(FILES gtk/gtkcellareabox.h DESTINATION include/gtk) +install(FILES gtk/gtkcelleditable.h DESTINATION include/gtk) +install(FILES gtk/gtkcelllayout.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrenderer.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrendereraccel.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrenderercombo.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrendererpixbuf.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrendererprogress.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrendererspin.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrendererspinner.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrenderertext.h DESTINATION include/gtk) +install(FILES gtk/gtkcellrenderertoggle.h DESTINATION include/gtk) +install(FILES gtk/gtkcellview.h DESTINATION include/gtk) +install(FILES gtk/gtkcheckbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkcheckmenuitem.h DESTINATION include/gtk) +install(FILES gtk/gtkclipboard.h DESTINATION include/gtk) +install(FILES gtk/gtkcolorbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkcolorchooser.h DESTINATION include/gtk) +install(FILES gtk/gtkcolorchooserwidget.h DESTINATION include/gtk) +install(FILES gtk/gtkcolorchooserdialog.h DESTINATION include/gtk) +install(FILES gtk/gtkcolorutils.h DESTINATION include/gtk) +install(FILES gtk/gtkcombobox.h DESTINATION include/gtk) +install(FILES gtk/gtkcomboboxtext.h DESTINATION include/gtk) +install(FILES gtk/gtkcontainer.h DESTINATION include/gtk) +install(FILES gtk/gtkcssprovider.h DESTINATION include/gtk) +install(FILES gtk/gtkcsssection.h DESTINATION include/gtk) +install(FILES gtk/gtkdebug.h DESTINATION include/gtk) +install(FILES gtk/gtkdialog.h DESTINATION include/gtk) +install(FILES gtk/gtkdnd.h DESTINATION include/gtk) +install(FILES gtk/gtkdragdest.h DESTINATION include/gtk) +install(FILES gtk/gtkdragsource.h DESTINATION include/gtk) +install(FILES gtk/gtkdrawingarea.h DESTINATION include/gtk) +install(FILES gtk/gtkeditable.h DESTINATION include/gtk) +install(FILES gtk/gtkentry.h DESTINATION include/gtk) +install(FILES gtk/gtkentrybuffer.h DESTINATION include/gtk) +install(FILES gtk/gtkentrycompletion.h DESTINATION include/gtk) +install(FILES gtk/gtkenums.h DESTINATION include/gtk) +install(FILES gtk/gtkeventbox.h DESTINATION include/gtk) +install(FILES gtk/gtkeventcontroller.h DESTINATION include/gtk) +install(FILES gtk/gtkexpander.h DESTINATION include/gtk) +install(FILES gtk/gtkfilechooser.h DESTINATION include/gtk) +install(FILES gtk/gtkfilechooserbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkfilechooserdialog.h DESTINATION include/gtk) +install(FILES gtk/gtkfilechoosernative.h DESTINATION include/gtk) +install(FILES gtk/gtkfilechooserwidget.h DESTINATION include/gtk) +install(FILES gtk/gtkfilefilter.h DESTINATION include/gtk) +install(FILES gtk/gtkfixed.h DESTINATION include/gtk) +install(FILES gtk/gtkflowbox.h DESTINATION include/gtk) +install(FILES gtk/gtkfontbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkfontchooser.h DESTINATION include/gtk) +install(FILES gtk/gtkfontchooserdialog.h DESTINATION include/gtk) +install(FILES gtk/gtkfontchooserwidget.h DESTINATION include/gtk) +install(FILES gtk/gtkframe.h DESTINATION include/gtk) +install(FILES gtk/gtkgesture.h DESTINATION include/gtk) +install(FILES gtk/gtkgesturedrag.h DESTINATION include/gtk) +install(FILES gtk/gtkgesturelongpress.h DESTINATION include/gtk) +install(FILES gtk/gtkgesturemultipress.h DESTINATION include/gtk) +install(FILES gtk/gtkgesturepan.h DESTINATION include/gtk) +install(FILES gtk/gtkgesturerotate.h DESTINATION include/gtk) +install(FILES gtk/gtkgesturesingle.h DESTINATION include/gtk) +install(FILES gtk/gtkgestureswipe.h DESTINATION include/gtk) +install(FILES gtk/gtkgesturezoom.h DESTINATION include/gtk) +install(FILES gtk/gtkglarea.h DESTINATION include/gtk) +install(FILES gtk/gtkgrid.h DESTINATION include/gtk) +install(FILES gtk/gtkheaderbar.h DESTINATION include/gtk) +install(FILES gtk/gtkicontheme.h DESTINATION include/gtk) +install(FILES gtk/gtkiconview.h DESTINATION include/gtk) +install(FILES gtk/gtkimage.h DESTINATION include/gtk) +install(FILES gtk/gtkimcontext.h DESTINATION include/gtk) +install(FILES gtk/gtkimcontextinfo.h DESTINATION include/gtk) +install(FILES gtk/gtkimcontextsimple.h DESTINATION include/gtk) +install(FILES gtk/gtkimmodule.h DESTINATION include/gtk) +install(FILES gtk/gtkimmulticontext.h DESTINATION include/gtk) +install(FILES gtk/gtkinfobar.h DESTINATION include/gtk) +install(FILES gtk/gtkinvisible.h DESTINATION include/gtk) +install(FILES gtk/gtklabel.h DESTINATION include/gtk) +install(FILES gtk/gtklayout.h DESTINATION include/gtk) +install(FILES gtk/gtklevelbar.h DESTINATION include/gtk) +install(FILES gtk/gtklinkbutton.h DESTINATION include/gtk) +install(FILES gtk/gtklistbox.h DESTINATION include/gtk) +install(FILES gtk/gtkliststore.h DESTINATION include/gtk) +install(FILES gtk/gtklockbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkmain.h DESTINATION include/gtk) +install(FILES gtk/gtkmenu.h DESTINATION include/gtk) +install(FILES gtk/gtkmenubar.h DESTINATION include/gtk) +install(FILES gtk/gtkmenubutton.h DESTINATION include/gtk) +install(FILES gtk/gtkmenuitem.h DESTINATION include/gtk) +install(FILES gtk/gtkmenushell.h DESTINATION include/gtk) +install(FILES gtk/gtkmenutoolbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkmessagedialog.h DESTINATION include/gtk) +install(FILES gtk/gtkmodelbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkmodules.h DESTINATION include/gtk) +install(FILES gtk/gtkmountoperation.h DESTINATION include/gtk) +install(FILES gtk/gtknativedialog.h DESTINATION include/gtk) +install(FILES gtk/gtknotebook.h DESTINATION include/gtk) +install(FILES gtk/gtkoffscreenwindow.h DESTINATION include/gtk) +install(FILES gtk/gtkorientable.h DESTINATION include/gtk) +install(FILES gtk/gtkoverlay.h DESTINATION include/gtk) +install(FILES gtk/gtkpadcontroller.h DESTINATION include/gtk) +install(FILES gtk/gtkpagesetup.h DESTINATION include/gtk) +install(FILES gtk/gtkpaned.h DESTINATION include/gtk) +install(FILES gtk/gtkpapersize.h DESTINATION include/gtk) +install(FILES gtk/gtkplacessidebar.h DESTINATION include/gtk) +install(FILES gtk/gtkplug.h DESTINATION include/gtk) +install(FILES gtk/gtkpopover.h DESTINATION include/gtk) +install(FILES gtk/gtkpopovermenu.h DESTINATION include/gtk) +install(FILES gtk/gtkprintcontext.h DESTINATION include/gtk) +install(FILES gtk/gtkprintoperation.h DESTINATION include/gtk) +install(FILES gtk/gtkprintoperationpreview.h DESTINATION include/gtk) +install(FILES gtk/gtkprintsettings.h DESTINATION include/gtk) +install(FILES gtk/gtkprogressbar.h DESTINATION include/gtk) +install(FILES gtk/gtkradiobutton.h DESTINATION include/gtk) +install(FILES gtk/gtkradiomenuitem.h DESTINATION include/gtk) +install(FILES gtk/gtkradiotoolbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkrange.h DESTINATION include/gtk) +install(FILES gtk/gtkrecentchooser.h DESTINATION include/gtk) +install(FILES gtk/gtkrecentchooserdialog.h DESTINATION include/gtk) +install(FILES gtk/gtkrecentchoosermenu.h DESTINATION include/gtk) +install(FILES gtk/gtkrecentchooserwidget.h DESTINATION include/gtk) +install(FILES gtk/gtkrecentfilter.h DESTINATION include/gtk) +install(FILES gtk/gtkrecentmanager.h DESTINATION include/gtk) +install(FILES gtk/gtkrender.h DESTINATION include/gtk) +install(FILES gtk/gtkrevealer.h DESTINATION include/gtk) +install(FILES gtk/gtkscale.h DESTINATION include/gtk) +install(FILES gtk/gtkscalebutton.h DESTINATION include/gtk) +install(FILES gtk/gtkscrollable.h DESTINATION include/gtk) +install(FILES gtk/gtkscrollbar.h DESTINATION include/gtk) +install(FILES gtk/gtkscrolledwindow.h DESTINATION include/gtk) +install(FILES gtk/gtksearchbar.h DESTINATION include/gtk) +install(FILES gtk/gtksearchentry.h DESTINATION include/gtk) +install(FILES gtk/gtkselection.h DESTINATION include/gtk) +install(FILES gtk/gtkseparator.h DESTINATION include/gtk) +install(FILES gtk/gtkseparatormenuitem.h DESTINATION include/gtk) +install(FILES gtk/gtkseparatortoolitem.h DESTINATION include/gtk) +install(FILES gtk/gtksettings.h DESTINATION include/gtk) +install(FILES gtk/gtkshortcutlabel.h DESTINATION include/gtk) +install(FILES gtk/gtkshortcutsgroup.h DESTINATION include/gtk) +install(FILES gtk/gtkshortcutssection.h DESTINATION include/gtk) +install(FILES gtk/gtkshortcutsshortcut.h DESTINATION include/gtk) +install(FILES gtk/gtkshortcutswindow.h DESTINATION include/gtk) +install(FILES gtk/gtkshow.h DESTINATION include/gtk) +install(FILES gtk/gtkstacksidebar.h DESTINATION include/gtk) +install(FILES gtk/gtksizegroup.h DESTINATION include/gtk) +install(FILES gtk/gtksizerequest.h DESTINATION include/gtk) +install(FILES gtk/gtksocket.h DESTINATION include/gtk) +install(FILES gtk/gtkspinbutton.h DESTINATION include/gtk) +install(FILES gtk/gtkspinner.h DESTINATION include/gtk) +install(FILES gtk/gtkstack.h DESTINATION include/gtk) +install(FILES gtk/gtkstackswitcher.h DESTINATION include/gtk) +install(FILES gtk/gtkstatusbar.h DESTINATION include/gtk) +install(FILES gtk/gtkstylecontext.h DESTINATION include/gtk) +install(FILES gtk/gtkstyleprovider.h DESTINATION include/gtk) +install(FILES gtk/gtkswitch.h DESTINATION include/gtk) +install(FILES gtk/gtktestutils.h DESTINATION include/gtk) +install(FILES gtk/gtktextattributes.h DESTINATION include/gtk) +install(FILES gtk/gtktextbuffer.h DESTINATION include/gtk) +install(FILES gtk/gtktextbufferrichtext.h DESTINATION include/gtk) +install(FILES gtk/gtktextchild.h DESTINATION include/gtk) +install(FILES gtk/gtktextdisplay.h DESTINATION include/gtk) +install(FILES gtk/gtktextiter.h DESTINATION include/gtk) +install(FILES gtk/gtktextmark.h DESTINATION include/gtk) +install(FILES gtk/gtktexttag.h DESTINATION include/gtk) +install(FILES gtk/gtktexttagtable.h DESTINATION include/gtk) +install(FILES gtk/gtktextview.h DESTINATION include/gtk) +install(FILES gtk/gtktogglebutton.h DESTINATION include/gtk) +install(FILES gtk/gtktoggletoolbutton.h DESTINATION include/gtk) +install(FILES gtk/gtktoolbar.h DESTINATION include/gtk) +install(FILES gtk/gtktoolbutton.h DESTINATION include/gtk) +install(FILES gtk/gtktoolitem.h DESTINATION include/gtk) +install(FILES gtk/gtktoolitemgroup.h DESTINATION include/gtk) +install(FILES gtk/gtktoolpalette.h DESTINATION include/gtk) +install(FILES gtk/gtktoolshell.h DESTINATION include/gtk) +install(FILES gtk/gtktooltip.h DESTINATION include/gtk) +install(FILES gtk/gtktreednd.h DESTINATION include/gtk) +install(FILES gtk/gtktreemodel.h DESTINATION include/gtk) +install(FILES gtk/gtktreemodelfilter.h DESTINATION include/gtk) +install(FILES gtk/gtktreemodelsort.h DESTINATION include/gtk) +install(FILES gtk/gtktreeselection.h DESTINATION include/gtk) +install(FILES gtk/gtktreesortable.h DESTINATION include/gtk) +install(FILES gtk/gtktreestore.h DESTINATION include/gtk) +install(FILES gtk/gtktreeview.h DESTINATION include/gtk) +install(FILES gtk/gtktreeviewcolumn.h DESTINATION include/gtk) +install(FILES gtk/gtktypes.h DESTINATION include/gtk) +install(FILES gtk/gtkviewport.h DESTINATION include/gtk) +install(FILES gtk/gtkvolumebutton.h DESTINATION include/gtk) +install(FILES gtk/gtkwidget.h DESTINATION include/gtk) +install(FILES gtk/gtkwidgetpath.h DESTINATION include/gtk) +install(FILES gtk/gtkwindow.h DESTINATION include/gtk) +install(FILES gtk/gtkwindowgroup.h DESTINATION include/gtk) +install(FILES gtk/gtktextlayout.h DESTINATION include/gtk) +install(FILES gtk/gtktypebuiltins.h DESTINATION include/gtk) +install(FILES gtk/gtkversion.h DESTINATION include/gtk) +install(FILES gtk/a11y/gtk-a11y-autocleanups.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkarrowaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkbooleancellaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkbuttonaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkcellaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkcellaccessibleparent.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkcheckmenuitemaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkcomboboxaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkcontaineraccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkcontainercellaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkentryaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkexpanderaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkflowboxaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkflowboxchildaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkframeaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkiconviewaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkimageaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkimagecellaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtklabelaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtklevelbaraccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtklinkbuttonaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtklistboxaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtklistboxrowaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtklockbuttonaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkmenuaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkmenubuttonaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkmenuitemaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkmenushellaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtknotebookaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtknotebookpageaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkpanedaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkpopoveraccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkprogressbaraccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkradiobuttonaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkradiomenuitemaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkrangeaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkrenderercellaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkscaleaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkscalebuttonaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkscrolledwindowaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkspinbuttonaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkspinneraccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkstatusbaraccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkstackaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkswitchaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtktextcellaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtktextviewaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtktogglebuttonaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtktoplevelaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtktreeviewaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkwidgetaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/a11y/gtkwindowaccessible.h DESTINATION include/gtk/a11y) +install(FILES gtk/deprecated/gtkactivatable.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkaction.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkactiongroup.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkalignment.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkarrow.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkcolorsel.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkcolorseldialog.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkfontsel.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkgradient.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkhandlebox.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkhbbox.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkhbox.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkhpaned.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkhscale.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkhscrollbar.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkhseparator.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkhsv.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkiconfactory.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkimagemenuitem.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkmisc.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtknumerableicon.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkradioaction.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkrc.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkrecentaction.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkstatusicon.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkstock.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkstyle.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkstyleproperties.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtksymboliccolor.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtktable.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtktearoffmenuitem.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkthemingengine.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtktoggleaction.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkuimanager.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkvbbox.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkvbox.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkvscale.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkvscrollbar.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkvseparator.h DESTINATION include/gtk/deprecated) +install(FILES gtk/deprecated/gtkvpaned.h DESTINATION include/gtk/deprecated) +install(FILES libgail-util/gailmisc.h DESTINATION include/libgail-util) +install(FILES libgail-util/gailtextutil.h DESTINATION include/libgail-util) +install(FILES libgail-util/gail-util.h DESTINATION include/libgail-util) +install(FILES gdk/broadway/gdkbroadway.h DESTINATION include/gdk) +install(FILES gdk/broadway/gdkbroadwaydisplay.h DESTINATION include/gdk/broadway) +install(FILES gdk/broadway/gdkbroadwaywindow.h DESTINATION include/gdk/broadway) +install(FILES gdk/broadway/gdkbroadwaycursor.h DESTINATION include/gdk/broadway) +install(FILES gdk/broadway/gdkbroadwaymonitor.h DESTINATION include/gdk/broadway) +install(FILES gdk/broadway/gdkbroadwayvisual.h DESTINATION include/gdk/broadway) diff --git a/ports/gtk/portfile.cmake b/ports/gtk/portfile.cmake new file mode 100644 index 000000000..cd36690e5 --- /dev/null +++ b/ports/gtk/portfile.cmake @@ -0,0 +1,34 @@ + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gtk+-3.22.8) +vcpkg_download_distfile(ARCHIVE + URLS "https://ftp.gnome.org/pub/gnome/sources/gtk+/3.22/gtk+-3.22.8.tar.xz" + FILENAME "gtk+-3.22.8.tar.xz" + SHA512 e8c887d73a29982e8db1be6b101367326b4691905bd28e244f05435f34dfaddb054badb0b0b01a47a4c939c7f87985b7203db5d0cd499a0868c25eba44ed002c) + +vcpkg_extract_source_archive(${ARCHIVE}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake DESTINATION ${SOURCE_PATH}) + +# generate sources using python script installed with glib +if(NOT EXISTS ${SOURCE_PATH}/gtk/gtkdbusgenerated.h OR NOT EXISTS ${SOURCE_PATH}/gtk/gtkdbusgenerated.c) + vcpkg_find_acquire_program(PYTHON3) + set(GLIB_TOOL_DIR ${CURRENT_INSTALLED_DIR}/tools/glib) + + vcpkg_execute_required_process( + COMMAND ${PYTHON3} ${GLIB_TOOL_DIR}/gdbus-codegen --interface-prefix org.Gtk. --c-namespace _Gtk --generate-c-code gtkdbusgenerated ./gtkdbusinterfaces.xml + WORKING_DIRECTORY ${SOURCE_PATH}/gtk + LOGNAME source-gen) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG + -DGTK_SKIP_HEADERS=ON) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gtk) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/gtk/COPYING ${CURRENT_PACKAGES_DIR}/share/gtk/copyright) diff --git a/ports/harfbuzz/CONTROL b/ports/harfbuzz/CONTROL index eab88ff11..6a54dc583 100644 --- a/ports/harfbuzz/CONTROL +++ b/ports/harfbuzz/CONTROL @@ -1,4 +1,4 @@ Source: harfbuzz -Version: 1.3.4 +Version: 1.3.4-2 Description: HarfBuzz OpenType text shaping engine -Build-Depends: freetype +Build-Depends: freetype, glib diff --git a/ports/harfbuzz/portfile.cmake b/ports/harfbuzz/portfile.cmake index 911dea860..ac3252455 100644 --- a/ports/harfbuzz/portfile.cmake +++ b/ports/harfbuzz/portfile.cmake @@ -11,7 +11,7 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) set(VCPKG_LIBRARY_LINKAGE dynamic) endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/harfbuzz-1.3.4) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/harfbuzz-1.3.4) find_program(NMAKE nmake) vcpkg_download_distfile(ARCHIVE @@ -19,20 +19,35 @@ vcpkg_download_distfile(ARCHIVE FILENAME "harfbuzz-1.3.4.tar.bz2" SHA512 72027ce64d735f1f7ecabcc78ba426d6155cebd564439feb77cefdfc28b00bfd9f6314e6735addaa90cee1d98cf6d2c0b61f77b446ba34e11f7eb7cdfdcd386a ) -vcpkg_extract_source_archive(${ARCHIVE}) +# Harfbuzz only supports in-source builds, so to make sure we get a clean build, we need to re-extract every time +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src) +vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src) -file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include" FREETYPE_INCLUDE_DIR) -file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/debug/lib" FREETYPE_LIB_DIR_DBG) -file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib" FREETYPE_LIB_DIR_REL) +file(WRITE ${SOURCE_PATH}/win32/msvc_recommended_pragmas.h "/* I'm expected to exist */") + +# for GObject support, harfbuzz expects glib-mkenums tool (perl script) to be availible in $(PREFIX)/bin +file(COPY ${CURRENT_INSTALLED_DIR}/tools/glib/glib-mkenums DESTINATION ${SOURCE_PATH}/bin) +vcpkg_find_acquire_program(PERL) + +file(TO_NATIVE_PATH "${PERL}" PERL_INTERPRETER) +file(TO_NATIVE_PATH "${SOURCE_PATH}" MKENUMS_TOOL_DIR) + +file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include" INCLUDE_DIR) +file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/debug/lib" LIB_DIR_DBG) +file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib" LIB_DIR_REL) + +set(DEPENDENCIES FREETYPE=1 GLIB=1 GOBJECT=1) vcpkg_execute_required_process( - COMMAND ${NMAKE} -f Makefile.vc CFG=debug FREETYPE=1 FREETYPE_DIR=${FREETYPE_INCLUDE_DIR} ADDITIONAL_LIB_DIR=${FREETYPE_LIB_DIR_DBG} + COMMAND ${NMAKE} -f Makefile.vc CFG=debug ${DEPENDENCIES} FREETYPE_DIR=${INCLUDE_DIR} ADDITIONAL_LIB_DIR=${LIB_DIR_DBG} + PREFIX=${MKENUMS_TOOL_DIR} PERL=${PERL_INTERPRETER} WORKING_DIRECTORY ${SOURCE_PATH}/win32/ LOGNAME nmake-build-${TARGET_TRIPLET}-debug ) vcpkg_execute_required_process( - COMMAND ${NMAKE} -f Makefile.vc CFG=release FREETYPE=1 FREETYPE_DIR=${FREETYPE_INCLUDE_DIR} ADDITIONAL_LIB_DIR=${FREETYPE_LIB_DIR_REL} + COMMAND ${NMAKE} -f Makefile.vc CFG=release ${DEPENDENCIES} FREETYPE_DIR=${INCLUDE_DIR} ADDITIONAL_LIB_DIR=${LIB_DIR_REL} + PREFIX=${MKENUMS_TOOL_DIR} PERL=${PERL_INTERPRETER} WORKING_DIRECTORY ${SOURCE_PATH}/win32/ LOGNAME nmake-build-${TARGET_TRIPLET}-release ) @@ -40,7 +55,7 @@ vcpkg_execute_required_process( file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}/debug" NATIVE_PACKAGES_DIR_DBG) vcpkg_execute_required_process( - COMMAND ${NMAKE} -f Makefile.vc CFG=debug FREETYPE=1 PREFIX=${NATIVE_PACKAGES_DIR_DBG} install + COMMAND ${NMAKE} -f Makefile.vc CFG=debug ${DEPENDENCIES} PREFIX=${NATIVE_PACKAGES_DIR_DBG} install WORKING_DIRECTORY ${SOURCE_PATH}/win32/ LOGNAME nmake-install-${TARGET_TRIPLET}-debug ) @@ -49,11 +64,16 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR_REL) vcpkg_execute_required_process( - COMMAND ${NMAKE} -f Makefile.vc CFG=release FREETYPE=1 PREFIX=${NATIVE_PACKAGES_DIR_REL} install + COMMAND ${NMAKE} -f Makefile.vc CFG=release ${DEPENDENCIES} PREFIX=${NATIVE_PACKAGES_DIR_REL} install WORKING_DIRECTORY ${SOURCE_PATH}/win32/ LOGNAME nmake-install-${TARGET_TRIPLET}-release ) +file(GLOB EXECUTABLES + ${CURRENT_PACKAGES_DIR}/bin/*.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) +file(REMOVE ${EXECUTABLES}) + # Handle copyright file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/harfbuzz) file(RENAME ${CURRENT_PACKAGES_DIR}/share/harfbuzz/COPYING ${CURRENT_PACKAGES_DIR}/share/harfbuzz/copyright) diff --git a/ports/hdf5/CONTROL b/ports/hdf5/CONTROL new file mode 100644 index 000000000..70d1f9979 --- /dev/null +++ b/ports/hdf5/CONTROL @@ -0,0 +1,4 @@ +Source: hdf5 +Version: 1.10.0-patch1-1 +Description: HDF5 is a data model, library, and file format for storing and managing data +Build-Depends: zlib, szip, msmpi
\ No newline at end of file diff --git a/ports/hdf5/disable-static-libs.patch b/ports/hdf5/disable-static-libs.patch new file mode 100644 index 000000000..4b7b440ec --- /dev/null +++ b/ports/hdf5/disable-static-libs.patch @@ -0,0 +1,90 @@ +diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt +index 872e42d..146d0a9 100644 +--- a/hl/src/CMakeLists.txt ++++ b/hl/src/CMakeLists.txt +@@ -29,16 +29,20 @@ set (HL_HEADERS + ${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h + ) + +-add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SRCS} ${HL_HEADERS}) +-TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ") +-target_link_libraries (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) +-H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC) +-set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES +- FOLDER libraries/hl +- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +-) +-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") +-set (install_targets ${HDF5_HL_LIB_TARGET}) ++set (install_targets) ++ ++if (NOT DISABLE_STATIC_LIBS) ++ add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SRCS} ${HL_HEADERS}) ++ TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ") ++ target_link_libraries (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) ++ H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC) ++ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES ++ FOLDER libraries/hl ++ INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ++ ) ++ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") ++ set (install_targets ${install_targets} ${HDF5_HL_LIB_TARGET}) ++endif (NOT DISABLE_STATIC_LIBS) + + if (BUILD_SHARED_LIBS) + add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS}) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index d93612b..a63cc3a 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -851,30 +851,33 @@ add_custom_command ( + #----------------------------------------------------------------------------- + set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) + +-add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) +-TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") +-target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) +-if (NOT WIN32) ++set (install_targets) ++if (NOT DISABLE_STATIC_LIBS) ++ add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) ++ TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") ++ target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) ++ if (NOT WIN32) + target_link_libraries (${HDF5_LIB_TARGET} dl) +-endif (NOT WIN32) +-if (H5_HAVE_PARALLEL AND MPI_C_FOUND) ++ endif (NOT WIN32) ++ if (H5_HAVE_PARALLEL AND MPI_C_FOUND) + target_link_libraries (${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) +-endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) +-set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) +-H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) +-set_target_properties (${HDF5_LIB_TARGET} PROPERTIES +- FOLDER libraries +- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +-) ++ endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) ++ set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) ++ H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) ++ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES ++ FOLDER libraries ++ INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ++ ) + +-option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) +-if (HDF5_ENABLE_DEBUG_APIS) ++ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) ++ if (HDF5_ENABLE_DEBUG_APIS) + set_target_properties (${HDF5_LIB_TARGET} PROPERTIES + COMPILE_DEFINITIONS + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" + ) +-endif (HDF5_ENABLE_DEBUG_APIS) +-set (install_targets ${HDF5_LIB_TARGET}) ++ endif (HDF5_ENABLE_DEBUG_APIS) ++ set (install_targets ${install_targets} ${HDF5_LIB_TARGET}) ++endif (NOT DISABLE_STATIC_LIBS) + + if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") diff --git a/ports/hdf5/link-libraries-private.patch b/ports/hdf5/link-libraries-private.patch new file mode 100644 index 000000000..15db78a2d --- /dev/null +++ b/ports/hdf5/link-libraries-private.patch @@ -0,0 +1,29 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index a63cc3a..aea963d 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -900,12 +900,12 @@ if (BUILD_SHARED_LIBS) + set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) + TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") +- target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) ++ target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_SHARED_LIBS}) + if (NOT WIN32) +- target_link_libraries (${HDF5_LIBSH_TARGET} dl) ++ target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE dl) + endif (NOT WIN32) + if (H5_HAVE_PARALLEL AND MPI_C_FOUND) +- target_link_libraries (${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) ++ target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${MPI_C_LIBRARIES}) + endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) +@@ -920,7 +920,7 @@ if (BUILD_SHARED_LIBS) + APPEND PROPERTY COMPILE_DEFINITIONS + "H5_HAVE_THREADSAFE" + ) +- target_link_libraries (${HDF5_LIBSH_TARGET} Threads::Threads) ++ target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE Threads::Threads) + endif (HDF5_ENABLE_THREADSAFE) + + if (HDF5_ENABLE_DEBUG_APIS) diff --git a/ports/hdf5/portfile.cmake b/ports/hdf5/portfile.cmake new file mode 100644 index 000000000..9801ec44a --- /dev/null +++ b/ports/hdf5/portfile.cmake @@ -0,0 +1,65 @@ +# 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(vcpkg_common_functions) +# set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/hdf5-1.8.18) +# vcpkg_download_distfile(ARCHIVE +# URLS "https://support.hdfgroup.org/ftp/HDF5/current18/src/hdf5-1.8.18.tar.bz2" +# FILENAME "hdf5-1.8.18.tar.bz2" +# SHA512 01f6d14bdd3be2ced9c63cc9e1820cd7ea11db649ff9f3a3055c18c4b0fffe777fd23baad536e3bce31c4d76fe17db64a3972762e1bb4d232927c1ca140e72b2 +# ) +# vcpkg_extract_source_archive(${ARCHIVE}) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CMake-hdf5-1.10.0-patch1/hdf5-1.10.0-patch1) +vcpkg_download_distfile(ARCHIVE + URLS "http://hdf4.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0-patch1/src/CMake-hdf5-1.10.0-patch1.zip" + FILENAME "CMake-hdf5-1.10.0-patch1.zip" + SHA512 ec2edb43438661323be5998ecf64c4dd537ddc7451e31f89390260d16883e60a1ccc1bf745bcb809af22f2bf7157d50331a33910b8ebf5c59cd50693dfb2ef8f +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/use-szip-config.patch + ${CMAKE_CURRENT_LIST_DIR}/disable-static-libs.patch + ${CMAKE_CURRENT_LIST_DIR}/link-libraries-private.patch +) + +set(DISABLE_STATIC_LIBS OFF) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(DISABLE_STATIC_LIBS ON) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_TESTING=OFF + -DDISABLE_STATIC_LIBS=${DISABLE_STATIC_LIBS} + -DHDF5_BUILD_EXAMPLES=OFF + -DHDF5_BUILD_TOOLS=OFF + -DHDF5_BUILD_CPP_LIB=OFF + -DHDF5_ENABLE_PARALLEL=ON + -DHDF5_ENABLE_Z_LIB_SUPPORT=ON + -DHDF5_ENABLE_SZIP_SUPPORT=ON + -DHDF5_ENABLE_SZIP_ENCODING=ON + -DHDF5_INSTALL_DATA_DIR=share/hdf5/data + -DHDF5_INSTALL_CMAKE_DIR=share/hdf5 +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/hdf5/copyright) + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/hdf5/hdf5-targets-debug.cmake HDF5_TARGETS_DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" HDF5_TARGETS_DEBUG_MODULE "${HDF5_TARGETS_DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/hdf5/hdf5-targets-debug.cmake "${HDF5_TARGETS_DEBUG_MODULE}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/hdf5/use-szip-config.patch b/ports/hdf5/use-szip-config.patch new file mode 100644 index 000000000..d7cd6748b --- /dev/null +++ b/ports/hdf5/use-szip-config.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake +index c2b81dc..a86d2d5 100644 +--- a/CMakeFilters.cmake ++++ b/CMakeFilters.cmake +@@ -81,6 +81,16 @@ if (HDF5_ENABLE_SZIP_SUPPORT) + if (NOT SZIP_USE_EXTERNAL) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) ++ find_package (SZIP CONFIG) ++ if (SZIP_FOUND) ++ if (TARGET szip-shared) ++ set(SZIP_LIBRARIES szip-shared) ++ else (TARGET szip-shared) ++ set(SZIP_LIBRARIES szip-static) ++ endif (TARGET szip-shared) ++ endif (SZIP_FOUND) ++ endif (NOT SZIP_FOUND) ++ if (NOT SZIP_FOUND) + find_package (SZIP) # Legacy find + if (SZIP_FOUND) + set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES}) diff --git a/ports/http-parser/CMakeLists.txt b/ports/http-parser/CMakeLists.txt index 6e9067a04..d959fff79 100644 --- a/ports/http-parser/CMakeLists.txt +++ b/ports/http-parser/CMakeLists.txt @@ -5,13 +5,17 @@ if (BUILD_SHARED_LIBS) SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() +if(CMAKE_BUILD_TYPE MATCHES "Release") + add_definitions(-DHTTP_PARSER_STRICT=0) +endif() + add_library(http_parser http_parser.c http_parser.h) install(TARGETS http_parser - RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" - ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" + RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" + ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" ) if (NOT SKIP_INSTALL_HEADERS) - install(FILES http_parser.h DESTINATION "${CMAKE_INSTALL_PREFIX}/include") + install(FILES http_parser.h DESTINATION "${CMAKE_INSTALL_PREFIX}/include") endif()
\ No newline at end of file diff --git a/ports/http-parser/CONTROL b/ports/http-parser/CONTROL index 41d234d26..605f3354c 100644 --- a/ports/http-parser/CONTROL +++ b/ports/http-parser/CONTROL @@ -1,3 +1,3 @@ Source: http-parser -Version: 2.7.1 +Version: 2.7.1-1 Description: HTTP Parser.
\ No newline at end of file diff --git a/ports/lcms/CMakeLists.txt b/ports/lcms/CMakeLists.txt new file mode 100644 index 000000000..0fedfb95e --- /dev/null +++ b/ports/lcms/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 3.5) + +project(lcms) + +set(SRCS +"src/cmstypes.c" +"src/cmsvirt.c" +"src/cmswtpnt.c" +"src/cmsxform.c" +"src/lcms2.def" +"src/lcms2_internal.h" +"src/cmsalpha.c" +"src/cmscam02.c" +"src/cmscgats.c" +"src/cmscnvrt.c" +"src/cmserr.c" +"src/cmsgamma.c" +"src/cmsgmt.c" +"src/cmshalf.c" +"src/cmsintrp.c" +"src/cmsio0.c" +"src/cmsio1.c" +"src/cmslut.c" +"src/cmsmd5.c" +"src/cmsmtrx.c" +"src/cmsnamed.c" +"src/cmsopt.c" +"src/cmspack.c" +"src/cmspcs.c" +"src/cmsplugin.c" +"src/cmsps2.c" +"src/cmssamp.c" +"src/cmssm.c" +) + +add_definitions(-DUNICODE -D_UNICODE) +string(REPLACE "/utf-8" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + +include_directories( +"./include" +) + +add_library(lcms ${SRCS}) + +if(NOT SKIP_INSTALL_HEADERS ) + + install(FILES + "./include/lcms2.h" + "./include/lcms2_plugin.h" + DESTINATION include + ) + +endif(NOT SKIP_INSTALL_HEADERS ) + +install(TARGETS lcms EXPORT lcms_EXPORT + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/ports/lcms/CONTROL b/ports/lcms/CONTROL new file mode 100644 index 000000000..64567fddd --- /dev/null +++ b/ports/lcms/CONTROL @@ -0,0 +1,4 @@ +Source: lcms +Version: 2.8 +Build-Depends: +Description: Little CMS.
\ No newline at end of file diff --git a/ports/lcms/portfile.cmake b/ports/lcms/portfile.cmake new file mode 100644 index 000000000..4487cce6a --- /dev/null +++ b/ports/lcms/portfile.cmake @@ -0,0 +1,35 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lcms2-2.8) + +vcpkg_download_distfile(ARCHIVE + URLS "https://sourceforge.net/projects/lcms/files/lcms/2.8/lcms2-2.8.tar.gz/download" + FILENAME "lcms2-2.8.tar.gz" + SHA512 a9478885b4892c79314a2ef9ab560e6655ac8f2d17abae0805e8b871138bb190e21f0e5c805398449f9dad528dc50baaf9e3cce8b8158eb8ff74179be5733f8f +) +vcpkg_extract_source_archive(${ARCHIVE}) +message(STATUS ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +set(USE_SHARED_LIBRARY OFF) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(USE_SHARED_LIBRARY ON) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG + -DSKIP_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/lcms RENAME copyright) + +vcpkg_copy_pdbs() + +#patch header files to fix import/export issues +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include + PATCHES "${CMAKE_CURRENT_LIST_DIR}/shared.patch") +endif(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) diff --git a/ports/lcms/shared.patch b/ports/lcms/shared.patch new file mode 100644 index 000000000..b3e7bf75f --- /dev/null +++ b/ports/lcms/shared.patch @@ -0,0 +1,10 @@ +--- lcms2.h Wed Jul 20 08:46:01 2016 ++++ lcms2.h Mon Jan 30 15:01:12 2017 +@@ -212,6 +212,7 @@ + + #endif // CMS_USE_BIG_ENDIAN + ++#define CMS_DLL_BUILD + + // Calling convention -- this is hardly platform and compiler dependent + #ifdef CMS_IS_WINDOWS_ diff --git a/ports/libarchive/CONTROL b/ports/libarchive/CONTROL new file mode 100644 index 000000000..96f2de7dd --- /dev/null +++ b/ports/libarchive/CONTROL @@ -0,0 +1,4 @@ +Source: libarchive
+Version: 3.2.2-2
+Description: Library for reading and writing streaming archives
+Build-Depends: zlib, bzip2, libxml2, lz4, liblzma, openssl
diff --git a/ports/libarchive/auto-define-libarchive-static.patch b/ports/libarchive/auto-define-libarchive-static.patch new file mode 100644 index 000000000..41c953ebe --- /dev/null +++ b/ports/libarchive/auto-define-libarchive-static.patch @@ -0,0 +1,28 @@ +diff --git a/archive.h b/archive.h
+index ff401e9..602717e 100644
+--- a/archive.h
++++ b/archive.h
+@@ -106,6 +106,9 @@ typedef ssize_t la_ssize_t;
+ * .lib. The default here assumes you're building a DLL. Only
+ * libarchive source should ever define __LIBARCHIVE_BUILD.
+ */
++
++#define LIBARCHIVE_STATIC
++
+ #if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
+ # ifdef __LIBARCHIVE_BUILD
+ # ifdef __GNUC__
+diff --git a/archive_entry.h b/archive_entry.h
+index 71b1e87..44246b9 100644
+--- a/archive_entry.h
++++ b/archive_entry.h
+@@ -85,6 +85,9 @@ typedef int64_t la_int64_t;
+ * .lib. The default here assumes you're building a DLL. Only
+ * libarchive source should ever define __LIBARCHIVE_BUILD.
+ */
++
++#define LIBARCHIVE_STATIC
++
+ #if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
+ # ifdef __LIBARCHIVE_BUILD
+ # ifdef __GNUC__
diff --git a/ports/libarchive/fix-buildsystem.patch b/ports/libarchive/fix-buildsystem.patch new file mode 100644 index 000000000..2568a8c8f --- /dev/null +++ b/ports/libarchive/fix-buildsystem.patch @@ -0,0 +1,146 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a376fce..2d035a1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -166,7 +166,7 @@ IF (MSVC) + # result of an assignment. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4706") + # /WX option is the same as gcc's -Werror option. +- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX") ++ #SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX") <- breaks x64-debug + # /Oi option enables built-in functions. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Oi") + ################################################################# +@@ -177,6 +177,7 @@ ENDIF (MSVC) + # Enable CTest/CDash support + include(CTest) + ++OPTION(ENABLE_LZO2 "Enable use of LZO2 library" ON) + OPTION(ENABLE_NETTLE "Enable use of Nettle" ON) + OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) + OPTION(ENABLE_LZMA "Enable the use of the system found LZMA library if found" ON) +@@ -357,7 +358,7 @@ IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + # The zlib and the bzip2 Setup program have installed programs and DLLs into + # "C:/Program Files/GnuWin32" by default. + # This is convenience setting for Windows. +- SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) ++ #SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) + # + # If you didn't use Setup program or installed into nonstandard path, + # cmake cannot find out your zlib or bzip2 libraries and include files, +@@ -397,11 +398,12 @@ IF(ZLIB_FOUND) + # + # Test if ZLIB_WINAPI macro is needed to use. + # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include <zlib.h>\nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ SET(ZLIB_WINAPI OFF) # skip following test, it crashes with weird message box ++ #TRY_MACRO_FOR_LIBRARY( ++ # "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" ++ # RUNS ++ # "#include <zlib.h>\nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" ++ # ZLIB_WINAPI) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) +@@ -483,6 +485,7 @@ ENDIF(LZMA_FOUND) + # + # Find LZO2 + # ++IF(ENABLE_LZO2) + IF (LZO2_INCLUDE_DIR) + # Already in cache, be silent + SET(LZO2_FIND_QUIETLY TRUE) +@@ -504,6 +507,7 @@ IF(LZO2_FOUND) + ENDIF(LZO2_FOUND) + MARK_AS_ADVANCED(CLEAR LZO2_INCLUDE_DIR) + MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY) ++ENDIF() + # + # Find LZ4 + # +@@ -923,7 +927,9 @@ IF(ENABLE_ICONV) + CHECK_ICONV("libc" "") + + # If iconv isn't in libc and we have a libiconv, try that. +- FIND_LIBRARY(LIBICONV_PATH NAMES iconv libiconv) ++ FIND_LIBRARY(LIBICONV_PATH1 NAMES iconv libiconv) ++ FIND_LIBRARY(LIBCHARSET_PATH NAMES charset libcharset) ++ SET(LIBICONV_PATH ${LIBICONV_PATH1} ${LIBCHARSET_PATH}) + IF(NOT HAVE_ICONV AND LIBICONV_PATH) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) + # Test if a macro is needed for the library. +@@ -1307,9 +1313,13 @@ CHECK_C_SOURCE_COMPILES( + "#include <sys/sysmacros.h>\nint main() { return major(256); }" + MAJOR_IN_SYSMACROS) + ++CMAKE_PUSH_CHECK_STATE() ++set(CMAKE_REQUIRED_INCLUDES ${LZMA_INCLUDE_DIR}) ++set(CMAKE_REQUIRED_LIBRARIES ${LZMA_LIBRARIES}) + CHECK_C_SOURCE_COMPILES( + "#include <lzma.h>\n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}" + HAVE_LZMA_STREAM_ENCODER_MT) ++CMAKE_POP_CHECK_STATE() + + IF(HAVE_STRERROR_R) + SET(HAVE_DECL_STRERROR_R 1) +@@ -1655,12 +1665,12 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) + ADD_DEFINITIONS(-DHAVE_CONFIG_H) + + # Handle generation of the libarchive.pc file for pkg-config +-INCLUDE(CreatePkgConfigFile) ++#INCLUDE(CreatePkgConfigFile) + + # + # Register installation of PDF documents. + # +-IF(WIN32 AND NOT CYGWIN) ++IF(0 AND WIN32 AND NOT CYGWIN) + # + # On Windows platform, It's better that we install PDF documents + # on one's computer. +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index 4cc9a2c..ef304c5 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -191,28 +191,24 @@ IF(WIN32 AND NOT CYGWIN) + ENDIF(WIN32 AND NOT CYGWIN) + + # Libarchive is a shared library +-ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) ++ADD_LIBRARY(archive ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) ++IF(BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) +- +-# archive_static is a static library +-ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) +-TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +-SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS +- LIBARCHIVE_STATIC) +-# On Posix systems, libarchive.so and libarchive.a can co-exist. +-IF(NOT WIN32 OR CYGWIN) +- SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) +-ENDIF(NOT WIN32 OR CYGWIN) ++ELSE() ++SET_TARGET_PROPERTIES(archive PROPERTIES COMPILE_DEFINITIONS LIBARCHIVE_STATIC) ++ENDIF() + + IF(ENABLE_INSTALL) + # How to install the libraries +- INSTALL(TARGETS archive archive_static ++ INSTALL(TARGETS archive + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +- INSTALL_MAN(${libarchive_MANS}) ++ #INSTALL_MAN(${libarchive_MANS}) ++ IF(NOT ARCHIVE_SKIP_HEADERS) + INSTALL(FILES ${include_HEADERS} DESTINATION include) ++ ENDIF() + ENDIF() + + add_subdirectory(test) diff --git a/ports/libarchive/override-broken-feature-checks.patch b/ports/libarchive/override-broken-feature-checks.patch new file mode 100644 index 000000000..63c65a10f --- /dev/null +++ b/ports/libarchive/override-broken-feature-checks.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2d035a1..1e32afd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1226,7 +1226,8 @@ CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) + CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) + CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) +-CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) ++#CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) ++set(HAVE_MEMMOVE 1) + CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) + CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) + CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) +@@ -1257,11 +1258,16 @@ CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) + CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) + CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) + CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) +-CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) +-CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) +-CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) +-CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) ++#CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) ++set(HAVE_WCRTOMB 1) ++#CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) ++set(HAVE_WCSCMP 1) ++#CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) ++set(HAVE_WCSCPY 1) ++#CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) ++set(HAVE_WCSLEN 1) ++#CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) ++set(HAVE_WCTOMB 1) + CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S) + CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) + CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) +@@ -1273,10 +1279,14 @@ CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) + CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) + CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) + CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) +-CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) +-CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) +-CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) +-CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) ++#CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) ++set(HAVE_VPRINTF 1) ++#CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) ++set(HAVE_WMEMCMP 1) ++#CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) ++set(HAVE_WMEMCPY 1) ++#CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) ++set(HAVE_WMEMMOVE 1) + + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + diff --git a/ports/libarchive/portfile.cmake b/ports/libarchive/portfile.cmake new file mode 100644 index 000000000..5a60f1d6d --- /dev/null +++ b/ports/libarchive/portfile.cmake @@ -0,0 +1,52 @@ +# libarchive uses winapi functions not available in WindowsStore
+if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+ message(FATAL_ERROR "Error: UWP builds are not supported.")
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libarchive-3.2.2)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/libarchive/libarchive/archive/v3.2.2.zip"
+ FILENAME "libarchive-3.2.2.zip"
+ SHA512 74abe8a66514aa344111f08e08015d2972545f6acf0923ff1ce7267bfc6c195ca562078a11d1c49ca36155c6b782b1f7ad08b71d93cb85fa892373479b0d1182)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/fix-buildsystem.patch
+ ${CMAKE_CURRENT_LIST_DIR}/use-memset-not-bzero.patch
+ ${CMAKE_CURRENT_LIST_DIR}/override-broken-feature-checks.patch)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DENABLE_LZO2=OFF
+ -DENABLE_NETTLE=OFF
+ -DENABLE_EXPAT=OFF
+ -DENABLE_LibGCC=OFF
+ -DENABLE_CNG=OFF
+ -DENABLE_TAR=OFF
+ -DENABLE_CPIO=OFF
+ -DENABLE_CAT=OFF
+ -DENABLE_XATTR=OFF
+ -DENABLE_ACL=OFF
+ -DENABLE_TEST=OFF
+ -DENABLE_ICONV=OFF
+ -DPOSIX_REGEX_LIB=NONE
+ OPTIONS_DEBUG
+ -DARCHIVE_SKIP_HEADERS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/auto-define-libarchive-static.patch)
+endif()
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libarchive)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libarchive/COPYING ${CURRENT_PACKAGES_DIR}/share/libarchive/copyright)
diff --git a/ports/libarchive/use-memset-not-bzero.patch b/ports/libarchive/use-memset-not-bzero.patch new file mode 100644 index 000000000..d28ab7409 --- /dev/null +++ b/ports/libarchive/use-memset-not-bzero.patch @@ -0,0 +1,26 @@ +diff --git a/libarchive/archive_write_add_filter_xz.c b/libarchive/archive_write_add_filter_xz.c +index 46a6c38..b0f25a6 100644 +--- a/libarchive/archive_write_add_filter_xz.c ++++ b/libarchive/archive_write_add_filter_xz.c +@@ -233,7 +233,7 @@ archive_compressor_xz_init_stream(struct archive_write_filter *f, + if (f->code == ARCHIVE_FILTER_XZ) { + #ifdef HAVE_LZMA_STREAM_ENCODER_MT + if (data->threads != 1) { +- bzero(&mt_options, sizeof(mt_options)); ++ memset(&mt_options, 0, sizeof(mt_options)); + mt_options.threads = data->threads; + mt_options.timeout = 300; + mt_options.filters = data->lzmafilters; +diff --git a/libarchive/archive_write_set_format_xar.c b/libarchive/archive_write_set_format_xar.c +index a2dbc03..15a013c 100644 +--- a/libarchive/archive_write_set_format_xar.c ++++ b/libarchive/archive_write_set_format_xar.c +@@ -2913,7 +2913,7 @@ compression_init_encoder_xz(struct archive *a, + *strm = lzma_init_data; + #ifdef HAVE_LZMA_STREAM_ENCODER_MT + if (threads > 1) { +- bzero(&mt_options, sizeof(mt_options)); ++ memset(&mt_options, 0, sizeof(mt_options)); + mt_options.threads = threads; + mt_options.timeout = 300; + mt_options.filters = lzmafilters; diff --git a/ports/libbson/portfile.cmake b/ports/libbson/portfile.cmake index ce2ccea40..6116f1f8c 100644 --- a/ports/libbson/portfile.cmake +++ b/ports/libbson/portfile.cmake @@ -12,7 +12,6 @@ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DENABLE_TESTS=OFF
- -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON
)
vcpkg_install_cmake()
diff --git a/ports/libepoxy/CONTROL b/ports/libepoxy/CONTROL new file mode 100644 index 000000000..963a3e17a --- /dev/null +++ b/ports/libepoxy/CONTROL @@ -0,0 +1,3 @@ +Source: libepoxy +Version: 1.4.0-2432daf-1 +Description: Epoxy is a library for handling OpenGL function pointer management for you diff --git a/ports/libepoxy/portfile.cmake b/ports/libepoxy/portfile.cmake new file mode 100644 index 000000000..ef1880d16 --- /dev/null +++ b/ports/libepoxy/portfile.cmake @@ -0,0 +1,26 @@ +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(STATUS "Warning: Static building not supported yet. Building dynamic.") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libepoxy-2432daf4cf58b5ff11e008ca34811588285c43b3) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/anholt/libepoxy/archive/2432daf4cf58b5ff11e008ca34811588285c43b3.zip" + FILENAME "libepoxy-2432daf4cf58b5ff11e008ca34811588285c43b3.zip" + SHA512 70b59b6c5722eb87522927fdedab44f74ffd2d71d2ae42509de07b0c3e13f71320b25da0d4c75dca75c4208ea7a525483267d6ccb8acd5274728c015c7ac4006) + +vcpkg_extract_source_archive(${ARCHIVE}) + +# ensure python is on path - not for meson but some source generation scripts +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_PATH ${PYTHON3} DIRECTORY) +set(ENV{PATH} "$ENV{PATH};${PYTHON3_PATH}") + +vcpkg_configure_meson(SOURCE_PATH ${SOURCE_PATH}) +vcpkg_install_meson() + +vcpkg_copy_pdbs() + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libepoxy) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libepoxy/COPYING ${CURRENT_PACKAGES_DIR}/share/libepoxy/copyright) diff --git a/ports/libffi/CMakeLists.txt b/ports/libffi/CMakeLists.txt new file mode 100644 index 000000000..79e9e671d --- /dev/null +++ b/ports/libffi/CMakeLists.txt @@ -0,0 +1,78 @@ +cmake_minimum_required(VERSION 3.0) +project(libffi) + +# config variables for ffi.h.in +set(VERSION 3.1) +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(TARGET X86_WIN32) +else() + set(TARGET X86_WIN64) +endif() +set(HAVE_LONG_DOUBLE 0) +set(HAVE_LONG_DOUBLE_VARIANT 0) +set(FFI_EXEC_TRAMPOLINE_TABLE 0) + +# mimic layout of original buildsystem +configure_file(include/ffi.h.in ${CMAKE_BINARY_DIR}/include/ffi.h) +file(COPY ${FFI_CONFIG_FILE} DESTINATION ${CMAKE_BINARY_DIR}) +file(COPY src/x86/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) + +include_directories(${CMAKE_BINARY_DIR}/include) +include_directories(${CMAKE_BINARY_DIR}) +include_directories(include) + +add_definitions(-DHAVE_CONFIG_H) +add_definitions(-DFFI_BUILDING) +if(BUILD_SHARED_LIBS) + add_definitions(-DFFI_EXPORT_DATA) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(ARCH_ASM_NAME win32) + set(ARCH_ASSEMBLER ml /safeseh) +else() + set(ARCH_ASM_NAME win64) + set(ARCH_ASSEMBLER ml64) +endif() + +execute_process( + COMMAND cl /nologo /EP /I. /Iinclude ${CMAKE_SOURCE_DIR}/src/x86/${ARCH_ASM_NAME}.S + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + OUTPUT_FILE ${ARCH_ASM_NAME}.asm) + +# Produced *.asm file could be just added to sources. +# It works in x64 mode, but for some strange reason MASM returns error code when in x86, +# (even though it didn't report any errors and correctly generated object file) +# which in turn causes MSBUILD to stop. +execute_process( + COMMAND ${ARCH_ASSEMBLER} /c /Zi ${ARCH_ASM_NAME}.asm + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + +set(FFI_SOURCES + ${CMAKE_BINARY_DIR}/${ARCH_ASM_NAME}.obj + src/x86/ffi.c + src/closures.c + src/java_raw_api.c + src/prep_cif.c + src/raw_api.c + src/types.c) + +if(CMAKE_BUILD_TYPE STREQUAL Debug) + list(APPEND FFI_SOURCES src/debug.c) + add_definitions(-DFFI_DEBUG) +endif() + +add_library(libffi ${FFI_SOURCES}) + +install(TARGETS libffi + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +if(NOT FFI_SKIP_HEADERS) + install(FILES + ${CMAKE_BINARY_DIR}/include/ffi.h + ${CMAKE_BINARY_DIR}/include/ffitarget.h + DESTINATION include) +endif() diff --git a/ports/libffi/CONTROL b/ports/libffi/CONTROL new file mode 100644 index 000000000..83725f49c --- /dev/null +++ b/ports/libffi/CONTROL @@ -0,0 +1,3 @@ +Source: libffi
+Version: 3.1
+Description: Portable, high level programming interface to various calling conventions
diff --git a/ports/libffi/auto-define-static-macro.patch b/ports/libffi/auto-define-static-macro.patch new file mode 100644 index 000000000..468a2fc36 --- /dev/null +++ b/ports/libffi/auto-define-static-macro.patch @@ -0,0 +1,14 @@ +diff --git a/ffi.h b/ffi.h +index 8d5eac2..0b0c2f6 100644 +--- a/ffi.h ++++ b/ffi.h +@@ -174,6 +174,9 @@ typedef struct _ffi_type + /* of the library, but don't worry about that. Besides, */ + /* as a workaround, they can define FFI_BUILDING if they */ + /* *know* they are going to link with the static library. */ ++ ++#define FFI_BUILDING ++ + #if defined _MSC_VER && !defined FFI_BUILDING + #define FFI_EXTERN extern __declspec(dllimport) + #else diff --git a/ports/libffi/export-global-data.patch b/ports/libffi/export-global-data.patch new file mode 100644 index 000000000..9d965f647 --- /dev/null +++ b/ports/libffi/export-global-data.patch @@ -0,0 +1,35 @@ +diff --git a/src/types.c b/src/types.c +index 0de5994..46c8d18 100644 +--- a/src/types.c ++++ b/src/types.c +@@ -31,6 +31,12 @@ + #include <ffi.h> + #include <ffi_common.h> + ++#ifdef FFI_EXPORT_DATA ++#define FFI_EXPORT __declspec(dllexport) ++#else ++#define FFI_EXPORT ++#endif ++ + /* Type definitions */ + + #define FFI_TYPEDEF(name, type, id) \ +@@ -38,7 +44,7 @@ struct struct_align_##name { \ + char c; \ + type x; \ + }; \ +-const ffi_type ffi_type_##name = { \ ++FFI_EXPORT const ffi_type ffi_type_##name = { \ + sizeof(type), \ + offsetof(struct struct_align_##name, x), \ + id, NULL \ +@@ -56,7 +62,7 @@ ffi_type ffi_type_##name = { \ + } + + /* Size and alignment are fake here. They must not be 0. */ +-const ffi_type ffi_type_void = { ++FFI_EXPORT const ffi_type ffi_type_void = { + 1, 1, FFI_TYPE_VOID, NULL + }; + diff --git a/ports/libffi/fficonfig.h b/ports/libffi/fficonfig.h new file mode 100644 index 000000000..b5cd2368f --- /dev/null +++ b/ports/libffi/fficonfig.h @@ -0,0 +1,220 @@ +/* fficonfig.h. Generated from fficonfig.h.in by configure. */ +/* fficonfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* 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 the flags needed for the .section .eh_frame directive. */ +/* #undef EH_FRAME_FLAGS */ + +/* Define this if you want extra debugging. */ +/* #undef FFI_DEBUG */ + +/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ +/* #undef FFI_EXEC_TRAMPOLINE_TABLE */ + +/* Define this if you want to enable pax emulated trampolines */ +/* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */ + +/* Cannot use malloc on this target, so, we revert to alternative means */ +/* #undef FFI_MMAP_EXEC_WRIT */ + +/* Define this if you do not want support for the raw API. */ +/* #undef FFI_NO_RAW_API */ + +/* Define this if you do not want support for aggregate types. */ +/* #undef FFI_NO_STRUCTS */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ +/* #undef HAVE_ALLOCA_H */ + +/* Define if your assembler supports .ascii. */ +#ifndef _WIN64 +#define HAVE_AS_ASCII_PSEUDO_OP 1 +#endif + +/* Define if your assembler supports .cfi_* directives. */ +/* #undef HAVE_AS_CFI_PSEUDO_OP */ + +/* Define if your assembler supports .register. */ +/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ + +/* Define if your assembler and linker support unaligned PC relative relocs. + */ +/* #undef HAVE_AS_SPARC_UA_PCREL */ + +/* Define if your assembler supports .string. */ +#ifndef _WIN64 +#define HAVE_AS_STRING_PSEUDO_OP 1 +#endif + +/* Define if your assembler supports unwind section type. */ +/* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */ + +/* Define if your assembler supports PC relative relocs. */ +#ifndef _WIN64 +#define HAVE_AS_X86_PCREL 1 +#endif + +/* Define to 1 if you have the <dlfcn.h> header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define if __attribute__((visibility("hidden"))) is supported. */ +/* #undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE */ + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the long double type and it is bigger than a double */ +/* #undef HAVE_LONG_DOUBLE */ + +/* Define if you support more than one size of the long double type */ +/* #undef HAVE_LONG_DOUBLE_VARIANT */ + +/* Define to 1 if you have the `memcpy' function. */ +/* #undef HAVE_MEMCPY */ + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +/* #undef HAVE_MMAP */ + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +/* #undef HAVE_MMAP_ANON */ + +/* Define if mmap of /dev/zero works. */ +/* #undef HAVE_MMAP_DEV_ZERO */ + +/* Define if read-only mmap of a plain file works. */ +/* #undef HAVE_MMAP_FILE */ + +/* Define if .eh_frame sections should be read-only. */ +/* #undef HAVE_RO_EH_FRAME */ + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* 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. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the <sys/mman.h> header file. */ +/* #undef HAVE_SYS_MMAN_H */ + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libffi" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "http://github.com/atgreen/libffi/issues" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libffi" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libffi 3.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libffi" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.1" + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 8 + +/* The size of `size_t', as computed by sizeof. */ +#ifndef _WIN64 +#define SIZEOF_SIZE_T 4 +#else +#define SIZEOF_SIZE_T 8 +#endif + +/* 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 you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if symbols are underscored. */ +#ifndef _WIN64 +#define SYMBOL_UNDERSCORE 1 +#endif + +/* Define this if you are using Purify and want to suppress spurious messages. + */ +/* #undef USING_PURIFY */ + +/* Version number of package */ +#define VERSION "3.1" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +/* #undef size_t */ + + +#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) .hidden name +#else +#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) +#endif +#else +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) +#else +#define FFI_HIDDEN +#endif +#endif + diff --git a/ports/libffi/portfile.cmake b/ports/libffi/portfile.cmake new file mode 100644 index 000000000..2639aa1ba --- /dev/null +++ b/ports/libffi/portfile.cmake @@ -0,0 +1,38 @@ +if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x86 AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
+ message(FATAL_ERROR "Architecture not supported")
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libffi-3.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/libffi/libffi/archive/v3.1.zip"
+ FILENAME "libffi-3.1.zip"
+ SHA512 a5d4cc638262aecec29e70333119f561588a737fd8f353e18d9bf1bfa7b38eb6aba371778119ea8d35339b458815105d5b110063295b6588a8761b24dac77a7c)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/export-global-data.patch)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DFFI_CONFIG_FILE=${CMAKE_CURRENT_LIST_DIR}/fficonfig.h
+ OPTIONS_DEBUG
+ -DFFI_SKIP_HEADERS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/auto-define-static-macro.patch)
+endif()
+
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libffi)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libffi/LICENSE ${CURRENT_PACKAGES_DIR}/share/libffi/copyright)
diff --git a/ports/libflac/CMakeLists.txt b/ports/libflac/CMakeLists.txt index afe55f55e..a9f1afc5e 100644 --- a/ports/libflac/CMakeLists.txt +++ b/ports/libflac/CMakeLists.txt @@ -24,15 +24,23 @@ endif() if(LIBFLAC_ARCHITECTURE MATCHES x86) add_definitions(-DFLAC__CPU_IA32) + add_definitions(-DFLAC__HAS_NASM) + enable_language(ASM_NASM) + list(APPEND LIBFLAC_SOURCES + src/libFLAC/ia32/cpu_asm.nasm + src/libFLAC/ia32/fixed_asm.nasm + src/libFLAC/ia32/lpc_asm.nasm) + set(CMAKE_ASM_NASM_FLAGS "-i${PROJECT_SOURCE_DIR}/src/libFLAC/ia32/ -f win32 -d OBJ_FORMAT_win32") elseif(LIBFLAC_ARCHITECTURE MATCHES x64) add_definitions(-DFLAC__CPU_X86_64) + add_definitions(-DENABLE_64_BIT_WORDS) endif() if(CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-DFLAC__OVERFLOW_DETECT) endif() -add_definitions(-DVERSION="1.3.1") +add_definitions(-DPACKAGE_VERSION="1.3.2") add_definitions(-DFLAC__HAS_OGG) add_definitions(-DFLAC__ALIGN_MALLOC_DATA) # 32 byte boundary add_definitions(-D_CRT_SECURE_NO_WARNINGS) diff --git a/ports/libflac/CONTROL b/ports/libflac/CONTROL index 9b1a37531..52878673d 100644 --- a/ports/libflac/CONTROL +++ b/ports/libflac/CONTROL @@ -1,4 +1,4 @@ Source: libflac
-Version: 1.3.1-1
+Version: 1.3.2-1
Description: Library for manipulating FLAC files
Build-Depends: libogg
diff --git a/ports/libflac/portfile.cmake b/ports/libflac/portfile.cmake index 4ed496fb8..cbf7d6fd3 100644 --- a/ports/libflac/portfile.cmake +++ b/ports/libflac/portfile.cmake @@ -1,32 +1,39 @@ # libFLAC uses winapi functions not available in WindowsStore
-if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
message(FATAL_ERROR "Error: UWP builds are currently not supported.")
endif()
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/flac-1.3.1)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/flac-1.3.2)
vcpkg_download_distfile(ARCHIVE
- URLS "http://downloads.xiph.org/releases/flac/flac-1.3.1.tar.xz"
- FILENAME "flac-1.3.1.tar.xz"
- SHA512 923cd0ffe2155636febf2b4633791bc83370d57080461b97ebb69ea21a4b1be7c0ff376c7fc8ca3979af4714e761112114a24b49ff6c80228b58b929db6e96d5)
+ URLS "http://downloads.xiph.org/releases/flac/flac-1.3.2.tar.xz"
+ FILENAME "flac-1.3.2.tar.xz"
+ SHA512 63910e8ebbe508316d446ffc9eb6d02efbd5f47d29d2ea7864da9371843c8e671854db6e89ba043fe08aef1845b8ece70db80f1cce853f591ca30d56ef7c3a15)
vcpkg_extract_source_archive(${ARCHIVE})
+if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
+ vcpkg_find_acquire_program(NASM)
+ get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
+ set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}")
+endif()
+
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
- OPTIONS
- -DLIBFLAC_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}
- OPTIONS_DEBUG
- -DLIBFLAC_SKIP_HEADERS=ON)
+ PREFER_NINJA
+ OPTIONS
+ -DLIBFLAC_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}
+ OPTIONS_DEBUG
+ -DLIBFLAC_SKIP_HEADERS=ON)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(APPEND ${CURRENT_PACKAGES_DIR}/include/FLAC/export.h "#undef FLAC_API\n#define FLAC_API\n")
- file(APPEND ${CURRENT_PACKAGES_DIR}/include/FLAC++/export.h "#undef FLAC_API\n#define FLAC_API\n")
+ file(APPEND ${CURRENT_PACKAGES_DIR}/include/FLAC++/export.h "#undef FLACPP_API\n#define FLACPP_API\n")
endif()
# This license (BSD) is relevant only for library - if someone would want to install
diff --git a/ports/libjpeg-turbo/CONTROL b/ports/libjpeg-turbo/CONTROL index 9c5ee1d07..d9df1c43d 100644 --- a/ports/libjpeg-turbo/CONTROL +++ b/ports/libjpeg-turbo/CONTROL @@ -1,3 +1,3 @@ Source: libjpeg-turbo -Version: 1.4.90-1 +Version: 1.5.1-1 Description: libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression on x86, x86-64, ARM, and PowerPC systems. diff --git a/ports/libjpeg-turbo/portfile.cmake b/ports/libjpeg-turbo/portfile.cmake index aaa01547c..6c30c0a08 100644 --- a/ports/libjpeg-turbo/portfile.cmake +++ b/ports/libjpeg-turbo/portfile.cmake @@ -1,10 +1,14 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libjpeg-turbo-1.4.90) + +set(LIBJPEGTURBO_VERSION 1.5.1) +set(LIBJPEGTURBO_HASH "7b89f3c707daa98b0ed19ec417aab5273a1248ce7f98722a671ea80558a8eb0e73b136ce7be7c059f9f42262e682743abcab64e325f82cd4bd1531e0a4035209") + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libjpeg-turbo-${LIBJPEGTURBO_VERSION}) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/1.4.90.zip" - FILENAME "libjpeg-turbo-1.4.90.zip" - SHA512 43c3d26c70a7356bb0832276fe82eead040c3f4aa17df118f91a38615bfacfdfb25fab41965f9ca2b69d18e0b937a1bb753e93fa2c114e01d5174fc1100010b4 + URLS "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${LIBJPEGTURBO_VERSION}.zip" + FILENAME "libjpeg-turbo-${LIBJPEGTURBO_VERSION}.zip" + SHA512 ${LIBJPEGTURBO_HASH} ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( @@ -14,7 +18,7 @@ vcpkg_apply_patches( vcpkg_find_acquire_program(NASM) get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY) -set(ENV{PATH} "${NASM_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}") if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(BUILD_STATIC OFF) diff --git a/ports/liblzma/CONTROL b/ports/liblzma/CONTROL index 648316130..754d767bc 100644 --- a/ports/liblzma/CONTROL +++ b/ports/liblzma/CONTROL @@ -1,3 +1,3 @@ Source: liblzma
-Version: 5.2.2
+Version: 5.2.3
Description: Compression library with an API similar to that of zlib.
diff --git a/ports/liblzma/portfile.cmake b/ports/liblzma/portfile.cmake index bb2b6e083..6185815f4 100644 --- a/ports/liblzma/portfile.cmake +++ b/ports/liblzma/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/xz-5.2.2)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/xz-5.2.3)
vcpkg_download_distfile(ARCHIVE
- URLS "http://tukaani.org/xz/xz-5.2.2.tar.gz"
- FILENAME "xz-5.2.2.tar.gz"
- SHA512 8d6249f93c5c43e1c8eeb21f93b22330fd54575e20bbb4af3d06721192d9f0ca3351878964c9640238ac410b7dd9f16329793c7be7355c7ca0db92c6db6ab813)
+ URLS "http://tukaani.org/xz/xz-5.2.3.tar.gz"
+ FILENAME "xz-5.2.3.tar.gz"
+ SHA512 a5eb4f707cf31579d166a6f95dbac45cf7ea181036d1632b4f123a4072f502f8d57cd6e7d0588f0bf831a07b8fc4065d26589a25c399b95ddcf5f73435163da6)
vcpkg_extract_source_archive(${ARCHIVE})
@@ -12,6 +12,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS_DEBUG
-DLIBLZMA_SKIP_HEADERS=ON)
diff --git a/ports/libmariadb/CONTROL b/ports/libmariadb/CONTROL index b91da0740..26e23810a 100644 --- a/ports/libmariadb/CONTROL +++ b/ports/libmariadb/CONTROL @@ -1,3 +1,3 @@ -Source: libmariadb -Version: 2.3.1 -Description: The MariaDB Connector/C is used to connect applications developed in C/C++ to MariaDB and MySQL databases.
\ No newline at end of file +Source: libmariadb
+Version: 2.3.2
+Description: MariaDB Connector/C is used to connect C/C++ applications to MariaDB and MySQL databases
diff --git a/ports/libmariadb/portfile.cmake b/ports/libmariadb/portfile.cmake index e6ccfa508..3dba9c7d1 100644 --- a/ports/libmariadb/portfile.cmake +++ b/ports/libmariadb/portfile.cmake @@ -1,77 +1,71 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mariadb-connector-c-2.3.1) - -if (EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql.h") - message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.") -endif() - -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/MariaDB/mariadb-connector-c/archive/v2.3.1.tar.gz" - FILENAME "mariadb-connector-c-2.3.1.tar.gz" - SHA512 d82f8348201d41dce6820c952a0503a5154c4e9c06feb471fe451a6fb968e5cff04423a64183cbb8e159a1b4e7265c12b5b7aef912f633395d9f1b0436fbfd2d -) -vcpkg_extract_source_archive(${ARCHIVE}) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} -) - -vcpkg_install_cmake() - -# remove debug header -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - -# fix libmariadb lib & dll directory. -file(MAKE_DIRECTORY - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin) -file(RENAME - ${CURRENT_PACKAGES_DIR}/lib/mariadb/libmariadb.dll - ${CURRENT_PACKAGES_DIR}/bin/libmariadb.dll) -file(RENAME - ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/libmariadb.dll - ${CURRENT_PACKAGES_DIR}/debug/bin/libmariadb.dll) -file(RENAME - ${CURRENT_PACKAGES_DIR}/lib/mariadb/libmariadb.lib - ${CURRENT_PACKAGES_DIR}/lib/libmariadb.lib) -file(RENAME - ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/libmariadb.lib - ${CURRENT_PACKAGES_DIR}/debug/lib/libmariadb.lib) -file(REMOVE - ${CURRENT_PACKAGES_DIR}/lib/mariadb/mariadbclient.lib - ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/mariadbclient.lib) - -# remove plugin folder -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/lib/plugin - ${CURRENT_PACKAGES_DIR}/debug/lib/plugin - ${CURRENT_PACKAGES_DIR}/lib/mariadb - ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb) - -# copy & remove header files -file(GLOB HEADER_FILES ${CURRENT_PACKAGES_DIR}/include/mariadb/*) -file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/mariadb) -file(REMOVE - ${CURRENT_PACKAGES_DIR}/include/config-win.h - ${CURRENT_PACKAGES_DIR}/include/dbug.h - ${CURRENT_PACKAGES_DIR}/include/errmsg.h - ${CURRENT_PACKAGES_DIR}/include/getopt.h - ${CURRENT_PACKAGES_DIR}/include/hash.h - ${CURRENT_PACKAGES_DIR}/include/ma_common.h - ${CURRENT_PACKAGES_DIR}/include/ma_dyncol.h - ${CURRENT_PACKAGES_DIR}/include/sha1.h - ${CURRENT_PACKAGES_DIR}/include/thr_alarm.h - ${CURRENT_PACKAGES_DIR}/include/violite.h - ${CURRENT_PACKAGES_DIR}/include/mysql_version.h.in - ${CURRENT_PACKAGES_DIR}/include/my_config.h.in - ${CURRENT_PACKAGES_DIR}/include/CMakeLists.txt - ${CURRENT_PACKAGES_DIR}/include/Makefile.am) - -# copy license file -file(COPY ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmariadb) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/libmariadb/COPYING.LIB ${CURRENT_PACKAGES_DIR}/share/libmariadb/copyright)
\ No newline at end of file +
+if (EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql/mysql.h")
+ message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.")
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mariadb-connector-c-2.3.2)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/MariaDB/mariadb-connector-c/archive/v2.3.2.tar.gz"
+ FILENAME "mariadb-connector-c-2.3.2.tar.gz"
+ SHA512 f5574756ffce69e3dd15b7f7c14cfd0b4d69e3203ae4b383f05a110918916279ba7c0b9149d0dcb9ec93bbfc0927dfaf88bb40979ba1de710ce148d1fbe033af
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+)
+
+vcpkg_install_cmake()
+
+# remove debug header
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# fix libmariadb lib & dll directory.
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/lib/mariadb/mariadbclient.lib
+ ${CURRENT_PACKAGES_DIR}/lib/mariadbclient.lib)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/mariadbclient.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mariadbclient.lib)
+else()
+ file(MAKE_DIRECTORY
+ ${CURRENT_PACKAGES_DIR}/bin
+ ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/lib/mariadb/libmariadb.dll
+ ${CURRENT_PACKAGES_DIR}/bin/libmariadb.dll)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/libmariadb.dll
+ ${CURRENT_PACKAGES_DIR}/debug/bin/libmariadb.dll)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/lib/mariadb/libmariadb.lib
+ ${CURRENT_PACKAGES_DIR}/lib/libmariadb.lib)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb/libmariadb.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/libmariadb.lib)
+endif()
+
+# remove plugin folder
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/lib/plugin
+ ${CURRENT_PACKAGES_DIR}/debug/lib/plugin
+ ${CURRENT_PACKAGES_DIR}/lib/mariadb
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mariadb)
+
+# copy & remove header files
+file(GLOB HEADER_FILES ${CURRENT_PACKAGES_DIR}/include/mariadb/*)
+file(REMOVE
+ ${CURRENT_PACKAGES_DIR}/include/mariadb/my_config.h.in
+ ${CURRENT_PACKAGES_DIR}/include/mariadb/mysql_version.h.in
+ ${CURRENT_PACKAGES_DIR}/include/mariadb/CMakeLists.txt
+ ${CURRENT_PACKAGES_DIR}/include/mariadb/Makefile.am)
+file(RENAME
+ ${CURRENT_PACKAGES_DIR}/include/mariadb
+ ${CURRENT_PACKAGES_DIR}/include/mysql)
+
+# copy license file
+file(COPY ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmariadb)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libmariadb/COPYING.LIB ${CURRENT_PACKAGES_DIR}/share/libmariadb/copyright)
diff --git a/ports/libmysql/0001_cmake.patch b/ports/libmysql/0001_cmake.patch deleted file mode 100644 index 9defe7fc1..000000000 --- a/ports/libmysql/0001_cmake.patch +++ /dev/null @@ -1,378 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 44842d3..e89eed9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -118,7 +118,7 @@ IF(DEFINED MYSQL_PROJECT_NAME) - SET(MYSQL_PROJECT_NAME ${MYSQL_PROJECT_NAME} CACHE STRING - ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE) - ELSE() -- SET(MYSQL_PROJECT_NAME "MySQL" CACHE STRING -+ SET(MYSQL_PROJECT_NAME "LibMySQL" CACHE STRING - ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE) - MARK_AS_ADVANCED(MYSQL_PROJECT_NAME) - ENDIF() -@@ -132,6 +132,9 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug" OR WITH_DEBUG) - ENDIF() - ENDIF() - -+OPTION(FORCE_UNSUPPORTED_COMPILER "Disable compiler version checks" ON) -+MARK_AS_ADVANCED(FORCE_UNSUPPORTED_COMPILER) -+ - OPTION(WITH_DEFAULT_COMPILER_OPTIONS - "Use flags from cmake/build_configurations/compiler_options.cmake" - ON) -@@ -193,46 +196,30 @@ ENDIF() - INCLUDE(character_sets) - INCLUDE(cpu_info) - INCLUDE(zlib) --INCLUDE(lz4) --INCLUDE(libevent) - INCLUDE(ssl) --INCLUDE(readline) --INCLUDE(protobuf) - INCLUDE(mysql_version) - INCLUDE(libutils) - INCLUDE(dtrace) --INCLUDE(plugin) - INCLUDE(install_macros) - INCLUDE(install_layout) - INCLUDE(mysql_add_executable) - - # Handle options --IF(EXISTS ${CMAKE_SOURCE_DIR}/rapid) -- OPTION(WITH_RAPID -- "Build additonal code(plugins) that is located in rapid directory" ON) --ELSE() -- OPTION(WITH_RAPID -- "Build additonal code(plugins) that is located in rapid directory" OFF) --ENDIF() - OPTION(DISABLE_SHARED - "Don't build shared libraries, compile code as position-dependent" OFF) -+MARK_AS_ADVANCED(DISABLE_SHARED) - IF(DISABLE_SHARED) - SET(WITHOUT_DYNAMIC_PLUGINS 1) - ENDIF() - OPTION(ENABLED_PROFILING "Enable profiling" ON) --OPTION(WITHOUT_SERVER OFF) -+SET(WITHOUT_SERVER ON) - IF(UNIX) - OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF) - ENDIF() - IF(WIN32) - OPTION(WITH_MSCRT_DEBUG "MS Visual Studio Debug CRT instrumentation" OFF) - ENDIF() --IF(NOT WITHOUT_SERVER) -- OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) --ENDIF() --OPTION(FORCE_UNSUPPORTED_COMPILER "Disable compiler version checks" OFF) --MARK_AS_ADVANCED(WITHOUT_SERVER DISABLE_SHARED FORCE_UNSUPPORTED_COMPILER) -- -+OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" OFF) - - include(CheckCSourceCompiles) - include(CheckCXXSourceCompiles) -@@ -452,18 +439,8 @@ ELSE() - SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") - ENDIF() - --INCLUDE(cmake/boost.cmake) -- --IF (CMAKE_SYSTEM_NAME MATCHES "Linux") -- OPTION(WITH_SYSTEMD "Enable installation of systemd support files" OFF) -- IF (WITH_SYSTEMD) -- INCLUDE(cmake/systemd.cmake) -- ENDIF() --ELSE() -- IF (WITH_SYSTEMD) -- MESSAGE(FATAL_ERROR "Installation of systemd support files not supported") -- ENDIF() --ENDIF() -+# Boost is not needed to build libmysql (yet) -+#INCLUDE(cmake/boost.cmake) - - # Run platform tests - INCLUDE(configure.cmake) -@@ -479,76 +456,6 @@ INCLUDE_DIRECTORIES( - MYSQL_CHECK_ZLIB_WITH_COMPRESS() - # Add bundled yassl/taocrypt or system openssl. - MYSQL_CHECK_SSL() --# Add system/bundled editline. --MYSQL_CHECK_EDITLINE() --# Add libevent --MYSQL_CHECK_LIBEVENT() --# Add lz4 library --MYSQL_CHECK_LZ4() --# Add protoc and libprotobuf --IF(NOT WITHOUT_SERVER) -- MYSQL_CHECK_PROTOBUF() --ENDIF() -- --# Check for SYS_thread_selfid system call --CHECK_C_SOURCE_COMPILES(" --#include <sys/types.h> --#include <sys/syscall.h> --#include <unistd.h> --int main(int ac, char **av) --{ -- unsigned long long tid = syscall(SYS_thread_selfid); -- return (tid != 0 ? 0 : 1); --}" --HAVE_SYS_THREAD_SELFID) -- --# Check for gettid() system call --CHECK_C_SOURCE_COMPILES(" --#include <sys/types.h> --#include <sys/syscall.h> --#include <unistd.h> --int main(int ac, char **av) --{ -- unsigned long long tid = syscall(SYS_gettid); -- return (tid != 0 ? 0 : 1); --}" --HAVE_SYS_GETTID) -- --IF(CMAKE_SYSTEM_NAME MATCHES "Linux") -- # Check for pthread_setname_np -- CHECK_C_SOURCE_COMPILES(" -- #include <pthread.h> -- int main(int ac, char **av) -- { -- const char *thread_name= 0; -- int ret = pthread_setname_np(pthread_self(), thread_name); -- return ret; -- }" -- HAVE_PTHREAD_SETNAME_NP) --ENDIF() -- --# Check for pthread_getthreadid_np() --CHECK_C_SOURCE_COMPILES(" --#include <pthread_np.h> --int main(int ac, char **av) --{ -- unsigned long long tid = pthread_getthreadid_np(); -- return (tid != 0 ? 0 : 1); --}" --HAVE_PTHREAD_GETTHREADID_NP) -- --# Check for pthread_self() returning an integer type --CHECK_C_SOURCE_COMPILES(" --#include <sys/types.h> --#include <pthread.h> --int main(int ac, char **av) --{ -- unsigned long long tid = pthread_self(); -- return (tid != 0 ? 0 : 1); --}" --HAVE_INTEGER_PTHREAD_SELF --FAIL_REGEX "warning: incompatible pointer to integer conversion" --) - - # - # Setup maintainer mode options by the end. Platform checks are -@@ -563,18 +470,15 @@ OPTION(MYSQL_MAINTAINER_MODE - - INCLUDE(maintainer) - --IF(WITH_UNIT_TESTS) -+IF(0) #WITH_UNIT_TESTS) - ENABLE_TESTING() - ENDIF() - --IF(NOT WITHOUT_SERVER) -+IF(0) #NOT WITHOUT_SERVER) - SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") - SET (MYSQLD_STATIC_EMBEDDED_PLUGIN_LIBS "" CACHE INTERNAL "") - # Add storage engines and plugins. - CONFIGURE_PLUGINS() --ELSE() -- # We may still want Cluster client libraries, use -DWITH_NDBCLUSTER=1 -- ADD_SUBDIRECTORY(storage/ndb) - ENDIF() - - ADD_SUBDIRECTORY(include) -@@ -588,61 +492,18 @@ ADD_SUBDIRECTORY(libmysql) - ADD_SUBDIRECTORY(libbinlogevents) - ADD_SUBDIRECTORY(libbinlogstandalone) - --IF(WITH_UNIT_TESTS) -- # Visual Studio 11 needs this extra flag in order to compile gmock. -- IF(WIN32) -- ADD_DEFINITIONS( /D _VARIADIC_MAX=10 ) -- ENDIF() -- # libc++ doesn't have tuple in tr1 -- IF(HAVE_LLVM_LIBCPP) -- ADD_DEFINITIONS(-DGTEST_USE_OWN_TR1_TUPLE=1) -- ENDIF() - -- ADD_SUBDIRECTORY(unittest) -- ADD_SUBDIRECTORY(unittest/examples) -- ADD_SUBDIRECTORY(unittest/mytap) -- ADD_SUBDIRECTORY(unittest/mytap/t) -- IF(WITH_RAPID AND EXISTS ${CMAKE_SOURCE_DIR}/rapid/unittest/gunit) -- ADD_SUBDIRECTORY(rapid/unittest/gunit) -- ENDIF() --ENDIF() - -+SET(WITH_INNOBASE_STORAGE_ENGINE 0) - ADD_SUBDIRECTORY(extra) --ADD_SUBDIRECTORY(client) - ADD_SUBDIRECTORY(sql/share) --ADD_SUBDIRECTORY(libservices) -- --IF(UNIX) -- ADD_SUBDIRECTORY(man) --ENDIF() -- --IF(NOT WITHOUT_SERVER) -- ADD_SUBDIRECTORY(testclients) -- ADD_SUBDIRECTORY(sql) -- OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF) -- IF(WITH_EMBEDDED_SERVER) -- ADD_SUBDIRECTORY(libmysqld) -- ADD_SUBDIRECTORY(libmysqld/examples) -- ENDIF(WITH_EMBEDDED_SERVER) --ENDIF() -- --# scripts/mysql_config depends on client and server targets loaded above. --# It is referenced by some of the directories below, so we insert it here. - ADD_SUBDIRECTORY(scripts) -+ADD_SUBDIRECTORY(support-files) - --IF(NOT WITHOUT_SERVER) -- ADD_SUBDIRECTORY(mysql-test) -- ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess) -- ADD_SUBDIRECTORY(support-files) -- IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt) -- ADD_SUBDIRECTORY(internal) -- ENDIF() -- ADD_SUBDIRECTORY(packaging/rpm-oel) -- ADD_SUBDIRECTORY(packaging/rpm-fedora) -- ADD_SUBDIRECTORY(packaging/rpm-sles) -- ADD_SUBDIRECTORY(packaging/rpm-docker) -- ADD_SUBDIRECTORY(packaging/deb-in) --ENDIF() -+# -+# Directory where error message database is generated (GenError target) -+# -+FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/sql/share) - - INCLUDE(cmake/abi_check.cmake) - INCLUDE(cmake/tags.cmake) -@@ -680,11 +541,7 @@ ELSE() - SET(CPACK_GENERATOR "TGZ") - ENDIF() - ADD_SUBDIRECTORY(packaging/WiX) --ADD_SUBDIRECTORY(packaging/solaris) - --IF(UNIX) -- INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info) --ENDIF() - # - # RPM installs documentation directly from the source tree - # -diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt -index 3adf988..9e0ba30 100644 ---- a/extra/CMakeLists.txt -+++ b/extra/CMakeLists.txt -@@ -70,87 +70,4 @@ ADD_DEFINITIONS(-DMUTEX_EVENT) - COPY_OPENSSL_DLLS(copy_openssl_extra) - IF (WIN32 AND WITH_SSL_PATH AND HAVE_CRYPTO_DLL) - ADD_DEPENDENCIES(GenError copy_openssl_extra) --ENDIF() -- -- --MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) --TARGET_LINK_LIBRARIES(my_print_defaults mysys mysys_ssl) --SET_TARGET_PROPERTIES(my_print_defaults PROPERTIES LINKER_LANGUAGE CXX) -- --MYSQL_ADD_EXECUTABLE(perror perror.c) --ADD_DEPENDENCIES(perror GenError) --TARGET_LINK_LIBRARIES(perror mysys mysys_ssl) --SET_TARGET_PROPERTIES(perror PROPERTIES LINKER_LANGUAGE CXX) -- --MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) --TARGET_LINK_LIBRARIES(resolveip mysys mysys_ssl) --SET_TARGET_PROPERTIES(resolveip PROPERTIES LINKER_LANGUAGE CXX) --IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") -- INCLUDE(CheckFunctionExists) -- INCLUDE(CheckLibraryExists) -- MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL) -- TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL}) --ENDIF() -- -- --MYSQL_ADD_EXECUTABLE(replace replace.c) --TARGET_LINK_LIBRARIES(replace mysys) -- --MYSQL_ADD_EXECUTABLE(lz4_decompress lz4_decompress.cc) --TARGET_LINK_LIBRARIES(lz4_decompress ${LZ4_LIBRARY}) -- --MYSQL_ADD_EXECUTABLE(zlib_decompress zlib_decompress.cc) --TARGET_LINK_LIBRARIES(zlib_decompress ${ZLIB_LIBRARY}) -- --IF(WITH_INNOBASE_STORAGE_ENGINE) -- -- IF(LZ4_INCLUDE_DIR AND LZ4_LIBRARY) -- ADD_DEFINITIONS(-DHAVE_LZ4=1) -- INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR}) -- ENDIF() -- -- # Add path to the InnoDB headers -- INCLUDE_DIRECTORIES( -- ${CMAKE_SOURCE_DIR}/storage/innobase/include -- ${CMAKE_SOURCE_DIR}/sql -- ) -- # We use the InnoDB code directly in case the code changes. -- ADD_DEFINITIONS("-DUNIV_INNOCHECKSUM") -- SET(INNOBASE_SOURCES -- ../storage/innobase/buf/buf0checksum.cc -- ../storage/innobase/ut/ut0crc32.cc -- ../storage/innobase/ut/ut0ut.cc -- ../storage/innobase/buf/buf0buf.cc -- ../storage/innobase/page/page0zip.cc -- ../storage/innobase/os/os0file.cc -- ) -- -- # Avoid generating Hardware Capabilities due to crc32 instructions -- IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND -- CMAKE_SYSTEM_PROCESSOR MATCHES "i386") -- INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) -- MY_CHECK_CXX_COMPILER_FLAG("-Wa,-nH" HAVE_WA_NH) -- IF(HAVE_WA_NH) -- ADD_COMPILE_FLAGS( -- ../storage/innobase/ut/ut0crc32.cc -- COMPILE_FLAGS "-Wa,-nH" -- ) -- ENDIF() -- ENDIF() -- -- MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.cc ${INNOBASE_SOURCES}) -- TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY}) -- ADD_DEPENDENCIES(innochecksum GenError) --ENDIF() -- --IF(UNIX) -- MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.cc) -- TARGET_LINK_LIBRARIES(resolve_stack_dump mysys mysys_ssl) --ENDIF() -- --# In published release builds on Solaris, we need to bundle gcc source. --# PB2 will take care of putting it in extra/ when needed --IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gcc-4.8.1.tar.bz2) -- INSTALL(FILES gcc-4.8.1.tar.bz2 -- DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Development) --ENDIF() -+ENDIF() -\ No newline at end of file -diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h -index 8b7a554..4353037 100644 ---- a/mysys/mysys_priv.h -+++ b/mysys/mysys_priv.h -@@ -18,6 +18,7 @@ - - #include "my_global.h" - #include "mysql/psi/mysql_thread.h" -+#include "my_sys.h" - - #ifdef HAVE_PSI_INTERFACE - diff --git a/ports/libmysql/CONTROL b/ports/libmysql/CONTROL index 504f14bbb..906249936 100644 --- a/ports/libmysql/CONTROL +++ b/ports/libmysql/CONTROL @@ -1,3 +1,3 @@ -Source: libmysql -Version: 5.7.16 +Source: libmysql
+Version: 5.7.17-1
Description: A MySQL client library for C development.
\ No newline at end of file diff --git a/ports/libmysql/boost_and_build.patch b/ports/libmysql/boost_and_build.patch new file mode 100644 index 000000000..7fce8ffc5 --- /dev/null +++ b/ports/libmysql/boost_and_build.patch @@ -0,0 +1,44 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 44842d3..e34ab24 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -452,7 +452,7 @@ ELSE() + SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") + ENDIF() + +-INCLUDE(cmake/boost.cmake) ++#INCLUDE(cmake/boost.cmake) + + IF (CMAKE_SYSTEM_NAME MATCHES "Linux") + OPTION(WITH_SYSTEMD "Enable installation of systemd support files" OFF) +diff --git a/client/dump/CMakeLists.txt b/client/dump/CMakeLists.txt +index bae2ce7..4e11516 100644 +--- a/client/dump/CMakeLists.txt ++++ b/client/dump/CMakeLists.txt +@@ -21,12 +21,12 @@ INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/dump + ) + +-IF (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") ++#IF (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") + IF (WITHOUT_SERVER) + MESSAGE(STATUS "Not building mysqlpump") + RETURN() + ENDIF() +-ENDIF() ++#ENDIF() + + # Prevent Boost from including external precompiled Boost libraries, use + # threading (not implemented for older Solaris Studio compilers) +diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h +index 8b7a554..4353037 100644 +--- a/mysys/mysys_priv.h ++++ b/mysys/mysys_priv.h +@@ -18,6 +18,7 @@ + + #include "my_global.h" + #include "mysql/psi/mysql_thread.h" ++#include "my_sys.h" + + #ifdef HAVE_PSI_INTERFACE + diff --git a/ports/libmysql/portfile.cmake b/ports/libmysql/portfile.cmake index 48412ccc7..530732b71 100644 --- a/ports/libmysql/portfile.cmake +++ b/ports/libmysql/portfile.cmake @@ -1,70 +1,87 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mysql-server-mysql-5.7.16) - -if (EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql.h") - message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.") -endif() - -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/mysql/mysql-server/archive/mysql-5.7.16.tar.gz" - FILENAME "mysql-server-mysql-5.7.16.tar.gz" - SHA512 30a3c55ebb15f18ededf814b66c108f18b2ced9c39e08319cdc9559ccf38d494ad9322098f2b04418ddf557e46d9d727be0e514be0ae982ac4f5186aa295b9c6 -) -vcpkg_extract_source_archive(${ARCHIVE}) - -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch -) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} -) - -vcpkg_install_cmake() - -# delete debug headers -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/debug/include) - -# delete useless vcruntime/scripts/bin/msg file -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/debug/share - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin - ${CURRENT_PACKAGES_DIR}/lib/debug) - -file(MAKE_DIRECTORY - ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin) - -# remove misc files -file(REMOVE - ${CURRENT_PACKAGES_DIR}/COPYING - ${CURRENT_PACKAGES_DIR}/my-default.ini - ${CURRENT_PACKAGES_DIR}/README - ${CURRENT_PACKAGES_DIR}/debug/COPYING - ${CURRENT_PACKAGES_DIR}/debug/my-default.ini - ${CURRENT_PACKAGES_DIR}/debug/README) - -# remove mysqlclient.lib -file(REMOVE - ${CURRENT_PACKAGES_DIR}/lib/mysqlclient.lib - ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlclient.lib) - -# correct the dll directory -file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/bin/libmysql.dll) -file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.dll) -file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/bin/libmysql.pdb) -file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.pdb) - -# copy license -file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmysql) +if (EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql/mysql.h")
+ message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.")
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mysql-server-mysql-5.7.17)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/mysql/mysql-server/archive/mysql-5.7.17.tar.gz"
+ FILENAME "mysql-server-mysql-5.7.17.tar.gz"
+ SHA512 511027f28f0705f59a08ec369b1ebe5d9a77eb839d545898631f1ebbcb6b4b800f5b88511d3ae5d231c04e09a2d7b2b2d178264d36aeb2bc602cc1b0b248cfba
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/boost_and_build.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DWITHOUT_SERVER=ON
+ -DWITH_UNIT_TESTS=OFF
+ -DENABLED_PROFILING=OFF
+ -DWIX_DIR=OFF
+)
+
+vcpkg_install_cmake()
+
+# delete debug headers
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# switch mysql into /mysql
+file(RENAME ${CURRENT_PACKAGES_DIR}/include ${CURRENT_PACKAGES_DIR}/include2)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include)
+file(RENAME ${CURRENT_PACKAGES_DIR}/include2 ${CURRENT_PACKAGES_DIR}/include/mysql)
+
+## delete useless vcruntime/scripts/bin/msg file
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/share
+ ${CURRENT_PACKAGES_DIR}/debug/share
+ ${CURRENT_PACKAGES_DIR}/bin
+ ${CURRENT_PACKAGES_DIR}/debug/bin
+ ${CURRENT_PACKAGES_DIR}/docs
+ ${CURRENT_PACKAGES_DIR}/debug/docs
+ ${CURRENT_PACKAGES_DIR}/lib/debug)
+
+# remove misc files
+file(REMOVE
+ ${CURRENT_PACKAGES_DIR}/COPYING
+ ${CURRENT_PACKAGES_DIR}/README
+ ${CURRENT_PACKAGES_DIR}/debug/COPYING
+ ${CURRENT_PACKAGES_DIR}/debug/README)
+
+# remove not-related libs
+file (REMOVE
+ ${CURRENT_PACKAGES_DIR}/lib/mysqlservices.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlservices.lib)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ file(REMOVE
+ ${CURRENT_PACKAGES_DIR}/lib/libmysql.lib
+ ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll
+ ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb
+ ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll
+ ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb)
+else()
+ file(REMOVE
+ ${CURRENT_PACKAGES_DIR}/lib/mysqlclient.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlclient.lib)
+
+ # correct the dll directory
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/bin/libmysql.dll)
+ file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/bin/libmysql.pdb)
+ file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.dll)
+ file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.pdb)
+endif()
+
+# copy license
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmysql)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libmysql/COPYING ${CURRENT_PACKAGES_DIR}/share/libmysql/copyright)
\ No newline at end of file diff --git a/ports/libnice/CMakeLists.txt b/ports/libnice/CMakeLists.txt new file mode 100644 index 000000000..c631d3317 --- /dev/null +++ b/ports/libnice/CMakeLists.txt @@ -0,0 +1,139 @@ +cmake_minimum_required(VERSION 3.0) +project(libnice C) +SET (this_target libnice) + +add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) + +configure_file(${CMAKE_SOURCE_DIR}/win32/vs9/config.h ${CMAKE_SOURCE_DIR}/config.h COPYONLY) +configure_file(${CMAKE_SOURCE_DIR}/win32/vs9/libnice.def ${CMAKE_SOURCE_DIR}/libnice.def COPYONLY) + +find_path(GLIB_INCLUDE_DIR glib.h) +find_library(GLIB_LIBRARY glib-2.0) +find_library(GOBJECT_LIBRARY gobject-2.0) +find_library(GIO_LIBRARY gio-2.0) +find_library(IPHLPAPI_LIBRARY iphlpapi) +find_library(WS2_32_LIB ws2_32) +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/agent + ${CMAKE_CURRENT_SOURCE_DIR}/random + ${CMAKE_CURRENT_SOURCE_DIR}/socket + ${CMAKE_CURRENT_SOURCE_DIR}/stun + ${GLIB_INCLUDE_DIR}) + + +SET (SRCS + ./agent/address.c + ./agent/agent.c + ./agent/candidate.c + ./agent/component.c + ./agent/conncheck.c + ./agent/debug.c + ./agent/discovery.c + ./agent/discovery.c + ./agent/inputstream.c + ./agent/interfaces.c + ./agent/iostream.c + ./agent/outputstream.c + ./agent/pseudotcp.c + ./agent/stream.c + ./random/random.c + ./random/random-glib.c + ./socket/http.c + ./socket/pseudossl.c + ./socket/socket.c + ./socket/socks5.c + ./socket/tcp-active.c + ./socket/tcp-bsd.c + ./socket/tcp-passive.c + ./socket/udp-bsd.c + ./socket/udp-turn.c + ./socket/udp-turn-over-tcp.c + ./stun/debug.c + ./stun/md5.c + ./stun/rand.c + ./stun/sha1.c + ./stun/stun5389.c + ./stun/stunagent.c + ./stun/stuncrc32.c + ./stun/stunhmac.c + ./stun/stunmessage.c + ./stun/usages/bind.c + ./stun/usages/ice.c + ./stun/usages/timer.c + ./stun/usages/turn.c + ./stun/utils.c + ./libnice.def + ) +SET(HEADERS + ./config.h + ./agent/address.h + ./agent/agent.h + ./agent/agent-priv.h + ./agent/candidate.h + ./agent/component.h + ./agent/conncheck.h + ./agent/debug.h + ./agent/discovery.h + ./agent/discovery.h + ./agent/inputstream.h + ./agent/interfaces.h + ./agent/iostream.h + ./agent/outputstream.h + ./agent/pseudotcp.h + ./agent/stream.h + ./random/random.h + ./random/random-glib.h + ./socket/http.h + ./socket/pseudossl.h + ./socket/socket.h + ./socket/socks5.h + ./socket/tcp-active.h + ./socket/tcp-bsd.h + ./socket/tcp-passive.h + ./socket/udp-bsd.h + ./socket/udp-turn.h + ./socket/udp-turn-over-tcp.h + ./stun/constants.h + ./stun/debug.h + ./stun/md5.h + ./stun/rand.h + ./stun/sha1.h + ./stun/stun5389.h + ./stun/stunagent.h + ./stun/stuncrc32.h + ./stun/stunhmac.h + ./stun/stunmessage.h + ./stun/usages/bind.h + ./stun/usages/ice.h + ./stun/usages/timer.h + ./stun/usages/turn.h + ./stun/utils.h + ./stun/win32_common.h + ) +add_library(libnice ${SRCS} ${HEADERS}) +set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4244 /wd4005 /wd4391 /wd4142 /wd4267") +target_link_libraries(libnice ${IPHLPAPI_LIBRARY} ${WS2_32_LIB} ${GLIB_LIBRARY} ${GOBJECT_LIBRARY} ${GIO_LIBRARY}) +install(TARGETS libnice +RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +if (${CMAKE_BUILD_TYPE} STREQUAL "Release") +install(FILES agent/address.h DESTINATION include/nice) +install(FILES agent/agent.h DESTINATION include/nice) +install(FILES agent/candidate.h DESTINATION include/nice) +install(FILES agent/debug.h DESTINATION include/nice) +install(FILES agent/interfaces.h DESTINATION include/nice) +install(FILES nice/nice.h DESTINATION include/nice) +install(FILES agent/pseudotcp.h DESTINATION include/nice) +install(FILES stun/constants.h DESTINATION include/stun) +install(FILES stun/debug.h DESTINATION include/stun) +install(FILES stun/stunagent.h DESTINATION include/stun) +install(FILES stun/stunmessage.h DESTINATION include/stun) +install(FILES stun/usages/bind.h DESTINATION include/stun/usages) +install(FILES stun/usages/ice.h DESTINATION include/stun/usages) +install(FILES stun/usages/timer.h DESTINATION include/stun/usages) +install(FILES stun/usages/turn.h DESTINATION include/stun/usages) +install(FILES stun/win32_common.h DESTINATION include/stun) +endif()
\ No newline at end of file diff --git a/ports/libnice/CONTROL b/ports/libnice/CONTROL new file mode 100644 index 000000000..7d16f4262 --- /dev/null +++ b/ports/libnice/CONTROL @@ -0,0 +1,4 @@ +Source: libnice +Version: 0.1.13 +Description: Libnice is an implementation of the IETF's Interactive Connectivity Establishment (ICE) standard (RFC 5245) and the Session Traversal Utilities for NAT (STUN) standard (RFC 5389). +Build-Depends: glib
\ No newline at end of file diff --git a/ports/libnice/portfile.cmake b/ports/libnice/portfile.cmake new file mode 100644 index 000000000..4d4a97bae --- /dev/null +++ b/ports/libnice/portfile.cmake @@ -0,0 +1,27 @@ +include(vcpkg_common_functions) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libnice-0.1.13) + +vcpkg_download_distfile(ARCHIVE + URLS "https://nice.freedesktop.org/releases/libnice-0.1.13.tar.gz" + FILENAME "libnice-0.1.13.tar.gz" + SHA512 c9bb81e8cd0b4e3673dba07ce08a16dd8821831339b44f1006510cdc09f9ae4c6eb7d43230711a2509867acb8d7df71821c411830dbf71c5a5d7e802f14a32c1 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_RELEASE -DOPTIMIZE=1 + OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(COPY ${SOURCE_PATH}/COPYING.LGPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(COPY ${SOURCE_PATH}/COPYING.MPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libnice/COPYING ${CURRENT_PACKAGES_DIR}/share/libnice/copyright) diff --git a/ports/libpng/CONTROL b/ports/libpng/CONTROL index 239fa0cb2..2d111607e 100644 --- a/ports/libpng/CONTROL +++ b/ports/libpng/CONTROL @@ -1,4 +1,4 @@ Source: libpng -Version: 1.6.24-1 +Version: 1.6.28 Build-Depends: zlib -Description: libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files.
\ No newline at end of file +Description: libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files. diff --git a/ports/libpng/portfile.cmake b/ports/libpng/portfile.cmake index f7be6cca1..759601e51 100644 --- a/ports/libpng/portfile.cmake +++ b/ports/libpng/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libpng-1.6.24) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libpng-1.6.28) vcpkg_download_distfile(ARCHIVE - URLS "http://download.sourceforge.net/libpng/libpng-1.6.24.tar.xz" - FILENAME "libpng-1.6.24.tar.xz" - SHA512 7eccb90f530a9c728e280b2b1776304a808b5deea559632e7bcf4ea219c7cb5e453aa810215465304501127595000717d4b7c5b26a9f8e22e236ec04af53a90f + URLS "https://downloads.sourceforge.net/project/libpng/libpng16/1.6.28/libpng-1.6.28.tar.xz" + FILENAME "libpng-1.6.28.tar.xz" + SHA512 3541139062a1c6cded7abe378ae73519835ec68561006ba33b3fe34f65676e4f91f2561b11d890ac20255dbf2e691e0b3d4fbf11db77b47b67979ba45b8af655 ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( diff --git a/ports/libraw/CONTROL b/ports/libraw/CONTROL index b10e10794..9bb52aae0 100644 --- a/ports/libraw/CONTROL +++ b/ports/libraw/CONTROL @@ -1,4 +1,4 @@ Source: libraw -Version: 0.17.2-2 +Version: 0.18.0-1 Build-Depends: libjpeg-turbo Description: raw image decoder library diff --git a/ports/libraw/portfile.cmake b/ports/libraw/portfile.cmake index 159251c28..2e25ec714 100644 --- a/ports/libraw/portfile.cmake +++ b/ports/libraw/portfile.cmake @@ -1,9 +1,9 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LibRaw-0.17.2) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LibRaw-0.18.0) vcpkg_download_distfile(ARCHIVE - URLS "http://www.libraw.org/data/LibRaw-0.17.2.zip" - FILENAME "LibRaw-0.17.2" - SHA512 97d34c84dafdcad300d607fbd4df7b120aea1ecdbc2783a8616bc423fa6a7a15adfbeb975f8dab021be09d08ef466c401a3b65bfd1abcfa49d31d4ab91873e60 + URLS "http://www.libraw.org/data/LibRaw-0.18.0.zip" + FILENAME "LibRaw-0.18.0.zip" + SHA512 c66ae2331caffe18c2835d76d6106052125fab2f549a6f06687b4c1fedaae1c46ee0e4ae4c23b0480976870d76e8cfdbb91dd3cf11e3433ccc070bf03c538bb1 ) set(LIBRAW_CMAKE_COMMIT "a71f3b83ee3dccd7be32f9a2f410df4d9bdbde0a") set(LIBRAW_CMAKE_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LibRaw-cmake-${LIBRAW_CMAKE_COMMIT}) diff --git a/ports/libsigcpp/CMakeLists.txt b/ports/libsigcpp/CMakeLists.txt new file mode 100644 index 000000000..7a669a24e --- /dev/null +++ b/ports/libsigcpp/CMakeLists.txt @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.0) +project(libsigc++) + +set(SIGCPP_API_VERSION 2.0) + +add_definitions(-DSIGC_BUILD) + +include_directories(./MSVC_Net2013) # config file for windows is there +include_directories(.) + +set(SICGPP_SOURCES + sigc++/connection.cc + sigc++/signal_base.cc + sigc++/trackable.cc + sigc++/adaptors/lambda/lambda.cc + sigc++/functors/slot_base.cc) + +add_library(sigc ${SICGPP_SOURCES}) +set_target_properties(sigc PROPERTIES OUTPUT_NAME sigc-${SIGCPP_API_VERSION}) +install(TARGETS sigc RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) + +if(NOT SIGCPP_SKIP_HEADERS) + install(FILES MSVC_Net2013/sigc++config.h DESTINATION include) + install(FILES sigc++/sigc++.h DESTINATION include/sigc++) + install(FILES sigc++/bind.h DESTINATION include/sigc++) + install(FILES sigc++/bind_return.h DESTINATION include/sigc++) + install(FILES sigc++/connection.h DESTINATION include/sigc++) + install(FILES sigc++/limit_reference.h DESTINATION include/sigc++) + install(FILES sigc++/reference_wrapper.h DESTINATION include/sigc++) + install(FILES sigc++/retype_return.h DESTINATION include/sigc++) + install(FILES sigc++/signal.h DESTINATION include/sigc++) + install(FILES sigc++/signal_base.h DESTINATION include/sigc++) + install(FILES sigc++/slot.h DESTINATION include/sigc++) + install(FILES sigc++/trackable.h DESTINATION include/sigc++) + install(FILES sigc++/type_traits.h DESTINATION include/sigc++) + install(FILES sigc++/visit_each.h DESTINATION include/sigc++) + install(FILES sigc++/adaptors/adaptors.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/adaptor_trait.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/bind.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/bind_return.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/bound_argument.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/compose.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/deduce_result_type.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/exception_catch.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/hide.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/retype.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/retype_return.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/track_obj.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/lambda/base.h DESTINATION include/sigc++/adaptors/lambda) + install(FILES sigc++/adaptors/lambda/select.h DESTINATION include/sigc++/adaptors/lambda) + install(FILES sigc++/functors/functors.h DESTINATION include/sigc++/functors) + install(FILES sigc++/functors/functor_trait.h DESTINATION include/sigc++/functors) + install(FILES sigc++/functors/mem_fun.h DESTINATION include/sigc++/functors) + install(FILES sigc++/functors/ptr_fun.h DESTINATION include/sigc++/functors) + install(FILES sigc++/functors/slot.h DESTINATION include/sigc++/functors) + install(FILES sigc++/functors/slot_base.h DESTINATION include/sigc++/functors) +endif() diff --git a/ports/libsigcpp/CONTROL b/ports/libsigcpp/CONTROL new file mode 100644 index 000000000..02b2e4b83 --- /dev/null +++ b/ports/libsigcpp/CONTROL @@ -0,0 +1,3 @@ +Source: libsigcpp
+Version: 2.10
+Description: Typesafe callback framework for C++
diff --git a/ports/libsigcpp/dont-import-symbols.patch b/ports/libsigcpp/dont-import-symbols.patch new file mode 100644 index 000000000..b031d3baf --- /dev/null +++ b/ports/libsigcpp/dont-import-symbols.patch @@ -0,0 +1,13 @@ +diff --git a/sigc++config.h b/sigc++config.h +index e212700..8d7366e 100644 +--- a/sigc++config.h ++++ b/sigc++config.h +@@ -72,6 +72,8 @@ + + #endif /* !SIGC_MSC */ + ++#undef SIGC_DLL ++ + #ifdef SIGC_DLL + # if defined(SIGC_BUILD) && defined(_WINDLL) + # define SIGC_API __declspec(dllexport) diff --git a/ports/libsigcpp/portfile.cmake b/ports/libsigcpp/portfile.cmake new file mode 100644 index 000000000..c98a26717 --- /dev/null +++ b/ports/libsigcpp/portfile.cmake @@ -0,0 +1,28 @@ +
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libsigc++-2.10.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.10/libsigc++-2.10.0.tar.xz"
+ FILENAME "libsigc++-2.10.0.tar.xz"
+ SHA512 5b96df21d6bd6ba41520c7219e77695a86aabc60b7259262c7a9f4b8475ce0e2fd8dc37bcf7c17e24e818ff28c262d682b964c83e215b51bdbe000f3f58794ae)
+
+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
+ -DSIGCPP_SKIP_HEADERS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/dont-import-symbols.patch)
+endif()
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libsigcpp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libsigcpp/COPYING ${CURRENT_PACKAGES_DIR}/share/libsigcpp/copyright)
diff --git a/ports/libssh2/0001-Fix-UWP.patch b/ports/libssh2/0001-Fix-UWP.patch new file mode 100644 index 000000000..270dd7b90 --- /dev/null +++ b/ports/libssh2/0001-Fix-UWP.patch @@ -0,0 +1,48 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 6401acf..64de3e9 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -349,7 +349,7 @@ target_include_directories(libssh2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + # Check for the OS. + # Daniel's note: this should not be necessary and we need to work to + # get this removed. +-if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") ++if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows" OR ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore") + target_compile_definitions(libssh2 PRIVATE LIBSSH2_WIN32) + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + target_compile_definitions(libssh2 PRIVATE LIBSSH2_DARWIN) +diff --git a/src/agent.c b/src/agent.c +index c2ba422..f1799f8 100644 +--- a/src/agent.c ++++ b/src/agent.c +@@ -51,6 +51,10 @@ + #include "userauth.h" + #include "session.h" + ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) ++#define IS_UWP 1 ++#endif /* #if defined(WINAPI_FAMILY) */ ++ + /* Requests from client to agent for protocol 1 key operations */ + #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 + #define SSH_AGENTC_RSA_CHALLENGE 3 +@@ -254,7 +258,7 @@ struct agent_ops agent_ops_unix = { + }; + #endif /* PF_UNIX */ + +-#ifdef WIN32 ++#if defined(WIN32) && !defined(IS_UWP) + /* Code to talk to Pageant was taken from PuTTY. + * + * Portions copyright Robert de Bath, Joris van Rantwijk, Delian +@@ -362,8 +366,8 @@ static struct { + const char *name; + struct agent_ops *ops; + } supported_backends[] = { +-#ifdef WIN32 +- {"Pageant", &agent_ops_pageant}, ++#if defined(WIN32) && !defined(IS_UWP) ++ {"Pageant", &agent_ops_pageant}, + #endif /* WIN32 */ + #ifdef PF_UNIX + {"Unix", &agent_ops_unix}, diff --git a/ports/libssh2/CONTROL b/ports/libssh2/CONTROL index d66030b71..715ffa0bd 100644 --- a/ports/libssh2/CONTROL +++ b/ports/libssh2/CONTROL @@ -1,4 +1,4 @@ Source: libssh2 -Version: 1.8.0 +Version: 1.8.0-1 Build-Depends: zlib, openssl Description: The SSH library
\ No newline at end of file diff --git a/ports/libssh2/portfile.cmake b/ports/libssh2/portfile.cmake index 9b4cc77dd..2e3ee5009 100644 --- a/ports/libssh2/portfile.cmake +++ b/ports/libssh2/portfile.cmake @@ -7,6 +7,10 @@ vcpkg_download_distfile(ARCHIVE_FILE ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-UWP.patch +) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS diff --git a/ports/libuv/portfile.cmake b/ports/libuv/portfile.cmake index 173d3bcdc..fbc71854e 100644 --- a/ports/libuv/portfile.cmake +++ b/ports/libuv/portfile.cmake @@ -16,8 +16,11 @@ if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src) ) endif() -vcpkg_find_acquire_program(PYTHON2) +find_program(GIT git) +get_filename_component(GIT_EXE_PATH ${GIT} DIRECTORY) +set(ENV{PATH} "$ENV{PATH};${GIT_EXE_PATH}") +vcpkg_find_acquire_program(PYTHON2) set(ENV{PYTHON} ${PYTHON2}) set(ENV{GYP_MSVS_VERSION} 2015) diff --git a/ports/libvorbis/0002-Allow-deprecated-functions.patch b/ports/libvorbis/0002-Allow-deprecated-functions.patch new file mode 100644 index 000000000..ea1d07e39 --- /dev/null +++ b/ports/libvorbis/0002-Allow-deprecated-functions.patch @@ -0,0 +1,14 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 2043294..e273393 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -61,6 +61,9 @@ if(MSVC) + list(APPEND VORBIS_SOURCES ../win32/vorbis.def) + list(APPEND VORBISENC_SOURCES ../win32/vorbisenc.def) + list(APPEND VORBISFILE_SOURCES ../win32/vorbisfile.def) ++ add_definitions(-D_CRT_SECURE_NO_WARNINGS) ++ add_definitions(-D_CRT_SECURE_NO_DEPRECATE) ++ add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) + endif() + + include_directories(../include) diff --git a/ports/libvorbis/CONTROL b/ports/libvorbis/CONTROL index 76181b9e8..db9b1f530 100644 --- a/ports/libvorbis/CONTROL +++ b/ports/libvorbis/CONTROL @@ -1,4 +1,4 @@ Source: libvorbis -Version: +Version: 1.3.5-1-143caf4023a90c09a5eb685fdd46fb9b9c36b1ee Description: Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format. Build-Depends: libogg diff --git a/ports/libvorbis/portfile.cmake b/ports/libvorbis/portfile.cmake index 66bfca07c..757196caf 100644 --- a/ports/libvorbis/portfile.cmake +++ b/ports/libvorbis/portfile.cmake @@ -33,13 +33,12 @@ if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") WORKING_DIRECTORY ${DOWNLOADS}/vorbis.git LOGNAME worktree ) - message(STATUS "Patching") - vcpkg_execute_required_process( - COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/0001-Add-vorbisenc.c-to-vorbis-library.patch --ignore-whitespace --whitespace=fix - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src - LOGNAME patch - ) endif() +vcpkg_apply_patches(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0001-Add-vorbisenc.c-to-vorbis-library.patch + ${CMAKE_CURRENT_LIST_DIR}/0002-Allow-deprecated-functions.patch +) file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include" OGG_INCLUDE) file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/ogg.lib" OGG_LIB_REL) diff --git a/ports/libwebsockets/0001-Fix-UWP.patch b/ports/libwebsockets/0001-Fix-UWP.patch new file mode 100644 index 000000000..8996c4e0e --- /dev/null +++ b/ports/libwebsockets/0001-Fix-UWP.patch @@ -0,0 +1,91 @@ +diff --git a/lib/lws-plat-win.c b/lib/lws-plat-win.c +index dd3e95a..eb1690a 100644 +--- a/lib/lws-plat-win.c ++++ b/lib/lws-plat-win.c +@@ -155,7 +155,7 @@ lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi) + { + struct lws_context_per_thread *pt = &context->pt[tsi]; + WSANETWORKEVENTS networkevents; +- struct lws_pollfd *pfd; ++ struct lws_pollfd *pfd = NULL; + struct lws *wsi; + unsigned int i; + DWORD ev; +@@ -493,6 +493,7 @@ lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt) + return ok ? dst : NULL; + } + ++#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) + static lws_filefd_type + _lws_plat_file_open(struct lws *wsi, const char *filename, + unsigned long *filelen, int flags) +@@ -516,6 +517,35 @@ _lws_plat_file_open(struct lws *wsi, const char *filename, + + return ret; + } ++#else ++static lws_filefd_type ++_lws_plat_file_open(struct lws *wsi, const char *filename, ++ unsigned long *filelen, int flags) ++{ ++ HANDLE ret; ++ WCHAR buf[MAX_PATH]; ++ ++ (void)wsi; ++ MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf)); ++ if ((flags & 7) == _O_RDONLY) { ++ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL); ++ } ++ else { ++ lwsl_err("%s: open for write not implemented\n", __func__); ++ *filelen = 0; ++ return LWS_INVALID_FILE; ++ } ++ ++ if (ret != LWS_INVALID_FILE) ++ { ++ struct stat info; ++ int result = stat(filename, &info); ++ *filelen = result != 0 ? -1 : (long)(info.st_size); ++ } ++ ++ return ret; ++} ++#endif + + static int + _lws_plat_file_close(struct lws *wsi, lws_filefd_type fd) +diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h +index 23f8f4d..bc32aef 100644 +--- a/lib/private-libwebsockets.h ++++ b/lib/private-libwebsockets.h +@@ -48,12 +48,25 @@ + #endif + + #if defined(WIN32) || defined(_WIN32) ++ ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) ++ #ifndef WINVER ++ #define WINVER 0x0602 ++ #define _WIN32_WINNT WINVER ++ #endif ++ ++ #define getenv(x) NULL ++ #define _WINSOCK_DEPRECATED_NO_WARNINGS ++#else ++ + #if (WINVER < 0x0501) +-#undef WINVER +-#undef _WIN32_WINNT +-#define WINVER 0x0501 +-#define _WIN32_WINNT WINVER ++ #undef WINVER ++ #undef _WIN32_WINNT ++ #define WINVER 0x0501 ++ #define _WIN32_WINNT WINVER ++ #endif + #endif ++ + #define LWS_NO_DAEMONIZE + #define LWS_ERRNO WSAGetLastError() + #define LWS_EAGAIN WSAEWOULDBLOCK diff --git a/ports/libwebsockets/CONTROL b/ports/libwebsockets/CONTROL index 866c0ccbc..61a9cc449 100644 --- a/ports/libwebsockets/CONTROL +++ b/ports/libwebsockets/CONTROL @@ -1,4 +1,4 @@ Source: libwebsockets -Version: 2.0.0 +Version: 2.0.0-1 Build-Depends: zlib, openssl Description: Libwebsockets is a lightweight pure C library built to use minimal CPU and memory resources, and provide fast throughput in both directions as client or server.
\ No newline at end of file diff --git a/ports/libwebsockets/portfile.cmake b/ports/libwebsockets/portfile.cmake index 27088bf87..43502a52a 100644 --- a/ports/libwebsockets/portfile.cmake +++ b/ports/libwebsockets/portfile.cmake @@ -11,6 +11,12 @@ vcpkg_download_distfile(ARCHIVE ) vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-UWP.patch +) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS diff --git a/ports/lmdb/CONTROL b/ports/lmdb/CONTROL new file mode 100644 index 000000000..13c648fa6 --- /dev/null +++ b/ports/lmdb/CONTROL @@ -0,0 +1,3 @@ +Source: lmdb +Version: 0.9.18-2 +Description: LMDB is an extraordinarily fast, memory-efficient database
\ No newline at end of file diff --git a/ports/lmdb/cmake/CMakeLists.txt b/ports/lmdb/cmake/CMakeLists.txt new file mode 100644 index 000000000..6f63384ea --- /dev/null +++ b/ports/lmdb/cmake/CMakeLists.txt @@ -0,0 +1,80 @@ +cmake_minimum_required(VERSION 2.8) + +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/lmdb.h" VERSION_HEADER) +string(REGEX MATCH ".*MDB_VERSION_MAJOR[ \t]+([0-9])" MAJOR_VERSION_MATCH "${VERSION_HEADER}") +set(LMDB_MAJOR_VERSION ${CMAKE_MATCH_1}) +string(REGEX MATCH ".*MDB_VERSION_MINOR[ \t]+([0-9])" MINOR_VERSION_MATCH "${VERSION_HEADER}") +set(LMDB_MINOR_VERSION ${CMAKE_MATCH_1}) +string(REGEX MATCH ".*MDB_VERSION_PATCH[ \t]+([0-9]+)" PATCH_VERSION_MATCH "${VERSION_HEADER}") +set(LMDB_PATCH_VERSION ${CMAKE_MATCH_1}) + +set(LMDB_VERSION "${LMDB_MAJOR_VERSION}.${LMDB_MINOR_VERSION}.${LMDB_PATCH_VERSION}") + +project(lmdb) + +option(LMDB_BUILD_TOOLS "Build lmdb tools" OFF) +option(LMDB_BUILD_TESTS "Build lmdb tests" OFF) +option(LMDB_INSTALL_HEADERS "Install LMDB header files" ON) +set(LMDB_INCLUDE_INSTALL_DIR include CACHE PATH "Install directory for headers") +set(LMDB_LIBRARY_INSTALL_DIR lib CACHE PATH "Install directory for library") +set(LMDB_RUNTIME_INSTALL_DIR bin CACHE PATH "Install directory for binaries/dlls") +set(LMDB_CONFIG_INSTALL_DIR share/lmdb CACHE PATH "Install directory for cmake config files") + + +if(BUILD_SHARED_LIBS) +set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEF:${CMAKE_CURRENT_SOURCE_DIR}/lmdbd.def") +set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEF:${CMAKE_CURRENT_SOURCE_DIR}/lmdb.def") +endif() + +set(SRCS lmdb mdb.c lmdb.h midl.c midl.h ) +add_library(lmdb ${SRCS}) +set_target_properties(lmdb PROPERTIES DEBUG_POSTFIX d) +target_link_libraries(lmdb PRIVATE ntdll.lib) + +install(TARGETS lmdb DESTINATION lib + EXPORT lmdb-targets + RUNTIME DESTINATION ${LMDB_RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${LMDB_LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${LMDB_LIBRARY_INSTALL_DIR} + ) + +if(LMDB_INSTALL_HEADERS) + install(FILES lmdb.h midl.h DESTINATION ${LMDB_INCLUDE_INSTALL_DIR}) +endif() + +include(CMakePackageConfigHelpers) + +set(INSTALL_INCLUDE_DIR ${LMDB_INCLUDE_INSTALL_DIR}) +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/package-config.cmakein ${CMAKE_CURRENT_BINARY_DIR}/lmdb-config.cmake + INSTALL_DESTINATION ${LMDB_CONFIG_INSTALL_DIR} + PATH_VARS INSTALL_INCLUDE_DIR + ) + +write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/lmdb-config-version.cmake VERSION ${LMDB_VERSION} COMPATIBILITY SameMajorVersion ) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lmdb-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/lmdb-config-version.cmake + DESTINATION ${LMDB_CONFIG_INSTALL_DIR} ) + + +install(EXPORT lmdb-targets DESTINATION ${LMDB_CONFIG_INSTALL_DIR}) + +if(LMDB_BUILD_TOOLS) + # don't build mdb_dump/load/stat since they will + # not build on windows + foreach(_tool mdb_copy) + add_executable(${_tool} ${_tool}.c) + target_link_libraries(${_tool} lmdb) + endforeach() +endif() + +if(LMDB_BUILD_TESTS) + enable_testing() + # don't use mtest6 since it will only build in static + # build + foreach(_test mtest mtest2 mtest3 mtest4 mtest5) + add_executable(${_test} ${_test}.c) + target_link_libraries(${_test} lmdb) + add_test(NAME ${_test} + COMMAND ${CMAKE_COMMAND} -DTEST=$<TARGET_FILE:"${_test}" -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/runtest.cmake) + endforeach() +endif() diff --git a/ports/lmdb/cmake/cmake/package-config.cmakein b/ports/lmdb/cmake/cmake/package-config.cmakein new file mode 100644 index 000000000..1bc3ab859 --- /dev/null +++ b/ports/lmdb/cmake/cmake/package-config.cmakein @@ -0,0 +1,13 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/lmdb-targets.cmake") + +set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR @PACKAGE_INSTALL_INCLUDE_DIR@) +set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS @PACKAGE_INSTALL_INCLUDE_DIR@) +set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES lmdb) + +string(TOUPPER "${CMAKE_FIND_PACKAGE_NAME}" UPPER_PACKAGE_NAME) + +set(${UPPER_PACKAGE_NAME}_INCLUDE_DIR @PACKAGE_INSTALL_INCLUDE_DIR@) +set(${UPPER_PACKAGE_NAME}_INCLUDE_DIRS @PACKAGE_INSTALL_INCLUDE_DIR@) +set(${UPPER_PACKAGE_NAME}_LIBRARIES lmdb) diff --git a/ports/lmdb/cmake/cmake/runtest.cmake b/ports/lmdb/cmake/cmake/runtest.cmake new file mode 100644 index 000000000..c67b095ad --- /dev/null +++ b/ports/lmdb/cmake/cmake/runtest.cmake @@ -0,0 +1,3 @@ +file(MAKE_DIRECTORY testb) +execute_process(COMMAND ${TEST}) +file(REMOVE_RECURSE testdb)
\ No newline at end of file diff --git a/ports/lmdb/cmake/lmdb.def b/ports/lmdb/cmake/lmdb.def new file mode 100644 index 000000000..275658c36 --- /dev/null +++ b/ports/lmdb/cmake/lmdb.def @@ -0,0 +1,58 @@ +LIBRARY lmdb +EXPORTS + mdb_version + mdb_strerror + mdb_env_create + mdb_env_open + mdb_env_copy + mdb_env_copyfd + mdb_env_copy2 + mdb_env_copyfd2 + mdb_env_stat + mdb_env_info + mdb_env_sync + mdb_env_close + mdb_env_set_flags + mdb_env_get_flags + mdb_env_get_path + mdb_env_get_fd + mdb_env_set_mapsize + mdb_env_set_maxreaders + mdb_env_get_maxreaders + mdb_env_set_maxdbs + mdb_env_get_maxkeysize + mdb_env_set_userctx + mdb_env_get_userctx + mdb_env_set_assert + mdb_txn_begin + mdb_txn_env + mdb_txn_id + mdb_txn_commit + mdb_txn_abort + mdb_txn_reset + mdb_txn_renew + mdb_dbi_open + mdb_stat + mdb_dbi_flags + mdb_dbi_close + mdb_drop + mdb_set_compare + mdb_set_dupsort + mdb_set_relfunc + mdb_set_relctx + mdb_get + mdb_put + mdb_del + mdb_cursor_open + mdb_cursor_close + mdb_cursor_renew + mdb_cursor_txn + mdb_cursor_dbi + mdb_cursor_get + mdb_cursor_put + mdb_cursor_del + mdb_cursor_count + mdb_cmp + mdb_dcmp + mdb_reader_list + mdb_reader_check
\ No newline at end of file diff --git a/ports/lmdb/cmake/lmdbd.def b/ports/lmdb/cmake/lmdbd.def new file mode 100644 index 000000000..ded15386d --- /dev/null +++ b/ports/lmdb/cmake/lmdbd.def @@ -0,0 +1,58 @@ +LIBRARY lmdbd +EXPORTS + mdb_version + mdb_strerror + mdb_env_create + mdb_env_open + mdb_env_copy + mdb_env_copyfd + mdb_env_copy2 + mdb_env_copyfd2 + mdb_env_stat + mdb_env_info + mdb_env_sync + mdb_env_close + mdb_env_set_flags + mdb_env_get_flags + mdb_env_get_path + mdb_env_get_fd + mdb_env_set_mapsize + mdb_env_set_maxreaders + mdb_env_get_maxreaders + mdb_env_set_maxdbs + mdb_env_get_maxkeysize + mdb_env_set_userctx + mdb_env_get_userctx + mdb_env_set_assert + mdb_txn_begin + mdb_txn_env + mdb_txn_id + mdb_txn_commit + mdb_txn_abort + mdb_txn_reset + mdb_txn_renew + mdb_dbi_open + mdb_stat + mdb_dbi_flags + mdb_dbi_close + mdb_drop + mdb_set_compare + mdb_set_dupsort + mdb_set_relfunc + mdb_set_relctx + mdb_get + mdb_put + mdb_del + mdb_cursor_open + mdb_cursor_close + mdb_cursor_renew + mdb_cursor_txn + mdb_cursor_dbi + mdb_cursor_get + mdb_cursor_put + mdb_cursor_del + mdb_cursor_count + mdb_cmp + mdb_dcmp + mdb_reader_list + mdb_reader_check
\ No newline at end of file diff --git a/ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch b/ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch new file mode 100644 index 000000000..e6d1f108c --- /dev/null +++ b/ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch @@ -0,0 +1,3958 @@ +diff --git a/libraries/liblmdb/Makefile b/libraries/liblmdb/Makefile +index 0940c49..72d0984 100644 +--- a/libraries/liblmdb/Makefile ++++ b/libraries/liblmdb/Makefile +@@ -8,7 +8,7 @@ + # platforms; you should not need to change any of these. + # Read their descriptions in mdb.c if you do: + # +-# - MDB_USE_POSIX_SEM ++# - MDB_USE_POSIX_MUTEX, MDB_USE_POSIX_SEM, MDB_USE_SYSV_SEM + # - MDB_DSYNC + # - MDB_FDATASYNC + # - MDB_FDATASYNC_WORKS +@@ -24,8 +24,9 @@ W = -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized + THREADS = -pthread + OPT = -O2 -g + CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS) +-LDLIBS = +-SOLIBS = ++LDLIBS = # -lntdll # Windows needs ntdll ++SOLIBS = # -lntdll ++SOEXT = .so + prefix = /usr/local + exec_prefix = $(prefix) + bindir = $(exec_prefix)/bin +@@ -37,7 +38,7 @@ mandir = $(datarootdir)/man + ######################################################################## + + IHDRS = lmdb.h +-ILIBS = liblmdb.a liblmdb.so ++ILIBS = liblmdb.a liblmdb$(SOEXT) + IPROGS = mdb_stat mdb_copy mdb_dump mdb_load + IDOCS = mdb_stat.1 mdb_copy.1 mdb_dump.1 mdb_load.1 + PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5 +@@ -63,7 +64,7 @@ test: all + liblmdb.a: mdb.o midl.o + $(AR) rs $@ mdb.o midl.o + +-liblmdb.so: mdb.lo midl.lo ++liblmdb$(SOEXT): mdb.lo midl.lo + # $(CC) $(LDFLAGS) -pthread -shared -Wl,-Bsymbolic -o $@ mdb.o midl.o $(SOLIBS) + $(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.lo midl.lo $(SOLIBS) + +diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h +index c4d05d1..30d5862 100644 +--- a/libraries/liblmdb/lmdb.h ++++ b/libraries/liblmdb/lmdb.h +@@ -53,14 +53,15 @@ + * + * Fix: Check for stale readers periodically, using the + * #mdb_reader_check function or the \ref mdb_stat_1 "mdb_stat" tool. +- * Stale writers will be cleared automatically on some systems: ++ * Stale writers will be cleared automatically on most systems: + * - Windows - automatic ++ * - BSD, systems using SysV semaphores - automatic + * - Linux, systems using POSIX mutexes with Robust option - automatic +- * - not on BSD, systems using POSIX semaphores. + * Otherwise just make all programs using the database close it; + * the lockfile is always reset on first open of the environment. + * +- * - On BSD systems or others configured with MDB_USE_POSIX_SEM, ++ * - On BSD systems or others configured with MDB_USE_SYSV_SEM or ++ * MDB_USE_POSIX_SEM, + * startup can fail due to semaphores owned by another userid. + * + * Fix: Open and close the database as the user which owns the +@@ -77,6 +78,11 @@ + * access to locks and lock file. Exceptions: On read-only filesystems + * or with the #MDB_NOLOCK flag described under #mdb_env_open(). + * ++ * - An LMDB configuration will often reserve considerable \b unused ++ * memory address space and maybe file size for future growth. ++ * This does not use actual memory or disk space, but users may need ++ * to understand the difference so they won't be scared off. ++ * + * - By default, in versions before 0.9.10, unused portions of the data + * file might receive garbage data from memory freed by other code. + * (This does not happen when using the #MDB_WRITEMAP flag.) As of +@@ -160,6 +166,8 @@ + #define _LMDB_H_ + + #include <sys/types.h> ++#include <inttypes.h> ++#include <limits.h> + + #ifdef __cplusplus + extern "C" { +@@ -172,6 +180,32 @@ typedef int mdb_mode_t; + typedef mode_t mdb_mode_t; + #endif + ++#ifdef _WIN32 ++# define MDB_FMT_Z "I" ++#else ++# define MDB_FMT_Z "z" /**< printf/scanf format modifier for size_t */ ++#endif ++ ++#ifndef MDB_VL32 ++/** Unsigned type used for mapsize, entry counts and page/transaction IDs. ++ * ++ * It is normally size_t, hence the name. Defining MDB_VL32 makes it ++ * uint64_t, but do not try this unless you know what you are doing. ++ */ ++typedef size_t mdb_size_t; ++# define MDB_SIZE_MAX SIZE_MAX /**< max #mdb_size_t */ ++/** #mdb_size_t printf formats, \b t = one of [diouxX] without quotes */ ++# define MDB_PRIy(t) MDB_FMT_Z #t ++/** #mdb_size_t scanf formats, \b t = one of [dioux] without quotes */ ++# define MDB_SCNy(t) MDB_FMT_Z #t ++#else ++typedef uint64_t mdb_size_t; ++# define MDB_SIZE_MAX UINT64_MAX ++# define MDB_PRIy(t) PRI##t##64 ++# define MDB_SCNy(t) SCN##t##64 ++# define mdb_env_create mdb_env_create_vl32 /**< Prevent mixing with non-VL32 builds */ ++#endif ++ + /** An abstraction for a file handle. + * On POSIX systems file handles are small integers. On Windows + * they're opaque pointers. +@@ -194,7 +228,7 @@ typedef int mdb_filehandle_t; + /** Library minor version */ + #define MDB_VERSION_MINOR 9 + /** Library patch version */ +-#define MDB_VERSION_PATCH 18 ++#define MDB_VERSION_PATCH 70 + + /** Combine args a,b,c into a single integer for easy version comparisons */ + #define MDB_VERINT(a,b,c) (((a) << 24) | ((b) << 16) | (c)) +@@ -204,7 +238,7 @@ typedef int mdb_filehandle_t; + MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH) + + /** The release date of this library version */ +-#define MDB_VERSION_DATE "February 5, 2016" ++#define MDB_VERSION_DATE "December 19, 2015" + + /** A stringifier for the version info */ + #define MDB_VERSTR(a,b,c,d) "LMDB " #a "." #b "." #c ": (" d ")" +@@ -306,7 +340,8 @@ typedef void (MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr, void *rel + #define MDB_REVERSEKEY 0x02 + /** use sorted duplicates */ + #define MDB_DUPSORT 0x04 +- /** numeric keys in native byte order: either unsigned int or size_t. ++ /** numeric keys in native byte order, either unsigned int or #mdb_size_t. ++ * (lmdb expects 32-bit int <= size_t <= 32/64-bit mdb_size_t.) + * The keys must all be of the same size. */ + #define MDB_INTEGERKEY 0x08 + /** with #MDB_DUPSORT, sorted dup items have fixed size */ +@@ -383,7 +418,9 @@ typedef enum MDB_cursor_op { + MDB_PREV_NODUP, /**< Position at last data item of previous key */ + MDB_SET, /**< Position at specified key */ + MDB_SET_KEY, /**< Position at specified key, return key + data */ +- MDB_SET_RANGE /**< Position at first key greater than or equal to specified key. */ ++ MDB_SET_RANGE, /**< Position at first key greater than or equal to specified key. */ ++ MDB_PREV_MULTIPLE /**< Position at previous page and return key and up to ++ a page of duplicate data items. Only for #MDB_DUPFIXED */ + } MDB_cursor_op; + + /** @defgroup errors Return Codes +@@ -440,8 +477,10 @@ typedef enum MDB_cursor_op { + #define MDB_BAD_VALSIZE (-30781) + /** The specified DBI was changed unexpectedly */ + #define MDB_BAD_DBI (-30780) ++ /** Unexpected problem - txn should abort */ ++#define MDB_PROBLEM (-30779) + /** The last defined error code */ +-#define MDB_LAST_ERRCODE MDB_BAD_DBI ++#define MDB_LAST_ERRCODE MDB_PROBLEM + /** @} */ + + /** @brief Statistics for a database in the environment */ +@@ -449,18 +488,18 @@ typedef struct MDB_stat { + unsigned int ms_psize; /**< Size of a database page. + This is currently the same for all databases. */ + unsigned int ms_depth; /**< Depth (height) of the B-tree */ +- size_t ms_branch_pages; /**< Number of internal (non-leaf) pages */ +- size_t ms_leaf_pages; /**< Number of leaf pages */ +- size_t ms_overflow_pages; /**< Number of overflow pages */ +- size_t ms_entries; /**< Number of data items */ ++ mdb_size_t ms_branch_pages; /**< Number of internal (non-leaf) pages */ ++ mdb_size_t ms_leaf_pages; /**< Number of leaf pages */ ++ mdb_size_t ms_overflow_pages; /**< Number of overflow pages */ ++ mdb_size_t ms_entries; /**< Number of data items */ + } MDB_stat; + + /** @brief Information about the environment */ + typedef struct MDB_envinfo { + void *me_mapaddr; /**< Address of map, if fixed */ +- size_t me_mapsize; /**< Size of the data memory map */ +- size_t me_last_pgno; /**< ID of the last used page */ +- size_t me_last_txnid; /**< ID of the last committed transaction */ ++ mdb_size_t me_mapsize; /**< Size of the data memory map */ ++ mdb_size_t me_last_pgno; /**< ID of the last used page */ ++ mdb_size_t me_last_txnid; /**< ID of the last committed transaction */ + unsigned int me_maxreaders; /**< max reader slots in the environment */ + unsigned int me_numreaders; /**< max reader slots used in the environment */ + } MDB_envinfo; +@@ -672,6 +711,7 @@ int mdb_env_copyfd(MDB_env *env, mdb_filehandle_t fd); + * <li>#MDB_CP_COMPACT - Perform compaction while copying: omit free + * pages and sequentially renumber all pages in output. This option + * consumes more CPU and runs more slowly than the default. ++ * Currently it fails if the environment has suffered a page leak. + * </ul> + * @return A non-zero error value on failure and 0 on success. + */ +@@ -829,7 +869,7 @@ int mdb_env_get_fd(MDB_env *env, mdb_filehandle_t *fd); + * an active write transaction. + * </ul> + */ +-int mdb_env_set_mapsize(MDB_env *env, size_t size); ++int mdb_env_set_mapsize(MDB_env *env, mdb_size_t size); + + /** @brief Set the maximum number of threads/reader slots for the environment. + * +@@ -942,6 +982,10 @@ int mdb_env_set_assert(MDB_env *env, MDB_assert_func *func); + * <ul> + * <li>#MDB_RDONLY + * This transaction will not perform any write operations. ++ * <li>#MDB_NOSYNC ++ * Don't flush system buffers to disk when committing this transaction. ++ * <li>#MDB_NOMETASYNC ++ * Flush system buffers but omit metadata flush when committing this transaction. + * </ul> + * @param[out] txn Address where the new #MDB_txn handle will be stored + * @return A non-zero error value on failure and 0 on success. Some possible +@@ -974,7 +1018,7 @@ MDB_env *mdb_txn_env(MDB_txn *txn); + * @param[in] txn A transaction handle returned by #mdb_txn_begin() + * @return A transaction ID, valid if input is an active transaction. + */ +-size_t mdb_txn_id(MDB_txn *txn); ++mdb_size_t mdb_txn_id(MDB_txn *txn); + + /** @brief Commit all the operations of a transaction into the database. + * +@@ -1084,7 +1128,8 @@ int mdb_txn_renew(MDB_txn *txn); + * keys must be unique and may have only a single data item. + * <li>#MDB_INTEGERKEY + * Keys are binary integers in native byte order, either unsigned int +- * or size_t, and will be sorted as such. ++ * or #mdb_size_t, and will be sorted as such. ++ * (lmdb expects 32-bit int <= size_t <= 32/64-bit mdb_size_t.) + * The keys must all be of the same size. + * <li>#MDB_DUPFIXED + * This flag may only be used in combination with #MDB_DUPSORT. This option +@@ -1524,7 +1569,7 @@ int mdb_cursor_del(MDB_cursor *cursor, unsigned int flags); + * <li>EINVAL - cursor is not initialized, or an invalid parameter was specified. + * </ul> + */ +-int mdb_cursor_count(MDB_cursor *cursor, size_t *countp); ++int mdb_cursor_count(MDB_cursor *cursor, mdb_size_t *countp); + + /** @brief Compare two data items according to a particular database. + * +diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c +index d2e81e4..1d9e9fa 100644 +--- a/libraries/liblmdb/mdb.c ++++ b/libraries/liblmdb/mdb.c +@@ -35,9 +35,42 @@ + #ifndef _GNU_SOURCE + #define _GNU_SOURCE 1 + #endif ++#if defined(MDB_VL32) || defined(__WIN64__) ++#define _FILE_OFFSET_BITS 64 ++#endif + #ifdef _WIN32 + #include <malloc.h> + #include <windows.h> ++ ++/* We use native NT APIs to setup the memory map, so that we can ++ * let the DB file grow incrementally instead of always preallocating ++ * the full size. These APIs are defined in <wdm.h> and <ntifs.h> ++ * but those headers are meant for driver-level development and ++ * conflict with the regular user-level headers, so we explicitly ++ * declare them here. Using these APIs also means we must link to ++ * ntdll.dll, which is not linked by default in user code. ++ */ ++NTSTATUS WINAPI ++NtCreateSection(OUT PHANDLE sh, IN ACCESS_MASK acc, ++ IN void * oa OPTIONAL, ++ IN PLARGE_INTEGER ms OPTIONAL, ++ IN ULONG pp, IN ULONG aa, IN HANDLE fh OPTIONAL); ++ ++typedef enum _SECTION_INHERIT { ++ ViewShare = 1, ++ ViewUnmap = 2 ++} SECTION_INHERIT; ++ ++NTSTATUS WINAPI ++NtMapViewOfSection(IN PHANDLE sh, IN HANDLE ph, ++ IN OUT PVOID *addr, IN ULONG_PTR zbits, ++ IN SIZE_T cs, IN OUT PLARGE_INTEGER off OPTIONAL, ++ IN OUT PSIZE_T vs, IN SECTION_INHERIT ih, ++ IN ULONG at, IN ULONG pp); ++ ++NTSTATUS WINAPI ++NtClose(HANDLE h); ++ + /** getpid() returns int; MinGW defines pid_t but MinGW64 typedefs it + * as int64 which is wrong. MSVC doesn't define it at all, so just + * don't use it. +@@ -56,6 +89,10 @@ + # define SSIZE_MAX INT_MAX + # endif + #endif ++/* Windows uses 32-bit off_t to define our own ++ 64 bit offset type ++*/ ++#define offset_t __int64 + #else + #include <sys/types.h> + #include <sys/stat.h> +@@ -68,6 +105,7 @@ + #include <sys/file.h> + #endif + #include <fcntl.h> ++#define offset_t off_t + #endif + + #if defined(__mips) && defined(__linux) +@@ -116,7 +154,9 @@ typedef SSIZE_T ssize_t; + #endif + + #if defined(__APPLE__) || defined (BSD) +-# define MDB_USE_POSIX_SEM 1 ++# if !(defined(MDB_USE_POSIX_MUTEX) || defined(MDB_USE_POSIX_SEM)) ++# define MDB_USE_SYSV_SEM 1 ++# endif + # define MDB_FDATASYNC fsync + #elif defined(ANDROID) + # define MDB_FDATASYNC fsync +@@ -127,12 +167,22 @@ typedef SSIZE_T ssize_t; + #ifdef MDB_USE_POSIX_SEM + # define MDB_USE_HASH 1 + #include <semaphore.h> ++#elif defined(MDB_USE_SYSV_SEM) ++#include <sys/ipc.h> ++#include <sys/sem.h> ++#ifdef _SEM_SEMUN_UNDEFINED ++union semun { ++ int val; ++ struct semid_ds *buf; ++ unsigned short *array; ++}; ++#endif /* _SEM_SEMUN_UNDEFINED */ + #else + #define MDB_USE_POSIX_MUTEX 1 +-#endif +-#endif ++#endif /* MDB_USE_POSIX_SEM */ ++#endif /* !_WIN32 */ + +-#if defined(_WIN32) + defined(MDB_USE_POSIX_SEM) \ ++#if defined(_WIN32) + defined(MDB_USE_POSIX_SEM) + defined(MDB_USE_SYSV_SEM) \ + + defined(MDB_USE_POSIX_MUTEX) != 1 + # error "Ambiguous shared-lock implementation" + #endif +@@ -183,7 +233,7 @@ typedef SSIZE_T ssize_t; + + #if (BYTE_ORDER == LITTLE_ENDIAN) == (BYTE_ORDER == BIG_ENDIAN) + # error "Unknown or unsupported endianness (BYTE_ORDER)" +-#elif (-6 & 5) || CHAR_BIT != 8 || UINT_MAX < 0xffffffff || ULONG_MAX % 0xFFFF ++#elif (-6 & 5) || CHAR_BIT!=8 || UINT_MAX!=0xffffffff || MDB_SIZE_MAX%UINT_MAX + # error "Two's complement, reasonably sized integer types, please" + #endif + +@@ -234,6 +284,8 @@ typedef SSIZE_T ssize_t; + #define MDB_NO_ROOT (MDB_LAST_ERRCODE + 10) + #ifdef _WIN32 + #define MDB_OWNERDEAD ((int) WAIT_ABANDONED) ++#elif defined MDB_USE_SYSV_SEM ++#define MDB_OWNERDEAD (MDB_LAST_ERRCODE + 11) + #elif defined(MDB_USE_POSIX_MUTEX) && defined(EOWNERDEAD) + #define MDB_OWNERDEAD EOWNERDEAD /**< #LOCK_MUTEX0() result if dead owner */ + #endif +@@ -256,16 +308,20 @@ typedef SSIZE_T ssize_t; + # define MDB_USE_ROBUST 0 + # else + # define MDB_USE_ROBUST 1 ++# endif ++#endif /* !MDB_USE_ROBUST */ ++ ++#if defined(MDB_USE_POSIX_MUTEX) && (MDB_USE_ROBUST) + /* glibc < 2.12 only provided _np API */ +-# if defined(__GLIBC__) && GLIBC_VER < 0x02000c ++# if (defined(__GLIBC__) && GLIBC_VER < 0x02000c) || \ ++ (defined(PTHREAD_MUTEX_ROBUST_NP) && !defined(PTHREAD_MUTEX_ROBUST)) + # define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST_NP + # define pthread_mutexattr_setrobust(attr, flag) pthread_mutexattr_setrobust_np(attr, flag) + # define pthread_mutex_consistent(mutex) pthread_mutex_consistent_np(mutex) + # endif +-# endif +-#endif /* MDB_USE_ROBUST */ ++#endif /* MDB_USE_POSIX_MUTEX && MDB_USE_ROBUST */ + +-#if defined(MDB_OWNERDEAD) && MDB_USE_ROBUST ++#if defined(MDB_OWNERDEAD) && (MDB_USE_ROBUST) + #define MDB_ROBUST_SUPPORTED 1 + #endif + +@@ -288,8 +344,10 @@ typedef HANDLE mdb_mutex_t, mdb_mutexref_t; + #define pthread_mutex_lock(x) WaitForSingleObject(*x, INFINITE) + #define pthread_cond_signal(x) SetEvent(*x) + #define pthread_cond_wait(cond,mutex) do{SignalObjectAndWait(*mutex, *cond, INFINITE, FALSE); WaitForSingleObject(*mutex, INFINITE);}while(0) +-#define THREAD_CREATE(thr,start,arg) thr=CreateThread(NULL,0,start,arg,0,NULL) +-#define THREAD_FINISH(thr) WaitForSingleObject(thr, INFINITE) ++#define THREAD_CREATE(thr,start,arg) \ ++ (((thr) = CreateThread(NULL, 0, start, arg, 0, NULL)) ? 0 : ErrCode()) ++#define THREAD_FINISH(thr) \ ++ (WaitForSingleObject(thr, INFINITE) ? ErrCode() : 0) + #define LOCK_MUTEX0(mutex) WaitForSingleObject(mutex, INFINITE) + #define UNLOCK_MUTEX(mutex) ReleaseMutex(mutex) + #define mdb_mutex_consistent(mutex) 0 +@@ -305,12 +363,10 @@ typedef HANDLE mdb_mutex_t, mdb_mutexref_t; + #else + #define MDB_PROCESS_QUERY_LIMITED_INFORMATION 0x1000 + #endif +-#define Z "I" + #else + #define THREAD_RET void * + #define THREAD_CREATE(thr,start,arg) pthread_create(&thr,NULL,start,arg) + #define THREAD_FINISH(thr) pthread_join(thr,NULL) +-#define Z "z" /**< printf format modifier for size_t */ + + /** For MDB_LOCK_FORMAT: True if readers take a pid lock in the lockfile */ + #define MDB_PIDLOCK 1 +@@ -329,12 +385,46 @@ mdb_sem_wait(sem_t *sem) + return rc; + } + ++#elif defined MDB_USE_SYSV_SEM ++ ++typedef struct mdb_mutex { ++ int semid; ++ int semnum; ++ int *locked; ++} mdb_mutex_t[1], *mdb_mutexref_t; ++ ++#define LOCK_MUTEX0(mutex) mdb_sem_wait(mutex) ++#define UNLOCK_MUTEX(mutex) do { \ ++ struct sembuf sb = { 0, 1, SEM_UNDO }; \ ++ sb.sem_num = (mutex)->semnum; \ ++ *(mutex)->locked = 0; \ ++ semop((mutex)->semid, &sb, 1); \ ++} while(0) ++ ++static int ++mdb_sem_wait(mdb_mutexref_t sem) ++{ ++ int rc, *locked = sem->locked; ++ struct sembuf sb = { 0, -1, SEM_UNDO }; ++ sb.sem_num = sem->semnum; ++ do { ++ if (!semop(sem->semid, &sb, 1)) { ++ rc = *locked ? MDB_OWNERDEAD : MDB_SUCCESS; ++ *locked = 1; ++ break; ++ } ++ } while ((rc = errno) == EINTR); ++ return rc; ++} ++ ++#define mdb_mutex_consistent(mutex) 0 ++ + #else /* MDB_USE_POSIX_MUTEX: */ + /** Shared mutex/semaphore as it is stored (mdb_mutex_t), and as + * local variables keep it (mdb_mutexref_t). + * +- * When #mdb_mutexref_t is a pointer declaration and #mdb_mutex_t is +- * not, then it is array[size 1] so it can be assigned to a pointer. ++ * An mdb_mutex_t can be assigned to an mdb_mutexref_t. They can ++ * be the same, or an array[size 1] and a pointer. + * @{ + */ + typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t; +@@ -349,7 +439,7 @@ typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t; + /** Mark mutex-protected data as repaired, after death of previous owner. + */ + #define mdb_mutex_consistent(mutex) pthread_mutex_consistent(mutex) +-#endif /* MDB_USE_POSIX_SEM */ ++#endif /* MDB_USE_POSIX_SEM || MDB_USE_SYSV_SEM */ + + /** Get the error code for the last failed system function. + */ +@@ -374,12 +464,24 @@ typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t; + #define GET_PAGESIZE(x) ((x) = sysconf(_SC_PAGE_SIZE)) + #endif + ++#define Z MDB_FMT_Z /**< printf/scanf format modifier for size_t */ ++#define Yu MDB_PRIy(u) /**< printf format for #mdb_size_t */ ++#define Yd MDB_PRIy(d) /**< printf format for "signed #mdb_size_t" */ ++ + #if defined(_WIN32) || defined(MDB_USE_POSIX_SEM) + #define MNAME_LEN 32 ++#elif defined(MDB_USE_SYSV_SEM) ++#define MNAME_LEN (sizeof(int)) + #else + #define MNAME_LEN (sizeof(pthread_mutex_t)) + #endif + ++#ifdef MDB_USE_SYSV_SEM ++#define SYSV_SEM_FLAG 1 /**< SysV sems in lockfile format */ ++#else ++#define SYSV_SEM_FLAG 0 ++#endif ++ + /** @} */ + + #ifdef MDB_ROBUST_SUPPORTED +@@ -521,7 +623,7 @@ static txnid_t mdb_debug_start; + /** The version number for a database's datafile format. */ + #define MDB_DATA_VERSION ((MDB_DEVEL) ? 999 : 1) + /** The version number for a database's lockfile format. */ +-#define MDB_LOCK_VERSION 1 ++#define MDB_LOCK_VERSION ((MDB_DEVEL) ? 999 : 1) + + /** @brief The max size of a key we can write, or 0 for computed max. + * +@@ -712,6 +814,9 @@ typedef struct MDB_txbody { + uint32_t mtb_format; + #if defined(_WIN32) || defined(MDB_USE_POSIX_SEM) + char mtb_rmname[MNAME_LEN]; ++#elif defined(MDB_USE_SYSV_SEM) ++ int mtb_semid; ++ int mtb_rlocked; + #else + /** Mutex protecting access to this table. + * This is the reader table lock used with LOCK_MUTEX(). +@@ -740,12 +845,19 @@ typedef struct MDB_txninfo { + #define mti_rmname mt1.mtb.mtb_rmname + #define mti_txnid mt1.mtb.mtb_txnid + #define mti_numreaders mt1.mtb.mtb_numreaders ++#ifdef MDB_USE_SYSV_SEM ++#define mti_semid mt1.mtb.mtb_semid ++#define mti_rlocked mt1.mtb.mtb_rlocked ++#endif + char pad[(sizeof(MDB_txbody)+CACHELINE-1) & ~(CACHELINE-1)]; + } mt1; + union { + #if defined(_WIN32) || defined(MDB_USE_POSIX_SEM) + char mt2_wmname[MNAME_LEN]; + #define mti_wmname mt2.mt2_wmname ++#elif defined MDB_USE_SYSV_SEM ++ int mt2_wlocked; ++#define mti_wlocked mt2.mt2_wlocked + #else + mdb_mutex_t mt2_wmutex; + #define mti_wmutex mt2.mt2_wmutex +@@ -760,12 +872,27 @@ typedef struct MDB_txninfo { + ((uint32_t) \ + ((MDB_LOCK_VERSION) \ + /* Flags which describe functionality */ \ ++ + (SYSV_SEM_FLAG << 18) \ + + (((MDB_PIDLOCK) != 0) << 16))) + /** @} */ + +-/** Common header for all page types. +- * Overflow records occupy a number of contiguous pages with no +- * headers on any page after the first. ++/** Common header for all page types. The page type depends on #mp_flags. ++ * ++ * #P_BRANCH and #P_LEAF pages have unsorted '#MDB_node's at the end, with ++ * sorted #mp_ptrs[] entries referring to them. Exception: #P_LEAF2 pages ++ * omit mp_ptrs and pack sorted #MDB_DUPFIXED values after the page header. ++ * ++ * #P_OVERFLOW records occupy one or more contiguous pages where only the ++ * first has a page header. They hold the real data of #F_BIGDATA nodes. ++ * ++ * #P_SUBP sub-pages are small leaf "pages" with duplicate data. ++ * A node with flag #F_DUPDATA but not #F_SUBDATA contains a sub-page. ++ * (Duplicate data can also go in sub-databases, which use normal pages.) ++ * ++ * #P_META pages contain #MDB_meta, the start point of an LMDB snapshot. ++ * ++ * Each non-metapage up to #MDB_meta.%mm_last_pg is reachable exactly once ++ * in the snapshot: Either used by a database or listed in a freeDB record. + */ + typedef struct MDB_page { + #define mp_pgno mp_p.p_pgno +@@ -774,7 +901,7 @@ typedef struct MDB_page { + pgno_t p_pgno; /**< page number */ + struct MDB_page *p_next; /**< for in-memory list of freed pages */ + } mp_p; +- uint16_t mp_pad; ++ uint16_t mp_pad; /**< key size if this is a LEAF2 page */ + /** @defgroup mdb_page Page Flags + * @ingroup internal + * Flags for the page headers. +@@ -841,7 +968,9 @@ typedef struct MDB_page { + /** The number of overflow pages needed to store the given size. */ + #define OVPAGES(size, psize) ((PAGEHDRSZ-1 + (size)) / (psize) + 1) + +- /** Link in #MDB_txn.%mt_loose_pgs list */ ++ /** Link in #MDB_txn.%mt_loose_pgs list. ++ * Kept outside the page header, which is needed when reusing the page. ++ */ + #define NEXT_LOOSE_PAGE(p) (*(MDB_page **)((p) + 2)) + + /** Header for a single key/data pair within a page. +@@ -924,7 +1053,7 @@ typedef struct MDB_node { + #ifdef MISALIGNED_OK + #define COPY_PGNO(dst,src) dst = src + #else +-#if SIZE_MAX > 4294967295UL ++#if MDB_SIZE_MAX > 0xffffffffU + #define COPY_PGNO(dst,src) do { \ + unsigned short *s, *d; \ + s = (unsigned short *)&(src); \ +@@ -965,13 +1094,13 @@ typedef struct MDB_db { + pgno_t md_branch_pages; /**< number of internal pages */ + pgno_t md_leaf_pages; /**< number of leaf pages */ + pgno_t md_overflow_pages; /**< number of overflow pages */ +- size_t md_entries; /**< number of data items */ ++ mdb_size_t md_entries; /**< number of data items */ + pgno_t md_root; /**< the root page of this tree */ + } MDB_db; + +- /** mdb_dbi_open flags */ + #define MDB_VALID 0x8000 /**< DB handle is valid, for me_dbflags */ + #define PERSISTENT_FLAGS (0xffff & ~(MDB_VALID)) ++ /** #mdb_dbi_open() flags */ + #define VALID_FLAGS (MDB_REVERSEKEY|MDB_DUPSORT|MDB_INTEGERKEY|MDB_DUPFIXED|\ + MDB_INTEGERDUP|MDB_REVERSEDUP|MDB_CREATE) + +@@ -995,14 +1124,25 @@ typedef struct MDB_meta { + uint32_t mm_magic; + /** Version number of this file. Must be set to #MDB_DATA_VERSION. */ + uint32_t mm_version; ++#ifdef MDB_VL32 ++ union { /* always zero since we don't support fixed mapping in MDB_VL32 */ ++ MDB_ID mmun_ull; ++ void *mmun_address; ++ } mm_un; ++#define mm_address mm_un.mmun_address ++#else + void *mm_address; /**< address for fixed mapping */ +- size_t mm_mapsize; /**< size of mmap region */ ++#endif ++ pgno_t mm_mapsize; /**< size of mmap region */ + MDB_db mm_dbs[CORE_DBS]; /**< first is free space, 2nd is main db */ + /** The size of pages used in this DB */ + #define mm_psize mm_dbs[FREE_DBI].md_pad + /** Any persistent environment flags. @ref mdb_env */ + #define mm_flags mm_dbs[FREE_DBI].md_flags +- pgno_t mm_last_pg; /**< last used page in file */ ++ /** Last used page in the datafile. ++ * Actually the file may be shorter if the freeDB lists the final pages. ++ */ ++ pgno_t mm_last_pg; + volatile txnid_t mm_txnid; /**< txnid that committed this page */ + } MDB_meta; + +@@ -1039,6 +1179,9 @@ struct MDB_txn { + /** Nested txn under this txn, set together with flag #MDB_TXN_HAS_CHILD */ + MDB_txn *mt_child; + pgno_t mt_next_pgno; /**< next unallocated page */ ++#ifdef MDB_VL32 ++ pgno_t mt_last_pgno; /**< last written page */ ++#endif + /** The ID of this transaction. IDs are integers incrementing from 1. + * Only committed write transactions increment the ID. If a transaction + * aborts, the ID may be re-used by the next writer. +@@ -1052,7 +1195,7 @@ struct MDB_txn { + * in this transaction, linked through #NEXT_LOOSE_PAGE(page). + */ + MDB_page *mt_loose_pgs; +- /* #Number of loose pages (#mt_loose_pgs) */ ++ /** Number of loose pages (#mt_loose_pgs) */ + int mt_loose_count; + /** The sorted list of dirty pages we temporarily wrote to disk + * because the dirty list was full. page numbers in here are +@@ -1085,6 +1228,19 @@ struct MDB_txn { + MDB_cursor **mt_cursors; + /** Array of flags for each DB */ + unsigned char *mt_dbflags; ++#ifdef MDB_VL32 ++ /** List of read-only pages (actually chunks) */ ++ MDB_ID3L mt_rpages; ++ /** We map chunks of 16 pages. Even though Windows uses 4KB pages, all ++ * mappings must begin on 64KB boundaries. So we round off all pgnos to ++ * a chunk boundary. We do the same on Linux for symmetry, and also to ++ * reduce the frequency of mmap/munmap calls. ++ */ ++#define MDB_RPAGE_CHUNK 16 ++#define MDB_TRPAGE_SIZE 4096 /**< size of #mt_rpages array of chunks */ ++#define MDB_TRPAGE_MAX (MDB_TRPAGE_SIZE-1) /**< maximum chunk index */ ++ unsigned int mt_rpcheck; /**< threshold for reclaiming unref'd chunks */ ++#endif + /** Number of DB records in use, or 0 when the txn is finished. + * This number only ever increments until the txn finishes; we + * don't decrement it when individual DB handles are closed. +@@ -1096,7 +1252,9 @@ struct MDB_txn { + * @{ + */ + /** #mdb_txn_begin() flags */ +-#define MDB_TXN_BEGIN_FLAGS MDB_RDONLY ++#define MDB_TXN_BEGIN_FLAGS (MDB_NOMETASYNC|MDB_NOSYNC|MDB_RDONLY) ++#define MDB_TXN_NOMETASYNC MDB_NOMETASYNC /**< don't sync meta for this txn on commit */ ++#define MDB_TXN_NOSYNC MDB_NOSYNC /**< don't sync this txn on commit */ + #define MDB_TXN_RDONLY MDB_RDONLY /**< read-only transaction */ + /* internal txn flags */ + #define MDB_TXN_WRITEMAP MDB_WRITEMAP /**< copy of #MDB_env flag in writers */ +@@ -1162,10 +1320,24 @@ struct MDB_cursor { + #define C_SUB 0x04 /**< Cursor is a sub-cursor */ + #define C_DEL 0x08 /**< last op was a cursor_del */ + #define C_UNTRACK 0x40 /**< Un-track cursor when closing */ ++#define C_WRITEMAP MDB_TXN_WRITEMAP /**< Copy of txn flag */ ++/** Read-only cursor into the txn's original snapshot in the map. ++ * Set for read-only txns, and in #mdb_page_alloc() for #FREE_DBI when ++ * #MDB_DEVEL & 2. Only implements code which is necessary for this. ++ */ ++#define C_ORIG_RDONLY MDB_TXN_RDONLY + /** @} */ + unsigned int mc_flags; /**< @ref mdb_cursor */ + MDB_page *mc_pg[CURSOR_STACK]; /**< stack of pushed pages */ + indx_t mc_ki[CURSOR_STACK]; /**< stack of page indices */ ++#ifdef MDB_VL32 ++ MDB_page *mc_ovpg; /**< a referenced overflow page */ ++# define MC_OVPG(mc) ((mc)->mc_ovpg) ++# define MC_SET_OVPG(mc, pg) ((mc)->mc_ovpg = (pg)) ++#else ++# define MC_OVPG(mc) ((MDB_page *)0) ++# define MC_SET_OVPG(mc, pg) ((void)0) ++#endif + }; + + /** Context for sorted-dup records. +@@ -1195,6 +1367,9 @@ struct MDB_env { + HANDLE me_fd; /**< The main data file */ + HANDLE me_lfd; /**< The lock file */ + HANDLE me_mfd; /**< just for writing the meta pages */ ++#if defined(MDB_VL32) && defined(_WIN32) ++ HANDLE me_fmh; /**< File Mapping handle */ ++#endif + /** Failed to update the meta page. Probably an I/O error. */ + #define MDB_FATAL_ERROR 0x80000000U + /** Some fields are initialized. */ +@@ -1219,8 +1394,8 @@ struct MDB_env { + void *me_pbuf; /**< scratch area for DUPSORT put() */ + MDB_txn *me_txn; /**< current write transaction */ + MDB_txn *me_txn0; /**< prealloc'd write transaction */ +- size_t me_mapsize; /**< size of the data memory map */ +- off_t me_size; /**< current file size */ ++ mdb_size_t me_mapsize; /**< size of the data memory map */ ++ offset_t me_size; /**< current file size */ + pgno_t me_maxpg; /**< me_mapsize / me_psize */ + MDB_dbx *me_dbxs; /**< array of static DB info */ + uint16_t *me_dbflags; /**< array of flags from MDB_db.md_flags */ +@@ -1253,6 +1428,13 @@ struct MDB_env { + mdb_mutex_t me_rmutex; + mdb_mutex_t me_wmutex; + #endif ++#ifdef MDB_VL32 ++ MDB_ID3L me_rpages; /**< like #mt_rpages, but global to env */ ++ pthread_mutex_t me_rpmutex; /**< control access to #me_rpages */ ++#define MDB_ERPAGE_SIZE 16384 ++#define MDB_ERPAGE_MAX (MDB_ERPAGE_SIZE-1) ++ unsigned int me_rpcheck; ++#endif + void *me_userctx; /**< User-settable context */ + MDB_assert_func *me_assert_func; /**< Callback for assertion failures */ + }; +@@ -1298,7 +1480,7 @@ enum { + #define MDB_END_SLOT MDB_NOTLS /**< release any reader slot if #MDB_NOTLS */ + static void mdb_txn_end(MDB_txn *txn, unsigned mode); + +-static int mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **mp, int *lvl); ++static int mdb_page_get(MDB_cursor *mc, pgno_t pgno, MDB_page **mp, int *lvl); + static int mdb_page_search_root(MDB_cursor *mc, + MDB_val *key, int modify); + #define MDB_PS_MODIFY 1 +@@ -1327,7 +1509,7 @@ static int mdb_node_add(MDB_cursor *mc, indx_t indx, + static void mdb_node_del(MDB_cursor *mc, int ksize); + static void mdb_node_shrink(MDB_page *mp, indx_t indx); + static int mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft); +-static int mdb_node_read(MDB_txn *txn, MDB_node *leaf, MDB_val *data); ++static int mdb_node_read(MDB_cursor *mc, MDB_node *leaf, MDB_val *data); + static size_t mdb_leaf_size(MDB_env *env, MDB_val *key, MDB_val *data); + static size_t mdb_branch_size(MDB_env *env, MDB_val *key); + +@@ -1360,13 +1542,18 @@ static int mdb_reader_check0(MDB_env *env, int rlocked, int *dead); + static MDB_cmp_func mdb_cmp_memn, mdb_cmp_memnr, mdb_cmp_int, mdb_cmp_cint, mdb_cmp_long; + /** @endcond */ + +-/** Compare two items pointing at size_t's of unknown alignment. */ ++/** Compare two items pointing at '#mdb_size_t's of unknown alignment. */ + #ifdef MISALIGNED_OK + # define mdb_cmp_clong mdb_cmp_long + #else + # define mdb_cmp_clong mdb_cmp_cint + #endif + ++/** True if we need #mdb_cmp_clong() instead of \b cmp for #MDB_INTEGERDUP */ ++#define NEED_CMP_CLONG(cmp, ksize) \ ++ (UINT_MAX < MDB_SIZE_MAX && \ ++ (cmp) == mdb_cmp_int && (ksize) == sizeof(mdb_size_t)) ++ + #ifdef _WIN32 + static SECURITY_DESCRIPTOR mdb_null_sd; + static SECURITY_ATTRIBUTES mdb_all_sa; +@@ -1407,6 +1594,7 @@ static char *const mdb_errstr[] = { + "MDB_BAD_TXN: Transaction must abort, has a child, or is invalid", + "MDB_BAD_VALSIZE: Unsupported size of key/DB name/data, or wrong DUPFIXED size", + "MDB_BAD_DBI: The specified DBI handle was closed/changed unexpectedly", ++ "MDB_PROBLEM: Unexpected problem - txn should abort", + }; + + char * +@@ -1417,8 +1605,9 @@ mdb_strerror(int err) + * This works as long as no function between the call to mdb_strerror + * and the actual use of the message uses more than 4K of stack. + */ +- char pad[4096]; +- char buf[1024], *ptr = buf; ++#define MSGSIZE 1024 ++#define PADSIZE 4096 ++ char buf[MSGSIZE+PADSIZE], *ptr = buf; + #endif + int i; + if (!err) +@@ -1450,7 +1639,7 @@ mdb_strerror(int err) + buf[0] = 0; + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, +- NULL, err, 0, ptr, sizeof(buf), (va_list *)pad); ++ NULL, err, 0, ptr, MSGSIZE, (va_list *)buf+MSGSIZE); + return ptr; + #else + return strerror(err); +@@ -1550,20 +1739,20 @@ mdb_page_list(MDB_page *mp) + case P_LEAF|P_LEAF2: type = "LEAF2 page"; break; + case P_LEAF|P_LEAF2|P_SUBP: type = "LEAF2 sub-page"; break; + case P_OVERFLOW: +- fprintf(stderr, "Overflow page %"Z"u pages %u%s\n", ++ fprintf(stderr, "Overflow page %"Yu" pages %u%s\n", + pgno, mp->mp_pages, state); + return; + case P_META: +- fprintf(stderr, "Meta-page %"Z"u txnid %"Z"u\n", ++ fprintf(stderr, "Meta-page %"Yu" txnid %"Yu"\n", + pgno, ((MDB_meta *)METADATA(mp))->mm_txnid); + return; + default: +- fprintf(stderr, "Bad page %"Z"u flags 0x%u\n", pgno, mp->mp_flags); ++ fprintf(stderr, "Bad page %"Yu" flags 0x%X\n", pgno, mp->mp_flags); + return; + } + + nkeys = NUMKEYS(mp); +- fprintf(stderr, "%s %"Z"u numkeys %d%s\n", type, pgno, nkeys, state); ++ fprintf(stderr, "%s %"Yu" numkeys %d%s\n", type, pgno, nkeys, state); + + for (i=0; i<nkeys; i++) { + if (IS_LEAF2(mp)) { /* LEAF2 pages have no mp_ptrs[] or node headers */ +@@ -1578,7 +1767,7 @@ mdb_page_list(MDB_page *mp) + key.mv_data = node->mn_data; + nsize = NODESIZE + key.mv_size; + if (IS_BRANCH(mp)) { +- fprintf(stderr, "key %d: page %"Z"u, %s\n", i, NODEPGNO(node), ++ fprintf(stderr, "key %d: page %"Yu", %s\n", i, NODEPGNO(node), + DKEY(&key)); + total += nsize; + } else { +@@ -1674,7 +1863,7 @@ static void mdb_audit(MDB_txn *txn) + } + } + if (freecount + count + NUM_METAS != txn->mt_next_pgno) { +- fprintf(stderr, "audit: %lu freecount: %lu count: %lu total: %lu next_pgno: %lu\n", ++ fprintf(stderr, "audit: %"Yu" freecount: %"Yu" count: %"Yu" total: %"Yu" next_pgno: %"Yu"\n", + txn->mt_txnid, freecount, count+NUM_METAS, + freecount+count+NUM_METAS, txn->mt_next_pgno); + } +@@ -1691,10 +1880,8 @@ int + mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b) + { + MDB_cmp_func *dcmp = txn->mt_dbxs[dbi].md_dcmp; +-#if UINT_MAX < SIZE_MAX +- if (dcmp == mdb_cmp_int && a->mv_size == sizeof(size_t)) ++ if (NEED_CMP_CLONG(dcmp, a->mv_size)) + dcmp = mdb_cmp_clong; +-#endif + return dcmp(a, b); + } + +@@ -1774,6 +1961,51 @@ mdb_dlist_free(MDB_txn *txn) + dl[0].mid = 0; + } + ++#ifdef MDB_VL32 ++static void ++mdb_page_unref(MDB_txn *txn, MDB_page *mp) ++{ ++ pgno_t pgno; ++ MDB_ID3L tl = txn->mt_rpages; ++ unsigned x, rem; ++ if (mp->mp_flags & (P_SUBP|P_DIRTY)) ++ return; ++ rem = mp->mp_pgno & (MDB_RPAGE_CHUNK-1); ++ pgno = mp->mp_pgno ^ rem; ++ x = mdb_mid3l_search(tl, pgno); ++ if (x != tl[0].mid && tl[x+1].mid == mp->mp_pgno) ++ x++; ++ if (tl[x].mref) ++ tl[x].mref--; ++} ++#define MDB_PAGE_UNREF(txn, mp) mdb_page_unref(txn, mp) ++ ++static void ++mdb_cursor_unref(MDB_cursor *mc) ++{ ++ int i; ++ if (!mc->mc_snum || !mc->mc_pg[0] || IS_SUBP(mc->mc_pg[0])) ++ return; ++ for (i=0; i<mc->mc_snum; i++) ++ mdb_page_unref(mc->mc_txn, mc->mc_pg[i]); ++ if (mc->mc_ovpg) { ++ mdb_page_unref(mc->mc_txn, mc->mc_ovpg); ++ mc->mc_ovpg = 0; ++ } ++ mc->mc_snum = mc->mc_top = 0; ++ mc->mc_pg[0] = NULL; ++ mc->mc_flags &= ~C_INITIALIZED; ++} ++#define MDB_CURSOR_UNREF(mc, force) \ ++ (((force) || ((mc)->mc_flags & C_INITIALIZED)) \ ++ ? mdb_cursor_unref(mc) \ ++ : (void)0) ++ ++#else ++#define MDB_PAGE_UNREF(txn, mp) ++#define MDB_CURSOR_UNREF(mc, force) ((void)0) ++#endif /* MDB_VL32 */ ++ + /** Loosen or free a single page. + * Saves single pages to a list for future reuse + * in this same txn. It has been pulled from the freeDB +@@ -1803,7 +2035,7 @@ mdb_page_loose(MDB_cursor *mc, MDB_page *mp) + if (mp != dl[x].mptr) { /* bad cursor? */ + mc->mc_flags &= ~(C_INITIALIZED|C_EOF); + txn->mt_flags |= MDB_TXN_ERROR; +- return MDB_CORRUPTED; ++ return MDB_PROBLEM; + } + /* ok, it's ours */ + loose = 1; +@@ -1815,8 +2047,7 @@ mdb_page_loose(MDB_cursor *mc, MDB_page *mp) + } + } + if (loose) { +- DPRINTF(("loosen db %d page %"Z"u", DDBI(mc), +- mp->mp_pgno)); ++ DPRINTF(("loosen db %d page %"Yu, DDBI(mc), mp->mp_pgno)); + NEXT_LOOSE_PAGE(mp) = txn->mt_loose_pgs; + txn->mt_loose_pgs = mp; + txn->mt_loose_count++; +@@ -1842,7 +2073,7 @@ mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) + { + enum { Mask = P_SUBP|P_DIRTY|P_LOOSE|P_KEEP }; + MDB_txn *txn = mc->mc_txn; +- MDB_cursor *m3; ++ MDB_cursor *m3, *m0 = mc; + MDB_xcursor *mx; + MDB_page *dp, *mp; + MDB_node *leaf; +@@ -1885,7 +2116,7 @@ mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) + pgno_t pgno = txn->mt_dbs[i].md_root; + if (pgno == P_INVALID) + continue; +- if ((rc = mdb_page_get(txn, pgno, &dp, &level)) != MDB_SUCCESS) ++ if ((rc = mdb_page_get(m0, pgno, &dp, &level)) != MDB_SUCCESS) + break; + if ((dp->mp_flags & Mask) == pflags && level <= 1) + dp->mp_flags ^= P_KEEP; +@@ -2074,6 +2305,8 @@ mdb_page_dirty(MDB_txn *txn, MDB_page *mp) + * Do not modify the freedB, just merge freeDB records into me_pghead[] + * and move me_pglast to say which records were consumed. Only this + * function can create me_pghead and move me_pglast/mt_next_pgno. ++ * When #MDB_DEVEL & 2, it is not affected by #mdb_freelist_save(): it ++ * then uses the transaction's original snapshot of the freeDB. + * @param[in] mc cursor A cursor handle identifying the transaction and + * database for which we are allocating. + * @param[in] num the number of pages to allocate. +@@ -2111,8 +2344,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) + np = txn->mt_loose_pgs; + txn->mt_loose_pgs = NEXT_LOOSE_PAGE(np); + txn->mt_loose_count--; +- DPRINTF(("db %d use loose page %"Z"u", DDBI(mc), +- np->mp_pgno)); ++ DPRINTF(("db %d use loose page %"Yu, DDBI(mc), np->mp_pgno)); + *mp = np; + return MDB_SUCCESS; + } +@@ -2149,6 +2381,14 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) + last = env->me_pglast; + oldest = env->me_pgoldest; + mdb_cursor_init(&m2, txn, FREE_DBI, NULL); ++#if (MDB_DEVEL) & 2 /* "& 2" so MDB_DEVEL=1 won't hide bugs breaking freeDB */ ++ /* Use original snapshot. TODO: Should need less care in code ++ * which modifies the database. Maybe we can delete some code? ++ */ ++ m2.mc_flags |= C_ORIG_RDONLY; ++ m2.mc_db = &env->me_metas[(txn->mt_txnid-1) & 1]->mm_dbs[FREE_DBI]; ++ m2.mc_dbflag = (unsigned char *)""; /* probably unnecessary */ ++#endif + if (last) { + op = MDB_SET_RANGE; + key.mv_data = &last; /* will look up last+1 */ +@@ -2189,7 +2429,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) + } + np = m2.mc_pg[m2.mc_top]; + leaf = NODEPTR(np, m2.mc_ki[m2.mc_top]); +- if ((rc = mdb_node_read(txn, leaf, &data)) != MDB_SUCCESS) ++ if ((rc = mdb_node_read(&m2, leaf, &data)) != MDB_SUCCESS) + return rc; + + idl = (MDB_ID *) data.mv_data; +@@ -2206,10 +2446,10 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) + } + env->me_pglast = last; + #if (MDB_DEBUG) > 1 +- DPRINTF(("IDL read txn %"Z"u root %"Z"u num %u", ++ DPRINTF(("IDL read txn %"Yu" root %"Yu" num %u", + last, txn->mt_dbs[FREE_DBI].md_root, i)); + for (j = i; j; j--) +- DPRINTF(("IDL %"Z"u", idl[j])); ++ DPRINTF(("IDL %"Yu, idl[j])); + #endif + /* Merge in descending sorted order */ + mdb_midl_xmerge(mop, idl); +@@ -2224,6 +2464,20 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) + rc = MDB_MAP_FULL; + goto fail; + } ++#if defined(_WIN32) && !defined(MDB_VL32) ++ if (!(env->me_flags & MDB_RDONLY)) { ++ void *p; ++ p = (MDB_page *)(env->me_map + env->me_psize * pgno); ++ p = VirtualAlloc(p, env->me_psize * num, MEM_COMMIT, ++ (env->me_flags & MDB_WRITEMAP) ? PAGE_READWRITE: ++ PAGE_READONLY); ++ if (!p) { ++ DPUTS("VirtualAlloc failed"); ++ rc = ErrCode(); ++ goto fail; ++ } ++ } ++#endif + + search_done: + if (env->me_flags & MDB_WRITEMAP) { +@@ -2365,7 +2619,7 @@ mdb_page_touch(MDB_cursor *mc) + (rc = mdb_page_alloc(mc, 1, &np))) + goto fail; + pgno = np->mp_pgno; +- DPRINTF(("touched db %d page %"Z"u -> %"Z"u", DDBI(mc), ++ DPRINTF(("touched db %d page %"Yu" -> %"Yu, DDBI(mc), + mp->mp_pgno, pgno)); + mdb_cassert(mc, mp->mp_pgno != pgno); + mdb_midl_xappend(txn->mt_free_pgs, mp->mp_pgno); +@@ -2389,7 +2643,7 @@ mdb_page_touch(MDB_cursor *mc) + if (mp != dl[x].mptr) { /* bad cursor? */ + mc->mc_flags &= ~(C_INITIALIZED|C_EOF); + txn->mt_flags |= MDB_TXN_ERROR; +- return MDB_CORRUPTED; ++ return MDB_PROBLEM; + } + return 0; + } +@@ -2439,6 +2693,7 @@ done: + } + } + } ++ MDB_PAGE_UNREF(mc->mc_txn, mp); + return 0; + + fail: +@@ -2447,7 +2702,7 @@ fail: + } + + int +-mdb_env_sync(MDB_env *env, int force) ++mdb_env_sync0(MDB_env *env, int force, pgno_t numpgs) + { + int rc = 0; + if (env->me_flags & MDB_RDONLY) +@@ -2456,7 +2711,7 @@ mdb_env_sync(MDB_env *env, int force) + if (env->me_flags & MDB_WRITEMAP) { + int flags = ((env->me_flags & MDB_MAPASYNC) && !force) + ? MS_ASYNC : MS_SYNC; +- if (MDB_MSYNC(env->me_map, env->me_mapsize, flags)) ++ if (MDB_MSYNC(env->me_map, env->me_psize * numpgs, flags)) + rc = ErrCode(); + #ifdef _WIN32 + else if (flags == MS_SYNC && MDB_FDATASYNC(env->me_fd)) +@@ -2476,6 +2731,13 @@ mdb_env_sync(MDB_env *env, int force) + return rc; + } + ++int ++mdb_env_sync(MDB_env *env, int force) ++{ ++ MDB_meta *m = mdb_env_pick_meta(env); ++ return mdb_env_sync0(env, force, m->mm_last_pg+1); ++} ++ + /** Back up parent txn's cursors, then grab the originals for tracking */ + static int + mdb_cursor_shadow(MDB_txn *src, MDB_txn *dst) +@@ -2720,6 +2982,9 @@ mdb_txn_renew0(MDB_txn *txn) + + /* Moved to here to avoid a data race in read TXNs */ + txn->mt_next_pgno = meta->mm_last_pg+1; ++#ifdef MDB_VL32 ++ txn->mt_last_pgno = txn->mt_next_pgno - 1; ++#endif + + txn->mt_flags = flags; + +@@ -2755,7 +3020,7 @@ mdb_txn_renew(MDB_txn *txn) + + rc = mdb_txn_renew0(txn); + if (rc == MDB_SUCCESS) { +- DPRINTF(("renew txn %"Z"u%c %p on mdbenv %p, root page %"Z"u", ++ DPRINTF(("renew txn %"Yu"%c %p on mdbenv %p, root page %"Yu, + txn->mt_txnid, (txn->mt_flags & MDB_TXN_RDONLY) ? 'r' : 'w', + (void *)txn, (void *)txn->mt_env, txn->mt_dbs[MAIN_DBI].md_root)); + } +@@ -2798,6 +3063,17 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) + DPRINTF(("calloc: %s", strerror(errno))); + return ENOMEM; + } ++#ifdef MDB_VL32 ++ if (!parent) { ++ txn->mt_rpages = malloc(MDB_TRPAGE_SIZE * sizeof(MDB_ID3)); ++ if (!txn->mt_rpages) { ++ free(txn); ++ return ENOMEM; ++ } ++ txn->mt_rpages[0].mid = 0; ++ txn->mt_rpcheck = MDB_TRPAGE_SIZE/2; ++ } ++#endif + txn->mt_dbxs = env->me_dbxs; /* static */ + txn->mt_dbs = (MDB_db *) ((char *)txn + tsize); + txn->mt_dbflags = (unsigned char *)txn + size - env->me_maxdbs; +@@ -2825,6 +3101,9 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) + parent->mt_child = txn; + txn->mt_parent = parent; + txn->mt_numdbs = parent->mt_numdbs; ++#ifdef MDB_VL32 ++ txn->mt_rpages = parent->mt_rpages; ++#endif + memcpy(txn->mt_dbs, parent->mt_dbs, txn->mt_numdbs * sizeof(MDB_db)); + /* Copy parent's mt_dbflags, but clear DB_NEW */ + for (i=0; i<txn->mt_numdbs; i++) +@@ -2850,12 +3129,16 @@ renew: + rc = mdb_txn_renew0(txn); + } + if (rc) { +- if (txn != env->me_txn0) ++ if (txn != env->me_txn0) { ++#ifdef MDB_VL32 ++ free(txn->mt_rpages); ++#endif + free(txn); ++ } + } else { + txn->mt_flags |= flags; /* could not change txn=me_txn0 earlier */ + *ret = txn; +- DPRINTF(("begin txn %"Z"u%c %p on mdbenv %p, root page %"Z"u", ++ DPRINTF(("begin txn %"Yu"%c %p on mdbenv %p, root page %"Yu, + txn->mt_txnid, (flags & MDB_RDONLY) ? 'r' : 'w', + (void *) txn, (void *) env, txn->mt_dbs[MAIN_DBI].md_root)); + } +@@ -2870,7 +3153,7 @@ mdb_txn_env(MDB_txn *txn) + return txn->mt_env; + } + +-size_t ++mdb_size_t + mdb_txn_id(MDB_txn *txn) + { + if(!txn) return 0; +@@ -2922,7 +3205,7 @@ mdb_txn_end(MDB_txn *txn, unsigned mode) + /* Export or close DBI handles opened in this txn */ + mdb_dbis_update(txn, mode & MDB_END_UPDATE); + +- DPRINTF(("%s txn %"Z"u%c %p on mdbenv %p, root page %"Z"u", ++ DPRINTF(("%s txn %"Yu"%c %p on mdbenv %p, root page %"Yu, + names[mode & MDB_END_OPMASK], + txn->mt_txnid, (txn->mt_flags & MDB_TXN_RDONLY) ? 'r' : 'w', + (void *) txn, (void *)env, txn->mt_dbs[MAIN_DBI].md_root)); +@@ -2976,7 +3259,31 @@ mdb_txn_end(MDB_txn *txn, unsigned mode) + + mdb_midl_free(pghead); + } +- ++#ifdef MDB_VL32 ++ if (!txn->mt_parent) { ++ MDB_ID3L el = env->me_rpages, tl = txn->mt_rpages; ++ unsigned i, x, n = tl[0].mid; ++ pthread_mutex_lock(&env->me_rpmutex); ++ for (i = 1; i <= n; i++) { ++ if (tl[i].mid & (MDB_RPAGE_CHUNK-1)) { ++ /* tmp overflow pages that we didn't share in env */ ++ munmap(tl[i].mptr, tl[i].mcnt * env->me_psize); ++ } else { ++ x = mdb_mid3l_search(el, tl[i].mid); ++ if (tl[i].mptr == el[x].mptr) { ++ el[x].mref--; ++ } else { ++ /* another tmp overflow page */ ++ munmap(tl[i].mptr, tl[i].mcnt * env->me_psize); ++ } ++ } ++ } ++ pthread_mutex_unlock(&env->me_rpmutex); ++ tl[0].mid = 0; ++ if (mode & MDB_END_FREE) ++ free(tl); ++ } ++#endif + if (mode & MDB_END_FREE) + free(txn); + } +@@ -3008,6 +3315,9 @@ mdb_txn_abort(MDB_txn *txn) + + /** Save the freelist as of this transaction to the freeDB. + * This changes the freelist. Keep trying until it stabilizes. ++ * ++ * When (MDB_DEVEL) & 2, the changes do not affect #mdb_page_alloc(), ++ * it then uses the transaction's original snapshot of the freeDB. + */ + static int + mdb_freelist_save(MDB_txn *txn) +@@ -3096,10 +3406,10 @@ mdb_freelist_save(MDB_txn *txn) + #if (MDB_DEBUG) > 1 + { + unsigned int i = free_pgs[0]; +- DPRINTF(("IDL write txn %"Z"u root %"Z"u num %u", ++ DPRINTF(("IDL write txn %"Yu" root %"Yu" num %u", + txn->mt_txnid, txn->mt_dbs[FREE_DBI].md_root, i)); + for (; i; i--) +- DPRINTF(("IDL %"Z"u", free_pgs[i])); ++ DPRINTF(("IDL %"Yu, free_pgs[i])); + } + #endif + continue; +@@ -3210,15 +3520,16 @@ mdb_page_flush(MDB_txn *txn, int keep) + MDB_ID2L dl = txn->mt_u.dirty_list; + unsigned psize = env->me_psize, j; + int i, pagecount = dl[0].mid, rc; +- size_t size = 0, pos = 0; ++ size_t size = 0; ++ offset_t pos = 0; + pgno_t pgno = 0; + MDB_page *dp = NULL; + #ifdef _WIN32 + OVERLAPPED ov; + #else + struct iovec iov[MDB_COMMIT_PAGES]; +- ssize_t wpos = 0, wsize = 0, wres; +- size_t next_pos = 1; /* impossible pos, so pos != next_pos */ ++ ssize_t wsize = 0, wres; ++ offset_t wpos = 0, next_pos = 1; /* impossible pos, so pos != next_pos */ + int n = 0; + #endif + +@@ -3266,7 +3577,7 @@ mdb_page_flush(MDB_txn *txn, int keep) + * the write offset, to at least save the overhead of a Seek + * system call. + */ +- DPRINTF(("committing page %"Z"u", pgno)); ++ DPRINTF(("committing page %"Yu, pgno)); + memset(&ov, 0, sizeof(ov)); + ov.Offset = pos & 0xffffffff; + ov.OffsetHigh = pos >> 16 >> 16; +@@ -3317,7 +3628,7 @@ retry_seek: + wpos = pos; + wsize = 0; + } +- DPRINTF(("committing page %"Z"u", pgno)); ++ DPRINTF(("committing page %"Yu, pgno)); + next_pos = pos + size; + iov[n].iov_len = size; + iov[n].iov_base = (char *)dp; +@@ -3325,6 +3636,10 @@ retry_seek: + n++; + #endif /* _WIN32 */ + } ++#ifdef MDB_VL32 ++ if (pgno > txn->mt_last_pgno) ++ txn->mt_last_pgno = pgno; ++#endif + + /* MIPS has cache coherency issues, this is a no-op everywhere else + * Note: for any size >= on-chip cache size, entire on-chip cache is +@@ -3526,7 +3841,7 @@ mdb_txn_commit(MDB_txn *txn) + !(txn->mt_flags & (MDB_TXN_DIRTY|MDB_TXN_SPILLS))) + goto done; + +- DPRINTF(("committing txn %"Z"u %p on mdbenv %p, root page %"Z"u", ++ DPRINTF(("committing txn %"Yu" %p on mdbenv %p, root page %"Yu, + txn->mt_txnid, (void*)txn, (void*)env, txn->mt_dbs[MAIN_DBI].md_root)); + + /* Update DB root pointers */ +@@ -3564,9 +3879,12 @@ mdb_txn_commit(MDB_txn *txn) + mdb_audit(txn); + #endif + +- if ((rc = mdb_page_flush(txn, 0)) || +- (rc = mdb_env_sync(env, 0)) || +- (rc = mdb_env_write_meta(txn))) ++ if ((rc = mdb_page_flush(txn, 0))) ++ goto fail; ++ if (!F_ISSET(txn->mt_flags, MDB_TXN_NOSYNC) && ++ (rc = mdb_env_sync0(env, 0, txn->mt_next_pgno))) ++ goto fail; ++ if ((rc = mdb_env_write_meta(txn))) + goto fail; + end_mode = MDB_END_COMMITTED|MDB_END_UPDATE; + +@@ -3621,7 +3939,7 @@ mdb_env_read_header(MDB_env *env, MDB_meta *meta) + p = (MDB_page *)&pbuf; + + if (!F_ISSET(p->mp_flags, P_META)) { +- DPRINTF(("page %"Z"u not a meta page", p->mp_pgno)); ++ DPRINTF(("page %"Yu" not a meta page", p->mp_pgno)); + return MDB_INVALID; + } + +@@ -3691,7 +4009,6 @@ mdb_env_init_meta(MDB_env *env, MDB_meta *meta) + p = calloc(NUM_METAS, psize); + if (!p) + return ENOMEM; +- + p->mp_pgno = 0; + p->mp_flags = P_META; + *(MDB_meta *)METADATA(p) = *meta; +@@ -3722,8 +4039,8 @@ mdb_env_write_meta(MDB_txn *txn) + MDB_env *env; + MDB_meta meta, metab, *mp; + unsigned flags; +- size_t mapsize; +- off_t off; ++ mdb_size_t mapsize; ++ offset_t off; + int rc, len, toggle; + char *ptr; + HANDLE mfd; +@@ -3734,11 +4051,11 @@ mdb_env_write_meta(MDB_txn *txn) + #endif + + toggle = txn->mt_txnid & 1; +- DPRINTF(("writing meta page %d for root page %"Z"u", ++ DPRINTF(("writing meta page %d for root page %"Yu, + toggle, txn->mt_dbs[MAIN_DBI].md_root)); + + env = txn->mt_env; +- flags = env->me_flags; ++ flags = txn->mt_flags | env->me_flags; + mp = env->me_metas[toggle]; + mapsize = env->me_metas[toggle ^ 1]->mm_mapsize; + /* Persist any increases of mapsize config */ +@@ -3867,6 +4184,9 @@ mdb_env_create(MDB_env **env) + #ifdef MDB_USE_POSIX_SEM + e->me_rmutex = SEM_FAILED; + e->me_wmutex = SEM_FAILED; ++#elif defined MDB_USE_SYSV_SEM ++ e->me_rmutex->semid = -1; ++ e->me_wmutex->semid = -1; + #endif + e->me_pid = getpid(); + GET_PAGESIZE(e->me_os_psize); +@@ -3875,6 +4195,19 @@ mdb_env_create(MDB_env **env) + return MDB_SUCCESS; + } + ++#ifdef _WIN32 ++/** @brief Map a result from an NTAPI call to WIN32. */ ++static DWORD ++mdb_nt2win32(NTSTATUS st) ++{ ++ OVERLAPPED o = {0}; ++ DWORD br; ++ o.Internal = st; ++ GetOverlappedResult(NULL, &o, &br, FALSE); ++ return GetLastError(); ++} ++#endif ++ + static int ESECT + mdb_env_map(MDB_env *env, void *addr) + { +@@ -3882,42 +4215,51 @@ mdb_env_map(MDB_env *env, void *addr) + unsigned int flags = env->me_flags; + #ifdef _WIN32 + int rc; ++ int access = SECTION_MAP_READ; + HANDLE mh; +- LONG sizelo, sizehi; +- size_t msize; ++ void *map; ++ SIZE_T msize; ++ ULONG pageprot = PAGE_READONLY, secprot, alloctype; + ++ if (flags & MDB_WRITEMAP) { ++ access |= SECTION_MAP_WRITE; ++ pageprot = PAGE_READWRITE; ++ } + if (flags & MDB_RDONLY) { +- /* Don't set explicit map size, use whatever exists */ ++ secprot = PAGE_READONLY; + msize = 0; +- sizelo = 0; +- sizehi = 0; ++ alloctype = 0; + } else { ++ secprot = PAGE_READWRITE; + msize = env->me_mapsize; +- sizelo = msize & 0xffffffff; +- sizehi = msize >> 16 >> 16; /* only needed on Win64 */ +- +- /* Windows won't create mappings for zero length files. +- * and won't map more than the file size. +- * Just set the maxsize right now. +- */ +- if (SetFilePointer(env->me_fd, sizelo, &sizehi, 0) != (DWORD)sizelo +- || !SetEndOfFile(env->me_fd) +- || SetFilePointer(env->me_fd, 0, NULL, 0) != 0) +- return ErrCode(); ++ alloctype = MEM_RESERVE; + } + +- mh = CreateFileMapping(env->me_fd, NULL, flags & MDB_WRITEMAP ? +- PAGE_READWRITE : PAGE_READONLY, +- sizehi, sizelo, NULL); +- if (!mh) +- return ErrCode(); +- env->me_map = MapViewOfFileEx(mh, flags & MDB_WRITEMAP ? +- FILE_MAP_WRITE : FILE_MAP_READ, +- 0, 0, msize, addr); +- rc = env->me_map ? 0 : ErrCode(); +- CloseHandle(mh); ++ rc = NtCreateSection(&mh, access, NULL, NULL, secprot, SEC_RESERVE, env->me_fd); + if (rc) +- return rc; ++ return mdb_nt2win32(rc); ++ map = addr; ++#ifdef MDB_VL32 ++ msize = NUM_METAS * env->me_psize; ++#endif ++ rc = NtMapViewOfSection(mh, GetCurrentProcess(), &map, 0, 0, NULL, &msize, ViewUnmap, alloctype, pageprot); ++#ifdef MDB_VL32 ++ env->me_fmh = mh; ++#else ++ NtClose(mh); ++#endif ++ if (rc) ++ return mdb_nt2win32(rc); ++ env->me_map = map; ++#else ++#ifdef MDB_VL32 ++ (void) flags; ++ env->me_map = mmap(addr, NUM_METAS * env->me_psize, PROT_READ, MAP_SHARED, ++ env->me_fd, 0); ++ if (env->me_map == MAP_FAILED) { ++ env->me_map = NULL; ++ return ErrCode(); ++ } + #else + int prot = PROT_READ; + if (flags & MDB_WRITEMAP) { +@@ -3951,6 +4293,7 @@ mdb_env_map(MDB_env *env, void *addr) + */ + if (addr && env->me_map != addr) + return EBUSY; /* TODO: Make a new MDB_* error code? */ ++#endif + + p = (MDB_page *)env->me_map; + env->me_metas[0] = METADATA(p); +@@ -3960,15 +4303,17 @@ mdb_env_map(MDB_env *env, void *addr) + } + + int ESECT +-mdb_env_set_mapsize(MDB_env *env, size_t size) ++mdb_env_set_mapsize(MDB_env *env, mdb_size_t size) + { + /* If env is already open, caller is responsible for making + * sure there are no active txns. + */ + if (env->me_map) { +- int rc; + MDB_meta *meta; ++#ifndef MDB_VL32 + void *old; ++ int rc; ++#endif + if (env->me_txn) + return EINVAL; + meta = mdb_env_pick_meta(env); +@@ -3976,16 +4321,21 @@ mdb_env_set_mapsize(MDB_env *env, size_t size) + size = meta->mm_mapsize; + { + /* Silently round up to minimum if the size is too small */ +- size_t minsize = (meta->mm_last_pg + 1) * env->me_psize; ++ mdb_size_t minsize = (meta->mm_last_pg + 1) * env->me_psize; + if (size < minsize) + size = minsize; + } ++#ifndef MDB_VL32 ++ /* For MDB_VL32 this bit is a noop since we dynamically remap ++ * chunks of the DB anyway. ++ */ + munmap(env->me_map, env->me_mapsize); + env->me_mapsize = size; + old = (env->me_flags & MDB_FIXEDMAP) ? env->me_map : NULL; + rc = mdb_env_map(env, old); + if (rc) + return rc; ++#endif /* !MDB_VL32 */ + } + env->me_mapsize = size; + if (env->me_psize) +@@ -4021,7 +4371,7 @@ mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers) + } + + static int ESECT +-mdb_fsize(HANDLE fd, size_t *size) ++mdb_fsize(HANDLE fd, mdb_size_t *size) + { + #ifdef _WIN32 + LARGE_INTEGER fsize; +@@ -4135,7 +4485,7 @@ mdb_env_open2(MDB_env *env) + /* Make sure mapsize >= committed data size. Even when using + * mm_mapsize, which could be broken in old files (ITS#7789). + */ +- size_t minsize = (meta.mm_last_pg + 1) * meta.mm_psize; ++ mdb_size_t minsize = (meta.mm_last_pg + 1) * meta.mm_psize; + if (env->me_mapsize < minsize) + env->me_mapsize = minsize; + } +@@ -4154,6 +4504,18 @@ mdb_env_open2(MDB_env *env) + return rc; + newenv = 0; + } ++#ifdef _WIN32 ++ /* For FIXEDMAP, make sure the file is non-empty before we attempt to map it */ ++ if (newenv) { ++ char dummy = 0; ++ DWORD len; ++ rc = WriteFile(env->me_fd, &dummy, 1, &len, NULL); ++ if (!rc) { ++ rc = ErrCode(); ++ return rc; ++ } ++ } ++#endif + + rc = mdb_env_map(env, (flags & MDB_FIXEDMAP) ? meta.mm_address : NULL); + if (rc) +@@ -4183,13 +4545,13 @@ mdb_env_open2(MDB_env *env) + + DPRINTF(("opened database version %u, pagesize %u", + meta->mm_version, env->me_psize)); +- DPRINTF(("using meta page %d", (int) (meta->mm_txnid & 1))); +- DPRINTF(("depth: %u", db->md_depth)); +- DPRINTF(("entries: %"Z"u", db->md_entries)); +- DPRINTF(("branch pages: %"Z"u", db->md_branch_pages)); +- DPRINTF(("leaf pages: %"Z"u", db->md_leaf_pages)); +- DPRINTF(("overflow pages: %"Z"u", db->md_overflow_pages)); +- DPRINTF(("root: %"Z"u", db->md_root)); ++ DPRINTF(("using meta page %d", (int) (meta->mm_txnid & 1))); ++ DPRINTF(("depth: %u", db->md_depth)); ++ DPRINTF(("entries: %"Yu, db->md_entries)); ++ DPRINTF(("branch pages: %"Yu, db->md_branch_pages)); ++ DPRINTF(("leaf pages: %"Yu, db->md_leaf_pages)); ++ DPRINTF(("overflow pages: %"Yu, db->md_overflow_pages)); ++ DPRINTF(("root: %"Yu, db->md_root)); + } + #endif + +@@ -4465,8 +4827,12 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) + # define MDB_CLOEXEC 0 + #endif + #endif ++#ifdef MDB_USE_SYSV_SEM ++ int semid; ++ union semun semu; ++#endif + int rc; +- off_t size, rsize; ++ offset_t size, rsize; + + #ifdef _WIN32 + wchar_t *wlpath; +@@ -4616,19 +4982,42 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) + env->me_wmutex = sem_open(env->me_txns->mti_wmname, + O_CREAT|O_EXCL, mode, 1); + if (env->me_wmutex == SEM_FAILED) goto fail_errno; ++#elif defined(MDB_USE_SYSV_SEM) ++ unsigned short vals[2] = {1, 1}; ++ key_t key = ftok(lpath, 'M'); ++ if (key == -1) ++ goto fail_errno; ++ semid = semget(key, 2, (mode & 0777) | IPC_CREAT); ++ if (semid < 0) ++ goto fail_errno; ++ semu.array = vals; ++ if (semctl(semid, 0, SETALL, semu) < 0) ++ goto fail_errno; ++ env->me_txns->mti_semid = semid; ++ env->me_txns->mti_rlocked = 0; ++ env->me_txns->mti_wlocked = 0; + #else /* MDB_USE_POSIX_MUTEX: */ + pthread_mutexattr_t mattr; + +- if ((rc = pthread_mutexattr_init(&mattr)) +- || (rc = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) ++ /* Solaris needs this before initing a robust mutex. Otherwise ++ * it may skip the init and return EBUSY "seems someone already ++ * inited" or EINVAL "it was inited differently". ++ */ ++ memset(env->me_txns->mti_rmutex, 0, sizeof(*env->me_txns->mti_rmutex)); ++ memset(env->me_txns->mti_wmutex, 0, sizeof(*env->me_txns->mti_wmutex)); ++ ++ if ((rc = pthread_mutexattr_init(&mattr)) != 0) ++ goto fail; ++ rc = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); + #ifdef MDB_ROBUST_SUPPORTED +- || (rc = pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST)) ++ if (!rc) rc = pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST); + #endif +- || (rc = pthread_mutex_init(env->me_txns->mti_rmutex, &mattr)) +- || (rc = pthread_mutex_init(env->me_txns->mti_wmutex, &mattr))) +- goto fail; ++ if (!rc) rc = pthread_mutex_init(env->me_txns->mti_rmutex, &mattr); ++ if (!rc) rc = pthread_mutex_init(env->me_txns->mti_wmutex, &mattr); + pthread_mutexattr_destroy(&mattr); +-#endif /* _WIN32 || MDB_USE_POSIX_SEM */ ++ if (rc) ++ goto fail; ++#endif /* _WIN32 || ... */ + + env->me_txns->mti_magic = MDB_MAGIC; + env->me_txns->mti_format = MDB_LOCK_FORMAT; +@@ -4636,6 +5025,9 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) + env->me_txns->mti_numreaders = 0; + + } else { ++#ifdef MDB_USE_SYSV_SEM ++ struct semid_ds buf; ++#endif + if (env->me_txns->mti_magic != MDB_MAGIC) { + DPUTS("lock region has invalid magic"); + rc = MDB_INVALID; +@@ -4661,8 +5053,33 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) + if (env->me_rmutex == SEM_FAILED) goto fail_errno; + env->me_wmutex = sem_open(env->me_txns->mti_wmname, 0); + if (env->me_wmutex == SEM_FAILED) goto fail_errno; ++#elif defined(MDB_USE_SYSV_SEM) ++ semid = env->me_txns->mti_semid; ++ semu.buf = &buf; ++ /* check for read access */ ++ if (semctl(semid, 0, IPC_STAT, semu) < 0) ++ goto fail_errno; ++ /* check for write access */ ++ if (semctl(semid, 0, IPC_SET, semu) < 0) ++ goto fail_errno; + #endif + } ++#ifdef MDB_USE_SYSV_SEM ++ env->me_rmutex->semid = semid; ++ env->me_wmutex->semid = semid; ++ env->me_rmutex->semnum = 0; ++ env->me_wmutex->semnum = 1; ++ env->me_rmutex->locked = &env->me_txns->mti_rlocked; ++ env->me_wmutex->locked = &env->me_txns->mti_wlocked; ++#endif ++#ifdef MDB_VL32 ++#ifdef _WIN32 ++ env->me_rpmutex = CreateMutex(NULL, FALSE, NULL); ++#else ++ pthread_mutex_init(&env->me_rpmutex, NULL); ++#endif ++#endif ++ + return MDB_SUCCESS; + + fail_errno: +@@ -4701,6 +5118,17 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode + if (env->me_fd!=INVALID_HANDLE_VALUE || (flags & ~(CHANGEABLE|CHANGELESS))) + return EINVAL; + ++#ifdef MDB_VL32 ++ if (flags & MDB_WRITEMAP) { ++ /* silently ignore WRITEMAP in 32 bit mode */ ++ flags ^= MDB_WRITEMAP; ++ } ++ if (flags & MDB_FIXEDMAP) { ++ /* cannot support FIXEDMAP */ ++ return EINVAL; ++ } ++#endif ++ + len = strlen(path); + if (flags & MDB_NOSUBDIR) { + rc = len + sizeof(LOCKSUFF) + len + 1; +@@ -4730,6 +5158,17 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode + (env->me_dirty_list = calloc(MDB_IDL_UM_SIZE, sizeof(MDB_ID2))))) + rc = ENOMEM; + } ++#ifdef MDB_VL32 ++ if (!rc) { ++ env->me_rpages = malloc(MDB_ERPAGE_SIZE * sizeof(MDB_ID3)); ++ if (!env->me_rpages) { ++ rc = ENOMEM; ++ goto leave; ++ } ++ env->me_rpages[0].mid = 0; ++ env->me_rpcheck = MDB_ERPAGE_SIZE/2; ++ } ++#endif + env->me_flags = flags |= MDB_ENV_ACTIVE; + if (rc) + goto leave; +@@ -4828,6 +5267,16 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode + txn->mt_dbiseqs = (unsigned int *)(txn->mt_cursors + env->me_maxdbs); + txn->mt_dbflags = (unsigned char *)(txn->mt_dbiseqs + env->me_maxdbs); + txn->mt_env = env; ++#ifdef MDB_VL32 ++ txn->mt_rpages = malloc(MDB_TRPAGE_SIZE * sizeof(MDB_ID3)); ++ if (!txn->mt_rpages) { ++ free(txn); ++ rc = ENOMEM; ++ goto leave; ++ } ++ txn->mt_rpages[0].mid = 0; ++ txn->mt_rpcheck = MDB_TRPAGE_SIZE/2; ++#endif + txn->mt_dbxs = env->me_dbxs; + txn->mt_flags = MDB_TXN_FINISHED; + env->me_txn0 = txn; +@@ -4866,6 +5315,15 @@ mdb_env_close0(MDB_env *env, int excl) + free(env->me_dbflags); + free(env->me_path); + free(env->me_dirty_list); ++#ifdef MDB_VL32 ++ if (env->me_txn0 && env->me_txn0->mt_rpages) ++ free(env->me_txn0->mt_rpages); ++ { unsigned int x; ++ for (x=1; x<=env->me_rpages[0].mid; x++) ++ munmap(env->me_rpages[x].mptr, env->me_rpages[x].mcnt * env->me_psize); ++ } ++ free(env->me_rpages); ++#endif + free(env->me_txn0); + mdb_midl_free(env->me_free_pgs); + +@@ -4883,7 +5341,11 @@ mdb_env_close0(MDB_env *env, int excl) + } + + if (env->me_map) { ++#ifdef MDB_VL32 ++ munmap(env->me_map, NUM_METAS*env->me_psize); ++#else + munmap(env->me_map, env->me_mapsize); ++#endif + } + if (env->me_mfd != env->me_fd && env->me_mfd != INVALID_HANDLE_VALUE) + (void) close(env->me_mfd); +@@ -4924,6 +5386,16 @@ mdb_env_close0(MDB_env *env, int excl) + sem_unlink(env->me_txns->mti_wmname); + } + } ++#elif defined(MDB_USE_SYSV_SEM) ++ if (env->me_rmutex->semid != -1) { ++ /* If we have the filelock: If we are the ++ * only remaining user, clean up semaphores. ++ */ ++ if (excl == 0) ++ mdb_env_excl_lock(env, &excl); ++ if (excl > 0) ++ semctl(env->me_rmutex->semid, 0, IPC_RMID); ++ } + #endif + munmap((void *)env->me_txns, (env->me_maxreaders-1)*sizeof(MDB_reader)+sizeof(MDB_txninfo)); + } +@@ -4938,6 +5410,14 @@ mdb_env_close0(MDB_env *env, int excl) + #endif + (void) close(env->me_lfd); + } ++#ifdef MDB_VL32 ++#ifdef _WIN32 ++ if (env->me_fmh) CloseHandle(env->me_fmh); ++ if (env->me_rpmutex) CloseHandle(env->me_rpmutex); ++#else ++ pthread_mutex_destroy(&env->me_rpmutex); ++#endif ++#endif + + env->me_flags &= ~(MDB_ENV_ACTIVE|MDB_ENV_TXKEY); + } +@@ -4961,18 +5441,18 @@ mdb_env_close(MDB_env *env) + free(env); + } + +-/** Compare two items pointing at aligned size_t's */ ++/** Compare two items pointing at aligned #mdb_size_t's */ + static int + mdb_cmp_long(const MDB_val *a, const MDB_val *b) + { +- return (*(size_t *)a->mv_data < *(size_t *)b->mv_data) ? -1 : +- *(size_t *)a->mv_data > *(size_t *)b->mv_data; ++ return (*(mdb_size_t *)a->mv_data < *(mdb_size_t *)b->mv_data) ? -1 : ++ *(mdb_size_t *)a->mv_data > *(mdb_size_t *)b->mv_data; + } + + /** Compare two items pointing at aligned unsigned int's. + * + * This is also set as #MDB_INTEGERDUP|#MDB_DUPFIXED's #MDB_dbx.%md_dcmp, +- * but #mdb_cmp_clong() is called instead if the data type is size_t. ++ * but #mdb_cmp_clong() is called instead if the data type is #mdb_size_t. + */ + static int + mdb_cmp_int(const MDB_val *a, const MDB_val *b) +@@ -5077,7 +5557,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) + + nkeys = NUMKEYS(mp); + +- DPRINTF(("searching %u keys in %s %spage %"Z"u", ++ DPRINTF(("searching %u keys in %s %spage %"Yu, + nkeys, IS_LEAF(mp) ? "leaf" : "branch", IS_SUBP(mp) ? "sub-" : "", + mdb_dbg_pgno(mp))); + +@@ -5089,7 +5569,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) + * alignment is guaranteed. Use faster mdb_cmp_int. + */ + if (cmp == mdb_cmp_cint && IS_BRANCH(mp)) { +- if (NODEPTR(mp, 1)->mn_ksize == sizeof(size_t)) ++ if (NODEPTR(mp, 1)->mn_ksize == sizeof(mdb_size_t)) + cmp = mdb_cmp_long; + else + cmp = mdb_cmp_int; +@@ -5125,7 +5605,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) + DPRINTF(("found leaf index %u [%s], rc = %i", + i, DKEY(&nodekey), rc)); + else +- DPRINTF(("found branch index %u [%s -> %"Z"u], rc = %i", ++ DPRINTF(("found branch index %u [%s -> %"Yu"], rc = %i", + i, DKEY(&nodekey), NODEPGNO(node), rc)); + #endif + if (rc == 0) +@@ -5173,7 +5653,7 @@ static void + mdb_cursor_pop(MDB_cursor *mc) + { + if (mc->mc_snum) { +- DPRINTF(("popping page %"Z"u off db %d cursor %p", ++ DPRINTF(("popping page %"Yu" off db %d cursor %p", + mc->mc_pg[mc->mc_top]->mp_pgno, DDBI(mc), (void *) mc)); + + mc->mc_snum--; +@@ -5189,7 +5669,7 @@ mdb_cursor_pop(MDB_cursor *mc) + static int + mdb_cursor_push(MDB_cursor *mc, MDB_page *mp) + { +- DPRINTF(("pushing page %"Z"u on db %d cursor %p", mp->mp_pgno, ++ DPRINTF(("pushing page %"Yu" on db %d cursor %p", mp->mp_pgno, + DDBI(mc), (void *) mc)); + + if (mc->mc_snum >= CURSOR_STACK) { +@@ -5204,21 +5684,309 @@ mdb_cursor_push(MDB_cursor *mc, MDB_page *mp) + return MDB_SUCCESS; + } + +-/** Find the address of the page corresponding to a given page number. ++#ifdef MDB_VL32 ++/** Map a read-only page. ++ * There are two levels of tracking in use, a per-txn list and a per-env list. ++ * ref'ing and unref'ing the per-txn list is faster since it requires no ++ * locking. Pages are cached in the per-env list for global reuse, and a lock ++ * is required. Pages are not immediately unmapped when their refcnt goes to ++ * zero; they hang around in case they will be reused again soon. ++ * ++ * When the per-txn list gets full, all pages with refcnt=0 are purged from the ++ * list and their refcnts in the per-env list are decremented. ++ * ++ * When the per-env list gets full, all pages with refcnt=0 are purged from the ++ * list and their pages are unmapped. ++ * ++ * @note "full" means the list has reached its respective rpcheck threshold. ++ * This threshold slowly raises if no pages could be purged on a given check, ++ * and returns to its original value when enough pages were purged. ++ * ++ * If purging doesn't free any slots, filling the per-txn list will return ++ * MDB_TXN_FULL, and filling the per-env list returns MDB_MAP_FULL. ++ * ++ * Reference tracking in a txn is imperfect, pages can linger with non-zero ++ * refcnt even without active references. It was deemed to be too invasive ++ * to add unrefs in every required location. However, all pages are unref'd ++ * at the end of the transaction. This guarantees that no stale references ++ * linger in the per-env list. ++ * ++ * Usually we map chunks of 16 pages at a time, but if an overflow page begins ++ * at the tail of the chunk we extend the chunk to include the entire overflow ++ * page. Unfortunately, pages can be turned into overflow pages after their ++ * chunk was already mapped. In that case we must remap the chunk if the ++ * overflow page is referenced. If the chunk's refcnt is 0 we can just remap ++ * it, otherwise we temporarily map a new chunk just for the overflow page. ++ * ++ * @note this chunk handling means we cannot guarantee that a data item ++ * returned from the DB will stay alive for the duration of the transaction: ++ * We unref pages as soon as a cursor moves away from the page ++ * A subsequent op may cause a purge, which may unmap any unref'd chunks ++ * The caller must copy the data if it must be used later in the same txn. ++ * ++ * Also - our reference counting revolves around cursors, but overflow pages ++ * aren't pointed to by a cursor's page stack. We have to remember them ++ * explicitly, in the added mc_ovpg field. A single cursor can only hold a ++ * reference to one overflow page at a time. ++ * + * @param[in] txn the transaction for this access. + * @param[in] pgno the page number for the page to retrieve. + * @param[out] ret address of a pointer where the page's address will be stored. +- * @param[out] lvl dirty_list inheritance level of found page. 1=current txn, 0=mapped page. + * @return 0 on success, non-zero on failure. + */ + static int +-mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) ++mdb_rpage_get(MDB_txn *txn, pgno_t pg0, MDB_page **ret) + { + MDB_env *env = txn->mt_env; ++ MDB_page *p; ++ MDB_ID3L tl = txn->mt_rpages; ++ MDB_ID3L el = env->me_rpages; ++ MDB_ID3 id3; ++ unsigned x, rem; ++ pgno_t pgno; ++ int rc, retries = 1; ++#ifdef _WIN32 ++ LARGE_INTEGER off; ++ SIZE_T len; ++#define SET_OFF(off,val) off.QuadPart = val ++#define MAP(rc,env,addr,len,off) \ ++ addr = NULL; \ ++ rc = NtMapViewOfSection(env->me_fmh, GetCurrentProcess(), &addr, 0, \ ++ len, &off, &len, ViewUnmap, (env->me_flags & MDB_RDONLY) ? 0 : MEM_RESERVE, PAGE_READONLY); \ ++ if (rc) rc = mdb_nt2win32(rc) ++#else ++ offset_t off; ++ size_t len; ++#define SET_OFF(off,val) off = val ++#define MAP(rc,env,addr,len,off) \ ++ addr = mmap(NULL, len, PROT_READ, MAP_SHARED, env->me_fd, off); \ ++ rc = (addr == MAP_FAILED) ? errno : 0 ++#endif ++ ++ /* remember the offset of the actual page number, so we can ++ * return the correct pointer at the end. ++ */ ++ rem = pg0 & (MDB_RPAGE_CHUNK-1); ++ pgno = pg0 ^ rem; ++ ++ id3.mid = 0; ++ x = mdb_mid3l_search(tl, pgno); ++ if (x <= tl[0].mid && tl[x].mid == pgno) { ++ if (x != tl[0].mid && tl[x+1].mid == pg0) ++ x++; ++ /* check for overflow size */ ++ p = (MDB_page *)((char *)tl[x].mptr + rem * env->me_psize); ++ if (IS_OVERFLOW(p) && p->mp_pages + rem > tl[x].mcnt) { ++ id3.mcnt = p->mp_pages + rem; ++ len = id3.mcnt * env->me_psize; ++ SET_OFF(off, pgno * env->me_psize); ++ MAP(rc, env, id3.mptr, len, off); ++ if (rc) ++ return rc; ++ /* check for local-only page */ ++ if (rem) { ++ mdb_tassert(txn, tl[x].mid != pg0); ++ /* hope there's room to insert this locally. ++ * setting mid here tells later code to just insert ++ * this id3 instead of searching for a match. ++ */ ++ id3.mid = pg0; ++ goto notlocal; ++ } else { ++ /* ignore the mapping we got from env, use new one */ ++ tl[x].mptr = id3.mptr; ++ tl[x].mcnt = id3.mcnt; ++ /* if no active ref, see if we can replace in env */ ++ if (!tl[x].mref) { ++ unsigned i; ++ pthread_mutex_lock(&env->me_rpmutex); ++ i = mdb_mid3l_search(el, tl[x].mid); ++ if (el[i].mref == 1) { ++ /* just us, replace it */ ++ munmap(el[i].mptr, el[i].mcnt * env->me_psize); ++ el[i].mptr = tl[x].mptr; ++ el[i].mcnt = tl[x].mcnt; ++ } else { ++ /* there are others, remove ourself */ ++ el[i].mref--; ++ } ++ pthread_mutex_unlock(&env->me_rpmutex); ++ } ++ } ++ } ++ id3.mptr = tl[x].mptr; ++ id3.mcnt = tl[x].mcnt; ++ tl[x].mref++; ++ goto ok; ++ } ++ ++notlocal: ++ if (tl[0].mid >= MDB_TRPAGE_MAX - txn->mt_rpcheck) { ++ unsigned i, y; ++ /* purge unref'd pages from our list and unref in env */ ++ pthread_mutex_lock(&env->me_rpmutex); ++retry: ++ y = 0; ++ for (i=1; i<=tl[0].mid; i++) { ++ if (!tl[i].mref) { ++ if (!y) y = i; ++ /* tmp overflow pages don't go to env */ ++ if (tl[i].mid & (MDB_RPAGE_CHUNK-1)) { ++ munmap(tl[i].mptr, tl[i].mcnt * env->me_psize); ++ continue; ++ } ++ x = mdb_mid3l_search(el, tl[i].mid); ++ el[x].mref--; ++ } ++ } ++ pthread_mutex_unlock(&env->me_rpmutex); ++ if (!y) { ++ /* we didn't find any unref'd chunks. ++ * if we're out of room, fail. ++ */ ++ if (tl[0].mid >= MDB_TRPAGE_MAX) ++ return MDB_TXN_FULL; ++ /* otherwise, raise threshold for next time around ++ * and let this go. ++ */ ++ txn->mt_rpcheck /= 2; ++ } else { ++ /* we found some unused; consolidate the list */ ++ for (i=y+1; i<= tl[0].mid; i++) ++ if (tl[i].mref) ++ tl[y++] = tl[i]; ++ tl[0].mid = y-1; ++ /* decrease the check threshold toward its original value */ ++ if (!txn->mt_rpcheck) ++ txn->mt_rpcheck = 1; ++ while (txn->mt_rpcheck < tl[0].mid && txn->mt_rpcheck < MDB_TRPAGE_SIZE/2) ++ txn->mt_rpcheck *= 2; ++ } ++ } ++ if (tl[0].mid < MDB_TRPAGE_SIZE) { ++ id3.mref = 1; ++ if (id3.mid) ++ goto found; ++ /* don't map past last written page in read-only envs */ ++ if ((env->me_flags & MDB_RDONLY) && pgno + MDB_RPAGE_CHUNK-1 > txn->mt_last_pgno) ++ id3.mcnt = txn->mt_last_pgno + 1 - pgno; ++ else ++ id3.mcnt = MDB_RPAGE_CHUNK; ++ len = id3.mcnt * env->me_psize; ++ id3.mid = pgno; ++ ++ /* search for page in env */ ++ pthread_mutex_lock(&env->me_rpmutex); ++ x = mdb_mid3l_search(el, pgno); ++ if (x <= el[0].mid && el[x].mid == pgno) { ++ id3.mptr = el[x].mptr; ++ id3.mcnt = el[x].mcnt; ++ /* check for overflow size */ ++ p = (MDB_page *)((char *)id3.mptr + rem * env->me_psize); ++ if (IS_OVERFLOW(p) && p->mp_pages + rem > id3.mcnt) { ++ id3.mcnt = p->mp_pages + rem; ++ len = id3.mcnt * env->me_psize; ++ SET_OFF(off, pgno * env->me_psize); ++ MAP(rc, env, id3.mptr, len, off); ++ if (rc) ++ goto fail; ++ if (!el[x].mref) { ++ munmap(el[x].mptr, env->me_psize * el[x].mcnt); ++ el[x].mptr = id3.mptr; ++ el[x].mcnt = id3.mcnt; ++ } else { ++ id3.mid = pg0; ++ pthread_mutex_unlock(&env->me_rpmutex); ++ goto found; ++ } ++ } ++ el[x].mref++; ++ pthread_mutex_unlock(&env->me_rpmutex); ++ goto found; ++ } ++ if (el[0].mid >= MDB_ERPAGE_MAX - env->me_rpcheck) { ++ /* purge unref'd pages */ ++ unsigned i, y = 0; ++ for (i=1; i<=el[0].mid; i++) { ++ if (!el[i].mref) { ++ if (!y) y = i; ++ munmap(el[i].mptr, env->me_psize * el[i].mcnt); ++ } ++ } ++ if (!y) { ++ if (retries) { ++ /* see if we can unref some local pages */ ++ retries--; ++ id3.mid = 0; ++ goto retry; ++ } ++ if (el[0].mid >= MDB_ERPAGE_MAX) { ++ pthread_mutex_unlock(&env->me_rpmutex); ++ return MDB_MAP_FULL; ++ } ++ env->me_rpcheck /= 2; ++ } else { ++ for (i=y+1; i<= el[0].mid; i++) ++ if (el[i].mref) ++ el[y++] = el[i]; ++ el[0].mid = y-1; ++ if (!env->me_rpcheck) ++ env->me_rpcheck = 1; ++ while (env->me_rpcheck < el[0].mid && env->me_rpcheck < MDB_ERPAGE_SIZE/2) ++ env->me_rpcheck *= 2; ++ } ++ } ++ SET_OFF(off, pgno * env->me_psize); ++ MAP(rc, env, id3.mptr, len, off); ++ if (rc) { ++fail: ++ pthread_mutex_unlock(&env->me_rpmutex); ++ return rc; ++ } ++ /* check for overflow size */ ++ p = (MDB_page *)((char *)id3.mptr + rem * env->me_psize); ++ if (IS_OVERFLOW(p) && p->mp_pages + rem > id3.mcnt) { ++ id3.mcnt = p->mp_pages + rem; ++ munmap(id3.mptr, len); ++ len = id3.mcnt * env->me_psize; ++ MAP(rc, env, id3.mptr, len, off); ++ if (rc) ++ goto fail; ++ } ++ mdb_mid3l_insert(el, &id3); ++ pthread_mutex_unlock(&env->me_rpmutex); ++found: ++ mdb_mid3l_insert(tl, &id3); ++ } else { ++ return MDB_TXN_FULL; ++ } ++ok: ++ p = (MDB_page *)((char *)id3.mptr + rem * env->me_psize); ++#if MDB_DEBUG /* we don't need this check any more */ ++ if (IS_OVERFLOW(p)) { ++ mdb_tassert(txn, p->mp_pages + rem <= id3.mcnt); ++ } ++#endif ++ *ret = p; ++ return MDB_SUCCESS; ++} ++#endif ++ ++/** Find the address of the page corresponding to a given page number. ++ * @param[in] mc the cursor accessing the page. ++ * @param[in] pgno the page number for the page to retrieve. ++ * @param[out] ret address of a pointer where the page's address will be stored. ++ * @param[out] lvl dirty_list inheritance level of found page. 1=current txn, 0=mapped page. ++ * @return 0 on success, non-zero on failure. ++ */ ++static int ++mdb_page_get(MDB_cursor *mc, pgno_t pgno, MDB_page **ret, int *lvl) ++{ ++ MDB_txn *txn = mc->mc_txn; + MDB_page *p = NULL; + int level; + +- if (! (txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_WRITEMAP))) { ++ if (! (mc->mc_flags & (C_ORIG_RDONLY|C_WRITEMAP))) { + MDB_txn *tx2 = txn; + level = 1; + do { +@@ -5233,8 +6001,7 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) + MDB_ID pn = pgno << 1; + x = mdb_midl_search(tx2->mt_spill_pgs, pn); + if (x <= tx2->mt_spill_pgs[0] && tx2->mt_spill_pgs[x] == pn) { +- p = (MDB_page *)(env->me_map + env->me_psize * pgno); +- goto done; ++ goto mapped; + } + } + if (dl[0].mid) { +@@ -5248,15 +6015,26 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) + } while ((tx2 = tx2->mt_parent) != NULL); + } + +- if (pgno < txn->mt_next_pgno) { +- level = 0; +- p = (MDB_page *)(env->me_map + env->me_psize * pgno); +- } else { +- DPRINTF(("page %"Z"u not found", pgno)); ++ if (pgno >= txn->mt_next_pgno) { ++ DPRINTF(("page %"Yu" not found", pgno)); + txn->mt_flags |= MDB_TXN_ERROR; + return MDB_PAGE_NOTFOUND; + } + ++ level = 0; ++ ++mapped: ++ { ++#ifdef MDB_VL32 ++ int rc = mdb_rpage_get(txn, pgno, &p); ++ if (rc) ++ return rc; ++#else ++ MDB_env *env = txn->mt_env; ++ p = (MDB_page *)(env->me_map + env->me_psize * pgno); ++#endif ++ } ++ + done: + *ret = p; + if (lvl) +@@ -5278,13 +6056,13 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) + MDB_node *node; + indx_t i; + +- DPRINTF(("branch page %"Z"u has %u keys", mp->mp_pgno, NUMKEYS(mp))); ++ DPRINTF(("branch page %"Yu" has %u keys", mp->mp_pgno, NUMKEYS(mp))); + /* Don't assert on branch pages in the FreeDB. We can get here + * while in the process of rebalancing a FreeDB branch page; we must + * let that proceed. ITS#8336 + */ + mdb_cassert(mc, !mc->mc_dbi || NUMKEYS(mp) > 1); +- DPRINTF(("found index 0 to page %"Z"u", NODEPGNO(NODEPTR(mp, 0)))); ++ DPRINTF(("found index 0 to page %"Yu, NODEPGNO(NODEPTR(mp, 0)))); + + if (flags & (MDB_PS_FIRST|MDB_PS_LAST)) { + i = 0; +@@ -5308,7 +6086,7 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) + mdb_cassert(mc, i < NUMKEYS(mp)); + node = NODEPTR(mp, i); + +- if ((rc = mdb_page_get(mc->mc_txn, NODEPGNO(node), &mp, NULL)) != 0) ++ if ((rc = mdb_page_get(mc, NODEPGNO(node), &mp, NULL)) != 0) + return rc; + + mc->mc_ki[mc->mc_top] = i; +@@ -5329,7 +6107,7 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) + return MDB_CORRUPTED; + } + +- DPRINTF(("found leaf page %"Z"u for key [%s]", mp->mp_pgno, ++ DPRINTF(("found leaf page %"Yu" for key [%s]", mp->mp_pgno, + key ? DKEY(key) : "null")); + mc->mc_flags |= C_INITIALIZED; + mc->mc_flags &= ~C_EOF; +@@ -5350,7 +6128,7 @@ mdb_page_search_lowest(MDB_cursor *mc) + MDB_node *node = NODEPTR(mp, 0); + int rc; + +- if ((rc = mdb_page_get(mc->mc_txn, NODEPGNO(node), &mp, NULL)) != 0) ++ if ((rc = mdb_page_get(mc, NODEPGNO(node), &mp, NULL)) != 0) + return rc; + + mc->mc_ki[mc->mc_top] = 0; +@@ -5402,7 +6180,7 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags) + return MDB_NOTFOUND; + if ((leaf->mn_flags & (F_DUPDATA|F_SUBDATA)) != F_SUBDATA) + return MDB_INCOMPATIBLE; /* not a named DB */ +- rc = mdb_node_read(mc->mc_txn, leaf, &data); ++ rc = mdb_node_read(&mc2, leaf, &data); + if (rc) + return rc; + memcpy(&flags, ((char *) data.mv_data + offsetof(MDB_db, md_flags)), +@@ -5425,14 +6203,26 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags) + } + + mdb_cassert(mc, root > 1); +- if (!mc->mc_pg[0] || mc->mc_pg[0]->mp_pgno != root) +- if ((rc = mdb_page_get(mc->mc_txn, root, &mc->mc_pg[0], NULL)) != 0) ++ if (!mc->mc_pg[0] || mc->mc_pg[0]->mp_pgno != root) { ++#ifdef MDB_VL32 ++ if (mc->mc_pg[0]) ++ MDB_PAGE_UNREF(mc->mc_txn, mc->mc_pg[0]); ++#endif ++ if ((rc = mdb_page_get(mc, root, &mc->mc_pg[0], NULL)) != 0) + return rc; ++ } + ++#ifdef MDB_VL32 ++ { ++ int i; ++ for (i=1; i<mc->mc_snum; i++) ++ MDB_PAGE_UNREF(mc->mc_txn, mc->mc_pg[i]); ++ } ++#endif + mc->mc_snum = 1; + mc->mc_top = 0; + +- DPRINTF(("db %d root page %"Z"u has flags 0x%X", ++ DPRINTF(("db %d root page %"Yu" has flags 0x%X", + DDBI(mc), root, mc->mc_pg[0]->mp_flags)); + + if (flags & MDB_PS_MODIFY) { +@@ -5457,7 +6247,7 @@ mdb_ovpage_free(MDB_cursor *mc, MDB_page *mp) + MDB_ID pn = pg << 1; + int rc; + +- DPRINTF(("free ov page %"Z"u (%d)", pg, ovpages)); ++ DPRINTF(("free ov page %"Yu" (%d)", pg, ovpages)); + /* If the page is dirty or on the spill list we just acquired it, + * so we should give it back to our current free list, if any. + * Otherwise put it onto the list of pages we freed in this txn. +@@ -5498,7 +6288,7 @@ mdb_ovpage_free(MDB_cursor *mc, MDB_page *mp) + j = ++(dl[0].mid); + dl[j] = ix; /* Unsorted. OK when MDB_TXN_ERROR. */ + txn->mt_flags |= MDB_TXN_ERROR; +- return MDB_CORRUPTED; ++ return MDB_PROBLEM; + } + } + txn->mt_dirty_room++; +@@ -5523,18 +6313,22 @@ release: + } + + /** Return the data associated with a given node. +- * @param[in] txn The transaction for this operation. ++ * @param[in] mc The cursor for this operation. + * @param[in] leaf The node being read. + * @param[out] data Updated to point to the node's data. + * @return 0 on success, non-zero on failure. + */ + static int +-mdb_node_read(MDB_txn *txn, MDB_node *leaf, MDB_val *data) ++mdb_node_read(MDB_cursor *mc, MDB_node *leaf, MDB_val *data) + { + MDB_page *omp; /* overflow page */ + pgno_t pgno; + int rc; + ++ if (MC_OVPG(mc)) { ++ MDB_PAGE_UNREF(mc->mc_txn, MC_OVPG(mc)); ++ MC_SET_OVPG(mc, NULL); ++ } + if (!F_ISSET(leaf->mn_flags, F_BIGDATA)) { + data->mv_size = NODEDSZ(leaf); + data->mv_data = NODEDATA(leaf); +@@ -5545,11 +6339,12 @@ mdb_node_read(MDB_txn *txn, MDB_node *leaf, MDB_val *data) + */ + data->mv_size = NODEDSZ(leaf); + memcpy(&pgno, NODEDATA(leaf), sizeof(pgno)); +- if ((rc = mdb_page_get(txn, pgno, &omp, NULL)) != 0) { +- DPRINTF(("read overflow page %"Z"u failed", pgno)); ++ if ((rc = mdb_page_get(mc, pgno, &omp, NULL)) != 0) { ++ DPRINTF(("read overflow page %"Yu" failed", pgno)); + return rc; + } + data->mv_data = METADATA(omp); ++ MC_SET_OVPG(mc, omp); + + return MDB_SUCCESS; + } +@@ -5560,7 +6355,7 @@ mdb_get(MDB_txn *txn, MDB_dbi dbi, + { + MDB_cursor mc; + MDB_xcursor mx; +- int exact = 0; ++ int exact = 0, rc; + DKBUF; + + DPRINTF(("===> get db %u key [%s]", dbi, DKEY(key))); +@@ -5572,7 +6367,12 @@ mdb_get(MDB_txn *txn, MDB_dbi dbi, + return MDB_BAD_TXN; + + mdb_cursor_init(&mc, txn, dbi, &mx); +- return mdb_cursor_set(&mc, key, data, MDB_SET, &exact); ++ rc = mdb_cursor_set(&mc, key, data, MDB_SET, &exact); ++ /* unref all the pages when MDB_VL32 - caller must copy the data ++ * before doing anything else ++ */ ++ MDB_CURSOR_UNREF(&mc, 1); ++ return rc; + } + + /** Find a sibling for a page. +@@ -5589,13 +6389,19 @@ mdb_cursor_sibling(MDB_cursor *mc, int move_right) + int rc; + MDB_node *indx; + MDB_page *mp; ++#ifdef MDB_VL32 ++ MDB_page *op; ++#endif + + if (mc->mc_snum < 2) { + return MDB_NOTFOUND; /* root has no siblings */ + } + ++#ifdef MDB_VL32 ++ op = mc->mc_pg[mc->mc_top]; ++#endif + mdb_cursor_pop(mc); +- DPRINTF(("parent page is page %"Z"u, index %u", ++ DPRINTF(("parent page is page %"Yu", index %u", + mc->mc_pg[mc->mc_top]->mp_pgno, mc->mc_ki[mc->mc_top])); + + if (move_right ? (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mc->mc_pg[mc->mc_top])) +@@ -5618,8 +6424,10 @@ mdb_cursor_sibling(MDB_cursor *mc, int move_right) + } + mdb_cassert(mc, IS_BRANCH(mc->mc_pg[mc->mc_top])); + ++ MDB_PAGE_UNREF(mc->mc_txn, op); ++ + indx = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); +- if ((rc = mdb_page_get(mc->mc_txn, NODEPGNO(indx), &mp, NULL)) != 0) { ++ if ((rc = mdb_page_get(mc, NODEPGNO(indx), &mp, NULL)) != 0) { + /* mc will be inconsistent if caller does mc_snum++ as above */ + mc->mc_flags &= ~(C_INITIALIZED|C_EOF); + return rc; +@@ -5640,11 +6448,12 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + MDB_node *leaf; + int rc; + +- if (mc->mc_flags & C_EOF) { ++ if ((mc->mc_flags & C_EOF) || ++ ((mc->mc_flags & C_DEL) && op == MDB_NEXT_DUP)) { + return MDB_NOTFOUND; + } +- +- mdb_cassert(mc, mc->mc_flags & C_INITIALIZED); ++ if (!(mc->mc_flags & C_INITIALIZED)) ++ return mdb_cursor_first(mc, key, data); + + mp = mc->mc_pg[mc->mc_top]; + +@@ -5659,6 +6468,9 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + return rc; + } + } ++ else { ++ MDB_CURSOR_UNREF(&mc->mc_xcursor->mx_cursor, 0); ++ } + } else { + mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); + if (op == MDB_NEXT_DUP) +@@ -5666,7 +6478,7 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + } + } + +- DPRINTF(("cursor_next: top page is %"Z"u in cursor %p", ++ DPRINTF(("cursor_next: top page is %"Yu" in cursor %p", + mdb_dbg_pgno(mp), (void *) mc)); + if (mc->mc_flags & C_DEL) { + mc->mc_flags ^= C_DEL; +@@ -5680,12 +6492,12 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + return rc; + } + mp = mc->mc_pg[mc->mc_top]; +- DPRINTF(("next page is %"Z"u, key index %u", mp->mp_pgno, mc->mc_ki[mc->mc_top])); ++ DPRINTF(("next page is %"Yu", key index %u", mp->mp_pgno, mc->mc_ki[mc->mc_top])); + } else + mc->mc_ki[mc->mc_top]++; + + skip: +- DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u", ++ DPRINTF(("==> cursor points to page %"Yu" with %u keys, key index %u", + mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top])); + + if (IS_LEAF2(mp)) { +@@ -5701,7 +6513,7 @@ skip: + mdb_xcursor_init1(mc, leaf); + } + if (data) { +- if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS) ++ if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) + return rc; + + if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { +@@ -5723,7 +6535,12 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + MDB_node *leaf; + int rc; + +- mdb_cassert(mc, mc->mc_flags & C_INITIALIZED); ++ if (!(mc->mc_flags & C_INITIALIZED)) { ++ rc = mdb_cursor_last(mc, key, data); ++ if (rc) ++ return rc; ++ mc->mc_ki[mc->mc_top]++; ++ } + + mp = mc->mc_pg[mc->mc_top]; + +@@ -5740,6 +6557,9 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + return rc; + } + } ++ else { ++ MDB_CURSOR_UNREF(&mc->mc_xcursor->mx_cursor, 0); ++ } + } else { + mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); + if (op == MDB_PREV_DUP) +@@ -5747,7 +6567,7 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + } + } + +- DPRINTF(("cursor_prev: top page is %"Z"u in cursor %p", ++ DPRINTF(("cursor_prev: top page is %"Yu" in cursor %p", + mdb_dbg_pgno(mp), (void *) mc)); + + mc->mc_flags &= ~(C_EOF|C_DEL); +@@ -5759,11 +6579,13 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + } + mp = mc->mc_pg[mc->mc_top]; + mc->mc_ki[mc->mc_top] = NUMKEYS(mp) - 1; +- DPRINTF(("prev page is %"Z"u, key index %u", mp->mp_pgno, mc->mc_ki[mc->mc_top])); ++ DPRINTF(("prev page is %"Yu", key index %u", mp->mp_pgno, mc->mc_ki[mc->mc_top])); + } else + mc->mc_ki[mc->mc_top]--; + +- DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u", ++ mc->mc_flags &= ~C_EOF; ++ ++ DPRINTF(("==> cursor points to page %"Yu" with %u keys, key index %u", + mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top])); + + if (IS_LEAF2(mp)) { +@@ -5779,7 +6601,7 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) + mdb_xcursor_init1(mc, leaf); + } + if (data) { +- if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS) ++ if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) + return rc; + + if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { +@@ -5806,8 +6628,10 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, + if (key->mv_size == 0) + return MDB_BAD_VALSIZE; + +- if (mc->mc_xcursor) ++ if (mc->mc_xcursor) { ++ MDB_CURSOR_UNREF(&mc->mc_xcursor->mx_cursor, 0); + mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); ++ } + + /* See if we're already on the right page */ + if (mc->mc_flags & C_INITIALIZED) { +@@ -5873,6 +6697,7 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, + } + } + rc = 0; ++ mc->mc_flags &= ~C_EOF; + goto set2; + } + } +@@ -5961,25 +6786,23 @@ set1: + } else if (op == MDB_GET_BOTH || op == MDB_GET_BOTH_RANGE) { + MDB_val olddata; + MDB_cmp_func *dcmp; +- if ((rc = mdb_node_read(mc->mc_txn, leaf, &olddata)) != MDB_SUCCESS) ++ if ((rc = mdb_node_read(mc, leaf, &olddata)) != MDB_SUCCESS) + return rc; + dcmp = mc->mc_dbx->md_dcmp; +-#if UINT_MAX < SIZE_MAX +- if (dcmp == mdb_cmp_int && olddata.mv_size == sizeof(size_t)) ++ if (NEED_CMP_CLONG(dcmp, olddata.mv_size)) + dcmp = mdb_cmp_clong; +-#endif + rc = dcmp(data, &olddata); + if (rc) { + if (op == MDB_GET_BOTH || rc > 0) + return MDB_NOTFOUND; + rc = 0; +- *data = olddata; + } ++ *data = olddata; + + } else { + if (mc->mc_xcursor) + mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); +- if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS) ++ if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) + return rc; + } + } +@@ -5999,8 +6822,10 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data) + int rc; + MDB_node *leaf; + +- if (mc->mc_xcursor) ++ if (mc->mc_xcursor) { ++ MDB_CURSOR_UNREF(&mc->mc_xcursor->mx_cursor, 0); + mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); ++ } + + if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) { + rc = mdb_page_search(mc, NULL, MDB_PS_FIRST); +@@ -6028,7 +6853,7 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data) + if (rc) + return rc; + } else { +- if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS) ++ if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) + return rc; + } + } +@@ -6043,8 +6868,10 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data) + int rc; + MDB_node *leaf; + +- if (mc->mc_xcursor) ++ if (mc->mc_xcursor) { ++ MDB_CURSOR_UNREF(&mc->mc_xcursor->mx_cursor, 0); + mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); ++ } + + if (!(mc->mc_flags & C_EOF)) { + +@@ -6073,7 +6900,7 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data) + if (rc) + return rc; + } else { +- if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS) ++ if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) + return rc; + } + } +@@ -6119,7 +6946,7 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data, + if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { + rc = mdb_cursor_get(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_GET_CURRENT); + } else { +- rc = mdb_node_read(mc->mc_txn, leaf, data); ++ rc = mdb_node_read(mc, leaf, data); + } + } + } +@@ -6169,10 +6996,7 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data, + rc = MDB_INCOMPATIBLE; + break; + } +- if (!(mc->mc_flags & C_INITIALIZED)) +- rc = mdb_cursor_first(mc, key, data); +- else +- rc = mdb_cursor_next(mc, key, data, MDB_NEXT_DUP); ++ rc = mdb_cursor_next(mc, key, data, MDB_NEXT_DUP); + if (rc == MDB_SUCCESS) { + if (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) { + MDB_cursor *mx; +@@ -6187,24 +7011,38 @@ fetchm: + } + } + break; ++ case MDB_PREV_MULTIPLE: ++ if (data == NULL) { ++ rc = EINVAL; ++ break; ++ } ++ if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) { ++ rc = MDB_INCOMPATIBLE; ++ break; ++ } ++ if (!(mc->mc_flags & C_INITIALIZED)) ++ rc = mdb_cursor_last(mc, key, data); ++ else ++ rc = MDB_SUCCESS; ++ if (rc == MDB_SUCCESS) { ++ MDB_cursor *mx = &mc->mc_xcursor->mx_cursor; ++ if (mx->mc_flags & C_INITIALIZED) { ++ rc = mdb_cursor_sibling(mx, 0); ++ if (rc == MDB_SUCCESS) ++ goto fetchm; ++ } else { ++ rc = MDB_NOTFOUND; ++ } ++ } ++ break; + case MDB_NEXT: + case MDB_NEXT_DUP: + case MDB_NEXT_NODUP: +- if (!(mc->mc_flags & C_INITIALIZED)) +- rc = mdb_cursor_first(mc, key, data); +- else +- rc = mdb_cursor_next(mc, key, data, op); ++ rc = mdb_cursor_next(mc, key, data, op); + break; + case MDB_PREV: + case MDB_PREV_DUP: + case MDB_PREV_NODUP: +- if (!(mc->mc_flags & C_INITIALIZED)) { +- rc = mdb_cursor_last(mc, key, data); +- if (rc) +- break; +- mc->mc_flags |= C_INITIALIZED; +- mc->mc_ki[mc->mc_top]++; +- } + rc = mdb_cursor_prev(mc, key, data, op); + break; + case MDB_FIRST: +@@ -6225,7 +7063,7 @@ fetchm: + MDB_node *leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); + if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { + MDB_GET_KEY(leaf, key); +- rc = mdb_node_read(mc->mc_txn, leaf, data); ++ rc = mdb_node_read(mc, leaf, data); + break; + } + } +@@ -6487,10 +7325,8 @@ more: + if (flags == MDB_CURRENT) + goto current; + dcmp = mc->mc_dbx->md_dcmp; +-#if UINT_MAX < SIZE_MAX +- if (dcmp == mdb_cmp_int && olddata.mv_size == sizeof(size_t)) ++ if (NEED_CMP_CLONG(dcmp, olddata.mv_size)) + dcmp = mdb_cmp_clong; +-#endif + /* does data match? */ + if (!dcmp(data, &olddata)) { + if (flags & (MDB_NODUPDATA|MDB_APPENDDUP)) +@@ -6609,7 +7445,7 @@ current: + int level, ovpages, dpages = OVPAGES(data->mv_size, env->me_psize); + + memcpy(&pg, olddata.mv_data, sizeof(pg)); +- if ((rc2 = mdb_page_get(mc->mc_txn, pg, &omp, &level)) != 0) ++ if ((rc2 = mdb_page_get(mc, pg, &omp, &level)) != 0) + return rc2; + ovpages = omp->mp_pages; + +@@ -6641,8 +7477,13 @@ current: + /* Note - this page is already counted in parent's dirty_room */ + rc2 = mdb_mid2l_insert(mc->mc_txn->mt_u.dirty_list, &id2); + mdb_cassert(mc, rc2 == 0); ++ /* Currently we make the page look as with put() in the ++ * parent txn, in case the user peeks at MDB_RESERVEd ++ * or unused parts. Some users treat ovpages specially. ++ */ + if (!(flags & MDB_RESERVE)) { +- /* Copy end of page, adjusting alignment so ++ /* Skip the part where LMDB will put *data. ++ * Copy end of page, adjusting alignment so + * compiler may copy words instead of bytes. + */ + off = (PAGEHDRSZ + data->mv_size) & -sizeof(size_t); +@@ -6728,7 +7569,7 @@ new_sub: + */ + if (do_sub) { + int xflags, new_dupdata; +- size_t ecount; ++ mdb_size_t ecount; + put_sub: + xdata.mv_size = 0; + xdata.mv_data = ""; +@@ -6810,7 +7651,7 @@ put_sub: + return rc; + bad_sub: + if (rc == MDB_KEYEXIST) /* should not happen, we deleted that item */ +- rc = MDB_CORRUPTED; ++ rc = MDB_PROBLEM; + } + mc->mc_txn->mt_flags |= MDB_TXN_ERROR; + return rc; +@@ -6910,7 +7751,7 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags) + pgno_t pg; + + memcpy(&pg, NODEDATA(leaf), sizeof(pg)); +- if ((rc = mdb_page_get(mc->mc_txn, pg, &omp, NULL)) || ++ if ((rc = mdb_page_get(mc, pg, &omp, NULL)) || + (rc = mdb_ovpage_free(mc, omp))) + goto fail; + } +@@ -6939,7 +7780,7 @@ mdb_page_new(MDB_cursor *mc, uint32_t flags, int num, MDB_page **mp) + + if ((rc = mdb_page_alloc(mc, num, &np))) + return rc; +- DPRINTF(("allocated new mpage %"Z"u, page size %u", ++ DPRINTF(("allocated new mpage %"Yu", page size %u", + np->mp_pgno, mc->mc_txn->mt_env->me_psize)); + np->mp_flags = flags | P_DIRTY; + np->mp_lower = (PAGEHDRSZ-PAGEBASE); +@@ -7039,7 +7880,7 @@ mdb_node_add(MDB_cursor *mc, indx_t indx, + + mdb_cassert(mc, mp->mp_upper >= mp->mp_lower); + +- DPRINTF(("add to %s %spage %"Z"u index %i, data size %"Z"u key size %"Z"u [%s]", ++ DPRINTF(("add to %s %spage %"Yu" index %i, data size %"Z"u key size %"Z"u [%s]", + IS_LEAF(mp) ? "leaf" : "branch", + IS_SUBP(mp) ? "sub-" : "", + mdb_dbg_pgno(mp), indx, data ? data->mv_size : 0, +@@ -7080,7 +7921,7 @@ mdb_node_add(MDB_cursor *mc, indx_t indx, + goto full; + if ((rc = mdb_page_new(mc, P_OVERFLOW, ovpages, &ofp))) + return rc; +- DPRINTF(("allocated overflow page %"Z"u", ofp->mp_pgno)); ++ DPRINTF(("allocated overflow page %"Yu, ofp->mp_pgno)); + flags |= F_BIGDATA; + goto update; + } else { +@@ -7137,7 +7978,7 @@ update: + return MDB_SUCCESS; + + full: +- DPRINTF(("not enough room in page %"Z"u, got %u ptrs", ++ DPRINTF(("not enough room in page %"Yu", got %u ptrs", + mdb_dbg_pgno(mp), NUMKEYS(mp))); + DPRINTF(("upper-lower = %u - %u = %"Z"d", mp->mp_upper,mp->mp_lower,room)); + DPRINTF(("node size = %"Z"u", node_size)); +@@ -7160,7 +8001,7 @@ mdb_node_del(MDB_cursor *mc, int ksize) + MDB_node *node; + char *base; + +- DPRINTF(("delete node %u on %s page %"Z"u", indx, ++ DPRINTF(("delete node %u on %s page %"Yu, indx, + IS_LEAF(mp) ? "leaf" : "branch", mdb_dbg_pgno(mp))); + numkeys = NUMKEYS(mp); + mdb_cassert(mc, indx < numkeys); +@@ -7269,7 +8110,8 @@ mdb_xcursor_init0(MDB_cursor *mc) + mx->mx_cursor.mc_dbflag = &mx->mx_dbflag; + mx->mx_cursor.mc_snum = 0; + mx->mx_cursor.mc_top = 0; +- mx->mx_cursor.mc_flags = C_SUB; ++ MC_SET_OVPG(&mx->mx_cursor, NULL); ++ mx->mx_cursor.mc_flags = C_SUB | (mc->mc_flags & (C_ORIG_RDONLY|C_WRITEMAP)); + mx->mx_dbx.md_name.mv_size = 0; + mx->mx_dbx.md_name.mv_data = NULL; + mx->mx_dbx.md_cmp = mc->mc_dbx->md_dcmp; +@@ -7288,12 +8130,12 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) + { + MDB_xcursor *mx = mc->mc_xcursor; + ++ mx->mx_cursor.mc_flags &= C_SUB|C_ORIG_RDONLY|C_WRITEMAP; + if (node->mn_flags & F_SUBDATA) { + memcpy(&mx->mx_db, NODEDATA(node), sizeof(MDB_db)); + mx->mx_cursor.mc_pg[0] = 0; + mx->mx_cursor.mc_snum = 0; + mx->mx_cursor.mc_top = 0; +- mx->mx_cursor.mc_flags = C_SUB; + } else { + MDB_page *fp = NODEDATA(node); + mx->mx_db.md_pad = 0; +@@ -7306,7 +8148,7 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) + COPY_PGNO(mx->mx_db.md_root, fp->mp_pgno); + mx->mx_cursor.mc_snum = 1; + mx->mx_cursor.mc_top = 0; +- mx->mx_cursor.mc_flags = C_INITIALIZED|C_SUB; ++ mx->mx_cursor.mc_flags |= C_INITIALIZED; + mx->mx_cursor.mc_pg[0] = fp; + mx->mx_cursor.mc_ki[0] = 0; + if (mc->mc_db->md_flags & MDB_DUPFIXED) { +@@ -7316,13 +8158,11 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) + mx->mx_db.md_flags |= MDB_INTEGERKEY; + } + } +- DPRINTF(("Sub-db -%u root page %"Z"u", mx->mx_cursor.mc_dbi, ++ DPRINTF(("Sub-db -%u root page %"Yu, mx->mx_cursor.mc_dbi, + mx->mx_db.md_root)); + mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DIRTY; /* DB_DIRTY guides mdb_cursor_touch */ +-#if UINT_MAX < SIZE_MAX +- if (mx->mx_dbx.md_cmp == mdb_cmp_int && mx->mx_db.md_pad == sizeof(size_t)) ++ if (NEED_CMP_CLONG(mx->mx_dbx.md_cmp, mx->mx_db.md_pad)) + mx->mx_dbx.md_cmp = mdb_cmp_clong; +-#endif + } + + +@@ -7345,7 +8185,7 @@ mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata) + mx->mx_cursor.mc_flags |= C_INITIALIZED; + mx->mx_cursor.mc_ki[0] = 0; + mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DIRTY; /* DB_DIRTY guides mdb_cursor_touch */ +-#if UINT_MAX < SIZE_MAX ++#if UINT_MAX < MDB_SIZE_MAX /* matches mdb_xcursor_init1:NEED_CMP_CLONG() */ + mx->mx_dbx.md_cmp = src_mx->mx_dbx.md_cmp; + #endif + } else if (!(mx->mx_cursor.mc_flags & C_INITIALIZED)) { +@@ -7353,7 +8193,7 @@ mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata) + } + mx->mx_db = src_mx->mx_db; + mx->mx_cursor.mc_pg[0] = src_mx->mx_cursor.mc_pg[0]; +- DPRINTF(("Sub-db -%u root page %"Z"u", mx->mx_cursor.mc_dbi, ++ DPRINTF(("Sub-db -%u root page %"Yu, mx->mx_cursor.mc_dbi, + mx->mx_db.md_root)); + } + +@@ -7372,7 +8212,8 @@ mdb_cursor_init(MDB_cursor *mc, MDB_txn *txn, MDB_dbi dbi, MDB_xcursor *mx) + mc->mc_top = 0; + mc->mc_pg[0] = 0; + mc->mc_ki[0] = 0; +- mc->mc_flags = 0; ++ MC_SET_OVPG(mc, NULL); ++ mc->mc_flags = txn->mt_flags & (C_ORIG_RDONLY|C_WRITEMAP); + if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) { + mdb_tassert(txn, mx != NULL); + mc->mc_xcursor = mx; +@@ -7437,7 +8278,7 @@ mdb_cursor_renew(MDB_txn *txn, MDB_cursor *mc) + + /* Return the count of duplicate data items for the current key */ + int +-mdb_cursor_count(MDB_cursor *mc, size_t *countp) ++mdb_cursor_count(MDB_cursor *mc, mdb_size_t *countp) + { + MDB_node *leaf; + +@@ -7471,6 +8312,9 @@ mdb_cursor_count(MDB_cursor *mc, size_t *countp) + void + mdb_cursor_close(MDB_cursor *mc) + { ++ if (mc) { ++ MDB_CURSOR_UNREF(mc, 0); ++ } + if (mc && !mc->mc_backup) { + /* remove from txn, if tracked */ + if ((mc->mc_flags & C_UNTRACK) && mc->mc_txn->mt_cursors) { +@@ -7522,7 +8366,7 @@ mdb_update_key(MDB_cursor *mc, MDB_val *key) + char kbuf2[DKBUF_MAXKEYSIZE*2+1]; + k2.mv_data = NODEKEY(node); + k2.mv_size = node->mn_ksize; +- DPRINTF(("update key %u (ofs %u) [%s] to [%s] on page %"Z"u", ++ DPRINTF(("update key %u (ofs %u) [%s] to [%s] on page %"Yu, + indx, ptr, + mdb_dkey(&k2, kbuf2), + DKEY(key), +@@ -7670,7 +8514,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) + return rc; + } + +- DPRINTF(("moving %s node %u [%s] on page %"Z"u to node %u on page %"Z"u", ++ DPRINTF(("moving %s node %u [%s] on page %"Yu" to node %u on page %"Yu, + IS_LEAF(csrc->mc_pg[csrc->mc_top]) ? "leaf" : "branch", + csrc->mc_ki[csrc->mc_top], + DKEY(&key), +@@ -7764,7 +8608,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) + key.mv_size = NODEKSZ(srcnode); + key.mv_data = NODEKEY(srcnode); + } +- DPRINTF(("update separator for source page %"Z"u to [%s]", ++ DPRINTF(("update separator for source page %"Yu" to [%s]", + csrc->mc_pg[csrc->mc_top]->mp_pgno, DKEY(&key))); + mdb_cursor_copy(csrc, &mn); + mn.mc_snum--; +@@ -7795,7 +8639,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) + key.mv_size = NODEKSZ(srcnode); + key.mv_data = NODEKEY(srcnode); + } +- DPRINTF(("update separator for destination page %"Z"u to [%s]", ++ DPRINTF(("update separator for destination page %"Yu" to [%s]", + cdst->mc_pg[cdst->mc_top]->mp_pgno, DKEY(&key))); + mdb_cursor_copy(cdst, &mn); + mn.mc_snum--; +@@ -7841,7 +8685,7 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) + psrc = csrc->mc_pg[csrc->mc_top]; + pdst = cdst->mc_pg[cdst->mc_top]; + +- DPRINTF(("merging page %"Z"u into %"Z"u", psrc->mp_pgno, pdst->mp_pgno)); ++ DPRINTF(("merging page %"Yu" into %"Yu, psrc->mp_pgno, pdst->mp_pgno)); + + mdb_cassert(csrc, csrc->mc_snum > 1); /* can't merge root page */ + mdb_cassert(csrc, cdst->mc_snum > 1); +@@ -7898,7 +8742,7 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) + } + } + +- DPRINTF(("dst page %"Z"u now has %u keys (%.1f%% filled)", ++ DPRINTF(("dst page %"Yu" now has %u keys (%.1f%% filled)", + pdst->mp_pgno, NUMKEYS(pdst), + (float)PAGEFILL(cdst->mc_txn->mt_env, pdst) / 10)); + +@@ -7986,6 +8830,7 @@ mdb_cursor_copy(const MDB_cursor *csrc, MDB_cursor *cdst) + cdst->mc_snum = csrc->mc_snum; + cdst->mc_top = csrc->mc_top; + cdst->mc_flags = csrc->mc_flags; ++ MC_SET_OVPG(cdst, MC_OVPG(csrc)); + + for (i=0; i<csrc->mc_snum; i++) { + cdst->mc_pg[i] = csrc->mc_pg[i]; +@@ -8014,14 +8859,14 @@ mdb_rebalance(MDB_cursor *mc) + minkeys = 1; + thresh = FILL_THRESHOLD; + } +- DPRINTF(("rebalancing %s page %"Z"u (has %u keys, %.1f%% full)", ++ DPRINTF(("rebalancing %s page %"Yu" (has %u keys, %.1f%% full)", + IS_LEAF(mc->mc_pg[mc->mc_top]) ? "leaf" : "branch", + mdb_dbg_pgno(mc->mc_pg[mc->mc_top]), NUMKEYS(mc->mc_pg[mc->mc_top]), + (float)PAGEFILL(mc->mc_txn->mt_env, mc->mc_pg[mc->mc_top]) / 10)); + + if (PAGEFILL(mc->mc_txn->mt_env, mc->mc_pg[mc->mc_top]) >= thresh && + NUMKEYS(mc->mc_pg[mc->mc_top]) >= minkeys) { +- DPRINTF(("no need to rebalance page %"Z"u, above fill threshold", ++ DPRINTF(("no need to rebalance page %"Yu", above fill threshold", + mdb_dbg_pgno(mc->mc_pg[mc->mc_top]))); + return MDB_SUCCESS; + } +@@ -8069,7 +8914,7 @@ mdb_rebalance(MDB_cursor *mc) + if (rc) + return rc; + mc->mc_db->md_root = NODEPGNO(NODEPTR(mp, 0)); +- rc = mdb_page_get(mc->mc_txn,mc->mc_db->md_root,&mc->mc_pg[0],NULL); ++ rc = mdb_page_get(mc, mc->mc_db->md_root, &mc->mc_pg[0], NULL); + if (rc) + return rc; + mc->mc_db->md_depth--; +@@ -8130,7 +8975,7 @@ mdb_rebalance(MDB_cursor *mc) + DPUTS("reading right neighbor"); + mn.mc_ki[ptop]++; + node = NODEPTR(mc->mc_pg[ptop], mn.mc_ki[ptop]); +- rc = mdb_page_get(mc->mc_txn,NODEPGNO(node),&mn.mc_pg[mn.mc_top],NULL); ++ rc = mdb_page_get(mc, NODEPGNO(node), &mn.mc_pg[mn.mc_top], NULL); + if (rc) + return rc; + mn.mc_ki[mn.mc_top] = 0; +@@ -8142,7 +8987,7 @@ mdb_rebalance(MDB_cursor *mc) + DPUTS("reading left neighbor"); + mn.mc_ki[ptop]--; + node = NODEPTR(mc->mc_pg[ptop], mn.mc_ki[ptop]); +- rc = mdb_page_get(mc->mc_txn,NODEPGNO(node),&mn.mc_pg[mn.mc_top],NULL); ++ rc = mdb_page_get(mc, NODEPGNO(node), &mn.mc_pg[mn.mc_top], NULL); + if (rc) + return rc; + mn.mc_ki[mn.mc_top] = NUMKEYS(mn.mc_pg[mn.mc_top]) - 1; +@@ -8150,7 +8995,7 @@ mdb_rebalance(MDB_cursor *mc) + fromleft = 1; + } + +- DPRINTF(("found neighbor page %"Z"u (%u keys, %.1f%% full)", ++ DPRINTF(("found neighbor page %"Yu" (%u keys, %.1f%% full)", + mn.mc_pg[mn.mc_top]->mp_pgno, NUMKEYS(mn.mc_pg[mn.mc_top]), + (float)PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) / 10)); + +@@ -8207,8 +9052,6 @@ mdb_cursor_del0(MDB_cursor *mc) + if (m3->mc_pg[mc->mc_top] == mp) { + if (m3->mc_ki[mc->mc_top] == ki) { + m3->mc_flags |= C_DEL; +- if (mc->mc_db->md_flags & MDB_DUPSORT) +- m3->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; + } else if (m3->mc_ki[mc->mc_top] > ki) { + m3->mc_ki[mc->mc_top]--; + } +@@ -8242,11 +9085,21 @@ mdb_cursor_del0(MDB_cursor *mc) + continue; + if (m3->mc_pg[mc->mc_top] == mp) { + /* if m3 points past last node in page, find next sibling */ +- if (m3->mc_ki[mc->mc_top] >= nkeys) { +- rc = mdb_cursor_sibling(m3, 1); +- if (rc == MDB_NOTFOUND) { +- m3->mc_flags |= C_EOF; +- rc = MDB_SUCCESS; ++ if (m3->mc_ki[mc->mc_top] >= mc->mc_ki[mc->mc_top]) { ++ if (m3->mc_ki[mc->mc_top] >= nkeys) { ++ rc = mdb_cursor_sibling(m3, 1); ++ if (rc == MDB_NOTFOUND) { ++ m3->mc_flags |= C_EOF; ++ rc = MDB_SUCCESS; ++ continue; ++ } ++ } ++ if (mc->mc_db->md_flags & MDB_DUPSORT) { ++ MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]); ++ if (node->mn_flags & F_DUPDATA) { ++ mdb_xcursor_init1(m3, node); ++ m3->mc_xcursor->mx_cursor.mc_flags |= C_DEL; ++ } + } + } + } +@@ -8352,7 +9205,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno + newindx = mc->mc_ki[mc->mc_top]; + nkeys = NUMKEYS(mp); + +- DPRINTF(("-----> splitting %s page %"Z"u and adding [%s] at index %i/%i", ++ DPRINTF(("-----> splitting %s page %"Yu" and adding [%s] at index %i/%i", + IS_LEAF(mp) ? "leaf" : "branch", mp->mp_pgno, + DKEY(newkey), mc->mc_ki[mc->mc_top], nkeys)); + +@@ -8360,7 +9213,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno + if ((rc = mdb_page_new(mc, mp->mp_flags, 1, &rp))) + return rc; + rp->mp_pad = mp->mp_pad; +- DPRINTF(("new right sibling: page %"Z"u", rp->mp_pgno)); ++ DPRINTF(("new right sibling: page %"Yu, rp->mp_pgno)); + + /* Usually when splitting the root page, the cursor + * height is 1. But when called from mdb_update_key, +@@ -8378,7 +9231,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno + mc->mc_pg[0] = pp; + mc->mc_ki[0] = 0; + mc->mc_db->md_root = pp->mp_pgno; +- DPRINTF(("root split! new root = %"Z"u", pp->mp_pgno)); ++ DPRINTF(("root split! new root = %"Yu, pp->mp_pgno)); + new_root = mc->mc_db->md_depth++; + + /* Add left (implicit) pointer. */ +@@ -8395,7 +9248,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno + ptop = 0; + } else { + ptop = mc->mc_top-1; +- DPRINTF(("parent branch page is %"Z"u", mc->mc_pg[ptop]->mp_pgno)); ++ DPRINTF(("parent branch page is %"Yu, mc->mc_pg[ptop]->mp_pgno)); + } + + mdb_cursor_copy(mc, &mn); +@@ -8776,11 +9629,12 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi, + #ifndef MDB_WBUF + #define MDB_WBUF (1024*1024) + #endif ++#define MDB_EOF 0x10 /**< #mdb_env_copyfd1() is done reading */ + +- /** State needed for a compacting copy. */ ++ /** State needed for a double-buffering compacting copy. */ + typedef struct mdb_copy { + pthread_mutex_t mc_mutex; +- pthread_cond_t mc_cond; ++ pthread_cond_t mc_cond; /**< Condition variable for #mc_new */ + char *mc_wbuf[2]; + char *mc_over[2]; + MDB_env *mc_env; +@@ -8789,10 +9643,9 @@ typedef struct mdb_copy { + int mc_olen[2]; + pgno_t mc_next_pgno; + HANDLE mc_fd; +- int mc_status; +- volatile int mc_new; +- int mc_toggle; +- ++ int mc_toggle; /**< Buffer number in provider */ ++ int mc_new; /**< (0-2 buffers to write) | (#MDB_EOF at end) */ ++ volatile int mc_error; /**< Error code, never cleared if set */ + } mdb_copy; + + /** Dedicated writer thread for compacting copy. */ +@@ -8811,20 +9664,16 @@ mdb_env_copythr(void *arg) + #endif + + pthread_mutex_lock(&my->mc_mutex); +- my->mc_new = 0; +- pthread_cond_signal(&my->mc_cond); + for(;;) { + while (!my->mc_new) + pthread_cond_wait(&my->mc_cond, &my->mc_mutex); +- if (my->mc_new < 0) { +- my->mc_new = 0; ++ if (my->mc_new == 0 + MDB_EOF) /* 0 buffers, just EOF */ + break; +- } +- my->mc_new = 0; + wsize = my->mc_wlen[toggle]; + ptr = my->mc_wbuf[toggle]; + again: +- while (wsize > 0) { ++ rc = MDB_SUCCESS; ++ while (wsize > 0 && !my->mc_error) { + DO_WRITE(rc, my->mc_fd, ptr, wsize, len); + if (!rc) { + rc = ErrCode(); +@@ -8840,8 +9689,7 @@ again: + } + } + if (rc) { +- my->mc_status = rc; +- break; ++ my->mc_error = rc; + } + /* If there's an overflow page tail, write it too */ + if (my->mc_olen[toggle]) { +@@ -8852,39 +9700,41 @@ again: + } + my->mc_wlen[toggle] = 0; + toggle ^= 1; ++ /* Return the empty buffer to provider */ ++ my->mc_new--; + pthread_cond_signal(&my->mc_cond); + } +- pthread_cond_signal(&my->mc_cond); + pthread_mutex_unlock(&my->mc_mutex); + return (THREAD_RET)0; + #undef DO_WRITE + } + +- /** Tell the writer thread there's a buffer ready to write */ ++ /** Give buffer and/or #MDB_EOF to writer thread, await unused buffer. ++ * ++ * @param[in] my control structure. ++ * @param[in] adjust (1 to hand off 1 buffer) | (MDB_EOF when ending). ++ */ + static int ESECT +-mdb_env_cthr_toggle(mdb_copy *my, int st) ++mdb_env_cthr_toggle(mdb_copy *my, int adjust) + { +- int toggle = my->mc_toggle ^ 1; + pthread_mutex_lock(&my->mc_mutex); +- if (my->mc_status) { +- pthread_mutex_unlock(&my->mc_mutex); +- return my->mc_status; +- } +- while (my->mc_new == 1) +- pthread_cond_wait(&my->mc_cond, &my->mc_mutex); +- my->mc_new = st; +- my->mc_toggle = toggle; ++ my->mc_new += adjust; + pthread_cond_signal(&my->mc_cond); ++ while (my->mc_new & 2) /* both buffers in use */ ++ pthread_cond_wait(&my->mc_cond, &my->mc_mutex); + pthread_mutex_unlock(&my->mc_mutex); +- return 0; ++ ++ my->mc_toggle ^= (adjust & 1); ++ /* Both threads reset mc_wlen, to be safe from threading errors */ ++ my->mc_wlen[my->mc_toggle] = 0; ++ return my->mc_error; + } + + /** Depth-first tree traversal for compacting copy. */ + static int ESECT + mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) + { +- MDB_cursor mc; +- MDB_txn *txn = my->mc_txn; ++ MDB_cursor mc = {0}; + MDB_node *ni; + MDB_page *mo, *mp, *leaf; + char *buf, *ptr; +@@ -8896,10 +9746,10 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) + return MDB_SUCCESS; + + mc.mc_snum = 1; +- mc.mc_top = 0; +- mc.mc_txn = txn; ++ mc.mc_txn = my->mc_txn; ++ mc.mc_flags = my->mc_txn->mt_flags & (C_ORIG_RDONLY|C_WRITEMAP); + +- rc = mdb_page_get(my->mc_txn, *pg, &mc.mc_pg[0], NULL); ++ rc = mdb_page_get(&mc, *pg, &mc.mc_pg[0], NULL); + if (rc) + return rc; + rc = mdb_page_search_root(&mc, NULL, MDB_PS_FIRST); +@@ -8943,7 +9793,8 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) + } + + memcpy(&pg, NODEDATA(ni), sizeof(pg)); +- rc = mdb_page_get(txn, pg, &omp, NULL); ++ memcpy(NODEDATA(ni), &my->mc_next_pgno, sizeof(pgno_t)); ++ rc = mdb_page_get(&mc, pg, &omp, NULL); + if (rc) + goto done; + if (my->mc_wlen[toggle] >= MDB_WBUF) { +@@ -8965,7 +9816,6 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) + goto done; + toggle = my->mc_toggle; + } +- memcpy(NODEDATA(ni), &mo->mp_pgno, sizeof(pgno_t)); + } else if (ni->mn_flags & F_SUBDATA) { + MDB_db db; + +@@ -8994,7 +9844,7 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) + again: + ni = NODEPTR(mp, mc.mc_ki[mc.mc_top]); + pg = NODEPGNO(ni); +- rc = mdb_page_get(txn, pg, &mp, NULL); ++ rc = mdb_page_get(&mc, pg, &mp, NULL); + if (rc) + goto done; + mc.mc_top++; +@@ -9043,47 +9893,56 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) + { + MDB_meta *mm; + MDB_page *mp; +- mdb_copy my; ++ mdb_copy my = {0}; + MDB_txn *txn = NULL; + pthread_t thr; +- int rc; ++ pgno_t root, new_root; ++ int rc = MDB_SUCCESS; + + #ifdef _WIN32 +- my.mc_mutex = CreateMutex(NULL, FALSE, NULL); +- my.mc_cond = CreateEvent(NULL, FALSE, FALSE, NULL); ++ if (!(my.mc_mutex = CreateMutex(NULL, FALSE, NULL)) || ++ !(my.mc_cond = CreateEvent(NULL, FALSE, FALSE, NULL))) { ++ rc = ErrCode(); ++ goto done; ++ } + my.mc_wbuf[0] = _aligned_malloc(MDB_WBUF*2, env->me_os_psize); +- if (my.mc_wbuf[0] == NULL) +- return errno; ++ if (my.mc_wbuf[0] == NULL) { ++ /* _aligned_malloc() sets errno, but we use Windows error codes */ ++ rc = ERROR_NOT_ENOUGH_MEMORY; ++ goto done; ++ } + #else +- pthread_mutex_init(&my.mc_mutex, NULL); +- pthread_cond_init(&my.mc_cond, NULL); ++ if ((rc = pthread_mutex_init(&my.mc_mutex, NULL)) != 0) ++ return rc; ++ if ((rc = pthread_cond_init(&my.mc_cond, NULL)) != 0) ++ goto done2; + #ifdef HAVE_MEMALIGN + my.mc_wbuf[0] = memalign(env->me_os_psize, MDB_WBUF*2); +- if (my.mc_wbuf[0] == NULL) +- return errno; ++ if (my.mc_wbuf[0] == NULL) { ++ rc = errno; ++ goto done; ++ } + #else +- rc = posix_memalign((void **)&my.mc_wbuf[0], env->me_os_psize, MDB_WBUF*2); +- if (rc) +- return rc; ++ { ++ void *p; ++ if ((rc = posix_memalign(&p, env->me_os_psize, MDB_WBUF*2)) != 0) ++ goto done; ++ my.mc_wbuf[0] = p; ++ } + #endif + #endif + memset(my.mc_wbuf[0], 0, MDB_WBUF*2); + my.mc_wbuf[1] = my.mc_wbuf[0] + MDB_WBUF; +- my.mc_wlen[0] = 0; +- my.mc_wlen[1] = 0; +- my.mc_olen[0] = 0; +- my.mc_olen[1] = 0; + my.mc_next_pgno = NUM_METAS; +- my.mc_status = 0; +- my.mc_new = 1; +- my.mc_toggle = 0; + my.mc_env = env; + my.mc_fd = fd; +- THREAD_CREATE(thr, mdb_env_copythr, &my); ++ rc = THREAD_CREATE(thr, mdb_env_copythr, &my); ++ if (rc) ++ goto done; + + rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn); + if (rc) +- return rc; ++ goto finish; + + mp = (MDB_page *)my.mc_wbuf[0]; + memset(mp, 0, NUM_METAS * env->me_psize); +@@ -9099,57 +9958,64 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) + *(MDB_meta *)METADATA(mp) = *mm; + mm = (MDB_meta *)METADATA(mp); + +- /* Count the number of free pages, subtract from lastpg to find +- * number of active pages +- */ +- { ++ /* Set metapage 1 with current main DB */ ++ root = new_root = txn->mt_dbs[MAIN_DBI].md_root; ++ if (root != P_INVALID) { ++ /* Count free pages + freeDB pages. Subtract from last_pg ++ * to find the new last_pg, which also becomes the new root. ++ */ + MDB_ID freecount = 0; + MDB_cursor mc; + MDB_val key, data; + mdb_cursor_init(&mc, txn, FREE_DBI, NULL); + while ((rc = mdb_cursor_get(&mc, &key, &data, MDB_NEXT)) == 0) + freecount += *(MDB_ID *)data.mv_data; ++ if (rc != MDB_NOTFOUND) ++ goto finish; + freecount += txn->mt_dbs[FREE_DBI].md_branch_pages + + txn->mt_dbs[FREE_DBI].md_leaf_pages + + txn->mt_dbs[FREE_DBI].md_overflow_pages; + +- /* Set metapage 1 */ +- mm->mm_last_pg = txn->mt_next_pgno - freecount - 1; ++ new_root = txn->mt_next_pgno - 1 - freecount; ++ mm->mm_last_pg = new_root; + mm->mm_dbs[MAIN_DBI] = txn->mt_dbs[MAIN_DBI]; +- if (mm->mm_last_pg > NUM_METAS-1) { +- mm->mm_dbs[MAIN_DBI].md_root = mm->mm_last_pg; +- mm->mm_txnid = 1; +- } else { +- mm->mm_dbs[MAIN_DBI].md_root = P_INVALID; +- } ++ mm->mm_dbs[MAIN_DBI].md_root = new_root; ++ } else { ++ /* When the DB is empty, handle it specially to ++ * fix any breakage like page leaks from ITS#8174. ++ */ ++ mm->mm_dbs[MAIN_DBI].md_flags = txn->mt_dbs[MAIN_DBI].md_flags; ++ } ++ if (root != P_INVALID || mm->mm_dbs[MAIN_DBI].md_flags) { ++ mm->mm_txnid = 1; /* use metapage 1 */ + } ++ + my.mc_wlen[0] = env->me_psize * NUM_METAS; + my.mc_txn = txn; +- pthread_mutex_lock(&my.mc_mutex); +- while(my.mc_new) +- pthread_cond_wait(&my.mc_cond, &my.mc_mutex); +- pthread_mutex_unlock(&my.mc_mutex); +- rc = mdb_env_cwalk(&my, &txn->mt_dbs[MAIN_DBI].md_root, 0); +- if (rc == MDB_SUCCESS && my.mc_wlen[my.mc_toggle]) +- rc = mdb_env_cthr_toggle(&my, 1); +- mdb_env_cthr_toggle(&my, -1); +- pthread_mutex_lock(&my.mc_mutex); +- while(my.mc_new) +- pthread_cond_wait(&my.mc_cond, &my.mc_mutex); +- pthread_mutex_unlock(&my.mc_mutex); +- THREAD_FINISH(thr); ++ rc = mdb_env_cwalk(&my, &root, 0); ++ if (rc == MDB_SUCCESS && root != new_root) { ++ rc = MDB_INCOMPATIBLE; /* page leak or corrupt DB */ ++ } + ++finish: ++ if (rc) ++ my.mc_error = rc; ++ mdb_env_cthr_toggle(&my, 1 | MDB_EOF); ++ rc = THREAD_FINISH(thr); + mdb_txn_abort(txn); ++ ++done: + #ifdef _WIN32 +- CloseHandle(my.mc_cond); +- CloseHandle(my.mc_mutex); +- _aligned_free(my.mc_wbuf[0]); ++ if (my.mc_wbuf[0]) _aligned_free(my.mc_wbuf[0]); ++ if (my.mc_cond) CloseHandle(my.mc_cond); ++ if (my.mc_mutex) CloseHandle(my.mc_mutex); + #else ++ free(my.mc_wbuf[0]); + pthread_cond_destroy(&my.mc_cond); ++done2: + pthread_mutex_destroy(&my.mc_mutex); +- free(my.mc_wbuf[0]); + #endif +- return rc; ++ return rc ? rc : my.mc_error; + } + + /** Copy environment as-is. */ +@@ -9159,7 +10025,7 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd) + MDB_txn *txn = NULL; + mdb_mutexref_t wmutex = NULL; + int rc; +- size_t wsize, w3; ++ mdb_size_t wsize, w3; + char *ptr; + #ifdef _WIN32 + DWORD len, w2; +@@ -9220,7 +10086,7 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd) + + w3 = txn->mt_next_pgno * env->me_psize; + { +- size_t fsize = 0; ++ mdb_size_t fsize = 0; + if ((rc = mdb_fsize(env->me_fd, &fsize))) + goto leave; + if (w3 > fsize) +@@ -9659,11 +10525,19 @@ mdb_drop0(MDB_cursor *mc, int subs) + + /* DUPSORT sub-DBs have no ovpages/DBs. Omit scanning leaves. + * This also avoids any P_LEAF2 pages, which have no nodes. ++ * Also if the DB doesn't have sub-DBs and has no overflow ++ * pages, omit scanning leaves. + */ +- if (mc->mc_flags & C_SUB) ++ if ((mc->mc_flags & C_SUB) || ++ (!subs && !mc->mc_db->md_overflow_pages)) + mdb_cursor_pop(mc); + + mdb_cursor_copy(mc, &mx); ++#ifdef MDB_VL32 ++ /* bump refcount for mx's pages */ ++ for (i=0; i<mc->mc_snum; i++) ++ mdb_page_get(&mx, mc->mc_pg[i]->mp_pgno, &mx.mc_pg[i], NULL); ++#endif + while (mc->mc_snum > 0) { + MDB_page *mp = mc->mc_pg[mc->mc_top]; + unsigned n = NUMKEYS(mp); +@@ -9674,7 +10548,7 @@ mdb_drop0(MDB_cursor *mc, int subs) + MDB_page *omp; + pgno_t pg; + memcpy(&pg, NODEDATA(ni), sizeof(pg)); +- rc = mdb_page_get(txn, pg, &omp, NULL); ++ rc = mdb_page_get(mc, pg, &omp, NULL); + if (rc != 0) + goto done; + mdb_cassert(mc, IS_OVERFLOW(omp)); +@@ -9682,6 +10556,9 @@ mdb_drop0(MDB_cursor *mc, int subs) + pg, omp->mp_pages); + if (rc) + goto done; ++ mc->mc_db->md_overflow_pages -= omp->mp_pages; ++ if (!mc->mc_db->md_overflow_pages && !subs) ++ break; + } else if (subs && (ni->mn_flags & F_SUBDATA)) { + mdb_xcursor_init1(mc, ni); + rc = mdb_drop0(&mc->mc_xcursor->mx_cursor, 0); +@@ -9689,6 +10566,8 @@ mdb_drop0(MDB_cursor *mc, int subs) + goto done; + } + } ++ if (!subs && !mc->mc_db->md_overflow_pages) ++ goto pop; + } else { + if ((rc = mdb_midl_need(&txn->mt_free_pgs, n)) != 0) + goto done; +@@ -9710,6 +10589,7 @@ mdb_drop0(MDB_cursor *mc, int subs) + /* no more siblings, go back to beginning + * of previous level. + */ ++pop: + mdb_cursor_pop(mc); + mc->mc_ki[0] = 0; + for (i=1; i<mc->mc_snum; i++) { +@@ -9723,6 +10603,8 @@ mdb_drop0(MDB_cursor *mc, int subs) + done: + if (rc) + txn->mt_flags |= MDB_TXN_ERROR; ++ /* drop refcount for mx's pages */ ++ MDB_CURSOR_UNREF(&mx, 0); + } else if (rc == MDB_NOTFOUND) { + rc = MDB_SUCCESS; + } +@@ -9842,7 +10724,7 @@ mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx) + if (mr[i].mr_pid) { + txnid_t txnid = mr[i].mr_txnid; + sprintf(buf, txnid == (txnid_t)-1 ? +- "%10d %"Z"x -\n" : "%10d %"Z"x %"Z"u\n", ++ "%10d %"Z"x -\n" : "%10d %"Z"x %"Yu"\n", + (int)mr[i].mr_pid, (size_t)mr[i].mr_tid, txnid); + if (first) { + first = 0; +@@ -9947,7 +10829,7 @@ mdb_reader_check0(MDB_env *env, int rlocked, int *dead) + } + for (; j<rdrs; j++) + if (mr[j].mr_pid == pid) { +- DPRINTF(("clear stale reader pid %u txn %"Z"d", ++ DPRINTF(("clear stale reader pid %u txn %"Yd, + (unsigned) pid, mr[j].mr_txnid)); + mr[j].mr_pid = 0; + count++; +diff --git a/libraries/liblmdb/mdb_copy.1 b/libraries/liblmdb/mdb_copy.1 +index 258affb..4387ac3 100644 +--- a/libraries/liblmdb/mdb_copy.1 ++++ b/libraries/liblmdb/mdb_copy.1 +@@ -36,6 +36,7 @@ Write the library version number to the standard output, and exit. + Compact while copying. Only current data pages will be copied; freed + or unused pages will be omitted from the copy. This option will + slow down the backup process as it is more CPU-intensive. ++Currently it fails if the environment has suffered a page leak. + .TP + .BR \-n + Open LDMB environment(s) which do not use subdirectories. +diff --git a/libraries/liblmdb/mdb_dump.c b/libraries/liblmdb/mdb_dump.c +index 17def6b..13084a2 100644 +--- a/libraries/liblmdb/mdb_dump.c ++++ b/libraries/liblmdb/mdb_dump.c +@@ -20,11 +20,7 @@ + #include <signal.h> + #include "lmdb.h" + +-#ifdef _WIN32 +-#define Z "I" +-#else +-#define Z "z" +-#endif ++#define Yu MDB_PRIy(u) + + #define PRINT 1 + static int mode; +@@ -115,7 +111,7 @@ static int dumpit(MDB_txn *txn, MDB_dbi dbi, char *name) + if (name) + printf("database=%s\n", name); + printf("type=btree\n"); +- printf("mapsize=%" Z "u\n", info.me_mapsize); ++ printf("mapsize=%"Yu"\n", info.me_mapsize); + if (info.me_mapaddr) + printf("mapaddr=%p\n", info.me_mapaddr); + printf("maxreaders=%u\n", info.me_maxreaders); +diff --git a/libraries/liblmdb/mdb_load.c b/libraries/liblmdb/mdb_load.c +index 053cc88..73dfe8c 100644 +--- a/libraries/liblmdb/mdb_load.c ++++ b/libraries/liblmdb/mdb_load.c +@@ -25,7 +25,7 @@ static int mode; + + static char *subname = NULL; + +-static size_t lineno; ++static mdb_size_t lineno; + static int version; + + static int flags; +@@ -38,11 +38,7 @@ static MDB_envinfo info; + + static MDB_val kbuf, dbuf; + +-#ifdef _WIN32 +-#define Z "I" +-#else +-#define Z "z" +-#endif ++#define Yu MDB_PRIy(u) + + #define STRLENOF(s) (sizeof(s)-1) + +@@ -73,7 +69,7 @@ static void readhdr(void) + if (!strncmp(dbuf.mv_data, "VERSION=", STRLENOF("VERSION="))) { + version=atoi((char *)dbuf.mv_data+STRLENOF("VERSION=")); + if (version > 3) { +- fprintf(stderr, "%s: line %" Z "d: unsupported VERSION %d\n", ++ fprintf(stderr, "%s: line %"Yu": unsupported VERSION %d\n", + prog, lineno, version); + exit(EXIT_FAILURE); + } +@@ -83,7 +79,7 @@ static void readhdr(void) + if (!strncmp((char *)dbuf.mv_data+STRLENOF("FORMAT="), "print", STRLENOF("print"))) + mode |= PRINT; + else if (strncmp((char *)dbuf.mv_data+STRLENOF("FORMAT="), "bytevalue", STRLENOF("bytevalue"))) { +- fprintf(stderr, "%s: line %" Z "d: unsupported FORMAT %s\n", ++ fprintf(stderr, "%s: line %"Yu": unsupported FORMAT %s\n", + prog, lineno, (char *)dbuf.mv_data+STRLENOF("FORMAT=")); + exit(EXIT_FAILURE); + } +@@ -94,7 +90,7 @@ static void readhdr(void) + subname = strdup((char *)dbuf.mv_data+STRLENOF("database=")); + } else if (!strncmp(dbuf.mv_data, "type=", STRLENOF("type="))) { + if (strncmp((char *)dbuf.mv_data+STRLENOF("type="), "btree", STRLENOF("btree"))) { +- fprintf(stderr, "%s: line %" Z "d: unsupported type %s\n", ++ fprintf(stderr, "%s: line %"Yu": unsupported type %s\n", + prog, lineno, (char *)dbuf.mv_data+STRLENOF("type=")); + exit(EXIT_FAILURE); + } +@@ -104,7 +100,7 @@ static void readhdr(void) + if (ptr) *ptr = '\0'; + i = sscanf((char *)dbuf.mv_data+STRLENOF("mapaddr="), "%p", &info.me_mapaddr); + if (i != 1) { +- fprintf(stderr, "%s: line %" Z "d: invalid mapaddr %s\n", ++ fprintf(stderr, "%s: line %"Yu": invalid mapaddr %s\n", + prog, lineno, (char *)dbuf.mv_data+STRLENOF("mapaddr=")); + exit(EXIT_FAILURE); + } +@@ -112,9 +108,10 @@ static void readhdr(void) + int i; + ptr = memchr(dbuf.mv_data, '\n', dbuf.mv_size); + if (ptr) *ptr = '\0'; +- i = sscanf((char *)dbuf.mv_data+STRLENOF("mapsize="), "%" Z "u", &info.me_mapsize); ++ i = sscanf((char *)dbuf.mv_data+STRLENOF("mapsize="), ++ "%" MDB_SCNy(u), &info.me_mapsize); + if (i != 1) { +- fprintf(stderr, "%s: line %" Z "d: invalid mapsize %s\n", ++ fprintf(stderr, "%s: line %"Yu": invalid mapsize %s\n", + prog, lineno, (char *)dbuf.mv_data+STRLENOF("mapsize=")); + exit(EXIT_FAILURE); + } +@@ -124,7 +121,7 @@ static void readhdr(void) + if (ptr) *ptr = '\0'; + i = sscanf((char *)dbuf.mv_data+STRLENOF("maxreaders="), "%u", &info.me_maxreaders); + if (i != 1) { +- fprintf(stderr, "%s: line %" Z "d: invalid maxreaders %s\n", ++ fprintf(stderr, "%s: line %"Yu": invalid maxreaders %s\n", + prog, lineno, (char *)dbuf.mv_data+STRLENOF("maxreaders=")); + exit(EXIT_FAILURE); + } +@@ -140,12 +137,12 @@ static void readhdr(void) + if (!dbflags[i].bit) { + ptr = memchr(dbuf.mv_data, '=', dbuf.mv_size); + if (!ptr) { +- fprintf(stderr, "%s: line %" Z "d: unexpected format\n", ++ fprintf(stderr, "%s: line %"Yu": unexpected format\n", + prog, lineno); + exit(EXIT_FAILURE); + } else { + *ptr = '\0'; +- fprintf(stderr, "%s: line %" Z "d: unrecognized keyword ignored: %s\n", ++ fprintf(stderr, "%s: line %"Yu": unrecognized keyword ignored: %s\n", + prog, lineno, (char *)dbuf.mv_data); + } + } +@@ -155,7 +152,7 @@ static void readhdr(void) + + static void badend(void) + { +- fprintf(stderr, "%s: line %" Z "d: unexpected end of input\n", ++ fprintf(stderr, "%s: line %"Yu": unexpected end of input\n", + prog, lineno); + } + +@@ -213,7 +210,7 @@ badend: + buf->mv_data = realloc(buf->mv_data, buf->mv_size*2); + if (!buf->mv_data) { + Eof = 1; +- fprintf(stderr, "%s: line %" Z "d: out of memory, line too long\n", ++ fprintf(stderr, "%s: line %"Yu": out of memory, line too long\n", + prog, lineno); + return EOF; + } +@@ -405,7 +402,7 @@ int main(int argc, char *argv[]) + + rc = readline(&data, &dbuf); + if (rc) { +- fprintf(stderr, "%s: line %" Z "d: failed to read key value\n", prog, lineno); ++ fprintf(stderr, "%s: line %"Yu": failed to read key value\n", prog, lineno); + goto txn_abort; + } + +@@ -420,7 +417,7 @@ int main(int argc, char *argv[]) + if (batch == 100) { + rc = mdb_txn_commit(txn); + if (rc) { +- fprintf(stderr, "%s: line %" Z "d: txn_commit: %s\n", ++ fprintf(stderr, "%s: line %"Yu": txn_commit: %s\n", + prog, lineno, mdb_strerror(rc)); + goto env_close; + } +@@ -440,7 +437,7 @@ int main(int argc, char *argv[]) + rc = mdb_txn_commit(txn); + txn = NULL; + if (rc) { +- fprintf(stderr, "%s: line %" Z "d: txn_commit: %s\n", ++ fprintf(stderr, "%s: line %"Yu": txn_commit: %s\n", + prog, lineno, mdb_strerror(rc)); + goto env_close; + } +diff --git a/libraries/liblmdb/mdb_stat.c b/libraries/liblmdb/mdb_stat.c +index a5cda2f..0343a65 100644 +--- a/libraries/liblmdb/mdb_stat.c ++++ b/libraries/liblmdb/mdb_stat.c +@@ -17,11 +17,8 @@ + #include <unistd.h> + #include "lmdb.h" + +-#ifdef _WIN32 +-#define Z "I" +-#else +-#define Z "z" +-#endif ++#define Z MDB_FMT_Z ++#define Yu MDB_PRIy(u) + + static void prstat(MDB_stat *ms) + { +@@ -29,10 +26,10 @@ static void prstat(MDB_stat *ms) + printf(" Page size: %u\n", ms->ms_psize); + #endif + printf(" Tree depth: %u\n", ms->ms_depth); +- printf(" Branch pages: %"Z"u\n", ms->ms_branch_pages); +- printf(" Leaf pages: %"Z"u\n", ms->ms_leaf_pages); +- printf(" Overflow pages: %"Z"u\n", ms->ms_overflow_pages); +- printf(" Entries: %"Z"u\n", ms->ms_entries); ++ printf(" Branch pages: %"Yu"\n", ms->ms_branch_pages); ++ printf(" Leaf pages: %"Yu"\n", ms->ms_leaf_pages); ++ printf(" Overflow pages: %"Yu"\n", ms->ms_overflow_pages); ++ printf(" Entries: %"Yu"\n", ms->ms_entries); + } + + static void usage(char *prog) +@@ -125,11 +122,11 @@ int main(int argc, char *argv[]) + (void)mdb_env_info(env, &mei); + printf("Environment Info\n"); + printf(" Map address: %p\n", mei.me_mapaddr); +- printf(" Map size: %"Z"u\n", mei.me_mapsize); ++ printf(" Map size: %"Yu"\n", mei.me_mapsize); + printf(" Page size: %u\n", mst.ms_psize); +- printf(" Max pages: %"Z"u\n", mei.me_mapsize / mst.ms_psize); +- printf(" Number of pages used: %"Z"u\n", mei.me_last_pgno+1); +- printf(" Last transaction ID: %"Z"u\n", mei.me_last_txnid); ++ printf(" Max pages: %"Yu"\n", mei.me_mapsize / mst.ms_psize); ++ printf(" Number of pages used: %"Yu"\n", mei.me_last_pgno+1); ++ printf(" Last transaction ID: %"Yu"\n", mei.me_last_txnid); + printf(" Max readers: %u\n", mei.me_maxreaders); + printf(" Number of readers used: %u\n", mei.me_numreaders); + } +@@ -156,7 +153,7 @@ int main(int argc, char *argv[]) + if (freinfo) { + MDB_cursor *cursor; + MDB_val key, data; +- size_t pages = 0, *iptr; ++ mdb_size_t pages = 0, *iptr; + + printf("Freelist Status\n"); + dbi = 0; +@@ -176,7 +173,7 @@ int main(int argc, char *argv[]) + pages += *iptr; + if (freinfo > 1) { + char *bad = ""; +- size_t pg, prev; ++ mdb_size_t pg, prev; + ssize_t i, j, span = 0; + j = *iptr++; + for (i = j, prev = 1; --i >= 0; ) { +@@ -187,20 +184,20 @@ int main(int argc, char *argv[]) + pg += span; + for (; i >= span && iptr[i-span] == pg; span++, pg++) ; + } +- printf(" Transaction %"Z"u, %"Z"d pages, maxspan %"Z"d%s\n", +- *(size_t *)key.mv_data, j, span, bad); ++ printf(" Transaction %"Yu", %"Z"d pages, maxspan %"Z"d%s\n", ++ *(mdb_size_t *)key.mv_data, j, span, bad); + if (freinfo > 2) { + for (--j; j >= 0; ) { + pg = iptr[j]; + for (span=1; --j >= 0 && iptr[j] == pg+span; span++) ; +- printf(span>1 ? " %9"Z"u[%"Z"d]\n" : " %9"Z"u\n", ++ printf(span>1 ? " %9"Yu"[%"Z"d]\n" : " %9"Yu"\n", + pg, span); + } + } + } + } + mdb_cursor_close(cursor); +- printf(" Free pages: %"Z"u\n", pages); ++ printf(" Free pages: %"Yu"\n", pages); + } + + rc = mdb_open(txn, subname, 0, &dbi); +diff --git a/libraries/liblmdb/midl.c b/libraries/liblmdb/midl.c +index 5c6d841..9748d8d 100644 +--- a/libraries/liblmdb/midl.c ++++ b/libraries/liblmdb/midl.c +@@ -3,7 +3,7 @@ + /* $OpenLDAP$ */ + /* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * +- * Copyright 2000-2015 The OpenLDAP Foundation. ++ * Copyright 2000-2016 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -354,5 +354,67 @@ int mdb_mid2l_append( MDB_ID2L ids, MDB_ID2 *id ) + return 0; + } + ++#ifdef MDB_VL32 ++unsigned mdb_mid3l_search( MDB_ID3L ids, MDB_ID id ) ++{ ++ /* ++ * binary search of id in ids ++ * if found, returns position of id ++ * if not found, returns first position greater than id ++ */ ++ unsigned base = 0; ++ unsigned cursor = 1; ++ int val = 0; ++ unsigned n = (unsigned)ids[0].mid; ++ ++ while( 0 < n ) { ++ unsigned pivot = n >> 1; ++ cursor = base + pivot + 1; ++ val = CMP( id, ids[cursor].mid ); ++ ++ if( val < 0 ) { ++ n = pivot; ++ ++ } else if ( val > 0 ) { ++ base = cursor; ++ n -= pivot + 1; ++ ++ } else { ++ return cursor; ++ } ++ } ++ ++ if( val > 0 ) { ++ ++cursor; ++ } ++ return cursor; ++} ++ ++int mdb_mid3l_insert( MDB_ID3L ids, MDB_ID3 *id ) ++{ ++ unsigned x, i; ++ ++ x = mdb_mid3l_search( ids, id->mid ); ++ ++ if( x < 1 ) { ++ /* internal error */ ++ return -2; ++ } ++ ++ if ( x <= ids[0].mid && ids[x].mid == id->mid ) { ++ /* duplicate */ ++ return -1; ++ } ++ ++ /* insert id */ ++ ids[0].mid++; ++ for (i=(unsigned)ids[0].mid; i>x; i--) ++ ids[i] = ids[i-1]; ++ ids[x] = *id; ++ ++ return 0; ++} ++#endif /* MDB_VL32 */ ++ + /** @} */ + /** @} */ +diff --git a/libraries/liblmdb/midl.h b/libraries/liblmdb/midl.h +index 2331e78..dc532c4 100644 +--- a/libraries/liblmdb/midl.h ++++ b/libraries/liblmdb/midl.h +@@ -11,7 +11,7 @@ + /* $OpenLDAP$ */ + /* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * +- * Copyright 2000-2015 The OpenLDAP Foundation. ++ * Copyright 2000-2016 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -26,7 +26,7 @@ + #ifndef _MDB_MIDL_H_ + #define _MDB_MIDL_H_ + +-#include <stddef.h> ++#include "lmdb.h" + + #ifdef __cplusplus + extern "C" { +@@ -42,7 +42,7 @@ extern "C" { + /** A generic unsigned ID number. These were entryIDs in back-bdb. + * Preferably it should have the same size as a pointer. + */ +-typedef size_t MDB_ID; ++typedef mdb_size_t MDB_ID; + + /** An IDL is an ID List, a sorted array of IDs. The first + * element of the array is a counter for how many actual +@@ -55,7 +55,11 @@ typedef MDB_ID *MDB_IDL; + /* IDL sizes - likely should be even bigger + * limiting factors: sizeof(ID), thread stack size + */ ++#ifdef MDB_VL32 ++#define MDB_IDL_LOGN 14 /* DB_SIZE is 2^14, UM_SIZE is 2^15 */ ++#else + #define MDB_IDL_LOGN 16 /* DB_SIZE is 2^16, UM_SIZE is 2^17 */ ++#endif + #define MDB_IDL_DB_SIZE (1<<MDB_IDL_LOGN) + #define MDB_IDL_UM_SIZE (1<<(MDB_IDL_LOGN+1)) + +@@ -177,6 +181,20 @@ int mdb_mid2l_insert( MDB_ID2L ids, MDB_ID2 *id ); + */ + int mdb_mid2l_append( MDB_ID2L ids, MDB_ID2 *id ); + ++#ifdef MDB_VL32 ++typedef struct MDB_ID3 { ++ MDB_ID mid; /**< The ID */ ++ void *mptr; /**< The pointer */ ++ unsigned int mcnt; /**< Number of pages */ ++ unsigned int mref; /**< Refcounter */ ++} MDB_ID3; ++ ++typedef MDB_ID3 *MDB_ID3L; ++ ++unsigned mdb_mid3l_search( MDB_ID3L ids, MDB_ID id ); ++int mdb_mid3l_insert( MDB_ID3L ids, MDB_ID3 *id ); ++ ++#endif /* MDB_VL32 */ + /** @} */ + /** @} */ + #ifdef __cplusplus diff --git a/ports/lmdb/portfile.cmake b/ports/lmdb/portfile.cmake new file mode 100644 index 000000000..4c038071e --- /dev/null +++ b/ports/lmdb/portfile.cmake @@ -0,0 +1,33 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lmdb-LMDB_0.9.18/libraries/liblmdb) +vcpkg_download_distfile(ARCHIVE_FILE + URLS "https://github.com/LMDB/lmdb/archive/LMDB_0.9.18.zip" + FILENAME "LMDB_0.9.18.zip" + SHA512 46d7ba226af05443c871f83c6ae0ab2ddbeecd289df59c082e806e135fcaa69d9d9060a19a4a907c4f7046de30871126e91e540eca27fc94446e95ba5616155b +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) + +vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lmdb-LMDB_0.9.18 + PATCHES ${CMAKE_CURRENT_LIST_DIR}/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake/ DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG + -DLMDB_INSTALL_HEADERS=OFF +) + +vcpkg_install_cmake() + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/lmdb/lmdb-targets-debug.cmake LMDB_DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" LMDB_DEBUG_MODULE "${LMDB_DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/lmdb/lmdb-targets-debug.cmake "${LMDB_DEBUG_MODULE}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +file(INSTALL ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lmdb RENAME copyright) + +vcpkg_copy_pdbs()
\ No newline at end of file diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt index 68de76788..faef8018b 100644 --- a/ports/lua/CMakeLists.txt +++ b/ports/lua/CMakeLists.txt @@ -1,3 +1,12 @@ +# Lua can be compiled as either C or C++. +# Default configuration is C, set COMPILE_AS_CPP to ON to use C++. +# See http://stackoverflow.com/questions/13560945/c-and-c-library-using-longjmp for why would you want to do that. +# Primary differences: +# - Exceptions will be used instead of setjmp/longjmp +# - The name mangling for functions will be C++ instead of C. +# - This is a source-incompatible change because extern "C" is chosen by the including application. +# - The lua.hpp header will not be available. + PROJECT ( lua ) IF( NOT WIN32 ) @@ -22,6 +31,10 @@ src/lopcodes.c src/loslib.c src/lparser.c src/lstate.c src/lstring.c src/lstrlib src/ltable.c src/ltablib.c src/ltm.c src/lundump.c src/lutf8lib.c src/lvm.c src/lzio.c ) +IF (COMPILE_AS_CPP) + SET_SOURCE_FILES_PROPERTIES(${SRC_LIBLUA} src/lua.c src/luac.c PROPERTIES LANGUAGE CXX) +ENDIF () + # append headers to sources to make them show up in MSVC GUI LIST(APPEND SRC_LIBLUA ${HDR_LIBLUA}) @@ -54,8 +67,11 @@ IF (NOT DEFINED SKIP_INSTALL_HEADERS) src/lualib.h src/lua.h src/luaconf.h - src/lua.hpp src/lauxlib.h DESTINATION include ) + # If using C++, don't install extern "C" wrapper. + IF (NOT COMPILE_AS_CPP) + INSTALL(FILES src/lua.hpp DESTINATION include) + ENDIF () ENDIF () diff --git a/ports/lua/CONTROL b/ports/lua/CONTROL index b284bfa85..266bd153c 100644 --- a/ports/lua/CONTROL +++ b/ports/lua/CONTROL @@ -1,3 +1,3 @@ Source: lua -Version: 5.3.3-2 +Version: 5.3.4 Description: a powerful, fast, lightweight, embeddable scripting language diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake index 0778a77f9..beda8362e 100644 --- a/ports/lua/portfile.cmake +++ b/ports/lua/portfile.cmake @@ -7,11 +7,11 @@ # include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lua-5.3.3) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lua-5.3.4) 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 + URLS "http://www.lua.org/ftp/lua-5.3.4.tar.gz" + FILENAME "lua-5.3.4.tar.gz" + SHA512 739e31f82e6a60fa99910c2005e991b3a1e21339af52847f653cb190b30842054d189ca116ffcfdf9b36e07888c9ce5642b1dd2988cc7eff9f8789f9a2e34997 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -19,6 +19,9 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DCOMPILE_AS_CPP=OFF OPTIONS_DEBUG -DSKIP_INSTALL_HEADERS=ON -DSKIP_INSTALL_TOOLS=ON @@ -26,6 +29,12 @@ vcpkg_configure_cmake( vcpkg_install_cmake() +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(READ ${CURRENT_PACKAGES_DIR}/include/luaconf.h LUA_CONF_H) + string(REPLACE "defined(LUA_BUILD_AS_DLL)" "1" LUA_CONF_H "${LUA_CONF_H}") + file(WRITE ${CURRENT_PACKAGES_DIR}/include/luaconf.h "${LUA_CONF_H}") +endif() + # Handle copyright file(COPY ${CMAKE_CURRENT_LIST_DIR}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lua) vcpkg_copy_pdbs() diff --git a/ports/lz4/CONTROL b/ports/lz4/CONTROL index 90be24a5b..b48ba5424 100644 --- a/ports/lz4/CONTROL +++ b/ports/lz4/CONTROL @@ -1,3 +1,3 @@ Source: lz4
-Version: 1.7.4.2
+Version: 1.7.5
Description: Lossless compression algorithm, providing compression speed at 400 MB/s per core.
diff --git a/ports/lz4/portfile.cmake b/ports/lz4/portfile.cmake index 9e2153e4b..dc6f80ed9 100644 --- a/ports/lz4/portfile.cmake +++ b/ports/lz4/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lz4-1.7.4.2)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lz4-1.7.5)
vcpkg_download_distfile(ARCHIVE
- URLS "https://github.com/lz4/lz4/archive/v1.7.4.2.zip"
- FILENAME "lz4-1.7.4.2.zip"
- SHA512 c9a65031225ccda43ad4c7622e9f36762c18e58b4aaf43b1a33f219186fb55c43ca354f574a1591188db39f57631351b1b90f96e0c150e28de08dcb65c6759d0)
+ URLS "https://github.com/lz4/lz4/archive/v1.7.5.zip"
+ FILENAME "lz4-1.7.5.zip"
+ SHA512 09968b67a5cd8555f6e1d95b99971a82d228c6d8d9f9dd9e9a33c9633bed9bcf1e370c2ff44e58c6ca72d103c149585b3e83061c690f3e857eb5f53d586f86a4)
vcpkg_extract_source_archive(${ARCHIVE})
@@ -12,6 +12,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS_DEBUG
-DLZ4_SKIP_INCLUDES=ON)
diff --git a/ports/lzo/CONTROL b/ports/lzo/CONTROL new file mode 100644 index 000000000..afc3540d2 --- /dev/null +++ b/ports/lzo/CONTROL @@ -0,0 +1,3 @@ +Source: lzo +Version: 2.09 +Description: Lossless data compression library diff --git a/ports/lzo/do-not-declare-setargv.patch b/ports/lzo/do-not-declare-setargv.patch new file mode 100644 index 000000000..48ae31514 --- /dev/null +++ b/ports/lzo/do-not-declare-setargv.patch @@ -0,0 +1,17 @@ +diff --git a/src/lzo_supp.h b/src/lzo_supp.h +index 87307f9..f94a6b0 100644 +--- a/src/lzo_supp.h ++++ b/src/lzo_supp.h +@@ -3643,9 +3643,9 @@ LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } + #endif + #if (LZO_OS_WIN32 || LZO_OS_WIN64) + #if (LZO_CC_INTELC || LZO_CC_MSC) +-LZO_EXTERN_C int __lzo_cdecl __setargv(void); +-LZO_EXTERN_C int __lzo_cdecl _setargv(void); +-LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } ++// LZO_EXTERN_C int __lzo_cdecl __setargv(void); ++// LZO_EXTERN_C int __lzo_cdecl _setargv(void); ++// LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } + #endif + #endif + #if (LZO_OS_EMX) diff --git a/ports/lzo/portfile.cmake b/ports/lzo/portfile.cmake new file mode 100644 index 000000000..6df36269c --- /dev/null +++ b/ports/lzo/portfile.cmake @@ -0,0 +1,44 @@ +# 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} +# + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lzo-2.09) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz" + FILENAME "lzo-2.09.tar.gz" + SHA512 7c64e5e7d2050d75ac8c59d613f6f7230b74746b1d207666755b07450053c8b73980f12f8a1ec59d2af0bada02beec126aaacb675b8088b5fe65e97ff7e6bfc7 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/do-not-declare-setargv.patch" +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(COPY ${CURRENT_BUILDTREES_DIR}/src/lzo-2.09/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/lzo) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/lzo/COPYING ${CURRENT_PACKAGES_DIR}/share/lzo/copyright) diff --git a/ports/metis/CONTROL b/ports/metis/CONTROL new file mode 100644 index 000000000..cc604ce8f --- /dev/null +++ b/ports/metis/CONTROL @@ -0,0 +1,3 @@ +Source: metis +Version: 5.1.0 +Description: Serial Graph Partitioning and Fill-reducing Matrix Ordering diff --git a/ports/metis/disable-programs.patch b/ports/metis/disable-programs.patch new file mode 100644 index 000000000..0c23be553 --- /dev/null +++ b/ports/metis/disable-programs.patch @@ -0,0 +1,8 @@ +--- a/CMakeLists.txt Wed Dec 21 18:24:22 2016 ++++ b/CMakeLists.txt Wed Dec 21 18:24:26 2016 +@@ -20,4 +20,4 @@ + # Recursively look for CMakeLists.txt in subdirs. + add_subdirectory("include") + add_subdirectory("libmetis") +-add_subdirectory("programs") ++# add_subdirectory("programs") diff --git a/ports/metis/enable-install.patch b/ports/metis/enable-install.patch new file mode 100644 index 000000000..9f36623ad --- /dev/null +++ b/ports/metis/enable-install.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt Sat Mar 30 17:24:45 2013 ++++ b/CMakeLists.txt Wed Dec 21 18:23:43 2016 +@@ -4,11 +4,7 @@ + set(GKLIB_PATH "GKlib" CACHE PATH "path to GKlib") + set(SHARED FALSE CACHE BOOL "build a shared library") + +-if(MSVC) +- set(METIS_INSTALL FALSE) +-else() +- set(METIS_INSTALL TRUE) +-endif() ++set(METIS_INSTALL TRUE) + + # Configure libmetis library. + if(SHARED) diff --git a/ports/metis/fix-gklib-vs14-math.patch b/ports/metis/fix-gklib-vs14-math.patch new file mode 100644 index 000000000..e83a68230 --- /dev/null +++ b/ports/metis/fix-gklib-vs14-math.patch @@ -0,0 +1,11 @@ +--- a/GKlib/gk_arch.h Wed Dec 21 18:34:18 2016 ++++ b/GKlib/gk_arch.h Wed Dec 21 18:30:49 2016 +@@ -58,7 +58,7 @@ + #define PTRDIFF_MAX INT64_MAX + #endif + +-#ifdef __MSC__ ++#if defined(__MSC__) && (_MSC_VER < 1900) + /* MSC does not have rint() function */ + #define rint(x) ((int)((x)+0.5)) + diff --git a/ports/metis/fix-metis-vs14-math.patch b/ports/metis/fix-metis-vs14-math.patch new file mode 100644 index 000000000..a296213e8 --- /dev/null +++ b/ports/metis/fix-metis-vs14-math.patch @@ -0,0 +1,11 @@ +--- a/libmetis/metislib.h Sat Mar 30 17:24:45 2013 ++++ b/libmetis/metislib.h Wed Dec 21 18:30:59 2016 +@@ -31,7 +31,7 @@ + #include <proto.h> + + +-#if defined(COMPILER_MSC) ++#if defined(COMPILER_MSC) && (_MSC_VER < 1900) + #if defined(rint) + #undef rint + #endif diff --git a/ports/metis/fix-runtime-install-destination.patch b/ports/metis/fix-runtime-install-destination.patch new file mode 100644 index 000000000..8d9147e5f --- /dev/null +++ b/ports/metis/fix-runtime-install-destination.patch @@ -0,0 +1,10 @@ +--- a/libmetis/CMakeLists.txt Sat Mar 30 17:24:45 2013 ++++ b/libmetis/CMakeLists.txt Wed Dec 21 17:41:37 2016 +@@ -11,6 +11,6 @@ + if(METIS_INSTALL) + install(TARGETS metis + LIBRARY DESTINATION lib +- RUNTIME DESTINATION lib ++ RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib) + endif() diff --git a/ports/metis/portfile.cmake b/ports/metis/portfile.cmake new file mode 100644 index 000000000..c53adde4e --- /dev/null +++ b/ports/metis/portfile.cmake @@ -0,0 +1,47 @@ +# 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(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/metis-5.1.0) +vcpkg_download_distfile(ARCHIVE + URLS "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz" + FILENAME "metis-5.1.0.tar.gz" + SHA512 deea47749d13bd06fbeaf98a53c6c0b61603ddc17a43dae81d72c8015576f6495fd83c11b0ef68d024879ed5415c14ebdbd87ce49c181bdac680573bea8bdb25 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/enable-install.patch + ${CMAKE_CURRENT_LIST_DIR}/disable-programs.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-runtime-install-destination.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-metis-vs14-math.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-gklib-vs14-math.patch +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(OPTIONS -DSHARED=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON) +else() + set(OPTIONS -DSHARED=OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + ${OPTIONS} +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/metis) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/metis/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/metis/copyright) diff --git a/ports/mongo-c-driver/bson.patch b/ports/mongo-c-driver/bson.patch new file mode 100644 index 000000000..83291d699 --- /dev/null +++ b/ports/mongo-c-driver/bson.patch @@ -0,0 +1,24 @@ +diff --git a/build/cmake/FindBSON.cmake b/build/cmake/FindBSON.cmake +index 4ac39ea..d11aa1f 100644 +--- a/build/cmake/FindBSON.cmake ++++ b/build/cmake/FindBSON.cmake +@@ -12,6 +12,7 @@ endif () + find_path(BSON_INCLUDE_DIR + NAMES + libbson-1.0/bson.h ++ bson.h + HINTS + ${BSON_ROOT_DIR} + ${_BSON_INCLUDEDIR} +@@ -19,7 +20,10 @@ find_path(BSON_INCLUDE_DIR + include + ) + +-set(BSON_INCLUDE_DIR "${BSON_INCLUDE_DIR}/libbson-1.0") ++set(BSON_INCLUDE_DIR "${BSON_INCLUDE_DIR}") ++if (NOT EXISTS ${BSON_INCLUDE_DIR}/bson.h) ++ set(BSON_INCLUDE_DIR "${BSON_INCLUDE_DIR}/libbson-1.0") ++endif() + + if(WIN32 AND NOT CYGWIN) + if(MSVC) diff --git a/ports/mongo-c-driver/portfile.cmake b/ports/mongo-c-driver/portfile.cmake index 833d7393c..0db81f8d3 100644 --- a/ports/mongo-c-driver/portfile.cmake +++ b/ports/mongo-c-driver/portfile.cmake @@ -8,13 +8,18 @@ vcpkg_download_distfile(ARCHIVE )
vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/bson.patch
+)
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DBSON_ROOT_DIR=${CURRENT_INSTALLED_DIR}
-DENABLE_TESTS=OFF
-DENABLE_EXAMPLES=OFF
- -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON
)
vcpkg_install_cmake()
diff --git a/ports/mongo-cxx-driver/CONTROL b/ports/mongo-cxx-driver/CONTROL index 41c958400..57c400bed 100644 --- a/ports/mongo-cxx-driver/CONTROL +++ b/ports/mongo-cxx-driver/CONTROL @@ -1,4 +1,4 @@ Source: mongo-cxx-driver -Version: 3.0.3 +Version: 3.0.3-1 Build-Depends: boost,libbson,mongo-c-driver Description: MongoDB C++ Driver.
\ No newline at end of file diff --git a/ports/mongo-cxx-driver/portfile.cmake b/ports/mongo-cxx-driver/portfile.cmake index 137088109..4f3ed9dca 100644 --- a/ports/mongo-cxx-driver/portfile.cmake +++ b/ports/mongo-cxx-driver/portfile.cmake @@ -20,7 +20,6 @@ vcpkg_configure_cmake( OPTIONS
-DLIBBSON_DIR=${CURRENT_INSTALLED_DIR}
-DLIBMONGOC_DIR=${CURRENT_INSTALLED_DIR}
- -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON
)
vcpkg_install_cmake()
@@ -53,7 +52,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/mongocxx/test_util
${CURRENT_PACKAGES_DIR}/include/mongocxx/private
${CURRENT_PACKAGES_DIR}/include/mongocxx/exception/private
- ${CURRENT_PACKAGES_DIR}/include/mongocxx/options
+ ${CURRENT_PACKAGES_DIR}/include/mongocxx/options/private
${CURRENT_PACKAGES_DIR}/debug/include)
diff --git a/ports/mpg123/portfile.cmake b/ports/mpg123/portfile.cmake index 0308bb17e..76b69c48b 100644 --- a/ports/mpg123/portfile.cmake +++ b/ports/mpg123/portfile.cmake @@ -13,7 +13,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_find_acquire_program(YASM) get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) -set(ENV{PATH} "${YASM_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} diff --git a/ports/mpir/CONTROL b/ports/mpir/CONTROL index 6d8646f93..2b67c7c98 100644 --- a/ports/mpir/CONTROL +++ b/ports/mpir/CONTROL @@ -1,3 +1,3 @@ -Source: mpir -Version: 2.7.2 +Source: mpir
+Version: 3.0.0-1
Description: Multiple Precision Integers and Rationals.
\ No newline at end of file diff --git a/ports/mpir/portfile.cmake b/ports/mpir/portfile.cmake index a3a704407..96bfa9454 100644 --- a/ports/mpir/portfile.cmake +++ b/ports/mpir/portfile.cmake @@ -1,53 +1,83 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2) -vcpkg_download_distfile(ARCHIVE_FILE - URLS "http://mpir.org/mpir-2.7.2.tar.lz" - FILENAME "mpir-2.7.2.tar.lz" - SHA512 2635c167ddbba99364ec741373768e0675d34f94fad8912d5433b95e6fbfdb0510f5e94a707acc42048254bc658c52c6671bb0c0dac31267c4b82b00c3e74efa -) -vcpkg_extract_source_archive(${ARCHIVE_FILE}) - -vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj -) - -IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") - SET(BUILD_ARCH "Win32") -ELSE() - SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) -ENDIF() - -file(INSTALL - ${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 - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.dll - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.dll - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/bin -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib -) - -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright) - -vcpkg_copy_pdbs() -message(STATUS "Installing done") +include(vcpkg_common_functions)
+
+set(MPIR_VERSION 3.0.0)
+set(MPIR_HASH "c735105db8b86db739fd915bf16064e6bc82d0565ad8858059e4e93f62c9d72d9a1c02a5ca9859b184346a8dc64fa714d4d61404cff1e405dc548cbd54d0a88e")
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpir-${MPIR_VERSION})
+
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "http://mpir.org/mpir-${MPIR_VERSION}.tar.bz2"
+ FILENAME "mpir-${MPIR_VERSION}.tar.bz2"
+ SHA512 ${MPIR_HASH}
+)
+vcpkg_extract_source_archive(${ARCHIVE_FILE})
+
+if(VCPKG_PLATFORM_TOOLSET MATCHES "v141*")
+ set(MSVC_VERSION 15)
+else()
+ set(MSVC_VERSION 14)
+endif()
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/build.vc${MSVC_VERSION}/dll_mpir_gc/dll_mpir_gc.vcxproj
+ )
+else()
+ vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/build.vc${MSVC_VERSION}/lib_mpir_gc/lib_mpir_gc.vcxproj
+ )
+endif()
+
+IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ SET(BUILD_ARCH "Win32")
+ELSE()
+ SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
+ENDIF()
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ file(INSTALL
+ ${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
+ ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.dll
+ ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.dll
+ ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib
+ )
+ file(INSTALL ${SOURCE_PATH}/COPYING.lib DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright)
+ vcpkg_copy_pdbs()
+else()
+ file(INSTALL
+ ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/gmp.h
+ ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/gmpxx.h
+ ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/mpir.h
+ ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/mpirxx.h
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/mpir.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/lib/${BUILD_ARCH}/Release/mpir.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib
+ )
+ file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright)
+endif()
+
+message(STATUS "Installing done")
diff --git a/ports/msgpack/CONTROL b/ports/msgpack/CONTROL new file mode 100644 index 000000000..de50a5575 --- /dev/null +++ b/ports/msgpack/CONTROL @@ -0,0 +1,3 @@ +Source: msgpack +Version: 2.1.1 +Description: MessagePack is an efficient binary serialization format, which lets you exchange data among multiple languages like JSON, except that it's faster and smaller. diff --git a/ports/msgpack/portfile.cmake b/ports/msgpack/portfile.cmake new file mode 100644 index 000000000..3beb72c5d --- /dev/null +++ b/ports/msgpack/portfile.cmake @@ -0,0 +1,32 @@ +include(vcpkg_common_functions) + +set(MSGPACK_VERSION 2.1.1) +set(MSGPACK_HASH 31ed6fda498d43da6fdbbe000ce36c40e4cf886f00d879c57d406def7f5bba4eaf66f02f221398cb50f6f4c748d5cde9c97eca0cfa21b368c7c933c3301cf9b5) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/msgpack-${MSGPACK_VERSION}) + +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/msgpack/msgpack-c/releases/download/cpp-${MSGPACK_VERSION}/msgpack-${MSGPACK_VERSION}.tar.gz" + FILENAME "msgpack-${MSGPACK_VERSION}.tar.gz" + SHA512 ${MSGPACK_HASH} +) +vcpkg_extract_source_archive(${ARCHIVE}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(MSGPACK_ENABLE_SHARED OFF) +else() + set(MSGPACK_ENABLE_SHARED ON) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS -DMSGPACK_ENABLE_SHARED=${MSGPACK_ENABLE_SHARED} +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/msgpack) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/msgpack/COPYING ${CURRENT_PACKAGES_DIR}/share/msgpack/copyright) diff --git a/ports/msmpi/CONTROL b/ports/msmpi/CONTROL new file mode 100644 index 000000000..e17fd1c00 --- /dev/null +++ b/ports/msmpi/CONTROL @@ -0,0 +1,3 @@ +Source: msmpi +Version: 8.0-1 +Description: Microsoft MPI diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake new file mode 100644 index 000000000..6125a20f6 --- /dev/null +++ b/ports/msmpi/portfile.cmake @@ -0,0 +1,119 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/msmpi-8.0) + +vcpkg_download_distfile(SDK_ARCHIVE + URLS "https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/msmpisdk.msi" + FILENAME "msmpisdk-8.0.msi" + SHA512 49c762873ba777ccb3c959a1d2ca1392e4c3c8d366e604ad707184ea432302e6649894ec6599162d0d40f3e6ebc0dada1eb9ca0da1cde0f6ba7a9b1847dac8c0 +) + +### Check for correct version of installed redistributable package + +# We always want the ProgramFiles folder even on a 64-bit machine (not the ProgramFilesx86 folder) +vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS) +set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_PLATFORM_BITNESS}/Microsoft MPI/Bin/mpiexec.exe") +set(MSMPI_EXPECTED_FULL_VERSION "8.0.12438.0") + +if(EXISTS ${SYSTEM_MPIEXEC_FILEPATH}) + set(MPIEXEC_VERSION_LOGNAME "mpiexec-version") + vcpkg_execute_required_process( + COMMAND ${SYSTEM_MPIEXEC_FILEPATH} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} + LOGNAME ${MPIEXEC_VERSION_LOGNAME} + ) + file(READ ${CURRENT_BUILDTREES_DIR}/${MPIEXEC_VERSION_LOGNAME}-out.log MPIEXEC_OUTPUT) + + if(${MPIEXEC_OUTPUT} MATCHES "\\[Version ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)\\]") + if(NOT ${CMAKE_MATCH_1} STREQUAL ${MSMPI_EXPECTED_FULL_VERSION}) + message(FATAL_ERROR + " The version of the installed MSMPI redistributable packages does not match the version to be installed\n" + " Expected version: ${MSMPI_EXPECTED_FULL_VERSION}\n" + " Found version: ${CMAKE_MATCH_1}\n") + endif() + else() + message(FATAL_ERROR + " Could not determine installed MSMPI redistributable package version.\n" + " See logs for more information:\n" + " ${CURRENT_BUILDTREES_DIR}\\${MPIEXEC_VERSION_LOGNAME}-out.log\n" + " ${CURRENT_BUILDTREES_DIR}\\${MPIEXEC_VERSION_LOGNAME}-err.log\n") + endif() +else() + vcpkg_download_distfile(REDIST_ARCHIVE + URLS "https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/MSMpiSetup.exe" + FILENAME "MSMpiSetup-8.0.exe" + SHA512 f5271255817f5417de8e432cd21e5ff3c617911a30b7777560c0ceb6f4031ace5fa88fc7675759ae0964bcf4e2076fe367a06c129f3a9ad06871a08bf95ed68b + ) + + message(FATAL_ERROR + " Could not find:\n" + " ${SYSTEM_MPIEXEC_FILEPATH}\n" + " Please install the MSMPI redistributable package before trying to install this port.\n" + " The appropriate installer has been downloaded to:\n" + " ${REDIST_ARCHIVE}\n") +endif() + +file(TO_NATIVE_PATH "${SDK_ARCHIVE}" SDK_ARCHIVE) +file(TO_NATIVE_PATH "${SOURCE_PATH}/sdk" SDK_SOURCE_DIR) +file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/msiexec-${TARGET_TRIPLET}.log" MSIEXEC_LOG_PATH) + +vcpkg_execute_required_process( + COMMAND msiexec /a ${SDK_ARCHIVE} /qn TARGETDIR=${SDK_SOURCE_DIR} /log "${MSIEXEC_LOG_PATH}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} + LOGNAME extract-sdk +) + +set(SOURCE_INCLUDE_PATH "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/Include") +set(SOURCE_LIB_PATH "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/Lib") + +# Install include files +file(INSTALL + "${SOURCE_INCLUDE_PATH}/mpi.h" + "${SOURCE_INCLUDE_PATH}/mpif.h" + "${SOURCE_INCLUDE_PATH}/mpi.f90" + "${SOURCE_INCLUDE_PATH}/mpio.h" + "${SOURCE_INCLUDE_PATH}/mspms.h" + "${SOURCE_INCLUDE_PATH}/pmidbg.h" + "${SOURCE_INCLUDE_PATH}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h" + DESTINATION + ${CURRENT_PACKAGES_DIR}/include +) + +# Install release libraries +file(INSTALL + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifec.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifmc.lib" + DESTINATION + ${CURRENT_PACKAGES_DIR}/lib +) +if(${TRIPLET_SYSTEM_ARCH} STREQUAL "x86") + file(INSTALL + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib" + DESTINATION + ${CURRENT_PACKAGES_DIR}/lib + ) +endif() + +# Install debug libraries +# NOTE: since the binary distribution does not include any debug libraries we simply install the release libraries +SET(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) +file(INSTALL + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifec.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifmc.lib" + DESTINATION + ${CURRENT_PACKAGES_DIR}/debug/lib +) +if(${TRIPLET_SYSTEM_ARCH} STREQUAL "x86") + file(INSTALL + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib" + DESTINATION + ${CURRENT_PACKAGES_DIR}/debug/lib + ) +endif() + +# Handle copyright +file(COPY "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/License/license_sdk.rtf" DESTINATION ${CURRENT_PACKAGES_DIR}/share/msmpi) +file(WRITE ${CURRENT_PACKAGES_DIR}/share/msmpi/copyright "See the accompanying license_sdk.rtf") diff --git a/ports/nana/CONTROL b/ports/nana/CONTROL index e7692526f..96d79560f 100644 --- a/ports/nana/CONTROL +++ b/ports/nana/CONTROL @@ -1,4 +1,4 @@ Source: nana
-Version: 1.4.1
+Version: 1.4.1-66be23c9204c5567d1c51e6f57ba23bffa517a7c
Description: Cross-platform library for GUI programming in modern C++ style.
Build-Depends: zlib, libpng, libjpeg-turbo
diff --git a/ports/nana/portfile.cmake b/ports/nana/portfile.cmake index 66fca68fa..970590608 100644 --- a/ports/nana/portfile.cmake +++ b/ports/nana/portfile.cmake @@ -1,10 +1,11 @@ include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/nana)
+set(VERSION 66be23c9204c5567d1c51e6f57ba23bffa517a7c)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/nana-${VERSION})
vcpkg_download_distfile(ARCHIVE
- URLS "http://downloads.sourceforge.net/project/nanapro/Nana/Nana 1.x/nana 1.4.1.zip"
- FILENAME "nana 1.4.1.zip"
- SHA512 38a4fe4c9f932d0e69753c0c1e28d0c8f7cc1ab73c639b87dd5ba102ed25da1ee04c93ec5d6bb79945f7bc118cc131022604c75c1bb6eaced3a071eb137115cd)
+ URLS "https://github.com/cnjinhao/nana/archive/${VERSION}.zip"
+ FILENAME "nana-${VERSION}.zip"
+ SHA512 07a611850ebdd3be29fcc5dd199511af859da9e6ad9365b41900ab669e2c1c506c9c264a13a35d60b2d7906b577c8412f2423d67595b75f4de6f6c65b1db1f37)
vcpkg_extract_source_archive(${ARCHIVE})
@@ -32,5 +33,5 @@ endif() vcpkg_copy_pdbs()
-file(COPY ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/nana)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/nana/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/nana/copyright)
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/nana)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/nana/LICENSE ${CURRENT_PACKAGES_DIR}/share/nana/copyright)
diff --git a/ports/netcdf-c/CONTROL b/ports/netcdf-c/CONTROL new file mode 100644 index 000000000..1303cb517 --- /dev/null +++ b/ports/netcdf-c/CONTROL @@ -0,0 +1,4 @@ +Source: netcdf-c +Version: 4.4.1.1-1 +Build-Depends: hdf5, curl +Description: a set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. diff --git a/ports/netcdf-c/config-pkg-location.patch b/ports/netcdf-c/config-pkg-location.patch new file mode 100644 index 000000000..532082ccb --- /dev/null +++ b/ports/netcdf-c/config-pkg-location.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 46892ee..803ff46 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1742,7 +1742,9 @@ FILE(COPY ${netCDF_SOURCE_DIR}/include/netcdf_meta.h + # Create CMake package configuration files. With these, other packages using + # cmake should be able to find netcdf using find_package and find_library. + # The EXPORT call is paired with one in liblib. +-set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/netCDF) ++if(NOT DEFINED ConfigPackageLocation) ++ set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/netCDF) ++endif(NOT DEFINED ConfigPackageLocation) + + install(EXPORT netCDFTargets + DESTINATION ${ConfigPackageLocation} diff --git a/ports/netcdf-c/no-install-deps.patch b/ports/netcdf-c/no-install-deps.patch new file mode 100644 index 000000000..3d44b383e --- /dev/null +++ b/ports/netcdf-c/no-install-deps.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e87f3de..46892ee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1570,7 +1570,7 @@ ADD_SUBDIRECTORY(docs) + # install them in the binary dir. Grab all of the .libs, put them + # in the libdir. + ## +-IF(MSVC) ++IF(MSVC AND NOT DISABLE_INSTALL_DEPENDENCIES) + FILE(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/lib/*.lib) + INSTALL(FILES ${COPY_FILES} + DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/ports/netcdf-c/portfile.cmake b/ports/netcdf-c/portfile.cmake new file mode 100644 index 000000000..75a361106 --- /dev/null +++ b/ports/netcdf-c/portfile.cmake @@ -0,0 +1,53 @@ +# 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(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/netcdf-c-4.4.1.1) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/Unidata/netcdf-c/archive/v4.4.1.1.zip" + FILENAME "netcdf-c-v4.4.1.1.zip" + SHA512 8d31e47f0bd4d5c8640d3444c5c83425862ed1e8283aa78419e86b18d33fd93bfeb0067e8e9630457cb9c334d6fedf630283b5227a15137a3e153d57b22364a8 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/no-install-deps.patch + ${CMAKE_CURRENT_LIST_DIR}/config-pkg-location.patch + ${CMAKE_CURRENT_LIST_DIR}/transitive-hdf5.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DBUILD_UTILITIES=OFF + -DBUILD_TESTING=OFF + -DENABLE_EXAMPLES=OFF + -DENABLE_TESTS=OFF + -DUSE_HDF5=ON + -DENABLE_DAP_REMOTE_TESTS=OFF + -DDISABLE_INSTALL_DEPENDENCIES=ON + -DConfigPackageLocation=share/netcdf + + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/netcdf/netCDFTargets-debug.cmake NETCDF_TARGETS_DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" NETCDF_TARGETS_DEBUG_MODULE "${NETCDF_TARGETS_DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/netcdf/netCDFTargets-debug.cmake "${NETCDF_TARGETS_DEBUG_MODULE}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/netcdf-c) diff --git a/ports/netcdf-c/transitive-hdf5.patch b/ports/netcdf-c/transitive-hdf5.patch new file mode 100644 index 000000000..220640366 --- /dev/null +++ b/ports/netcdf-c/transitive-hdf5.patch @@ -0,0 +1,13 @@ +diff --git a/netCDFConfig.cmake.in b/netCDFConfig.cmake.in +index 6f4ccf8..14a3743 100644 +--- a/netCDFConfig.cmake.in ++++ b/netCDFConfig.cmake.in +@@ -11,6 +11,8 @@ set_and_check(netCDF_LIB_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@") + + set(netCDF_LIBRARIES netcdf) + ++find_package(HDF5 REQUIRED) ++ + # include target information + include("${CMAKE_CURRENT_LIST_DIR}/netCDFTargets.cmake") + diff --git a/ports/netcdf-cxx4/CONTROL b/ports/netcdf-cxx4/CONTROL new file mode 100644 index 000000000..9fcda5468 --- /dev/null +++ b/ports/netcdf-cxx4/CONTROL @@ -0,0 +1,4 @@ +Source: netcdf-cxx4 +Version: 4.3.0 +Build-Depends: netcdf-c +Description: a set of machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. diff --git a/ports/netcdf-cxx4/install-destination.patch b/ports/netcdf-cxx4/install-destination.patch new file mode 100644 index 000000000..7ff4e08c7 --- /dev/null +++ b/ports/netcdf-cxx4/install-destination.patch @@ -0,0 +1,33 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6673282..d6c7a78 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -522,10 +522,14 @@ write_basic_package_version_file( + COMPATIBILITY SameMajorVersion + ) + ++if(NOT DEFINED CMAKE_INSTALL_CMAKECONFIGDIR) ++ set(CMAKE_INSTALL_CMAKECONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/netCDFCxx) ++endif() ++ + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/netCDF/netCDFCxxConfigVersion.cmake" +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/netCDFCxx ++ DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR} + COMPONENT headers + ) + +diff --git a/cxx4/CMakeLists.txt b/cxx4/CMakeLists.txt +index 431eb45..0423594 100644 +--- a/cxx4/CMakeLists.txt ++++ b/cxx4/CMakeLists.txt +@@ -43,5 +43,7 @@ INSTALL( + ) + INSTALL( + TARGETS netcdf-cxx4 +- DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) diff --git a/ports/netcdf-cxx4/portfile.cmake b/ports/netcdf-cxx4/portfile.cmake new file mode 100644 index 000000000..92ae59675 --- /dev/null +++ b/ports/netcdf-cxx4/portfile.cmake @@ -0,0 +1,44 @@ +# 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} +# + +if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + message(STATUS "Warning: DLLs not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/netcdf-cxx4-4.3.0) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/Unidata/netcdf-cxx4/archive/v4.3.0.zip" + FILENAME "netcdf-cxx4-4.3.0.zip" + SHA512 c0ae933446c5bb019ab90c097787cefe15a0161b6b768e0251e9e0b21c92ca8d42d98babcbe07b81b8db08cd1e9fba7befb853611a76debfdfba0aee4fb4b0bc +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/install-destination.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DNCXX_ENABLE_TESTS=OFF + -DCMAKE_INSTALL_CMAKECONFIGDIR=share/netCDFCxx + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/netcdf-cxx4) diff --git a/ports/opencv/CONTROL b/ports/opencv/CONTROL index 74cf1d3bc..0c9766079 100644 --- a/ports/opencv/CONTROL +++ b/ports/opencv/CONTROL @@ -1,4 +1,4 @@ Source: opencv -Version: 3.1.0-1 +Version: 3.2.0 Build-Depends: zlib, libpng, libjpeg-turbo, tiff Description: computer vision library diff --git a/ports/opencv/opencv-installation-options.patch b/ports/opencv/opencv-installation-options.patch index 580334634..cfb401836 100644 --- a/ports/opencv/opencv-installation-options.patch +++ b/ports/opencv/opencv-installation-options.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3ee50ff..64b0405 100644 +index cc45f6f..b4265bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -250,6 +250,10 @@ OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF ) +@@ -263,6 +263,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) @@ -13,36 +13,18 @@ index 3ee50ff..64b0405 100644 # OpenCV build options # =================================================== -@@ -315,7 +319,9 @@ else() +@@ -330,7 +334,9 @@ else() endif() if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows) - if(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH) + if(DEFINED OpenCV_DISABLE_ARCH_PATH) -+ set(OpenCV_INSTALL_BINARIES_PREFIX "") ++ ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "") + elseif(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH) - set(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") + ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") else() message(STATUS "Can't detect runtime and/or arch") -@@ -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 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}) -@@ -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) +@@ -784,7 +790,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 @@ -50,29 +32,29 @@ index 3ee50ff..64b0405 100644 +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 ./ COMPONENT libs) diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake -index dbfd7ca..8bfa448 100644 +index 206acfd..b4c223e 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake -@@ -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}\"") +@@ -91,7 +91,7 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) + endif() + endfunction() --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() +-if(UNIX AND NOT ANDROID) ++if((UNIX AND NOT ANDROID) OR INSTALL_FORCE_UNIX_PATHS) + ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "" "") + endif() + +@@ -103,7 +103,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 "\"\"") - + if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows) + if(BUILD_SHARED_LIBS) + set(_lib_suffix "lib") diff --git a/cmake/OpenCVGenHeaders.cmake b/cmake/OpenCVGenHeaders.cmake index 2988979..810871b 100644 --- a/cmake/OpenCVGenHeaders.cmake @@ -97,10 +79,10 @@ index 2988979..810871b 100644 + install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT dev) +endif() diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake -index 3385385..530e53f 100644 +index 742a287..c8242dd 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake -@@ -879,7 +879,9 @@ macro(_ocv_create_module) +@@ -880,7 +880,9 @@ macro(_ocv_create_module) foreach(hdr ${OPENCV_MODULE_${m}_HEADERS}) string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}") if(NOT hdr2 MATCHES "opencv2/${m}/private.*" AND hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$" ) @@ -111,19 +93,6 @@ 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 @@ -142,19 +111,27 @@ 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..6ea20d6 100644 +index b4e48e6..d5ed455 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,7 +1,9 @@ -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) +- DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv +- COMPONENT dev) -install(FILES "opencv2/opencv.hpp" -+ install(FILES "opencv2/opencv.hpp" - DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 - COMPONENT dev) +- DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 +- COMPONENT dev) ++if(INSTALL_HEADERS) ++ file(GLOB old_hdrs "opencv/*.h*") ++ install(FILES ${old_hdrs} ++ DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv ++ COMPONENT dev) ++ install(FILES "opencv2/opencv.hpp" ++ DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 ++ COMPONENT dev) +endif() +\ No newline at end of file +-- +2.9.0.windows.1 + diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 224c99c42..6614fbb1a 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -3,11 +3,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) set(VCPKG_LIBRARY_LINKAGE dynamic) endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv-92387b1ef8fad15196dd5f7fb4931444a68bc93a) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv-3.2.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/opencv/opencv/archive/92387b1ef8fad15196dd5f7fb4931444a68bc93a.zip" - FILENAME "opencv-92387b1ef8fad15196dd5f7fb4931444a68bc93a.zip" - SHA512 b95fa1a5bce0ea9e9bd43173b904e5d779a2f640f4f8dbb36a12df462e8e4cdce3ff94b2fbd85cb96ddf338019f9888e9e7410c468c81b1de98d9c1da945a7eb + URLS "https://github.com/opencv/opencv/archive/3.2.0.zip" + FILENAME "opencv-3.2.0.zip" + SHA512 c6418d2a7654fe9d50611e756778df4c6736f2de76b85773efbf490bb475dd95ec1041fe57a87163ce11a7db44430cd378c8416af3319f979ced92532bf5ebb5 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -24,7 +24,6 @@ vcpkg_configure_cmake( -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 diff --git a/ports/opengl/CONTROL b/ports/opengl/CONTROL index 05546ae5c..e2db823cf 100644 --- a/ports/opengl/CONTROL +++ b/ports/opengl/CONTROL @@ -1,3 +1,3 @@ Source: opengl -Version: 10.0.10240.0 +Version: 0.0-3 Description: Open Graphics Library (OpenGL)[3][4][5] is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics.
\ No newline at end of file diff --git a/ports/opengl/portfile.cmake b/ports/opengl/portfile.cmake index 8c2ac722b..2af9e6e3b 100644 --- a/ports/opengl/portfile.cmake +++ b/ports/opengl/portfile.cmake @@ -1,9 +1,21 @@ -set(OPENGLPATH "C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10240.0\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib") -set(LICENSEPATH "C:\\Program Files (x86)\\Windows Kits\\10\\Licenses\\10.0.10240.0\\sdk_license.rtf") -set(HEADERSPATH "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10240.0\\um") +include(vcpkg_common_functions) + +vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT) +vcpkg_get_windows_sdk(WINDOWS_SDK) + +if (WINDOWS_SDK MATCHES "10.") + set(OPENGLPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib") + set(LICENSEPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Licenses\\${WINDOWS_SDK}\\sdk_license.rtf") + set(HEADERSPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Include\\${WINDOWS_SDK}\\um") +elseif(WINDOWS_SDK MATCHES "8.") + set(OPENGLPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib") + set(HEADERSPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Include\\um") +else() + message(FATAL_ERROR "Portfile not yet configured for Windows SDK with version: ${WINDOWS_SDK}") +endif() if (NOT EXISTS "${OPENGLPATH}") - message(FATAL_ERROR "Cannot find Windows 10.0.10240.0 SDK. File does not exist: ${OPENGLPATH}") + message(FATAL_ERROR "Cannot find Windows ${WINDOWS_SDK} SDK. File does not exist: ${OPENGLPATH}") endif() file(MAKE_DIRECTORY @@ -13,13 +25,17 @@ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/opengl ) -file(COPY ${LICENSEPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/include/gl) file(COPY "${HEADERSPATH}\\gl\\GL.h" "${HEADERSPATH}\\gl\\GLU.h" - DESTINATION ${CURRENT_PACKAGES_DIR}/include + DESTINATION ${CURRENT_PACKAGES_DIR}/include/gl ) file(COPY ${OPENGLPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) file(COPY ${OPENGLPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) -file(COPY ${LICENSEPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/share/opengl) -file(WRITE ${CURRENT_PACKAGES_DIR}/share/opengl/copyright "See the accompanying sdk_license.rtf") + +if (DEFINED LICENSEPATH) + file(COPY ${LICENSEPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/share/opengl) + file(WRITE ${CURRENT_PACKAGES_DIR}/share/opengl/copyright "See the accompanying sdk_license.rtf") +else() + file(WRITE ${CURRENT_PACKAGES_DIR}/share/opengl/copyright "See https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk for the Windows 8.1 SDK license") +endif()
\ No newline at end of file diff --git a/ports/openjpeg/CONTROL b/ports/openjpeg/CONTROL index f137d0ebc..cd2f0aaa8 100644 --- a/ports/openjpeg/CONTROL +++ b/ports/openjpeg/CONTROL @@ -1,3 +1,3 @@ Source: openjpeg -Version: 2.1.2 +Version: 2.1.2-1 Description: JPEG 2000 image library diff --git a/ports/openjpeg/portfile.cmake b/ports/openjpeg/portfile.cmake index dfa25881d..f48395997 100644 --- a/ports/openjpeg/portfile.cmake +++ b/ports/openjpeg/portfile.cmake @@ -9,6 +9,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DBUILD_CODEC:BOOL=OFF -DOPENJPEG_INSTALL_PACKAGE_DIR=share/openjpeg ) @@ -23,19 +24,8 @@ string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" OPENJPEG_DEBUG_MO file(WRITE ${CURRENT_PACKAGES_DIR}/share/openjpeg/OpenJPEGTargets-debug.cmake "${OPENJPEG_DEBUG_MODULE}") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -# Cleanup bin directories in static builds -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) -endif() - -# Cleanup Visual C++ Redistributable runtime -file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/msvcp140.dll) -file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vcruntime140.dll) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/msvcp140.dll) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vcruntime140.dll) - # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openjpeg) file(RENAME ${CURRENT_PACKAGES_DIR}/share/openjpeg/LICENSE ${CURRENT_PACKAGES_DIR}/share/openjpeg/copyright) -vcpkg_copy_pdbs()
\ No newline at end of file +vcpkg_copy_pdbs() diff --git a/ports/openssl/CMakeLists.txt b/ports/openssl/CMakeLists.txt index 1fa0f30d0..ca1de18c0 100644 --- a/ports/openssl/CMakeLists.txt +++ b/ports/openssl/CMakeLists.txt @@ -3,7 +3,7 @@ project(openssl NONE) include(vcpkg_execute_required_process) include(vcpkg_apply_patches) -set(SOURCE_PATH ${CMAKE_CURRENT_BINARY_DIR}/openssl-1.0.2j) +set(SOURCE_PATH ${CMAKE_CURRENT_BINARY_DIR}/openssl-${OPENSSL_VERSION}) find_program(PERL perl) find_program(NMAKE nmake) @@ -58,25 +58,25 @@ endif() vcpkg_execute_required_process( COMMAND ${CONFIGURE_COMMAND} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/openssl-${VERSION} + WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME configure-perl-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE} ) vcpkg_execute_required_process( COMMAND ${OPENSSL_DO} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/openssl-${VERSION} + WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME configure-do-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE} ) if(BUILD_SHARED_LIBS) add_custom_command(OUTPUT ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll COMMAND ${NMAKE} -f ms\\ntdll.mak install - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/openssl-${VERSION} + WORKING_DIRECTORY ${SOURCE_PATH} ) add_custom_target(openssl ALL DEPENDS ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll) else() add_custom_command(OUTPUT ${OPENSSLDIR}/bin/ssleay32.lib ${OPENSSLDIR}/bin/libeay32.lib COMMAND ${NMAKE} -f ms\\nt.mak install - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/openssl-${VERSION} + WORKING_DIRECTORY ${SOURCE_PATH} ) add_custom_target(openssl ALL DEPENDS ${OPENSSLDIR}/bin/ssleay32.lib ${OPENSSLDIR}/bin/libeay32.lib) endif() diff --git a/ports/openssl/CONTROL b/ports/openssl/CONTROL index cb7bc7493..6fb520404 100644 --- a/ports/openssl/CONTROL +++ b/ports/openssl/CONTROL @@ -1,3 +1,3 @@ Source: openssl -Version: 1.0.2j-1 -Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.
\ No newline at end of file +Version: 1.0.2k-2 +Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library. diff --git a/ports/openssl/portfile-uwp.cmake b/ports/openssl/portfile-uwp.cmake index f4a0a716b..cf2f1e7ca 100644 --- a/ports/openssl/portfile-uwp.cmake +++ b/ports/openssl/portfile-uwp.cmake @@ -26,16 +26,16 @@ endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-OpenSSL_1_0_2j_WinRT) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-OpenSSL_1_0_2k_WinRT) vcpkg_find_acquire_program(PERL) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) -set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}") vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Microsoft/openssl/archive/OpenSSL_1_0_2j_WinRT.zip" - FILENAME "openssl-microsoft-1.0.2j_WinRT.zip" - SHA512 0860d1f5fca7b1345870e866d7bb78f14672c5bb63c56bb04360ee891be542b4b56625ab971ef9b304b792b6cf36c9508bfd812c4a133f6ba8bafdde5e2f8fcf + URLS "https://github.com/Microsoft/openssl/archive/OpenSSL_1_0_2k_WinRT.zip" + FILENAME "openssl-microsoft-1.0.2k_WinRT.zip" + SHA512 afb434ef69c399f690f7ce723fabb228f77a12428f19062c5df3b8b841a2a7881c01150fdcfd2fab23867e3963292874a08ad227b37d168907b507fb1d7fede7 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -45,10 +45,6 @@ file(REMOVE_RECURSE ${SOURCE_PATH}/out32dll) file(REMOVE_RECURSE ${SOURCE_PATH}/inc32dll) file(COPY -${CMAKE_CURRENT_LIST_DIR}/setVSvars.bat -DESTINATION ${SOURCE_PATH}/ms) - -file(COPY ${CMAKE_CURRENT_LIST_DIR}/make-openssl.bat DESTINATION ${SOURCE_PATH}) diff --git a/ports/openssl/portfile.cmake b/ports/openssl/portfile.cmake index 9b84b7475..ca3bb7ff6 100644 --- a/ports/openssl/portfile.cmake +++ b/ports/openssl/portfile.cmake @@ -4,7 +4,8 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-1.0.2j) +set(OPENSSL_VERSION 1.0.2k) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-${OPENSSL_VERSION}) vcpkg_find_acquire_program(PERL) find_program(NMAKE nmake) @@ -12,9 +13,9 @@ get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE - URLS "https://www.openssl.org/source/openssl-1.0.2j.tar.gz" - FILENAME "openssl-1.0.2j.tar.gz" - SHA512 7d6ccae4aa3ccec3a5d128da29c68401cdb1210cba6d212d55235fc3bc63d7085e2f119e2bbee7ddff6b7b5eef07c6196156791724cd2caf313a4c2fef724edd + URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" + FILENAME "openssl-${OPENSSL_VERSION}.tar.gz" + SHA512 0d314b42352f4b1df2c40ca1094abc7e9ad684c5c35ea997efdd58204c70f22a1abcb17291820f0fff3769620a4e06906034203d31eb1a4d540df3e0db294016 ) file(COPY @@ -34,7 +35,7 @@ vcpkg_configure_cmake( -DOPENSSL_SOURCE_ARCHIVE=${OPENSSL_SOURCE_ARCHIVE} -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -DTRIPLET_SYSTEM_ARCH=${TRIPLET_SYSTEM_ARCH} - -DVERSION=1.0.2j + -DOPENSSL_VERSION=${OPENSSL_VERSION} -DTARGET_TRIPLET=${TARGET_TRIPLET} ) diff --git a/ports/openssl/setVSvars.bat b/ports/openssl/setVSvars.bat deleted file mode 100644 index 23259821e..000000000 --- a/ports/openssl/setVSvars.bat +++ /dev/null @@ -1,185 +0,0 @@ -@echo off -call:set_%1 -exit /b -:set_universal10.0Win32 - call:setVar _VS14VC VisualStudio14VC - call "%_VS14VC%vcvarsall" x86 - set _VCPlatform=x86 - set _VCLibPlat= - call:setEnv - goto :eof - -:set_universal10.0x64 - call:setVar _VS14VC VisualStudio14VC - call "%_VS14VC%vcvarsall" x64 - set _VCPlatform=x64 - set _VCLibPlat=amd64 - call:setEnv - goto :eof - -:set_universal10.0arm - call:setVar _VS14VC VisualStudio14VC - call "%_VS14VC%vcvarsall" x86_arm - set _VCPlatform=ARM - set _VCLibPlat=ARM - call:setEnv - goto :eof - -:set_universal10.0arm64 - call:setVar _VS14VC VisualStudio14VC - call "%_VS14VC%vcvarsall" x86_arm64 - set _VCPlatform=ARM64 - set _VCLibPlat=ARM64 - call:setEnv - goto :eof - -:set_wp8.1arm - call:setVar _VS12VC VisualStudio12VC - call:setVar _WPKITS81 WindowsPhoneKits8.1 - call:setVar _VS14VC VisualStudio14VC - call "%_VS12VC%\vcvarsall" x86_arm - set PATH=%_VS12VC\Bin%;%PATH% - set INCLUDE=%_WPKITS81%\Include;%_WPKITS81%\Include\abi;%_WPKITS81%\Include\mincore;%_WPKITS81%\Include\minwin;%_WPKITS81%\Include\wrl;%INCLUDE% - set LIB=%_WPKITS81%\lib\ARM;%_VS12VC%\lib\store\ARM; - set LIBPATH=%LIBPATH%;%_VS12VC%\vcpackages;%WindowsSDK_ExecutablePath_x86%\..\..\Tools\MDILXAPCompile\WinMDs;%_VS14VC%\vcpackages; - goto :eof - -:set_wp8.1Win32 - call:setVar _VS12VC VisualStudio12VC - call:setVar _WPKITS81 WindowsPhoneKits8.1 - call:setVar _VS14VC VisualStudio14VC - call "%_VS12VC%\vcvarsall" x86 - set INCLUDE=%_WPKITS81%\Include;%_WPKITS81%\Include\abi;%_WPKITS81%\Include\mincore;%_WPKITS81%\Include\minwin;%_WPKITS81%\Include\wrl;%INCLUDE% - set LIB=%_WPKITS81%\lib\x86;%_VS12VC%\lib\store; - set LIBPATH=%LIBPATH%;%_VS12VC%\vcpackages;%WindowsSDK_ExecutablePath_x86%\..\..\Tools\MDILXAPCompile\WinMDs;%_VS14VC%\vcpackages; - goto :eof - -:set_wp8.0arm - call:setVar _VS11VC VisualStudio11VC - call:setVar _WPKITS80 WindowsPhoneKits8.0 - call "%_VS11VC%\WPSDK\WP80\vcvarsphoneall.bat" x86_arm - goto :eof - -:set_wp8.0Win32 - call:setVar _VS11VC VisualStudio11VC - call:setVar _WPKITS80 WindowsPhoneKits8.0 - call "%_VS11VC%\WPSDK\WP80\vcvarsphoneall.bat" x86 - goto :eof - -:set_ws8.1Win32 - call:setVar _VS12VC VisualStudio12VC - call:setVar _WSKITS81 WindowsKits8.1 - call:setVar _VS14VC VisualStudio14VC - call "%_VS12VC%\vcvarsall" x86 - set INCLUDE=%_VS12VC%\include;%_VS12VC%\atlmfc\include;%_WSKITS81%\Include\um;%_WSKITS81%\Include\shared;%_WSKITS81%\Include\winrt; - set LIB=%_VS12VC%\lib\store;%_VS12VC%\atlmfc\lib;%_WSKITS81%\lib\winv6.3\um\x86; - set LIBPATH=%_WSKITS81%\References\CommonConfiguration\Neutral;%_VS12VC%\atlmfc\lib;%_VS12VC%\lib\store;%_VS12VC%\vcpackages;%WindowsSDK_ExecutablePath_x86%\..\..\Tools\MDILXAPCompile\WinMDs;%_VS14VC%\vcpackages; - goto :eof - -:set_ws8.1x64 - call:setVar _VS12VC VisualStudio12VC - call:setVar _WSKITS81 WindowsKits8.1 - call:setVar _VS14VC VisualStudio14VC - call "%_VS12VC%\vcvarsall" x64 - set INCLUDE=%_VS12VC%\include;%_VS12VC%\atlmfc\include;%_WSKITS81%\Include\um;%_WSKITS81%\Include\shared;%_WSKITS81%\Include\winrt; - set LIB=%_VS12VC%\lib\store\amd64;%_VS12VC%\atlmfc\lib\amd64;%_WSKITS81%\lib\winv6.3\um\x64; - set LIBPATH=%_WSKITS81%\References\CommonConfiguration\Neutral;%_VS12VC%\atlmfc\lib\amd64;%_VS12VC%\lib\store;%_VS12VC%\vcpackages;%WindowsSDK_ExecutablePath_x86%\..\..\Tools\MDILXAPCompile\WinMDs;%_VS14VC%\vcpackages; - goto :eof - -:set_ws8.1arm - call:setVar _VS12VC VisualStudio12VC - call:setVar _WSKITS81 WindowsKits8.1 - call:setVar _VS14VC VisualStudio14VC - call "%_VS12VC%\vcvarsall" x86_arm - set INCLUDE=%_VS12VC%\include;%_VS12VC%\atlmfc\include;%_WSKITS81%\Include\um;%_WSKITS81%\Include\shared;%_WSKITS81%\Include\winrt; - set LIB=%_VS12VC%\lib\store\arm;%_VS12VC%\atlmfc\lib\arm;%_WSKITS81%\lib\winv6.3\um\arm; - set LIBPATH=%_WSKITS81%\References\CommonConfiguration\Neutral;%_VS12VC%\atlmfc\lib\arm;%_VS12VC%\lib\store;%_VS12VC%\vcpackages;%WindowsSDK_ExecutablePath_x86%\..\..\Tools\MDILXAPCompile\WinMDs;%_VS14VC%\vcpackages; - goto :eof - -:setVar - call:set%1 - if "!%1!"=="" echo warning: could not locate %2 - goto :eof - -:setRegVar - for /F "usebackq tokens=2*" %%A IN (`reg query %1 /v %2 2^>nul`) do ( - set %3=%%B - ) - goto :eof - -:setAppend - if exist %1%2 set %3=%1%2 - goto :eof - -:set_VS11VC - if not "%_VS11VC%"=="" goto :eof - call:setRegVar "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\Setup\VC" ProductDir _VS11VC - if not "%_VS11VC%"=="" goto :eof - call:setRegVar "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VC" ProductDir _VS11VC - if not "%_VS11VC%"=="" goto :eof - call:setAppend VSSDK110Install \..\VC _VS11VC - if not "%_VS11VC%"=="" goto :eof - call:setAppend VS110COMNTOOLS \..\..\VC _VS11VC - goto :eof - -:set_VS12VC - if not "%_VS12VC%"=="" goto :eof - call:setRegVar "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Setup\VC" ProductDir _VS12VC - if not "%_VS12VC%"=="" goto :eof - call:setRegVar "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Setup\VC" ProductDir _VS12VC - if not "%_VS12VC%"=="" goto :eof - call:setAppend VSSDK120Install \..\VC _VS12VC - if not "%_VS12VC%"=="" goto :eof - call:setAppend VS120COMNTOOLS \..\..\VC _VS12VC - goto :eof - -:set_VS14VC - if not "%_VS14VC%"=="" goto :eof - call:setRegVar "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\Setup\VC" ProductDir _VS14VC - if not "%_VS14VC%"=="" goto :eof - call:setRegVar "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\Setup\VC" ProductDir _VS14VC - if not "%_VS14VC%"=="" goto :eof - call:setAppend VSSDK140Install \..\VC _VS14VC - if not "%_VS14VC%"=="" goto :eof - call:setAppend VS140COMNTOOLS \..\..\VC _VS14VC - goto :eof - -:set_WPKITS80 - if not "%_WPKITS80%"=="" goto :eof - call:setRegVar "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows Phone\v8.0" InstallationFolder _WPKITS80 - if not "%_WPKITS80%"=="" goto :eof - goto :eof - -:set_WPKITS81 - if not "%_WPKITS81%"=="" goto :eof - call:setRegVar "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows Phone\v8.1" InstallationFolder _WPKITS81 - if not "%_WPKITS81%"=="" goto :eof - goto :eof - -:set_WSKITS81 - if not "%_WSKITS81%"=="" goto :eof - call:setRegVar "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots" KitsRoot81 _WSKITS81 - if not "%_WSKITS81%"=="" goto :eof - goto :eof - -:set_WKITS10 - if not "%_WKITS10%"=="" goto :eof - call:setRegVar "HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" InstallationFolder _WKITS10 - if not "%_WKITS10%"=="" goto :eof - goto :eof - -:set_WKITS10VER - if not "%_WKITS10VER%"=="" goto :eof - call:setRegVar "HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" ProductVersion _WKITS10VER - echo %_WKITS10VER% - if not "%_WKITS10VER%"=="" goto :eof - goto :eof - -:setEnv - call:setVar _VS14VC VisualStudio14VC - call:setVar _WKITS10 WindowsKits10.0 - set PATH=%_VS14VCBin%;%PATH% - set "LIBPATH=%_WKITS10%UnionMetadata\Facade;%_VS14VC%vcpackages;%_WKITS10%references\windows.foundation.foundationcontract\1.0.0.0\;%_WKITS10%references\windows.foundation.universalapicontract\1.0.0.0\" - goto :eof - -:end diff --git a/ports/openvr/CONTROL b/ports/openvr/CONTROL new file mode 100644 index 000000000..2a2228ba2 --- /dev/null +++ b/ports/openvr/CONTROL @@ -0,0 +1,3 @@ +Source: openvr +Version: 1.0.5 +Description: an API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting. diff --git a/ports/openvr/portfile.cmake b/ports/openvr/portfile.cmake new file mode 100644 index 000000000..94e90143d --- /dev/null +++ b/ports/openvr/portfile.cmake @@ -0,0 +1,54 @@ +# 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(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openvr-1.0.5) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/ValveSoftware/openvr/archive/v1.0.5.zip" + FILENAME "openvr-v1.0.5.zip" + SHA512 18c2e3f7a8754d0e9389c953d0af70788c77adf43f51d25b6664beaeb407dc8d2daa755396c45ce2b4be1b08d333b378810dbebdf3c9bb5f5a03a9d372dc97b0 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +set(VCPKG_LIBRARY_LINKAGE dynamic) + +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(ARCH_PATH "win64") +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(ARCH_PATH "win32") +else() + message(FATAL_ERROR "Package only supports x64 and x86 windows.") +endif() + +if(VCPKG_CMAKE_SYSTEM_NAME) + message(FATAL_ERROR "Package only supports windows desktop.") +endif() + +file(MAKE_DIRECTORY + ${CURRENT_PACKAGES_DIR}/lib + ${CURRENT_PACKAGES_DIR}/bin + ${CURRENT_PACKAGES_DIR}/debug/lib + ${CURRENT_PACKAGES_DIR}/debug/bin +) +file(COPY ${SOURCE_PATH}/lib/${ARCH_PATH}/openvr_api.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) +file(COPY ${SOURCE_PATH}/lib/${ARCH_PATH}/openvr_api.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) +file(COPY + ${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.dll + ${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/bin +) +file(COPY + ${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.dll + ${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin +) +file(COPY ${SOURCE_PATH}/headers DESTINATION ${CURRENT_PACKAGES_DIR}) +file(RENAME ${CURRENT_PACKAGES_DIR}/headers ${CURRENT_PACKAGES_DIR}/include) + +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openvr) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/openvr/LICENSE ${CURRENT_PACKAGES_DIR}/share/openvr/copyright) diff --git a/ports/opus/CONTROL b/ports/opus/CONTROL new file mode 100644 index 000000000..7177b2199 --- /dev/null +++ b/ports/opus/CONTROL @@ -0,0 +1,3 @@ +Source: opus +Version: 1.1.4 +Description: Totally open, royalty-free, highly versatile audio codec diff --git a/ports/opus/portfile.cmake b/ports/opus/portfile.cmake new file mode 100644 index 000000000..a004f09dd --- /dev/null +++ b/ports/opus/portfile.cmake @@ -0,0 +1,76 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opus-1.1.4) +vcpkg_download_distfile(ARCHIVE + URLS "http://downloads.xiph.org/releases/opus/opus-1.1.4.tar.gz" + FILENAME "opus-1.1.4.tar.gz" + SHA512 57f14b9e8037eaa02a4d86535d3bbcceca249310fbc9ef1a452cc19dd442d4cf338d5db241d20605c236e22549df2c8266b7486c5f1666b80c532afd52cb3585 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(RELEASE_CONFIGURATION "Release") + set(DEBUG_CONFIGURATION "Debug") +else() + set(RELEASE_CONFIGURATION "ReleaseDll") + set(DEBUG_CONFIGURATION "DebugDll") +endif() + +if(TARGET_TRIPLET MATCHES "x86") + set(ARCH_DIR "Win32") +elseif(TARGET_TRIPLET MATCHES "x64") + set(ARCH_DIR "x64") +else() + message("Architecture not supported") +endif() + +function(build_project PROJECT_PATH) + vcpkg_build_msbuild( + PROJECT_PATH ${PROJECT_PATH} + RELEASE_CONFIGURATION ${RELEASE_CONFIGURATION} + DEBUG_CONFIGURATION ${DEBUG_CONFIGURATION} + ) +endfunction(build_project) + + +build_project(${SOURCE_PATH}/win32/VS2015/celt.vcxproj) +build_project(${SOURCE_PATH}/win32/VS2015/silk_common.vcxproj) +build_project(${SOURCE_PATH}/win32/VS2015/silk_float.vcxproj) +build_project(${SOURCE_PATH}/win32/VS2015/silk_fixed.vcxproj) +build_project(${SOURCE_PATH}/win32/VS2015/opus.vcxproj) + + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + # Install release build + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/opus.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/celt.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/silk_common.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/silk_fixed.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/silk_float.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/) + + # Install debug build + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/opus.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/opus.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/celt.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/celt.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/silk_common.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/silk_common.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/silk_fixed.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/silk_fixed.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/silk_float.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/silk_float.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) +else() + # Install release build + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/opus.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/opus.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin/) + + # Install debug build + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/opus.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/opus.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin/) + file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/opus.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin/) +endif() + +# Install headers +file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}/include RENAME opus) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/opus RENAME copyright) diff --git a/ports/pango/CMakeLists.txt b/ports/pango/CMakeLists.txt new file mode 100644 index 000000000..d290d1332 --- /dev/null +++ b/ports/pango/CMakeLists.txt @@ -0,0 +1,180 @@ +cmake_minimum_required(VERSION 3.0) +project(pango) + +set(PANGO_LIB_SUFFIX 1.0) +set(PANGO_DLL_SUFFIX 1) +set(GLIB_LIB_VERSION 2.0) + +configure_file(./config.h.win32 ${CMAKE_SOURCE_DIR}/config.h COPYONLY) +add_definitions(-DHAVE_CONFIG_H) +include_directories(. ./pango) + +# find libintl +find_path(LIBINTL_INCLUDE_DIR libintl.h) +find_library(LIBINTL_LIBRARY NAMES libintl intl) + +# find glib +find_path(GLIB_INCLUDE_DIR glib.h) +find_library(GLIB_GLIB_LIBRARY glib-${GLIB_LIB_VERSION}) +find_library(GLIB_GOBJECT_LIBRARY gobject-${GLIB_LIB_VERSION}) +find_library(GLIB_GMODULE_LIBRARY gmodule-${GLIB_LIB_VERSION}) +set(GLIB_LIBRARIES ${GLIB_GLIB_LIBRARY} ${GLIB_GOBJECT_LIBRARY} ${GLIB_GMODULE_LIBRARY}) + +# find cairo +find_path(CAIRO_INCLUDE_DIR cairo.h) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(CAIRO_SUFFIX d) +endif() +find_library(CAIRO_LIBRARY cairo${CAIRO_SUFFIX}) +find_library(CAIRO_GOBJECT_LIBRARY cairo-gobject${CAIRO_SUFFIX}) +set(CAIRO_LIBRARIES ${CAIRO_LIBRARY} ${CAIRO_GOBJECT_LIBRARY}) + +# find fontconfig +find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h) +find_library(FONTCONFIG_LIBRARY fontconfig) + +# find freetype +find_path(FREETYPE_INCLUDE_DIR ft2build.h) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(FT_SUFFIX d) +endif() +find_library(FREETYPE_LIBRARY freetype${FT_SUFFIX}) + +# find harfbuzz +find_path(HARFBUZZ_INCLUDE_DIR harfbuzz/hb.h) +find_library(HARFBUZZ_LIBRARY harfbuzz) + +set(FONT_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR} ${FONTCONFIG_INCLUDE_DIR} ${HARFBUZZ_INCLUDE_DIR}/harfbuzz) +set(FONT_LIBRARIES ${FREETYPE_LIBRARY} ${FONTCONFIG_LIBRARY} ${HARFBUZZ_LIBRARY}) + +macro(pango_add_module MODULE_NAME) + add_library(${MODULE_NAME} ${ARGN}) + target_include_directories(${MODULE_NAME} PRIVATE ${GLIB_INCLUDE_DIR} ${LIBINTL_INCLUDE_DIR}) + target_link_libraries(${MODULE_NAME} ${LIBINTL_LIBRARY} ${GLIB_LIBRARIES}) + target_compile_definitions(${MODULE_NAME} PRIVATE + G_LOG_DOMAIN="Pango" PANGO_ENABLE_BACKEND PANGO_ENABLE_ENGINE + G_DISABLE_SINGLE_INCLUDES SYSCONFDIR="/dummy/etc" LIBDIR="/dummy/lib") + target_compile_definitions(${MODULE_NAME} PRIVATE HAVE_CAIRO_FREETYPE=1) + set_target_properties(${MODULE_NAME} PROPERTIES + OUTPUT_NAME ${MODULE_NAME}-${PANGO_DLL_SUFFIX} + ARCHIVE_OUTPUT_NAME ${MODULE_NAME}-${PANGO_LIB_SUFFIX}) + install(TARGETS ${MODULE_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) +endmacro() + +pango_add_module(pango + pango/break-arabic.c + pango/break-indic.c + pango/mini-fribidi/fribidi.c + pango/mini-fribidi/fribidi_char_type.c + pango/mini-fribidi/fribidi_types.c + pango/break.c + pango/ellipsize.c + pango/fonts.c + pango/glyphstring.c + pango/modules.c + pango/pango-attributes.c + pango/pango-bidi-type.c + pango/pango-color.c + pango/pango-context.c + pango/pango-coverage.c + pango/pango-engine.c + pango/pango-fontmap.c + pango/pango-fontset.c + pango/pango-glyph-item.c + pango/pango-gravity.c + pango/pango-item.c + pango/pango-language.c + pango/pango-layout.c + pango/pango-markup.c + pango/pango-matrix.c + pango/pango-renderer.c + pango/pango-script.c + pango/pango-tabs.c + pango/pango-utils.c + pango/reorder-items.c + pango/shape.c + pango/pango-enum-types.c) + +pango_add_module(pangowin32 + pango/pangowin32.c + pango/pangowin32-fontcache.c + pango/pangowin32-fontmap.c + pango/pangowin32-shape.c) +target_link_libraries(pangowin32 usp10 pango) + +pango_add_module(pangoft2 + pango/pangofc-font.c + pango/pangofc-fontmap.c + pango/pangofc-decoder.c + pango/pangofc-shape.c + pango/pangoft2.c + pango/pangoft2-fontmap.c + pango/pangoft2-render.c + pango/pango-ot-buffer.c + pango/pango-ot-info.c + pango/pango-ot-ruleset.c + pango/pango-ot-tag.c) +target_link_libraries(pangoft2 pango ${FONT_LIBRARIES}) +target_include_directories(pangoft2 PRIVATE ${FONT_INCLUDE_DIRS}) + +pango_add_module(pangocairo + pango/pangocairo-fcfont.c + pango/pangocairo-fcfontmap.c + pango/pangocairo-win32font.c + pango/pangocairo-win32fontmap.c + pango/pangocairo-context.c + pango/pangocairo-font.c + pango/pangocairo-fontmap.c + pango/pangocairo-render.c) +target_link_libraries(pangocairo ${CAIRO_LIBRARIES} pango pangowin32 pangoft2 ${FONT_LIBRARIES}) +target_include_directories(pangocairo PRIVATE ${CAIRO_INCLUDE_DIR} ${FONT_INCLUDE_DIRS}) + +if(NOT PANGO_SKIP_HEADERS) + install(FILES + pango/pango.h + pango/pango-attributes.h + pango/pango-bidi-type.h + pango/pango-break.h + pango/pango-context.h + pango/pango-coverage.h + pango/pango-engine.h + pango/pango-font.h + pango/pango-fontmap.h + pango/pango-fontset.h + pango/pango-glyph.h + pango/pango-glyph-item.h + pango/pango-gravity.h + pango/pango-item.h + pango/pango-language.h + pango/pango-layout.h + pango/pango-matrix.h + pango/pango-modules.h + pango/pango-renderer.h + pango/pango-script.h + pango/pango-tabs.h + pango/pango-types.h + pango/pango-utils.h + pango/pango-version-macros.h + pango/pangocairo.h + pango/pangowin32.h + pango/pango-features.h + pango/pango-enum-types.h + pango/pangofc-decoder.h + pango/pangofc-font.h + pango/pangofc-fontmap.h + pango/pango-ot.h + pango/pangoft2.h + DESTINATION include/pango) +endif() + +message(STATUS "Link-time dependencies:") +message(STATUS " " ${LIBINTL_LIBRARY}) +foreach(GL ${GLIB_LIBRARIES}) + message(STATUS " " ${GL}) +endforeach() +foreach(CL ${CAIRO_LIBRARIES}) + message(STATUS " " ${CL}) +endforeach() +foreach(FL ${FONT_LIBRARIES}) + message(STATUS " " ${FL}) +endforeach() diff --git a/ports/pango/CONTROL b/ports/pango/CONTROL new file mode 100644 index 000000000..b763f25e8 --- /dev/null +++ b/ports/pango/CONTROL @@ -0,0 +1,4 @@ +Source: pango
+Version: 1.40.3
+Description: Text and font handling library.
+Build-Depends: glib, gettext, cairo, fontconfig, freetype, harfbuzz
diff --git a/ports/pango/portfile.cmake b/ports/pango/portfile.cmake new file mode 100644 index 000000000..07dfc6929 --- /dev/null +++ b/ports/pango/portfile.cmake @@ -0,0 +1,26 @@ +
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ message(STATUS "Warning: Static building not supported. Building dynamic.")
+ set(VCPKG_LIBRARY_LINKAGE dynamic)
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pango-1.40.3)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://ftp.gnome.org/pub/GNOME/sources/pango/1.40/pango-1.40.3.tar.xz"
+ FILENAME "pango-1.40.3.tar.xz"
+ SHA512 ff82395e8487624dffe212975b72b3383dcebb197a8675c8b409665e3e2e30fc23d9a6c25c3129a115adb7182b2a71a49550dbe881eb7ee9bbc572de6ba18d27)
+
+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
+ -DPANGO_SKIP_HEADERS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/pango)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/pango/COPYING ${CURRENT_PACKAGES_DIR}/share/pango/copyright)
diff --git a/ports/parmetis/CONTROL b/ports/parmetis/CONTROL new file mode 100644 index 000000000..86a367cbd --- /dev/null +++ b/ports/parmetis/CONTROL @@ -0,0 +1,4 @@ +Source: parmetis +Version: 4.0.3 +Description: Parallel Graph Partitioning and Fill-reducing Matrix Ordering +Build-Depends: metis, msmpi diff --git a/ports/parmetis/fix-gklib-vs14-math.patch b/ports/parmetis/fix-gklib-vs14-math.patch new file mode 100644 index 000000000..059890e36 --- /dev/null +++ b/ports/parmetis/fix-gklib-vs14-math.patch @@ -0,0 +1,11 @@ +--- a/metis/GKlib/gk_arch.h Wed Dec 21 18:34:18 2016 ++++ b/metis/GKlib/gk_arch.h Wed Dec 21 18:30:49 2016 +@@ -58,7 +58,7 @@ + #define PTRDIFF_MAX INT64_MAX + #endif + +-#ifdef __MSC__ ++#if defined(__MSC__) && (_MSC_VER < 1900) + /* MSC does not have rint() function */ + #define rint(x) ((int)((x)+0.5)) + diff --git a/ports/parmetis/fix-libparmetis-cmakelist.patch b/ports/parmetis/fix-libparmetis-cmakelist.patch new file mode 100644 index 000000000..6cdd7be62 --- /dev/null +++ b/ports/parmetis/fix-libparmetis-cmakelist.patch @@ -0,0 +1,15 @@ +--- a/libparmetis/CMakeLists.txt Sat Mar 30 17:24:50 2013 ++++ b/libparmetis/CMakeLists.txt Wed Dec 21 19:40:28 2016 +@@ -5,10 +5,10 @@ + # Create libparmetis + add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources}) + # Link with metis and MPI libraries. +-target_link_libraries(parmetis metis ${MPI_LIBRARIES}) ++target_link_libraries(parmetis ${METIS_LIBRARY} ${MPI_LIBRARIES}) + set_target_properties(parmetis PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}") + + install(TARGETS parmetis + LIBRARY DESTINATION lib +- RUNTIME DESTINATION lib ++ RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib) diff --git a/ports/parmetis/fix-metis-vs14-math.patch b/ports/parmetis/fix-metis-vs14-math.patch new file mode 100644 index 000000000..ddf10052a --- /dev/null +++ b/ports/parmetis/fix-metis-vs14-math.patch @@ -0,0 +1,11 @@ +--- a/metis/libmetis/metislib.h Sat Mar 30 17:24:45 2013 ++++ b/metis/libmetis/metislib.h Wed Dec 21 18:30:59 2016 +@@ -31,7 +31,7 @@ + #include <proto.h> + + +-#if defined(COMPILER_MSC) ++#if defined(COMPILER_MSC) && (_MSC_VER < 1900) + #if defined(rint) + #undef rint + #endif diff --git a/ports/parmetis/fix-root-cmakelist.patch b/ports/parmetis/fix-root-cmakelist.patch new file mode 100644 index 000000000..914bf9189 --- /dev/null +++ b/ports/parmetis/fix-root-cmakelist.patch @@ -0,0 +1,29 @@ +--- a/CMakeLists.txt Sat Mar 30 17:24:50 2013 ++++ b/CMakeLists.txt Wed Dec 21 19:38:12 2016 +@@ -16,6 +16,9 @@ + # endif() + # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") + ++find_package(MPI REQUIRED) ++find_library(METIS_LIBRARY NAMES metis) ++ + # Prepare libraries. + if(SHARED) + set(ParMETIS_LIBRARY_TYPE SHARED) +@@ -30,13 +33,13 @@ + include_directories(include) + include_directories(${MPI_INCLUDE_PATH}) + include_directories(${GKLIB_PATH}) +-include_directories(${METIS_PATH}/include) ++# include_directories(${METIS_PATH}/include) + + # List of directories that cmake will look for CMakeLists.txt +-add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis) ++# add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis) + add_subdirectory(include) + add_subdirectory(libparmetis) +-add_subdirectory(programs) ++# add_subdirectory(programs) + + # This is for testing during development and is not being distributed + #add_subdirectory(test) diff --git a/ports/parmetis/portfile.cmake b/ports/parmetis/portfile.cmake new file mode 100644 index 000000000..c6022ad47 --- /dev/null +++ b/ports/parmetis/portfile.cmake @@ -0,0 +1,46 @@ +# 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(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/parmetis-4.0.3) +vcpkg_download_distfile(ARCHIVE + URLS "http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz" + FILENAME "parmetis-4.0.3.tar.gz" + SHA512 454a91921ca35c981df11c9846a11963ff8fd8407a25179453af33f8fe69493f6dd7f2a0b8feed9a7d3f121e45b715749dd7a94873eaac2bae4cad1e535ca132 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/fix-metis-vs14-math.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-gklib-vs14-math.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-root-cmakelist.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-libparmetis-cmakelist.patch +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(ADDITIONAL_OPTIONS -DSHARED=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON) +else() + set(ADDITIONAL_OPTIONS -DSHARED=OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + ${ADDITIONAL_OPTIONS} +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/parmetis) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/parmetis/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/parmetis/copyright) diff --git a/ports/pcre/portfile.cmake b/ports/pcre/portfile.cmake index 8fd6c8819..87f4ec7cb 100644 --- a/ports/pcre/portfile.cmake +++ b/ports/pcre/portfile.cmake @@ -7,11 +7,11 @@ # include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pcre-8.38) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pcre-8.39) vcpkg_download_distfile(ARCHIVE - URLS "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.zip" - FILENAME "pcre-8.38.zip" - SHA512 82f1c2bdd0a6cc086e3734621ac7a2773cb28f42cf5e400b9bbe8c16655465d9367bce82c6db69577c40ec137b30f1b2443a8d91998a514f81e1c2210828a113 + URLS "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.zip" "https://downloads.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.zip" + FILENAME "pcre-8.39.zip" + SHA512 14e6336fe603b7110ba9d54a92af8449bbd4a82fe33d14bc912a048336fc90686464354141316c7890e80e7501af88f657cb7247de6717674e80ba044a279a00 ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/pixman/CONTROL b/ports/pixman/CONTROL index 564c81466..3603242d0 100644 --- a/ports/pixman/CONTROL +++ b/ports/pixman/CONTROL @@ -1,3 +1,3 @@ Source: pixman -Version: 0.34.0 +Version: 0.34.0-1 Description: Pixman is a low-level software library for pixel manipulation, providing features such as image compositing and trapezoid rasterization. diff --git a/ports/pixman/portfile.cmake b/ports/pixman/portfile.cmake index b4029a26b..ac6de80f0 100644 --- a/ports/pixman/portfile.cmake +++ b/ports/pixman/portfile.cmake @@ -5,10 +5,6 @@ # CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} # CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} # -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - message(STATUS "Warning: Dynamic building not supported. Building static.") # pixman does not export any symbols. - set(VCPKG_LIBRARY_LINKAGE static) -endif() include(vcpkg_common_functions) @@ -27,6 +23,7 @@ file(RENAME ${SOURCE_PATH}/pixman/CMakeLists_pixman.txt ${SOURCE_PATH}/pixman/CM vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + OPTIONS -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON ) vcpkg_install_cmake() diff --git a/ports/poco/CONTROL b/ports/poco/CONTROL index 6f4f7e3b1..555be3a5d 100644 --- a/ports/poco/CONTROL +++ b/ports/poco/CONTROL @@ -1,4 +1,4 @@ Source: poco -Version: 1.7.6-2 +Version: 1.7.6-4 Build-Depends: zlib, pcre, sqlite3, expat -Description: Modern, powerful open source C++ class libraries for building network and internet-based applications that run on desktop, server, mobile and embedded systems.
\ No newline at end of file +Description: Modern, powerful open source C++ class libraries for building network and internet-based applications that run on desktop, server, mobile and embedded systems. diff --git a/ports/poco/foundation-public-include-pcre.patch b/ports/poco/foundation-public-include-pcre.patch new file mode 100644 index 000000000..ab4403ad8 --- /dev/null +++ b/ports/poco/foundation-public-include-pcre.patch @@ -0,0 +1,12 @@ +diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt +index 76005b1..efc99b6 100644 +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -166,6 +166,7 @@ target_link_libraries( "${LIBNAME}" ${SYSLIBS}) + target_include_directories( "${LIBNAME}" + PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> ++ $<BUILD_INTERFACE:${PCRE_INCLUDE_DIRS}> + $<INSTALL_INTERFACE:include> + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src + ) diff --git a/ports/poco/portfile.cmake b/ports/poco/portfile.cmake index 413f19c7e..7ef484cdb 100644 --- a/ports/poco/portfile.cmake +++ b/ports/poco/portfile.cmake @@ -11,23 +11,25 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES - ${CMAKE_CURRENT_LIST_DIR}/config_h.patch - ${CMAKE_CURRENT_LIST_DIR}/find_pcre.patch + ${CMAKE_CURRENT_LIST_DIR}/config_h.patch + ${CMAKE_CURRENT_LIST_DIR}/find_pcre.patch + ${CMAKE_CURRENT_LIST_DIR}/foundation-public-include-pcre.patch ) if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - set(POCO_STATIC ON) + set(POCO_STATIC ON) else() - set(POCO_STATIC OFF) + set(POCO_STATIC OFF) endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS - -DPOCO_STATIC=${POCO_STATIC} - -DENABLE_SEVENZIP=ON - -DENABLE_TESTS=OFF - -DPOCO_UNBUNDLED=ON # OFF means: using internal copy of sqlite, libz, pcre, expat, ... + PREFER_NINJA + OPTIONS + -DPOCO_STATIC=${POCO_STATIC} + -DENABLE_SEVENZIP=ON + -DENABLE_TESTS=OFF + -DPOCO_UNBUNDLED=ON # OFF means: using internal copy of sqlite, libz, pcre, expat, ... ) vcpkg_install_cmake() @@ -37,23 +39,17 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/bin/cpspc.exe ${CURRENT_PACKAGES_DIR}/tools/ file(RENAME ${CURRENT_PACKAGES_DIR}/bin/f2cpsp.exe ${CURRENT_PACKAGES_DIR}/tools/f2cpsp.exe) if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin) + file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/bin + ${CURRENT_PACKAGES_DIR}/debug/bin) else() - file(REMOVE - ${CURRENT_PACKAGES_DIR}/bin/cpspc.pdb - ${CURRENT_PACKAGES_DIR}/bin/f2cpsp.pdb - ${CURRENT_PACKAGES_DIR}/debug/bin/cpspc.exe - ${CURRENT_PACKAGES_DIR}/debug/bin/cpspc.pdb - ${CURRENT_PACKAGES_DIR}/debug/bin/f2cpsp.exe - ${CURRENT_PACKAGES_DIR}/debug/bin/f2cpsp.pdb) - - file(REMOVE - ${CURRENT_PACKAGES_DIR}/bin/vcruntime140.dll - ${CURRENT_PACKAGES_DIR}/bin/msvcp140.dll - ${CURRENT_PACKAGES_DIR}/debug/bin/vcruntime140.dll - ${CURRENT_PACKAGES_DIR}/debug/bin/msvcp140.dll) + file(REMOVE + ${CURRENT_PACKAGES_DIR}/bin/cpspc.pdb + ${CURRENT_PACKAGES_DIR}/bin/f2cpsp.pdb + ${CURRENT_PACKAGES_DIR}/debug/bin/cpspc.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/cpspc.pdb + ${CURRENT_PACKAGES_DIR}/debug/bin/f2cpsp.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/f2cpsp.pdb) endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) @@ -62,4 +58,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) # copy license file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/poco) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/poco/LICENSE ${CURRENT_PACKAGES_DIR}/share/poco/copyright)
\ No newline at end of file +file(RENAME ${CURRENT_PACKAGES_DIR}/share/poco/LICENSE ${CURRENT_PACKAGES_DIR}/share/poco/copyright) diff --git a/ports/portaudio/CONTROL b/ports/portaudio/CONTROL new file mode 100644 index 000000000..b2fb68b84 --- /dev/null +++ b/ports/portaudio/CONTROL @@ -0,0 +1,3 @@ +Source: portaudio
+Version: 19.0.6.00
+Description: PortAudio Portable Cross-platform Audio I/O API PortAudio is a free, cross-platform, open-source, audio I/O library. It lets you write simple audio programs in 'C' or C++ that will compile and run on many platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA). It is intended to promote the exchange of audio software between developers on different platforms. Many applications use PortAudio for Audio I/O.
diff --git a/ports/portaudio/cmakelists-install.patch b/ports/portaudio/cmakelists-install.patch new file mode 100644 index 000000000..88c95260d --- /dev/null +++ b/ports/portaudio/cmakelists-install.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -372,6 +372,8 @@ + ENDIF() + SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX} FOLDER "Portaudio") + SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX} FOLDER "Portaudio") ++ INSTALL(FILES ${PA_PUBLIC_INCLUDES} DESTINATION include) ++ INSTALL(TARGETS portaudio portaudio_static RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + ELSE() + IF(APPLE AND CMAKE_VERSION VERSION_GREATER 3.4.2) + OPTION(PA_OUTPUT_OSX_FRAMEWORK "Generate an OS X framework instead of the simple library" OFF) diff --git a/ports/portaudio/portfile.cmake b/ports/portaudio/portfile.cmake new file mode 100644 index 000000000..b243d5a6d --- /dev/null +++ b/ports/portaudio/portfile.cmake @@ -0,0 +1,52 @@ +# Common Ambient Variables:
+# VCPKG_ROOT_DIR = <C:/path/to/current/vcpkg>
+# TARGET_TRIPLET is the current triplet (${VCPKG_TARGET_ARCHITECTURE}-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(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/portaudio)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz"
+ FILENAME "pa_stable_v190600_20161030.tgz"
+ SHA512 7ec692cbd8c23878b029fad9d9fd63a021f57e60c4921f602995a2fca070c29f17a280c7f2da5966c4aad29d28434538452f4c822eacf3a60af59a6dc8e9704c
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/cmakelists-install.patch)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+# Remove static builds from dynamic builds and otherwise
+# Remove x86 and x64 from resulting files
+if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ file (REMOVE ${CURRENT_PACKAGES_DIR}/lib/portaudio_static_${VCPKG_TARGET_ARCHITECTURE}.lib)
+ file (REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/portaudio_static_${VCPKG_TARGET_ARCHITECTURE}.lib)
+
+ file (RENAME ${CURRENT_PACKAGES_DIR}/lib/portaudio_${VCPKG_TARGET_ARCHITECTURE}.lib ${CURRENT_PACKAGES_DIR}/lib/portaudio.lib)
+ file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/portaudio_${VCPKG_TARGET_ARCHITECTURE}.lib ${CURRENT_PACKAGES_DIR}/debug/lib/portaudio.lib)
+else ()
+ file (RENAME ${CURRENT_PACKAGES_DIR}/lib/portaudio_static_${VCPKG_TARGET_ARCHITECTURE}.lib ${CURRENT_PACKAGES_DIR}/lib/portaudio.lib)
+ file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/portaudio_static_${VCPKG_TARGET_ARCHITECTURE}.lib ${CURRENT_PACKAGES_DIR}/debug/lib/portaudio.lib)
+
+ file (REMOVE ${CURRENT_PACKAGES_DIR}/lib/portaudio_${VCPKG_TARGET_ARCHITECTURE}.lib)
+ file (REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+ file (REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/portaudio_${VCPKG_TARGET_ARCHITECTURE}.lib)
+ file (REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
+endif ()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/portaudio)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/portaudio/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/portaudio/copyright)
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
diff --git a/ports/pqp/CMakeLists.txt b/ports/pqp/CMakeLists.txt new file mode 100644 index 000000000..e46f17895 --- /dev/null +++ b/ports/pqp/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.0) +project(pqp) + +include_directories(${SOURCE}/src) + +file(GLOB SRCS + "${SOURCE}/src/*.cpp") +file(GLOB HDRS + "${SOURCE}/src/*.h") + +add_library(pqp STATIC ${SRCS}) + +install(TARGETS pqp EXPORT pqpConfig + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +foreach (file ${HDRS}) + get_filename_component(dir ${file} DIRECTORY) + install(FILES ${file} DESTINATION include/ CONFIGURATIONS Release) +endforeach()
\ No newline at end of file diff --git a/ports/pqp/CONTROL b/ports/pqp/CONTROL new file mode 100644 index 000000000..89995bb92 --- /dev/null +++ b/ports/pqp/CONTROL @@ -0,0 +1,3 @@ +Source: pqp +Version: 1.3 +Description: a proximity query package diff --git a/ports/pqp/LICENSE b/ports/pqp/LICENSE new file mode 100644 index 000000000..2d4e4817a --- /dev/null +++ b/ports/pqp/LICENSE @@ -0,0 +1,32 @@ +Copyright 1999 University of North Carolina at Chapel Hill. +All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for educational, research, and non-profit purposes, without fee, +and without a written agreement is hereby granted, provided that the above +copyright notice and the following three paragraphs appear in all copies. + +IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE LIABLE TO +ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, +INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL SPECIFICALLY DISCLAIMS ANY +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED +HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA AT +CHAPEL HILL HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, +ENHANCEMENTS, OR MODIFICATIONS. + +The authors may be contacted via: + +US Mail: Eric Larsen, Stefan Gottschalk + Department of Computer Science + Sitterson Hall, CB #3175 + University of North Carolina + Chapel Hill, NC 27599-3175 + +Phone: (919) 962-1749 + +Email: geom@cs.unc.edu
\ No newline at end of file diff --git a/ports/pqp/portfile.cmake b/ports/pqp/portfile.cmake new file mode 100644 index 000000000..3ce851400 --- /dev/null +++ b/ports/pqp/portfile.cmake @@ -0,0 +1,27 @@ +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pqp-1.3/PQP_v1.3) +vcpkg_download_distfile(ARCHIVE + URLS "http://gamma.cs.unc.edu/software/downloads/SSV/pqp-1.3.tar.gz" + FILENAME "pqp-1.3.tar.gz" + SHA512 baad7b050b13a6d13de5110cdec443048a3543b65b0d3b30d1b5f737b46715052661f762ef71345d39978c0c788a30a3a935717664806b4729722ee3594ebdc1 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DSOURCE=${SOURCE_PATH} +) + +vcpkg_install_cmake() + +# Handle copyright +file(COPY ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/pqp) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/pqp/LICENSE ${CURRENT_PACKAGES_DIR}/share/pqp/copyright) diff --git a/ports/protobuf/CONTROL b/ports/protobuf/CONTROL index 795213a33..95e7e367c 100644 --- a/ports/protobuf/CONTROL +++ b/ports/protobuf/CONTROL @@ -1,4 +1,4 @@ Source: protobuf -Version: 3.0.2 +Version: 3.2.0 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 index fa7748381..2d7cecf65 100644 --- a/ports/protobuf/portfile.cmake +++ b/ports/protobuf/portfile.cmake @@ -1,20 +1,20 @@ #tool 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 + URLS "https://github.com/google/protobuf/releases/download/v3.2.0/protobuf-cpp-3.2.0.tar.gz" + FILENAME "protobuf-cpp-3.2.0.tar.gz" + SHA512 dd005f5e862ff24bb233b9eaed1d7f44c42f1cc8c647c0839fe2ecc2d91178845195d79776cfa2e31d224c16eed11b05ad824b66b743e685334057d8180f17aa ) 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 + URLS "https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-win32.zip" + FILENAME "protoc-3.2.0-win32.zip" + SHA512 985c86a04cebacfba96f3985d1b3d6ef341470171b809c6f6362bc13a07a3df9c8962d912857bb764bf8634cf676c5f8453c43b4e0a6398f2ff314708975d1e4 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) -vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2-win32) +vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.2.0-win32) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2/cmake + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.2.0/cmake OPTIONS -Dprotobuf_BUILD_SHARED_LIBS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF @@ -23,9 +23,21 @@ vcpkg_configure_cmake( -DCMAKE_INSTALL_CMAKEDIR=share/protobuf ) -vcpkg_install_cmake() +# Using 64-bit toolset to avoid occassional Linker Out-of-Memory issues. +vcpkg_install_cmake(MSVC_64_TOOLSET) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +# It appears that at this point the build hasn't actually finished. There is probably +# a process spawned by the build, therefore we need to wait a bit. + +function(protobuf_try_remove_recurse_wait PATH_TO_REMOVE) + file(REMOVE_RECURSE ${PATH_TO_REMOVE}) + if (EXISTS "${PATH_TO_REMOVE}") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 5) + file(REMOVE_RECURSE ${PATH_TO_REMOVE}) + endif() +endfunction() + +protobuf_try_remove_recurse_wait(${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}") @@ -36,12 +48,10 @@ string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${D 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(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share) +protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin) +protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin) -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) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.2.0/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.2.0-win32/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) vcpkg_copy_pdbs() diff --git a/ports/pugixml/CONTROL b/ports/pugixml/CONTROL new file mode 100644 index 000000000..298d433b2 --- /dev/null +++ b/ports/pugixml/CONTROL @@ -0,0 +1,3 @@ +Source: pugixml +Version: 1.8.1 +Description: C++ XML processing library diff --git a/ports/pugixml/portfile.cmake b/ports/pugixml/portfile.cmake new file mode 100644 index 000000000..4fcbec84b --- /dev/null +++ b/ports/pugixml/portfile.cmake @@ -0,0 +1,28 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pugixml-1.8) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/zeux/pugixml/releases/download/v1.8.1/pugixml-1.8.1.zip" + FILENAME "pugixml-1.8.1.zip" + SHA512 683fe224a9bcac032d78cb44d03915a3766d2faa588f3a8486b5719f26eeba3e17d447edf70e1907f51f8649ffb4607b6badd1365e4c15cf24279bf577dc853e +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/pugixmlapi.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DBUILD_DEFINES="PUGIXML_API=__declspec\(dllexport\)" +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +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(INSTALL ${SOURCE_PATH}/readme.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/pugixml RENAME copyright)
\ No newline at end of file diff --git a/ports/pugixml/pugixmlapi.patch b/ports/pugixml/pugixmlapi.patch new file mode 100644 index 000000000..177664dbe --- /dev/null +++ b/ports/pugixml/pugixmlapi.patch @@ -0,0 +1,13 @@ +diff --git a/src/pugixml.hpp b/src/pugixml.hpp +index 4d76bfa..75a4f8a 100644 +--- a/src/pugixml.hpp ++++ b/src/pugixml.hpp +@@ -50,7 +50,7 @@ + + // If no API is defined, assume default + #ifndef PUGIXML_API +-# define PUGIXML_API ++# define PUGIXML_API __declspec(dllimport) + #endif + + // If no API for classes is defined, assume default diff --git a/ports/qca/portfile.cmake b/ports/qca/portfile.cmake index 072c4b7cb..6ad35d1f7 100644 --- a/ports/qca/portfile.cmake +++ b/ports/qca/portfile.cmake @@ -15,7 +15,7 @@ include(vcpkg_common_functions) find_program(GIT git) vcpkg_find_acquire_program(PERL) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) -set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}") # Set git variables to qca version 2.2.0 commit set(GIT_URL "git://anongit.kde.org/qca.git") diff --git a/ports/qt5/CONTROL b/ports/qt5/CONTROL index 40bde5f2a..cd49d30ab 100644 --- a/ports/qt5/CONTROL +++ b/ports/qt5/CONTROL @@ -1,4 +1,4 @@ Source: qt5 -Version: 5.7.1-2 +Version: 5.7.1-5 Description: Qt5 application framework main components. Webengine, examples and tests not included. -Build-Depends: sqlite3, libpq +Build-Depends: sqlite3, libpq, double-conversion diff --git a/ports/qt5/fixcmake.py b/ports/qt5/fixcmake.py index bd37c1e54..41b74606c 100644 --- a/ports/qt5/fixcmake.py +++ b/ports/qt5/fixcmake.py @@ -36,7 +36,7 @@ for f in files: builder += "\n " + line.replace("/plugins/", "/debug/plugins/") builder += " endif()\n" elif exepattern.search(line) != None: - builder += line.replace("/bin/", "/tools/") + builder += line.replace("/bin/", "/tools/qt5/") else: builder += line new_file = open(f, "w") diff --git a/ports/qt5/portfile.cmake b/ports/qt5/portfile.cmake index adcec1c8b..ecdc9b8df 100644 --- a/ports/qt5/portfile.cmake +++ b/ports/qt5/portfile.cmake @@ -12,7 +12,7 @@ vcpkg_find_acquire_program(PYTHON3) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY) get_filename_component(JOM_EXE_PATH ${JOM} DIRECTORY) -set(ENV{PATH} "${JOM_EXE_PATH};${PYTHON3_EXE_PATH};${PERL_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "${JOM_EXE_PATH};${PYTHON3_EXE_PATH};${CURRENT_INSTALLED_DIR}/bin;$ENV{PATH};${PERL_EXE_PATH}") set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}") set(ENV{LIB} "${CURRENT_INSTALLED_DIR}/lib;$ENV{LIB}") vcpkg_download_distfile(ARCHIVE_FILE @@ -25,6 +25,12 @@ if (EXISTS ${CURRENT_BUILDTREES_DIR}/src/qt-everywhere-opensource-src-5.7.1) file(RENAME ${CURRENT_BUILDTREES_DIR}/src/qt-everywhere-opensource-src-5.7.1 ${CURRENT_BUILDTREES_DIR}/src/qt-5.7.1) endif() +if(EXISTS ${OUTPUT_PATH}) + file(REMOVE_RECURSE ${OUTPUT_PATH}) + if(EXISTS ${OUTPUT_PATH}) + message(FATAL_ERROR "Could not clean output directory.") + endif() +endif() file(MAKE_DIRECTORY ${OUTPUT_PATH}) if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static) list(APPEND QT_RUNTIME_LINKAGE "-static") @@ -32,11 +38,13 @@ if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES "${CMAKE_CURRENT_LIST_DIR}/set-static-qmakespec.patch" + QUIET ) else() vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES "${CMAKE_CURRENT_LIST_DIR}/set-shared-qmakespec.patch" + QUIET ) endif() @@ -46,17 +54,29 @@ vcpkg_execute_required_process( -confirm-license -opensource -platform win32-msvc2015 -debug-and-release -force-debug-info ${QT_RUNTIME_LINKAGE} -qt-zlib - -qt-libjpeg + -no-libjpeg -no-libpng -no-freetype -qt-pcre -no-harfbuzz + -no-angle + -no-inotify + -no-mtdev + -no-evdev + -system-doubleconversion + -no-iconv -system-sqlite - -nomake examples -nomake tests -skip webengine + -no-opengl + -no-style-windowsxp + -no-style-windowsvista + -no-style-fusion + -mp + -nomake examples -nomake tests -no-compile-examples + -skip webengine -skip declarative -qt-sql-sqlite -qt-sql-psql -prefix ${CURRENT_PACKAGES_DIR} -bindir ${CURRENT_PACKAGES_DIR}/bin - -hostbindir ${CURRENT_PACKAGES_DIR}/tools + -hostbindir ${CURRENT_PACKAGES_DIR}/tools/qt5 -archdatadir ${CURRENT_PACKAGES_DIR}/share/qt5 -datadir ${CURRENT_PACKAGES_DIR}/share/qt5 -plugindir ${CURRENT_PACKAGES_DIR}/plugins @@ -66,8 +86,14 @@ vcpkg_execute_required_process( message(STATUS "Configure ${TARGET_TRIPLET} done") message(STATUS "Building ${TARGET_TRIPLET}") +# Multiple executions are required due to https://bugreports.qt.io/browse/QTBUG-53393 +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(COUNT 1) +else() + set(COUNT 3) +endif() vcpkg_execute_required_process_repeat( - COUNT 5 + COUNT ${COUNT} COMMAND ${JOM} WORKING_DIRECTORY ${OUTPUT_PATH} LOGNAME build-${TARGET_TRIPLET} @@ -101,7 +127,9 @@ if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic) file(REMOVE ${DEBUG_BIN_FILES}) file(GLOB DEBUG_BIN_FILES "${CURRENT_PACKAGES_DIR}/bin/*d.pdb") file(REMOVE ${DEBUG_BIN_FILES}) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/bin/Qt5Gamepad.dll ${CURRENT_PACKAGES_DIR}/bin/Qt5Gamepad.dll) + if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/bin/Qt5Gamepad.dll) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/bin/Qt5Gamepad.dll ${CURRENT_PACKAGES_DIR}/bin/Qt5Gamepad.dll) + endif() endif() file(INSTALL ${CURRENT_PACKAGES_DIR}/lib @@ -124,10 +152,14 @@ file(GLOB DEBUG_LIB_FILES "${CURRENT_PACKAGES_DIR}/lib/*d.pdb") if(DEBUG_LIB_FILES) file(REMOVE ${DEBUG_LIB_FILES}) endif() -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Gamepad.lib ${CURRENT_PACKAGES_DIR}/lib/Qt5Gamepad.lib) -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Gamepad.prl ${CURRENT_PACKAGES_DIR}/lib/Qt5Gamepad.prl) +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Gamepad.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Gamepad.lib ${CURRENT_PACKAGES_DIR}/lib/Qt5Gamepad.lib) +endif() +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Gamepad.prl) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Gamepad.prl ${CURRENT_PACKAGES_DIR}/lib/Qt5Gamepad.prl) +endif() file(GLOB BINARY_TOOLS "${CURRENT_PACKAGES_DIR}/bin/*.exe") -file(INSTALL ${BINARY_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +file(INSTALL ${BINARY_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/qt5) file(REMOVE ${BINARY_TOOLS}) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/plugins") file(GLOB_RECURSE DEBUG_PLUGINS @@ -141,18 +173,27 @@ foreach(file ${DEBUG_PLUGINS}) file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/plugins/${rel_dir}") file(RENAME ${file} "${CURRENT_PACKAGES_DIR}/debug/plugins/${rel_dir}/${file_n}") endforeach() -file(RENAME - ${CURRENT_PACKAGES_DIR}/debug/plugins/gamepads/xinputgamepad.dll - ${CURRENT_PACKAGES_DIR}/plugins/gamepads/xinputgamepad.dll) -file(RENAME - ${CURRENT_PACKAGES_DIR}/debug/plugins/gamepads/xinputgamepad.pdb - ${CURRENT_PACKAGES_DIR}/plugins/gamepads/xinputgamepad.pdb) -if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic) - file(GLOB RELEASE_DLLS "${CURRENT_PACKAGES_DIR}/bin/*.dll") - file(INSTALL ${RELEASE_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/plugins/gamepads/xinputgamepad.dll) + file(RENAME + ${CURRENT_PACKAGES_DIR}/debug/plugins/gamepads/xinputgamepad.dll + ${CURRENT_PACKAGES_DIR}/plugins/gamepads/xinputgamepad.dll) +endif() +if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/plugins/gamepads/xinputgamepad.pdb) + file(RENAME + ${CURRENT_PACKAGES_DIR}/debug/plugins/gamepads/xinputgamepad.pdb + ${CURRENT_PACKAGES_DIR}/plugins/gamepads/xinputgamepad.pdb) endif() +if(NOT EXISTS ${CURRENT_PACKAGES_DIR}/lib/Qt5Bootstrap.lib AND EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrapd.lib) + # QT bug: https://bugreports.qt.io/browse/QTBUG-55499 + # The release copy of Qt5Bootstrap.lib is not created when using -debug-and-release + # Comments from Oswald Buddenhagen indicate this is an internal library, so simply removing the mismatch should be safe. + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/Qt5Bootstrapd.lib) +endif() + +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/qt5) + vcpkg_execute_required_process( COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py WORKING_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/cmake diff --git a/ports/qwt/CONTROL b/ports/qwt/CONTROL new file mode 100644 index 000000000..b457bdead --- /dev/null +++ b/ports/qwt/CONTROL @@ -0,0 +1,4 @@ +Source: qwt +Version: 6.1.3 +Description: Qt widgets library for technical applications +Build-Depends: qt5 diff --git a/ports/qwt/build-shared-lib.patch b/ports/qwt/build-shared-lib.patch new file mode 100644 index 000000000..2a8447d52 --- /dev/null +++ b/ports/qwt/build-shared-lib.patch @@ -0,0 +1,13 @@ +diff --git a/qwtconfig.pri b/qwtconfig.pri +index 756231a..2dc3715 100644 +--- a/qwtconfig.pri ++++ b/qwtconfig.pri +@@ -72,7 +72,7 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features + # it will be a static library. + ###################################################################### + +-# QWT_CONFIG += QwtDll ++QWT_CONFIG += QwtDll + + ###################################################################### + # QwtPlot enables all classes, that are needed to use the QwtPlot diff --git a/ports/qwt/build-static-lib.patch b/ports/qwt/build-static-lib.patch new file mode 100644 index 000000000..3e1b462ac --- /dev/null +++ b/ports/qwt/build-static-lib.patch @@ -0,0 +1,13 @@ +diff --git a/qwtconfig.pri b/qwtconfig.pri +index 2dc3715..756231a 100644 +--- a/qwtconfig.pri ++++ b/qwtconfig.pri +@@ -72,7 +72,7 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features + # it will be a static library. + ###################################################################### + +-QWT_CONFIG += QwtDll ++# QWT_CONFIG += QwtDll + + ###################################################################### + # QwtPlot enables all classes, that are needed to use the QwtPlot diff --git a/ports/qwt/portfile.cmake b/ports/qwt/portfile.cmake new file mode 100644 index 000000000..94cb2af91 --- /dev/null +++ b/ports/qwt/portfile.cmake @@ -0,0 +1,61 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/qwt-6.1.3) +vcpkg_download_distfile(ARCHIVE + URLS "https://sourceforge.net/projects/qwt/files/qwt/6.1.3/qwt-6.1.3.zip" + FILENAME "qwt-6.1.3.zip" + SHA512 8f249e23d50f71d14fca37776ea40d8d6931db14d9602e03a343bfb7a9bf55502202103135b77f583c3890a7924220e8a142a01c448dbde311860d89a3b10fc8 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/build-shared-lib.patch" + QUIET + ) +else() + vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/build-static-lib.patch" + QUIET + ) +endif() + +vcpkg_configure_qmake( + SOURCE_PATH ${SOURCE_PATH} +) + +vcpkg_build_qmake() + +# Install following vcpkg conventions +set(BUILD_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) + +file(GLOB HEADER_FILES ${SOURCE_PATH}/src/*.h) +file(INSTALL ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +file(INSTALL + ${BUILD_DIR}/lib/qwt.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/lib +) + +file(INSTALL + ${BUILD_DIR}/lib/qwtd.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(INSTALL + ${BUILD_DIR}/lib/qwt.dll + DESTINATION ${CURRENT_PACKAGES_DIR}/bin + ) + + file(INSTALL + ${BUILD_DIR}/lib/qwtd.dll + ${BUILD_DIR}/lib/qwtd.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin + ) +endif() + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/qwt) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/qwt/COPYING ${CURRENT_PACKAGES_DIR}/share/qwt/copyright) diff --git a/ports/rapidjson/CONTROL b/ports/rapidjson/CONTROL index 2ef641783..0dd6333cf 100644 --- a/ports/rapidjson/CONTROL +++ b/ports/rapidjson/CONTROL @@ -1,3 +1,3 @@ Source: rapidjson -Version: 1.0.2-1 +Version: 1.1.0 Description: A fast JSON parser/generator for C++ with both SAX/DOM style API <http://rapidjson.org/> diff --git a/ports/rapidjson/portfile.cmake b/ports/rapidjson/portfile.cmake index 3d923cb95..80dc14f5d 100644 --- a/ports/rapidjson/portfile.cmake +++ b/ports/rapidjson/portfile.cmake @@ -1,10 +1,10 @@ #header-only library include(vcpkg_common_functions) -SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0) +SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rapidjson-1.1.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/miloyip/rapidjson/archive/879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip" - FILENAME "rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip" - SHA512 4d9ef7cce7d179344c33245c081a142ca5fcb2a0cc170ed39e3d0add008efab8e7389feec03e1ea83b30c5778cd0600865b08bc1c23592e5154dbe1f21f9547d + URLS "https://github.com/miloyip/rapidjson/archive/v1.1.0.zip" + FILENAME "rapidjson-v1.1.0.zip" + SHA512 4ddbf6dc5d943eb971e7a62910dd78d1cc5cc3016066a443f351d4276d2be3375ed97796e672c2aecd6990f0b332826f8c8ddc7d367193d7b82f0037f4e4012c ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/sdl2-image/CMakeLists.txt b/ports/sdl2-image/CMakeLists.txt new file mode 100644 index 000000000..e742a408d --- /dev/null +++ b/ports/sdl2-image/CMakeLists.txt @@ -0,0 +1,109 @@ +cmake_minimum_required(VERSION 2.6) +project(SDL2_image) + +### configuration ### + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") +# enable all file formats which are supported natively +set(SUPPORTED_FORMATS BMP GIF LBM PCX PNM TGA XPM XCF XV) + +# enable all file formats which are supported through external dependencies +# first try to load them statically (lib file in vcpkg installation) +# if this fails try to make them a dynamic dependency (dll will be loaded at runtime) if possible. vcpkg cannot resolve these dependencies! +# else do not support this file format at all +set(DEPENDENCIES PNG JPEG TIFF WEBP) + +# patch library names for preprocessor flags +set(JPEG_FLAG JPG) +set(TIFF_FLAG TIF) + +# names of potentially dynamically loaded libraries +set(JPEG_DYNAMIC \"libjpeg-9.dll\") +set(PNG_DYNAMIC \"libpng16-16.dll\") +set(TIFF_DYNAMIC \"libtiff-5.dll\") +set(WEBP_DYNAMIC \"libwebp-4.dll\") + +### implementation ### + +add_library(SDL2_image + IMG.c + IMG_bmp.c + IMG_gif.c + IMG_jpg.c + IMG_lbm.c + IMG_pcx.c + IMG_png.c + IMG_pnm.c + IMG_tga.c + IMG_tif.c + IMG_webp.c + IMG_xcf.c + IMG_xpm.c + IMG_xv.c + IMG_xxx.c + ) + +foreach(FORMAT ${SUPPORTED_FORMATS}) + add_definitions(-DLOAD_${FORMAT}) +endforeach(FORMAT) + +# SDL +find_path(SDL_INCLUDE_DIR SDL2/SDL.h) +find_library(SDL_LIBRARY SDL2) + +include_directories(${SDL_INCLUDE_DIR}) +include_directories(${SDL_INCLUDE_DIR}/SDL2) +include_directories(${CMAKE_SOURCE_DIR}) + +target_link_libraries(SDL2_image ${SDL_LIBRARY}) + +# external dependencies +foreach(DEPENDENCY ${DEPENDENCIES}) + find_package(${DEPENDENCY}) + + if(NOT DEFINED ${DEPENDENCY}_FLAG) + set(${DEPENDENCY}_FLAG ${DEPENDENCY}) + endif() + + add_definitions(-DLOAD_${${DEPENDENCY}_FLAG}) + if(${DEPENDENCY}_FOUND) + message(STATUS " --> linking statically.") + target_link_libraries(SDL2_image ${${DEPENDENCY}_LIBRARIES}) + elseif(DEFINED ${DEPENDENCY}_DYNAMIC) + message(STATUS " --> linking dynamically.") + add_definitions(-DLOAD_${${DEPENDENCY}_FLAG}_DYNAMIC=${${DEPENDENCY}_DYNAMIC}) + set(RUNTIME_DEPENDENCIES ON) + else() + message(STATUS " --> skipping.") + endif() +endforeach(DEPENDENCY) + +if(DEFINED RUNTIME_DEPENDENCIES) + include_directories(VisualC/external/include) +endif() + + +install(TARGETS SDL2_image + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +install(FILES SDL_image.h DESTINATION include/SDL2 CONFIGURATIONS Release) + + +message(STATUS "Link-time dependencies:") +message(STATUS " " ${SDL_LIBRARY}) +foreach(DEPENDENCY ${DEPENDENCIES}) + if(${DEPENDENCY}_FOUND) + message(STATUS " " ${DEPENDENCY}) + endif() +endforeach(DEPENDENCY) + +if(DEFINED RUNTIME_DEPENDENCIES) + message(STATUS "Run-time dependencies:") + foreach(DEPENDENCY ${DEPENDENCIES}) + if(NOT ${DEPENDENCY}_FOUND AND DEFINED ${DEPENDENCY}_DYNAMIC) + message(STATUS " " ${${DEPENDENCY}_DYNAMIC}) + endif() + endforeach(DEPENDENCY) +endif()
\ No newline at end of file diff --git a/ports/sdl2-image/CONTROL b/ports/sdl2-image/CONTROL new file mode 100644 index 000000000..04c9f77bb --- /dev/null +++ b/ports/sdl2-image/CONTROL @@ -0,0 +1,5 @@ +Source: sdl2-image +Version: 2.0.1 +Build-Depends: sdl2, libpng, libjpeg-turbo, tiff, libwebp +Description: SDL_image is an image file loading library. It loads images as SDL surfaces and textures, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV + diff --git a/ports/sdl2-image/FindWEBP.cmake b/ports/sdl2-image/FindWEBP.cmake new file mode 100644 index 000000000..fb3f9caa1 --- /dev/null +++ b/ports/sdl2-image/FindWEBP.cmake @@ -0,0 +1,24 @@ +# - Find WEBP +# Find the WEBP library +# This module defines +# WEBP_INCLUDE_DIRS, where to find webp/decode.h +# WEBP_LIBRARIES, the libraries needed to use WEBP +# + +find_path(WEBP_INCLUDE_DIRS + NAMES webp/decode.h +) +mark_as_advanced(WEBP_INCLUDE_DIRS) + +find_library( + WEBP_LIBRARIES + NAMES webp +) + +find_library(WEBP_LIBRARY_RELEASE NAMES webp PATH_SUFFIXES lib) +find_library(WEBP_LIBRARY_DEBUG NAMES webpd PATH_SUFFIXES lib) +include(SelectLibraryConfigurations) +select_library_configurations(WEBP) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(WEBP DEFAULT_MSG WEBP_INCLUDE_DIRS WEBP_LIBRARIES)
\ No newline at end of file diff --git a/ports/sdl2-image/correct-sdl-headers-dir.patch b/ports/sdl2-image/correct-sdl-headers-dir.patch new file mode 100644 index 000000000..4addc155d --- /dev/null +++ b/ports/sdl2-image/correct-sdl-headers-dir.patch @@ -0,0 +1,25 @@ +diff --git "a/SDL_image.h" "b/SDL_image.h" +index f654483..1bd4f62 100644 +--- "a/SDL_image.h" ++++ "b/SDL_image.h" +@@ -24,9 +24,9 @@ + #ifndef _SDL_IMAGE_H + #define _SDL_IMAGE_H + +-#include "SDL.h" +-#include "SDL_version.h" +-#include "begin_code.h" ++#include <SDL2/SDL.h> ++#include <SDL2/SDL_version.h> ++#include <SDL2/begin_code.h> + + /* Set up for C function definitions, even when using C++ */ + #ifdef __cplusplus +@@ -140,6 +140,6 @@ extern DECLSPEC int SDLCALL IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, + #ifdef __cplusplus + } + #endif +-#include "close_code.h" ++#include <SDL2/close_code.h> + + #endif /* _SDL_IMAGE_H */ diff --git a/ports/sdl2-image/portfile.cmake b/ports/sdl2-image/portfile.cmake new file mode 100644 index 000000000..4cc6ce74a --- /dev/null +++ b/ports/sdl2-image/portfile.cmake @@ -0,0 +1,39 @@ +# 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(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2_image-2.0.1) +vcpkg_download_distfile(ARCHIVE + URLS "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.zip" + FILENAME "SDL2_image-2.0.1.zip" + SHA512 37d12f4fae71c586bec73262bddb9207ab2f9a2ca6001d2cbfde646e268a950ba5cd4cff53d75e2da8959ae6da6e9cadc6eca88fa7bd9aa2758395d64c84a307 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/correct-sdl-headers-dir.patch) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindWEBP.cmake DESTINATION ${SOURCE_PATH}/cmake) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + # OPTIONS + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-image) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-image/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-image/copyright) + +vcpkg_copy_pdbs()
\ No newline at end of file diff --git a/ports/sfml/CONTROL b/ports/sfml/CONTROL index 175aaa0ab..e7fb08ecd 100644 --- a/ports/sfml/CONTROL +++ b/ports/sfml/CONTROL @@ -1,4 +1,4 @@ Source: sfml
-Version: 2.4.1
+Version: 2.4.2
Description: Simple and fast multimedia library
Build-Depends: freetype, libflac, libjpeg-turbo, libogg, libvorbis, openal-soft, stb
diff --git a/ports/sfml/portfile.cmake b/ports/sfml/portfile.cmake index 916b033ef..69f114ca5 100644 --- a/ports/sfml/portfile.cmake +++ b/ports/sfml/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SFML-2.4.1)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SFML-2.4.2)
vcpkg_download_distfile(ARCHIVE
- URLS "http://www.sfml-dev.org/files/SFML-2.4.1-sources.zip"
- FILENAME "SFML-2.4.1-sources.zip"
- SHA512 e2a49927e1db6ab94fa52b88460782fa2b28ccd4a8c75793e10c7669b24736f63aab723c2e1d8befc96f6f5cf4ed185f13da2550da721d206780003f158e5507)
+ URLS "http://www.sfml-dev.org/files/SFML-2.4.2-sources.zip"
+ FILENAME "SFML-2.4.2-sources.zip"
+ SHA512 14f2b9f244bbff681d1992581f20012f3073456e4baed0fb2bf2cf82538e9c5ddd8ce01b0cfb3874af47091ec19654aa23c426df04fe1ffcfa209623dc362f85)
vcpkg_extract_source_archive(${ARCHIVE})
diff --git a/ports/spdlog/CONTROL b/ports/spdlog/CONTROL index dea187f2e..e4e9a7fc3 100644 --- a/ports/spdlog/CONTROL +++ b/ports/spdlog/CONTROL @@ -1,3 +1,4 @@ Source: spdlog -Version: 0.11.0 +Version: 0.12.0 Description: Very fast, header only, C++ logging library +Build-Depends: fmt diff --git a/ports/spdlog/portfile.cmake b/ports/spdlog/portfile.cmake index f8a4c61ff..230695a52 100644 --- a/ports/spdlog/portfile.cmake +++ b/ports/spdlog/portfile.cmake @@ -1,15 +1,18 @@ #header-only library include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/spdlog-0.11.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/spdlog-0.12.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/gabime/spdlog/archive/v0.11.0.zip" - FILENAME "v0.11.0.zip" - SHA512 4e759b8a18d0e3f256d974920260ebb6c6792885651290637a8a7210731e1d24a6f662d7dc7d3ae165a78c6e738229bd4b6922f36df26581bf43c8bca7c90314 + URLS "https://github.com/gabime/spdlog/archive/v0.12.0.zip" + FILENAME "v0.12.0.zip" + SHA512 2ef251bf4496b3a17ca055f8ee087864b95eb1eb50d43cbe675bdb6f7cb2e5386460c222f4ed9b95d0f21fdb811f43e3b6a1cfaa45523760ff6125a329d8a02a ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DSPDLOG_BUILD_TESTING=OFF ) vcpkg_install_cmake() @@ -23,6 +26,12 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/spdlog/ ${CURRENT_PACKAGES_DIR}/sh file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) +# use vcpkg-provided fmt library +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/spdlog/fmt/bundled) +file(READ ${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h SPDLOG_TWEAKME_CONTENTS) +string(REPLACE "// #define SPDLOG_FMT_EXTERNAL" "#define SPDLOG_FMT_EXTERNAL" SPDLOG_TWEAKME_CONTENTS ${SPDLOG_TWEAKME_CONTENTS}) +file(WRITE ${CURRENT_PACKAGES_DIR}/include/spdlog/tweakme.h ${SPDLOG_TWEAKME_CONTENTS}) + # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/spdlog) file(RENAME ${CURRENT_PACKAGES_DIR}/share/spdlog/LICENSE ${CURRENT_PACKAGES_DIR}/share/spdlog/copyright) diff --git a/ports/spirv-tools/CONTROL b/ports/spirv-tools/CONTROL index 0e1a82706..eacc40ff9 100644 --- a/ports/spirv-tools/CONTROL +++ b/ports/spirv-tools/CONTROL @@ -1,3 +1,3 @@ Source: spirv-tools -Version: -Description: +Version: 1.1-f72189c249ba143c6a89a4cf1e7d53337b2ddd40 +Description: API and commands for processing SPIR-V modules diff --git a/ports/sqlite-modern-cpp/CONTROL b/ports/sqlite-modern-cpp/CONTROL new file mode 100644 index 000000000..641b3229c --- /dev/null +++ b/ports/sqlite-modern-cpp/CONTROL @@ -0,0 +1,4 @@ +Source: sqlite-modern-cpp
+Version: 2.4
+Build-Depends: sqlite3
+Description: The C++14 wrapper around sqlite library
diff --git a/ports/sqlite-modern-cpp/portfile.cmake b/ports/sqlite-modern-cpp/portfile.cmake new file mode 100644 index 000000000..3171b5550 --- /dev/null +++ b/ports/sqlite-modern-cpp/portfile.cmake @@ -0,0 +1,20 @@ +# header only
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite_modern_cpp-2.4)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/aminroosta/sqlite_modern_cpp/archive/v2.4.tar.gz"
+ FILENAME "sqlite_modern_cpp-2.4.tar.gz"
+ SHA512 99d8220c9dcbf7383c75ef8061bc792a4ea0b7e6e1290992f1604f66e77fcb5055af8c54c2d82b6a8d331359e2829d987b7528208f032f32699e1349296792db
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(INSTALL ${SOURCE_PATH}/hdr/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+# Handle copyright
+vcpkg_download_distfile(LICENSE
+ URLS https://raw.githubusercontent.com/aminroosta/sqlite_modern_cpp/1d7747fcbb16325ec6673477b06f0c780de24a27/License.txt
+ FILENAME "sqlite_modern_cpp-2.4-license-mit.txt"
+ SHA512 4ffc41d14902b37841463b9e9274537cb48523a7ab7e5fbbbd14a01820d141e367851b0496aa18546ddab96100e7381db7fc35621c795a97c3290b618e18a8bd
+)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/sqlite-modern-cpp)
+file(INSTALL ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/sqlite-modern-cpp RENAME copyright)
diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL index e382a6f85..bc5b4af98 100644 --- a/ports/sqlite3/CONTROL +++ b/ports/sqlite3/CONTROL @@ -1,3 +1,3 @@ -Source: sqlite3 -Version: 3.15.0 +Source: sqlite3
+Version: 3.17.0
Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
\ No newline at end of file diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake index 8302e9d3e..fdf4ec159 100644 --- a/ports/sqlite3/portfile.cmake +++ b/ports/sqlite3/portfile.cmake @@ -1,27 +1,27 @@ -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-3150000) -vcpkg_download_distfile(ARCHIVE - URLS "https://sqlite.org/2016/sqlite-amalgamation-3150000.zip" - FILENAME "sqlite-amalgamation-3150000.zip" - SHA512 82fea23b2158c448cbe2b80121eb32652df49eb85357edbaeef0c343ef478433706ebc4cd8add1985763db223d9268d0f7e74fc8db59353c15267cbc3d2078a8 -) -vcpkg_extract_source_archive(${ARCHIVE}) - -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - -DSOURCE=${SOURCE_PATH} -) -vcpkg_build_cmake() -vcpkg_install_cmake() - -file(READ ${CURRENT_PACKAGES_DIR}/debug/share/sqlite3/sqlite3Config-debug.cmake SQLITE3_DEBUG_CONFIG) -string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" SQLITE3_DEBUG_CONFIG "${SQLITE3_DEBUG_CONFIG}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/sqlite3Config-debug.cmake "${SQLITE3_DEBUG_CONFIG}") - -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) - -file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/copyright "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n") -vcpkg_copy_pdbs() +include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-3170000)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://sqlite.org/2017/sqlite-amalgamation-3170000.zip"
+ FILENAME "sqlite-amalgamation-3170000.zip"
+ SHA512 36dc05dbb21428237332e813181d4dd0c2ffaedb92a53934630c25421617afd9c1a65784665d222501f1b4b5c6445f425f8c512572a97e42603510dcc0796344
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DSOURCE=${SOURCE_PATH}
+)
+vcpkg_build_cmake()
+vcpkg_install_cmake()
+
+file(READ ${CURRENT_PACKAGES_DIR}/debug/share/sqlite3/sqlite3Config-debug.cmake SQLITE3_DEBUG_CONFIG)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" SQLITE3_DEBUG_CONFIG "${SQLITE3_DEBUG_CONFIG}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/sqlite3Config-debug.cmake "${SQLITE3_DEBUG_CONFIG}")
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/copyright "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n")
+vcpkg_copy_pdbs()
diff --git a/ports/szip/CONTROL b/ports/szip/CONTROL new file mode 100644 index 000000000..acc364810 --- /dev/null +++ b/ports/szip/CONTROL @@ -0,0 +1,3 @@ +Source: szip +Version: 2.1-1 +Description: Szip compression software, providing lossless compression of scientific data diff --git a/ports/szip/default-component-shared.patch b/ports/szip/default-component-shared.patch new file mode 100644 index 000000000..3db94c503 --- /dev/null +++ b/ports/szip/default-component-shared.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d4163a0..4e2a312 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -267,6 +267,14 @@ set (SZIP_VERSION_MAJOR ${SZIP_PACKAGE_VERSION_MAJOR}) + set (SZIP_VERSION_MINOR ${SZIP_PACKAGE_VERSION_MINOR}) + + #----------------------------------------------------------------------------- ++# Set default component ++#----------------------------------------------------------------------------- ++set (SZIP_DEFAULT_COMPONENT static) ++if (BUILD_SHARED_LIBS) ++ set (SZIP_DEFAULT_COMPONENT shared) ++endif () ++ ++#----------------------------------------------------------------------------- + # Configure the szip-config.cmake file for the build directory + #----------------------------------------------------------------------------- + set(INCLUDE_INSTALL_DIR ${SZIP_INSTALL_INCLUDE_DIR} ) +diff --git a/config/cmake/szip-config.cmake.in b/config/cmake/szip-config.cmake.in +index 4a7fec7..ad54287 100644 +--- a/config/cmake/szip-config.cmake.in ++++ b/config/cmake/szip-config.cmake.in +@@ -37,10 +37,10 @@ if (NOT TARGET "@SZIP_PACKAGE@") + include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) + endif () + +-# Handle default component(static) : ++# Handle default component(@SZIP_DEFAULT_COMPONENT@) : + if (NOT ${SZIP_PACKAGE_NAME}_FIND_COMPONENTS) +- set (${SZIP_PACKAGE_NAME}_FIND_COMPONENTS static) +- set (${SZIP_PACKAGE_NAME}_FIND_REQUIRED_static true) ++ set (${SZIP_PACKAGE_NAME}_FIND_COMPONENTS @SZIP_DEFAULT_COMPONENT@) ++ set (${SZIP_PACKAGE_NAME}_FIND_REQUIRED_@SZIP_DEFAULT_COMPONENT@ true) + endif () + + # Handle requested components: diff --git a/ports/szip/disable-static-lib-in-shared-build.patch b/ports/szip/disable-static-lib-in-shared-build.patch new file mode 100644 index 000000000..f06e6dcf6 --- /dev/null +++ b/ports/szip/disable-static-lib-in-shared-build.patch @@ -0,0 +1,39 @@ +--- a/src/CMakeLists.txt Mon Aug 03 17:10:33 2015 ++++ b/src/CMakeLists.txt Fri Jan 13 09:38:07 2017 +@@ -22,20 +22,22 @@ + ${SZIP_SRC_SOURCE_DIR}/szlib.h + ) + +-add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) +-#set_target_properties (${SZIP_LIB_TARGET} +-# PROPERTIES +-# LINK_FLAGS "-version-info 2:0:0" +-#) +-TARGET_C_PROPERTIES (${SZIP_LIB_TARGET} STATIC " " " ") +-target_link_libraries (${SZIP_LIB_TARGET} ${LINK_LIBS}) +-set_target_properties(${SZIP_LIB_TARGET} PROPERTIES +- PUBLIC_HEADER "${SZIP_PUBLIC_HEADERS}" +- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +-) +-set_global_variable (SZIP_LIBRARIES_TO_EXPORT ${SZIP_LIB_TARGET}) +-SZIP_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC) +-set (install_targets ${SZIP_LIB_TARGET}) ++if (NOT BUILD_SHARED_LIBS) ++ add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) ++ #set_target_properties (${SZIP_LIB_TARGET} ++ # PROPERTIES ++ # LINK_FLAGS "-version-info 2:0:0" ++ #) ++ TARGET_C_PROPERTIES (${SZIP_LIB_TARGET} STATIC " " " ") ++ target_link_libraries (${SZIP_LIB_TARGET} ${LINK_LIBS}) ++ set_target_properties(${SZIP_LIB_TARGET} PROPERTIES ++ PUBLIC_HEADER "${SZIP_PUBLIC_HEADERS}" ++ INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ++ ) ++ set_global_variable (SZIP_LIBRARIES_TO_EXPORT ${SZIP_LIB_TARGET}) ++ SZIP_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC) ++ set (install_targets ${SZIP_LIB_TARGET}) ++endif() + + if (BUILD_SHARED_LIBS) + add_library (${SZIP_LIBSH_TARGET} SHARED ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) diff --git a/ports/szip/portfile.cmake b/ports/szip/portfile.cmake new file mode 100644 index 000000000..957d91ea1 --- /dev/null +++ b/ports/szip/portfile.cmake @@ -0,0 +1,48 @@ +include(vcpkg_common_functions) + +# set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/szip-2.1) +# vcpkg_download_distfile(ARCHIVE +# URLS "https://support.hdfgroup.org/ftp/lib-external/szip/2.1/src/szip-2.1.tar.gz" +# FILENAME "szip-2.1.tar.gz" +# SHA512 ea91b877bb061fe6c96988a3c4b705e101a6950e34e9be53d6a57455c6a625be0afa60f4a3cfdd09649205b9f8586cc25ea60fe07a8131579acf3826b35fb749 +# ) +# vcpkg_extract_source_archive(${ARCHIVE}) + +# NOTE: We use Szip from the HDF5 cmake package dir, because it includes a lot of fixes for the CMake build files + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CMake-hdf5-1.10.0-patch1) +vcpkg_download_distfile(ARCHIVE + URLS "http://hdf4.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0-patch1/src/CMake-hdf5-1.10.0-patch1.zip" + FILENAME "CMake-hdf5-1.10.0-patch1.zip" + SHA512 ec2edb43438661323be5998ecf64c4dd537ddc7451e31f89390260d16883e60a1ccc1bf745bcb809af22f2bf7157d50331a33910b8ebf5c59cd50693dfb2ef8f +) +vcpkg_extract_source_archive(${ARCHIVE}) +set(ARCHIVE ${SOURCE_PATH}/SZip.tar.gz) +vcpkg_extract_source_archive(${ARCHIVE}) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/Szip) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/disable-static-lib-in-shared-build.patch + ${CMAKE_CURRENT_LIST_DIR}/default-component-shared.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DSZIP_INSTALL_DATA_DIR=share/szip/data + -DSZIP_INSTALL_CMAKE_DIR=share/szip +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(RENAME ${CURRENT_PACKAGES_DIR}/share/szip/data/COPYING ${CURRENT_PACKAGES_DIR}/share/szip/copyright) + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/szip/szip-targets-debug.cmake SZIP_TARGETS_DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" SZIP_TARGETS_DEBUG_MODULE "${SZIP_TARGETS_DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/szip/szip-targets-debug.cmake "${SZIP_TARGETS_DEBUG_MODULE}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/tiff/CONTROL b/ports/tiff/CONTROL index 65e3d37da..0c82029fb 100644 --- a/ports/tiff/CONTROL +++ b/ports/tiff/CONTROL @@ -1,4 +1,4 @@ Source: tiff -Version: 4.0.6-1 +Version: 4.0.6-2 Build-Depends: zlib Description: A library that supports the manipulation of TIFF image files
\ No newline at end of file diff --git a/ports/tiff/fix-uwp.patch b/ports/tiff/fix-uwp.patch new file mode 100644 index 000000000..6fce8d573 --- /dev/null +++ b/ports/tiff/fix-uwp.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 439e26a..05416d8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -187,6 +187,7 @@ endforeach(flag ${test_flags}) + + if(MSVC) + set(CMAKE_DEBUG_POSTFIX "d") ++ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) + endif() + + option(ld-version-script "Enable linker version script" ON) +diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c +index a0dc68b..3c4e101 100644 +--- a/libtiff/tif_dirread.c ++++ b/libtiff/tif_dirread.c +@@ -3690,7 +3690,7 @@ TIFFReadDirectory(TIFF* tif) + case TIFFTAG_SMAXSAMPLEVALUE: + { + +- double *data; ++ double *data = NULL; + enum TIFFReadDirEntryErr err; + uint32 saved_flags; + int m; diff --git a/ports/tiff/portfile.cmake b/ports/tiff/portfile.cmake index 345024fe0..281d681b9 100644 --- a/ports/tiff/portfile.cmake +++ b/ports/tiff/portfile.cmake @@ -10,6 +10,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-component-options.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-uwp.patch ) vcpkg_configure_cmake( diff --git a/ports/uvatlas/CONTROL b/ports/uvatlas/CONTROL new file mode 100644 index 000000000..7fad35659 --- /dev/null +++ b/ports/uvatlas/CONTROL @@ -0,0 +1,3 @@ +Source: uvatlas
+Version: sept2016
+Description: UVAtlas isochart texture atlas
\ No newline at end of file diff --git a/ports/uvatlas/portfile.cmake b/ports/uvatlas/portfile.cmake new file mode 100644 index 000000000..22b04326c --- /dev/null +++ b/ports/uvatlas/portfile.cmake @@ -0,0 +1,49 @@ +# 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}
+#
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ message(STATUS "Warning: Dynamic building not supported yet. Building static.")
+ set(VCPKG_LIBRARY_LINKAGE static)
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/UVAtlas-sept2016)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Microsoft/UVAtlas/archive/sept2016.tar.gz"
+ FILENAME "UVAtlas-sept2016.tar.gz"
+ SHA512 326af26c151620cd5082daf3913cf3fbe7bca7d1aaf5cc44cacff54319ffe79b728c24519187c3f9393a846430d0fb9493ffe9473f87d220f5c9ae7dab73f69f
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ SET(BUILD_ARCH "Win32")
+ELSE()
+ SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
+ENDIF()
+
+vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/UVAtlas/UVAtlas_2015.sln
+ PLATFORM ${BUILD_ARCH}
+)
+
+file(INSTALL
+ ${SOURCE_PATH}/UVAtlas/Inc/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(INSTALL
+ ${SOURCE_PATH}/UVAtlas/Bin/Desktop_2015/${BUILD_ARCH}/Release/UVAtlas.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+file(INSTALL
+ ${SOURCE_PATH}/UVAtlas/Bin/Desktop_2015/${BUILD_ARCH}/Debug/UVAtlas.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/MIT.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/uvatlas)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/uvatlas/MIT.txt ${CURRENT_PACKAGES_DIR}/share/uvatlas/copyright)
+
+message(STATUS "Installing done, uvatlastool.exe can be downloaded at: ")
+message(STATUS " https://github.com/Microsoft/UVAtlas/releases/download/sept2016/uvatlastool.exe")
\ No newline at end of file diff --git a/ports/uwebsockets/0001_cmake.patch b/ports/uwebsockets/0001_cmake.patch index f4004a5bb..f0879d659 100644 --- a/ports/uwebsockets/0001_cmake.patch +++ b/ports/uwebsockets/0001_cmake.patch @@ -1,22 +1,24 @@ +commit 2b244f92ddf5e58bf81ccb40a8f23a3f94d9941b +Author: Alexander Karatarakis <alkarata@microsoft.com> +Date: Tue Mar 7 17:13:52 2017 -0800 + + Fixes + diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1fadf72..6ee984d 100644 +index 33a8ae0..0b9c006 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -18,7 +18,11 @@ if(NOT LIBUV_INCLUDE_DIR) +@@ -12,7 +12,7 @@ if(NOT LIBUV_INCLUDE_DIR) find_path(LIBUV_INCLUDE_DIR uv.h) endif() if(NOT LIBUV_LIBRARY) - find_library(LIBUV_LIBRARY NAMES uv uv1) -+ if(WIN32) -+ find_library(LIBUV_LIBRARY NAMES libuv) -+ else() -+ find_library(LIBUV_LIBRARY NAMES uv uv1) -+ endif() ++ find_library(LIBUV_LIBRARY NAMES libuv uv uv1) endif() - add_library(uWS src/Extensions.cpp src/Group.cpp src/WebSocketImpl.cpp src/Networking.cpp src/Hub.cpp src/Node.cpp src/WebSocket.cpp src/HTTPSocket.cpp src/Socket.cpp) -@@ -38,4 +42,20 @@ install (TARGETS uWS DESTINATION /usr/lib64) - install (FILES src/Extensions.h src/WebSocketProtocol.h src/Networking.h src/WebSocket.h src/Hub.h src/Group.h src/Node.h src/Socket.h src/HTTPSocket.h src/uWS.h DESTINATION /usr/include/uWS) + add_library(uWS src/Extensions.cpp src/Group.cpp src/WebSocketImpl.cpp src/Networking.cpp src/Hub.cpp src/Node.cpp src/WebSocket.cpp src/HTTPSocket.cpp src/Socket.cpp src/uUV.cpp) +@@ -38,4 +38,20 @@ install (TARGETS uWS DESTINATION /usr/lib64) + install (FILES src/Extensions.h src/WebSocketProtocol.h src/Networking.h src/WebSocket.h src/Hub.h src/Group.h src/Node.h src/Socket.h src/HTTPSocket.h src/uWS.h src/uUV.h DESTINATION /usr/include/uWS) endif (UNIX) -add_subdirectory(examples) @@ -25,7 +27,7 @@ index 1fadf72..6ee984d 100644 +if(WIN32) + target_link_libraries (uWS PUBLIC psapi.lib iphlpapi.lib userenv.lib) + install (FILES src/Extensions.h src/WebSocketProtocol.h src/Networking.h src/WebSocket.h src/Hub.h src/Group.h src/Node.h src/Socket.h src/HTTPSocket.h src/uWS.h DESTINATION include/uWS) -+ ++ + if(BUILD_SHARED_LIBS) + target_link_libraries (uWS PUBLIC ws2_32.lib) + endif() @@ -37,4 +39,3 @@ index 1fadf72..6ee984d 100644 + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) -\ No newline at end of file
\ No newline at end of file diff --git a/ports/uwebsockets/portfile.cmake b/ports/uwebsockets/portfile.cmake index 881f35086..1049e761d 100644 --- a/ports/uwebsockets/portfile.cmake +++ b/ports/uwebsockets/portfile.cmake @@ -1,9 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/uwebsockets-0.12.0) +set(VERSION 0.13.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/uwebsockets-${VERSION}) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/uWebSockets/uWebSockets/archive/v0.12.0.zip" - FILENAME "uwebsockets-v0.12.0.zip" - SHA512 ea10682608d5f6c8b246f186dfc2f14f496858cc7e468880b96b111f10058daf529f1aa9662a851e21494dde9a4faadf2b9904483dac5350d0ca8736500cdda8 + URLS "https://github.com/uWebSockets/uWebSockets/archive/v${VERSION}.zip" + FILENAME "uwebsockets-v${VERSION}.zip" + SHA512 d3912296ed9e20900dc401e841238b84fe273e2e828500347d311948b8cb9dc3a08039b87f82d32a5844e39782201fe39641f336040a4a0493787760f1b5c618 ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/vtk/CONTROL b/ports/vtk/CONTROL new file mode 100644 index 000000000..d963451ce --- /dev/null +++ b/ports/vtk/CONTROL @@ -0,0 +1,4 @@ +Source: vtk +Version: 7.1.0 +Description: Software system for 3D computer graphics, image processing, and visualization +Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi diff --git a/ports/vtk/dont-define-ssize_t.patch b/ports/vtk/dont-define-ssize_t.patch new file mode 100644 index 000000000..ba9b5e605 --- /dev/null +++ b/ports/vtk/dont-define-ssize_t.patch @@ -0,0 +1,13 @@ +diff --git a/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in b/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in +index 0a19c41..0d92371 100644 +--- a/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in ++++ b/ThirdParty/netcdf/vtknetcdf/ncconfig.h.in +@@ -110,7 +110,7 @@ + #cmakedefine HAVE_LIBHDF5_HL + + /* Define to `int' if system doesn't define. */ +-#cmakedefine ssize_t @ssize_t@ ++/* #cmakedefine ssize_t @ssize_t@ */ + + /* Define to `int' if system doesn't define. */ + #cmakedefine ptrdiff_t @ptrdiff_t@ diff --git a/ports/vtk/netcdf-use-hdf5-definitions.patch b/ports/vtk/netcdf-use-hdf5-definitions.patch new file mode 100644 index 000000000..a6a3528ca --- /dev/null +++ b/ports/vtk/netcdf-use-hdf5-definitions.patch @@ -0,0 +1,10 @@ +--- a/ThirdParty/netcdf/vtknetcdf/CMakeLists.txt Mon Nov 14 17:59:47 2016 ++++ b/ThirdParty/netcdf/vtknetcdf/CMakeLists.txt Thu Jan 05 21:15:28 2017 +@@ -330,6 +330,7 @@ + ${netcdf_dispatch_SOURCES} + ${netcdf_liblib_SOURCES}) + target_link_libraries(vtkNetCDF ${vtkhdf5_LIBRARIES}) ++target_compile_definitions(vtkNetCDF PRIVATE ${vtkhdf5_DEFINITIONS}) + + if (UNIX) + # link against the math library. diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake new file mode 100644 index 000000000..611023a61 --- /dev/null +++ b/ports/vtk/portfile.cmake @@ -0,0 +1,90 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/VTK-7.1.0) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.vtk.org/files/release/7.1/VTK-7.1.0.tar.gz" + FILENAME "VTK-7.1.0.tar.gz" + SHA512 83f0c9291cd2bc517a4bc449ad28a1d77e7ece169e846c7beab0b1140b9ef4b7bad30e3fa6e5a59826a707df78e2e336e07fa8bd30cf7498096ee80feef16534 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/transfer-3rd-party-module-definitions.patch + ${CMAKE_CURRENT_LIST_DIR}/transfer-hdf5-definitions.patch + ${CMAKE_CURRENT_LIST_DIR}/netcdf-use-hdf5-definitions.patch + ${CMAKE_CURRENT_LIST_DIR}/dont-define-ssize_t.patch +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + # HACK: The FindHDF5.cmake script does not seem to detect the HDF5_DEFINITIONS correctly + # if HDF5 has been built without the tools (which is the case in the HDF5 port), + # so we set the BUILT_AS_DYNAMIC_LIB=1 flag here explicitly because we know HDF5 + # has been build as dynamic library in the current case. + list(APPEND ADDITIONAL_OPTIONS "-DHDF5_DEFINITIONS=-DH5_BUILT_AS_DYNAMIC_LIB=1") +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_TESTING=OFF + -DBUILD_EXAMPLES=OFF + -DVTK_Group_MPI=ON + -DVTK_Group_Qt=ON + -DVTK_QT_VERSION=5 + -DVTK_BUILD_QT_DESIGNER_PLUGIN=OFF + # -DVTK_WRAP_PYTHON=ON + # -DVTK_PYTHON_VERSION=3 + -DVTK_USE_SYSTEM_EXPAT=ON + -DVTK_USE_SYSTEM_FREETYPE=ON + # -DVTK_USE_SYSTEM_GL2PS=ON + -DVTK_USE_SYSTEM_GLEW=ON + -DVTK_USE_SYSTEM_HDF5=ON + -DVTK_USE_SYSTEM_JSONCPP=ON + # -DVTK_USE_SYSTEM_LIBPROJ4=ON + # -DVTK_USE_SYSTEM_LIBRARIES=ON + -DVTK_USE_SYSTEM_LIBXML2=ON + # -DVTK_USE_SYSTEM_NETCDF=ON + # -DVTK_USE_SYSTEM_OGGTHEORA=ON + -DVTK_USE_SYSTEM_PNG=ON + -DVTK_USE_SYSTEM_TIFF=ON + -DVTK_USE_SYSTEM_ZLIB=ON + -DVTK_INSTALL_DATA_DIR=share/vtk/data + -DVTK_INSTALL_DOC_DIR=share/vtk/doc + -DVTK_INSTALL_PACKAGE_DIR=share/vtk + -DVTK_FORBID_DOWNLOADS=ON + ${ADDITIONAL_OPTIONS} + OPTIONS_RELEASE + -DHDF5_C_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/hdf5.lib + -DHDF5_C_HL_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/hdf5_hl.lib + OPTIONS_DEBUG + -DHDF5_C_LIBRARY=${CURRENT_INSTALLED_DIR}/debug/lib/hdf5_D.lib + -DHDF5_C_HL_LIBRARY=${CURRENT_INSTALLED_DIR}/debug/lib/hdf5_hl_D.lib +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake VTK_TARGETS_RELEASE_MODULE) +string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" VTK_TARGETS_RELEASE_MODULE "${VTK_TARGETS_RELEASE_MODULE}") +string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" VTK_TARGETS_RELEASE_MODULE "${VTK_TARGETS_RELEASE_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake "${VTK_TARGETS_RELEASE_MODULE}") + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/vtk/VTKTargets-debug.cmake VTK_TARGETS_DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" VTK_TARGETS_DEBUG_MODULE "${VTK_TARGETS_DEBUG_MODULE}") +string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkEncodeString" VTK_TARGETS_DEBUG_MODULE "${VTK_TARGETS_DEBUG_MODULE}") +string(REPLACE "list\(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" "#list(APPEND _IMPORT_CHECK_FILES_FOR_vtkHashSource" VTK_TARGETS_DEBUG_MODULE "${VTK_TARGETS_DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake "${VTK_TARGETS_DEBUG_MODULE}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-7.1.exe) +file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-7.1.exe) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkEncodeString-7.1.exe) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkHashSource-7.1.exe) + +# Handle copyright +file(COPY ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/vtk/Copyright.txt ${CURRENT_PACKAGES_DIR}/share/vtk/copyright) diff --git a/ports/vtk/transfer-3rd-party-module-definitions.patch b/ports/vtk/transfer-3rd-party-module-definitions.patch new file mode 100644 index 000000000..7b402892f --- /dev/null +++ b/ports/vtk/transfer-3rd-party-module-definitions.patch @@ -0,0 +1,26 @@ +--- a/CMake/vtkModuleMacros.cmake Mon Nov 14 17:59:47 2016 ++++ b/CMake/vtkModuleMacros.cmake Thu Jan 05 21:36:06 2017 +@@ -665,6 +665,9 @@ + if(${dep}_LIBRARY_DIRS) + link_directories(${${dep}_LIBRARY_DIRS}) + endif() ++ if(${dep}_DEFINITIONS) ++ target_compile_definitions(${vtk-module} PRIVATE ${${dep}_DEFINITIONS}) ++ endif() + vtk_module_link_libraries(${vtk-module} LINK_PRIVATE ${${dep}_LIBRARIES}) + if(_help_vs7 AND ${dep}_LIBRARIES) + add_dependencies(${vtk-module} ${${dep}_LIBRARIES}) +@@ -870,6 +873,13 @@ + set(vtk${_lower}_LIBRARIES "${${_pkg}_LIBRARIES}") + else() + set(vtk${_lower}_LIBRARIES "${${_upper}_LIBRARIES}") ++ endif() ++ if(${_pkg}_DEFINITIONS) ++ set(vtk${_lower}_DEFINITIONS ${${_pkg}_DEFINITIONS}) ++ elseif(${_upper}_DEFINITIONS) ++ set(vtk${_lower}_DEFINITIONS ${${_upper}_DEFINITIONS}) ++ else() ++ set(vtk${_lower}_DEFINITIONS ${${_upper}_DEFINITIONS}) + endif() + + #a workaround for bad FindHDF5 behavior in which deb or opt can diff --git a/ports/vtk/transfer-hdf5-definitions.patch b/ports/vtk/transfer-hdf5-definitions.patch new file mode 100644 index 000000000..6184fdf7a --- /dev/null +++ b/ports/vtk/transfer-hdf5-definitions.patch @@ -0,0 +1,10 @@ +--- a/ThirdParty/hdf5/module.cmake Mon Nov 14 17:59:47 2016 ++++ b/ThirdParty/hdf5/module.cmake Thu Jan 05 21:23:20 2017 +@@ -5,6 +5,7 @@ + endif() + if(VTK_USE_SYSTEM_HDF5) + set(vtkhdf5_LIBRARIES ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}) ++ set(vtkhdf5_DEFINITIONS ${HDF5_DEFINITIONS}) + endif() + vtk_module(vtkhdf5 + EXCLUDE_FROM_WRAPPING diff --git a/ports/websocketpp/CONTROL b/ports/websocketpp/CONTROL new file mode 100644 index 000000000..f812dc565 --- /dev/null +++ b/ports/websocketpp/CONTROL @@ -0,0 +1,4 @@ +Source: websocketpp +Version: 0.7.0 +Build-Depends: zlib, openssl, boost +Description: Library that implements RFC6455 The WebSocket Protocol
\ No newline at end of file diff --git a/ports/websocketpp/portfile.cmake b/ports/websocketpp/portfile.cmake new file mode 100644 index 000000000..98a4d52e6 --- /dev/null +++ b/ports/websocketpp/portfile.cmake @@ -0,0 +1,24 @@ +#header-only library +include(vcpkg_common_functions) +set(VERSION "0.7.0") +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/websocketpp-${VERSION}) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/zaphoyd/websocketpp/archive/${VERSION}.zip" + FILENAME "websocketpp-${VERSION}.zip" + SHA512 0cfbc5ed7034758b3666b5154854287441ebeef8e18c4e5f39b62559d4f0e9dda63d79021243c447f57b9855209e1813aeb1c6c475fc98aa71ff03933fc7ac0c +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) + +# Put the license file where vcpkg expects it +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/websocketpp/) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/websocketpp/COPYING ${CURRENT_PACKAGES_DIR}/share/websocketpp/copyright) + +# Copy the header files +file(COPY "${SOURCE_PATH}/websocketpp" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN "*.hpp") + +set(INSTALL_INCLUDE_DIR "\${CMAKE_CURRENT_LIST_DIR}/../../include") +set(WEBSOCKETPP_VERSION ${VERSION}) +configure_file (${SOURCE_PATH}/websocketpp-config.cmake.in "${CURRENT_PACKAGES_DIR}/share/websocketpp/websocketpp-config.cmake" @ONLY) +configure_file (${SOURCE_PATH}/websocketpp-configVersion.cmake.in "${CURRENT_PACKAGES_DIR}/share/websocketpp/websocketpp-configVersion.cmake" @ONLY)
\ No newline at end of file diff --git a/ports/wt/CONTROL b/ports/wt/CONTROL index fc71d9aaf..d7ac2c535 100644 --- a/ports/wt/CONTROL +++ b/ports/wt/CONTROL @@ -1,4 +1,4 @@ Source: wt -Version: 3.3.6 +Version: 3.3.6-3 Description: Wt is a C++ library for developing web applications Build-Depends: boost, openssl diff --git a/ports/wt/add-disable-boost-autolink-option.patch b/ports/wt/add-disable-boost-autolink-option.patch new file mode 100644 index 000000000..57cb3ed99 --- /dev/null +++ b/ports/wt/add-disable-boost-autolink-option.patch @@ -0,0 +1,26 @@ +diff --git a/cmake/WtFindBoost-cmake.txt b/cmake/WtFindBoost-cmake.txt +index b66741f..377cede 100644 +--- a/cmake/WtFindBoost-cmake.txt ++++ b/cmake/WtFindBoost-cmake.txt +@@ -99,7 +99,7 @@ IF (Boost_FOUND) + SET(BOOST_WTHTTP_MT_FOUND TRUE) + SET(BOOST_WTHTTP_FOUND TRUE) + +- IF(MSVC) ++ IF(MSVC AND NOT DISABLE_BOOST_AUTOLINK) + # use autolink + SET(BOOST_WT_LIBRARIES "") + SET(BOOST_WTHTTP_LIBRARIES "") +diff --git a/src/wt/Dbo/CMakeLists.txt b/src/wt/Dbo/CMakeLists.txt +index 64d3af2..f9c31e0 100644 +--- a/src/wt/Dbo/CMakeLists.txt ++++ b/src/wt/Dbo/CMakeLists.txt +@@ -31,7 +31,7 @@ IF(ENABLE_LIBWTDBO) + StringStream.C + ) + +- IF(MSVC) ++ IF(MSVC AND NOT DISABLE_BOOST_AUTOLINK) + #win32 links automatically against boost libs; specifying too much causes + #trouble + IF(MULTI_THREADED_BUILD) diff --git a/ports/wt/portfile.cmake b/ports/wt/portfile.cmake index 66b1d5a33..7e2bdb47c 100644 --- a/ports/wt/portfile.cmake +++ b/ports/wt/portfile.cmake @@ -7,10 +7,19 @@ vcpkg_download_distfile(ARCHIVE_FILE SHA512 d6135713d300bcd3956a4fd673af73be0561eb5d6aa91c47255b966950ddb411217e6a826c1d11c0d941dbb6d006c9926231d7334b21de6256cca331066e18a6 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) +vcpkg_download_distfile(PATCH_FILE + URLS "https://github.com/emweb/wt/commit/b944cdc0961f683cd12fc6e60db3d0b328cd46dd.diff" + FILENAME "wt-fix-boost-1-63.diff" + SHA512 0766837ed8852da675b02b45bfbe7a6705ab20f67aa20849df4cc4b93b00dec0b73acea3568bca1046e203119445044c5ea06e33bac5d5d991f6a56b8fe282e1 +) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-disable-boost-autolink-option.patch + ${PATCH_FILE} +) -file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}) vcpkg_configure_cmake( -SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DSHARED_LIBS=ON -DENABLE_SSL=ON @@ -20,6 +29,8 @@ SOURCE_PATH ${SOURCE_PATH} -DENABLE_MYSQL=OFF -DENABLE_QT4=OFF -DBOOST_DYNAMIC=ON + -DDISABLE_BOOST_AUTOLINK=ON + -DENABLE_LIBWTTEST=OFF ) vcpkg_install_cmake() diff --git a/ports/xerces-c/CONTROL b/ports/xerces-c/CONTROL new file mode 100644 index 000000000..822c50387 --- /dev/null +++ b/ports/xerces-c/CONTROL @@ -0,0 +1,3 @@ +Source: xerces-c +Version: 3.1.4 +Description: Xerces-C++ is a XML parser, for parsing, generating, manipulating, and validating XML documents using the DOM, SAX, and SAX2 APIs. diff --git a/ports/xerces-c/portfile.cmake b/ports/xerces-c/portfile.cmake new file mode 100644 index 000000000..5543f80ed --- /dev/null +++ b/ports/xerces-c/portfile.cmake @@ -0,0 +1,40 @@ +# 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(vcpkg_common_functions) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/xerces-c-3.1.4) + +vcpkg_download_distfile(ARCHIVE + URLS "http://www-us.apache.org/dist//xerces/c/3/sources/xerces-c-3.1.4.zip" + FILENAME "xerces-c-3.1.4.zip" + SHA512 3ba1bf38875bda8a294990dba73143cfd6dbfa158b17f4db1fd0ee9a08a078af969103200eaf8957756f8363c8a661983cc95124b4978eb2162dc0344a85fff8 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +if (TRIPLET_SYSTEM_ARCH MATCHES "x86") + set(BUILD_ARCH "Win32") +else() + set(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) +endif() + + +vcpkg_build_msbuild( + #PROJECT_PATH ${SOURCE_PATH}/projects/Win32/VC14/xerces-all/xerces-all.sln + PROJECT_PATH ${SOURCE_PATH}/projects/Win32/VC14/xerces-all/xercesLib/xercesLib.vcxproj + PLATFORM ${BUILD_ARCH}) + + +file(COPY ${SOURCE_PATH}/src/xercesc DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.hpp) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xercesc/NLS) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/xercesc/util/MsgLoaders/ICU/resources) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/xerces-c) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/xerces-c/LICENSE ${CURRENT_PACKAGES_DIR}/share/xerces-c/copyright) diff --git a/ports/zeromq/CONTROL b/ports/zeromq/CONTROL index 8274ec0fd..6b82f310a 100644 --- a/ports/zeromq/CONTROL +++ b/ports/zeromq/CONTROL @@ -1,3 +1,3 @@ Source: zeromq -Version: 4.2.0 +Version: 4.2.2 Description: The ZeroMQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products diff --git a/ports/zeromq/portfile.cmake b/ports/zeromq/portfile.cmake index 9abd4ed74..a530598eb 100644 --- a/ports/zeromq/portfile.cmake +++ b/ports/zeromq/portfile.cmake @@ -1,9 +1,12 @@ +set(ZEROMQ_VERSION 4.2.2) +set(ZEROMQ_HASH 4069813374d4e8d4c0f8debbe85472d0bd24cf644fb1bce748920eadffb81c429d28f523ef424df84fcaa7082b984fab8da57192802585811d37cff066f4e40c) + include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/zeromq-4.2.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libzmq-${ZEROMQ_VERSION}) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/zeromq/libzmq/releases/download/v4.2.0/zeromq-4.2.0.tar.gz" - FILENAME "zeromq-4.2.0.tar.gz" - SHA512 3b6f0a1869fb1663ea40b3c3aa088b81399a35c051e4ade2b30bbac60bfceefe6b4403248a4635fb31d33767c1e478342f61c47b0ffdb4501419c13590ebeb96 + URLS "https://github.com/zeromq/libzmq/archive/v${ZEROMQ_VERSION}.tar.gz" + FILENAME "libzmq-${ZEROMQ_VERSION}.tar.gz" + SHA512 ${ZEROMQ_HASH} ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -14,42 +17,48 @@ else () set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH}) endif() +if(VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(MSVS_VERSION 2017) +else() + set(MSVS_VERSION 2015) +endif() + if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/builds/msvc/vs2015/libzmq/libzmq.vcxproj + PROJECT_PATH ${SOURCE_PATH}/builds/msvc/vs${MSVS_VERSION}/libzmq/libzmq.vcxproj RELEASE_CONFIGURATION ReleaseDLL DEBUG_CONFIGURATION DebugDLL ) file(INSTALL - ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/v140/dynamic/libzmq.dll + ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/${VCPKG_PLATFORM_TOOLSET}/dynamic/libzmq.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin ) file(INSTALL - ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/v140/dynamic/libzmq.dll + ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/${VCPKG_PLATFORM_TOOLSET}/dynamic/libzmq.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin ) file(INSTALL - ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/v140/dynamic/libzmq.lib + ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/${VCPKG_PLATFORM_TOOLSET}/dynamic/libzmq.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib ) file(INSTALL - ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/v140/dynamic/libzmq.lib + ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/${VCPKG_PLATFORM_TOOLSET}/dynamic/libzmq.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) vcpkg_copy_pdbs() else() vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/builds/msvc/vs2015/libzmq/libzmq.vcxproj + PROJECT_PATH ${SOURCE_PATH}/builds/msvc/vs${MSVS_VERSION}/libzmq/libzmq.vcxproj RELEASE_CONFIGURATION ReleaseLIB DEBUG_CONFIGURATION DebugLIB ) file(INSTALL - ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/v140/static/libzmq.lib + ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/${VCPKG_PLATFORM_TOOLSET}/static/libzmq.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib ) file(INSTALL - ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/v140/static/libzmq.lib + ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/${VCPKG_PLATFORM_TOOLSET}/static/libzmq.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) endif() diff --git a/ports/zlib/CONTROL b/ports/zlib/CONTROL index 482873480..def1ef6be 100644 --- a/ports/zlib/CONTROL +++ b/ports/zlib/CONTROL @@ -1,3 +1,3 @@ Source: zlib -Version: 1.2.8 +Version: 1.2.11 Description: A compression library
\ No newline at end of file diff --git a/ports/zlib/LICENSE b/ports/zlib/LICENSE index 9b2f94711..ca5fddfe0 100644 --- a/ports/zlib/LICENSE +++ b/ports/zlib/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/ports/zlib/portfile.cmake b/ports/zlib/portfile.cmake index ef891f685..0d53d9e89 100644 --- a/ports/zlib/portfile.cmake +++ b/ports/zlib/portfile.cmake @@ -1,9 +1,9 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/zlib-1.2.8) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/zlib-1.2.11) vcpkg_download_distfile(ARCHIVE_FILE - URLS "http://zlib.net/zlib128.zip" - FILENAME "zlib128.zip" - SHA512 b0d7e71eca9032910c56fc1de6adbdc4f915bdeafd9a114591fc05701893004ef3363add8ad0e576c956b6be158f2fc339ab393f2dd40e8cc8c2885d641d807b + URLS "http://www.zlib.net/zlib-1.2.11.tar.gz" "https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz" + FILENAME "zlib1211.tar.gz" + SHA512 73fd3fff4adeccd4894084c15ddac89890cd10ef105dd5e1835e1e9bbb6a49ff229713bd197d203edfa17c2727700fce65a2a235f07568212d820dca88b528ae ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index bcb570b39..fea05964b 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -23,7 +23,11 @@ if (!(Test-Path $vcpkgSourcesPath)) try{ pushd $vcpkgSourcesPath - cmd /c "$env:VS140COMNTOOLS..\..\VC\vcvarsall.bat" x86 "&" msbuild "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /m + $msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1 + $msbuildExe = $msbuildExeWithPlatformToolset[0] + $platformToolset = $msbuildExeWithPlatformToolset[1] + $windowsSDK = & $scriptsDir\getWindowsSDK.ps1 + & $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /p:TargetPlatformVersion=$windowsSDK /m dirs.proj Write-Verbose("Placing vcpkg.exe in the correct location") diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1 index ddb4a07f9..55680c1f6 100644 --- a/scripts/buildsystems/msbuild/applocal.ps1 +++ b/scripts/buildsystems/msbuild/applocal.ps1 @@ -2,11 +2,21 @@ param([string]$targetBinary, [string]$installedDir, [string]$tlogFile) function resolve($targetBinary) { - $targetBinaryPath = Resolve-Path $targetBinary + try + { + $targetBinaryPath = Resolve-Path $targetBinary -erroraction stop + } + catch [System.Management.Automation.ItemNotFoundException] + { + return + } $targetBinaryDir = Split-Path $targetBinaryPath -parent $a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" }) $a | % { + if ([string]::IsNullOrEmpty($_)) { + continue + } if (Test-Path "$installedDir\$_") { if (Test-Path "$targetBinaryDir\$_") { Write-Verbose "$_ is already present" diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index 0c748c1d6..d1d804e94 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -9,6 +9,16 @@ <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x86-uwp</VcpkgTriplet> </PropertyGroup> + <PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == '||'"> + <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x86-windows</VcpkgTriplet> + </PropertyGroup> + + <PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == '|Windows Store|10.0'"> + <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x86-uwp</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'x64||'"> <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x64-windows</VcpkgTriplet> @@ -41,18 +51,25 @@ </ClCompile> </ItemDefinitionGroup> + <Target Name="VcpkgTripletSelection" BeforeTargets="ClCompile"> + <Message Text="Using triplet "$(VcpkgTriplet)" from "$(VcpkgRoot)"" Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/> + <Message Text="Not using Vcpkg because VcpkgEnabled is "$(VcpkgEnabled)"" Importance="Normal" Condition="'$(VcpkgEnabled)' != 'true'"/> + </Target> + <Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup;RegisterOutput" Condition="'$(VcpkgEnabled)' == 'true'"> <WriteLinesToFile File="$(TLogLocation)$(ProjectName).write.1u.tlog" Lines="^$(OutputPath)$(TargetName).$(OutputType);" Encoding="Unicode"/> <Exec Condition="'$(VcpkgConfiguration)' == 'Debug'" Command="powershell.exe -ExecutionPolicy Unrestricted -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22" - ConsoleToMSBuild="true"> + ConsoleToMSBuild="true" + StandardOutputImportance="Normal"> <Output TaskParameter="ConsoleOutput" ItemName="ReferenceCopyLocalPaths" /> </Exec> <Exec Condition="'$(VcpkgConfiguration)' == 'Release'" Command="powershell.exe -ExecutionPolicy Unrestricted -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22" - ConsoleToMSBuild="true"> + ConsoleToMSBuild="true" + StandardOutputImportance="Normal"> <Output TaskParameter="ConsoleOutput" ItemName="ReferenceCopyLocalPaths" /> </Exec> </Target> diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 7be93e54d..e7b2b20db 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -57,6 +57,8 @@ if(NOT VCPKG_TOOLCHAIN) ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link ) + set(Boost_COMPILER "-vc140") + set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON) diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake new file mode 100644 index 000000000..20e249c8b --- /dev/null +++ b/scripts/cmake/vcpkg_acquire_msys.cmake @@ -0,0 +1,30 @@ +function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) + set(TOOLPATH ${DOWNLOADS}/tools/msys2) + set(TOOLSUBPATH msys32) + set(URL "https://sourceforge.net/projects/msys2/files/Base/i686/msys2-base-i686-20161025.tar.xz/download") + set(ARCHIVE "msys2-base-i686-20161025.tar.xz") + set(HASH c9260a38e0c6bf963adeaea098c4e376449c1dd0afe07480741d6583a1ac4c138951ccb0c5388bd148e04255a5c1a23bf5ee2d58dcd6607c14f1eaa5639a7c85) + + set(PATH_TO_ROOT ${TOOLPATH}/${TOOLSUBPATH}) + + if(NOT EXISTS "${TOOLPATH}/initialized-msys2.stamp") + message(STATUS "Acquiring MSYS2...") + file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE} + EXPECTED_HASH SHA512=${HASH} + ) + file(REMOVE_RECURSE ${TOOLPATH}) + file(MAKE_DIRECTORY ${TOOLPATH}) + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE} + WORKING_DIRECTORY ${TOOLPATH} + ) + execute_process( + COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin:\$PATH;pacman-key --init;pacman-key --populate" + WORKING_DIRECTORY ${TOOLPATH} + ) + file(WRITE "${TOOLPATH}/initialized-msys2.stamp" "0") + message(STATUS "Acquiring MSYS2... OK") + endif() + + set(${PATH_TO_ROOT_OUT} ${PATH_TO_ROOT} PARENT_SCOPE) +endfunction()
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index cd3026b6a..1ef138a1e 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -1,7 +1,28 @@ +#.rst: +# .. command:: vcpkg_apply_patches +# +# Apply a set of patches to a source tree. +# +# :: +# vcpkg_apply_patches(SOURCE_PATH <source_path> +# PATCHES patch1 [patch ...] +# ) +# +# ``SOURCE_PATH`` +# The source path in which apply the patches. +# ``PATCHES`` +# A list of patches that are applied to the source tree +# ``QUIET`` +# If this option is passed, the warning message when applyng +# a patch fails is not printed. This is convenient for patches +# that are known to fail even on a clean source tree, and for +# which the standard warning message would be confusing for the user. +# + function(vcpkg_apply_patches) - cmake_parse_arguments(_ap "" "SOURCE_PATH" "PATCHES" ${ARGN}) + cmake_parse_arguments(_ap "QUIET" "SOURCE_PATH" "PATCHES" ${ARGN}) - find_program(GIT git) + find_program(GIT NAMES git git.cmd) set(PATCHNUM 0) foreach(PATCH ${_ap_PATCHES}) message(STATUS "Applying patch ${PATCH}") @@ -14,7 +35,7 @@ function(vcpkg_apply_patches) RESULT_VARIABLE error_code ) - if(error_code) + if(error_code AND NOT ${_ap_QUIET}) message(STATUS "Applying patch failed. This is expected if this patch was previously applied.") endif() diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 8ba4b9fae..18e2a8b00 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -1,7 +1,31 @@ function(vcpkg_build_cmake) + cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) + + set(MSVC_EXTRA_ARGS + "/p:VCPkgLocalAppDataDisabled=true" + "/p:UseIntelMKL=No" + ) + + # Specifies the architecture of the toolset, NOT the architecture of the produced binary + # This can help libraries that cause the linker to run out of memory. + # https://support.microsoft.com/en-us/help/2891057/linker-fatal-error-lnk1102-out-of-memory + if (_bc_MSVC_64_TOOLSET) + list(APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64") + endif() + + if (NOT _bc_DISABLE_PARALLEL) + list(APPEND MSVC_EXTRA_ARGS "/m") + endif() + + if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) + set(BUILD_ARGS -v) # verbose output + else() + set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) + endif() + message(STATUS "Build ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release -- /p:VCPkgLocalAppDataDisabled=true /m + COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME build-${TARGET_TRIPLET}-rel ) @@ -9,7 +33,7 @@ function(vcpkg_build_cmake) message(STATUS "Build ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug -- /p:VCPkgLocalAppDataDisabled=true /m + COMMAND ${CMAKE_COMMAND} --build . --config Debug -- ${BUILD_ARGS} 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 df255c745..f4a809e7f 100644 --- a/scripts/cmake/vcpkg_build_msbuild.cmake +++ b/scripts/cmake/vcpkg_build_msbuild.cmake @@ -55,6 +55,7 @@ function(vcpkg_build_msbuild) /p:Configuration=${_csc_RELEASE_CONFIGURATION} /p:Platform=${_csc_PLATFORM} /p:VCPkgLocalAppDataDisabled=true + /p:UseIntelMKL=No /m WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME build-${TARGET_TRIPLET}-rel @@ -67,6 +68,7 @@ function(vcpkg_build_msbuild) /p:Configuration=${_csc_DEBUG_CONFIGURATION} /p:Platform=${_csc_PLATFORM} /p:VCPkgLocalAppDataDisabled=true + /p:UseIntelMKL=No /m WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME build-${TARGET_TRIPLET}-dbg diff --git a/scripts/cmake/vcpkg_build_qmake.cmake b/scripts/cmake/vcpkg_build_qmake.cmake new file mode 100644 index 000000000..263200423 --- /dev/null +++ b/scripts/cmake/vcpkg_build_qmake.cmake @@ -0,0 +1,36 @@ +#.rst: +# .. command:: vcpkg_build_qmake +# +# Build a qmake-based project, previously configured using vcpkg_configure_qmake . +# As the CONFIG qmake option is assumed to be "debug_and_release" (the default value on Windows, see [1]), +# both the debug and release libraries are build in the same build tree. +# +# :: +# vcpkg_build_qmake() +# +# +# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html + +function(vcpkg_build_qmake) + vcpkg_find_acquire_program("JOM") + + if(NOT JOM) + BUILD_ERROR("vcpkg_install_qmake: impossible to find jom.") + endif() + + # Make sure that the linker finds the libraries used + set(ENV_LIB_BACKUP ENV{LIB}) + set(ENV{LIB} "${CURRENT_INSTALLED_DIR}/lib;${CURRENT_INSTALLED_DIR}/debug/lib;$ENV{LIB}") + + message(STATUS "Package ${TARGET_TRIPLET}") + vcpkg_execute_required_process_repeat( + COUNT 2 + COMMAND ${JOM} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET} + LOGNAME package-${TARGET_TRIPLET} + ) + message(STATUS "Package ${TARGET_TRIPLET} done") + + # Restore the original value of ENV{LIB} + set(ENV{LIB} ENV_LIB_BACKUP) +endfunction() diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index f1bbdb9e3..a003548d5 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -1,3 +1,4 @@ +include(vcpkg_acquire_msys) include(vcpkg_download_distfile) include(vcpkg_extract_source_archive) include(vcpkg_execute_required_process) @@ -5,7 +6,15 @@ include(vcpkg_execute_required_process_repeat) include(vcpkg_find_acquire_program) include(vcpkg_build_cmake) include(vcpkg_build_msbuild) +include(vcpkg_build_qmake) include(vcpkg_install_cmake) +include(vcpkg_install_meson) include(vcpkg_configure_cmake) +include(vcpkg_configure_meson) +include(vcpkg_configure_qmake) include(vcpkg_apply_patches) include(vcpkg_copy_pdbs) +include(vcpkg_copy_tool_dependencies) +include(vcpkg_get_program_files_32_bit) +include(vcpkg_get_program_files_platform_bitness) +include(vcpkg_get_windows_sdk)
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 179703172..daf9dfd6f 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -1,23 +1,46 @@ -find_program(vcpkg_configure_cmake_NINJA ninja) function(vcpkg_configure_cmake) - cmake_parse_arguments(_csc "" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) + cmake_parse_arguments(_csc "PREFER_NINJA" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) + + if(NOT VCPKG_PLATFORM_TOOLSET) + message(FATAL_ERROR "Vcpkg has been updated with VS2017 support, however you need to rebuild vcpkg.exe by re-running bootstrap.ps1\n powershell -exec bypass scripts\\bootstrap.ps1\n") + endif() if(_csc_GENERATOR) set(GENERATOR ${_csc_GENERATOR}) - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86") + elseif(_csc_PREFER_NINJA AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(GENERATOR "Ninja") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 ARM") - # elseif(NOT vcpkg_configure_cmake_NINJA MATCHES "NOTFOUND") - # set(GENERATOR "Ninja") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") - set(GENERATOR "Visual Studio 14 2015 ARM") + set(GENERATOR "Visual Studio 14 2015 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 Win64") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 ARM") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 Win64") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") + set(GENERATOR "Visual Studio 15 2017 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + endif() + + # If we use Ninja, make sure it's on PATH + if(GENERATOR STREQUAL "Ninja") + vcpkg_find_acquire_program(NINJA) + get_filename_component(NINJA_PATH ${NINJA} DIRECTORY) + set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}") endif() file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) @@ -33,14 +56,18 @@ function(vcpkg_configure_cmake) elseif(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL static) list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=OFF) endif() - + list(APPEND _csc_OPTIONS - "-DCMAKE_CXX_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc" - "-DCMAKE_C_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8" + "-DCMAKE_CXX_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP" + "-DCMAKE_C_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /MP" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" + "-DBoost_COMPILER=-vc140" + "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" + "-DCMAKE_VERBOSE_MAKEFILE=ON" + "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TRIPLET_FILE}" ) if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic) list(APPEND _csc_OPTIONS_DEBUG @@ -71,9 +98,7 @@ function(vcpkg_configure_cmake) vcpkg_execute_required_process( COMMAND ${CMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE} -G ${GENERATOR} - -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release - -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 @@ -86,9 +111,7 @@ function(vcpkg_configure_cmake) vcpkg_execute_required_process( COMMAND ${CMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG} -G ${GENERATOR} - -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug - -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_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake new file mode 100644 index 000000000..277f91e11 --- /dev/null +++ b/scripts/cmake/vcpkg_configure_meson.cmake @@ -0,0 +1,72 @@ +function(vcpkg_configure_meson) + cmake_parse_arguments(_vcm "" "SOURCE_PATH" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) + + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + + # use the same compiler options as in vcpkg_configure_cmake + set(MESON_COMMON_CFLAGS "${MESON_COMMON_CFLAGS} /DWIN32 /D_WINDOWS /W3 /utf-8") + set(MESON_COMMON_CXXFLAGS "${MESON_COMMON_CXXFLAGS} /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc") + + if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + + set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Zi") + set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Zi") + elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static) + set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1") + set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1") + + set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Zi") + set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Zi") + endif() + + set(MESON_COMMON_LDFLAGS "${MESON_COMMON_LDFLAGS} /DEBUG") + set(MESON_RELEASE_LDFLAGS "${MESON_RELEASE_LDFLAGS} /INCREMENTAL:NO /OPT:REF /OPT:ICF") + + # select meson cmd-line options + list(APPEND _vcm_OPTIONS --buildtype plain --backend ninja) + if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + list(APPEND _vcm_OPTIONS --default-library shared) + else() + list(APPEND _vcm_OPTIONS --default-library static) + endif() + + list(APPEND _vcm_OPTIONS_DEBUG --prefix ${CURRENT_PACKAGES_DIR}/debug --includedir ../include) + list(APPEND _vcm_OPTIONS_RELEASE --prefix ${CURRENT_PACKAGES_DIR}) + + vcpkg_find_acquire_program(MESON) + vcpkg_find_acquire_program(NINJA) + get_filename_component(NINJA_PATH ${NINJA} DIRECTORY) + set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}") + + # configure release + message(STATUS "Configuring ${TARGET_TRIPLET}-rel") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_RELEASE_CFLAGS}") + set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_RELEASE_CXXFLAGS}") + set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_RELEASE_LDFLAGS}") + set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_RELEASE_CPPFLAGS}") + vcpkg_execute_required_process( + COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_RELEASE} ${_vcm_SOURCE_PATH} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME config-${TARGET_TRIPLET}-rel + ) + message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") + + # configure debug + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_DEBUG_CFLAGS}") + set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_DEBUG_CXXFLAGS}") + set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_DEBUG_LDFLAGS}") + set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_DEBUG_CPPFLAGS}") + vcpkg_execute_required_process( + COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_DEBUG} ${_vcm_SOURCE_PATH} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME config-${TARGET_TRIPLET}-dbg + ) + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") + +endfunction() diff --git a/scripts/cmake/vcpkg_configure_qmake.cmake b/scripts/cmake/vcpkg_configure_qmake.cmake new file mode 100644 index 000000000..f51a2f4fb --- /dev/null +++ b/scripts/cmake/vcpkg_configure_qmake.cmake @@ -0,0 +1,44 @@ +#.rst: +# .. command:: vcpkg_configure_qmake +# +# Configure a qmake-based project. +# It is assume that the qmake project CONFIG variable is +# "debug_and_release" (the default value on Windows, see [1]). +# Using this option, only one Makefile for building both Release and Debug +# libraries is generated, that then can be run using the vcpkg_install_qmake +# command. +# +# :: +# vcpkg_configure_qmake(SOURCE_PATH <pro_file_path> +# [OPTIONS arg1 [arg2 ...]] +# ) +# +# ``PROJECT_PATH`` +# The path to the *.pro qmake project file. +# ``OPTIONS`` +# The options passed to qmake. +# +# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html + +function(vcpkg_configure_qmake) + cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS" ${ARGN}) + + # Find qmake exectuable + find_program(QMAKE_COMMAND NAMES qmake) + + if(NOT QMAKE_COMMAND) + BUILD_ERROR("vcpkg_configure_qmake: impossible to find qmake.") + endif() + + # Cleanup build directories + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) + + message(STATUS "Configuring ${TARGET_TRIPLET}") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) + vcpkg_execute_required_process( + COMMAND ${QMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET} + LOGNAME config-${TARGET_TRIPLET} + ) + message(STATUS "Configuring ${TARGET_TRIPLET} done") +endfunction()
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_copy_pdbs.cmake b/scripts/cmake/vcpkg_copy_pdbs.cmake index 10cd1b2d3..61ad97728 100644 --- a/scripts/cmake/vcpkg_copy_pdbs.cmake +++ b/scripts/cmake/vcpkg_copy_pdbs.cmake @@ -13,6 +13,9 @@ function(vcpkg_copy_pdbs) set(DLLS_WITHOUT_MATCHING_PDBS) + set(PREVIOUS_VSLANG $ENV{VSLANG}) + set(ENV{VSLANG} 1033) + foreach(DLL ${DLLS}) execute_process(COMMAND dumpbin /PDBPATH ${DLL} COMMAND findstr PDB @@ -31,6 +34,8 @@ function(vcpkg_copy_pdbs) endif() endforeach() + set(ENV{VSLANG} ${PREVIOUS_VSLANG}) + list(LENGTH DLLS_WITHOUT_MATCHING_PDBS UNMATCHED_DLLS_LENGTH) if(UNMATCHED_DLLS_LENGTH GREATER 0) merge_filelist(MSG DLLS_WITHOUT_MATCHING_PDBS) diff --git a/scripts/cmake/vcpkg_copy_tool_dependencies.cmake b/scripts/cmake/vcpkg_copy_tool_dependencies.cmake new file mode 100644 index 000000000..432e3c12a --- /dev/null +++ b/scripts/cmake/vcpkg_copy_tool_dependencies.cmake @@ -0,0 +1,16 @@ +# Copy dlls for all tools in TOOL_DIR + +function(vcpkg_copy_tool_dependencies TOOL_DIR) + macro(search_for_dependencies PATH_TO_SEARCH) + file(GLOB TOOLS ${TOOL_DIR}/*.exe ${TOOL_DIR}/*.dll) + foreach(TOOL ${TOOLS}) + execute_process(COMMAND powershell -noprofile -executionpolicy UnRestricted -nologo + -file ${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/applocal.ps1 + -targetBinary ${TOOL} + -installedDir ${PATH_TO_SEARCH} + OUTPUT_VARIABLE OUT) + endforeach() + endmacro() + search_for_dependencies(${CURRENT_PACKAGES_DIR}/bin) + search_for_dependencies(${CURRENT_INSTALLED_DIR}/bin) +endfunction() diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index b192bc5d7..d6bd34b21 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -4,19 +4,24 @@ function(vcpkg_find_acquire_program VAR) endif() unset(NOEXTRACT) + unset(SUBDIR) + unset(REQUIRED_INTERPRETER) + + vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS) + vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT) if(VAR MATCHES "PERL") set(PROGNAME perl) 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 6e14e5580e52da5d35f29b67a52ef9db0e021af1575b4bbd84ebdbf18580522287890bdc21c0d21ddc1b2529d888f8e159dcaa017a3ff06d8fd23d16901bcc8b) + set(URL "http://strawberryperl.com/download/5.24.1.1/strawberry-perl-5.24.1.1-32bit-portable.zip") + set(ARCHIVE "strawberry-perl-5.24.1.1-32bit-portable.zip") + set(HASH a6e685ea24376f50db5f06c5b46075f1d3be25168fa1f27fa9b02e2ac017826cee62a2b43562f9b6c989337a231ba914416c110075457764de2d11f99d5e0f26) 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 cd80b540530d3995d15dc636e97673f1d34f471baadf1dac993165232c61efefe7f8ec10625f8f718fc89f0dd3dcb6a4595e0cf40c5fd7cbac1b71672b644d2d) + set(PATHS ${DOWNLOADS}/tools/nasm/nasm-2.12.02) + set(URL "http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/win32/nasm-2.12.02-win32.zip") + set(ARCHIVE "nasm-2.12.02-win32.zip") + set(HASH df7aaba094e17832688c88993997612a2e2c96cc3dc14ca3e8347b44c7762115f5a7fc6d7f20be402553aaa4c9e43ddfcf6228f581cfe89289bae550de151b36) elseif(VAR MATCHES "YASM") set(PROGNAME yasm) set(PATHS ${DOWNLOADS}/tools/yasm) @@ -27,9 +32,9 @@ function(vcpkg_find_acquire_program VAR) elseif(VAR MATCHES "PYTHON3") set(PROGNAME python) set(PATHS ${DOWNLOADS}/tools/python) - set(URL "https://www.python.org/ftp/python/3.5.2/python-3.5.2-embed-amd64.zip") - set(ARCHIVE "python-3.5.2-embed-amd64.zip") - set(HASH 48bdcb6f94c993acad6782ee33ad4a07a0ea3b9b1bfcdeadf446d459a9224336837e2e7b518d54d8d99c5c3f4e9f8877ea1789cae513fa2eda2a3cad9e4dfd8f) + set(URL "https://www.python.org/ftp/python/3.5.3/python-3.5.3-embed-win32.zip") + set(ARCHIVE "python-3.5.3-embed-win32.zip") + set(HASH c8cfdc09d052dc27e4380e8e4bf0d32a4c0def7e03896c1fa6cabc26dde78bb74dbb04e3673cc36e3e307d65a1ef284d69174f0cc80008c83bc6178f192ac5cf) elseif(VAR MATCHES "PYTHON2") find_program(PYTHON2 NAMES python2 python PATHS C:/python27 ENV PYTHON) if(NOT PYTHON2 MATCHES "NOTFOUND") @@ -46,39 +51,81 @@ function(vcpkg_find_acquire_program VAR) endif() endif() if(PYTHON2 MATCHES "NOTFOUND") - message(FATAL_ERROR "libuv uses the GYP build system, which requires Python 2.7.\n" - "Python 2.7 was not found in the path or by searching inside C:\\Python27.\n" + message(FATAL_ERROR "Python 2.7 was not found in the path or by searching inside C:\\Python27.\n" "There is no portable redistributable for Python 2.7, so you will need to install the MSI located at:\n" - " https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi\n" + " https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi\n" ) endif() elseif(VAR MATCHES "JOM") set(PROGNAME jom) - set(PATHS ${DOWNLOADS}/tools/jom) - set(URL "http://download.qt.io/official_releases/jom/jom_1_1_1.zip") - set(ARCHIVE "jom_1_1_1.zip") - set(HASH 23a26dc7e29979bec5dcd3bfcabf76397b93ace64f5d46f2254d6420158bac5eff1c1a8454e3427e7a2fe2c233c5f2cffc87b376772399e12e40b51be2c065f4) + set(SUBDIR "jom-1.1.2") + set(PATHS ${DOWNLOADS}/tools/jom/${SUBDIR}) + set(URL "http://download.qt.io/official_releases/jom/jom_1_1_2.zip") + set(ARCHIVE "jom_1_1_2.zip") + set(HASH 830cd94ed6518fbe4604a0f5a3322671b4674b87d25a71349c745500d38e85c0fac4f6995242fc5521eb048e3966bb5ec2a96a06b041343ed8da9bba78124f34) + elseif(VAR MATCHES "7Z") + set(PROGNAME 7z) + set(PATHS "${PROGRAM_FILES_PLATFORM_BITNESS}/7-Zip" "${PROGRAM_FILES_32_BIT}/7-Zip" ${DOWNLOADS}/tools/7z/Files/7-Zip) + set(URL "http://7-zip.org/a/7z1604.msi") + set(ARCHIVE "7z1604.msi") + set(HASH 556f95f7566fe23704d136239e4cf5e2a26f939ab43b44145c91b70d031a088d553e5c21301f1242a2295dcde3143b356211f0108c68e65eef8572407618326d) + elseif(VAR MATCHES "NINJA") + set(PROGNAME ninja) + set(SUBDIR "ninja-1.7.2") + set(PATHS ${DOWNLOADS}/tools/ninja/${SUBDIR}) + set(URL "https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip") + set(ARCHIVE "ninja-win.zip") + set(HASH cccab9281b274c564f9ad77a2115be1f19be67d7b2ee14a55d1db1b27f3b68db8e76076e4f804b61eb8e573e26a8ecc9985675a8dcf03fd7a77b7f57234f1393) + elseif(VAR MATCHES "MESON") + set(PROGNAME meson) + set(REQUIRED_INTERPRETER PYTHON3) + set(SCRIPTNAME meson.py) + set(PATHS ${DOWNLOADS}/tools/meson/meson-0.38.1) + set(URL "https://github.com/mesonbuild/meson/archive/0.38.1.zip") + set(ARCHIVE "meson-0.38.1.zip") + set(HASH 89642b1d976af7e29e9ca2b1a378510ce286ebd90a8234e898f3dd9dd7151538fdfc61fba770681605dad843b77b344fee94f992f18328655669d5f603c7fee5) else() message(FATAL "unknown tool ${VAR} -- unable to acquire.") endif() - find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) + macro(do_find) + if(NOT DEFINED REQUIRED_INTERPRETER) + find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) + else() + vcpkg_find_acquire_program(${REQUIRED_INTERPRETER}) + find_file(SCIRPT ${SCRIPTNAME} PATHS ${PATHS}) + set(${VAR} ${${REQUIRED_INTERPRETER}} ${SCIRPT}) + endif() + endmacro() + + do_find() if(${VAR} MATCHES "-NOTFOUND") file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE} EXPECTED_HASH SHA512=${HASH} SHOW_PROGRESS ) - file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}) + file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}) if(DEFINED NOEXTRACT) - file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}) + file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}) else() - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE} - WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME} - ) + get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT) + string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION) + if(${ARCHIVE_EXTENSION} STREQUAL ".msi") + file(TO_NATIVE_PATH "${DOWNLOADS}/${ARCHIVE}" ARCHIVE_NATIVE_PATH) + file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}" DESTINATION_NATIVE_PATH) + execute_process( + COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH} + WORKING_DIRECTORY ${DOWNLOADS} + ) + else() + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE} + WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR} + ) + endif() endif() - find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) + do_find() endif() set(${VAR} ${${VAR}} PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_get_program_files_32_bit.cmake b/scripts/cmake/vcpkg_get_program_files_32_bit.cmake new file mode 100644 index 000000000..6f4345473 --- /dev/null +++ b/scripts/cmake/vcpkg_get_program_files_32_bit.cmake @@ -0,0 +1,10 @@ +function(vcpkg_get_program_files_32_bit ret) + + set(ret_temp $ENV{ProgramFiles\(X86\)}) + if (NOT DEFINED ret_temp) + set(ret_temp $ENV{PROGRAMFILES}) + endif() + + set(${ret} ${ret_temp} PARENT_SCOPE) + +endfunction()
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake new file mode 100644 index 000000000..ed51b7401 --- /dev/null +++ b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake @@ -0,0 +1,10 @@ +function(vcpkg_get_program_files_platform_bitness ret) + + set(ret_temp $ENV{ProgramW6432}) + if (NOT DEFINED ret_temp) + set(ret_temp $ENV{PROGRAMFILES}) + endif() + + set(${ret} ${ret_temp} PARENT_SCOPE) + +endfunction()
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_get_windows_sdk.cmake b/scripts/cmake/vcpkg_get_windows_sdk.cmake new file mode 100644 index 000000000..7a8014eb2 --- /dev/null +++ b/scripts/cmake/vcpkg_get_windows_sdk.cmake @@ -0,0 +1,15 @@ +function(vcpkg_get_windows_sdk ret) + execute_process( + COMMAND powershell.exe -ExecutionPolicy Bypass ${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1 + OUTPUT_VARIABLE WINDOWS_SDK + RESULT_VARIABLE error_code) + + if (${error_code}) + message(FATAL_ERROR "Could not find Windows SDK") + endif() + + # Remove trailing newline + string(REGEX REPLACE "\n$" "" WINDOWS_SDK "${WINDOWS_SDK}") + + set(${ret} ${WINDOWS_SDK} PARENT_SCOPE) +endfunction()
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_install_cmake.cmake b/scripts/cmake/vcpkg_install_cmake.cmake index 30aff0fe1..0ebff6961 100644 --- a/scripts/cmake/vcpkg_install_cmake.cmake +++ b/scripts/cmake/vcpkg_install_cmake.cmake @@ -1,7 +1,31 @@ function(vcpkg_install_cmake) + cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) + + set(MSVC_EXTRA_ARGS + "/p:VCPkgLocalAppDataDisabled=true" + "/p:UseIntelMKL=No" + ) + + # Specifies the architecture of the toolset, NOT the architecture of the produced binary + # This can help libraries that cause the linker to run out of memory. + # https://support.microsoft.com/en-us/help/2891057/linker-fatal-error-lnk1102-out-of-memory + if (_bc_MSVC_64_TOOLSET) + list(APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64") + endif() + + if (NOT _bc_DISABLE_PARALLEL) + list(APPEND MSVC_EXTRA_ARGS "/m") + endif() + + if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) + set(BUILD_ARGS -v) # verbose output + else() + set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) + endif() + message(STATUS "Package ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release --target install -- /m + COMMAND ${CMAKE_COMMAND} --build . --config Release --target install -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME package-${TARGET_TRIPLET}-rel ) @@ -9,7 +33,7 @@ function(vcpkg_install_cmake) message(STATUS "Package ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug --target install -- /m + COMMAND ${CMAKE_COMMAND} --build . --config Debug --target install -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME package-${TARGET_TRIPLET}-dbg ) diff --git a/scripts/cmake/vcpkg_install_meson.cmake b/scripts/cmake/vcpkg_install_meson.cmake new file mode 100644 index 000000000..f6d49288c --- /dev/null +++ b/scripts/cmake/vcpkg_install_meson.cmake @@ -0,0 +1,23 @@ +function(vcpkg_install_meson) + + vcpkg_find_acquire_program(NINJA) + + unset(ENV{DESTDIR}) # installation directory was already specified with '--prefix' option + + message(STATUS "Package ${TARGET_TRIPLET}-rel") + vcpkg_execute_required_process( + COMMAND ${NINJA} install -v + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME package-${TARGET_TRIPLET}-rel + ) + message(STATUS "Package ${TARGET_TRIPLET}-rel done") + + message(STATUS "Package ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${NINJA} install -v + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME package-${TARGET_TRIPLET}-dbg + ) + message(STATUS "Package ${TARGET_TRIPLET}-dbg done") + +endfunction() diff --git a/scripts/doVcpkgRelease.ps1 b/scripts/doVcpkgRelease.ps1 deleted file mode 100644 index fb964d0c3..000000000 --- a/scripts/doVcpkgRelease.ps1 +++ /dev/null @@ -1,84 +0,0 @@ -[CmdletBinding()] -param( - -) -$ErrorActionPreference = "Stop" -$version = git show HEAD:toolsrc/VERSION.txt -#Remove the quotes from the string -$version = $version.Substring(1, $version.length - 2) -$versionRegex = '^\d+\.\d+\.\d+$' -if (!($version -match $versionRegex)) -{ - throw [System.ArgumentException] ("Expected version in the form d.d.d but was " + $version) -} - -Write-Verbose("New version is " + $version) -$gitTagString = "v$version" - -# Intentionally doesn't have ^ (=starts with) to match remote tags as well -$matchingTags = git tag | Where-Object {$_ -match "$gitTagString$"} -if ($matchingTags.Length -gt 0) -{ - throw [System.ArgumentException] ("Git tag matches existing tags: " + $matchingTags) -} - -$gitHash = git rev-parse HEAD -Write-Verbose("Git hash is " + $gitHash) - -$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition -$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root -$gitStartOfHash = $gitHash.substring(0,6) -$versionWithStartOfHash = "$version-$gitStartOfHash" -$buildPath = "$vcpkgRootDir\build-$versionWithStartOfHash" -$releasePath = "$vcpkgRootDir\release-$versionWithStartOfHash" -Write-Verbose("Build Path " + $buildPath) -Write-Verbose("Release Path " + $releasePath) - -# 0 is metrics disabled, 1 is metrics enabled -for ($disableMetrics = 0; $disableMetrics -le 1; $disableMetrics++) -{ - - if (!(Test-Path $buildPath)) - { - New-Item -ItemType directory -Path $buildPath -force | Out-Null - } - - if (!(Test-Path $releasePath)) - { - New-Item -ItemType directory -Path $releasePath -force | Out-Null - } - - # Partial checkout for building vcpkg - $dotGitDir = "$vcpkgRootDir\.git" - $workTreeForBuildOnly = "$buildPath" - $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 -- $checkoutForBuildOnly - git reset - - & "$buildPath\scripts\bootstrap.ps1" -disableMetrics $disableMetrics - - # Full checkout which will be a zip along with the executables from the previous step - $workTree = "$releasePath" - $checkoutThisDir = ".\" # Must be relative to the root of the repository - Write-Verbose("Creating temporary checkout: $releasePath") - git --git-dir=$dotGitDir --work-tree=$workTree checkout $gitHash -f -q -- $checkoutThisDir - git reset - - Copy-Item $buildPath\vcpkg.exe $releasePath\vcpkg.exe | Out-Null - Copy-Item $buildPath\scripts\vcpkgmetricsuploader.exe $releasePath\scripts\vcpkgmetricsuploader.exe | Out-Null - - Write-Verbose("Archiving") - $outputArchive = "$vcpkgRootDir\vcpkg-$versionWithStartOfHash.zip" - if ($disableMetrics -ne 0) - { - $outputArchive = "$vcpkgRootDir\vcpkg-$versionWithStartOfHash-external.zip" - } - Compress-Archive -Path "$releasePath\*" -CompressionLevel Optimal -DestinationPath $outputArchive -Force | Out-Null - - Write-Verbose("Removing temporary checkouts: $releasePath") - Remove-Item -recurse $buildPath | Out-Null - Remove-Item -recurse $releasePath | Out-Null - - Write-Verbose("Redistributable archive is: $outputArchive") -}
\ No newline at end of file diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 2f3d992ba..3c98f7247 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -1,9 +1,15 @@ [CmdletBinding()] param( - [string]$Dependency + [string]$Dependency, + [ValidateNotNullOrEmpty()] + [string]$downloadPromptOverride = "0" ) -Import-Module BitsTransfer +$downloadPromptOverride_NO_OVERRIDE= 0 +$downloadPromptOverride_DO_NOT_PROMPT = 1 +$downloadPromptOverride_ALWAYS_PROMPT = 2 + +Import-Module BitsTransfer -Verbose:$false $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root @@ -12,9 +18,13 @@ $downloadsDir = "$vcpkgRootDir\downloads" function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { - function promptForDownload([string]$title, [string]$message, [string]$yesDescription, [string]$noDescription) + function promptForDownload([string]$title, [string]$message, [string]$yesDescription, [string]$noDescription, [string]$downloadPromptOverride) { - if ((Test-Path "$downloadsDir\AlwaysAllowEverything") -Or (Test-Path "$downloadsDir\AlwaysAllowDownloads")) + $do_not_prompt = ($downloadPromptOverride -eq $downloadPromptOverride_DO_NOT_PROMPT) -Or + (Test-Path "$downloadsDir\AlwaysAllowEverything") -Or + (Test-Path "$downloadsDir\AlwaysAllowDownloads") + + if (($downloadPromptOverride -ne $downloadPromptOverride_ALWAYS_PROMPT) -And $do_not_prompt) { return $true } @@ -51,13 +61,13 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { return } - + $title = "Download " + $Dependency $message = ("No suitable version of " + $Dependency + " was found (requires $requiredVersion or higher). Download portable version?") $yesDescription = "Downloads " + $Dependency + " v" + $downloadVersion +" app-locally." - $noDescription = "Does not download " + $Dependency + "." - - $userAllowedDownload = promptForDownload $title $message $yesDescription $noDescription + $noDescription = "Does not download " + $Dependency + "." + + $userAllowedDownload = promptForDownload $title $message $yesDescription $noDescription $downloadPromptOverride if (!$userAllowedDownload) { throw [System.IO.FileNotFoundException] ("Could not detect suitable version of " + $Dependency + " and download not allowed") @@ -70,15 +80,29 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if ($Dependency -ne "git") # git fails with BITS { - Start-BitsTransfer -Source $url -Destination $downloadPath -ErrorAction SilentlyContinue + try { + $WC = New-Object System.Net.WebClient + $ProxyAuth = !$WC.Proxy.IsBypassed($url) + If($ProxyAuth){ + $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic") + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential",$ProxyCred) + } + + Start-BitsTransfer -Source $url -Destination $downloadPath -ErrorAction Stop + } + catch [System.Exception] { + # If BITS fails for any reason, delete any potentially partially downloaded files and continue + if (Test-Path $downloadPath) + { + Remove-Item $downloadPath + } + } } - else + if (!(Test-Path $downloadPath)) { - if (!(Test-Path $downloadPath)) - { - Write-Host("Downloading $Dependency...") - (New-Object System.Net.WebClient).DownloadFile($url, $downloadPath) - } + Write-Host("Downloading $Dependency...") + (New-Object System.Net.WebClient).DownloadFile($url, $downloadPath) } } @@ -86,10 +110,10 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $ExtractionType_NO_EXTRACTION_REQUIRED = 0 $ExtractionType_ZIP = 1 $ExtractionType_SELF_EXTRACTING_7Z = 2 - - + + # Using this to wait for the execution to finish - function Invoke-Command() + function Invoke-Command() { param ( [string]$program = $(throw "Please specify a program" ), [string]$argumentString = "", @@ -99,7 +123,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $psi.FileName = $program $psi.Arguments = $argumentString $proc = [Diagnostics.Process]::Start($psi) - if ( $waitForExit ) + if ( $waitForExit ) { $proc.WaitForExit(); } @@ -107,8 +131,11 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) function Expand-ZIPFile($file, $destination) { - Write-Host($file) - Write-Host($destination) + if (!(Test-Path $destination)) + { + New-Item -ItemType Directory -Path $destination | Out-Null + } + $shell = new-object -com shell.application $zip = $shell.NameSpace($file) foreach($item in $zip.items()) @@ -120,42 +147,49 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if($Dependency -eq "cmake") { - $requiredVersion = "3.5.0" - $downloadVersion = "3.5.2" - $url = "https://cmake.org/files/v3.5/cmake-3.5.2-win32-x86.zip" - $downloadName = "cmake-3.5.2-win32-x86.zip" - $expectedDownloadedFileHash = "671073aee66b3480a564d0736792e40570a11e861bb34819bb7ae7858bbdfb80" - $executableFromDownload = "$downloadsDir\cmake-3.5.2-win32-x86\bin\cmake.exe" + $requiredVersion = "3.8.0" + $downloadVersion = "3.8.0" + $url = "https://cmake.org/files/v3.8/cmake-3.8.0-rc1-win32-x86.zip" + $downloadPath = "$downloadsDir\cmake-3.8.0-rc1-win32-x86.zip" + $expectedDownloadedFileHash = "ccdbd92fbfb548aa35a545e4e45ff19fd6d13c88c90370acdf940c3cf464e9c9" + $executableFromDownload = "$downloadsDir\cmake-3.8.0-rc1-win32-x86\bin\cmake.exe" $extractionType = $ExtractionType_ZIP + $extractionFolder = $downloadsDir } elseif($Dependency -eq "nuget") { - $requiredVersion = "1.0.0" - $downloadVersion = "3.4.3" - $url = "https://dist.nuget.org/win-x86-commandline/v3.4.3/nuget.exe" - $downloadName = "nuget.exe" - $expectedDownloadedFileHash = "3B1EA72943968D7AF6BACDB4F2F3A048A25AFD14564EF1D8B1C041FDB09EBB0A" - $executableFromDownload = "$downloadsDir\nuget.exe" + $requiredVersion = "3.3.0" + $downloadVersion = "3.5.0" + $url = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe" + $downloadPath = "$downloadsDir\nuget-3.5.0\nuget.exe" + $expectedDownloadedFileHash = "399ec24c26ed54d6887cde61994bb3d1cada7956c1b19ff880f06f060c039918" + $executableFromDownload = $downloadPath $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED } elseif($Dependency -eq "git") { $requiredVersion = "2.0.0" - $downloadVersion = "2.8.3" - $url = "https://github.com/git-for-windows/git/releases/download/v2.8.3.windows.1/PortableGit-2.8.3-32-bit.7z.exe" # We choose the 32-bit version - $downloadName = "PortableGit-2.8.3-32-bit.7z.exe" - $expectedDownloadedFileHash = "DE52D070219E9C4EC1DB179F2ADBF4B760686C3180608F0382A1F8C7031E72AD" - # There is another copy of git.exe in PortableGit\bin. However, an installed version of git add the cmd dir to the PATH. - # Therefore, choosing the cmd dir here as well. - $executableFromDownload = "$downloadsDir\PortableGit\cmd\git.exe" - $extractionType = $ExtractionType_SELF_EXTRACTING_7Z + $downloadVersion = "2.11.1" + $url = "https://github.com/git-for-windows/git/releases/download/v2.11.1.windows.1/MinGit-2.11.1-32-bit.zip" # We choose the 32-bit version + $downloadPath = "$downloadsDir\MinGit-2.11.1-32-bit.zip" + $expectedDownloadedFileHash = "6ca79af09015625f350ef4ad74a75cfb001b340aec095b6963be9d45becb3bba" + # There is another copy of git.exe in MinGit\bin. However, an installed version of git add the cmd dir to the PATH. + # Therefore, choosing the cmd dir here as well. + $executableFromDownload = "$downloadsDir\MinGit-2.11.1-32-bit\cmd\git.exe" + $extractionType = $ExtractionType_ZIP + $extractionFolder = "$downloadsDir\MinGit-2.11.1-32-bit" } else { throw "Unknown program requested" } - $downloadPath = "$downloadsDir\$downloadName" + $downloadSubdir = Split-path $downloadPath -Parent + if (!(Test-Path $downloadSubdir)) + { + New-Item -ItemType Directory -Path $downloadSubdir | Out-Null + } + performDownload $Dependency $url $downloadsDir $downloadPath $downloadVersion $requiredVersion #calculating the hash @@ -177,8 +211,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { if (-not (Test-Path $executableFromDownload)) # consider renaming the extraction folder to make sure the extraction finished { - # Expand-Archive $downloadPath -dest "$downloadsDir" -Force # Requires powershell 5+ - Expand-ZIPFile -File $downloadPath -Destination $downloadsDir + # Expand-Archive $downloadPath -dest "$extractionFolder" -Force # Requires powershell 5+ + Expand-ZIPFile -File $downloadPath -Destination $extractionFolder } } elseif($extractionType -eq $ExtractionType_SELF_EXTRACTING_7Z) @@ -186,7 +220,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if (-not (Test-Path $executableFromDownload)) { Invoke-Command $downloadPath "-y" -waitForExit:$true - } + } } else { @@ -197,6 +231,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { throw [System.IO.FileNotFoundException] ("Could not detect or download " + $Dependency) } + + return $executableFromDownload } SelectProgram $Dependency
\ No newline at end of file diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 new file mode 100644 index 000000000..f1ef1ae6b --- /dev/null +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -0,0 +1,164 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory=$False)] + [switch]$DisableVS2017 = $False, + + [Parameter(Mandatory=$False)] + [switch]$DisableVS2015 = $False +) + +if ($DisableVS2017 -and $DisableVS2015) +{ + throw "Both VS2015 and VS2017 were disabled." +} + +function New-MSBuildInstance() +{ + param ($msbuildExePath, $toolsetVersion) + + $instance = new-object PSObject + $instance | add-member -type NoteProperty -Name msbuildExePath -Value $msbuildExePath + $instance | add-member -type NoteProperty -Name toolsetVersion -Value $toolsetVersion + + return $instance +} + +Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015" +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition + +$validInstances = New-Object System.Collections.ArrayList + +# VS2017 +Write-Verbose "`n`n" +Write-Verbose "Checking for MSBuild from VS2017 instances..." +$VisualStudio2017InstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1 +Write-Verbose "VS2017 Candidates: $([system.String]::Join(',', $VisualStudio2017InstallationInstances))" +foreach ($instanceCandidate in $VisualStudio2017InstallationInstances) +{ + $VCFolder= "$instanceCandidate\VC\Tools\MSVC\" + + if (Test-Path $VCFolder) + { + $instance = New-MSBuildInstance "$instanceCandidate\MSBuild\15.0\Bin\MSBuild.exe" "v141" + Write-Verbose "Found $instance" + $validInstances.Add($instance) > $null + } +} + +# VS2015 - in Program Files +Write-Verbose "`n`n" +Write-Verbose "Checking for MSBuild from VS2015 in Program Files..." +$CandidateProgramFiles = $(& $scriptsDir\getProgramFiles32bit.ps1), $(& $scriptsDir\getProgramFilesPlatformBitness.ps1) +Write-Verbose "Program Files Candidate locations: $([system.String]::Join(',', $CandidateProgramFiles))" +foreach ($ProgramFiles in $CandidateProgramFiles) +{ + $clExe= "$ProgramFiles\Microsoft Visual Studio 14.0\VC\bin\cl.exe" + + if (!(Test-Path $clExe)) + { + Write-Verbose "$clExe - Not Found" + continue + } + + Write-Verbose "$clExe - Found" + $instance = New-MSBuildInstance "$ProgramFiles\MSBuild\14.0\Bin\MSBuild.exe" "v140" + Write-Verbose "Found $instance" + $validInstances.Add($instance) > $null +} + +# VS2015 - through the registry +function NewCppRegistryPair() +{ + param ($visualStudioEntry, $msBuildEntry) + + $instance = new-object PSObject + $instance | add-member -type NoteProperty -Name visualStudioEntry -Value $visualStudioEntry + $instance | add-member -type NoteProperty -Name msBuildEntry -Value $msBuildEntry + + return $instance +} + +Write-Verbose "`n`n" +Write-Verbose "Checking for MSBuild from VS2015 through the registry..." + +$registryPairs = +$(NewCppRegistryPair "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\visualstudio\14.0" "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\msbuild\toolsversions\14.0"), +$(NewCppRegistryPair "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\visualstudio\14.0" "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\msbuild\toolsversions\14.0") + +foreach ($pair in $registryPairs) +{ + $vsEntry = $pair.visualStudioEntry + try + { + $VS14InstallDir = $(gp $vsEntry InstallDir -erroraction Stop | % { $_.InstallDir }) + Write-Verbose "$vsEntry - Found" + } + catch + { + Write-Verbose "$vsEntry - Not Found" + continue + } + + Write-Verbose "$VS14InstallDir - Obtained from registry" + # We want "${VS14InstallDir}..\..\VC\bin\cl.exe" + # Doing Split-path to avoid the ..\.. from appearing in the output + $clExePath = Split-path $VS14InstallDir -Parent + $clExePath = Split-path $clExePath -Parent + $clExePath = "$clExePath\VC\bin\cl.exe" + + if (!(Test-Path $clExePath)) + { + Write-Verbose "$clExePath - Not Found" + continue + } + + Write-Verbose "$clExePath - Found" + + $msbuildEntry = $pair.msBuildEntry + try + { + $MSBuild14 = $(gp $msbuildEntry MSBuildToolsPath -erroraction Stop | % { $_.MSBuildToolsPath }) + Write-Verbose "$msbuildEntry - Found" + } + catch + { + Write-Verbose "$msbuildEntry - Not Found" + continue + } + + Write-Verbose "${MSBuild14} - Obtained from registry" + $msbuildPath = "${MSBuild14}MSBuild.exe" + if (!(Test-Path $msbuildPath)) + { + Write-Verbose "$msbuildPath - Not Found" + continue + } + + $instance = New-MSBuildInstance $msbuildPath "v140" + Write-Verbose "Found $instance" + $validInstances.Add($instance) > $null +} + +Write-Verbose "`n`n`n" +Write-Verbose "The following MSBuild instances were found:" +foreach ($instance in $validInstances) +{ + Write-Verbose $instance +} + +# Selecting +foreach ($instance in $validInstances) +{ + if (!$DisableVS2017 -and $instance.toolsetVersion -eq "v141") + { + return $instance.msbuildExePath, $instance.toolsetVersion + } + + if (!$DisableVS2015 -and $instance.toolsetVersion -eq "v140") + { + return $instance.msbuildExePath, $instance.toolsetVersion + } +} + + +throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed."
\ No newline at end of file diff --git a/scripts/findFileRecursivelyUp.ps1 b/scripts/findFileRecursivelyUp.ps1 index 788adbf08..4b6409e8c 100644 --- a/scripts/findFileRecursivelyUp.ps1 +++ b/scripts/findFileRecursivelyUp.ps1 @@ -11,8 +11,8 @@ $currentDir = $startingDir while (!($currentDir -eq "") -and !(Test-Path "$currentDir\$filename")) { - Write-Verbose "Examining: $currentDir" + Write-Verbose "Examining $currentDir for $filename" $currentDir = Split-path $currentDir -Parent } -Write-Verbose "Found: $currentDir" +Write-Verbose "Examining $currentDir for $filename - Found" return $currentDir
\ No newline at end of file diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 new file mode 100644 index 000000000..0f685c6a9 --- /dev/null +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -0,0 +1,33 @@ +[CmdletBinding()] +param( + +) + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition +$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root + +$downloadsDir = "$vcpkgRootDir\downloads" + +$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" 1 +$nugetPackageDir = "$downloadsDir\nuget-packages" + +$SetupAPIVersion = "1.8.24" +$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Version $SetupAPIVersion -OutputDirectory $nugetPackageDir -Source "https://api.nuget.org/v3/index.json" -nocache 2>&1 + +$SetupConsoleExe = "$nugetPackageDir\Microsoft.VisualStudio.Setup.Configuration.Native.$SetupAPIVersion\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Console.exe" + +if (!(Test-Path $SetupConsoleExe)) +{ + throw $nugetOutput +} + +$instances = & $SetupConsoleExe -nologo -value InstallationPath 2>&1 +$instanceCount = $instances.Length + +# The last item can be empty +if ($instanceCount -gt 0 -and $instances[$instanceCount - 1] -eq "") +{ + $instances = $instances[0..($instanceCount - 2)] +} + +return $instances diff --git a/scripts/getProgramFiles32bit.ps1 b/scripts/getProgramFiles32bit.ps1 new file mode 100644 index 000000000..6b71915b1 --- /dev/null +++ b/scripts/getProgramFiles32bit.ps1 @@ -0,0 +1,17 @@ +[CmdletBinding()] +param( + +) + +$out = ${env:PROGRAMFILES(X86)} +if ($out -eq $null) +{ + $out = ${env:PROGRAMFILES} +} + +if ($out -eq $null) +{ + throw "Could not find [Program Files 32-bit]" +} + +return $out
\ No newline at end of file diff --git a/scripts/getProgramFilesPlatformBitness.ps1 b/scripts/getProgramFilesPlatformBitness.ps1 new file mode 100644 index 000000000..2be4c1137 --- /dev/null +++ b/scripts/getProgramFilesPlatformBitness.ps1 @@ -0,0 +1,17 @@ +[CmdletBinding()] +param( + +) + +$out = ${env:ProgramW6432} +if ($out -eq $null) +{ + $out = ${env:PROGRAMFILES} +} + +if ($out -eq $null) +{ + throw "Could not find [Program Files Platform Bitness]" +} + +return $out
\ No newline at end of file diff --git a/scripts/getWindowsSDK.ps1 b/scripts/getWindowsSDK.ps1 new file mode 100644 index 000000000..90ca1b06b --- /dev/null +++ b/scripts/getWindowsSDK.ps1 @@ -0,0 +1,94 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory=$False)] + [switch]$DisableWin10SDK = $False, + + [Parameter(Mandatory=$False)] + [switch]$DisableWin81SDK = $False +) + +if ($DisableWin10SDK -and $DisableWin81SDK) +{ + throw "Both Win10SDK and Win81SDK were disabled." +} + +Write-Verbose "Executing $($MyInvocation.MyCommand.Name)" +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition + +$validInstances = New-Object System.Collections.ArrayList + +$CandidateProgramFiles = $(& $scriptsDir\getProgramFiles32bit.ps1), $(& $scriptsDir\getProgramFilesPlatformBitness.ps1) +Write-Verbose "Program Files Candidate locations: $([system.String]::Join(',', $CandidateProgramFiles))" + +# Windows 10 SDK +Write-Verbose "`n" +Write-Verbose "Looking for Windows 10 SDK" +foreach ($ProgramFiles in $CandidateProgramFiles) +{ + $folder = "$ProgramFiles\Windows Kits\10\Include" + if (!(Test-Path $folder)) + { + Write-Verbose "$folder - Not Found" + continue + } + + Write-Verbose "$folder - Found" + $win10sdkVersions = @(Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object) + [array]::Reverse($win10sdkVersions) # Newest SDK first + + foreach ($win10sdkV in $win10sdkVersions) + { + $windowsheader = "$folder\$win10sdkV\um\windows.h" + if (!(Test-Path $windowsheader)) + { + Write-Verbose "$windowsheader - Not Found" + continue + } + + Write-Verbose "$windowsheader - Found" + $win10sdkVersionString = $win10sdkV.ToString() + Write-Verbose "Found $win10sdkVersionString" + $validInstances.Add($win10sdkVersionString) > $null + } +} + +# Windows 8.1 SDK +Write-Verbose "`n" +Write-Verbose "Looking for Windows 8.1 SDK" +foreach ($ProgramFiles in $CandidateProgramFiles) +{ + $folder = "$ProgramFiles\Windows Kits\8.1\Include" + if (!(Test-Path $folder)) + { + Write-Verbose "$folder - Not Found" + continue + } + + Write-Verbose "$folder - Found" + $win81sdkVersionString = "8.1" + Write-Verbose "Found $win81sdkVersionString" + $validInstances.Add($win81sdkVersionString) > $null +} + +Write-Verbose "`n`n`n" +Write-Verbose "The following Windows SDKs were found:" +foreach ($instance in $validInstances) +{ + Write-Verbose $instance +} + +# Selecting +foreach ($instance in $validInstances) +{ + if (!$DisableWin10SDK -and $instance -match "10.") + { + return $instance + } + + if (!$DisableWin81SDK -and $instance -match "8.1") + { + return $instance + } +} + +throw "Could not detect a Windows SDK / TargetPlatformVersion"
\ No newline at end of file diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 4e28cbb67..e83b83d88 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -74,7 +74,17 @@ if(CMD MATCHES "^BUILD$") set(BUILD_INFO_FILE_PATH ${CURRENT_PACKAGES_DIR}/BUILD_INFO) file(WRITE ${BUILD_INFO_FILE_PATH} "CRTLinkage: ${VCPKG_CRT_LINKAGE}\n") - file(APPEND ${BUILD_INFO_FILE_PATH} "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}") + file(APPEND ${BUILD_INFO_FILE_PATH} "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}\n") + + if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_LIBS) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutLIBs: ${VCPKG_POLICY_DLLS_WITHOUT_LIBS}\n") + endif() + if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n") + endif() + if (DEFINED VCPKG_POLICY_ONLY_RELEASE_CRT) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyOnlyReleaseCRT: ${VCPKG_POLICY_ONLY_RELEASE_CRT}\n") + endif() elseif(CMD MATCHES "^CREATE$") file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR) file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS) diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake index c848b6445..ef72431ff 100644 --- a/scripts/templates/portfile.in.cmake +++ b/scripts/templates/portfile.in.cmake @@ -17,6 +17,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 # OPTIONS_RELEASE -DOPTIMIZE=1 # OPTIONS_DEBUG -DDEBUGGABLE=1 diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 1c65f15d9..efe1fb7ee 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.65"
\ No newline at end of file +"0.0.76"
\ No newline at end of file diff --git a/toolsrc/dirs.proj b/toolsrc/dirs.proj new file mode 100644 index 000000000..17d9fa1b0 --- /dev/null +++ b/toolsrc/dirs.proj @@ -0,0 +1,20 @@ +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir> + </PropertyGroup> + <ItemGroup> + <ProjectFile Include="vcpkg\vcpkg.vcxproj"/> + <ProjectFile Include="vcpkglib\vcpkglib.vcxproj"/> + <ProjectFile Include="vcpkgmetricsuploader\vcpkgmetricsuploader.vcxproj"/> + </ItemGroup> + + <Target Name="Rebuild" DependsOnTargets="Clean;Build" /> + + <Target Name="Build"> + <MSBuild Projects="@(ProjectFile)" Properties="SolutionDir=$(SolutionDir)" Targets="Build"/> + </Target> + + <Target Name="Clean"> + <MSBuild Projects="@(ProjectFile)" Properties="SolutionDir=$(SolutionDir)" Targets="Clean"/> + </Target> +</Project>
\ No newline at end of file diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h deleted file mode 100644 index 49811d521..000000000 --- a/toolsrc/include/BuildInfo.h +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once - -#include <unordered_map> -#include "Paragraphs.h" -#include <regex> - -namespace vcpkg { namespace PostBuildLint -{ - enum class LinkageType - { - DYNAMIC, - STATIC, - UNKNOWN - }; - - LinkageType linkage_type_value_of(const std::string& as_string); - - std::string to_string(const LinkageType& build_info); - - enum class ConfigurationType - { - DEBUG = 1, - RELEASE = 2 - }; - - std::string to_string(const ConfigurationType& conf); - - struct BuildType - { - static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage); - - static const BuildType DEBUG_STATIC; - static const BuildType DEBUG_DYNAMIC; - static const BuildType RELEASE_STATIC; - static const BuildType RELEASE_DYNAMIC; - - static const std::vector<BuildType>& values() - { - static const std::vector<BuildType> v = {DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC}; - return v; - } - - BuildType() = delete; - - const ConfigurationType& config() const; - const LinkageType& linkage() const; - std::regex crt_regex() const; - std::string toString() const; - - private: - BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string) - : m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string) - { - } - - ConfigurationType m_config; - LinkageType m_linkage; - std::string m_crt_regex_as_string; - }; - - bool operator ==(const BuildType& lhs, const BuildType& rhs); - - bool operator !=(const BuildType& lhs, const BuildType& rhs); - - struct OutdatedDynamicCrt - { - // Old CPP - static const OutdatedDynamicCrt MSVCP100_DLL; - static const OutdatedDynamicCrt MSVCP100D_DLL; - static const OutdatedDynamicCrt MSVCP110_DLL; - static const OutdatedDynamicCrt MSVCP110_WIN_DLL; - static const OutdatedDynamicCrt MSVCP120_DLL; - static const OutdatedDynamicCrt MSVCP120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCP60_DLL; - static const OutdatedDynamicCrt MSVCP_WIN_DLL; - - // Old C - static const OutdatedDynamicCrt MSVCR100_DLL; - static const OutdatedDynamicCrt MSVCR100D_DLL; - static const OutdatedDynamicCrt MSVCR100_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCR110_DLL; - static const OutdatedDynamicCrt MSVCR120_DLL; - static const OutdatedDynamicCrt MSVCR120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCRT_DLL; - static const OutdatedDynamicCrt MSVCRT20_DLL; - static const OutdatedDynamicCrt MSVCRT40_DLL; - - static const std::vector<OutdatedDynamicCrt>& values() - { - static const std::vector<OutdatedDynamicCrt> v = { - MSVCP100_DLL, MSVCP100D_DLL, - MSVCP110_DLL,MSVCP110_WIN_DLL, - MSVCP120_DLL, MSVCP120_CLR0400_DLL, - MSVCP60_DLL, - MSVCP_WIN_DLL, - - MSVCR100_DLL, MSVCR100D_DLL, MSVCR100_CLR0400_DLL, - MSVCR110_DLL, - MSVCR120_DLL, MSVCR120_CLR0400_DLL, - MSVCRT_DLL, MSVCRT20_DLL,MSVCRT40_DLL - }; - return v; - } - - OutdatedDynamicCrt() = delete; - - std::regex crt_regex() const; - const std::string& toString() const; - - private: - explicit OutdatedDynamicCrt(const std::string& dll_name, const std::string& crt_regex_as_string) - : m_dll_name(dll_name), m_crt_regex_as_string(crt_regex_as_string) - { - } - - std::string m_dll_name; - std::string m_crt_regex_as_string; - }; - - struct BuildInfo - { - static BuildInfo create(const std::unordered_map<std::string, std::string>& pgh); - - std::string crt_linkage; - std::string library_linkage; - }; - - BuildInfo read_build_info(const fs::path& filepath); -}} diff --git a/toolsrc/include/ImmutableSortedVector.h b/toolsrc/include/ImmutableSortedVector.h new file mode 100644 index 000000000..681f9fd4d --- /dev/null +++ b/toolsrc/include/ImmutableSortedVector.h @@ -0,0 +1,48 @@ +#pragma once + +#include <vector> +#include <algorithm> + +// Add more forwarding functions to the delegate std::vector as needed. +namespace vcpkg +{ + template <class T> + class ImmutableSortedVector + { + public: + static ImmutableSortedVector<T> create(std::vector<T> vector) + { + ImmutableSortedVector out; + out.delegate = std::move(vector); + if (!std::is_sorted(out.delegate.cbegin(), out.delegate.cend())) + { + std::sort(out.delegate.begin(), out.delegate.end()); + } + + return out; + } + + typename std::vector<T>::const_iterator begin() const + { + return this->delegate.cbegin(); + } + + typename std::vector<T>::const_iterator end() const + { + return this->delegate.cend(); + } + + typename std::vector<T>::const_iterator cbegin() const + { + return this->delegate.cbegin(); + } + + typename std::vector<T>::const_iterator cend() const + { + return this->delegate.cend(); + } + + private: + std::vector<T> delegate; + }; +} diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 9e9fafe49..79b66a67f 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -1,10 +1,21 @@ #pragma once #include "filesystem_fs.h" -#include <unordered_map> +#include <map> +#include "expected.h" +#include "BinaryParagraph.h" +#include "vcpkg_paths.h" -namespace vcpkg { namespace Paragraphs +namespace vcpkg::Paragraphs { std::vector<std::unordered_map<std::string, std::string>> get_paragraphs(const fs::path& control_path); std::vector<std::unordered_map<std::string, std::string>> parse_paragraphs(const std::string& str); -}} + + expected<SourceParagraph> try_load_port(const fs::path& control_path); + + expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); + + std::vector<SourceParagraph> load_all_ports(const fs::path& ports_dir); + + std::map<std::string, std::string> extract_port_names_and_versions(const std::vector<SourceParagraph>& source_paragraphs); +} diff --git a/toolsrc/include/PostBuildLint.h b/toolsrc/include/PostBuildLint.h new file mode 100644 index 000000000..73c8ec54b --- /dev/null +++ b/toolsrc/include/PostBuildLint.h @@ -0,0 +1,8 @@ +#pragma once +#include "package_spec.h" +#include "vcpkg_paths.h" + +namespace vcpkg::PostBuildLint +{ + size_t perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); +} diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h new file mode 100644 index 000000000..bac024e01 --- /dev/null +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -0,0 +1,21 @@ +#pragma once + +#include "filesystem_fs.h" +#include "PostBuildLint_BuildPolicies.h" +#include "opt_bool.h" +#include "PostBuildLint_LinkageType.h" + +namespace vcpkg::PostBuildLint +{ + struct BuildInfo + { + static BuildInfo create(std::unordered_map<std::string, std::string> pgh); + + LinkageType::type crt_linkage; + LinkageType::type library_linkage; + + std::map<BuildPolicies::type, opt_bool_t> policies; + }; + + BuildInfo read_build_info(const fs::path& filepath); +} diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h new file mode 100644 index 000000000..d815c6d27 --- /dev/null +++ b/toolsrc/include/PostBuildLint_BuildPolicies.h @@ -0,0 +1,38 @@ +#pragma once +#include <string> +#include <array> + +namespace vcpkg::PostBuildLint::BuildPolicies +{ + enum class backing_enum_t + { + NULLVALUE = 0, + EMPTY_PACKAGE, + DLLS_WITHOUT_LIBS, + ONLY_RELEASE_CRT + }; + + struct type + { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } + + const std::string& toString() const; + const std::string& cmake_variable() const; + + private: + backing_enum_t backing_enum; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildPolicies"; + + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); + static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE); + static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); + static constexpr type ONLY_RELEASE_CRT(backing_enum_t::ONLY_RELEASE_CRT); + + static constexpr std::array<type, 3> values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS, ONLY_RELEASE_CRT }; + + type parse(const std::string& s); +} diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/PostBuildLint_BuildType.h new file mode 100644 index 000000000..31fbb11c9 --- /dev/null +++ b/toolsrc/include/PostBuildLint_BuildType.h @@ -0,0 +1,47 @@ +#pragma once +#include "PostBuildLint_ConfigurationType.h" +#include "PostBuildLint_LinkageType.h" +#include <array> +#include <regex> + +namespace vcpkg::PostBuildLint::BuildType +{ + enum class backing_enum_t + { + DEBUG_STATIC = 1, + DEBUG_DYNAMIC, + RELEASE_STATIC, + RELEASE_DYNAMIC + }; + + struct type + { + type() = delete; + + constexpr explicit type(const backing_enum_t backing_enum, const ConfigurationType::type config, const LinkageType::type linkage) : + backing_enum(backing_enum), m_config(config), m_linkage(linkage) { } + + constexpr operator backing_enum_t() const { return backing_enum; } + + const ConfigurationType::type& config() const; + const LinkageType::type& linkage() const; + const std::regex& crt_regex() const; + const std::string& toString() const; + + private: + backing_enum_t backing_enum; + ConfigurationType::type m_config; + LinkageType::type m_linkage; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildType"; + + static constexpr type DEBUG_STATIC = type(backing_enum_t::DEBUG_STATIC, ConfigurationType::DEBUG, LinkageType::STATIC); + static constexpr type DEBUG_DYNAMIC = type(backing_enum_t::DEBUG_DYNAMIC, ConfigurationType::DEBUG, LinkageType::DYNAMIC); + static constexpr type RELEASE_STATIC = type(backing_enum_t::RELEASE_STATIC, ConfigurationType::RELEASE, LinkageType::STATIC); + static constexpr type RELEASE_DYNAMIC = type(backing_enum_t::RELEASE_DYNAMIC, ConfigurationType::RELEASE, LinkageType::DYNAMIC); + + static constexpr std::array<type, 4> values = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC }; + + type value_of(const ConfigurationType::type& config, const LinkageType::type& linkage); +} diff --git a/toolsrc/include/PostBuildLint_ConfigurationType.h b/toolsrc/include/PostBuildLint_ConfigurationType.h new file mode 100644 index 000000000..7245d2932 --- /dev/null +++ b/toolsrc/include/PostBuildLint_ConfigurationType.h @@ -0,0 +1,33 @@ +#pragma once +#pragma once +#include <string> + +namespace vcpkg::PostBuildLint::ConfigurationType +{ + enum class backing_enum_t + { + NULLVALUE = 0, + DEBUG = 1, + RELEASE = 2 + }; + + struct type + { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } + + const std::string& toString() const; + + private: + backing_enum_t backing_enum; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::ConfigurationType"; + + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); + static constexpr type DEBUG(backing_enum_t::DEBUG); + static constexpr type RELEASE(backing_enum_t::RELEASE); + + static constexpr std::array<type, 2> values = { DEBUG, RELEASE }; +} diff --git a/toolsrc/include/PostBuildLint_LinkageType.h b/toolsrc/include/PostBuildLint_LinkageType.h new file mode 100644 index 000000000..0cecc8c9f --- /dev/null +++ b/toolsrc/include/PostBuildLint_LinkageType.h @@ -0,0 +1,34 @@ +#pragma once +#include <string> + +namespace vcpkg::PostBuildLint::LinkageType +{ + enum class backing_enum_t + { + NULLVALUE = 0, + DYNAMIC, + STATIC + }; + + struct type + { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } + + const std::string& toString() const; + + private: + backing_enum_t backing_enum; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::LinkageType"; + + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); + static constexpr type DYNAMIC(backing_enum_t::DYNAMIC); + static constexpr type STATIC(backing_enum_t::STATIC); + + static constexpr std::array<type, 2> values = { DYNAMIC, STATIC }; + + type value_of(const std::string& as_string); +} diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h index 7a0f2177d..3c5d35183 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/StatusParagraphs.h @@ -1,6 +1,7 @@ #pragma once #include "StatusParagraph.h" #include <memory> +#include <iterator> namespace vcpkg { @@ -19,28 +20,28 @@ namespace vcpkg } const_iterator find(const std::string& name, const triplet& target_triplet) const; iterator find(const std::string& name, const triplet& target_triplet); - iterator find_installed(const std::string& name, const triplet& target_triplet); + const_iterator find_installed(const std::string& name, const triplet& target_triplet) const; iterator insert(std::unique_ptr<StatusParagraph>); friend std::ostream& operator<<(std::ostream&, const StatusParagraphs&); - auto end() + iterator end() { return paragraphs.rend(); } - auto end() const + const_iterator end() const { return paragraphs.rend(); } - auto begin() + iterator begin() { return paragraphs.rbegin(); } - auto begin() const + const_iterator begin() const { return paragraphs.rbegin(); } diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/Stopwatch.h deleted file mode 100644 index 105a4b1ee..000000000 --- a/toolsrc/include/Stopwatch.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include <chrono> -#include <string> - -namespace vcpkg -{ - class Stopwatch - { - public: - static Stopwatch createUnstarted(); - - static Stopwatch createStarted(); - - bool isRunning() const; - - const Stopwatch& start(); - - const Stopwatch& stop(); - - Stopwatch& reset(); - - template <class TimeUnit> - TimeUnit elapsed() const - { - return std::chrono::duration_cast<TimeUnit>(elapsedNanos()); - } - - std::string toString() const; - - private: - Stopwatch(); - - std::chrono::nanoseconds elapsedNanos() const; - - bool m_isRunning; - std::chrono::nanoseconds m_elapsedNanos; - std::chrono::steady_clock::time_point m_startTick; - }; -} diff --git a/toolsrc/include/coff_file_reader.h b/toolsrc/include/coff_file_reader.h index edf6910a5..24fbf4576 100644 --- a/toolsrc/include/coff_file_reader.h +++ b/toolsrc/include/coff_file_reader.h @@ -3,7 +3,7 @@ #include "MachineType.h" #include "filesystem_fs.h" -namespace vcpkg {namespace COFFFileReader +namespace vcpkg::COFFFileReader { struct dll_info { @@ -18,4 +18,4 @@ namespace vcpkg {namespace COFFFileReader dll_info read_dll(const fs::path& path); lib_info read_lib(const fs::path& path); -}} +} diff --git a/toolsrc/include/lazy.h b/toolsrc/include/lazy.h new file mode 100644 index 000000000..f9dbd8dc7 --- /dev/null +++ b/toolsrc/include/lazy.h @@ -0,0 +1,26 @@ +#pragma once + +namespace vcpkg +{ + template <typename T> + class lazy + { + public: + lazy() : value(T()), initialized(false) {} + + template <class F> + T const& get_lazy(F& f) const + { + if (!initialized) + { + value = f(); + initialized = true; + } + return value; + } + + private: + mutable T value; + mutable bool initialized; + }; +} diff --git a/toolsrc/include/opt_bool.h b/toolsrc/include/opt_bool.h index 3856366c8..06642a399 100644 --- a/toolsrc/include/opt_bool.h +++ b/toolsrc/include/opt_bool.h @@ -1,11 +1,33 @@ #pragma once -namespace vcpkg +#include <string> +#include <map> + +namespace vcpkg::opt_bool { - enum class opt_bool + enum class type { - unspecified, - enabled, - disabled + UNSPECIFIED = 0, + ENABLED, + DISABLED }; + + type parse(const std::string& s); + + template <class T> + type from_map(const std::map<T, std::string>& map, const T& key) + { + auto it = map.find(key); + if (it == map.cend()) + { + return type::UNSPECIFIED; + } + + return parse(*it); + } } + +namespace vcpkg +{ + using opt_bool_t = opt_bool::type; +}
\ No newline at end of file diff --git a/toolsrc/include/package_spec.h b/toolsrc/include/package_spec.h index 30dfca5c7..1bc493756 100644 --- a/toolsrc/include/package_spec.h +++ b/toolsrc/include/package_spec.h @@ -1,5 +1,4 @@ #pragma once -#include <string> #include "package_spec_parse_result.h" #include "triplet.h" #include "expected.h" @@ -16,15 +15,17 @@ namespace vcpkg const triplet& target_triplet() const; + std::string display_name() const; + std::string dir() const; + std::string toString() const; + private: std::string m_name; triplet m_target_triplet; }; - std::string to_string(const package_spec& spec); - std::string to_printf_arg(const package_spec& spec); bool operator==(const package_spec& left, const package_spec& right); diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h new file mode 100644 index 000000000..e78f17237 --- /dev/null +++ b/toolsrc/include/pch.h @@ -0,0 +1,43 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include <Windows.h> +#include <shellapi.h> +#include <Shlobj.h> +#include <winhttp.h> +#include <process.h> + +#include <cassert> +#include <stdexcept> +#include <system_error> + +#include <array> +#include <vector> +#include <set> +#include <map> +#include <unordered_set> +#include <unordered_map> + +#include <string> +#include <regex> + +#include <filesystem> +#include <iostream> +#include <fstream> +#include <memory> +#include <iomanip> + +#include <algorithm> +#include <functional> +#include <iterator> +#include <utility> + +#include <cstdarg> +#include <codecvt> +#include <cctype> +#include <cstdint> + +#include <sys/timeb.h> +#include <time.h> +#include <chrono> diff --git a/toolsrc/include/post_build_lint.h b/toolsrc/include/post_build_lint.h deleted file mode 100644 index a5fb9149f..000000000 --- a/toolsrc/include/post_build_lint.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#include "package_spec.h" -#include "vcpkg_paths.h" - -namespace vcpkg {namespace PostBuildLint -{ - void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); -}} diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h deleted file mode 100644 index 75dc40b43..000000000 --- a/toolsrc/include/vcpkg.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include "package_spec.h" -#include "BinaryParagraph.h" -#include "StatusParagraphs.h" -#include "vcpkg_paths.h" - -namespace vcpkg -{ - StatusParagraphs database_load_check(const vcpkg_paths& paths); - - void write_update(const vcpkg_paths& paths, const StatusParagraph& p); - - struct StatusParagraph_and_associated_files - { - StatusParagraph pgh; - std::vector<std::string> files; - }; - - std::vector<StatusParagraph_and_associated_files> get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db); - - expected<SourceParagraph> try_load_port(const fs::path& control_path); - - inline expected<SourceParagraph> try_load_port(const vcpkg_paths& paths, const std::string& name) - { - return try_load_port(paths.ports / name); - } - - expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); -} // namespace vcpkg diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h index 9d9b21ed6..23869f35f 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg_Checks.h @@ -2,7 +2,7 @@ #include "vcpkg_Strings.h" -namespace vcpkg {namespace Checks +namespace vcpkg::Checks { __declspec(noreturn) void unreachable(); @@ -35,6 +35,8 @@ namespace vcpkg {namespace Checks } } + void check_exit(bool expression); + void check_exit(bool expression, const char* errorMessage); template <class...Args> @@ -46,4 +48,4 @@ namespace vcpkg {namespace Checks exit_with_message(Strings::format(errorMessageTemplate, errorMessageArgs...).c_str()); } } -}} +} diff --git a/toolsrc/include/vcpkg_Chrono.h b/toolsrc/include/vcpkg_Chrono.h new file mode 100644 index 000000000..a9d1bbbed --- /dev/null +++ b/toolsrc/include/vcpkg_Chrono.h @@ -0,0 +1,31 @@ +#pragma once + +#include <chrono> +#include <string> + +namespace vcpkg +{ + class ElapsedTime + { + public: + static ElapsedTime createStarted(); + + constexpr ElapsedTime() : m_startTick() {} + + template <class TimeUnit> + TimeUnit elapsed() const + { + return std::chrono::duration_cast<TimeUnit>(std::chrono::high_resolution_clock::now() - this->m_startTick); + } + + double microseconds() const + { + return elapsed<std::chrono::duration<double, std::micro>>().count(); + } + + std::string toString() const; + + private: + std::chrono::high_resolution_clock::time_point m_startTick; + }; +} diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index fd427fd40..544dffe72 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -2,46 +2,139 @@ #include "vcpkg_cmd_arguments.h" #include "vcpkg_paths.h" +#include "StatusParagraphs.h" +#include <array> -namespace vcpkg +namespace vcpkg::Commands { - extern const char*const INTEGRATE_COMMAND_HELPSTRING; + using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + using command_type_c = void(*)(const vcpkg_cmd_arguments& args); - void print_usage(); - void print_example(const std::string& command_and_arguments); - std::string create_example_string(const std::string& command_and_arguments); - void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + namespace Build + { + enum class BuildResult + { + NULLVALUE = 0, + SUCCEEDED, + BUILD_FAILED, + POST_BUILD_CHECKS_FAILED, + CASCADED_DUE_TO_MISSING_DEPENDENCIES + }; + + static constexpr std::array<BuildResult, 4> BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES }; + + const std::string& to_string(const BuildResult build_result); + std::string create_error_message(const BuildResult build_result, const package_spec& spec); + std::string create_user_troubleshooting_message(const package_spec& spec); + + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); + void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } - void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - 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); + namespace BuildExternal + { + void perform_and_exit(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); + namespace Install + { + void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } - void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void internal_test_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + namespace CI + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } + + namespace Remove + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } - void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + namespace Update + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } - void integrate_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + namespace Create + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } - void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + namespace Edit + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } - void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - void help_topic_valid_triplet(const vcpkg_paths& paths); + namespace Search + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } - void version_command(const vcpkg_cmd_arguments& args); - void contact_command(const vcpkg_cmd_arguments& args); - void hash_command(const vcpkg_cmd_arguments& args); + namespace List + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } - using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); - using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - using command_type_c = void(*)(const vcpkg_cmd_arguments& args); + namespace Owns + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Cache + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Import + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Integrate + { + extern const char*const INTEGRATE_COMMAND_HELPSTRING; + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace PortsDiff + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + + namespace Help + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + + void help_topic_valid_triplet(const vcpkg_paths& paths); + + void print_usage(); + + void print_example(const std::string& command_and_arguments); + + std::string create_example_string(const std::string& command_and_arguments); + } + + namespace Version + { + const std::string& version(); + void perform_and_exit(const vcpkg_cmd_arguments& args); + } + + namespace Contact + { + const std::string& email(); + void perform_and_exit(const vcpkg_cmd_arguments& args); + } + + namespace Hash + { + void perform_and_exit(const vcpkg_cmd_arguments& args); + } template <class T> struct package_name_and_function @@ -55,7 +148,7 @@ namespace vcpkg const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c(); template <typename T> - T find_command(const std::string& command_name, const std::vector<package_name_and_function<T>> available_commands) + T find(const std::string& command_name, const std::vector<package_name_and_function<T>> available_commands) { for (const package_name_and_function<T>& cmd : available_commands) { diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 3616e6be9..dca824ee9 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -3,11 +3,20 @@ #include "package_spec.h" #include "StatusParagraphs.h" #include "vcpkg_paths.h" +#include "vcpkg_optional.h" -namespace vcpkg {namespace Dependencies +namespace vcpkg::Dependencies { + enum class request_type + { + UNKNOWN, + USER_REQUESTED, + AUTO_SELECTED + }; + enum class install_plan_type { + UNKNOWN, BUILD_AND_INSTALL, INSTALL, ALREADY_INSTALLED @@ -15,16 +24,56 @@ namespace vcpkg {namespace Dependencies struct install_plan_action { - install_plan_type type; - std::unique_ptr<BinaryParagraph> bpgh; - std::unique_ptr<SourceParagraph> spgh; + install_plan_action(); + install_plan_action(const install_plan_type& plan_type, optional<BinaryParagraph> binary_pgh, optional<SourceParagraph> source_pgh); + install_plan_action(const install_plan_action&) = delete; + install_plan_action(install_plan_action&&) = default; + install_plan_action& operator=(const install_plan_action&) = delete; + install_plan_action& operator=(install_plan_action&&) = default; + + install_plan_type plan_type; + optional<BinaryParagraph> binary_pgh; + optional<SourceParagraph> source_pgh; }; struct package_spec_with_install_plan { + package_spec_with_install_plan(const package_spec& spec, install_plan_action&& plan); + package_spec spec; install_plan_action plan; }; + enum class remove_plan_type + { + UNKNOWN, + NOT_INSTALLED, + REMOVE + }; + + struct remove_plan_action + { + remove_plan_action(); + remove_plan_action(const remove_plan_type& plan_type, const request_type& request_type); + remove_plan_action(const remove_plan_action&) = delete; + remove_plan_action(remove_plan_action&&) = default; + remove_plan_action& operator=(const remove_plan_action&) = delete; + remove_plan_action& operator=(remove_plan_action&&) = default; + + + remove_plan_type plan_type; + request_type request_type; + }; + + struct package_spec_with_remove_plan + { + package_spec_with_remove_plan(const package_spec& spec, remove_plan_action&& plan); + + package_spec spec; + remove_plan_action plan; + }; + std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db); -}} + + std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<package_spec>& specs, const StatusParagraphs& status_db); +} diff --git a/toolsrc/include/vcpkg_Enums.h b/toolsrc/include/vcpkg_Enums.h new file mode 100644 index 000000000..5c4dc8b06 --- /dev/null +++ b/toolsrc/include/vcpkg_Enums.h @@ -0,0 +1,11 @@ +#pragma once +#include <string> + +namespace vcpkg::Enums +{ + std::string nullvalue_toString(const std::string& enum_name); + + __declspec(noreturn) void nullvalue_used(const std::string& enum_name); + + __declspec(noreturn) void unreachable(const std::string& enum_name); +} diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 877ac7deb..5d12c8f6c 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -1,17 +1,19 @@ #pragma once #include "vcpkg_paths.h" -namespace vcpkg {namespace Environment +namespace vcpkg::Environment { - void ensure_nuget_on_path(const vcpkg_paths& paths); + const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); - void ensure_git_on_path(const vcpkg_paths& paths); + struct vcvarsall_and_platform_toolset + { + fs::path path; + std::wstring platform_toolset; + }; - void ensure_cmake_on_path(const vcpkg_paths& paths); + const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths); - inline void ensure_utilities_on_path(const vcpkg_paths& paths) - { - ensure_cmake_on_path(paths); - ensure_git_on_path(paths); - } -}} + const fs::path& get_ProgramFiles_32_bit(); + + const fs::path& get_ProgramFiles_platform_bitness(); +} diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h index 6c9d0d365..3f9570946 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg_Files.h @@ -4,7 +4,7 @@ #include "filesystem_fs.h" #include <iterator> -namespace vcpkg {namespace Files +namespace vcpkg::Files { static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)"; @@ -53,4 +53,4 @@ namespace vcpkg {namespace Files std::vector<fs::path> non_recursive_find_all_files_in_dir(const fs::path& dir); void print_paths(const std::vector<fs::path>& paths); -}} +} diff --git a/toolsrc/include/vcpkg_Graphs.h b/toolsrc/include/vcpkg_Graphs.h index 9444ac45b..933d9ac67 100644 --- a/toolsrc/include/vcpkg_Graphs.h +++ b/toolsrc/include/vcpkg_Graphs.h @@ -3,7 +3,7 @@ #include <unordered_map> #include <unordered_set> -namespace vcpkg { namespace Graphs +namespace vcpkg::Graphs { enum class ExplorationStatus { @@ -117,4 +117,4 @@ namespace vcpkg { namespace Graphs private: std::unordered_map<V, std::unordered_set<V>> vertices; }; -}} +} diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h index 5ce90e3b9..96cbeecc3 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg_Input.h @@ -3,7 +3,7 @@ #include "package_spec.h" #include "vcpkg_paths.h" -namespace vcpkg {namespace Input +namespace vcpkg::Input { package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const std::string& example_text); @@ -11,5 +11,5 @@ namespace vcpkg {namespace Input void check_triplet(const triplet& t, const vcpkg_paths& paths); - void check_triplets(std::vector<package_spec> triplets, const vcpkg_paths& paths); -}} + void check_triplets(const std::vector<package_spec>& triplets, const vcpkg_paths& paths); +} diff --git a/toolsrc/include/vcpkg_Maps.h b/toolsrc/include/vcpkg_Maps.h index c67462a39..5e2f92f55 100644 --- a/toolsrc/include/vcpkg_Maps.h +++ b/toolsrc/include/vcpkg_Maps.h @@ -4,7 +4,7 @@ #include <unordered_set> #include <map> -namespace vcpkg { namespace Maps +namespace vcpkg::Maps { template <typename K, typename V> std::unordered_set<K> extract_key_set(const std::unordered_map<K, V>& input_map) @@ -38,4 +38,4 @@ namespace vcpkg { namespace Maps } return key_set; } -}} +} diff --git a/toolsrc/include/vcpkg_Sets.h b/toolsrc/include/vcpkg_Sets.h index 7b330f31c..ec4800864 100644 --- a/toolsrc/include/vcpkg_Sets.h +++ b/toolsrc/include/vcpkg_Sets.h @@ -3,15 +3,15 @@ #include "vcpkg_Checks.h" #include <unordered_set> -namespace vcpkg { namespace Sets +namespace vcpkg::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"); + Checks::check_exit(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 a117a1a81..abf3651e5 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -2,7 +2,7 @@ #include <vector> -namespace vcpkg {namespace Strings {namespace details +namespace vcpkg::Strings::details { inline const char* to_printf_arg(const std::string& s) { @@ -19,6 +19,11 @@ namespace vcpkg {namespace Strings {namespace details return s; } + inline long long to_printf_arg(const long long s) + { + return s; + } + inline double to_printf_arg(const double s) { return s; @@ -42,9 +47,9 @@ namespace vcpkg {namespace Strings {namespace details } std::wstring wformat_internal(const wchar_t* fmtstr, ...); -}}} +} -namespace vcpkg {namespace Strings +namespace vcpkg::Strings { template <class...Args> std::string format(const char* fmtstr, const Args&...args) @@ -68,11 +73,60 @@ namespace vcpkg {namespace Strings std::string ascii_to_lowercase(const std::string& input); - std::string join(const std::vector<std::string>& v, const std::string& delimiter); + template <class T, class Transformer> + std::string join(const std::string& delimiter, const std::vector<T>& v, Transformer transformer) + { + if (v.empty()) + { + return std::string(); + } + + std::string output; + size_t size = v.size(); + + output.append(transformer(v.at(0))); + + for (size_t i = 1; i < size; ++i) + { + output.append(delimiter); + output.append(transformer(v.at(i))); + } + + return output; + } + + std::string join(const std::string& delimiter, const std::vector<std::string>& v); + + template <class T, class Transformer> + std::wstring wjoin(const std::wstring& delimiter, const std::vector<T>& v, Transformer transformer) + { + if (v.empty()) + { + return std::wstring(); + } + + std::wstring output; + size_t size = v.size(); + + output.append(transformer(v.at(0))); + + for (size_t i = 1; i < size; ++i) + { + output.append(delimiter); + output.append(transformer(v.at(i))); + } + + return output; + } + + std::wstring wjoin(const std::wstring& delimiter, const std::vector<std::wstring>& v); + void trim(std::string* s); std::string trimmed(const std::string& s); void trim_all_and_remove_whitespace_strings(std::vector<std::string>* strings); -}} + + std::vector<std::string> split(const std::string& s, const std::string& delimiter); +} diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 1101c9b27..71caeed5e 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -1,10 +1,14 @@ #pragma once +#include <Windows.h> #include "vcpkg_Strings.h" #include "filesystem_fs.h" +#include "vcpkg_optional.h" -namespace vcpkg {namespace System +namespace vcpkg::System { + optional<std::wstring> get_registry_string(HKEY base, const wchar_t* subkey, const wchar_t* valuename); + fs::path get_exe_path_of_current_process(); struct exit_code_and_output @@ -13,6 +17,13 @@ namespace vcpkg {namespace System std::string output; }; + int cmd_execute_clean(const wchar_t* cmd_line); + + inline int cmd_execute_clean(const std::wstring& cmd_line) + { + return cmd_execute_clean(cmd_line.c_str()); + } + int cmd_execute(const wchar_t* cmd_line); inline int cmd_execute(const std::wstring& cmd_line) @@ -27,6 +38,10 @@ namespace vcpkg {namespace System return cmd_execute_and_capture_output(cmd_line.c_str()); } + std::wstring create_powershell_script_cmd(const fs::path& script_path); + + std::wstring create_powershell_script_cmd(const fs::path& script_path, const std::wstring& args); + enum class color { success = 10, @@ -83,14 +98,7 @@ namespace vcpkg {namespace System return println(c, Strings::format(messageTemplate, messageArgs...).c_str()); } - struct Stopwatch2 - { - int64_t start_time, end_time, freq; - - void start(); - void stop(); - double microseconds() const; - }; + optional<std::wstring> get_environmental_variable(const wchar_t* varname) noexcept; - std::wstring wdupenv_str(const wchar_t* varname) noexcept; -}} + void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept; +} diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 2194e6d2c..91f7de8ac 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -4,7 +4,6 @@ #include <vector> #include <unordered_set> #include "opt_bool.h" -#include "vcpkg_paths.h" namespace vcpkg { @@ -15,9 +14,9 @@ namespace vcpkg std::unique_ptr<std::string> vcpkg_root_dir; std::unique_ptr<std::string> target_triplet; - opt_bool debug = opt_bool::unspecified; - opt_bool sendmetrics = opt_bool::unspecified; - opt_bool printmetrics = opt_bool::unspecified; + opt_bool_t debug = opt_bool_t::UNSPECIFIED; + opt_bool_t sendmetrics = opt_bool_t::UNSPECIFIED; + opt_bool_t printmetrics = opt_bool_t::UNSPECIFIED; std::string command; std::vector<std::string> command_arguments; diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h deleted file mode 100644 index 01da06307..000000000 --- a/toolsrc/include/vcpkg_info.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include <string> - -namespace vcpkg { namespace Info -{ - const std::string& version(); - - const std::string& email(); -}} diff --git a/toolsrc/include/vcpkg_optional.h b/toolsrc/include/vcpkg_optional.h new file mode 100644 index 000000000..7b935bea9 --- /dev/null +++ b/toolsrc/include/vcpkg_optional.h @@ -0,0 +1,5 @@ +#pragma once +#include <memory> + +template<class T> +using optional = std::unique_ptr<T>; diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index a2932070d..99fd14905 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -3,6 +3,7 @@ #include "expected.h" #include "package_spec.h" #include "BinaryParagraph.h" +#include "lazy.h" namespace vcpkg { @@ -24,6 +25,7 @@ namespace vcpkg fs::path ports; fs::path installed; fs::path triplets; + fs::path scripts; fs::path buildsystems; fs::path buildsystems_msbuild_targets; @@ -34,5 +36,14 @@ namespace vcpkg fs::path vcpkg_dir_updates; fs::path ports_cmake; + + const fs::path& get_cmake_exe() const; + const fs::path& get_git_exe() const; + const fs::path& get_nuget_exe() const; + + private: + lazy<fs::path> cmake_exe; + lazy<fs::path> git_exe; + lazy<fs::path> nuget_exe; }; } diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h new file mode 100644 index 000000000..353bfb0a0 --- /dev/null +++ b/toolsrc/include/vcpkglib.h @@ -0,0 +1,34 @@ +#pragma once + +#include "StatusParagraphs.h" +#include "vcpkg_paths.h" +#include "ImmutableSortedVector.h" + +namespace vcpkg +{ + StatusParagraphs database_load_check(const vcpkg_paths& paths); + + void write_update(const vcpkg_paths& paths, const StatusParagraph& p); + + struct StatusParagraph_and_associated_files + { + StatusParagraph pgh; + ImmutableSortedVector<std::string> files; + }; + + std::vector<StatusParagraph_and_associated_files> get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db); + + + struct CMakeVariable + { + CMakeVariable(const std::wstring& varname, const wchar_t* varvalue); + CMakeVariable(const std::wstring& varname, const std::string& varvalue); + CMakeVariable(const std::wstring& varname, const std::wstring& varvalue); + CMakeVariable(const std::wstring& varname, const fs::path& path); + + std::wstring s; + }; + + std::wstring make_cmake_cmd(const fs::path& cmake_exe, const fs::path& cmake_script, const std::vector<CMakeVariable>& pass_variables); + +} // namespace vcpkg diff --git a/toolsrc/include/vcpkglib_helpers.h b/toolsrc/include/vcpkglib_helpers.h index 019bb8c39..8a08513f3 100644 --- a/toolsrc/include/vcpkglib_helpers.h +++ b/toolsrc/include/vcpkglib_helpers.h @@ -2,7 +2,7 @@ #include <unordered_map> -namespace vcpkg {namespace details +namespace vcpkg::details { std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname); std::string remove_optional_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname); @@ -11,4 +11,4 @@ namespace vcpkg {namespace details std::string remove_required_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname); std::string shorten_description(const std::string& desc); -}} +} diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/BinaryParagraph.cpp index ad85a1f8a..8605cd276 100644 --- a/toolsrc/src/BinaryParagraph.cpp +++ b/toolsrc/src/BinaryParagraph.cpp @@ -1,3 +1,4 @@ +#include "pch.h" #include "BinaryParagraph.h" #include "vcpkglib_helpers.h" #include "vcpkg_Checks.h" @@ -22,22 +23,6 @@ namespace vcpkg static const std::string DEPENDS = "Depends"; } - static const std::vector<std::string>& get_list_of_valid_fields() - { - static const std::vector<std::string> valid_fields = - { - BinaryParagraphRequiredField::PACKAGE, - BinaryParagraphRequiredField::VERSION, - BinaryParagraphRequiredField::ARCHITECTURE, - - BinaryParagraphOptionalField::DESCRIPTION, - BinaryParagraphOptionalField::MAINTAINER, - BinaryParagraphOptionalField::DEPENDS - }; - - return valid_fields; - } - BinaryParagraph::BinaryParagraph() = default; BinaryParagraph::BinaryParagraph(std::unordered_map<std::string, std::string> fields) @@ -70,7 +55,7 @@ namespace vcpkg std::string BinaryParagraph::displayname() const { - return Strings::format("%s:%s", this->spec.name(), this->spec.target_triplet()); + return this->spec.display_name(); } std::string BinaryParagraph::dir() const diff --git a/toolsrc/src/BuildInfo.cpp b/toolsrc/src/BuildInfo.cpp deleted file mode 100644 index f151a3ea5..000000000 --- a/toolsrc/src/BuildInfo.cpp +++ /dev/null @@ -1,164 +0,0 @@ -#include "BuildInfo.h" -#include "vcpkg_Checks.h" -#include "vcpkglib_helpers.h" - -namespace vcpkg { namespace PostBuildLint -{ - const ConfigurationType& BuildType::config() const - { - return this->m_config; - } - - const LinkageType& BuildType::linkage() const - { - return this->m_linkage; - } - - std::regex BuildType::crt_regex() const - { - const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase); - return r; - } - - std::string BuildType::toString() const - { - const std::string s = Strings::format("[%s,%s]", to_string(this->m_config), to_string(this->m_linkage)); - return s; - } - - bool operator==(const BuildType& lhs, const BuildType& rhs) - { - return lhs.config() == rhs.config() && lhs.linkage() == rhs.linkage(); - } - - bool operator!=(const BuildType& lhs, const BuildType& rhs) - { - return !(lhs == rhs); - } - - // - namespace BuildInfoRequiredField - { - static const std::string CRT_LINKAGE = "CRTLinkage"; - static const std::string LIBRARY_LINKAGE = "LibraryLinkage"; - } - - BuildInfo BuildInfo::create(const std::unordered_map<std::string, std::string>& pgh) - { - BuildInfo build_info; - build_info.crt_linkage = details::required_field(pgh, BuildInfoRequiredField::CRT_LINKAGE); - build_info.library_linkage = details::required_field(pgh, BuildInfoRequiredField::LIBRARY_LINKAGE); - - return build_info; - } - - const BuildType BuildType::DEBUG_STATIC = BuildType(ConfigurationType::DEBUG, LinkageType::STATIC, R"(/DEFAULTLIB:LIBCMTD)"); - const BuildType BuildType::DEBUG_DYNAMIC = BuildType(ConfigurationType::DEBUG, LinkageType::DYNAMIC, R"(/DEFAULTLIB:MSVCRTD)"); - const BuildType BuildType::RELEASE_STATIC = BuildType(ConfigurationType::RELEASE, LinkageType::STATIC, R"(/DEFAULTLIB:LIBCMT[^D])"); - const BuildType BuildType::RELEASE_DYNAMIC = BuildType(ConfigurationType::RELEASE, LinkageType::DYNAMIC, R"(/DEFAULTLIB:MSVCRT[^D])"); - - LinkageType linkage_type_value_of(const std::string& as_string) - - { - if (as_string == "dynamic") - { - return LinkageType::DYNAMIC; - } - - if (as_string == "static") - { - return LinkageType::STATIC; - } - - return LinkageType::UNKNOWN; - } - - std::string to_string(const LinkageType& build_info) - { - switch (build_info) - { - case LinkageType::STATIC: - return "static"; - case LinkageType::DYNAMIC: - return "dynamic"; - default: - Checks::unreachable(); - } - } - - std::string to_string(const ConfigurationType& conf) - { - switch (conf) - { - case ConfigurationType::DEBUG: - return "Debug"; - case ConfigurationType::RELEASE: - return "Release"; - default: - Checks::unreachable(); - } - } - - BuildType BuildType::value_of(const ConfigurationType& config, const LinkageType& linkage) - { - if (config == ConfigurationType::DEBUG && linkage == LinkageType::STATIC) - { - return DEBUG_STATIC; - } - - if (config == ConfigurationType::DEBUG && linkage == LinkageType::DYNAMIC) - { - return DEBUG_DYNAMIC; - } - - if (config == ConfigurationType::RELEASE && linkage == LinkageType::STATIC) - { - return RELEASE_STATIC; - } - - if (config == ConfigurationType::RELEASE && linkage == LinkageType::DYNAMIC) - { - return RELEASE_DYNAMIC; - } - - Checks::unreachable(); - } - - BuildInfo read_build_info(const fs::path& filepath) - { - const std::vector<std::unordered_map<std::string, std::string>> pghs = Paragraphs::get_paragraphs(filepath); - Checks::check_exit(pghs.size() == 1, "Invalid BUILD_INFO file for package"); - - return BuildInfo::create(pghs[0]); - } - - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP100_DLL = OutdatedDynamicCrt("msvcp100.dll", R"(msvcp100\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP100D_DLL = OutdatedDynamicCrt("msvcp100d.dll", R"(msvcp100d\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP110_DLL = OutdatedDynamicCrt("msvcp110.dll", R"(msvcp110\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP110_WIN_DLL = OutdatedDynamicCrt("msvcp110_win.dll", R"(msvcp110_win\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP120_DLL = OutdatedDynamicCrt("msvcp120.dll", R"(msvcp120\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP120_CLR0400_DLL = OutdatedDynamicCrt("msvcp120_clr0400.dll", R"(msvcp120_clr0400\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP60_DLL = OutdatedDynamicCrt("msvcp60.dll", R"(msvcp60\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP_WIN_DLL = OutdatedDynamicCrt("msvcp60.dll", R"(msvcp60\.dll)");; - - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR100_DLL = OutdatedDynamicCrt("msvcr100.dll", R"(msvcr100\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR100D_DLL = OutdatedDynamicCrt("msvcr100d.dll", R"(msvcr100d\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR100_CLR0400_DLL = OutdatedDynamicCrt("msvcr100_clr0400.dll", R"(msvcr100_clr0400\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR110_DLL = OutdatedDynamicCrt("msvcr110.dll", R"(msvcr110\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR120_DLL = OutdatedDynamicCrt("msvcr120.dll", R"(msvcr120\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR120_CLR0400_DLL = OutdatedDynamicCrt("msvcr120_clr0400.dll", R"(msvcr120_clr0400\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCRT_DLL = OutdatedDynamicCrt("msvcrt.dll", R"(msvcrt\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCRT20_DLL = OutdatedDynamicCrt("msvcrt20.dll", R"(msvcrt20\.dll)");; - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCRT40_DLL = OutdatedDynamicCrt("msvcrt40.dll", R"(msvcrt40\.dll)");; - - std::regex OutdatedDynamicCrt::crt_regex() const - { - const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase); - return r; - } - - const std::string& OutdatedDynamicCrt::toString() const - { - return this->m_dll_name; - } -}} diff --git a/toolsrc/MachineType.cpp b/toolsrc/src/MachineType.cpp index 0115f3e5e..81012234d 100644 --- a/toolsrc/MachineType.cpp +++ b/toolsrc/src/MachineType.cpp @@ -1,3 +1,4 @@ +#include "pch.h" #include "MachineType.h" #include "vcpkg_Checks.h" diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index 823b4a85e..cb90ed1ec 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -1,13 +1,12 @@ +#include "pch.h" #include "Paragraphs.h" #include "vcpkg_Files.h" -namespace vcpkg { namespace Paragraphs +namespace vcpkg::Paragraphs { struct Parser { - Parser(const char* c, const char* e) : cur(c), end(e) - { - } + Parser(const char* c, const char* e) : cur(c), end(e) { } private: const char* cur; @@ -41,8 +40,8 @@ namespace vcpkg { namespace Paragraphs static bool is_alphanum(char ch) { return (ch >= 'A' && ch <= 'Z') - || (ch >= 'a' && ch <= 'z') - || (ch >= '0' && ch <= '9'); + || (ch >= 'a' && ch <= 'z') + || (ch >= '0' && ch <= '9'); } static bool is_lineend(char ch) @@ -100,7 +99,7 @@ namespace vcpkg { namespace Paragraphs auto begin_fieldname = cur; while (is_alphanum(ch) || ch == '-') next(ch); - Checks::check_throw(ch == ':', "Expected ':'"); + Checks::check_exit(ch == ':', "Expected ':'"); fieldname = std::string(begin_fieldname, cur); // skip ': ' @@ -118,7 +117,7 @@ namespace vcpkg { namespace Paragraphs get_fieldname(ch, fieldname); auto it = fields.find(fieldname); - Checks::check_throw(it == fields.end(), "Duplicate field"); + Checks::check_exit(it == fields.end(), "Duplicate field"); get_fieldvalue(ch, fieldvalue); @@ -153,11 +152,76 @@ namespace vcpkg { namespace Paragraphs std::vector<std::unordered_map<std::string, std::string>> get_paragraphs(const fs::path& control_path) { - return parse_paragraphs(Files::read_contents(control_path).get_or_throw()); + const expected<std::string> contents = Files::read_contents(control_path); + if (auto spgh = contents.get()) + { + return parse_paragraphs(*spgh); + } + + Checks::exit_with_message("Error while reading %s: %s", control_path.generic_string(), contents.error_code().message()); } std::vector<std::unordered_map<std::string, std::string>> parse_paragraphs(const std::string& str) { return Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); } -}} + + expected<SourceParagraph> try_load_port(const fs::path& path) + { + try + { + auto pghs = get_paragraphs(path / "CONTROL"); + Checks::check_exit(pghs.size() == 1, "Invalid control file at %s\\CONTROL", path.string()); + return SourceParagraph(pghs[0]); + } + catch (std::runtime_error const&) {} + + return std::errc::no_such_file_or_directory; + } + + expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec) + { + const fs::path path = paths.package_dir(spec) / "CONTROL"; + + auto control_contents_maybe = Files::read_contents(path); + if (auto control_contents = control_contents_maybe.get()) + { + std::vector<std::unordered_map<std::string, std::string>> pghs; + try + { + pghs = parse_paragraphs(*control_contents); + } + catch (std::runtime_error) {} + Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", path.string()); + return BinaryParagraph(pghs[0]); + } + return control_contents_maybe.error_code(); + } + + std::vector<SourceParagraph> load_all_ports(const fs::path& ports_dir) + { + std::vector<SourceParagraph> output; + for (auto it = fs::directory_iterator(ports_dir); it != fs::directory_iterator(); ++it) + { + const fs::path& path = it->path(); + expected<SourceParagraph> source_paragraph = try_load_port(path); + if (auto srcpgh = source_paragraph.get()) + { + output.emplace_back(std::move(*srcpgh)); + } + } + + return output; + } + + std::map<std::string, std::string> extract_port_names_and_versions(const std::vector<SourceParagraph>& source_paragraphs) + { + std::map<std::string, std::string> names_and_versions; + for (const SourceParagraph& port : source_paragraphs) + { + names_and_versions.emplace(port.name, port.version); + } + + return names_and_versions; + } +} diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/PostBuildLint.cpp index 4f0adf677..8abf71bb3 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -1,13 +1,14 @@ +#include "pch.h" #include "vcpkg_paths.h" #include "package_spec.h" #include "vcpkg_Files.h" -#include <functional> #include "vcpkg_System.h" +#include "vcpkg_Environment.h" #include "coff_file_reader.h" -#include "BuildInfo.h" -#include <regex> +#include "PostBuildLint_BuildInfo.h" +#include "PostBuildLint_BuildType.h" -namespace vcpkg { namespace PostBuildLint +namespace vcpkg::PostBuildLint { enum class lint_status { @@ -15,7 +16,41 @@ namespace vcpkg { namespace PostBuildLint ERROR_DETECTED = 1 }; - static const fs::path DUMPBIN_EXE = R"(%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe)"; + struct OutdatedDynamicCrt + { + std::string name; + std::regex regex; + + OutdatedDynamicCrt(const std::string& name, const std::string& regex_as_string) + : name(name), + regex(std::regex(regex_as_string, std::regex_constants::icase)) {} + }; + + const std::vector<OutdatedDynamicCrt>& get_outdated_dynamic_crts() + { + static const std::vector<OutdatedDynamicCrt> v = { + { "msvcp100.dll", R"(msvcp100\.dll)" }, + { "msvcp100d.dll", R"(msvcp100d\.dll)" }, + { "msvcp110.dll", R"(msvcp110\.dll)" }, + { "msvcp110_win.dll", R"(msvcp110_win\.dll)" }, + { "msvcp120.dll", R"(msvcp120\.dll)" }, + { "msvcp120_clr0400.dll", R"(msvcp120_clr0400\.dll)" }, + { "msvcp60.dll", R"(msvcp60\.dll)" }, + { "msvcp60.dll", R"(msvcp60\.dll)" }, + + { "msvcr100.dll", R"(msvcr100\.dll)" }, + { "msvcr100d.dll", R"(msvcr100d\.dll)" }, + { "msvcr100_clr0400.dll", R"(msvcr100_clr0400\.dll)" }, + { "msvcr110.dll", R"(msvcr110\.dll)" }, + { "msvcr120.dll", R"(msvcr120\.dll)" }, + { "msvcr120_clr0400.dll", R"(msvcr120_clr0400\.dll)" }, + { "msvcrt.dll", R"(msvcrt\.dll)" }, + { "msvcrt20.dll", R"(msvcrt20\.dll)" }, + { "msvcrt40.dll", R"(msvcrt40\.dll)" } + }; + + return v; + } static lint_status check_for_files_in_include_directory(const fs::path& package_dir) { @@ -185,12 +220,12 @@ namespace vcpkg { namespace PostBuildLint return lint_status::SUCCESS; } - static lint_status check_exports_of_dlls(const std::vector<fs::path>& dlls) + static lint_status check_exports_of_dlls(const std::vector<fs::path>& dlls, const fs::path& dumpbin_exe) { std::vector<fs::path> dlls_with_no_exports; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(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)); @@ -211,7 +246,7 @@ namespace vcpkg { namespace PostBuildLint return lint_status::SUCCESS; } - static lint_status check_uwp_bit_of_dlls(const std::string& expected_system_name, const std::vector<fs::path>& dlls) + static lint_status check_uwp_bit_of_dlls(const std::string& expected_system_name, const std::vector<fs::path>& dlls, const fs::path dumpbin_exe) { if (expected_system_name != "uwp") { @@ -221,7 +256,7 @@ namespace vcpkg { namespace PostBuildLint std::vector<fs::path> dlls_with_improper_uwp_bit; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(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)); @@ -289,7 +324,7 @@ namespace vcpkg { namespace PostBuildLint if (expected_architecture != actual_architecture) { - binaries_with_invalid_architecture.push_back({file, actual_architecture}); + binaries_with_invalid_architecture.push_back({ file, actual_architecture }); } } @@ -315,7 +350,7 @@ namespace vcpkg { namespace PostBuildLint const std::string actual_architecture = get_actual_architecture(info.machine_types.at(0)); if (expected_architecture != actual_architecture) { - binaries_with_invalid_architecture.push_back({file, actual_architecture}); + binaries_with_invalid_architecture.push_back({ file, actual_architecture }); } } @@ -370,29 +405,20 @@ namespace vcpkg { namespace PostBuildLint return lint_status::ERROR_DETECTED; } - static lint_status check_lib_files_are_available_if_dlls_are_available(const size_t lib_count, const size_t dll_count, const fs::path& lib_dir) + static lint_status check_lib_files_are_available_if_dlls_are_available(const std::map<BuildPolicies::type, opt_bool_t>& policies, const size_t lib_count, const size_t dll_count, const fs::path& lib_dir) { - if (lib_count == 0 && dll_count != 0) + auto it = policies.find(BuildPolicies::DLLS_WITHOUT_LIBS); + if (it != policies.cend() && it->second == opt_bool_t::DISABLED) { - System::println(System::color::warning, "Import libs were not present in %s", lib_dir.generic_string()); - return lint_status::ERROR_DETECTED; + return lint_status::SUCCESS; } - return lint_status::SUCCESS; - } - - static lint_status check_no_subdirectories(const fs::path& dir) - { - const std::vector<fs::path> subdirectories = Files::recursive_find_matching_paths_in_dir(dir, [&](const fs::path& current) - { - return fs::is_directory(current); - }); - - if (!subdirectories.empty()) + if (lib_count == 0 && dll_count != 0) { - System::println(System::color::warning, "Directory %s should have no subdirectories", dir.generic_string()); - System::println("The following subdirectories were found: "); - Files::print_paths(subdirectories); + System::println(System::color::warning, "Import libs were not present in %s", lib_dir.generic_string()); + System::println(System::color::warning, + "If this is intended, add the following line in the portfile:\n" + " SET(%s disabled)", BuildPolicies::DLLS_WITHOUT_LIBS.cmake_variable()); return lint_status::ERROR_DETECTED; } @@ -443,7 +469,7 @@ namespace vcpkg { namespace PostBuildLint System::println("The following empty directories were found: "); Files::print_paths(empty_directories); System::println(System::color::warning, "If a directory should be populated but is not, this might indicate an error in the portfile.\n" - "If the directories are not needed and their creation cannot be disabled, use something like this in the portfile to remove them)\n" + "If the directories are not needed and their creation cannot be disabled, use something like this in the portfile to remove them:\n" "\n" R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/a/dir ${CURRENT_PACKAGES_DIR}/some/other/dir))###""\n" "\n"); @@ -456,27 +482,27 @@ namespace vcpkg { namespace PostBuildLint struct BuildType_and_file { fs::path file; - BuildType build_type; + BuildType::type build_type; }; - static lint_status check_crt_linkage_of_libs(const BuildType& expected_build_type, const std::vector<fs::path>& libs) + static lint_status check_crt_linkage_of_libs(const BuildType::type& expected_build_type, const std::vector<fs::path>& libs, const fs::path dumpbin_exe) { - std::vector<BuildType> bad_build_types = BuildType::values(); + std::vector<BuildType::type> bad_build_types(BuildType::values.cbegin(), BuildType::values.cend()); bad_build_types.erase(std::remove(bad_build_types.begin(), bad_build_types.end(), expected_build_type), bad_build_types.end()); std::vector<BuildType_and_file> libs_with_invalid_crt; for (const fs::path& lib : libs) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /directives "%s")", DUMPBIN_EXE.native(), lib.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /directives "%s")", dumpbin_exe.native(), lib.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)); - for (const BuildType& bad_build_type : bad_build_types) + for (const BuildType::type& bad_build_type : bad_build_types) { if (std::regex_search(ec_data.output.cbegin(), ec_data.output.cend(), bad_build_type.crt_regex())) { - libs_with_invalid_crt.push_back({lib, bad_build_type}); + libs_with_invalid_crt.push_back({ lib, bad_build_type }); break; } } @@ -503,25 +529,27 @@ namespace vcpkg { namespace PostBuildLint { fs::path file; OutdatedDynamicCrt outdated_crt; + + OutdatedDynamicCrt_and_file() = delete; }; - static lint_status check_outdated_crt_linkage_of_dlls(const std::vector<fs::path>& dlls) + static lint_status check_outdated_crt_linkage_of_dlls(const std::vector<fs::path>& dlls, const fs::path dumpbin_exe) { - const std::vector<OutdatedDynamicCrt>& outdated_crts = OutdatedDynamicCrt::values(); + const std::vector<OutdatedDynamicCrt>& outdated_crts = get_outdated_dynamic_crts(); std::vector<OutdatedDynamicCrt_and_file> dlls_with_outdated_crt; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /dependents "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /dependents "%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)); for (const OutdatedDynamicCrt& outdated_crt : outdated_crts) { - if (std::regex_search(ec_data.output.cbegin(), ec_data.output.cend(), outdated_crt.crt_regex())) + if (std::regex_search(ec_data.output.cbegin(), ec_data.output.cend(), outdated_crt.regex)) { - dlls_with_outdated_crt.push_back({dll, outdated_crt}); + dlls_with_outdated_crt.push_back({ dll, outdated_crt }); break; } } @@ -533,7 +561,7 @@ namespace vcpkg { namespace PostBuildLint System::println(""); for (const OutdatedDynamicCrt_and_file btf : dlls_with_outdated_crt) { - System::println(" %s: %s", btf.file.generic_string(), btf.outdated_crt.toString()); + System::println(" %s: %s", btf.file.generic_string(), btf.outdated_crt.name); } System::println(""); @@ -573,14 +601,32 @@ namespace vcpkg { namespace PostBuildLint left += static_cast<size_t>(right); } - void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) + template <class T> + static bool contains_and_enabled(const std::map<T, opt_bool_t> map, const T& key) { - System::println("-- Performing post-build validation"); + auto it = map.find(key); + if (it != map.cend() && it->second == opt_bool_t::ENABLED) + { + return true; + } + + return false; + } + + static size_t perform_all_checks_and_return_error_count(const package_spec& spec, const vcpkg_paths& paths) + { + const fs::path dumpbin_exe = Environment::get_dumpbin_exe(paths); BuildInfo build_info = read_build_info(paths.build_info_file_path(spec)); const fs::path package_dir = paths.package_dir(spec); size_t error_count = 0; + + if (contains_and_enabled(build_info.policies, BuildPolicies::EMPTY_PACKAGE)) + { + return error_count; + } + error_count += check_for_files_in_include_directory(package_dir); error_count += check_for_files_in_debug_include_directory(package_dir); error_count += check_for_files_in_debug_share_directory(package_dir); @@ -607,30 +653,30 @@ namespace vcpkg { namespace PostBuildLint error_count += check_lib_architecture(spec.target_triplet().architecture(), libs); - switch (linkage_type_value_of(build_info.library_linkage)) + switch (build_info.library_linkage) { - case LinkageType::DYNAMIC: + case LinkageType::backing_enum_t::DYNAMIC: { const std::vector<fs::path> debug_dlls = Files::recursive_find_files_with_extension_in_dir(debug_bin_dir, ".dll"); const std::vector<fs::path> release_dlls = Files::recursive_find_files_with_extension_in_dir(release_bin_dir, ".dll"); error_count += check_matching_debug_and_release_binaries(debug_dlls, release_dlls); - error_count += check_lib_files_are_available_if_dlls_are_available(debug_libs.size(), debug_dlls.size(), debug_lib_dir); - error_count += check_lib_files_are_available_if_dlls_are_available(release_libs.size(), release_dlls.size(), release_lib_dir); + error_count += check_lib_files_are_available_if_dlls_are_available(build_info.policies, debug_libs.size(), debug_dlls.size(), debug_lib_dir); + error_count += check_lib_files_are_available_if_dlls_are_available(build_info.policies, release_libs.size(), release_dlls.size(), release_lib_dir); std::vector<fs::path> dlls; dlls.insert(dlls.cend(), debug_dlls.cbegin(), debug_dlls.cend()); dlls.insert(dlls.cend(), release_dlls.cbegin(), release_dlls.cend()); - error_count += check_exports_of_dlls(dlls); - error_count += check_uwp_bit_of_dlls(spec.target_triplet().system(), dlls); + error_count += check_exports_of_dlls(dlls, dumpbin_exe); + error_count += check_uwp_bit_of_dlls(spec.target_triplet().system(), dlls, dumpbin_exe); error_count += check_dll_architecture(spec.target_triplet().architecture(), dlls); - error_count += check_outdated_crt_linkage_of_dlls(dlls); + error_count += check_outdated_crt_linkage_of_dlls(dlls, dumpbin_exe); break; } - case LinkageType::STATIC: + case LinkageType::backing_enum_t::STATIC: { std::vector<fs::path> dlls; Files::recursive_find_files_with_extension_in_dir(package_dir, ".dll", &dlls); @@ -638,34 +684,36 @@ namespace vcpkg { namespace PostBuildLint error_count += check_bin_folders_are_not_present_in_static_build(package_dir); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, linkage_type_value_of(build_info.crt_linkage)), debug_libs); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, linkage_type_value_of(build_info.crt_linkage)), release_libs); - break; - } - case LinkageType::UNKNOWN: - { - error_count += 1; - System::println(System::color::warning, "Unknown library_linkage architecture: [ %s ]", build_info.library_linkage); + if (!contains_and_enabled(build_info.policies, BuildPolicies::ONLY_RELEASE_CRT)) + { + error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, build_info.crt_linkage), debug_libs, dumpbin_exe); + } + error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, build_info.crt_linkage), release_libs, dumpbin_exe); break; } + case LinkageType::backing_enum_t::NULLVALUE: default: Checks::unreachable(); } -#if 0 - error_count += check_no_subdirectories(package_dir / "lib"); - error_count += check_no_subdirectories(package_dir / "debug" / "lib"); -#endif error_count += check_no_empty_folders(package_dir); error_count += check_no_files_in_package_dir_and_debug_dir(package_dir); + return error_count; + } + + size_t perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) + { + System::println("-- Performing post-build validation"); + const size_t error_count = perform_all_checks_and_return_error_count(spec, paths); + System::println("-- Performing post-build validation done"); + if (error_count != 0) { 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); } - System::println("-- Performing post-build validation done"); + return error_count; } -}} +} diff --git a/toolsrc/src/PostBuildLint_BuildInfo.cpp b/toolsrc/src/PostBuildLint_BuildInfo.cpp new file mode 100644 index 000000000..0d1d480b8 --- /dev/null +++ b/toolsrc/src/PostBuildLint_BuildInfo.cpp @@ -0,0 +1,48 @@ +#include "pch.h" +#include "PostBuildLint_BuildInfo.h" +#include "vcpkg_Checks.h" +#include "opt_bool.h" +#include "vcpkglib_helpers.h" +#include "Paragraphs.h" + +namespace vcpkg::PostBuildLint +{ + // + namespace BuildInfoRequiredField + { + static const std::string CRT_LINKAGE = "CRTLinkage"; + static const std::string LIBRARY_LINKAGE = "LibraryLinkage"; + } + + BuildInfo BuildInfo::create(std::unordered_map<std::string, std::string> pgh) + { + BuildInfo build_info; + const std::string crt_linkage_as_string = details::remove_required_field(&pgh, BuildInfoRequiredField::CRT_LINKAGE); + build_info.crt_linkage = LinkageType::value_of(crt_linkage_as_string); + Checks::check_exit(build_info.crt_linkage != LinkageType::NULLVALUE, "Invalid crt linkage type: [%s]", crt_linkage_as_string); + + const std::string library_linkage_as_string = details::remove_required_field(&pgh, BuildInfoRequiredField::LIBRARY_LINKAGE); + build_info.library_linkage = LinkageType::value_of(library_linkage_as_string); + Checks::check_exit(build_info.library_linkage != LinkageType::NULLVALUE, "Invalid library linkage type: [%s]", library_linkage_as_string); + + // The remaining entries are policies + for (const std::unordered_map<std::string, std::string>::value_type& p : pgh) + { + const BuildPolicies::type policy = BuildPolicies::parse(p.first); + Checks::check_exit(policy != BuildPolicies::NULLVALUE, "Unknown policy found: %s", p.first); + const opt_bool_t status = opt_bool::parse(p.second); + build_info.policies.emplace(policy, status); + } + + return build_info; + } + + BuildInfo read_build_info(const fs::path& filepath) + { + const std::vector<std::unordered_map<std::string, std::string>> pghs = Paragraphs::get_paragraphs(filepath); + Checks::check_exit(pghs.size() == 1, "Invalid BUILD_INFO file for package"); + + return BuildInfo::create(pghs[0]); + } + +} diff --git a/toolsrc/src/PostBuildLint_BuildPolicies.cpp b/toolsrc/src/PostBuildLint_BuildPolicies.cpp new file mode 100644 index 000000000..f070a2a42 --- /dev/null +++ b/toolsrc/src/PostBuildLint_BuildPolicies.cpp @@ -0,0 +1,70 @@ +#include "pch.h" +#include "PostBuildLint_BuildPolicies.h" +#include "vcpkg_Enums.h" + +namespace vcpkg::PostBuildLint::BuildPolicies +{ + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString(ENUM_NAME); + + static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; + static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; + static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT"; + + const std::string& type::toString() const + { + switch (this->backing_enum) + { + case EMPTY_PACKAGE: + return NAME_EMPTY_PACKAGE; + case DLLS_WITHOUT_LIBS: + return NAME_DLLS_WITHOUT_LIBS; + case ONLY_RELEASE_CRT: + return NAME_ONLY_RELEASE_CRT; + case NULLVALUE: + return NULLVALUE_STRING; + default: + Enums::unreachable(ENUM_NAME); + } + } + + const std::string& type::cmake_variable() const + { + static const std::string CMAKE_VARIABLE_EMPTY_PACKAGE = "VCPKG_POLICY_EMPTY_PACKAGE"; + static const std::string CMAKE_VARIABLE_DLLS_WITHOUT_LIBS = "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; + static const std::string CMAKE_VARIABLE_ONLY_RELEASE_CRT = "VCPKG_POLICY_ONLY_RELEASE_CRT"; + + switch (this->backing_enum) + { + case EMPTY_PACKAGE: + return CMAKE_VARIABLE_EMPTY_PACKAGE; + case DLLS_WITHOUT_LIBS: + return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS; + case ONLY_RELEASE_CRT: + return CMAKE_VARIABLE_ONLY_RELEASE_CRT; + case NULLVALUE: + Enums::nullvalue_used(ENUM_NAME); + default: + Enums::unreachable(ENUM_NAME); + } + } + + type parse(const std::string& s) + { + if (s == NAME_EMPTY_PACKAGE) + { + return BuildPolicies::EMPTY_PACKAGE; + } + + if (s == NAME_DLLS_WITHOUT_LIBS) + { + return BuildPolicies::DLLS_WITHOUT_LIBS; + } + + if (s == NAME_ONLY_RELEASE_CRT) + { + return BuildPolicies::ONLY_RELEASE_CRT; + } + + return BuildPolicies::NULLVALUE; + } +} diff --git a/toolsrc/src/PostBuildLint_BuildType.cpp b/toolsrc/src/PostBuildLint_BuildType.cpp new file mode 100644 index 000000000..f2fb292d7 --- /dev/null +++ b/toolsrc/src/PostBuildLint_BuildType.cpp @@ -0,0 +1,85 @@ +#include "pch.h" +#include "PostBuildLint_BuildType.h" +#include "vcpkg_Enums.h" + +namespace vcpkg::PostBuildLint::BuildType +{ + type value_of(const ConfigurationType::type& config, const LinkageType::type& linkage) + { + if (config == ConfigurationType::DEBUG && linkage == LinkageType::STATIC) + { + return DEBUG_STATIC; + } + + if (config == ConfigurationType::DEBUG && linkage == LinkageType::DYNAMIC) + { + return DEBUG_DYNAMIC; + } + + if (config == ConfigurationType::RELEASE && linkage == LinkageType::STATIC) + { + return RELEASE_STATIC; + } + + if (config == ConfigurationType::RELEASE && linkage == LinkageType::DYNAMIC) + { + return RELEASE_DYNAMIC; + } + + Enums::unreachable(ENUM_NAME); + } + + const ConfigurationType::type& type::config() const + { + return this->m_config; + } + + const LinkageType::type& type::linkage() const + { + return this->m_linkage; + } + + const std::regex& type::crt_regex() const + { + static const std::regex REGEX_DEBUG_STATIC(R"(/DEFAULTLIB:LIBCMTD)", std::regex_constants::icase); + static const std::regex REGEX_DEBUG_DYNAMIC(R"(/DEFAULTLIB:MSVCRTD)", std::regex_constants::icase); + static const std::regex REGEX_RELEASE_STATIC(R"(/DEFAULTLIB:LIBCMT[^D])", std::regex_constants::icase); + static const std::regex REGEX_RELEASE_DYNAMIC(R"(/DEFAULTLIB:MSVCRT[^D])", std::regex_constants::icase); + + switch (backing_enum) + { + case BuildType::DEBUG_STATIC: + return REGEX_DEBUG_STATIC; + case BuildType::DEBUG_DYNAMIC: + return REGEX_DEBUG_DYNAMIC; + case BuildType::RELEASE_STATIC: + return REGEX_RELEASE_STATIC; + case BuildType::RELEASE_DYNAMIC: + return REGEX_RELEASE_DYNAMIC; + default: + Enums::unreachable(ENUM_NAME); + } + } + + const std::string& type::toString() const + { + static const std::string NAME_DEBUG_STATIC("Debug,Static"); + static const std::string NAME_DEBUG_DYNAMIC("Debug,Dynamic"); + static const std::string NAME_RELEASE_STATIC("Release,Static"); + static const std::string NAME_RELEASE_DYNAMIC("Release,Dynamic"); + + switch (backing_enum) + { + case BuildType::DEBUG_STATIC: + return NAME_DEBUG_STATIC; + case BuildType::DEBUG_DYNAMIC: + return NAME_DEBUG_DYNAMIC; + case BuildType::RELEASE_STATIC: + return NAME_RELEASE_STATIC; + case BuildType::RELEASE_DYNAMIC: + return NAME_RELEASE_DYNAMIC; + default: + Enums::unreachable(ENUM_NAME); + } + } +} diff --git a/toolsrc/src/PostBuildLint_ConfigurationType.cpp b/toolsrc/src/PostBuildLint_ConfigurationType.cpp new file mode 100644 index 000000000..990b10a37 --- /dev/null +++ b/toolsrc/src/PostBuildLint_ConfigurationType.cpp @@ -0,0 +1,26 @@ +#include "pch.h" +#include "PostBuildLint_ConfigurationType.h" +#include "vcpkg_Enums.h" + +namespace vcpkg::PostBuildLint::ConfigurationType +{ + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString(ENUM_NAME); + + static const std::string NAME_DEBUG = "Debug"; + static const std::string NAME_RELEASE = "Release"; + + const std::string& type::toString() const + { + switch (this->backing_enum) + { + case ConfigurationType::DEBUG: + return NAME_DEBUG; + case ConfigurationType::RELEASE: + return NAME_RELEASE; + case ConfigurationType::NULLVALUE: + return NULLVALUE_STRING; + default: + Enums::unreachable(ENUM_NAME); + } + } +} diff --git a/toolsrc/src/PostBuildLint_LinkageType.cpp b/toolsrc/src/PostBuildLint_LinkageType.cpp new file mode 100644 index 000000000..6d2c2c935 --- /dev/null +++ b/toolsrc/src/PostBuildLint_LinkageType.cpp @@ -0,0 +1,41 @@ +#include "pch.h" +#include "PostBuildLint_LinkageType.h" +#include "vcpkg_Enums.h" + +namespace vcpkg::PostBuildLint::LinkageType +{ + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString(ENUM_NAME); + + static const std::string NAME_DYNAMIC = "dynamic"; + static const std::string NAME_STATIC = "static"; + + const std::string& type::toString() const + { + switch (this->backing_enum) + { + case LinkageType::DYNAMIC: + return NAME_DYNAMIC; + case LinkageType::STATIC: + return NAME_STATIC; + case LinkageType::NULLVALUE: + return NULLVALUE_STRING; + default: + Enums::unreachable(ENUM_NAME); + } + } + + type value_of(const std::string& as_string) + { + if (as_string == NAME_DYNAMIC) + { + return LinkageType::DYNAMIC; + } + + if (as_string == NAME_STATIC) + { + return LinkageType::STATIC; + } + + return LinkageType::NULLVALUE; + } +} diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp index bdf15a737..4d144191f 100644 --- a/toolsrc/src/SourceParagraph.cpp +++ b/toolsrc/src/SourceParagraph.cpp @@ -1,3 +1,4 @@ +#include "pch.h" #include "SourceParagraph.h" #include "vcpkglib_helpers.h" #include "vcpkg_System.h" @@ -52,8 +53,8 @@ namespace vcpkg const std::vector<std::string> remaining_fields = Maps::extract_keys(fields); const std::vector<std::string>& valid_fields = get_list_of_valid_fields(); - const std::string remaining_fields_as_string = Strings::join(remaining_fields, "\n "); - const std::string valid_fields_as_string = Strings::join(valid_fields, "\n "); + const std::string remaining_fields_as_string = Strings::join("\n ", remaining_fields); + const std::string valid_fields_as_string = Strings::join("\n ", valid_fields); System::println(System::color::error, "Error: There are invalid fields in the Source Paragraph of %s", this->name); System::println("The following fields were not expected:\n\n %s\n\n", remaining_fields_as_string); diff --git a/toolsrc/src/StatusParagraph.cpp b/toolsrc/src/StatusParagraph.cpp index bf12ae89a..3f07689ca 100644 --- a/toolsrc/src/StatusParagraph.cpp +++ b/toolsrc/src/StatusParagraph.cpp @@ -1,3 +1,4 @@ +#include "pch.h" #include "StatusParagraph.h" #include "vcpkglib_helpers.h" diff --git a/toolsrc/src/StatusParagraphs.cpp b/toolsrc/src/StatusParagraphs.cpp index 3e23c519a..9a440fbb8 100644 --- a/toolsrc/src/StatusParagraphs.cpp +++ b/toolsrc/src/StatusParagraphs.cpp @@ -1,5 +1,5 @@ +#include "pch.h" #include "StatusParagraphs.h" -#include <algorithm> #include "vcpkg_Checks.h" namespace vcpkg @@ -29,9 +29,9 @@ namespace vcpkg }); } - StatusParagraphs::iterator StatusParagraphs::find_installed(const std::string& name, const triplet& target_triplet) + StatusParagraphs::const_iterator StatusParagraphs::find_installed(const std::string& name, const triplet& target_triplet) const { - auto it = find(name, target_triplet); + const const_iterator it = find(name, target_triplet); if (it != end() && (*it)->want == want_t::install) { return it; @@ -42,7 +42,7 @@ namespace vcpkg StatusParagraphs::iterator StatusParagraphs::insert(std::unique_ptr<StatusParagraph> pgh) { - Checks::check_throw(pgh != nullptr, "Inserted null paragraph"); + Checks::check_exit(pgh != nullptr, "Inserted null paragraph"); const package_spec& spec = pgh->package.spec; auto ptr = find(spec.name(), spec.target_triplet()); if (ptr == end()) diff --git a/toolsrc/src/coff_file_reader.cpp b/toolsrc/src/coff_file_reader.cpp index 1f30ea70b..f48f912c1 100644 --- a/toolsrc/src/coff_file_reader.cpp +++ b/toolsrc/src/coff_file_reader.cpp @@ -1,12 +1,10 @@ +#include "pch.h" #include "coff_file_reader.h" -#include <iostream> #include "vcpkg_Checks.h" -#include <set> -#include <fstream> using namespace std; -namespace vcpkg { namespace COFFFileReader +namespace vcpkg::COFFFileReader { template <class T> static T reinterpret_bytes(const char* data) @@ -306,4 +304,4 @@ namespace vcpkg { namespace COFFFileReader return {std::vector<MachineType>(machine_types.cbegin(), machine_types.cend())}; } -}} +} diff --git a/toolsrc/src/commands_available_commands.cpp b/toolsrc/src/commands_available_commands.cpp new file mode 100644 index 000000000..4c7e0df2c --- /dev/null +++ b/toolsrc/src/commands_available_commands.cpp @@ -0,0 +1,46 @@ +#include "pch.h" +#include "vcpkg_Commands.h" + +namespace vcpkg::Commands +{ + const std::vector<package_name_and_function<command_type_a>>& get_available_commands_type_a() + { + static std::vector<package_name_and_function<command_type_a>> t = { + {"install", &Install::perform_and_exit}, + { "ci", &CI::perform_and_exit }, + {"remove", &Remove::perform_and_exit}, + {"build", &Build::perform_and_exit}, + {"build_external", &BuildExternal::perform_and_exit} + }; + return t; + } + + const std::vector<package_name_and_function<command_type_b>>& get_available_commands_type_b() + { + static std::vector<package_name_and_function<command_type_b>> t = { + {"/?", &Help::perform_and_exit}, + {"help", &Help::perform_and_exit}, + {"search", &Search::perform_and_exit}, + {"list", &List::perform_and_exit}, + {"integrate", &Integrate::perform_and_exit}, + {"owns", &Owns::perform_and_exit}, + {"update", &Update::perform_and_exit}, + {"edit", &Edit::perform_and_exit}, + {"create", &Create::perform_and_exit}, + {"import", &Import::perform_and_exit}, + {"cache", &Cache::perform_and_exit}, + {"portsdiff", &PortsDiff::perform_and_exit} + }; + return t; + } + + const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c() + { + static std::vector<package_name_and_function<command_type_c>> t = { + {"version", &Version::perform_and_exit}, + {"contact", &Contact::perform_and_exit}, + {"hash", &Hash::perform_and_exit}, + }; + return t; + } +} diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp new file mode 100644 index 000000000..a47083cbd --- /dev/null +++ b/toolsrc/src/commands_build.cpp @@ -0,0 +1,183 @@ +#include "pch.h" +#include "vcpkg_Commands.h" +#include "StatusParagraphs.h" +#include "vcpkglib.h" +#include "vcpkg_Input.h" +#include "PostBuildLint.h" +#include "vcpkg_Dependencies.h" +#include "vcpkg_System.h" +#include "vcpkg_Chrono.h" +#include "vcpkg_Environment.h" +#include "metrics.h" +#include "vcpkg_Enums.h" +#include "Paragraphs.h" + +namespace vcpkg::Commands::Build +{ + using Dependencies::package_spec_with_install_plan; + using Dependencies::install_plan_type; + + static const std::string OPTION_CHECKS_ONLY = "--checks-only"; + + static void create_binary_control_file(const vcpkg_paths& paths, const SourceParagraph& source_paragraph, const triplet& target_triplet) + { + const BinaryParagraph bpgh = BinaryParagraph(source_paragraph, target_triplet); + const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL"; + std::ofstream(binary_control_file) << bpgh; + } + + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db) + { + Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_package()"); + + const triplet& target_triplet = spec.target_triplet(); + for (auto&& dep : source_paragraph.depends) + { + if (status_db.find_installed(dep.name, target_triplet) == status_db.end()) + { + return BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES; + } + } + + const fs::path& cmake_exe_path = paths.get_cmake_exe(); + const fs::path& git_exe_path = paths.get_git_exe(); + + const fs::path ports_cmake_script_path = paths.ports_cmake; + const Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths); + const std::wstring cmd_set_environment = Strings::wformat(LR"("%s" %s >nul 2>&1)", vcvarsall_bat.path.native(), Strings::utf8_to_utf16(target_triplet.architecture())); + + const std::wstring cmd_launch_cmake = make_cmake_cmd(cmake_exe_path, ports_cmake_script_path, + { + { L"CMD", L"BUILD" }, + { L"PORT", source_paragraph.name }, + { L"CURRENT_PORT_DIR", port_dir / "/." }, + { L"TARGET_TRIPLET", target_triplet.canonical_name() }, + { L"VCPKG_PLATFORM_TOOLSET", vcvarsall_bat.platform_toolset }, + { L"GIT", git_exe_path } + }); + + const std::wstring command = Strings::wformat(LR"(%s && %s)", cmd_set_environment, cmd_launch_cmake); + + const ElapsedTime timer = ElapsedTime::createStarted(); + + int return_code = System::cmd_execute_clean(command); + auto buildtimeus = timer.microseconds(); + TrackMetric("buildtimeus-" + spec.toString(), buildtimeus); + + if (return_code != 0) + { + TrackProperty("error", "build failed"); + TrackProperty("build_error", spec.toString()); + return BuildResult::BUILD_FAILED; + } + + const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); + + if (error_count != 0) + { + return BuildResult::POST_BUILD_CHECKS_FAILED; + } + + create_binary_control_file(paths, source_paragraph, target_triplet); + + // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name; + // delete_directory(port_buildtrees_dir); + + return BuildResult::SUCCEEDED; + } + + const std::string& to_string(const BuildResult build_result) + { + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString("vcpkg::Commands::Build::BuildResult"); + static const std::string SUCCEEDED_STRING = "SUCCEEDED"; + static const std::string BUILD_FAILED_STRING = "BUILD_FAILED"; + static const std::string POST_BUILD_CHECKS_FAILED_STRING = "POST_BUILD_CHECKS_FAILED"; + static const std::string CASCADED_DUE_TO_MISSING_DEPENDENCIES_STRING = "CASCADED_DUE_TO_MISSING_DEPENDENCIES"; + + switch (build_result) + { + case BuildResult::NULLVALUE: return NULLVALUE_STRING; + case BuildResult::SUCCEEDED: return SUCCEEDED_STRING; + case BuildResult::BUILD_FAILED: return BUILD_FAILED_STRING; + case BuildResult::POST_BUILD_CHECKS_FAILED: return POST_BUILD_CHECKS_FAILED_STRING; + case BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES: return CASCADED_DUE_TO_MISSING_DEPENDENCIES_STRING; + default: Checks::unreachable(); + } + } + + std::string create_error_message(const BuildResult build_result, const package_spec& spec) + { + return Strings::format("Error: Building package %s failed with: %s", spec.toString(), Build::to_string(build_result)); + } + + std::string create_user_troubleshooting_message(const package_spec& spec) + { + return Strings::format("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." + , spec.toString(), Version::version()); + } + + void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths) + { + if (options.find(OPTION_CHECKS_ONLY) != options.end()) + { + const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); + if (error_count > 0) + { + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); + } + + const expected<SourceParagraph> maybe_spgh = Paragraphs::try_load_port(port_dir); + Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message()); + const SourceParagraph& spgh = *maybe_spgh.get(); + + StatusParagraphs status_db = database_load_check(paths); + const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec), status_db); + if (result == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES) + { + std::vector<package_spec_with_install_plan> unmet_dependencies = Dependencies::create_install_plan(paths, { spec }, status_db); + unmet_dependencies.erase( + std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [&spec](const package_spec_with_install_plan& p) + { + return (p.spec == spec) || (p.plan.plan_type == install_plan_type::ALREADY_INSTALLED); + }), + unmet_dependencies.end()); + + Checks::check_exit(!unmet_dependencies.empty()); + 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_with_install_plan& p : unmet_dependencies) + { + System::println(" %s", p.spec.toString()); + } + System::println(""); + exit(EXIT_FAILURE); + } + + if (result != BuildResult::SUCCEEDED) + { + System::println(System::color::error, Build::create_error_message(result, spec)); + System::println(Build::create_user_troubleshooting_message(spec)); + exit(EXIT_FAILURE); + } + + exit(EXIT_SUCCESS); + } + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows"); + args.check_exact_arg_count(1, example); // Build only takes a single package and all dependencies must already be installed + const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); + Input::check_triplet(spec.target_triplet(), paths); + const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY }); + perform_and_exit(spec, paths.port_dir(spec), options, paths); + } +} diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp new file mode 100644 index 000000000..06bd1374c --- /dev/null +++ b/toolsrc/src/commands_build_external.cpp @@ -0,0 +1,20 @@ +#include "pch.h" +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" +#include "vcpkg_Environment.h" +#include "vcpkg_Input.h" + +namespace vcpkg::Commands::BuildExternal +{ + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + static const std::string example = Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); + args.check_exact_arg_count(2, example); + const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); + Input::check_triplet(spec.target_triplet(), paths); + const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({}); + + const fs::path port_dir = args.command_arguments.at(1); + Build::perform_and_exit(spec, port_dir, options, paths); + } +} diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp index 1a10b93cf..e255b5dff 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/commands_cache.cpp @@ -1,10 +1,11 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" #include "vcpkg_Files.h" #include "Paragraphs.h" #include "BinaryParagraph.h" -namespace vcpkg +namespace vcpkg::Commands::Cache { static std::vector<BinaryParagraph> read_all_binary_paragraphs(const vcpkg_paths& paths) { @@ -34,11 +35,12 @@ namespace vcpkg return output; } - void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(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 cached libraries.\n%s", create_example_string("cache png")); + "The argument should be a substring to search for, or no argument to display all cached libraries.\n%s", Commands::Help::create_example_string("cache png")); args.check_max_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); const std::vector<BinaryParagraph> binary_paragraphs = read_all_binary_paragraphs(paths); if (binary_paragraphs.empty()) diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp new file mode 100644 index 000000000..315308a62 --- /dev/null +++ b/toolsrc/src/commands_ci.cpp @@ -0,0 +1,120 @@ +#include "pch.h" +#include "vcpkg_Commands.h" +#include "vcpkglib.h" +#include "vcpkg_Files.h" +#include "vcpkg_System.h" +#include "vcpkg_Dependencies.h" +#include "vcpkg_Input.h" +#include "vcpkg_Chrono.h" +#include "Paragraphs.h" + +namespace vcpkg::Commands::CI +{ + using Dependencies::package_spec_with_install_plan; + using Dependencies::install_plan_type; + using Build::BuildResult; + + static std::vector<package_spec> load_all_package_specs(const fs::path& ports_directory, const triplet& target_triplet) + { + std::vector<SourceParagraph> ports = Paragraphs::load_all_ports(ports_directory); + std::vector<package_spec> specs; + for (const SourceParagraph& p : ports) + { + specs.push_back(package_spec::from_name_and_triplet(p.name, target_triplet).get_or_throw()); + } + + return specs; + } + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + static const std::string example = Commands::Help::create_example_string("ci x64-windows"); + args.check_max_arg_count(1, example); + const triplet target_triplet = args.command_arguments.size() == 1 ? triplet::from_canonical_name(args.command_arguments.at(0)) : default_target_triplet; + Input::check_triplet(target_triplet, paths); + args.check_and_get_optional_command_arguments({}); + const std::vector<package_spec> specs = load_all_package_specs(paths.ports, target_triplet); + + StatusParagraphs status_db = database_load_check(paths); + const std::vector<package_spec_with_install_plan> install_plan = Dependencies::create_install_plan(paths, specs, status_db); + Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); + + std::vector<BuildResult> results; + std::vector<std::chrono::milliseconds::rep> timing; + const ElapsedTime timer = ElapsedTime::createStarted(); + size_t counter = 0; + const size_t package_count = install_plan.size(); + for (const package_spec_with_install_plan& action : install_plan) + { + const ElapsedTime build_timer = ElapsedTime::createStarted(); + counter++; + System::println("Starting package %d/%d: %s", counter, package_count, action.spec.toString()); + + timing.push_back(-1); + results.push_back(BuildResult::NULLVALUE); + + try + { + if (action.plan.plan_type == install_plan_type::ALREADY_INSTALLED) + { + results.back() = BuildResult::SUCCEEDED; + System::println(System::color::success, "Package %s is already installed", action.spec); + } + else if (action.plan.plan_type == install_plan_type::BUILD_AND_INSTALL) + { + const BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), status_db); + timing.back() = build_timer.elapsed<std::chrono::milliseconds>().count(); + results.back() = result; + if (result != BuildResult::SUCCEEDED) + { + System::println(System::color::error, Build::create_error_message(result, action.spec)); + continue; + } + const BinaryParagraph bpgh = Paragraphs::try_load_cached_package(paths, action.spec).get_or_throw(); + Install::install_package(paths, bpgh, &status_db); + System::println(System::color::success, "Package %s is installed", action.spec); + } + else if (action.plan.plan_type == install_plan_type::INSTALL) + { + results.back() = BuildResult::SUCCEEDED; + Install::install_package(paths, *action.plan.binary_pgh, &status_db); + System::println(System::color::success, "Package %s is installed from cache", action.spec); + } + else + Checks::unreachable(); + } + catch (const std::exception& e) + { + System::println(System::color::error, "Error: Could not install package %s: %s", action.spec, e.what()); + results.back() = BuildResult::NULLVALUE; + } + System::println("Elapsed time for package %s: %s", action.spec, build_timer.toString()); + } + + System::println("Total time taken: %s", timer.toString()); + + for (size_t i = 0; i < results.size(); i++) + { + System::println("%s: %s: %dms", install_plan[i].spec.toString(), Build::to_string(results[i]), timing[i]); + } + + std::map<BuildResult, int> summary; + for (const BuildResult& v : Build::BuildResult_values) + { + summary[v] = 0; + } + + for (const BuildResult& r : results) + { + summary[r]++; + } + + System::println("\n\nSUMMARY"); + for (const std::pair<const BuildResult, int>& entry : summary) + { + System::println(" %s: %d", Build::to_string(entry.first), entry.second); + } + + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_contact.cpp b/toolsrc/src/commands_contact.cpp new file mode 100644 index 000000000..29f0d4d27 --- /dev/null +++ b/toolsrc/src/commands_contact.cpp @@ -0,0 +1,21 @@ +#include "pch.h" +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" + +namespace vcpkg::Commands::Contact +{ + const std::string& email() + { + static const std::string s_email = R"(vcpkg@microsoft.com)"; + return s_email; + } + + void perform_and_exit(const vcpkg_cmd_arguments& args) + { + args.check_exact_arg_count(0); + args.check_and_get_optional_command_arguments({}); + + System::println("Send an email to %s with any feedback.", email()); + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index ad00cd676..b74693ed5 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -1,37 +1,41 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" #include "vcpkg_Environment.h" #include "vcpkg_Files.h" #include "vcpkg_Input.h" +#include "vcpkglib.h" -namespace vcpkg +namespace vcpkg::Commands::Create { - void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(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")###"); + static const std::string example = Commands::Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib1211.zip "zlib1211-2.zip")###"); args.check_max_arg_count(3, example); args.check_min_arg_count(2, example); - + args.check_and_get_optional_command_arguments({}); const std::string port_name = args.command_arguments.at(0); - Environment::ensure_utilities_on_path(paths); + const std::string url = args.command_arguments.at(1); + + const fs::path& cmake_exe = paths.get_cmake_exe(); + + std::vector<CMakeVariable> cmake_args + { + { L"CMD", L"CREATE" }, + { L"PORT", port_name }, + { L"URL", url } + }; - // 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)); + cmake_args.push_back({ L"FILENAME", 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)); + const std::wstring cmd_launch_cmake = make_cmake_cmd(cmake_exe, paths.ports_cmake, cmake_args); + exit(System::cmd_execute_clean(cmd_launch_cmake)); } } diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index fbf4eab62..ce0557e09 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -1,33 +1,71 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" #include "vcpkg_Input.h" +#include "vcpkg_Environment.h" -namespace vcpkg +namespace vcpkg::Commands::Edit { - void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { - static const std::string example = create_example_string("edit zlib"); + static const std::string example = Commands::Help::create_example_string("edit zlib"); args.check_exact_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); const std::string port_name = args.command_arguments.at(0); const fs::path portpath = paths.ports / port_name; + Checks::check_exit(fs::is_directory(portpath), R"(Could not find port named "%s")", port_name); + + // Find the user's selected editor + std::wstring env_EDITOR; + + if (env_EDITOR.empty()) + { + const optional<std::wstring> env_EDITOR_optional = System::get_environmental_variable(L"EDITOR"); + if (env_EDITOR_optional) + { + env_EDITOR = *env_EDITOR_optional; + } + } - // 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)"; + const fs::path CODE_EXE_PATH = Environment::get_ProgramFiles_32_bit() / "Microsoft VS Code/Code.exe"; if (fs::exists(CODE_EXE_PATH)) { env_EDITOR = CODE_EXE_PATH; } - else + } + + if (env_EDITOR.empty()) + { + static const std::array<const wchar_t*, 4> regkeys = { + LR"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)", + LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)", + LR"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)", + LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)", + }; + for (auto&& keypath : regkeys) { - Checks::exit_with_message("Visual Studio Code was not found and the environmental variable EDITOR is not set"); + auto code_installpath = System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, L"InstallLocation"); + if (code_installpath) + { + auto p = fs::path(*code_installpath) / "Code.exe"; + if (fs::exists(p)) + { + env_EDITOR = p.native(); + break; + } + } } } - std::wstring cmdLine = Strings::wformat(LR"("%s" "%s" "%s")", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native()); + if (env_EDITOR.empty()) + { + Checks::exit_with_message("Visual Studio Code was not found and the environment variable EDITOR is not set"); + } + + std::wstring cmdLine = Strings::wformat(LR"("%s" "%s" "%s" -n)", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native()); exit(System::cmd_execute(cmdLine)); } } diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/commands_hash.cpp index 0e3e8a77c..805da4153 100644 --- a/toolsrc/src/commands_hash.cpp +++ b/toolsrc/src/commands_hash.cpp @@ -1,7 +1,8 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" -namespace vcpkg +namespace vcpkg::Commands::Hash { static void do_file_hash(fs::path const& path, std::wstring const& hashType) { @@ -23,12 +24,13 @@ namespace vcpkg System::println(hash); } - void hash_command(const vcpkg_cmd_arguments& args) + void perform_and_exit(const vcpkg_cmd_arguments& args) { static const std::string example = Strings::format( - "The argument should be a file path\n%s", create_example_string("hash boost_1_62_0.tar.bz2")); + "The argument should be a file path\n%s", Commands::Help::create_example_string("hash boost_1_62_0.tar.bz2")); args.check_min_arg_count(1, example); args.check_max_arg_count(2, example); + args.check_and_get_optional_command_arguments({}); if (args.command_arguments.size() == 1) { diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index fd02d948e..49b5697c3 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -1,22 +1,74 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" -#include "vcpkg_info.h" -namespace vcpkg +namespace vcpkg::Commands::Help { - void version_command(const vcpkg_cmd_arguments& args) + void help_topic_valid_triplet(const vcpkg_paths& paths) { - args.check_exact_arg_count(0); - System::println("Vcpkg package management program version %s\n" - "\n" - "See LICENSE.txt for license information.", Info::version() - ); - exit(EXIT_SUCCESS); + System::println("Available architecture triplets:"); + auto it = fs::directory_iterator(paths.triplets); + for (; it != fs::directory_iterator(); ++it) + { + System::println(" %s", it->path().stem().filename().string()); + } + } + + void print_usage() + { + 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" + " vcpkg remove --purge <pkg> Uninstall and delete a package. \n" + " vcpkg list List installed packages\n" + " vcpkg update Display list of packages for updating\n" + " vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512\n" + "\n" + "%s" // Integration help + "\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" + " vcpkg owns <pat> Search for files in installed packages\n" + " vcpkg cache List cached compiled packages\n" + " vcpkg version Display version information\n" + " vcpkg contact Display contact information to send feedback\n" + "\n" + //"internal commands:\n" + //" --check-build-deps <controlfile>\n" + //" --create-binary-control <controlfile>\n" + //"\n" + "Options:\n" + " --triplet <t> Specify the target architecture 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" + "\n" + "For more help (including examples) see the accompanying README.md." + , Integrate::INTEGRATE_COMMAND_HELPSTRING); + } + + std::string create_example_string(const std::string& command_and_arguments) + { + std::string cs = Strings::format("Example:\n" + " vcpkg %s", command_and_arguments); + return cs; + } + + void print_example(const std::string& command_and_arguments) + { + System::println(create_example_string(command_and_arguments)); } - void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { args.check_max_arg_count(1); + args.check_and_get_optional_command_arguments({}); + if (args.command_arguments.empty()) { print_usage(); @@ -35,21 +87,4 @@ namespace vcpkg } exit(EXIT_SUCCESS); } - - void contact_command(const vcpkg_cmd_arguments& args) - { - args.check_exact_arg_count(0); - System::println("Send an email to %s with any feedback.", Info::email()); - exit(EXIT_SUCCESS); - } - - void help_topic_valid_triplet(const vcpkg_paths& paths) - { - System::println("Available architecture triplets:"); - auto it = fs::directory_iterator(paths.triplets); - for (; it != fs::directory_iterator(); ++it) - { - System::println(" %s", it->path().stem().filename().string()); - } - } } diff --git a/toolsrc/src/commands_helpers.cpp b/toolsrc/src/commands_helpers.cpp new file mode 100644 index 000000000..0c7ce15bb --- /dev/null +++ b/toolsrc/src/commands_helpers.cpp @@ -0,0 +1,7 @@ +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" + +namespace vcpkg::Commands::Helpers +{ + +} diff --git a/toolsrc/src/commands_import.cpp b/toolsrc/src/commands_import.cpp index 3832f0e7b..11924b4b2 100644 --- a/toolsrc/src/commands_import.cpp +++ b/toolsrc/src/commands_import.cpp @@ -1,10 +1,10 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "Paragraphs.h" #include "StatusParagraph.h" #include "vcpkg_Files.h" -#include <fstream> -namespace vcpkg +namespace vcpkg::Commands::Import { struct Binaries { @@ -12,26 +12,13 @@ namespace vcpkg std::vector<fs::path> libs; }; - static Binaries detect_files_in_directory_ending_with(const fs::path& path) + static Binaries find_binaries_in_dir(const fs::path& path) { Files::check_is_directory(path); Binaries binaries; - - for (auto it = fs::recursive_directory_iterator(path); it != fs::recursive_directory_iterator(); ++it) - { - fs::path file = *it; - // Skip if directory ????? - if (file.extension() == ".dll") - { - binaries.dlls.push_back(file); - } - else if (file.extension() == ".lib") - { - binaries.libs.push_back(file); - } - } - + binaries.dlls = Files::recursive_find_files_with_extension_in_dir(path, ".dll"); + binaries.libs = Files::recursive_find_files_with_extension_in_dir(path, ".lib"); return binaries; } @@ -51,8 +38,8 @@ namespace vcpkg Files::check_is_directory(include_directory); Files::check_is_directory(project_directory); Files::check_is_directory(destination_path); - Binaries debug_binaries = detect_files_in_directory_ending_with(project_directory / "Debug"); - Binaries release_binaries = detect_files_in_directory_ending_with(project_directory / "Release"); + Binaries debug_binaries = find_binaries_in_dir(project_directory / "Debug"); + Binaries release_binaries = find_binaries_in_dir(project_directory / "Release"); fs::path destination_include_directory = destination_path / "include"; fs::copy(include_directory, destination_include_directory, fs::copy_options::recursive | fs::copy_options::overwrite_existing); @@ -75,17 +62,18 @@ namespace vcpkg std::ofstream(control_file_path) << control_file_data; } - void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(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)"); + static const std::string example = Commands::Help::create_example_string(R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"); args.check_exact_arg_count(3, example); + args.check_and_get_optional_command_arguments({}); 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 = Paragraphs::get_paragraphs(control_file_path); - Checks::check_throw(pghs.size() == 1, "Invalid control file for package"); + Checks::check_exit(pghs.size() == 1, "Invalid control file %s for package", control_file_path.generic_string()); StatusParagraph spgh; spgh.package = BinaryParagraph(pghs[0]); diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp new file mode 100644 index 000000000..bb3df943c --- /dev/null +++ b/toolsrc/src/commands_install.cpp @@ -0,0 +1,247 @@ +#include "pch.h" +#include "vcpkg_Commands.h" +#include "vcpkglib.h" +#include "metrics.h" +#include "vcpkg_Files.h" +#include "vcpkg_System.h" +#include "vcpkg_Dependencies.h" +#include "vcpkg_Input.h" +#include "Paragraphs.h" + +namespace vcpkg::Commands::Install +{ + using Dependencies::package_spec_with_install_plan; + using Dependencies::install_plan_type; + + static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryParagraph& bpgh) + { + std::vector<std::string> output; + + const fs::path package_prefix_path = paths.package_dir(bpgh.spec); + const size_t 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 / target_triplet_as_string, ec); + output.push_back(Strings::format(R"(%s/)", target_triplet_as_string)); + + for (auto it = fs::recursive_directory_iterator(package_prefix_path); it != fs::recursive_directory_iterator(); ++it) + { + const std::string filename = it->path().filename().generic_string(); + if (fs::is_regular_file(it->status()) && (_stricmp(filename.c_str(), "CONTROL") == 0 || _stricmp(filename.c_str(), "BUILD_INFO") == 0)) + { + // Do not copy the control file + continue; + } + + const std::string suffix = it->path().generic_u8string().substr(prefix_length + 1); + const fs::path target = paths.installed / target_triplet_as_string / suffix; + + auto status = it->status(ec); + if (ec) + { + System::println(System::color::error, "failed: %s: %s", it->path().u8string(), ec.message()); + continue; + } + + if (fs::is_directory(status)) + { + fs::create_directory(target, ec); + if (ec) + { + System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message()); + } + + // Trailing backslash for directories + output.push_back(Strings::format(R"(%s/%s/)", target_triplet_as_string, suffix)); + continue; + } + + if (fs::is_regular_file(status)) + { + if (fs::exists(target)) + { + System::println(System::color::warning, "File %s was already present and will be overwritten", target.u8string(), ec.message()); + } + fs::copy_file(*it, target, fs::copy_options::overwrite_existing, ec); + if (ec) + { + System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message()); + } + output.push_back(Strings::format(R"(%s/%s)", target_triplet_as_string, suffix)); + continue; + } + + if (!fs::status_known(status)) + { + System::println(System::color::error, "failed: %s: unknown status", it->path().u8string()); + continue; + } + + System::println(System::color::error, "failed: %s: cannot handle file type", it->path().u8string()); + } + + std::sort(output.begin(), output.end()); + + Files::write_all_lines(paths.listfile_path(bpgh), output); + } + + static void remove_first_n_chars(std::vector<std::string>* strings, const size_t n) + { + for (std::string& s : *strings) + { + s.erase(0, n); + } + }; + + static std::vector<std::string> extract_files_in_triplet(const std::vector<StatusParagraph_and_associated_files>& pgh_and_files, const triplet& triplet) + { + std::vector<std::string> output; + for (const StatusParagraph_and_associated_files& t : pgh_and_files) + { + if (t.pgh.package.spec.target_triplet() != triplet) + { + continue; + } + + output.insert(output.end(), t.files.cbegin(), t.files.cend()); + } + + std::sort(output.begin(), output.end()); + return output; + } + + static ImmutableSortedVector<std::string> build_list_of_package_files(const fs::path& package_dir) + { + const std::vector<fs::path> package_file_paths = Files::recursive_find_all_files_in_dir(package_dir); + std::vector<std::string> package_files; + const size_t package_remove_char_count = package_dir.generic_string().size() + 1; // +1 for the slash + std::transform(package_file_paths.cbegin(), package_file_paths.cend(), std::back_inserter(package_files), [package_remove_char_count](const fs::path& path) + { + std::string as_string = path.generic_string(); + as_string.erase(0, package_remove_char_count); + return std::move(as_string); + }); + + return ImmutableSortedVector<std::string>::create(std::move(package_files)); + } + + static ImmutableSortedVector<std::string> build_list_of_installed_files(const std::vector<StatusParagraph_and_associated_files>& pgh_and_files, const triplet& triplet) + { + std::vector<std::string> installed_files = extract_files_in_triplet(pgh_and_files, triplet); + const size_t installed_remove_char_count = triplet.canonical_name().size() + 1; // +1 for the slash + remove_first_n_chars(&installed_files, installed_remove_char_count); + + return ImmutableSortedVector<std::string>::create(std::move(installed_files)); + } + + void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db) + { + const fs::path package_dir = paths.package_dir(binary_paragraph.spec); + const triplet& triplet = binary_paragraph.spec.target_triplet(); + const std::vector<StatusParagraph_and_associated_files> pgh_and_files = get_installed_files(paths, *status_db); + + const ImmutableSortedVector<std::string> package_files = build_list_of_package_files(package_dir); + const ImmutableSortedVector<std::string> installed_files = build_list_of_installed_files(pgh_and_files, triplet); + + std::vector<std::string> intersection; + std::set_intersection(package_files.cbegin(), package_files.cend(), + installed_files.cbegin(), installed_files.cend(), + std::back_inserter(intersection)); + + if (!intersection.empty()) + { + const fs::path triplet_install_path = paths.installed / triplet.canonical_name(); + System::println(System::color::error, "The following files are already installed in %s and are in conflict with %s", + triplet_install_path.generic_string(), + binary_paragraph.spec); + System::print("\n "); + System::println(Strings::join("\n ", intersection)); + System::println(""); + exit(EXIT_FAILURE); + } + + StatusParagraph spgh; + spgh.package = binary_paragraph; + spgh.want = want_t::install; + spgh.state = install_state_t::half_installed; + for (auto&& dep : spgh.package.depends) + { + if (status_db->find_installed(dep, spgh.package.spec.target_triplet()) == status_db->end()) + { + Checks::unreachable(); + } + } + write_update(paths, spgh); + status_db->insert(std::make_unique<StatusParagraph>(spgh)); + + install_and_write_listfile(paths, spgh.package); + + spgh.state = install_state_t::installed; + write_update(paths, spgh); + status_db->insert(std::make_unique<StatusParagraph>(spgh)); + } + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + static const std::string example = Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost"); + args.check_min_arg_count(1, example); + std::vector<package_spec> specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example); + Input::check_triplets(specs, paths); + args.check_and_get_optional_command_arguments({}); + + StatusParagraphs status_db = database_load_check(paths); + std::vector<package_spec_with_install_plan> install_plan = Dependencies::create_install_plan(paths, specs, status_db); + Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); + + std::string specs_string = install_plan[0].spec.toString(); + for (size_t i = 1; i < install_plan.size(); ++i) + { + specs_string.push_back(','); + specs_string.append(install_plan[i].spec.toString()); + } + TrackProperty("installplan", specs_string); + + for (const package_spec_with_install_plan& action : install_plan) + { + try + { + if (action.plan.plan_type == install_plan_type::ALREADY_INSTALLED) + { + if (std::find(specs.begin(), specs.end(), action.spec) != specs.end()) + { + System::println(System::color::success, "Package %s is already installed", action.spec); + } + } + else if (action.plan.plan_type == install_plan_type::BUILD_AND_INSTALL) + { + const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), status_db); + if (result != Build::BuildResult::SUCCEEDED) + { + System::println(System::color::error, Build::create_error_message(result, action.spec)); + System::println(Build::create_user_troubleshooting_message(action.spec)); + exit(EXIT_FAILURE); + } + const BinaryParagraph bpgh = Paragraphs::try_load_cached_package(paths, action.spec).get_or_throw(); + install_package(paths, bpgh, &status_db); + System::println(System::color::success, "Package %s is installed", action.spec); + } + else if (action.plan.plan_type == install_plan_type::INSTALL) + { + install_package(paths, *action.plan.binary_pgh, &status_db); + System::println(System::color::success, "Package %s is installed", action.spec); + } + else + Checks::unreachable(); + } + catch (const std::exception& e) + { + System::println(System::color::error, "Error: Could not install package %s: %s", action.spec, e.what()); + exit(EXIT_FAILURE); + } + } + + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp deleted file mode 100644 index 8d940bc9d..000000000 --- a/toolsrc/src/commands_installation.cpp +++ /dev/null @@ -1,368 +0,0 @@ -#include "vcpkg_Commands.h" -#include "vcpkg.h" -#include <fstream> -#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" -#include "vcpkg_Maps.h" -#include "vcpkg_info.h" - -namespace vcpkg -{ - using Dependencies::package_spec_with_install_plan; - using Dependencies::install_plan_type; - - static const std::string OPTION_CHECKS_ONLY = "--checks-only"; - - static void create_binary_control_file(const vcpkg_paths& paths, const SourceParagraph& source_paragraph, const triplet& target_triplet) - { - const BinaryParagraph bpgh = BinaryParagraph(source_paragraph, target_triplet); - const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL"; - std::ofstream(binary_control_file) << bpgh; - } - - static void build_internal(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) - { - Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_internal()"); - const triplet& target_triplet = spec.target_triplet(); - - const fs::path ports_cmake_script_path = paths.ports_cmake; - 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(source_paragraph.name), - Strings::utf8_to_utf16(target_triplet.canonical_name()), - port_dir.generic_wstring(), - ports_cmake_script_path.generic_wstring()); - - System::Stopwatch2 timer; - timer.start(); - int return_code = System::cmd_execute(command); - timer.stop(); - TrackMetric("buildtimeus-" + to_string(spec), timer.microseconds()); - - if (return_code != 0) - { - 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), Info::version()); - TrackProperty("error", "build failed"); - TrackProperty("build_error", to_string(spec)); - exit(EXIT_FAILURE); - } - - PostBuildLint::perform_all_checks(spec, paths); - - create_binary_control_file(paths, source_paragraph, target_triplet); - - // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name; - // delete_directory(port_buildtrees_dir); - } - - static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryParagraph& bpgh) - { - std::vector<std::string> output; - - const fs::path package_prefix_path = paths.package_dir(bpgh.spec); - const size_t 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 / target_triplet_as_string, ec); - output.push_back(Strings::format(R"(%s)", target_triplet_as_string)); - - for (auto it = fs::recursive_directory_iterator(package_prefix_path); it != fs::recursive_directory_iterator(); ++it) - { - const std::string filename = it->path().filename().generic_string(); - if (fs::is_regular_file(it->status()) && (_stricmp(filename.c_str(), "CONTROL") == 0 || _stricmp(filename.c_str(), "BUILD_INFO") == 0)) - { - // Do not copy the control file - continue; - } - - const std::string suffix = it->path().generic_u8string().substr(prefix_length + 1); - const fs::path target = paths.installed / target_triplet_as_string / suffix; - - auto status = it->status(ec); - if (ec) - { - System::println(System::color::error, "failed: %s: %s", it->path().u8string(), ec.message()); - continue; - } - - if (fs::is_directory(status)) - { - fs::create_directory(target, ec); - if (ec) - { - System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message()); - } - - // Trailing backslash for directories - output.push_back(Strings::format(R"(%s/%s)", target_triplet_as_string, suffix)); - continue; - } - - if (fs::is_regular_file(status)) - { - if (fs::exists(target)) - { - System::println(System::color::warning, "File %s was already present and will be overwritten", target.u8string(), ec.message()); - } - fs::copy_file(*it, target, fs::copy_options::overwrite_existing, ec); - if (ec) - { - System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message()); - } - output.push_back(Strings::format(R"(%s/%s)", target_triplet_as_string, suffix)); - continue; - } - - if (!fs::status_known(status)) - { - System::println(System::color::error, "failed: %s: unknown status", it->path().u8string()); - continue; - } - - System::println(System::color::error, "failed: %s: cannot handle file type", it->path().u8string()); - } - - Files::write_all_lines(paths.listfile_path(bpgh), output); - } - - static void remove_first_n_chars(std::vector<std::string>* strings, const size_t n) - { - for (std::string& s : *strings) - { - s.erase(0, n); - } - }; - - static std::vector<std::string> extract_files_in_triplet(const std::vector<StatusParagraph_and_associated_files>& pgh_and_files, const triplet& triplet) - { - std::vector<std::string> output; - for (const StatusParagraph_and_associated_files& t : pgh_and_files) - { - if (t.pgh.package.spec.target_triplet() != triplet) - { - continue; - } - - output.insert(output.end(), t.files.cbegin(), t.files.cend()); - } - - std::sort(output.begin(), output.end()); - return output; - } - - void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db) - { - const fs::path package_dir = paths.package_dir(binary_paragraph.spec); - const std::vector<fs::path> package_file_paths = Files::recursive_find_all_files_in_dir(package_dir); - std::vector<std::string> package_files; - const size_t package_remove_char_count = package_dir.generic_string().size() + 1; // +1 for the slash - std::transform(package_file_paths.cbegin(), package_file_paths.cend(), std::back_inserter(package_files), [package_remove_char_count](const fs::path& path) - { - std::string as_string = path.generic_string(); - as_string.erase(0, package_remove_char_count); - return std::move(as_string); - }); - std::sort(package_files.begin(), package_files.end()); - - const std::vector<StatusParagraph_and_associated_files>& pgh_and_files = get_installed_files(paths, status_db); - const triplet& triplet = binary_paragraph.spec.target_triplet(); - std::vector<std::string> installed_files = extract_files_in_triplet(pgh_and_files, triplet); - const size_t installed_remove_char_count = triplet.canonical_name().size() + 1; // +1 for the slash - remove_first_n_chars(&installed_files, installed_remove_char_count); - std::sort(installed_files.begin(), installed_files.end()); // Should already be sorted - - std::vector<std::string> intersection; - std::set_intersection(package_files.cbegin(), package_files.cend(), - installed_files.cbegin(), installed_files.cend(), - std::back_inserter(intersection)); - - if (!intersection.empty()) - { - const fs::path triplet_install_path = paths.installed / triplet.canonical_name(); - System::println(System::color::error, "The following files are already installed in %s and are in conflict with %s", - triplet_install_path.generic_string(), - binary_paragraph.spec); - System::println(""); - for (const std::string& s : intersection) - { - System::println(" %s", s); - } - System::println(""); - exit(EXIT_FAILURE); - } - - StatusParagraph spgh; - spgh.package = binary_paragraph; - spgh.want = want_t::install; - spgh.state = install_state_t::half_installed; - for (auto&& dep : spgh.package.depends) - { - if (status_db.find_installed(dep, spgh.package.spec.target_triplet()) == status_db.end()) - { - Checks::unreachable(); - } - } - write_update(paths, spgh); - status_db.insert(std::make_unique<StatusParagraph>(spgh)); - - install_and_write_listfile(paths, spgh.package); - - spgh.state = install_state_t::installed; - write_update(paths, spgh); - status_db.insert(std::make_unique<StatusParagraph>(spgh)); - } - - 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); - StatusParagraphs status_db = database_load_check(paths); - - std::vector<package_spec> specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example); - Input::check_triplets(specs, paths); - std::vector<package_spec_with_install_plan> install_plan = Dependencies::create_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].spec); - for (size_t i = 1; i < install_plan.size(); ++i) - { - specs_string.push_back(','); - specs_string.append(to_string(install_plan[i].spec)); - } - TrackProperty("installplan", specs_string); - Environment::ensure_utilities_on_path(paths); - - for (const package_spec_with_install_plan& action : install_plan) - { - try - { - if (action.plan.type == install_plan_type::ALREADY_INSTALLED) - { - if (std::find(specs.begin(), specs.end(), action.spec) != specs.end()) - { - System::println(System::color::success, "Package %s is already installed", action.spec); - } - } - else if (action.plan.type == install_plan_type::BUILD_AND_INSTALL) - { - build_internal(*action.plan.spgh, action.spec, paths, paths.port_dir(action.spec)); - const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); - install_package(paths, bpgh, status_db); - System::println(System::color::success, "Package %s is installed", action.spec); - } - else if (action.plan.type == install_plan_type::INSTALL) - { - install_package(paths, *action.plan.bpgh, status_db); - System::println(System::color::success, "Package %s is installed", action.spec); - } - else - Checks::unreachable(); - } - catch (const std::exception& e) - { - System::println(System::color::error, "Error: Could not install package %s: %s", action.spec, e.what()); - exit(EXIT_FAILURE); - } - } - - exit(EXIT_SUCCESS); - } - - void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) - { - static const std::string example = create_example_string("build zlib:x64-windows"); - - // Installing multiple packages leads to unintuitive behavior if one of them depends on another. - // Allowing only 1 package for now. - - args.check_exact_arg_count(1, example); - - StatusParagraphs status_db = database_load_check(paths); - - const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); - Input::check_triplet(spec.target_triplet(), paths); - - const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY}); - if (options.find(OPTION_CHECKS_ONLY) != options.end()) - { - PostBuildLint::perform_all_checks(spec, paths); - exit(EXIT_SUCCESS); - } - - // Explicitly load and use the portfile's build dependencies when resolving the build command (instead of a cached package's dependencies). - const expected<SourceParagraph> maybe_spgh = try_load_port(paths, spec.name()); - Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message()); - const SourceParagraph& spgh = *maybe_spgh.get(); - - const std::vector<std::string> first_level_deps = filter_dependencies(spgh.depends, spec.target_triplet()); - - std::vector<package_spec> first_level_deps_specs; - for (const std::string& dep : first_level_deps) - { - first_level_deps_specs.push_back(package_spec::from_name_and_triplet(dep, spec.target_triplet()).get_or_throw()); - } - - std::vector<package_spec_with_install_plan> unmet_dependencies = Dependencies::create_install_plan(paths, first_level_deps_specs, status_db); - unmet_dependencies.erase( - std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [](const package_spec_with_install_plan& p) - { - return p.plan.type == install_plan_type::ALREADY_INSTALLED; - }), - unmet_dependencies.end()); - - if (!unmet_dependencies.empty()) - { - 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_with_install_plan& p : unmet_dependencies) - { - System::println(" %s", to_string(p.spec)); - } - System::println(""); - exit(EXIT_FAILURE); - } - - Environment::ensure_utilities_on_path(paths); - build_internal(spgh, spec, paths, paths.port_dir(spec)); - exit(EXIT_SUCCESS); - } - - void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) - { - 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); - - expected<package_spec> maybe_current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet); - if (auto spec = maybe_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); - const expected<SourceParagraph> maybe_spgh = try_load_port(port_dir); - if (auto spgh = maybe_spgh.get()) - { - build_internal(*spgh, *spec, paths, port_dir); - exit(EXIT_SUCCESS); - } - } - - System::println(System::color::error, "Error: %s: %s", maybe_current_spec.error_code().message(), args.command_arguments[0]); - print_example(Strings::format("%s zlib:x64-windows", args.command)); - exit(EXIT_FAILURE); - } -} diff --git a/toolsrc/src/commands_integration.cpp b/toolsrc/src/commands_integrate.cpp index e7e5b2d8d..f98b9f77c 100644 --- a/toolsrc/src/commands_integration.cpp +++ b/toolsrc/src/commands_integrate.cpp @@ -1,22 +1,17 @@ -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <shellapi.h> +#include "pch.h" #include "vcpkg_Commands.h" -#include <fstream> -#include <regex> -#include <array> #include "vcpkg_Environment.h" #include "vcpkg_Checks.h" #include "vcpkg_System.h" #include "vcpkg_Files.h" -namespace vcpkg +namespace vcpkg::Commands::Integrate { static const std::array<fs::path, 2> old_system_target_files = { - "C:/Program Files (x86)/MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets", - "C:/Program Files (x86)/MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets" + Environment::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets", + Environment::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets" }; - static const fs::path system_wide_targets_file = "C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props"; + static const fs::path system_wide_targets_file = Environment::get_ProgramFiles_32_bit() / "MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props"; static std::string create_appdata_targets_shortcut(const std::string& target_path) noexcept { @@ -114,7 +109,7 @@ namespace vcpkg static elevation_prompt_user_choice elevated_cmd_execute(const std::string& param) { - SHELLEXECUTEINFO shExInfo = {0}; + SHELLEXECUTEINFO shExInfo = { 0 }; shExInfo.cbSize = sizeof(shExInfo); shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS; shExInfo.hwnd = nullptr; @@ -141,7 +136,7 @@ namespace vcpkg static fs::path get_appdata_targets_path() { - return fs::path(System::wdupenv_str(L"LOCALAPPDATA")) / "vcpkg" / "vcpkg.user.targets"; + return fs::path(*System::get_environmental_variable(L"LOCALAPPDATA")) / "vcpkg" / "vcpkg.user.targets"; } static void integrate_install(const vcpkg_paths& paths) @@ -171,20 +166,17 @@ namespace vcpkg fs::create_directory(tmp_dir); bool should_install_system = true; - if (fs::exists(system_wide_targets_file)) + const expected<std::string> system_wide_file_contents = Files::read_contents(system_wide_targets_file); + if (auto contents_data = system_wide_file_contents.get()) { - auto system_wide_file_contents = Files::read_contents(system_wide_targets_file); - if (auto contents_data = system_wide_file_contents.get()) + std::regex re(R"###(<!-- version (\d+) -->)###"); + std::match_results<std::string::const_iterator> match; + auto found = std::regex_search(*contents_data, match, re); + if (found) { - std::regex re(R"###(<!-- version (\d+) -->)###"); - std::match_results<std::string::const_iterator> match; - auto found = std::regex_search(*contents_data, match, re); - if (found) - { - int ver = atoi(match[1].str().c_str()); - if (ver >= 1) - should_install_system = false; - } + int ver = atoi(match[1].str().c_str()); + if (ver >= 1) + should_install_system = false; } } @@ -219,37 +211,45 @@ namespace vcpkg exit(EXIT_FAILURE); } System::println(System::color::success, "Applied user-wide integration for this vcpkg root."); + const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake"; System::println("\n" - "All C++ projects can now #include any installed libraries.\n" - "Linking will be handled automatically.\n" - "Installing new libraries will make them instantly available."); + "All MSBuild C++ projects can now #include any installed libraries.\n" + "Linking will be handled automatically.\n" + "Installing new libraries will make them instantly available.\n" + "\n" + "CMake projects should use -DCMAKE_TOOLCHAIN_FILE=%s", cmake_toolchain.generic_string()); exit(EXIT_SUCCESS); } static void integrate_remove() { - auto path = get_appdata_targets_path(); - if (!fs::exists(path)) + const fs::path path = get_appdata_targets_path(); + + std::error_code ec; + bool was_deleted = fs::remove(path, ec); + + if (ec) { - System::println(System::color::success, "User-wide integration is not installed"); - exit(EXIT_SUCCESS); + System::println(System::color::error, "Error: Unable to remove user-wide integration: %d", ec.message()); + exit(EXIT_FAILURE); } - 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) + if (was_deleted) + { + System::println(System::color::success, "User-wide integration was removed"); + } + else { - System::println(System::color::error, "Error: Unable to remove user-wide integration: %d", exit_code); - exit(exit_code); + System::println(System::color::success, "User-wide integration is not installed"); } - System::println(System::color::success, "User-wide integration was removed"); + exit(EXIT_SUCCESS); } static void integrate_project(const vcpkg_paths& paths) { - Environment::ensure_nuget_on_path(paths); + const fs::path& nuget_exe = paths.get_nuget_exe(); const fs::path& buildsystems_dir = paths.buildsystems; const fs::path tmp_dir = buildsystems_dir / "tmp"; @@ -267,17 +267,12 @@ 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::wformat(LR"(nuget.exe pack -OutputDirectory "%s" "%s" > nul)", buildsystems_dir.native(), nuspec_file_path.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" pack -OutputDirectory "%s" "%s" > nul)", nuget_exe.native(), buildsystems_dir.native(), nuspec_file_path.native()); - const int exit_code = System::cmd_execute(cmd_line); + const int exit_code = System::cmd_execute_clean(cmd_line); const fs::path nuget_package = buildsystems_dir / Strings::format("%s.%s.nupkg", nuget_id, nupkg_version); - if (exit_code != 0 || !fs::exists(nuget_package)) - { - System::println(System::color::error, "Error: NuGet package creation failed"); - exit(EXIT_FAILURE); - } - + Checks::check_exit(exit_code == 0 && fs::exists(nuget_package), "Error: NuGet package creation failed"); System::println(System::color::success, "Created nupkg: %s", nuget_package.string()); System::println(R"( @@ -293,11 +288,12 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console " vcpkg integrate remove Remove user-wide integration\n" " vcpkg integrate project Generate a referencing nuget package for individual VS project use\n"; - void integrate_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { static const std::string example = Strings::format("Commands:\n" "%s", INTEGRATE_COMMAND_HELPSTRING); args.check_exact_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); if (args.command_arguments[0] == "install") { diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp index cc51232e9..7bfc11f1b 100644 --- a/toolsrc/src/commands_list.cpp +++ b/toolsrc/src/commands_list.cpp @@ -1,9 +1,10 @@ +#include "pch.h" #include "vcpkg_Commands.h" -#include "vcpkg.h" +#include "vcpkglib.h" #include "vcpkg_System.h" #include "vcpkglib_helpers.h" -namespace vcpkg +namespace vcpkg::Commands::List { static void do_print(const StatusParagraph& pgh) { @@ -13,11 +14,12 @@ namespace vcpkg details::shorten_description(pgh.package.description)); } - void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(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 installed libraries.\n%s", create_example_string("list png")); + "The argument should be a substring to search for, or no argument to display all installed libraries.\n%s", Commands::Help::create_example_string("list png")); args.check_max_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); const StatusParagraphs status_paragraphs = database_load_check(paths); std::vector<StatusParagraph> installed_packages; diff --git a/toolsrc/src/commands_other.cpp b/toolsrc/src/commands_other.cpp deleted file mode 100644 index 6df325100..000000000 --- a/toolsrc/src/commands_other.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" - -namespace vcpkg -{ - void print_usage() - { - 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" - " vcpkg remove --purge <pkg> Uninstall and delete a package. \n" - " vcpkg list List installed packages\n" - " vcpkg update Display list of packages for updating\n" - " vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512\n" - "\n" - "%s" // Integration help - "\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" - " vcpkg owns <pat> Search for files in installed packages\n" - " vcpkg cache List cached compiled packages\n" - " vcpkg version Display version information\n" - " vcpkg contact Display contact information to send feedback\n" - "\n" - //"internal commands:\n" - //" --check-build-deps <controlfile>\n" - //" --create-binary-control <controlfile>\n" - //"\n" - "Options:\n" - " --triplet <t> Specify the target architecture 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" - "\n" - "For more help (including examples) see the accompanying README.md." - , INTEGRATE_COMMAND_HELPSTRING); - } - - std::string create_example_string(const std::string& command_and_arguments) - { - std::string cs = Strings::format("Example:\n" - " vcpkg %s", command_and_arguments); - return cs; - } - - void print_example(const std::string& command_and_arguments) - { - System::println(create_example_string(command_and_arguments)); - } - - void internal_test_command(const vcpkg_cmd_arguments& /*args*/, const vcpkg_paths& /*paths*/) - { - // auto data = FormatEventData("test"); - // Track(data); - exit(EXIT_SUCCESS); - } - - const std::vector<package_name_and_function<command_type_a>>& get_available_commands_type_a() - { - static std::vector<package_name_and_function<command_type_a>> t = { - {"install", install_command}, - {"remove", remove_command}, - {"build", build_command}, - {"build_external", build_external_command} - }; - return t; - } - - const std::vector<package_name_and_function<command_type_b>>& get_available_commands_type_b() - { - static std::vector<package_name_and_function<command_type_b>> t = { - {"/?", help_command}, - {"help", help_command}, - {"search", search_command}, - {"list", list_command}, - {"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}, - {"portsdiff", portsdiff_command} - }; - return t; - } - - const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c() - { - static std::vector<package_name_and_function<command_type_c>> t = { - {"version", &version_command}, - {"contact", &contact_command}, - {"hash", &hash_command}, - }; - return t; - } -} diff --git a/toolsrc/src/commands_owns.cpp b/toolsrc/src/commands_owns.cpp index 62dac57eb..16bb986e2 100644 --- a/toolsrc/src/commands_owns.cpp +++ b/toolsrc/src/commands_owns.cpp @@ -1,8 +1,9 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" -#include "vcpkg.h" +#include "vcpkglib.h" -namespace vcpkg +namespace vcpkg::Commands::Owns { static void search_file(const vcpkg_paths& paths, const std::string& file_substr, const StatusParagraphs& status_db) { @@ -21,10 +22,11 @@ namespace vcpkg } } - void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(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")); + static const std::string example = Strings::format("The argument should be a pattern to search for. %s", Commands::Help::create_example_string("owns zlib.dll")); args.check_exact_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); StatusParagraphs status_db = database_load_check(paths); search_file(paths, args.command_arguments[0], status_db); diff --git a/toolsrc/src/commands_portsdiff.cpp b/toolsrc/src/commands_portsdiff.cpp index 46c6c90c7..4d5a589f6 100644 --- a/toolsrc/src/commands_portsdiff.cpp +++ b/toolsrc/src/commands_portsdiff.cpp @@ -1,26 +1,19 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" -#include <map> -#include <iterator> #include "vcpkg_Maps.h" -#include <iostream> -#include <iomanip> -#include <set> -#include "Paragraphs.h" #include "SourceParagraph.h" #include "vcpkg_Environment.h" +#include "Paragraphs.h" -namespace vcpkg +namespace vcpkg::Commands::PortsDiff { static void do_print_name_and_version(const std::vector<std::string>& ports_to_print, const std::map<std::string, std::string>& names_and_versions) { for (const std::string& name : ports_to_print) { const std::string& version = names_and_versions.at(name); - std::cout << std::left - << std::setw(20) << name << ' ' - << std::setw(16) << version << ' ' - << '\n'; + System::println("%-20s %-16s", name, version); } } @@ -30,85 +23,59 @@ namespace vcpkg { for (const std::string& name : ports_to_print) { - if (name == "") - { - continue; - } - const std::string& previous_version = previous_names_and_versions.at(name); const std::string& current_version = current_names_and_versions.at(name); - std::cout << std::left - << std::setw(20) << name << ' ' - << std::setw(16) << previous_version << " -> " << current_version - << '\n'; - } - } - - static std::map<std::string, std::string> read_all_ports(const fs::path& ports_folder_path) - { - std::map<std::string, std::string> names_and_versions; - - for (auto it = fs::directory_iterator(ports_folder_path); it != fs::directory_iterator(); ++it) - { - const fs::path& path = it->path(); - - try - { - auto pghs = Paragraphs::get_paragraphs(path / "CONTROL"); - if (pghs.empty()) - continue; - auto srcpgh = SourceParagraph(pghs[0]); - names_and_versions.emplace(srcpgh.name, srcpgh.version); - } - catch (std::runtime_error const&) - { - } + System::println("%-20s %-16s -> %s", name, previous_version, current_version); } - - return names_and_versions; } static std::map<std::string, std::string> read_ports_from_commit(const vcpkg_paths& paths, const std::wstring& git_commit_id) { + const fs::path& git_exe = paths.get_git_exe(); const fs::path dot_git_dir = paths.root / ".git"; const std::wstring ports_dir_name_as_string = paths.ports.filename().native(); const fs::path temp_checkout_path = paths.root / Strings::wformat(L"%s-%s", ports_dir_name_as_string, git_commit_id); fs::create_directory(temp_checkout_path); const std::wstring checkout_this_dir = Strings::wformat(LR"(.\%s)", ports_dir_name_as_string); // Must be relative to the root of the repository - const std::wstring cmd = Strings::wformat(LR"(git --git-dir="%s" --work-tree="%s" checkout %s -f -q -- %s %s & git reset >NUL)", + const std::wstring cmd = Strings::wformat(LR"("%s" --git-dir="%s" --work-tree="%s" checkout %s -f -q -- %s %s & "%s" reset >NUL)", + git_exe.native(), dot_git_dir.native(), temp_checkout_path.native(), git_commit_id, checkout_this_dir, - L".vcpkg-root"); - System::cmd_execute(cmd); - std::map<std::string, std::string> names_and_versions = read_all_ports(temp_checkout_path / ports_dir_name_as_string); + L".vcpkg-root", + git_exe.native()); + System::cmd_execute_clean(cmd); + const std::vector<SourceParagraph> source_paragraphs = Paragraphs::load_all_ports(temp_checkout_path / ports_dir_name_as_string); + const std::map<std::string, std::string> names_and_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); fs::remove_all(temp_checkout_path); return names_and_versions; } - static void check_commit_exists(const std::wstring& git_commit_id) + static void check_commit_exists(const fs::path& git_exe, const std::wstring& git_commit_id) { static const std::string VALID_COMMIT_OUTPUT = "commit\n"; - const std::wstring cmd = Strings::wformat(LR"(git cat-file -t %s 2>NUL)", git_commit_id); + const std::wstring cmd = Strings::wformat(LR"("%s" cat-file -t %s 2>NUL)", git_exe.native(), git_commit_id); const System::exit_code_and_output output = System::cmd_execute_and_capture_output(cmd); Checks::check_exit(output.output == VALID_COMMIT_OUTPUT, "Invalid commit id %s", Strings::utf16_to_utf8(git_commit_id)); } - void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { - static const std::string example = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", create_example_string("portsdiff mybranchname")); + static const std::string example = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", Commands::Help::create_example_string("portsdiff mybranchname")); args.check_min_arg_count(1, example); args.check_max_arg_count(2, example); + args.check_and_get_optional_command_arguments({}); + + const fs::path& git_exe = paths.get_git_exe(); - Environment::ensure_git_on_path(paths); const std::wstring git_commit_id_for_previous_snapshot = Strings::utf8_to_utf16(args.command_arguments.at(0)); const std::wstring git_commit_id_for_current_snapshot = args.command_arguments.size() < 2 ? L"HEAD" : Strings::utf8_to_utf16(args.command_arguments.at(1)); - check_commit_exists(git_commit_id_for_current_snapshot); - check_commit_exists(git_commit_id_for_previous_snapshot); + check_commit_exists(git_exe, git_commit_id_for_current_snapshot); + check_commit_exists(git_exe, git_commit_id_for_previous_snapshot); const std::map<std::string, std::string> current_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_current_snapshot); const std::map<std::string, std::string> previous_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_previous_snapshot); diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index 445213fc2..1b7b7923a 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -1,12 +1,18 @@ +#include "pch.h" #include "vcpkg_Commands.h" -#include "vcpkg.h" +#include "vcpkglib.h" #include "vcpkg_System.h" #include "vcpkg_Input.h" -#include <fstream> +#include "vcpkg_Dependencies.h" -namespace vcpkg +namespace vcpkg::Commands::Remove { + using Dependencies::package_spec_with_remove_plan; + using Dependencies::remove_plan_type; + using Dependencies::request_type; + static const std::string OPTION_PURGE = "--purge"; + static const std::string OPTION_RECURSE = "--recurse"; static void delete_directory(const fs::path& directory) { @@ -22,78 +28,9 @@ namespace vcpkg } } - enum class deinstall_plan - { - not_installed, - dependencies_not_satisfied, - should_deinstall - }; - - static deinstall_plan deinstall_package_plan( - const StatusParagraphs::iterator package_it, - const StatusParagraphs& status_db, - std::vector<const StatusParagraph*>& dependencies_out) - { - dependencies_out.clear(); - - if (package_it == status_db.end() || (*package_it)->state == install_state_t::not_installed) - { - return deinstall_plan::not_installed; - } - - auto& pkg = (*package_it)->package; - - for (auto&& inst_pkg : status_db) - { - if (inst_pkg->want != want_t::install) - continue; - 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.spec.name()) != deps.end()) - { - dependencies_out.push_back(inst_pkg.get()); - } - } - - if (!dependencies_out.empty()) - return deinstall_plan::dependencies_not_satisfied; - - return deinstall_plan::should_deinstall; - } - - static void deinstall_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs& status_db) + static void remove_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs* status_db) { - 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); - return; - } - - auto& pkg = **package_it; - - std::vector<const StatusParagraph*> deps; - auto plan = deinstall_package_plan(package_it, status_db, deps); - switch (plan) - { - case deinstall_plan::not_installed: - System::println(System::color::success, "Package %s is not installed", spec); - return; - case deinstall_plan::dependencies_not_satisfied: - System::println(System::color::error, "Error: Cannot remove package %s:", spec); - for (auto&& dep : deps) - { - System::println(" %s depends on %s", dep->package.displayname(), pkg.package.displayname()); - } - exit(EXIT_FAILURE); - case deinstall_plan::should_deinstall: - break; - default: - Checks::unreachable(); - } + StatusParagraph& pkg = **status_db->find(spec.name(), spec.target_triplet()); pkg.want = want_t::purge; pkg.state = install_state_t::half_installed; @@ -163,31 +100,125 @@ namespace vcpkg pkg.state = install_state_t::not_installed; write_update(paths, pkg); - System::println(System::color::success, "Package %s was successfully removed", pkg.package.displayname()); } - void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + static void sort_packages_by_name(std::vector<const package_spec_with_remove_plan*>* packages) { - static const std::string example = create_example_string("remove zlib zlib:x64-windows curl boost"); - args.check_min_arg_count(1, example); + std::sort(packages->begin(), packages->end(), [](const package_spec_with_remove_plan* left, const package_spec_with_remove_plan* right) -> bool + { + return left->spec.name() < right->spec.name(); + }); + } - const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_PURGE}); - auto status_db = database_load_check(paths); + static void print_plan(const std::vector<package_spec_with_remove_plan>& plan) + { + std::vector<const package_spec_with_remove_plan*> not_installed; + std::vector<const package_spec_with_remove_plan*> remove; + for (const package_spec_with_remove_plan& i : plan) + { + if (i.plan.plan_type == remove_plan_type::NOT_INSTALLED) + { + not_installed.push_back(&i); + continue; + } + + if (i.plan.plan_type == remove_plan_type::REMOVE) + { + remove.push_back(&i); + continue; + } + + Checks::unreachable(); + } + + if (!not_installed.empty()) + { + sort_packages_by_name(¬_installed); + System::println("The following packages are not installed, so not removed:\n%s", + Strings::join("\n ", not_installed, [](const package_spec_with_remove_plan* p) + { + return " " + p->spec.toString(); + })); + } + + if (!remove.empty()) + { + sort_packages_by_name(&remove); + System::println("The following packages will be removed:\n%s", + Strings::join("\n", remove, [](const package_spec_with_remove_plan* p) + { + if (p->plan.request_type == Dependencies::request_type::AUTO_SELECTED) + { + return " * " + p->spec.toString(); + } + + if (p->plan.request_type == Dependencies::request_type::USER_REQUESTED) + { + return " " + p->spec.toString(); + } + + Checks::unreachable(); + })); + } + } + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + static const std::string example = Commands::Help::create_example_string("remove zlib zlib:x64-windows curl boost"); + args.check_min_arg_count(1, example); std::vector<package_spec> specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example); Input::check_triplets(specs, paths); - bool alsoRemoveFolderFromPackages = options.find(OPTION_PURGE) != options.end(); + const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_PURGE, OPTION_RECURSE }); + const bool alsoRemoveFolderFromPackages = options.find(OPTION_PURGE) != options.end(); + const bool isRecursive = options.find(OPTION_RECURSE) != options.end(); + + auto status_db = database_load_check(paths); + const std::vector<package_spec_with_remove_plan> remove_plan = Dependencies::create_remove_plan(specs, status_db); + Checks::check_exit(!remove_plan.empty(), "Remove plan cannot be empty"); + + print_plan(remove_plan); + + const bool has_non_user_requested_packages = std::find_if(remove_plan.cbegin(), remove_plan.cend(), [](const package_spec_with_remove_plan& package)-> bool + { + return package.plan.request_type != request_type::USER_REQUESTED; + }) != remove_plan.cend(); - for (const package_spec& spec : specs) + if (has_non_user_requested_packages && !isRecursive) { - deinstall_package(paths, spec, status_db); + System::println(System::color::warning, + "Additional packages (*) need to be removed to complete this operation.\n" + "If you are sure you want to remove them, run the command with the --recurse option"); + exit(EXIT_FAILURE); + } + + for (const package_spec_with_remove_plan& action : remove_plan) + { + const std::string display_name = action.spec.display_name(); + + switch (action.plan.plan_type) + { + case remove_plan_type::NOT_INSTALLED: + System::println(System::color::success, "Package %s is not installed", display_name); + break; + case remove_plan_type::REMOVE: + System::println("Removing package %s... ", display_name); + remove_package(paths, action.spec, &status_db); + System::println(System::color::success, "Removing package %s... done", display_name); + break; + case remove_plan_type::UNKNOWN: + default: + Checks::unreachable(); + } if (alsoRemoveFolderFromPackages) { - const fs::path spec_package_dir = paths.packages / spec.dir(); - delete_directory(spec_package_dir); + System::println("Purging package %s... ", display_name); + delete_directory(paths.packages / action.spec.dir()); + System::println(System::color::success, "Purging package %s... done", display_name); } } + exit(EXIT_SUCCESS); } } diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp index a4714477e..8bac858f1 100644 --- a/toolsrc/src/commands_search.cpp +++ b/toolsrc/src/commands_search.cpp @@ -1,35 +1,47 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" #include "Paragraphs.h" #include "vcpkglib_helpers.h" #include "SourceParagraph.h" -namespace vcpkg +namespace vcpkg::Commands::Search { - static std::vector<SourceParagraph> read_all_source_paragraphs(const vcpkg_paths& paths) + static const std::string OPTION_GRAPH = "--graph"; //TODO: This should find a better home, eventually + + static std::string replace_dashes_with_underscore(const std::string& input) { - std::vector<SourceParagraph> output; - for (auto it = fs::directory_iterator(paths.ports); it != fs::directory_iterator(); ++it) - { - const fs::path& path = it->path(); + std::string output = input; + std::replace(output.begin(), output.end(), '-', '_'); + return output; + } - try - { - auto pghs = Paragraphs::get_paragraphs(path / "CONTROL"); - if (pghs.empty()) - { - continue; - } + static std::string create_graph_as_string(const std::vector<SourceParagraph>& source_paragraphs) + { + int empty_node_count = 0; + + std::string s; + s.append("digraph G{ rankdir=LR; edge [minlen=3]; overlap=false;"); - auto srcpgh = SourceParagraph(pghs[0]); - output.push_back(srcpgh); + for (const SourceParagraph& source_paragraph : source_paragraphs) + { + if (source_paragraph.depends.empty()) + { + empty_node_count++; + continue; } - catch (std::runtime_error const&) + + const std::string name = replace_dashes_with_underscore(source_paragraph.name); + s.append(Strings::format("%s;", name)); + for (const dependency& d : source_paragraph.depends) { + const std::string dependency_name = replace_dashes_with_underscore(d.name); + s.append(Strings::format("%s -> %s;", name, dependency_name)); } } - return output; + s.append(Strings::format("empty [label=\"%d singletons...\"]; }", empty_node_count)); + return s; } static void do_print(const SourceParagraph& source_paragraph) @@ -40,14 +52,22 @@ namespace vcpkg details::shorten_description(source_paragraph.description)); } - void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(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")); + 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", + Commands::Help::create_example_string("search png")); args.check_max_arg_count(1, example); + const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_GRAPH }); - const std::vector<SourceParagraph> source_paragraphs = read_all_source_paragraphs(paths); + const std::vector<SourceParagraph> source_paragraphs = Paragraphs::load_all_ports(paths.ports); + if (options.find(OPTION_GRAPH) != options.cend()) + { + const std::string graph_as_string = create_graph_as_string(source_paragraphs); + System::println(graph_as_string); + exit(EXIT_SUCCESS); + } - if (args.command_arguments.size() == 0) + if (args.command_arguments.empty()) { for (const SourceParagraph& source_paragraph : source_paragraphs) { diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp index a4ab7c6e7..8131d9a73 100644 --- a/toolsrc/src/commands_update.cpp +++ b/toolsrc/src/commands_update.cpp @@ -1,38 +1,22 @@ +#include "pch.h" #include "vcpkg_Commands.h" -#include "vcpkg.h" +#include "vcpkglib.h" #include "vcpkg_System.h" #include "vcpkg_Files.h" #include "Paragraphs.h" -#include "vcpkg_info.h" -namespace vcpkg +namespace vcpkg::Commands::Update { - void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { args.check_exact_arg_count(0); + args.check_and_get_optional_command_arguments({}); 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 = Paragraphs::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&) - { - } - } + const std::vector<SourceParagraph> source_paragraphs = Paragraphs::load_all_ports(paths.ports); + const std::map<std::string, std::string> src_names_to_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); std::string packages_list; @@ -78,13 +62,13 @@ namespace vcpkg auto num1 = sscanf_s(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1); int maj2, min2, rev2; - auto num2 = sscanf_s(Info::version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2); + auto num2 = sscanf_s(Version::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.", + System::println("Different source is available for vcpkg (%d.%d.%d -> %d.%d.%d). Use powershell -exec bypass scripts/bootstrap.ps1 to update.", maj2, min2, rev2, maj1, min1, rev1); } diff --git a/toolsrc/src/commands_version.cpp b/toolsrc/src/commands_version.cpp new file mode 100644 index 000000000..4789e2409 --- /dev/null +++ b/toolsrc/src/commands_version.cpp @@ -0,0 +1,37 @@ +#include "pch.h" +#include "vcpkg_Commands.h" +#include "vcpkg_System.h" +#include "metrics.h" + +#define STRINGIFY(...) #__VA_ARGS__ +#define MACRO_TO_STRING(X) STRINGIFY(X) + +#define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION) + +namespace vcpkg::Commands::Version +{ + const std::string& version() + { + static const std::string s_version = +#include "../VERSION.txt" + + + std::string(VCPKG_VERSION_AS_STRING) +#ifndef NDEBUG + + std::string("-debug") +#endif + + std::string(GetCompiledMetricsEnabled() ? "" : "-external"); + return s_version; + } + + void perform_and_exit(const vcpkg_cmd_arguments& args) + { + args.check_exact_arg_count(0); + args.check_and_get_optional_command_arguments({}); + + System::println("Vcpkg package management program version %s\n" + "\n" + "See LICENSE.txt for license information.", version() + ); + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/main.cpp b/toolsrc/src/main.cpp deleted file mode 100644 index 7703c541f..000000000 --- a/toolsrc/src/main.cpp +++ /dev/null @@ -1,248 +0,0 @@ -#define WIN32_LEAN_AND_MEAN -#include <Windows.h> - -#include <iostream> -#include <fstream> -#include <memory> -#include <cassert> -#include "vcpkg_Commands.h" -#include "metrics.h" -#include <Shlobj.h> -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Input.h" -#include "Paragraphs.h" -#include "vcpkg_info.h" - -using namespace vcpkg; - -bool g_debugging = false; - -void invalid_command(const std::string& cmd) -{ - System::println(System::color::error, "invalid command: %s", cmd); - print_usage(); - exit(EXIT_FAILURE); -} - -static void inner(const vcpkg_cmd_arguments& args) -{ - TrackProperty("command", args.command); - if (args.command.empty()) - { - print_usage(); - exit(EXIT_FAILURE); - } - - if (auto command_function = find_command(args.command, get_available_commands_type_c())) - { - return command_function(args); - } - - fs::path vcpkg_root_dir; - if (args.vcpkg_root_dir != nullptr) - { - vcpkg_root_dir = fs::absolute(Strings::utf8_to_utf16(*args.vcpkg_root_dir)); - } - else - { - auto vcpkg_root_dir_env = System::wdupenv_str(L"VCPKG_ROOT"); - - if (!vcpkg_root_dir_env.empty()) - { - vcpkg_root_dir = fs::absolute(vcpkg_root_dir_env); - } - else - { - vcpkg_root_dir = Files::find_file_recursively_up(fs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root"); - } - } - - Checks::check_exit(!vcpkg_root_dir.empty(), "Error: Could not detect vcpkg-root."); - - const expected<vcpkg_paths> expected_paths = vcpkg_paths::create(vcpkg_root_dir); - Checks::check_exit(!expected_paths.error_code(), "Error: Invalid vcpkg root directory %s: %s", vcpkg_root_dir.string(), expected_paths.error_code().message()); - const vcpkg_paths paths = expected_paths.get_or_throw(); - int exit_code = _wchdir(paths.root.c_str()); - Checks::check_exit(exit_code == 0, "Changing the working dir failed"); - - if (auto command_function = find_command(args.command, get_available_commands_type_b())) - { - return command_function(args, paths); - } - - triplet default_target_triplet; - if (args.target_triplet != nullptr) - { - 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()) - { - default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(vcpkg_default_triplet_env)); - } - else - { - 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); - } - - return invalid_command(args.command); -} - -static void loadConfig() -{ - fs::path localappdata; - { - // Config path in AppDataLocal - wchar_t* localappdatapath = nullptr; - if (S_OK != SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &localappdatapath)) - __fastfail(1); - localappdata = localappdatapath; - CoTaskMemFree(localappdatapath); - } - - try - { - std::string config_contents = Files::read_contents(localappdata / "vcpkg" / "config").get_or_throw(); - - std::unordered_map<std::string, std::string> keys; - auto pghs = Paragraphs::parse_paragraphs(config_contents); - if (pghs.size() > 0) - keys = pghs[0]; - - for (size_t x = 1; x < pghs.size(); ++x) - { - for (auto&& p : pghs[x]) - keys.insert(p); - } - - auto user_id = keys["User-Id"]; - auto user_time = keys["User-Since"]; - Checks::check_throw(!user_id.empty() && !user_time.empty(), ""); // Use as goto to the catch statement - - SetUserInformation(user_id, user_time); - return; - } - catch (...) - { - } - - // config file not found, could not be read, or invalid - std::string user_id, user_time; - InitUserInformation(user_id, user_time); - SetUserInformation(user_id, user_time); - try - { - std::error_code ec; - fs::create_directory(localappdata / "vcpkg", ec); - std::ofstream(localappdata / "vcpkg" / "config", std::ios_base::out | std::ios_base::trunc) - << "User-Id: " << user_id << "\n" - << "User-Since: " << user_time << "\n"; - } - catch (...) - { - } -} - -static System::Stopwatch2 g_timer; - -static std::string trim_path_from_command_line(const std::string& full_command_line) -{ - Checks::check_exit(full_command_line.size() > 0, "Internal failure - cannot have empty command line"); - - if (full_command_line[0] == '"') - { - auto it = std::find(full_command_line.cbegin() + 1, full_command_line.cend(), '"'); - if (it != full_command_line.cend()) // Skip over the quote - ++it; - while (it != full_command_line.cend() && *it == ' ') // Skip over a space - ++it; - return std::string(it, full_command_line.cend()); - } - - auto it = std::find(full_command_line.cbegin(), full_command_line.cend(), ' '); - while (it != full_command_line.cend() && *it == ' ') - ++it; - return std::string(it, full_command_line.cend()); -} - -int wmain(const int argc, const wchar_t* const* const argv) -{ - if (argc == 0) - std::abort(); - - std::cout.sync_with_stdio(false); - std::cout.imbue(std::locale::classic()); - - g_timer.start(); - atexit([]() - { - g_timer.stop(); - TrackMetric("elapsed_us", g_timer.microseconds()); - Flush(); - }); - - TrackProperty("version", Info::version()); - - const std::string trimmed_command_line = trim_path_from_command_line(Strings::utf16_to_utf8(GetCommandLineW())); - TrackProperty("cmdline", trimmed_command_line); - loadConfig(); - TrackProperty("sqmuser", GetSQMUser()); - - const vcpkg_cmd_arguments args = vcpkg_cmd_arguments::create_from_command_line(argc, argv); - - if (args.printmetrics != opt_bool::unspecified) - SetPrintMetrics(args.printmetrics == opt_bool::enabled); - if (args.sendmetrics != opt_bool::unspecified) - SetSendMetrics(args.sendmetrics == opt_bool::enabled); - - if (args.debug != opt_bool::unspecified) - { - g_debugging = (args.debug == opt_bool::enabled); - } - - if (g_debugging) - { - inner(args); - exit(EXIT_FAILURE); - } - - std::string exc_msg; - try - { - inner(args); - exit(EXIT_FAILURE); - } - catch (std::exception& e) - { - exc_msg = e.what(); - } - catch (...) - { - exc_msg = "unknown error(...)"; - } - TrackProperty("error", exc_msg); - std::cerr - << "vcpkg.exe has crashed.\n" - << "Please send an email to:\n" - << " " << Info::email() << "\n" - << "containing a brief summary of what you were trying to do and the following data blob:\n" - << "\n" - << "Version=" << Info::version() << "\n" - << "EXCEPTION='" << exc_msg << "'\n" - << "CMD=\n"; - for (int x = 0; x < argc; ++x) - std::cerr << argv[x] << "|\n"; - std::cerr - << "\n"; -} diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/metrics.cpp index 51c7179c8..d0e20fe2d 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/metrics.cpp @@ -1,15 +1,5 @@ +#include "pch.h" #include "metrics.h" -#include <utility> -#include <array> -#include <string> -#include <iostream> -#include <vector> -#include <sys/timeb.h> -#include <time.h> -#define WIN32_LEAN_AND_MEAN -#include <Windows.h> -#include <winhttp.h> -#include <fstream> #include "filesystem_fs.h" #include "vcpkg_Strings.h" #include "vcpkg_System.h" @@ -42,7 +32,7 @@ namespace vcpkg static std::string GenerateRandomUUID() { - int partSizes[] = {8, 4, 4, 4, 12}; + int partSizes[] = { 8, 4, 4, 4, 12 }; char uuid[37]; memset(uuid, 0, sizeof(uuid)); int num; @@ -111,7 +101,7 @@ namespace vcpkg // Note: this treats incoming Strings as Latin-1 static constexpr const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; encoded.append("\\u00"); encoded.push_back(hex[ch / 16]); encoded.push_back(hex[ch % 16]); @@ -237,36 +227,12 @@ true std::wstring GetSQMUser() { - LONG err = NULL; + auto hkcu_sqmclient = System::get_registry_string(HKEY_CURRENT_USER, LR"(Software\Microsoft\SQMClient)", L"UserId"); - struct RAII_HKEY { - HKEY hkey = NULL; - ~RAII_HKEY() - { - if (hkey != NULL) - RegCloseKey(hkey); - } - } HKCU_SQMClient; - - err = RegOpenKeyExW(HKEY_CURRENT_USER, LR"(Software\Microsoft\SQMClient)", NULL, KEY_READ, &HKCU_SQMClient.hkey); - if (err != ERROR_SUCCESS) - { + if (hkcu_sqmclient) + return std::move(*hkcu_sqmclient); + else return L"{}"; - } - - std::array<wchar_t,128> buffer; - DWORD lType = 0; - DWORD dwBufferSize = static_cast<DWORD>(buffer.size() * sizeof(wchar_t)); - err = RegQueryValueExW(HKCU_SQMClient.hkey, L"UserId", NULL, &lType, reinterpret_cast<LPBYTE>(buffer.data()), &dwBufferSize); - if (err == ERROR_SUCCESS && lType == REG_SZ && dwBufferSize >= sizeof(wchar_t)) - { - size_t sz = dwBufferSize / sizeof(wchar_t); - if (buffer[sz - 1] == '\0') - --sz; - return std::wstring(buffer.begin(), buffer.begin() + sz); - } - - return L"{}"; } void SetUserInformation(const std::string& user_id, const std::string& first_use_time) @@ -366,8 +332,7 @@ true if (bResults) { DWORD availableData = 0, readData = 0, totalData = 0; - - while ((bResults = WinHttpQueryDataAvailable(hRequest, &availableData)) && availableData > 0) + while ((bResults = WinHttpQueryDataAvailable(hRequest, &availableData)) == TRUE && availableData > 0) { responseBuffer.resize(responseBuffer.size() + availableData); @@ -452,6 +417,6 @@ true std::ofstream(vcpkg_metrics_txt_path) << payload; const std::wstring cmdLine = Strings::wformat(L"start %s %s", temp_folder_path_exe.native(), vcpkg_metrics_txt_path.native()); - System::cmd_execute(cmdLine); + System::cmd_execute_clean(cmdLine); } } diff --git a/toolsrc/src/opt_bool.cpp b/toolsrc/src/opt_bool.cpp new file mode 100644 index 000000000..324936fb4 --- /dev/null +++ b/toolsrc/src/opt_bool.cpp @@ -0,0 +1,29 @@ +#include "pch.h" +#include "opt_bool.h" +#include "vcpkg_Checks.h" + +namespace vcpkg::opt_bool +{ + static const std::string UNSPECIFIED_NAME = "unspecified"; + static const std::string ENABLED_NAME = "enabled"; + static const std::string DISABLED_NAME = "disabled"; + type parse(const std::string& s) + { + if (s == UNSPECIFIED_NAME) + { + return opt_bool_t::UNSPECIFIED; + } + + if (s == ENABLED_NAME) + { + return opt_bool_t::ENABLED; + } + + if (s == DISABLED_NAME) + { + return opt_bool_t::DISABLED; + } + + Checks::exit_with_message("Could not convert string [%s] to opt_bool", s); + } +} diff --git a/toolsrc/src/package_spec.cpp b/toolsrc/src/package_spec.cpp index 86d4393bd..2713e219f 100644 --- a/toolsrc/src/package_spec.cpp +++ b/toolsrc/src/package_spec.cpp @@ -1,5 +1,5 @@ +#include "pch.h" #include "package_spec.h" -#include <algorithm> namespace vcpkg { @@ -50,19 +50,24 @@ namespace vcpkg return this->m_target_triplet; } + std::string package_spec::display_name() const + { + return Strings::format("%s:%s", this->name(), this->target_triplet()); + } + std::string package_spec::dir() const { return Strings::format("%s_%s", this->m_name, this->m_target_triplet); } - std::string to_string(const package_spec& spec) + std::string package_spec::toString() const { - return Strings::format("%s:%s", spec.name(), spec.target_triplet()); + return this->display_name(); } std::string to_printf_arg(const package_spec& spec) { - return to_string(spec); + return spec.toString(); } bool operator==(const package_spec& left, const package_spec& right) @@ -72,6 +77,6 @@ namespace vcpkg std::ostream& operator<<(std::ostream& os, const package_spec& spec) { - return os << to_string(spec); + return os << spec.toString(); } } diff --git a/toolsrc/src/package_spec_parse_result.cpp b/toolsrc/src/package_spec_parse_result.cpp index dc377f656..892232c2e 100644 --- a/toolsrc/src/package_spec_parse_result.cpp +++ b/toolsrc/src/package_spec_parse_result.cpp @@ -1,5 +1,5 @@ -#include <package_spec.h> -#include <system_error> +#include "pch.h" +#include "package_spec.h" #include "package_spec_parse_result.h" namespace vcpkg diff --git a/toolsrc/src/pch.cpp b/toolsrc/src/pch.cpp new file mode 100644 index 000000000..17305716a --- /dev/null +++ b/toolsrc/src/pch.cpp @@ -0,0 +1 @@ +#include "pch.h"
\ No newline at end of file diff --git a/toolsrc/src/tests_paragraph.cpp b/toolsrc/src/tests_paragraph.cpp index 6d9e46fcf..fb20eee82 100644 --- a/toolsrc/src/tests_paragraph.cpp +++ b/toolsrc/src/tests_paragraph.cpp @@ -7,14 +7,14 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework; -namespace Microsoft { namespace VisualStudio { namespace CppUnitTestFramework +namespace Microsoft::VisualStudio::CppUnitTestFramework { template <> inline std::wstring ToString<vcpkg::package_spec_parse_result>(const vcpkg::package_spec_parse_result& t) { return ToString(static_cast<uint32_t>(t)); } -}}} +} namespace UnitTest1 { diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp index a6816b445..d91e0e68f 100644 --- a/toolsrc/src/triplet.cpp +++ b/toolsrc/src/triplet.cpp @@ -1,6 +1,7 @@ +#include "pch.h" #include "triplet.h" #include "vcpkg_Checks.h" -#include <algorithm> +#include "vcpkg_Strings.h" namespace vcpkg { @@ -37,9 +38,7 @@ namespace vcpkg 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); - + const std::string s(Strings::ascii_to_lowercase(triplet_as_string)); auto it = std::find(s.cbegin(), s.cend(), '-'); Checks::check_exit(it != s.cend(), "Invalid triplet: %s", triplet_as_string); diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 4748aeb54..e94d2538b 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -1,248 +1,250 @@ -#include "vcpkg.h" +#define WIN32_LEAN_AND_MEAN +#include <Windows.h> + #include <iostream> -#include <iomanip> #include <fstream> -#include <functional> -#include <string> -#include <unordered_map> #include <memory> -#include <vector> +#include <cassert> +#include "vcpkg_Commands.h" +#include "metrics.h" +#include <Shlobj.h> #include "vcpkg_Files.h" +#include "vcpkg_System.h" +#include "vcpkg_Input.h" #include "Paragraphs.h" -#include <regex> -#include "metrics.h" +#include "vcpkg_Strings.h" +#include "vcpkg_Chrono.h" using namespace vcpkg; -static StatusParagraphs load_current_database(const fs::path& vcpkg_dir_status_file, const fs::path& vcpkg_dir_status_file_old) +bool g_debugging = false; + +void invalid_command(const std::string& cmd) { - if (!fs::exists(vcpkg_dir_status_file)) - { - if (!fs::exists(vcpkg_dir_status_file_old)) - { - // no status file, use empty db - return StatusParagraphs(); - } + System::println(System::color::error, "invalid command: %s", cmd); + Commands::Help::print_usage(); + exit(EXIT_FAILURE); +} - fs::rename(vcpkg_dir_status_file_old, vcpkg_dir_status_file); +static void inner(const vcpkg_cmd_arguments& args) +{ + TrackProperty("command", args.command); + if (args.command.empty()) + { + Commands::Help::print_usage(); + exit(EXIT_FAILURE); } - auto text = Files::read_contents(vcpkg_dir_status_file).get_or_throw(); - auto pghs = Paragraphs::parse_paragraphs(text); - - std::vector<std::unique_ptr<StatusParagraph>> status_pghs; - for (auto&& p : pghs) + if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c())) { - status_pghs.push_back(std::make_unique<StatusParagraph>(p)); + return command_function(args); } - return StatusParagraphs(std::move(status_pghs)); -} - -StatusParagraphs vcpkg::database_load_check(const vcpkg_paths& paths) -{ - auto updates_dir = paths.vcpkg_dir_updates; - - std::error_code ec; - fs::create_directory(paths.installed, ec); - fs::create_directory(paths.vcpkg_dir, ec); - fs::create_directory(paths.vcpkg_dir_info, ec); - fs::create_directory(updates_dir, ec); + fs::path vcpkg_root_dir; + if (args.vcpkg_root_dir != nullptr) + { + vcpkg_root_dir = fs::absolute(Strings::utf8_to_utf16(*args.vcpkg_root_dir)); + } + else + { + const optional<std::wstring> vcpkg_root_dir_env = System::get_environmental_variable(L"VCPKG_ROOT"); + if (vcpkg_root_dir_env) + { + vcpkg_root_dir = fs::absolute(*vcpkg_root_dir_env); + } + else + { + vcpkg_root_dir = Files::find_file_recursively_up(fs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root"); + } + } - const fs::path& status_file = paths.vcpkg_dir_status_file; - const fs::path status_file_old = status_file.parent_path() / "status-old"; - const fs::path status_file_new = status_file.parent_path() / "status-new"; + Checks::check_exit(!vcpkg_root_dir.empty(), "Error: Could not detect vcpkg-root."); - StatusParagraphs current_status_db = load_current_database(status_file, status_file_old); + const expected<vcpkg_paths> expected_paths = vcpkg_paths::create(vcpkg_root_dir); + Checks::check_exit(!expected_paths.error_code(), "Error: Invalid vcpkg root directory %s: %s", vcpkg_root_dir.string(), expected_paths.error_code().message()); + const vcpkg_paths paths = expected_paths.get_or_throw(); + int exit_code = _wchdir(paths.root.c_str()); + Checks::check_exit(exit_code == 0, "Changing the working dir failed"); - auto b = fs::directory_iterator(updates_dir); - auto e = fs::directory_iterator(); - if (b == e) + if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_b())) { - // updates directory is empty, control file is up-to-date. - return current_status_db; + return command_function(args, paths); } - for (; b != e; ++b) + triplet default_target_triplet; + if (args.target_triplet != nullptr) { - if (!fs::is_regular_file(b->status())) - continue; - if (b->path().filename() == "incomplete") - continue; - - auto text = Files::read_contents(b->path()).get_or_throw(); - auto pghs = Paragraphs::parse_paragraphs(text); - for (auto&& p : pghs) + default_target_triplet = triplet::from_canonical_name(*args.target_triplet); + } + else + { + const optional<std::wstring> vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET"); + if (vcpkg_default_triplet_env) { - current_status_db.insert(std::make_unique<StatusParagraph>(p)); + default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(*vcpkg_default_triplet_env)); + } + else + { + default_target_triplet = triplet::X86_WINDOWS; } } - std::fstream(status_file_new, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc) << current_status_db; - - if (fs::exists(status_file_old)) - fs::remove(status_file_old); - if (fs::exists(status_file)) - fs::rename(status_file, status_file_old); - fs::rename(status_file_new, status_file); - fs::remove(status_file_old); + Input::check_triplet(default_target_triplet, paths); - b = fs::directory_iterator(updates_dir); - for (; b != e; ++b) + if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a())) { - if (!fs::is_regular_file(b->status())) - continue; - fs::remove(b->path()); + return command_function(args, paths, default_target_triplet); } - return current_status_db; -} - -void vcpkg::write_update(const vcpkg_paths& paths, const StatusParagraph& p) -{ - static int update_id = 0; - auto my_update_id = update_id++; - auto tmp_update_filename = paths.vcpkg_dir_updates / "incomplete"; - auto update_filename = paths.vcpkg_dir_updates / std::to_string(my_update_id); - std::fstream fs(tmp_update_filename, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc); - fs << p; - fs.close(); - fs::rename(tmp_update_filename, update_filename); + return invalid_command(args.command); } -static void upgrade_to_slash_terminated_sorted_format(std::vector<std::string>* lines, const fs::path& listfile_path) +static void loadConfig() { - static bool was_tracked = false; + fs::path localappdata; + { + // Config path in AppDataLocal + wchar_t* localappdatapath = nullptr; + if (S_OK != SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &localappdatapath)) + __fastfail(1); + localappdata = localappdatapath; + CoTaskMemFree(localappdatapath); + } - if (lines->empty()) + try { + std::string config_contents = Files::read_contents(localappdata / "vcpkg" / "config").get_or_throw(); + + std::unordered_map<std::string, std::string> keys; + auto pghs = Paragraphs::parse_paragraphs(config_contents); + if (pghs.size() > 0) + keys = pghs[0]; + + for (size_t x = 1; x < pghs.size(); ++x) + { + for (auto&& p : pghs[x]) + keys.insert(p); + } + + auto user_id = keys["User-Id"]; + auto user_time = keys["User-Since"]; + Checks::check_throw(!user_id.empty() && !user_time.empty(), ""); // Use as goto to the catch statement + + SetUserInformation(user_id, user_time); return; } - - if (lines->at(0).back() == '/') + catch (...) { - return; // File already in the new format } - if (!was_tracked) + // config file not found, could not be read, or invalid + std::string user_id, user_time; + InitUserInformation(user_id, user_time); + SetUserInformation(user_id, user_time); + try { - was_tracked = true; - TrackProperty("listfile", "update to new format"); + std::error_code ec; + fs::create_directory(localappdata / "vcpkg", ec); + std::ofstream(localappdata / "vcpkg" / "config", std::ios_base::out | std::ios_base::trunc) + << "User-Id: " << user_id << "\n" + << "User-Since: " << user_time << "\n"; } - - // The files are sorted such that directories are placed just before the files they contain - // (They are not necessarily sorted alphabetically, e.g. libflac) - // Therefore we can detect the entries that represent directories by comparing every element with the next one - // and checking if the next has a slash immediately after the current one's length - for (size_t i = 0; i < lines->size() - 1; i++) + catch (...) { - std::string& current_string = lines->at(i); - const std::string& next_string = lines->at(i + 1); + } +} - const size_t potential_slash_char_index = current_string.length(); - // Make sure the index exists first - if (next_string.size() > potential_slash_char_index && next_string.at(potential_slash_char_index) == '/') - { - current_string += '/'; // Mark as a directory - } +static std::string trim_path_from_command_line(const std::string& full_command_line) +{ + Checks::check_exit(full_command_line.size() > 0, "Internal failure - cannot have empty command line"); + + if (full_command_line[0] == '"') + { + auto it = std::find(full_command_line.cbegin() + 1, full_command_line.cend(), '"'); + if (it != full_command_line.cend()) // Skip over the quote + ++it; + while (it != full_command_line.cend() && *it == ' ') // Skip over a space + ++it; + return std::string(it, full_command_line.cend()); } - // After suffixing the directories with a slash, we can now sort. - // We cannot sort before adding the suffixes because the following (actual example): - /* - x86-windows/include/FLAC <<<<<< This would be separated from its group due to sorting - x86-windows/include/FLAC/all.h - x86-windows/include/FLAC/assert.h - x86-windows/include/FLAC/callback.h - x86-windows/include/FLAC++ - x86-windows/include/FLAC++/all.h - x86-windows/include/FLAC++/decoder.h - x86-windows/include/FLAC++/encoder.h - * - x86-windows/include/FLAC/ <<<<<< This will now be kept with its group when sorting - x86-windows/include/FLAC/all.h - x86-windows/include/FLAC/assert.h - x86-windows/include/FLAC/callback.h - x86-windows/include/FLAC++/ - x86-windows/include/FLAC++/all.h - x86-windows/include/FLAC++/decoder.h - x86-windows/include/FLAC++/encoder.h - */ - // Note that after sorting, the FLAC++/ group will be placed before the FLAC/ group - // The new format is lexicographically sorted - std::sort(lines->begin(), lines->end()); - -#if 0 - // Replace the listfile on disk - const fs::path updated_listfile_path = listfile_path.generic_string() + "_updated"; - Files::write_all_lines(updated_listfile_path, *lines); - fs::rename(updated_listfile_path, listfile_path); -#endif + auto it = std::find(full_command_line.cbegin(), full_command_line.cend(), ' '); + while (it != full_command_line.cend() && *it == ' ') + ++it; + return std::string(it, full_command_line.cend()); } -std::vector<StatusParagraph_and_associated_files> vcpkg::get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db) +static ElapsedTime g_timer; + +int wmain(const int argc, const wchar_t* const* const argv) { - std::vector<StatusParagraph_and_associated_files> installed_files; + if (argc == 0) + std::abort(); - for (const std::unique_ptr<StatusParagraph>& pgh : status_db) - { - if (pgh->state != install_state_t::installed) + g_timer = ElapsedTime::createStarted(); + atexit([]() { - continue; - } + auto elapsed_us = g_timer.microseconds(); + TrackMetric("elapsed_us", elapsed_us); + Flush(); + }); + + TrackProperty("version", Commands::Version::version()); + + const std::string trimmed_command_line = trim_path_from_command_line(Strings::utf16_to_utf8(GetCommandLineW())); + TrackProperty("cmdline", trimmed_command_line); + loadConfig(); + TrackProperty("sqmuser", GetSQMUser()); - const fs::path listfile_path = paths.listfile_path(pgh->package); - std::vector<std::string> installed_files_of_current_pgh = Files::read_all_lines(listfile_path).get_or_throw(); - Strings::trim_all_and_remove_whitespace_strings(&installed_files_of_current_pgh); - upgrade_to_slash_terminated_sorted_format(&installed_files_of_current_pgh, listfile_path); + const vcpkg_cmd_arguments args = vcpkg_cmd_arguments::create_from_command_line(argc, argv); - // Remove the directories - installed_files_of_current_pgh.erase( - std::remove_if(installed_files_of_current_pgh.begin(), installed_files_of_current_pgh.end(), [](const std::string& file) -> bool - { - return file.back() == '/'; - } - ), installed_files_of_current_pgh.end()); + if (args.printmetrics != opt_bool_t::UNSPECIFIED) + SetPrintMetrics(args.printmetrics == opt_bool_t::ENABLED); + if (args.sendmetrics != opt_bool_t::UNSPECIFIED) + SetSendMetrics(args.sendmetrics == opt_bool_t::ENABLED); - StatusParagraph_and_associated_files pgh_and_files = {*pgh, std::move(installed_files_of_current_pgh)}; - installed_files.push_back(std::move(pgh_and_files)); + if (args.debug != opt_bool_t::UNSPECIFIED) + { + g_debugging = (args.debug == opt_bool_t::ENABLED); } - return installed_files; -} + if (g_debugging) + { + inner(args); + exit(EXIT_FAILURE); + } -expected<SourceParagraph> vcpkg::try_load_port(const fs::path& path) -{ + std::string exc_msg; try { - auto pghs = Paragraphs::get_paragraphs(path / "CONTROL"); - Checks::check_exit(pghs.size() == 1, "Invalid control file at %s\\CONTROL", path.string()); - return SourceParagraph(pghs[0]); + inner(args); + exit(EXIT_FAILURE); } - catch (std::runtime_error const&) + catch (std::exception& e) { + exc_msg = e.what(); } - - return std::errc::no_such_file_or_directory; -} - -expected<BinaryParagraph> vcpkg::try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec) -{ - const fs::path path = paths.package_dir(spec) / "CONTROL"; - - auto control_contents_maybe = Files::read_contents(path); - if (auto control_contents = control_contents_maybe.get()) + catch (...) { - std::vector<std::unordered_map<std::string, std::string>> pghs; - try - { - pghs = Paragraphs::parse_paragraphs(*control_contents); - } - catch (std::runtime_error) - { - } - Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", path.string()); - return BinaryParagraph(pghs[0]); + exc_msg = "unknown error(...)"; } - return control_contents_maybe.error_code(); + TrackProperty("error", exc_msg); + + fflush(stdout); + System::print( + "vcpkg.exe has crashed.\n" + "Please send an email to:\n" + " %s\n" + "containing a brief summary of what you were trying to do and the following data blob:\n" + "\n" + "Version=%s\n" + "EXCEPTION='%s'\n" + "CMD=\n", + Commands::Contact::email(), + Commands::Version::version(), + exc_msg); + fflush(stdout); + for (int x = 0; x < argc; ++x) + System::println("%s|", Strings::utf16_to_utf8(argv[x])); + fflush(stdout); } diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp index 817ac9e96..02d3480a2 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg_Checks.cpp @@ -1,11 +1,10 @@ +#include "pch.h" #include "vcpkg_Checks.h" - -#include <stdexcept> #include "vcpkg_System.h" -namespace vcpkg {namespace Checks +namespace vcpkg::Checks { - void unreachable() + __declspec(noreturn) void unreachable() { System::println(System::color::error, "Error: Unreachable code was reached"); #ifndef NDEBUG @@ -15,13 +14,13 @@ namespace vcpkg {namespace Checks #endif } - void exit_with_message(const char* errorMessage) + __declspec(noreturn) void exit_with_message(const char* errorMessage) { System::println(System::color::error, errorMessage); exit(EXIT_FAILURE); } - void throw_with_message(const char* errorMessage) + __declspec(noreturn) void throw_with_message(const char* errorMessage) { throw std::runtime_error(errorMessage); } @@ -34,6 +33,14 @@ namespace vcpkg {namespace Checks } } + void check_exit(bool expression) + { + if (!expression) + { + exit(EXIT_FAILURE); + } + } + void check_exit(bool expression, const char* errorMessage) { if (!expression) @@ -41,4 +48,4 @@ namespace vcpkg {namespace Checks exit_with_message(errorMessage); } } -}} +} diff --git a/toolsrc/src/Stopwatch.cpp b/toolsrc/src/vcpkg_Chrono.cpp index 550f1ebd8..e39842df9 100644 --- a/toolsrc/src/Stopwatch.cpp +++ b/toolsrc/src/vcpkg_Chrono.cpp @@ -1,48 +1,10 @@ -#include "Stopwatch.h" +#include "pch.h" +#include "vcpkg_Chrono.h" #include "vcpkg_Checks.h" namespace vcpkg { - Stopwatch Stopwatch::createUnstarted() - { - return Stopwatch(); - } - - Stopwatch Stopwatch::createStarted() - { - return Stopwatch().start(); - } - - bool Stopwatch::isRunning() const - { - return this->m_isRunning; - } - - const Stopwatch& Stopwatch::start() - { - Checks::check_exit(!this->m_isRunning, "This stopwatch is already running."); - this->m_isRunning = true; - this->m_startTick = std::chrono::high_resolution_clock::now(); - return *this; - } - - const Stopwatch& Stopwatch::stop() - { - auto tick = std::chrono::high_resolution_clock::now(); - Checks::check_exit(this->m_isRunning, "This stopwatch is already stopped."); - this->m_isRunning = false; - this->m_elapsedNanos += tick - this->m_startTick; - return *this; - } - - Stopwatch& Stopwatch::reset() - { - this->m_elapsedNanos = std::chrono::nanoseconds(); - this->m_isRunning = false; - return *this; - } - - std::string Stopwatch::toString() const + static std::string format_time_userfriendly(const std::chrono::nanoseconds& nanos) { using std::chrono::hours; using std::chrono::minutes; @@ -52,8 +14,7 @@ namespace vcpkg using std::chrono::nanoseconds; using std::chrono::duration_cast; - auto nanos = elapsedNanos(); - auto nanos_as_double = static_cast<double>(nanos.count()); + const double nanos_as_double = static_cast<double>(nanos.count()); if (duration_cast<hours>(nanos) > hours()) { @@ -88,17 +49,15 @@ namespace vcpkg return Strings::format("%.4g ns", nanos_as_double); } - Stopwatch::Stopwatch() : m_isRunning(false), m_elapsedNanos(), m_startTick() + ElapsedTime ElapsedTime::createStarted() { + ElapsedTime t; + t.m_startTick = std::chrono::high_resolution_clock::now(); + return t; } - std::chrono::nanoseconds Stopwatch::elapsedNanos() const + std::string ElapsedTime::toString() const { - if (this->m_isRunning) - { - return std::chrono::high_resolution_clock::now() - this->m_startTick + this->m_elapsedNanos; - } - - return this->m_elapsedNanos; + return format_time_userfriendly(elapsed<std::chrono::nanoseconds>()); } } diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp index ae7f697fa..e8bf10617 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg_Dependencies.cpp @@ -1,16 +1,40 @@ +#include "pch.h" #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_Maps.h" #include "vcpkg_Files.h" -#include "vcpkg.h" +#include "Paragraphs.h" -namespace vcpkg { namespace Dependencies +namespace vcpkg::Dependencies { + install_plan_action::install_plan_action() : plan_type(install_plan_type::UNKNOWN), binary_pgh(nullptr), source_pgh(nullptr) + { + } + + install_plan_action::install_plan_action(const install_plan_type& plan_type, optional<BinaryParagraph> binary_pgh, optional<SourceParagraph> source_pgh) + : plan_type(std::move(plan_type)), binary_pgh(std::move(binary_pgh)), source_pgh(std::move(source_pgh)) + { + } + + package_spec_with_install_plan::package_spec_with_install_plan(const package_spec& spec, install_plan_action&& plan) : spec(spec), plan(std::move(plan)) + { + } + + remove_plan_action::remove_plan_action() : plan_type(remove_plan_type::UNKNOWN), request_type(request_type::UNKNOWN) + { + } + + remove_plan_action::remove_plan_action(const remove_plan_type& plan_type, const Dependencies::request_type& request_type) : plan_type(plan_type), request_type(request_type) + { + } + + package_spec_with_remove_plan::package_spec_with_remove_plan(const package_spec& spec, remove_plan_action&& plan) + : spec(spec), plan(std::move(plan)) + { + } + std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db) { std::unordered_map<package_spec, install_plan_action> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies @@ -48,7 +72,7 @@ namespace vcpkg { namespace Dependencies continue; } - expected<BinaryParagraph> maybe_bpgh = try_load_cached_package(paths, spec); + expected<BinaryParagraph> maybe_bpgh = Paragraphs::try_load_cached_package(paths, spec); if (BinaryParagraph* bpgh = maybe_bpgh.get()) { process_dependencies(bpgh->depends); @@ -56,7 +80,7 @@ namespace vcpkg { namespace Dependencies continue; } - expected<SourceParagraph> maybe_spgh = try_load_port(paths, spec.name()); + expected<SourceParagraph> maybe_spgh = Paragraphs::try_load_port(paths.port_dir(spec)); SourceParagraph* spgh = maybe_spgh.get(); Checks::check_exit(spgh != nullptr, "Cannot find package %s", spec.name()); process_dependencies(filter_dependencies(spgh->depends, spec.target_triplet())); @@ -68,8 +92,65 @@ namespace vcpkg { namespace Dependencies const std::vector<package_spec> pkgs = graph.find_topological_sort(); for (const package_spec& pkg : pkgs) { - ret.push_back({ pkg, std::move(was_examined[pkg]) }); + ret.push_back(package_spec_with_install_plan(pkg, std::move(was_examined[pkg]))); + } + return ret; + } + + std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<package_spec>& specs, const StatusParagraphs& status_db) + { + std::unordered_set<package_spec> specs_as_set(specs.cbegin(), specs.cend()); + + std::unordered_map<package_spec, remove_plan_action> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies + Graphs::Graph<package_spec> graph; + graph.add_vertices(specs); + + std::vector<package_spec> examine_stack(specs); + while (!examine_stack.empty()) + { + const package_spec spec = examine_stack.back(); + examine_stack.pop_back(); + + if (was_examined.find(spec) != was_examined.end()) + { + continue; + } + + const StatusParagraphs::const_iterator it = status_db.find(spec); + if (it == status_db.end() || (*it)->state == install_state_t::not_installed) + { + was_examined.emplace(spec, remove_plan_action(remove_plan_type::NOT_INSTALLED, request_type::USER_REQUESTED)); + continue; + } + + for (const std::unique_ptr<StatusParagraph>& an_installed_package : status_db) + { + if (an_installed_package->want != want_t::install) + continue; + if (an_installed_package->package.spec.target_triplet() != spec.target_triplet()) + continue; + + const std::vector<std::string>& deps = an_installed_package->package.depends; + if (std::find(deps.begin(), deps.end(), spec.name()) == deps.end()) + { + continue; + } + + graph.add_edge(spec, an_installed_package.get()->package.spec); + examine_stack.push_back(an_installed_package.get()->package.spec); + } + + const request_type request_type = specs_as_set.find(spec) != specs_as_set.end() ? request_type::USER_REQUESTED : request_type::AUTO_SELECTED; + was_examined.emplace(spec, remove_plan_action(remove_plan_type::REMOVE, request_type)); + } + + std::vector<package_spec_with_remove_plan> ret; + + const std::vector<package_spec> pkgs = graph.find_topological_sort(); + for (const package_spec& pkg : pkgs) + { + ret.push_back(package_spec_with_remove_plan(pkg, std::move(was_examined[pkg]))); } return ret; } -}} +} diff --git a/toolsrc/src/vcpkg_Enums.cpp b/toolsrc/src/vcpkg_Enums.cpp new file mode 100644 index 000000000..5e698659d --- /dev/null +++ b/toolsrc/src/vcpkg_Enums.cpp @@ -0,0 +1,21 @@ +#include "pch.h" +#include "vcpkg_Enums.h" +#include "vcpkg_Checks.h" + +namespace vcpkg::Enums +{ + std::string nullvalue_toString(const std::string& enum_name) + { + return Strings::format("%s_NULLVALUE", enum_name); + } + + void nullvalue_used(const std::string& enum_name) + { + Checks::exit_with_message("NULLVALUE of enum %s was used", enum_name); + } + + void unreachable(const std::string& enum_name) + { + Checks::exit_with_message("Unreachable code for enum, %s", enum_name); + } +} diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index ed70e6881..8aaaba8a8 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -1,86 +1,187 @@ -#include <regex> -#include <array> +#include "pch.h" #include "vcpkg_Environment.h" #include "vcpkg_Commands.h" -#include "metrics.h" #include "vcpkg_System.h" +#include "vcpkg_Strings.h" +#include "vcpkg_Files.h" -namespace vcpkg {namespace Environment +namespace vcpkg::Environment { - static const fs::path default_cmake_installation_dir = "C:/Program Files/CMake/bin"; - static const fs::path default_cmake_installation_dir_x86 = "C:/Program Files (x86)/CMake/bin"; - static const fs::path default_git_installation_dir = "C:/Program Files/git/cmd"; - static const fs::path default_git_installation_dir_x86 = "C:/Program Files (x86)/git/cmd"; + static std::vector<std::string> get_VS2017_installation_instances(const vcpkg_paths& paths) + { + const fs::path script = paths.scripts / "findVisualStudioInstallationInstances.ps1"; + const std::wstring cmd = System::create_powershell_script_cmd(script); + System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd); + Checks::check_exit(ec_data.exit_code == 0, "Could not run script to detect VS 2017 instances"); + return Strings::split(ec_data.output, "\n"); + } + + static optional<fs::path> find_vs2015_installation_instance() + { + const optional<std::wstring> vs2015_cmntools_optional = System::get_environmental_variable(L"VS140COMNTOOLS"); + if (!vs2015_cmntools_optional) + { + return nullptr; + } + + static const fs::path vs2015_cmntools = fs::path(*vs2015_cmntools_optional).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash + static const fs::path vs2015_path = vs2015_cmntools.parent_path().parent_path(); + return std::make_unique<fs::path>(vs2015_path); + } + + static const optional<fs::path>& get_VS2015_installation_instance() + { + static const optional<fs::path> vs2015_path = find_vs2015_installation_instance(); + return vs2015_path; + } - static void ensure_on_path(const std::array<int, 3>& version, const wchar_t* version_check_cmd, const wchar_t* install_cmd) + static fs::path find_dumpbin_exe(const vcpkg_paths& paths) { - System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(version_check_cmd); - if (ec_data.exit_code == 0) + const std::vector<std::string> vs2017_installation_instances = get_VS2017_installation_instances(paths); + std::vector<fs::path> paths_examined; + + // VS2017 + for (const std::string& instance : vs2017_installation_instances) { - // version check - std::regex re(R"###((\d+)\.(\d+)\.(\d+))###"); - std::match_results<std::string::const_iterator> match; - auto found = std::regex_search(ec_data.output, match, re); - if (found) + const fs::path msvc_path = Strings::format(R"(%s\VC\Tools\MSVC)", instance); + std::vector<fs::path> msvc_subdirectories; + Files::non_recursive_find_matching_paths_in_dir(msvc_path, [&](const fs::path& current) + { + return fs::is_directory(current); + }, &msvc_subdirectories); + + // Sort them so that latest comes first + std::sort(msvc_subdirectories.begin(), msvc_subdirectories.end(), [&](const fs::path& left, const fs::path& right) + { + return left.filename() > right.filename(); + }); + + for (const fs::path& subdir : msvc_subdirectories) { - int d1 = atoi(match[1].str().c_str()); - int d2 = atoi(match[2].str().c_str()); - int d3 = atoi(match[3].str().c_str()); - if (d1 > version[0] || (d1 == version[0] && d2 > version[1]) || (d1 == version[0] && d2 == version[1] && d3 >= version[2])) + const fs::path dumpbin_path = subdir / "bin" / "HostX86" / "x86" / "dumpbin.exe"; + paths_examined.push_back(dumpbin_path); + if (fs::exists(dumpbin_path)) { - // satisfactory version found - return; + return dumpbin_path; } } } - auto rc = System::cmd_execute(install_cmd); - if (rc) + // VS2015 + const optional<fs::path>& vs_2015_installation_instance = get_VS2015_installation_instance(); + if (vs_2015_installation_instance) + { + const fs::path vs2015_dumpbin_exe = *vs_2015_installation_instance / "VC" / "bin" / "dumpbin.exe"; + paths_examined.push_back(vs2015_dumpbin_exe); + if (fs::exists(vs2015_dumpbin_exe)) + { + return vs2015_dumpbin_exe; + } + } + + System::println(System::color::error, "Could not detect dumpbin.exe."); + System::println("The following paths were examined:"); + for (const fs::path& path : paths_examined) + { + System::println(" %s", path.generic_string()); + } + exit(EXIT_FAILURE); + } + + const fs::path& get_dumpbin_exe(const vcpkg_paths& paths) + { + static const fs::path dumpbin_exe = find_dumpbin_exe(paths); + return dumpbin_exe; + } + + static vcvarsall_and_platform_toolset find_vcvarsall_bat(const vcpkg_paths& paths) + { + const std::vector<std::string> vs2017_installation_instances = get_VS2017_installation_instances(paths); + std::vector<fs::path> paths_examined; + + // VS2017 + for (const fs::path& instance : vs2017_installation_instances) + { + const fs::path vcvarsall_bat = instance / "VC" / "Auxiliary" / "Build" / "vcvarsall.bat"; + paths_examined.push_back(vcvarsall_bat); + if (fs::exists(vcvarsall_bat)) + { + return { vcvarsall_bat , L"v141" }; + } + } + + // VS2015 + const optional<fs::path>& vs_2015_installation_instance = get_VS2015_installation_instance(); + if (vs_2015_installation_instance) + { + const fs::path vs2015_vcvarsall_bat = *vs_2015_installation_instance / "VC" / "vcvarsall.bat"; + + paths_examined.push_back(vs2015_vcvarsall_bat); + if (fs::exists(vs2015_vcvarsall_bat)) + { + return { vs2015_vcvarsall_bat, L"v140" }; + } + } + + System::println(System::color::error, "Could not detect vcvarsall.bat."); + System::println("The following paths were examined:"); + for (const fs::path& path : paths_examined) { - System::println(System::color::error, "Launching powershell failed or was denied"); - TrackProperty("error", "powershell install failed"); - TrackProperty("installcmd", install_cmd); - exit(rc); + System::println(" %s", path.generic_string()); } + exit(EXIT_FAILURE); + } + + const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths) + { + static const vcvarsall_and_platform_toolset vcvarsall_bat = find_vcvarsall_bat(paths); + return vcvarsall_bat; } - void ensure_git_on_path(const vcpkg_paths& paths) + static fs::path find_ProgramFiles() { - const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; - 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}; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(git_version, L"git --version 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency git"); + const optional<std::wstring> program_files = System::get_environmental_variable(L"PROGRAMFILES"); + Checks::check_exit(program_files.get() != nullptr, "Could not detect the PROGRAMFILES environmental variable"); + return *program_files; } - void ensure_cmake_on_path(const vcpkg_paths& paths) + static const fs::path& get_ProgramFiles() { - const fs::path downloaded_cmake = paths.downloads / "cmake-3.5.2-win32-x86" / "bin"; - 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}; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(cmake_version, L"cmake --version 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency cmake"); + static const fs::path p = find_ProgramFiles(); + return p; } - void ensure_nuget_on_path(const vcpkg_paths& paths) + static fs::path find_ProgramFiles_32_bit() { - 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()); + const optional<std::wstring> program_files_X86 = System::get_environmental_variable(L"ProgramFiles(x86)"); + if (program_files_X86) + { + return *program_files_X86; + } + + return get_ProgramFiles(); + } + + const fs::path& get_ProgramFiles_32_bit() + { + static const fs::path p = find_ProgramFiles_32_bit(); + return p; + } - static constexpr std::array<int, 3> nuget_version = {1,0,0}; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(nuget_version, L"nuget 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency nuget"); + static fs::path find_ProgramFiles_platform_bitness() + { + const optional<std::wstring> program_files_W6432 = System::get_environmental_variable(L"ProgramW6432"); + if (program_files_W6432) + { + return *program_files_W6432; + } + + return get_ProgramFiles(); + } + + const fs::path& get_ProgramFiles_platform_bitness() + { + static const fs::path p = find_ProgramFiles_platform_bitness(); + return p; } -}} +} diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index 48283e43f..57d4c665c 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -1,9 +1,8 @@ +#include "pch.h" #include "vcpkg_Files.h" -#include <fstream> -#include <regex> #include "vcpkg_System.h" -namespace vcpkg {namespace Files +namespace vcpkg::Files { static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); @@ -103,7 +102,7 @@ namespace vcpkg {namespace Files void recursive_find_all_files_in_dir(const fs::path& dir, std::vector<fs::path>* output) { - recursive_find_matching_paths_in_dir(dir, [&](const fs::path& current) + recursive_find_matching_paths_in_dir(dir, [](const fs::path& current) { return !fs::is_directory(current); }, output); @@ -118,7 +117,7 @@ namespace vcpkg {namespace Files void non_recursive_find_all_files_in_dir(const fs::path& dir, std::vector<fs::path>* output) { - non_recursive_find_matching_paths_in_dir(dir, [&](const fs::path& current) + non_recursive_find_matching_paths_in_dir(dir, [](const fs::path& current) { return !fs::is_directory(current); }, output); @@ -140,4 +139,4 @@ namespace vcpkg {namespace Files } System::println(""); } -}} +} diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg_Input.cpp index 29d487fdb..5720cadc0 100644 --- a/toolsrc/src/vcpkg_Input.cpp +++ b/toolsrc/src/vcpkg_Input.cpp @@ -1,9 +1,10 @@ +#include "pch.h" #include "vcpkg_Input.h" #include "vcpkg_System.h" #include "metrics.h" #include "vcpkg_Commands.h" -namespace vcpkg {namespace Input +namespace vcpkg::Input { package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const std::string& example_text) { @@ -37,16 +38,16 @@ namespace vcpkg {namespace Input { System::println(System::color::error, "Error: invalid triplet: %s", t.canonical_name()); TrackProperty("error", "invalid triplet: " + t.canonical_name()); - help_topic_valid_triplet(paths); + Commands::Help::help_topic_valid_triplet(paths); exit(EXIT_FAILURE); } } - void check_triplets(std::vector<package_spec> triplets, const vcpkg_paths& paths) + void check_triplets(const 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 46a4b1855..044fd3c05 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -1,13 +1,7 @@ +#include "pch.h" #include "vcpkg_Strings.h" -#include <cstdarg> -#include <algorithm> -#include <codecvt> -#include <iterator> -#include <functional> -#include <cctype> - -namespace vcpkg {namespace Strings {namespace details +namespace vcpkg::Strings::details { // To disambiguate between two overloads static const auto isspace = [](const char c) @@ -15,14 +9,26 @@ namespace vcpkg {namespace Strings {namespace details return std::isspace(c); }; + // Avoids C4244 warnings because of char<->int conversion that occur when using std::tolower() + static char tolower_char(const char c) + { + return static_cast<char>(std::tolower(c)); + } + + static _locale_t& c_locale() + { + static _locale_t c_locale_impl = _create_locale(LC_ALL, "C"); + return c_locale_impl; + } + std::string format_internal(const char* fmtstr, ...) { va_list lst; va_start(lst, fmtstr); - auto sz = _vscprintf(fmtstr, lst); + const int sz = _vscprintf_l(fmtstr, c_locale(), lst); std::string output(sz, '\0'); - _vsnprintf_s(&output[0], output.size() + 1, output.size() + 1, fmtstr, lst); + _vsnprintf_s_l(&output[0], output.size() + 1, output.size() + 1, fmtstr, c_locale(), lst); va_end(lst); return output; @@ -33,16 +39,16 @@ namespace vcpkg {namespace Strings {namespace details va_list lst; va_start(lst, fmtstr); - auto sz = _vscwprintf(fmtstr, lst); + const int sz = _vscwprintf_l(fmtstr, c_locale(), lst); std::wstring output(sz, '\0'); - _vsnwprintf_s(&output[0], output.size() + 1, output.size() + 1, fmtstr, lst); + _vsnwprintf_s_l(&output[0], output.size() + 1, output.size() + 1, fmtstr, c_locale(), lst); va_end(lst); return output; } -}}} +} -namespace vcpkg {namespace Strings +namespace vcpkg::Strings { std::wstring utf8_to_utf16(const std::string& s) { @@ -58,40 +64,28 @@ namespace vcpkg {namespace Strings std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern) { - std::string pattern_as_lower_case; - std::transform(pattern.begin(), pattern.end(), back_inserter(pattern_as_lower_case), tolower); + const std::string pattern_as_lower_case(ascii_to_lowercase(pattern)); 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 details::tolower_char(a) == b; }); } std::string ascii_to_lowercase(const std::string& input) { - std::string output = input; - std::transform(output.begin(), output.end(), output.begin(), ::tolower); + std::string output(input); + std::transform(output.begin(), output.end(), output.begin(), &details::tolower_char); return output; } - std::string join(const std::vector<std::string>& v, const std::string& delimiter) + std::string join(const std::string& delimiter, const std::vector<std::string>& v) { - if (v.empty()) - { - return std::string(); - } - - std::string output; - size_t size = v.size(); - - output.append(v.at(0)); - - for (size_t i = 1; i < size; ++i) - { - output.append(delimiter); - output.append(v.at(i)); - } + return join(delimiter, v, [](const std::string& p) -> const std::string& { return p; }); + } - return output; + std::wstring wjoin(const std::wstring& delimiter, const std::vector<std::wstring>& v) + { + return wjoin(delimiter, v, [](const std::wstring& p) -> const std::wstring&{ return p; }); } void trim(std::string* s) @@ -119,4 +113,24 @@ namespace vcpkg {namespace Strings return s == ""; }), strings->end()); } -}} + + std::vector<std::string> split(const std::string& s, const std::string& delimiter) + { + std::vector<std::string> output; + + size_t i = 0; + for (size_t pos = s.find(delimiter); pos != std::string::npos; pos = s.find(delimiter, pos)) + { + output.push_back(s.substr(i, pos - i)); + i = ++pos; + } + + // Add the rest of the string after the last delimiter, unless there is nothing after it + if (i != s.length()) + { + output.push_back(s.substr(i, s.length())); + } + + return output; + } +} diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 43eae3412..472f8450f 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -1,21 +1,97 @@ +#include "pch.h" #include "vcpkg_System.h" -#include <iostream> -#include <Windows.h> -#include <regex> +#include "vcpkg_Checks.h" -namespace vcpkg {namespace System +namespace vcpkg::System { fs::path get_exe_path_of_current_process() { - wchar_t buf[_MAX_PATH ]; + wchar_t buf[_MAX_PATH]; int bytes = GetModuleFileNameW(nullptr, buf, _MAX_PATH); if (bytes == 0) std::abort(); return fs::path(buf, buf + bytes); } + int cmd_execute_clean(const wchar_t* cmd_line) + { + static const std::wstring system_root = *get_environmental_variable(L"SystemRoot"); + static const std::wstring system_32 = system_root + LR"(\system32)"; + static const std::wstring new_PATH = Strings::wformat(LR"(Path=%s;%s;%s\WindowsPowerShell\v1.0\)", system_32, system_root, system_32); + + std::vector<std::wstring> env_wstrings = + { + L"ALLUSERSPROFILE", + L"APPDATA", + L"CommonProgramFiles", + L"CommonProgramFiles(x86)", + L"CommonProgramW6432", + L"COMPUTERNAME", + L"ComSpec", + L"HOMEDRIVE", + L"HOMEPATH", + L"LOCALAPPDATA", + L"LOGONSERVER", + L"NUMBER_OF_PROCESSORS", + L"OS", + L"PATHEXT", + L"PROCESSOR_ARCHITECTURE", + L"PROCESSOR_IDENTIFIER", + L"PROCESSOR_LEVEL", + L"PROCESSOR_REVISION", + L"ProgramData", + L"ProgramFiles", + L"ProgramFiles(x86)", + L"ProgramW6432", + L"PROMPT", + L"PSModulePath", + L"PUBLIC", + L"SystemDrive", + L"SystemRoot", + L"TEMP", + L"TMP", + L"USERDNSDOMAIN", + L"USERDOMAIN", + L"USERDOMAIN_ROAMINGPROFILE", + L"USERNAME", + L"USERPROFILE", + L"windir", + // Enables proxy information to be passed to Curl, the underlying download library in cmake.exe + L"HTTP_PROXY", + L"HTTPS_PROXY", + }; + + // Flush stdout before launching external process + _flushall(); + + std::vector<const wchar_t*> env_cstr; + env_cstr.reserve(env_wstrings.size() + 2); + + for (auto&& env_wstring : env_wstrings) + { + auto v = System::get_environmental_variable(env_wstring.c_str()); + if (v == nullptr || v->empty()) + continue; + + env_wstring.push_back(L'='); + env_wstring.append(*v); + env_cstr.push_back(env_wstring.c_str()); + } + + env_cstr.push_back(new_PATH.c_str()); + env_cstr.push_back(nullptr); + + // Basically we are wrapping it in quotes + const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); + auto exit_code = _wspawnlpe(_P_WAIT, L"cmd.exe", L"cmd.exe", L"/c", actual_cmd_line.c_str(), nullptr, env_cstr.data()); + return static_cast<int>(exit_code); + } + int cmd_execute(const wchar_t* cmd_line) { + // Flush stdout before launching external process + _flushall(); + // Basically we are wrapping it in quotes const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); int exit_code = _wsystem(actual_cmd_line.c_str()); @@ -24,6 +100,9 @@ namespace vcpkg {namespace System exit_code_and_output cmd_execute_and_capture_output(const wchar_t* cmd_line) { + // Flush stdout before launching external process + fflush(stdout); + const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); std::string output; @@ -31,7 +110,7 @@ namespace vcpkg {namespace System auto pipe = _wpopen(actual_cmd_line.c_str(), L"r"); if (pipe == nullptr) { - return {1, output}; + return { 1, output }; } while (fgets(buf, 1024, pipe)) { @@ -39,21 +118,32 @@ namespace vcpkg {namespace System } if (!feof(pipe)) { - return {1, output}; + return { 1, output }; } auto ec = _pclose(pipe); - return {ec, output}; + return { ec, output }; + } + + std::wstring create_powershell_script_cmd(const fs::path& script_path) + { + return create_powershell_script_cmd(script_path, L""); + } + + std::wstring create_powershell_script_cmd(const fs::path& script_path, const std::wstring& args) + { + // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned + return Strings::wformat(LR"(powershell -ExecutionPolicy Bypass -Command "& {& '%s' %s}")", script_path.native(), args); } void print(const char* message) { - std::cout << message; + fputs(message, stdout); } void println(const char* message) { print(message); - std::cout << "\n"; + putchar('\n'); } void print(const color c, const char* message) @@ -64,46 +154,61 @@ namespace vcpkg {namespace System GetConsoleScreenBufferInfo(hConsole, &consoleScreenBufferInfo); auto original_color = consoleScreenBufferInfo.wAttributes; - SetConsoleTextAttribute(hConsole, static_cast<int>(c) | (original_color & 0xF0)); - std::cout << message; + SetConsoleTextAttribute(hConsole, static_cast<WORD>(c) | (original_color & 0xF0)); + print(message); SetConsoleTextAttribute(hConsole, original_color); } void println(const color c, const char* message) { print(c, message); - std::cout << "\n"; + putchar('\n'); } - std::wstring wdupenv_str(const wchar_t* varname) noexcept + optional<std::wstring> get_environmental_variable(const wchar_t* varname) noexcept { - std::wstring ret; - wchar_t* buffer; - _wdupenv_s(&buffer, nullptr, varname); - if (buffer != nullptr) - { - ret = buffer; - free(buffer); - } + auto sz = GetEnvironmentVariableW(varname, nullptr, 0); + if (sz == 0) + return nullptr; + + auto ret = std::make_unique<std::wstring>(sz, L'\0'); + Checks::check_exit(MAXDWORD >= ret->size()); + auto sz2 = GetEnvironmentVariableW(varname, ret->data(), static_cast<DWORD>(ret->size())); + Checks::check_exit(sz2 + 1 == sz); + ret->pop_back(); return ret; } - void Stopwatch2::start() + void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept { - static_assert(sizeof(start_time) == sizeof(LARGE_INTEGER), ""); - - QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&start_time)); + _wputenv_s(varname, varvalue); } - void Stopwatch2::stop() + static bool is_string_keytype(DWORD hkey_type) { - QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&end_time)); - QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(&freq)); + return hkey_type == REG_SZ || hkey_type == REG_MULTI_SZ || hkey_type == REG_EXPAND_SZ; } - double Stopwatch2::microseconds() const + optional<std::wstring> get_registry_string(HKEY base, const wchar_t* subKey, const wchar_t* valuename) { - return (reinterpret_cast<const LARGE_INTEGER*>(&end_time)->QuadPart - - reinterpret_cast<const LARGE_INTEGER*>(&start_time)->QuadPart) * 1000000.0 / reinterpret_cast<const LARGE_INTEGER*>(&freq)->QuadPart; + HKEY k = nullptr; + LSTATUS ec = RegOpenKeyExW(base, subKey, NULL, KEY_READ, &k); + if (ec != ERROR_SUCCESS) + return nullptr; + + DWORD dwBufferSize = 0; + DWORD dwType = 0; + auto rc = RegQueryValueExW(k, valuename, nullptr, &dwType, nullptr, &dwBufferSize); + if (rc != ERROR_SUCCESS || !is_string_keytype(dwType) || dwBufferSize == 0 || dwBufferSize % sizeof(wchar_t) != 0) + return nullptr; + std::wstring ret; + ret.resize(dwBufferSize / sizeof(wchar_t)); + + rc = RegQueryValueExW(k, valuename, nullptr, &dwType, reinterpret_cast<LPBYTE>(ret.data()), &dwBufferSize); + if (rc != ERROR_SUCCESS || !is_string_keytype(dwType) || dwBufferSize != sizeof(wchar_t) * ret.size()) + return nullptr; + + ret.pop_back(); // remove extra trailing null byte + return std::make_unique<std::wstring>(std::move(ret)); } -}} +} diff --git a/toolsrc/src/vcpkg_cmd_arguments.cpp b/toolsrc/src/vcpkg_cmd_arguments.cpp index a3648668f..fdeb6e877 100644 --- a/toolsrc/src/vcpkg_cmd_arguments.cpp +++ b/toolsrc/src/vcpkg_cmd_arguments.cpp @@ -1,8 +1,6 @@ -#define WIN32_LEAN_AND_MEAN -#include <Windows.h> +#include "pch.h" #include "vcpkg_cmd_arguments.h" #include "vcpkg_Commands.h" -#include <unordered_set> #include "metrics.h" #include "vcpkg_System.h" @@ -18,7 +16,7 @@ namespace vcpkg { System::println(System::color::error, "Error: expected value after %s", option_name); TrackProperty("error", "error option name"); - print_usage(); + Commands::Help::print_usage(); exit(EXIT_FAILURE); } @@ -26,7 +24,7 @@ namespace vcpkg { System::println(System::color::error, "Error: %s specified multiple times", option_name); TrackProperty("error", "error option specified multiple times"); - print_usage(); + Commands::Help::print_usage(); exit(EXIT_FAILURE); } @@ -34,15 +32,15 @@ namespace vcpkg } static void parse_switch( - opt_bool new_setting, + opt_bool_t new_setting, const std::string& option_name, - opt_bool& option_field) + opt_bool_t& option_field) { - if (option_field != opt_bool::unspecified && option_field != new_setting) + if (option_field != opt_bool_t::UNSPECIFIED && option_field != new_setting) { System::println(System::color::error, "Error: conflicting values specified for --%s", option_name); TrackProperty("error", "error conflicting switches"); - print_usage(); + Commands::Help::print_usage(); exit(EXIT_FAILURE); } option_field = new_setting; @@ -96,27 +94,27 @@ namespace vcpkg } if (arg == "--debug") { - parse_switch(opt_bool::enabled, "debug", args.debug); + parse_switch(opt_bool_t::ENABLED, "debug", args.debug); continue; } if (arg == "--sendmetrics") { - parse_switch(opt_bool::enabled, "sendmetrics", args.sendmetrics); + parse_switch(opt_bool_t::ENABLED, "sendmetrics", args.sendmetrics); continue; } if (arg == "--printmetrics") { - parse_switch(opt_bool::enabled, "printmetrics", args.printmetrics); + parse_switch(opt_bool_t::ENABLED, "printmetrics", args.printmetrics); continue; } if (arg == "--no-sendmetrics") { - parse_switch(opt_bool::disabled, "sendmetrics", args.sendmetrics); + parse_switch(opt_bool_t::DISABLED, "sendmetrics", args.sendmetrics); continue; } if (arg == "--no-printmetrics") { - parse_switch(opt_bool::disabled, "printmetrics", args.printmetrics); + parse_switch(opt_bool_t::DISABLED, "printmetrics", args.printmetrics); continue; } diff --git a/toolsrc/src/vcpkg_info.cpp b/toolsrc/src/vcpkg_info.cpp deleted file mode 100644 index 25c09d6da..000000000 --- a/toolsrc/src/vcpkg_info.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "vcpkg_info.h" -#include "metrics.h" - -#define STRINGIFY(X) #X -#define MACRO_TO_STRING(X) STRINGIFY(X) - -#define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION)"" // Double quotes needed at the end to prevent blank token - -namespace vcpkg { namespace Info -{ - const std::string& version() - { - static const std::string s_version = -#include "../VERSION.txt" - - -#pragma warning( push ) -#pragma warning( disable : 4003) - // VCPKG_VERSION can be defined but have no value, which yields C4003. - + std::string(VCPKG_VERSION_AS_STRING) -#pragma warning( pop ) -#ifndef NDEBUG - + std::string("-debug") -#endif - + std::string(GetCompiledMetricsEnabled() ? "" : "-external"); - return s_version; - } - - const std::string& email() - { - static const std::string s_email = R"(vcpkg@microsoft.com)"; - return s_email; - } -}} diff --git a/toolsrc/src/vcpkg_metrics_uploader.cpp b/toolsrc/src/vcpkg_metrics_uploader.cpp index 14fc9ae48..82dcd4b03 100644 --- a/toolsrc/src/vcpkg_metrics_uploader.cpp +++ b/toolsrc/src/vcpkg_metrics_uploader.cpp @@ -5,13 +5,7 @@ using namespace vcpkg; -int WINAPI -WinMain( - _In_ HINSTANCE hInstance, - _In_opt_ HINSTANCE hPrevInstance, - _In_ LPSTR lpCmdLine, - _In_ int nShowCmd -) +int WINAPI WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int) { LPWSTR* szArgList; int argCount; diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp index b7e716307..fa6fca370 100644 --- a/toolsrc/src/vcpkg_paths.cpp +++ b/toolsrc/src/vcpkg_paths.cpp @@ -1,11 +1,156 @@ +#include "pch.h" #include "expected.h" #include "vcpkg_paths.h" #include "metrics.h" #include "vcpkg_System.h" #include "package_spec.h" +#include "vcpkg_Environment.h" namespace vcpkg { + static bool exists_and_has_equal_or_greater_version(const std::wstring& version_cmd, const std::array<int, 3>& expected_version) + { + static const std::regex re(R"###((\d+)\.(\d+)\.(\d+))###"); + + auto rc = System::cmd_execute_and_capture_output(Strings::wformat(LR"(%s 2>&1)", version_cmd)); + if (rc.exit_code != 0) + { + return false; + } + + std::match_results<std::string::const_iterator> match; + auto found = std::regex_search(rc.output, match, re); + if (!found) + { + return false; + } + + int d1 = atoi(match[1].str().c_str()); + int d2 = atoi(match[2].str().c_str()); + int d3 = atoi(match[3].str().c_str()); + if (d1 > expected_version[0] || (d1 == expected_version[0] && d2 > expected_version[1]) || (d1 == expected_version[0] && d2 == expected_version[1] && d3 >= expected_version[2])) + { + // satisfactory version found + return true; + } + + return false; + } + + static optional<fs::path> find_if_has_equal_or_greater_version(const std::vector<fs::path>& candidate_paths, const std::wstring& version_check_arguments, const std::array<int, 3>& expected_version) + { + auto it = std::find_if(candidate_paths.cbegin(), candidate_paths.cend(), [&](const fs::path& p) + { + const std::wstring cmd = Strings::wformat(LR"("%s" %s)", p.native(), version_check_arguments); + return exists_and_has_equal_or_greater_version(cmd, expected_version); + }); + + if (it != candidate_paths.cend()) + { + return std::make_unique<fs::path>(std::move(*it)); + } + + return nullptr; + } + + static std::vector<fs::path> find_from_PATH(const std::wstring& name) + { + const std::wstring cmd = Strings::wformat(L"where.exe %s", name); + auto out = System::cmd_execute_and_capture_output(cmd); + if (out.exit_code != 0) + { + return {}; + } + + const std::vector<std::string> paths_to_add = Strings::split(out.output, "\n"); + std::vector<fs::path> v; + v.insert(v.end(), paths_to_add.cbegin(), paths_to_add.cend()); + return v; + } + + static fs::path fetch_dependency(const fs::path scripts_folder, const std::wstring& tool_name, const fs::path& expected_downloaded_path) + { + const fs::path script = scripts_folder / "fetchDependency.ps1"; + auto install_cmd = System::create_powershell_script_cmd(script, Strings::wformat(L"-Dependency %s", tool_name)); + System::exit_code_and_output rc = System::cmd_execute_and_capture_output(install_cmd); + if (rc.exit_code) + { + System::println(System::color::error, "Launching powershell failed or was denied"); + TrackProperty("error", "powershell install failed"); + TrackProperty("installcmd", install_cmd); + exit(rc.exit_code); + } + + const fs::path actual_downloaded_path = rc.output; + Checks::check_exit(expected_downloaded_path == actual_downloaded_path, "Expected dependency downloaded path to be %s, but was %s", + expected_downloaded_path.generic_string(), actual_downloaded_path.generic_string()); + return actual_downloaded_path; + } + + static fs::path get_cmake_path(const fs::path& downloads_folder, const fs::path scripts_folder) + { + static constexpr std::array<int, 3> expected_version = { 3,8,0 }; + static const std::wstring version_check_arguments = L"--version"; + + const fs::path downloaded_copy = downloads_folder / "cmake-3.8.0-rc1-win32-x86" / "bin" / "cmake.exe"; + const std::vector<fs::path> from_path = find_from_PATH(L"cmake"); + + std::vector<fs::path> candidate_paths; + candidate_paths.push_back(downloaded_copy); + candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); + candidate_paths.push_back(Environment::get_ProgramFiles_platform_bitness() / "CMake" / "bin" / "cmake.exe"); + candidate_paths.push_back(Environment::get_ProgramFiles_32_bit() / "CMake" / "bin"); + + if (auto ret = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version)) + { + return *ret; + } + + return fetch_dependency(scripts_folder, L"cmake", downloaded_copy); + } + + fs::path get_nuget_path(const fs::path& downloads_folder, const fs::path scripts_folder) + { + static constexpr std::array<int, 3> expected_version = { 3,3,0 }; + static const std::wstring version_check_arguments = L""; + + const fs::path downloaded_copy = downloads_folder / "nuget-3.5.0" / "nuget.exe"; + const std::vector<fs::path> from_path = find_from_PATH(L"nuget"); + + std::vector<fs::path> candidate_paths; + candidate_paths.push_back(downloaded_copy); + candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); + + if (auto ret = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version)) + { + return *ret; + } + + return fetch_dependency(scripts_folder, L"nuget", downloaded_copy); + } + + fs::path get_git_path(const fs::path& downloads_folder, const fs::path scripts_folder) + { + static constexpr std::array<int, 3> expected_version = { 2,0,0 }; + static const std::wstring version_check_arguments = L"--version"; + + const fs::path downloaded_copy = downloads_folder / "MinGit-2.11.1-32-bit" / "cmd" / "git.exe"; + const std::vector<fs::path> from_path = find_from_PATH(L"git"); + + std::vector<fs::path> candidate_paths; + candidate_paths.push_back(downloaded_copy); + candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); + candidate_paths.push_back(Environment::get_ProgramFiles_platform_bitness() / "git" / "cmd" / "git.exe"); + candidate_paths.push_back(Environment::get_ProgramFiles_32_bit() / "git" / "cmd" / "git.exe"); + + if (auto ret = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version)) + { + return *ret; + } + + return fetch_dependency(scripts_folder, L"git", downloaded_copy); + } + expected<vcpkg_paths> vcpkg_paths::create(const fs::path& vcpkg_root_dir) { std::error_code ec; @@ -31,8 +176,9 @@ namespace vcpkg paths.ports = paths.root / "ports"; paths.installed = paths.root / "installed"; paths.triplets = paths.root / "triplets"; + paths.scripts = paths.root / "scripts"; - paths.buildsystems = paths.root / "scripts" / "buildsystems"; + paths.buildsystems = paths.scripts / "buildsystems"; paths.buildsystems_msbuild_targets = paths.buildsystems / "msbuild" / "vcpkg.targets"; paths.vcpkg_dir = paths.installed / "vcpkg"; @@ -40,7 +186,8 @@ namespace vcpkg paths.vcpkg_dir_info = paths.vcpkg_dir / "info"; paths.vcpkg_dir_updates = paths.vcpkg_dir / "updates"; - paths.ports_cmake = paths.root / "scripts" / "ports.cmake"; + paths.ports_cmake = paths.scripts / "ports.cmake"; + return paths; } @@ -78,4 +225,19 @@ namespace vcpkg } return false; } + + const fs::path& vcpkg_paths::get_cmake_exe() const + { + return this->cmake_exe.get_lazy([this]() { return get_cmake_path(this->downloads, this->scripts); }); + } + + const fs::path& vcpkg_paths::get_git_exe() const + { + return this->git_exe.get_lazy([this]() { return get_git_path(this->downloads, this->scripts); }); + } + + const fs::path& vcpkg_paths::get_nuget_exe() const + { + return this->nuget_exe.get_lazy([this]() { return get_nuget_path(this->downloads, this->scripts); }); + } } diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp new file mode 100644 index 000000000..7ea33da0a --- /dev/null +++ b/toolsrc/src/vcpkglib.cpp @@ -0,0 +1,215 @@ +#include "pch.h" +#include "vcpkglib.h" +#include "vcpkg_Files.h" +#include "Paragraphs.h" +#include "metrics.h" +#include "vcpkg_Strings.h" + +namespace vcpkg +{ + static StatusParagraphs load_current_database(const fs::path& vcpkg_dir_status_file, const fs::path& vcpkg_dir_status_file_old) + { + if (!fs::exists(vcpkg_dir_status_file)) + { + if (!fs::exists(vcpkg_dir_status_file_old)) + { + // no status file, use empty db + return StatusParagraphs(); + } + + fs::rename(vcpkg_dir_status_file_old, vcpkg_dir_status_file); + } + + auto text = Files::read_contents(vcpkg_dir_status_file).get_or_throw(); + auto pghs = Paragraphs::parse_paragraphs(text); + + std::vector<std::unique_ptr<StatusParagraph>> status_pghs; + for (auto&& p : pghs) + { + status_pghs.push_back(std::make_unique<StatusParagraph>(p)); + } + + return StatusParagraphs(std::move(status_pghs)); + } + + StatusParagraphs database_load_check(const vcpkg_paths& paths) + { + auto updates_dir = paths.vcpkg_dir_updates; + + std::error_code ec; + fs::create_directory(paths.installed, ec); + fs::create_directory(paths.vcpkg_dir, ec); + fs::create_directory(paths.vcpkg_dir_info, ec); + fs::create_directory(updates_dir, ec); + + const fs::path& status_file = paths.vcpkg_dir_status_file; + const fs::path status_file_old = status_file.parent_path() / "status-old"; + const fs::path status_file_new = status_file.parent_path() / "status-new"; + + StatusParagraphs current_status_db = load_current_database(status_file, status_file_old); + + auto b = fs::directory_iterator(updates_dir); + auto e = fs::directory_iterator(); + if (b == e) + { + // updates directory is empty, control file is up-to-date. + return current_status_db; + } + + for (; b != e; ++b) + { + if (!fs::is_regular_file(b->status())) + continue; + if (b->path().filename() == "incomplete") + continue; + + auto text = Files::read_contents(b->path()).get_or_throw(); + auto pghs = Paragraphs::parse_paragraphs(text); + for (auto&& p : pghs) + { + current_status_db.insert(std::make_unique<StatusParagraph>(p)); + } + } + + std::fstream(status_file_new, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc) << current_status_db; + + if (fs::exists(status_file_old)) + fs::remove(status_file_old); + if (fs::exists(status_file)) + fs::rename(status_file, status_file_old); + fs::rename(status_file_new, status_file); + fs::remove(status_file_old); + + b = fs::directory_iterator(updates_dir); + for (; b != e; ++b) + { + if (!fs::is_regular_file(b->status())) + continue; + fs::remove(b->path()); + } + + return current_status_db; + } + + void write_update(const vcpkg_paths& paths, const StatusParagraph& p) + { + static int update_id = 0; + auto my_update_id = update_id++; + auto tmp_update_filename = paths.vcpkg_dir_updates / "incomplete"; + auto update_filename = paths.vcpkg_dir_updates / std::to_string(my_update_id); + std::fstream fs(tmp_update_filename, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc); + fs << p; + fs.close(); + fs::rename(tmp_update_filename, update_filename); + } + + static void upgrade_to_slash_terminated_sorted_format(std::vector<std::string>* lines, const fs::path& listfile_path) + { + static bool was_tracked = false; + + if (lines->empty()) + { + return; + } + + if (lines->at(0).back() == '/') + { + return; // File already in the new format + } + + if (!was_tracked) + { + was_tracked = true; + TrackProperty("listfile", "update to new format"); + } + + // The files are sorted such that directories are placed just before the files they contain + // (They are not necessarily sorted alphabetically, e.g. libflac) + // Therefore we can detect the entries that represent directories by comparing every element with the next one + // and checking if the next has a slash immediately after the current one's length + for (size_t i = 0; i < lines->size() - 1; i++) + { + std::string& current_string = lines->at(i); + const std::string& next_string = lines->at(i + 1); + + const size_t potential_slash_char_index = current_string.length(); + // Make sure the index exists first + if (next_string.size() > potential_slash_char_index && next_string.at(potential_slash_char_index) == '/') + { + current_string += '/'; // Mark as a directory + } + } + + // After suffixing the directories with a slash, we can now sort. + // We cannot sort before adding the suffixes because the following (actual example): + /* + x86-windows/include/FLAC <<<<<< This would be separated from its group due to sorting + x86-windows/include/FLAC/all.h + x86-windows/include/FLAC/assert.h + x86-windows/include/FLAC/callback.h + x86-windows/include/FLAC++ + x86-windows/include/FLAC++/all.h + x86-windows/include/FLAC++/decoder.h + x86-windows/include/FLAC++/encoder.h + * + x86-windows/include/FLAC/ <<<<<< This will now be kept with its group when sorting + x86-windows/include/FLAC/all.h + x86-windows/include/FLAC/assert.h + x86-windows/include/FLAC/callback.h + x86-windows/include/FLAC++/ + x86-windows/include/FLAC++/all.h + x86-windows/include/FLAC++/decoder.h + x86-windows/include/FLAC++/encoder.h + */ + // Note that after sorting, the FLAC++/ group will be placed before the FLAC/ group + // The new format is lexicographically sorted + std::sort(lines->begin(), lines->end()); + + // Replace the listfile on disk + const fs::path updated_listfile_path = listfile_path.generic_string() + "_updated"; + Files::write_all_lines(updated_listfile_path, *lines); + fs::rename(updated_listfile_path, listfile_path); + } + + std::vector<StatusParagraph_and_associated_files> get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db) + { + std::vector<StatusParagraph_and_associated_files> installed_files; + + for (const std::unique_ptr<StatusParagraph>& pgh : status_db) + { + if (pgh->state != install_state_t::installed) + { + continue; + } + + const fs::path listfile_path = paths.listfile_path(pgh->package); + std::vector<std::string> installed_files_of_current_pgh = Files::read_all_lines(listfile_path).get_or_throw(); + Strings::trim_all_and_remove_whitespace_strings(&installed_files_of_current_pgh); + upgrade_to_slash_terminated_sorted_format(&installed_files_of_current_pgh, listfile_path); + + // Remove the directories + installed_files_of_current_pgh.erase( + std::remove_if(installed_files_of_current_pgh.begin(), installed_files_of_current_pgh.end(), [](const std::string& file) -> bool + { + return file.back() == '/'; + } + ), installed_files_of_current_pgh.end()); + + StatusParagraph_and_associated_files pgh_and_files = { *pgh, ImmutableSortedVector<std::string>::create(std::move(installed_files_of_current_pgh)) }; + installed_files.push_back(std::move(pgh_and_files)); + } + + return installed_files; + } + + CMakeVariable::CMakeVariable(const std::wstring& varname, const wchar_t* varvalue) : s(Strings::wformat(LR"("-D%s=%s")", varname, varvalue)) { } + CMakeVariable::CMakeVariable(const std::wstring& varname, const std::string& varvalue) : CMakeVariable(varname, Strings::utf8_to_utf16(varvalue).c_str()) { } + CMakeVariable::CMakeVariable(const std::wstring& varname, const std::wstring& varvalue) : CMakeVariable(varname, varvalue.c_str()) {} + CMakeVariable::CMakeVariable(const std::wstring& varname, const fs::path& path) : CMakeVariable(varname, path.generic_wstring()) {} + + std::wstring make_cmake_cmd(const fs::path& cmake_exe, const fs::path& cmake_script, const std::vector<CMakeVariable>& pass_variables) + { + std::wstring cmd_cmake_pass_variables = Strings::wjoin(L" ", pass_variables, [](auto&& v) { return v.s; }); + return Strings::wformat(LR"("%s" %s -P "%s")", cmake_exe.native(), cmd_cmake_pass_variables, cmake_script.generic_wstring()); + } +} diff --git a/toolsrc/src/vcpkglib_helpers.cpp b/toolsrc/src/vcpkglib_helpers.cpp index d104bb19d..6b96c25cb 100644 --- a/toolsrc/src/vcpkglib_helpers.cpp +++ b/toolsrc/src/vcpkglib_helpers.cpp @@ -1,9 +1,8 @@ +#include "pch.h" #include "vcpkg_Checks.h" #include "vcpkglib_helpers.h" -#include <unordered_map> -#include <regex> -namespace vcpkg {namespace details +namespace vcpkg::details { std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname) { @@ -53,4 +52,4 @@ namespace vcpkg {namespace details simple_desc.append("..."); return simple_desc; } -}} +} diff --git a/toolsrc/vcpkg.sln b/toolsrc/vcpkg.sln index 83051670a..c97756c21 100644 --- a/toolsrc/vcpkg.sln +++ b/toolsrc/vcpkg.sln @@ -5,12 +5,8 @@ VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vcpkg", "vcpkg\vcpkg.vcxproj", "{34671B80-54F9-46F5-8310-AC429C11D4FB}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vcpkgcommon", "vcpkgcommon\vcpkgcommon.vcxproj", "{7129F242-F20C-43E7-BBEC-4E15B71890B2}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vcpkglib", "vcpkglib\vcpkglib.vcxproj", "{B98C92B7-2874-4537-9D46-D14E5C237F04}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vcpkgmetrics", "vcpkgmetrics\vcpkgmetrics.vcxproj", "{7226078C-1D2A-4123-9EF1-8DF2B722B8F1}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vcpkgmetricsuploader", "vcpkgmetricsuploader\vcpkgmetricsuploader.vcxproj", "{7D6FDEEB-B299-4A23-85EE-F67C4DED47BE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vcpkgtest", "vcpkgtest\vcpkgtest.vcxproj", "{F27B8DB0-1279-4AF8-A2E3-1D49C4F0220D}" @@ -31,14 +27,6 @@ Global {34671B80-54F9-46F5-8310-AC429C11D4FB}.Release|x64.Build.0 = Release|x64 {34671B80-54F9-46F5-8310-AC429C11D4FB}.Release|x86.ActiveCfg = Release|Win32 {34671B80-54F9-46F5-8310-AC429C11D4FB}.Release|x86.Build.0 = Release|Win32 - {7129F242-F20C-43E7-BBEC-4E15B71890B2}.Debug|x64.ActiveCfg = Debug|x64 - {7129F242-F20C-43E7-BBEC-4E15B71890B2}.Debug|x64.Build.0 = Debug|x64 - {7129F242-F20C-43E7-BBEC-4E15B71890B2}.Debug|x86.ActiveCfg = Debug|Win32 - {7129F242-F20C-43E7-BBEC-4E15B71890B2}.Debug|x86.Build.0 = Debug|Win32 - {7129F242-F20C-43E7-BBEC-4E15B71890B2}.Release|x64.ActiveCfg = Release|x64 - {7129F242-F20C-43E7-BBEC-4E15B71890B2}.Release|x64.Build.0 = Release|x64 - {7129F242-F20C-43E7-BBEC-4E15B71890B2}.Release|x86.ActiveCfg = Release|Win32 - {7129F242-F20C-43E7-BBEC-4E15B71890B2}.Release|x86.Build.0 = Release|Win32 {B98C92B7-2874-4537-9D46-D14E5C237F04}.Debug|x64.ActiveCfg = Debug|x64 {B98C92B7-2874-4537-9D46-D14E5C237F04}.Debug|x64.Build.0 = Debug|x64 {B98C92B7-2874-4537-9D46-D14E5C237F04}.Debug|x86.ActiveCfg = Debug|Win32 @@ -47,14 +35,6 @@ Global {B98C92B7-2874-4537-9D46-D14E5C237F04}.Release|x64.Build.0 = Release|x64 {B98C92B7-2874-4537-9D46-D14E5C237F04}.Release|x86.ActiveCfg = Release|Win32 {B98C92B7-2874-4537-9D46-D14E5C237F04}.Release|x86.Build.0 = Release|Win32 - {7226078C-1D2A-4123-9EF1-8DF2B722B8F1}.Debug|x64.ActiveCfg = Debug|x64 - {7226078C-1D2A-4123-9EF1-8DF2B722B8F1}.Debug|x64.Build.0 = Debug|x64 - {7226078C-1D2A-4123-9EF1-8DF2B722B8F1}.Debug|x86.ActiveCfg = Debug|Win32 - {7226078C-1D2A-4123-9EF1-8DF2B722B8F1}.Debug|x86.Build.0 = Debug|Win32 - {7226078C-1D2A-4123-9EF1-8DF2B722B8F1}.Release|x64.ActiveCfg = Release|x64 - {7226078C-1D2A-4123-9EF1-8DF2B722B8F1}.Release|x64.Build.0 = Release|x64 - {7226078C-1D2A-4123-9EF1-8DF2B722B8F1}.Release|x86.ActiveCfg = Release|Win32 - {7226078C-1D2A-4123-9EF1-8DF2B722B8F1}.Release|x86.Build.0 = Release|Win32 {7D6FDEEB-B299-4A23-85EE-F67C4DED47BE}.Debug|x64.ActiveCfg = Debug|x64 {7D6FDEEB-B299-4A23-85EE-F67C4DED47BE}.Debug|x64.Build.0 = Debug|x64 {7D6FDEEB-B299-4A23-85EE-F67C4DED47BE}.Debug|x86.ActiveCfg = Debug|Win32 diff --git a/toolsrc/vcpkg/vcpkg.vcxproj b/toolsrc/vcpkg/vcpkg.vcxproj index 7fab309d3..fd8e5d33e 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj +++ b/toolsrc/vcpkg/vcpkg.vcxproj @@ -22,31 +22,28 @@ <ProjectGuid>{34671B80-54F9-46F5-8310-AC429C11D4FB}</ProjectGuid> <RootNamespace>vcpkg</RootNamespace> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> @@ -76,6 +73,8 @@ <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <MinimalRebuild>false</MinimalRebuild> </ClCompile> <Link> <AdditionalDependencies>winhttp.lib;version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -88,6 +87,8 @@ <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <MinimalRebuild>false</MinimalRebuild> </ClCompile> <Link> <AdditionalDependencies>winhttp.lib;version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -103,6 +104,7 @@ <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> @@ -120,6 +122,7 @@ <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> @@ -128,51 +131,12 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\MachineType.cpp" /> - <ClCompile Include="..\src\coff_file_reader.cpp" /> - <ClCompile Include="..\src\commands_cache.cpp" /> - <ClCompile Include="..\src\commands_create.cpp" /> - <ClCompile Include="..\src\commands_edit.cpp" /> - <ClCompile Include="..\src\commands_hash.cpp" /> - <ClCompile Include="..\src\commands_import.cpp" /> - <ClCompile Include="..\src\commands_list.cpp" /> - <ClCompile Include="..\src\commands_owns.cpp" /> - <ClCompile Include="..\src\commands_portsdiff.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\coff_file_reader.h" /> - <ClInclude Include="..\include\filesystem_fs.h" /> - <ClInclude Include="..\include\MachineType.h" /> - <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"> - <Project>{7129f242-f20c-43e7-bbec-4e15b71890b2}</Project> - </ProjectReference> <ProjectReference Include="..\vcpkglib\vcpkglib.vcxproj"> <Project>{b98c92b7-2874-4537-9d46-d14e5c237f04}</Project> </ProjectReference> - <ProjectReference Include="..\vcpkgmetrics\vcpkgmetrics.vcxproj"> - <Project>{7226078c-1d2a-4123-9ef1-8df2b722b8f1}</Project> - </ProjectReference> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\src\vcpkg.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/toolsrc/vcpkg/vcpkg.vcxproj.filters b/toolsrc/vcpkg/vcpkg.vcxproj.filters index cfbb17a22..ca9723bbf 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj.filters +++ b/toolsrc/vcpkg/vcpkg.vcxproj.filters @@ -15,103 +15,8 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\main.cpp"> + <ClCompile Include="..\src\vcpkg.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\commands_other.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\commands_help.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\commands_integration.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\commands_installation.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\post_build_lint.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\vcpkg_cmd_arguments.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\vcpkg_Environment.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <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> - <ClCompile Include="..\src\coff_file_reader.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\MachineType.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\commands_hash.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\commands_portsdiff.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\include\post_build_lint.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\vcpkg_cmd_arguments.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\vcpkg_Commands.h"> - <Filter>Header Files</Filter> - </ClInclude> - <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> - <ClInclude Include="..\include\coff_file_reader.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\MachineType.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\filesystem_fs.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 deleted file mode 100644 index 218a826ad..000000000 --- a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj +++ /dev/null @@ -1,144 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{7129F242-F20C-43E7-BBEC-4E15B71890B2}</ProjectGuid> - <RootNamespace>vcpkgcommon</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="Shared"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup /> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - <Link> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - <Link> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\src\Stopwatch.cpp" /> - <ClCompile Include="..\src\vcpkg_Checks.cpp" /> - <ClCompile Include="..\src\vcpkg_Files.cpp" /> - <ClCompile Include="..\src\vcpkg_Strings.cpp" /> - <ClCompile Include="..\src\vcpkg_System.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\include\expected.h" /> - <ClInclude Include="..\include\opt_bool.h" /> - <ClInclude Include="..\include\Stopwatch.h" /> - <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> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters deleted file mode 100644 index 4d40bfbe2..000000000 --- a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\vcpkg_Checks.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\vcpkg_Strings.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\vcpkg_System.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\vcpkg_Files.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\Stopwatch.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\include\vcpkg_Checks.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\vcpkg_Strings.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\vcpkg_System.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\expected.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\vcpkg_Files.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="..\include\vcpkg_Graphs.h"> - <Filter>Header Files</Filter> - </ClInclude> - <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> - <ClInclude Include="..\include\Stopwatch.h"> - <Filter>Header Files</Filter> - </ClInclude> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 10cc32935..dd5dd124a 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -22,34 +22,34 @@ <ProjectGuid>{B98C92B7-2874-4537-9D46-D14E5C237F04}</ProjectGuid> <RootNamespace>vcpkglib</RootNamespace> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> + <PropertyGroup> + <DISABLE_METRICS Condition="'$(DISABLE_METRICS)' == ''">0</DISABLE_METRICS> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> @@ -75,18 +75,26 @@ <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>VCPKG_VERSION=$(VCPKG_VERSION);_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DISABLE_METRICS=$(DISABLE_METRICS);VCPKG_VERSION=$(VCPKG_VERSION);_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <PrecompiledHeader>Use</PrecompiledHeader> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <MinimalRebuild>false</MinimalRebuild> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>VCPKG_VERSION=$(VCPKG_VERSION);_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DISABLE_METRICS=$(DISABLE_METRICS);VCPKG_VERSION=$(VCPKG_VERSION);_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <PrecompiledHeader>Use</PrecompiledHeader> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <MinimalRebuild>false</MinimalRebuild> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> @@ -97,8 +105,11 @@ <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>VCPKG_VERSION=$(VCPKG_VERSION);_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DISABLE_METRICS=$(DISABLE_METRICS);VCPKG_VERSION=$(VCPKG_VERSION);_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <PrecompiledHeader>Use</PrecompiledHeader> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> @@ -113,8 +124,11 @@ <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>VCPKG_VERSION=$(VCPKG_VERSION);_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>DISABLE_METRICS=$(DISABLE_METRICS);VCPKG_VERSION=$(VCPKG_VERSION);_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <PrecompiledHeader>Use</PrecompiledHeader> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> @@ -123,23 +137,87 @@ </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="..\include\BinaryParagraph.h" /> - <ClInclude Include="..\include\BuildInfo.h" /> + <ClInclude Include="..\include\lazy.h" /> + <ClInclude Include="..\include\PostBuildLint_BuildInfo.h" /> + <ClInclude Include="..\include\PostBuildLint_BuildPolicies.h" /> + <ClInclude Include="..\include\coff_file_reader.h" /> + <ClInclude Include="..\include\expected.h" /> + <ClInclude Include="..\include\filesystem_fs.h" /> + <ClInclude Include="..\include\ImmutableSortedVector.h" /> + <ClInclude Include="..\include\MachineType.h" /> + <ClInclude Include="..\include\metrics.h" /> + <ClInclude Include="..\include\opt_bool.h" /> <ClInclude Include="..\include\package_spec.h" /> <ClInclude Include="..\include\package_spec_parse_result.h" /> <ClInclude Include="..\include\Paragraphs.h" /> + <ClInclude Include="..\include\pch.h" /> + <ClInclude Include="..\include\PostBuildLint.h" /> + <ClInclude Include="..\include\PostBuildLint_BuildType.h" /> + <ClInclude Include="..\include\PostBuildLint_ConfigurationType.h" /> + <ClInclude Include="..\include\PostBuildLint_LinkageType.h" /> <ClInclude Include="..\include\SourceParagraph.h" /> <ClInclude Include="..\include\StatusParagraph.h" /> <ClInclude Include="..\include\StatusParagraphs.h" /> + <ClInclude Include="..\include\vcpkg_Chrono.h" /> <ClInclude Include="..\include\triplet.h" /> - <ClInclude Include="..\include\vcpkg.h" /> + <ClInclude Include="..\include\vcpkglib.h" /> <ClInclude Include="..\include\vcpkglib_helpers.h" /> + <ClInclude Include="..\include\vcpkg_Checks.h" /> + <ClInclude Include="..\include\vcpkg_cmd_arguments.h" /> + <ClInclude Include="..\include\vcpkg_Commands.h" /> + <ClInclude Include="..\include\vcpkg_Dependencies.h" /> + <ClInclude Include="..\include\vcpkg_Enums.h" /> + <ClInclude Include="..\include\vcpkg_Environment.h" /> + <ClInclude Include="..\include\vcpkg_Files.h" /> + <ClInclude Include="..\include\vcpkg_Graphs.h" /> + <ClInclude Include="..\include\vcpkg_Input.h" /> + <ClInclude Include="..\include\vcpkg_Maps.h" /> + <ClInclude Include="..\include\vcpkg_optional.h" /> <ClInclude Include="..\include\vcpkg_paths.h" /> - <ClInclude Include="..\include\vcpkg_info.h" /> + <ClInclude Include="..\include\vcpkg_Sets.h" /> + <ClInclude Include="..\include\vcpkg_Strings.h" /> + <ClInclude Include="..\include\vcpkg_System.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\src\BinaryParagraph.cpp" /> - <ClCompile Include="..\src\BuildInfo.cpp" /> - <ClCompile Include="..\src\vcpkg.cpp" /> + <ClCompile Include="..\src\commands_ci.cpp" /> + <ClCompile Include="..\src\PostBuildLint_BuildInfo.cpp" /> + <ClCompile Include="..\src\PostBuildLint_BuildPolicies.cpp" /> + <ClCompile Include="..\src\coff_file_reader.cpp" /> + <ClCompile Include="..\src\commands_available_commands.cpp" /> + <ClCompile Include="..\src\commands_build.cpp" /> + <ClCompile Include="..\src\commands_build_external.cpp" /> + <ClCompile Include="..\src\commands_cache.cpp" /> + <ClCompile Include="..\src\commands_contact.cpp" /> + <ClCompile Include="..\src\commands_create.cpp" /> + <ClCompile Include="..\src\commands_edit.cpp" /> + <ClCompile Include="..\src\commands_hash.cpp" /> + <ClCompile Include="..\src\commands_help.cpp" /> + <ClCompile Include="..\src\commands_import.cpp" /> + <ClCompile Include="..\src\commands_install.cpp" /> + <ClCompile Include="..\src\commands_integrate.cpp" /> + <ClCompile Include="..\src\commands_list.cpp" /> + <ClCompile Include="..\src\commands_owns.cpp" /> + <ClCompile Include="..\src\commands_portsdiff.cpp" /> + <ClCompile Include="..\src\commands_remove.cpp" /> + <ClCompile Include="..\src\commands_search.cpp" /> + <ClCompile Include="..\src\commands_update.cpp" /> + <ClCompile Include="..\src\commands_version.cpp" /> + <ClCompile Include="..\src\MachineType.cpp" /> + <ClCompile Include="..\src\metrics.cpp" /> + <ClCompile Include="..\src\opt_bool.cpp" /> + <ClCompile Include="..\src\pch.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> + </ClCompile> + <ClCompile Include="..\src\PostBuildLint.cpp" /> + <ClCompile Include="..\src\PostBuildLint_ConfigurationType.cpp" /> + <ClCompile Include="..\src\PostBuildLint_LinkageType.cpp" /> + <ClCompile Include="..\src\PostBuildLint_BuildType.cpp" /> + <ClCompile Include="..\src\vcpkg_Chrono.cpp" /> + <ClCompile Include="..\src\vcpkglib.cpp" /> <ClCompile Include="..\src\package_spec.cpp" /> <ClCompile Include="..\src\package_spec_parse_result.cpp" /> <ClCompile Include="..\src\Paragraphs.cpp" /> @@ -148,8 +226,16 @@ <ClCompile Include="..\src\StatusParagraphs.cpp" /> <ClCompile Include="..\src\triplet.cpp" /> <ClCompile Include="..\src\vcpkglib_helpers.cpp" /> + <ClCompile Include="..\src\vcpkg_Checks.cpp" /> + <ClCompile Include="..\src\vcpkg_cmd_arguments.cpp" /> + <ClCompile Include="..\src\vcpkg_Dependencies.cpp" /> + <ClCompile Include="..\src\vcpkg_Enums.cpp" /> + <ClCompile Include="..\src\vcpkg_Environment.cpp" /> + <ClCompile Include="..\src\vcpkg_Files.cpp" /> + <ClCompile Include="..\src\vcpkg_Input.cpp" /> <ClCompile Include="..\src\vcpkg_paths.cpp" /> - <ClCompile Include="..\src\vcpkg_info.cpp" /> + <ClCompile Include="..\src\vcpkg_Strings.cpp" /> + <ClCompile Include="..\src\vcpkg_System.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index e8856235c..d701321be 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -45,20 +45,134 @@ <ClCompile Include="..\src\Paragraphs.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg.cpp"> + <ClCompile Include="..\src\metrics.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_info.cpp"> + <ClCompile Include="..\src\vcpkg_Input.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\BuildInfo.cpp"> + <ClCompile Include="..\src\vcpkg_Environment.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\coff_file_reader.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_available_commands.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_build.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_build_external.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_cache.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_contact.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_create.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_edit.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_hash.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_help.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_import.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_install.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_integrate.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_list.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_owns.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_portsdiff.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <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_update.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_version.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\MachineType.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_cmd_arguments.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_Dependencies.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkglib.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_System.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_Checks.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_Files.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_Strings.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\pch.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\opt_bool.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\PostBuildLint.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\PostBuildLint_BuildInfo.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\PostBuildLint_BuildPolicies.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\PostBuildLint_LinkageType.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\PostBuildLint_ConfigurationType.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\PostBuildLint_BuildType.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_Enums.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\commands_ci.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\vcpkg_Chrono.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\include\vcpkg.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="..\include\package_spec.h"> <Filter>Header Files</Filter> </ClInclude> @@ -89,10 +203,97 @@ <ClInclude Include="..\include\Paragraphs.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_info.h"> + <ClInclude Include="..\include\metrics.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Input.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\coff_file_reader.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\filesystem_fs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\MachineType.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_cmd_arguments.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Commands.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Dependencies.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Environment.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkglib.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\expected.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\ImmutableSortedVector.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\opt_bool.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Checks.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Files.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Graphs.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> + <ClInclude Include="..\include\vcpkg_Strings.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_System.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\pch.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_optional.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\PostBuildLint.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\PostBuildLint_BuildInfo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\PostBuildLint_BuildPolicies.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\PostBuildLint_LinkageType.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\PostBuildLint_ConfigurationType.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\PostBuildLint_BuildType.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Enums.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg_Chrono.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\include\BuildInfo.h"> + <ClInclude Include="..\include\lazy.h"> <Filter>Header Files</Filter> </ClInclude> </ItemGroup> diff --git a/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj b/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj deleted file mode 100644 index 7b7fe89ed..000000000 --- a/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{7226078C-1D2A-4123-9EF1-8DF2B722B8F1}</ProjectGuid> - <RootNamespace>vcpkgmetrics</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup> - <DISABLE_METRICS Condition="'$(DISABLE_METRICS)' == ''">0</DISABLE_METRICS> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="Shared"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup /> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>DISABLE_METRICS=$(DISABLE_METRICS);_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - <Link> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>DISABLE_METRICS=$(DISABLE_METRICS);_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - <Link> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup> - <ClCompile> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">DISABLE_METRICS=$(DISABLE_METRICS);_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">DISABLE_METRICS=$(DISABLE_METRICS);_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/std:c++latest %(AdditionalOptions)</AdditionalOptions> - <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/std:c++latest %(AdditionalOptions)</AdditionalOptions> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\include\metrics.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\metrics.cpp" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj.filters b/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj.filters deleted file mode 100644 index 7116a4247..000000000 --- a/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="Resource Files"> - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\include\metrics.h"> - <Filter>Header Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\src\metrics.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj index 1e2a85087..472d74e30 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj @@ -22,31 +22,28 @@ <ProjectGuid>{7D6FDEEB-B299-4A23-85EE-F67C4DED47BE}</ProjectGuid> <RootNamespace>vcpkgmetricsuploader</RootNamespace> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> @@ -76,6 +73,8 @@ <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <MinimalRebuild>false</MinimalRebuild> </ClCompile> <Link> <AdditionalDependencies>winhttp.lib;version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -83,11 +82,13 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <MinimalRebuild>false</MinimalRebuild> </ClCompile> <Link> <AdditionalDependencies>winhttp.lib;version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -103,6 +104,7 @@ <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> @@ -120,6 +122,7 @@ <AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_MBCS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> @@ -131,11 +134,8 @@ <ClCompile Include="..\src\vcpkg_metrics_uploader.cpp" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\vcpkgcommon\vcpkgcommon.vcxproj"> - <Project>{7129f242-f20c-43e7-bbec-4e15b71890b2}</Project> - </ProjectReference> - <ProjectReference Include="..\vcpkgmetrics\vcpkgmetrics.vcxproj"> - <Project>{7226078c-1d2a-4123-9ef1-8df2b722b8f1}</Project> + <ProjectReference Include="..\vcpkglib\vcpkglib.vcxproj"> + <Project>{b98c92b7-2874-4537-9d46-d14e5c237f04}</Project> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index d14f86745..c12c2dd31 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -23,34 +23,27 @@ <ClCompile Include="..\src\tests_paragraph.cpp" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\vcpkgcommon\vcpkgcommon.vcxproj"> - <Project>{7129f242-f20c-43e7-bbec-4e15b71890b2}</Project> - </ProjectReference> <ProjectReference Include="..\vcpkglib\vcpkglib.vcxproj"> <Project>{b98c92b7-2874-4537-9d46-d14e5c237f04}</Project> </ProjectReference> - <ProjectReference Include="..\vcpkgmetrics\vcpkgmetrics.vcxproj"> - <Project>{7226078c-1d2a-4123-9ef1-8df2b722b8f1}</Project> - </ProjectReference> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{F27B8DB0-1279-4AF8-A2E3-1D49C4F0220D}</ProjectGuid> <Keyword>Win32Proj</Keyword> <RootNamespace>vcpkgtest</RootNamespace> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <CharacterSet>Unicode</CharacterSet> <UseOfMfc>false</UseOfMfc> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> <UseOfMfc>false</UseOfMfc> @@ -58,14 +51,12 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <CharacterSet>Unicode</CharacterSet> <UseOfMfc>false</UseOfMfc> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>Unicode</CharacterSet> <UseOfMfc>false</UseOfMfc> @@ -106,6 +97,8 @@ <UseFullPaths>true</UseFullPaths> <PrecompiledHeaderFile /> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <MinimalRebuild>false</MinimalRebuild> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -115,13 +108,15 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <PrecompiledHeader>NotUsing</PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\include;$(VCInstallDir)UnitTest\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <UseFullPaths>true</UseFullPaths> <PrecompiledHeaderFile /> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <MinimalRebuild>false</MinimalRebuild> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -140,6 +135,7 @@ <UseFullPaths>true</UseFullPaths> <PrecompiledHeaderFile /> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <SubSystem>Windows</SubSystem> @@ -160,6 +156,7 @@ <UseFullPaths>true</UseFullPaths> <PrecompiledHeaderFile /> <AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> </ClCompile> <Link> <SubSystem>Windows</SubSystem> |
