aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-02-08 15:12:28 -0800
committerGitHub <noreply@github.com>2017-02-08 15:12:28 -0800
commit7ddae17e2f520e83d25f78c078bf8b8a58fff447 (patch)
tree87e2fc5c57a685367ec051b1efbdeb5d3ab43f4d
parent5e588ddb5be9e6e27cebcc3be2e1a27f3ca83a50 (diff)
parenta9f7fc6e90feaad50c1221ef9bd56e2620302215 (diff)
downloadvcpkg-7ddae17e2f520e83d25f78c078bf8b8a58fff447.tar.gz
vcpkg-7ddae17e2f520e83d25f78c078bf8b8a58fff447.zip
Merge branch 'master' into master
-rw-r--r--CHANGELOG.md329
-rw-r--r--README.md13
-rw-r--r--docs/EXAMPLES.md91
-rw-r--r--docs/FAQ.md3
-rw-r--r--docs/PRIVACY.md6
-rw-r--r--ports/ace/CONTROL2
-rw-r--r--ports/ace/portfile.cmake25
-rw-r--r--ports/anax/Add-bin-output.patch10
-rw-r--r--ports/anax/CONTROL3
-rw-r--r--ports/anax/portfile.cmake36
-rw-r--r--ports/antlr4/CONTROL3
-rw-r--r--ports/antlr4/crt_mt.patch36
-rw-r--r--ports/antlr4/portfile.cmake74
-rw-r--r--ports/antlr4/static.patch12
-rw-r--r--ports/apr/CONTROL3
-rw-r--r--ports/apr/portfile.cmake49
-rw-r--r--ports/asio/portfile.cmake4
-rw-r--r--ports/assimp/portfile.cmake8
-rw-r--r--ports/atk/CMakeLists.txt129
-rw-r--r--ports/atk/CONTROL4
-rw-r--r--ports/atk/portfile.cmake28
-rw-r--r--ports/aws-sdk-cpp/CONTROL3
-rw-r--r--ports/aws-sdk-cpp/disable_warning_as_error.patch13
-rw-r--r--ports/aws-sdk-cpp/drop_git.patch13
-rw-r--r--ports/aws-sdk-cpp/portfile.cmake52
-rw-r--r--ports/azure-storage-cpp/CONTROL5
-rw-r--r--ports/azure-storage-cpp/cmake.patch169
-rw-r--r--ports/azure-storage-cpp/portfile.cmake33
-rw-r--r--ports/bond/portfile.cmake4
-rw-r--r--ports/boost-di/CONTROL3
-rw-r--r--ports/boost-di/portfile.cmake22
-rw-r--r--ports/boost/CONTROL3
-rw-r--r--ports/boost/portfile.cmake140
-rw-r--r--ports/box2d/CONTROL3
-rw-r--r--ports/box2d/portfile.cmake77
-rw-r--r--ports/bullet3/portfile.cmake23
-rw-r--r--ports/bzip2/CMakeLists.txt42
-rw-r--r--ports/bzip2/CONTROL3
-rw-r--r--ports/bzip2/auto-define-import-macro.patch13
-rw-r--r--ports/bzip2/fix-import-export-macros.patch40
-rw-r--r--ports/bzip2/portfile.cmake35
-rw-r--r--ports/cairo/CMakeLists.txt3
-rw-r--r--ports/cairo/CMakeLists_cairo.txt313
-rw-r--r--ports/cairo/CONTROL4
-rw-r--r--ports/cairo/cairo-features.h36
-rw-r--r--ports/cairo/portfile.cmake56
-rw-r--r--ports/catch/CONTROL3
-rw-r--r--ports/catch/portfile.cmake28
-rw-r--r--ports/cereal/CONTROL3
-rw-r--r--ports/cereal/portfile.cmake16
-rw-r--r--ports/chakracore/CONTROL2
-rw-r--r--ports/chakracore/portfile.cmake22
-rw-r--r--ports/charls/0001_cmake.patch12
-rw-r--r--ports/charls/CONTROL3
-rw-r--r--ports/charls/portfile.cmake27
-rw-r--r--ports/clockutils/CONTROL3
-rw-r--r--ports/clockutils/portfile.cmake37
-rw-r--r--ports/cocos2d/portfile.cmake47
-rw-r--r--ports/constexpr/portfile.cmake1
-rw-r--r--ports/cpprestsdk/0001_cmake.patch (renamed from ports/cpprestsdk/0001-Use-find_package-on-Windows.-Enable-install-target-f.patch)27
-rw-r--r--ports/cpprestsdk/CONTROL3
-rw-r--r--ports/cpprestsdk/portfile.cmake60
-rw-r--r--ports/cppwinrt/portfile.cmake1
-rw-r--r--ports/cppzmq/CONTROL4
-rw-r--r--ports/cppzmq/portfile.cmake16
-rw-r--r--ports/cryptopp/CONTROL3
-rw-r--r--ports/cryptopp/portfile.cmake45
-rw-r--r--ports/cuda/CONTROL3
-rw-r--r--ports/cuda/portfile.cmake34
-rw-r--r--ports/curl/0001_cmake.patch13
-rw-r--r--ports/curl/0002_fix_uwp.patch109
-rw-r--r--ports/curl/CONTROL5
-rw-r--r--ports/curl/portfile.cmake59
-rw-r--r--ports/decimal-for-cpp/CONTROL4
-rw-r--r--ports/decimal-for-cpp/portfile.cmake29
-rw-r--r--ports/dimcli/CONTROL4
-rw-r--r--ports/dimcli/portfile.cmake37
-rw-r--r--ports/directxmesh/CONTROL3
-rw-r--r--ports/directxmesh/portfile.cmake52
-rw-r--r--ports/directxtex/CONTROL3
-rw-r--r--ports/directxtex/portfile.cmake59
-rw-r--r--ports/directxtk/CONTROL3
-rw-r--r--ports/directxtk/portfile.cmake51
-rw-r--r--ports/directxtk12/CONTROL3
-rw-r--r--ports/directxtk12/portfile.cmake38
-rw-r--r--ports/doctest/portfile.cmake1
-rw-r--r--ports/double-conversion/portfile.cmake41
-rw-r--r--ports/dx/CONTROL3
-rw-r--r--ports/dx/portfile.cmake20
-rw-r--r--ports/dxut/CONTROL3
-rw-r--r--ports/dxut/portfile.cmake48
-rw-r--r--ports/eigen3/CONTROL2
-rw-r--r--ports/eigen3/portfile.cmake22
-rw-r--r--ports/entityx/CONTROL3
-rw-r--r--ports/entityx/portfile.cmake44
-rw-r--r--ports/expat/portfile.cmake8
-rw-r--r--ports/fastlz/CMakeLists.txt16
-rw-r--r--ports/fastlz/CONTROL3
-rw-r--r--ports/fastlz/portfile.cmake26
-rw-r--r--ports/fltk/CONTROL4
-rw-r--r--ports/fltk/findlibsfix.patch51
-rw-r--r--ports/fltk/portfile.cmake68
-rw-r--r--ports/fmt/CONTROL2
-rw-r--r--ports/fmt/portfile.cmake44
-rw-r--r--ports/fontconfig/CMakeLists.txt80
-rw-r--r--ports/fontconfig/CONTROL4
-rw-r--r--ports/fontconfig/include/config.h267
-rw-r--r--ports/fontconfig/include/fcaliastail.h1
-rw-r--r--ports/fontconfig/include/fcftaliastail.h1
-rw-r--r--ports/fontconfig/include/fcobjshash.h328
-rw-r--r--ports/fontconfig/include/fcstdint.h8
-rw-r--r--ports/fontconfig/include/unistd.h21
-rw-r--r--ports/fontconfig/portfile.cmake39
-rw-r--r--ports/freeglut/portfile.cmake20
-rw-r--r--ports/freeimage/CMakeLists.txt148
-rw-r--r--ports/freeimage/CONTROL4
-rw-r--r--ports/freeimage/FreeImageConfig-dynamic.h5
-rw-r--r--ports/freeimage/FreeImageConfig-static.h6
-rw-r--r--ports/freeimage/cmake/FindJXR.cmake28
-rw-r--r--ports/freeimage/cmake/FindWEBP.cmake26
-rw-r--r--ports/freeimage/disable-plugins-depending-on-internal-third-party-libraries.patch71
-rw-r--r--ports/freeimage/portfile.cmake56
-rw-r--r--ports/freeimage/use-external-jpeg.patch17
-rw-r--r--ports/freeimage/use-external-jxrlib.patch14
-rw-r--r--ports/freeimage/use-external-libtiff.patch174
-rw-r--r--ports/freeimage/use-external-openjpeg.patch39
-rw-r--r--ports/freeimage/use-external-png-zlib.patch40
-rw-r--r--ports/freeimage/use-external-rawlib.patch13
-rw-r--r--ports/freeimage/use-external-webp.patch18
-rw-r--r--ports/freeimage/use-freeimage-config-include.patch16
-rw-r--r--ports/freetype/0003-Fix-UWP.patch63
-rw-r--r--ports/freetype/CONTROL3
-rw-r--r--ports/freetype/portfile.cmake6
-rw-r--r--ports/gdal/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch70
-rw-r--r--ports/gdal/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch50
-rw-r--r--ports/gdal/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch26
-rw-r--r--ports/gdal/CONTROL4
-rw-r--r--ports/gdal/portfile.cmake143
-rw-r--r--ports/geos/CONTROL3
-rw-r--r--ports/geos/portfile.cmake46
-rw-r--r--ports/gettext/0001-Fix-macro-definitions.patch45
-rw-r--r--ports/gettext/CMakeLists.txt1
-rw-r--r--ports/gettext/CMakeLists_libintl.txt54
-rw-r--r--ports/gettext/CONTROL3
-rw-r--r--ports/gettext/config.h666
-rw-r--r--ports/gettext/libgnuintl.h423
-rw-r--r--ports/gettext/portfile.cmake44
-rw-r--r--ports/gflags/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch51
-rw-r--r--ports/gflags/CONTROL2
-rw-r--r--ports/gflags/portfile.cmake81
-rw-r--r--ports/glbinding/CONTROL3
-rw-r--r--ports/glbinding/portfile.cmake60
-rw-r--r--ports/glew/CONTROL2
-rw-r--r--ports/glew/portfile.cmake107
-rw-r--r--ports/glfw3/portfile.cmake41
-rw-r--r--ports/gli/CONTROL3
-rw-r--r--ports/gli/portfile.cmake20
-rw-r--r--ports/glib/CMakeLists.txt166
-rw-r--r--ports/glib/CONTROL4
-rw-r--r--ports/glib/cmake/install_headers.cmake255
-rw-r--r--ports/glib/portfile.cmake42
-rw-r--r--ports/glib/use-libiconv-on-windows.patch14
-rw-r--r--ports/glm/portfile.cmake1
-rw-r--r--ports/globjects/CONTROL5
-rw-r--r--ports/globjects/portfile.cmake61
-rw-r--r--ports/glog/portfile.cmake7
-rw-r--r--ports/glslang/0001-Fix-export-symbol-for-Windows.patch86
-rw-r--r--ports/glslang/CONTROL3
-rw-r--r--ports/glslang/copyright35
-rw-r--r--ports/glslang/portfile.cmake68
-rw-r--r--ports/grpc/CONTROL2
-rw-r--r--ports/grpc/portfile.cmake8
-rw-r--r--ports/gsl/portfile.cmake1
-rw-r--r--ports/gtest/portfile.cmake17
-rw-r--r--ports/harfbuzz/0001-Add-an-extra-path-input-for-Freetype.patch40
-rw-r--r--ports/harfbuzz/0001-Set-d-suffix-for-debug-freetype-lib.patch28
-rw-r--r--ports/harfbuzz/CONTROL4
-rw-r--r--ports/harfbuzz/portfile.cmake55
-rw-r--r--ports/http-parser/CMakeLists.txt21
-rw-r--r--ports/http-parser/CONTROL3
-rw-r--r--ports/http-parser/portfile.cmake29
-rw-r--r--ports/icu/CONTROL3
-rw-r--r--ports/icu/portfile.cmake83
-rw-r--r--ports/jsoncpp/CONTROL3
-rw-r--r--ports/jsoncpp/portfile.cmake49
-rw-r--r--ports/jxrlib/CMakeLists.txt102
-rw-r--r--ports/jxrlib/CONTROL3
-rw-r--r--ports/jxrlib/LICENSE23
-rw-r--r--ports/jxrlib/portfile.cmake29
-rw-r--r--ports/lcms/CMakeLists.txt59
-rw-r--r--ports/lcms/CONTROL4
-rw-r--r--ports/lcms/portfile.cmake35
-rw-r--r--ports/lcms/shared.patch10
-rw-r--r--ports/libarchive/CONTROL4
-rw-r--r--ports/libarchive/auto-define-libarchive-static.patch28
-rw-r--r--ports/libarchive/fix-buildsystem.patch146
-rw-r--r--ports/libarchive/override-broken-feature-checks.patch55
-rw-r--r--ports/libarchive/portfile.cmake52
-rw-r--r--ports/libarchive/use-memset-not-bzero.patch26
-rw-r--r--ports/libbson/0001_cmake.patch35
-rw-r--r--ports/libbson/CONTROL2
-rw-r--r--ports/libbson/portfile.cmake77
-rw-r--r--ports/libbson/static.patch13
-rw-r--r--ports/libccd/CONTROL3
-rw-r--r--ports/libccd/portfile.cmake41
-rw-r--r--ports/libffi/CMakeLists.txt78
-rw-r--r--ports/libffi/CONTROL3
-rw-r--r--ports/libffi/auto-define-static-macro.patch14
-rw-r--r--ports/libffi/export-global-data.patch35
-rw-r--r--ports/libffi/fficonfig.h220
-rw-r--r--ports/libffi/portfile.cmake38
-rw-r--r--ports/libflac/CMakeLists.txt73
-rw-r--r--ports/libflac/CONTROL4
-rw-r--r--ports/libflac/portfile.cmake35
-rw-r--r--ports/libiconv/0003-Fix-uwp.patch25
-rw-r--r--ports/libiconv/CMakeLists.txt2
-rw-r--r--ports/libiconv/portfile.cmake11
-rw-r--r--ports/libjpeg-turbo/portfile.cmake19
-rw-r--r--ports/liblzma/CMakeLists.txt104
-rw-r--r--ports/liblzma/CONTROL3
-rw-r--r--ports/liblzma/auto-define-lzma-api-static.patch14
-rw-r--r--ports/liblzma/portfile.cmake29
-rw-r--r--ports/libmariadb/CONTROL3
-rw-r--r--ports/libmariadb/portfile.cmake71
-rw-r--r--ports/libmodplug/CONTROL3
-rw-r--r--ports/libmodplug/automagically-define-modplug-static.patch13
-rw-r--r--ports/libmodplug/portfile.cmake30
-rw-r--r--ports/libmysql/0001_cmake.patch378
-rw-r--r--ports/libmysql/CONTROL4
-rw-r--r--ports/libmysql/boost_and_build.patch44
-rw-r--r--ports/libmysql/portfile.cmake148
-rw-r--r--ports/libodb-pgsql/CMakeLists.txt43
-rw-r--r--ports/libodb-pgsql/CONTROL4
-rw-r--r--ports/libodb-pgsql/portfile.cmake25
-rw-r--r--ports/libodb-sqlite/CMakeLists.txt45
-rw-r--r--ports/libodb-sqlite/CONTROL4
-rw-r--r--ports/libodb-sqlite/portfile.cmake33
-rw-r--r--ports/libodb/CMakeLists.txt39
-rw-r--r--ports/libodb/CONTROL3
-rw-r--r--ports/libodb/odbConfig.cmake10
-rw-r--r--ports/libodb/portfile.cmake39
-rw-r--r--ports/libogg/CONTROL3
-rw-r--r--ports/libogg/portfile.cmake44
-rw-r--r--ports/libpng/portfile.cmake6
-rw-r--r--ports/libpq/CMakeLists.txt82
-rw-r--r--ports/libpq/CONTROL4
-rw-r--r--ports/libpq/portfile.cmake33
-rw-r--r--ports/libraw/CONTROL4
-rw-r--r--ports/libraw/portfile.cmake56
-rw-r--r--ports/libsigcpp/CMakeLists.txt57
-rw-r--r--ports/libsigcpp/CONTROL3
-rw-r--r--ports/libsigcpp/dont-import-symbols.patch13
-rw-r--r--ports/libsigcpp/portfile.cmake28
-rw-r--r--ports/libssh2/0001-Fix-UWP.patch48
-rw-r--r--ports/libssh2/CONTROL4
-rw-r--r--ports/libssh2/LICENSE41
-rw-r--r--ports/libssh2/portfile.cmake36
-rw-r--r--ports/libtheora/CMakeLists.txt68
-rw-r--r--ports/libtheora/CONTROL4
-rw-r--r--ports/libtheora/FindOGG.cmake8
-rw-r--r--ports/libtheora/portfile.cmake31
-rw-r--r--ports/libuv/CONTROL2
-rw-r--r--ports/libuv/portfile.cmake94
-rw-r--r--ports/libvorbis/0001-Add-vorbisenc.c-to-vorbis-library.patch25
-rw-r--r--ports/libvorbis/0002-Allow-deprecated-functions.patch14
-rw-r--r--ports/libvorbis/CONTROL4
-rw-r--r--ports/libvorbis/portfile.cmake62
-rw-r--r--ports/libwebp/0001-add-install-to-cmake.patch21
-rw-r--r--ports/libwebp/0002-add-missing-directory-to-cmake.patch12
-rw-r--r--ports/libwebp/CONTROL3
-rw-r--r--ports/libwebp/portfile.cmake31
-rw-r--r--ports/libwebsockets/0001-Fix-UWP.patch91
-rw-r--r--ports/libwebsockets/CONTROL2
-rw-r--r--ports/libwebsockets/portfile.cmake10
-rw-r--r--ports/libxml2/0001-Fix-makefile.patch60
-rw-r--r--ports/libxml2/CONTROL4
-rw-r--r--ports/libxml2/portfile.cmake169
-rw-r--r--ports/libxslt/0001-Fix-makefile.patch73
-rw-r--r--ports/libxslt/CONTROL4
-rw-r--r--ports/libxslt/portfile.cmake176
-rw-r--r--ports/lmdb/CONTROL3
-rw-r--r--ports/lmdb/cmake/CMakeLists.txt80
-rw-r--r--ports/lmdb/cmake/cmake/package-config.cmakein13
-rw-r--r--ports/lmdb/cmake/cmake/runtest.cmake3
-rw-r--r--ports/lmdb/cmake/lmdb.def58
-rw-r--r--ports/lmdb/cmake/lmdbd.def58
-rw-r--r--ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch3932
-rw-r--r--ports/lmdb/portfile.cmake33
-rw-r--r--ports/log4cplus/portfile.cmake1
-rw-r--r--ports/lua/CMakeLists.txt17
-rw-r--r--ports/lua/CONTROL2
-rw-r--r--ports/lua/portfile.cmake2
-rw-r--r--ports/lz4/CMakeLists.txt26
-rw-r--r--ports/lz4/CONTROL3
-rw-r--r--ports/lz4/auto-define-import-macro.patch28
-rw-r--r--ports/lz4/portfile.cmake29
-rw-r--r--ports/lzo/CONTROL3
-rw-r--r--ports/lzo/do-not-declare-setargv.patch17
-rw-r--r--ports/lzo/portfile.cmake44
-rw-r--r--ports/metis/CONTROL3
-rw-r--r--ports/metis/disable-programs.patch8
-rw-r--r--ports/metis/enable-install.patch15
-rw-r--r--ports/metis/fix-gklib-vs14-math.patch11
-rw-r--r--ports/metis/fix-metis-vs14-math.patch11
-rw-r--r--ports/metis/fix-runtime-install-destination.patch10
-rw-r--r--ports/metis/portfile.cmake47
-rw-r--r--ports/mongo-c-driver/0001_cmake.patch43
-rw-r--r--ports/mongo-c-driver/CONTROL2
-rw-r--r--ports/mongo-c-driver/bson.patch24
-rw-r--r--ports/mongo-c-driver/portfile.cmake80
-rw-r--r--ports/mongo-cxx-driver/0001_cmake.patch64
-rw-r--r--ports/mongo-cxx-driver/CONTROL2
-rw-r--r--ports/mongo-cxx-driver/disable_shared.patch46
-rw-r--r--ports/mongo-cxx-driver/disable_test_and_example.patch149
-rw-r--r--ports/mongo-cxx-driver/portfile.cmake120
-rw-r--r--ports/mongo-cxx-driver/static.patch12
-rw-r--r--ports/mpg123/portfile.cmake4
-rw-r--r--ports/mpir/CONTROL4
-rw-r--r--ports/mpir/portfile.cmake122
-rw-r--r--ports/nana/CONTROL4
-rw-r--r--ports/nana/fix-linking.patch51
-rw-r--r--ports/nana/portfile.cmake36
-rw-r--r--ports/nanodbc/portfile.cmake9
-rw-r--r--ports/ogre/0001-use-vcpkg-freeimage.patch17
-rw-r--r--ports/ogre/0002-ogre-cmake-dir-as-option.patch19
-rw-r--r--ports/ogre/0003-use-flat-installation.patch41
-rw-r--r--ports/ogre/CONTROL4
-rw-r--r--ports/ogre/OGREConfig.cmake37
-rw-r--r--ports/ogre/portfile.cmake60
-rw-r--r--ports/openal-soft/portfile.cmake4
-rw-r--r--ports/opencv/portfile.cmake4
-rw-r--r--ports/openjpeg/CONTROL3
-rw-r--r--ports/openjpeg/portfile.cmake41
-rw-r--r--ports/openssl/CMakeLists.txt48
-rw-r--r--ports/openssl/CONTROL5
-rw-r--r--ports/openssl/ConfigureIncludeQuotesFix.patch13
-rw-r--r--ports/openssl/PerlScriptSpaceInPathFixes.patch35
-rw-r--r--ports/openssl/STRINGIFYPatch.patch23
-rw-r--r--ports/openssl/make-openssl.bat10
-rw-r--r--ports/openssl/portfile-uwp.cmake109
-rw-r--r--ports/openssl/portfile.cmake39
-rw-r--r--ports/opus/CONTROL3
-rw-r--r--ports/opus/portfile.cmake76
-rw-r--r--ports/pango/CMakeLists.txt180
-rw-r--r--ports/pango/CONTROL4
-rw-r--r--ports/pango/portfile.cmake26
-rw-r--r--ports/pcre/CONTROL4
-rw-r--r--ports/pcre/portfile.cmake56
-rw-r--r--ports/pdcurses/CONTROL3
-rw-r--r--ports/pdcurses/LICENSE7
-rw-r--r--ports/pdcurses/portfile.cmake70
-rw-r--r--ports/physfs/CONTROL3
-rw-r--r--ports/physfs/portfile.cmake33
-rw-r--r--ports/pixman/CMakeLists.txt4
-rw-r--r--ports/pixman/CMakeLists_pixman.txt53
-rw-r--r--ports/pixman/CONTROL3
-rw-r--r--ports/pixman/portfile.cmake49
-rw-r--r--ports/poco/CONTROL4
-rw-r--r--ports/poco/config_h.patch13
-rw-r--r--ports/poco/find_pcre.patch13
-rw-r--r--ports/poco/foundation-public-include-pcre.patch12
-rw-r--r--ports/poco/portfile.cmake66
-rw-r--r--ports/proj/0001-CMake-add-detection-of-recent-visual-studio-versions.patch26
-rw-r--r--ports/proj/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch52
-rw-r--r--ports/proj/0003-CMake-configurable-cmake-config-install-location.patch98
-rw-r--r--ports/proj/CONTROL3
-rw-r--r--ports/proj/portfile.cmake57
-rw-r--r--ports/protobuf/portfile.cmake24
-rw-r--r--ports/qca/0001-fix-path-for-vcpkg.patch63
-rw-r--r--ports/qca/CONTROL4
-rw-r--r--ports/qca/mk-ca-bundle.pl554
-rw-r--r--ports/qca/portfile.cmake123
-rw-r--r--ports/qt5/CONTROL4
-rw-r--r--ports/qt5/fixcmake.py44
-rw-r--r--ports/qt5/portfile.cmake167
-rw-r--r--ports/qt5/set-shared-qmakespec.patch18
-rw-r--r--ports/qt5/set-static-qmakespec.patch18
-rw-r--r--ports/qwt/CONTROL4
-rw-r--r--ports/qwt/build-shared-lib.patch13
-rw-r--r--ports/qwt/build-static-lib.patch13
-rw-r--r--ports/qwt/portfile.cmake61
-rw-r--r--ports/ragel/CONTROL2
-rw-r--r--ports/ragel/portfile.cmake5
-rw-r--r--ports/range-v3/CONTROL2
-rw-r--r--ports/range-v3/portfile.cmake16
-rw-r--r--ports/rapidjson/portfile.cmake1
-rw-r--r--ports/rapidxml/portfile.cmake1
-rw-r--r--ports/rxcpp/CONTROL2
-rw-r--r--ports/rxcpp/portfile.cmake14
-rw-r--r--ports/sdl2-image/CMakeLists.txt109
-rw-r--r--ports/sdl2-image/CONTROL5
-rw-r--r--ports/sdl2-image/FindWEBP.cmake24
-rw-r--r--ports/sdl2-image/correct-sdl-headers-dir.patch25
-rw-r--r--ports/sdl2-image/portfile.cmake39
-rw-r--r--ports/sdl2/CONTROL4
-rw-r--r--ports/sdl2/dont-ignore-default-libs.patch22
-rw-r--r--ports/sdl2/portfile.cmake39
-rw-r--r--ports/sery/portfile.cmake4
-rw-r--r--ports/sfml/CMakeLists.txt122
-rw-r--r--ports/sfml/CONTROL4
-rw-r--r--ports/sfml/portfile.cmake34
-rw-r--r--ports/shaderc/0001-Do-not-generate-build-version.inc.patch30
-rw-r--r--ports/shaderc/CMakeLists.txt29
-rw-r--r--ports/shaderc/CMakeLists_spirv.txt14
-rw-r--r--ports/shaderc/CONTROL4
-rw-r--r--ports/shaderc/build-version.inc3
-rw-r--r--ports/shaderc/portfile.cmake79
-rw-r--r--ports/signalrclient/0001_cmake.patch75
-rw-r--r--ports/signalrclient/CONTROL4
-rw-r--r--ports/signalrclient/portfile.cmake34
-rw-r--r--ports/smpeg2/CMakeLists.txt57
-rw-r--r--ports/smpeg2/CONTROL4
-rw-r--r--ports/smpeg2/correct-sdl-headers-dir.patch17
-rw-r--r--ports/smpeg2/portfile.cmake27
-rw-r--r--ports/soci/CONTROL3
-rw-r--r--ports/soci/portfile.cmake53
-rw-r--r--ports/spdlog/portfile.cmake2
-rw-r--r--ports/spirv-tools/CONTROL3
-rw-r--r--ports/spirv-tools/portfile.cmake78
-rw-r--r--ports/sqlite3/CMakeLists.txt23
-rw-r--r--ports/sqlite3/CONTROL2
-rw-r--r--ports/sqlite3/portfile.cmake20
-rw-r--r--ports/stb/portfile.cmake1
-rw-r--r--ports/szip/CONTROL3
-rw-r--r--ports/szip/disable-static-lib-in-shared-build.patch39
-rw-r--r--ports/szip/portfile.cmake48
-rw-r--r--ports/tbb/CONTROL3
-rw-r--r--ports/tbb/portfile.cmake82
-rw-r--r--ports/tcl/portfile.cmake63
-rw-r--r--ports/tclap/CONTROL3
-rw-r--r--ports/tclap/portfile.cmake18
-rw-r--r--ports/think-cell-range/CONTROL5
-rw-r--r--ports/think-cell-range/portfile.cmake16
-rw-r--r--ports/tiff/CONTROL3
-rw-r--r--ports/tiff/add-component-options.patch43
-rw-r--r--ports/tiff/fix-uwp.patch25
-rw-r--r--ports/tiff/portfile.cmake27
-rw-r--r--ports/tk/portfile.cmake63
-rw-r--r--ports/utfcpp/CONTROL3
-rw-r--r--ports/utfcpp/portfile.cmake15
-rw-r--r--ports/uvatlas/CONTROL3
-rw-r--r--ports/uvatlas/portfile.cmake49
-rw-r--r--ports/uwebsockets/0001_cmake.patch40
-rw-r--r--ports/uwebsockets/CONTROL4
-rw-r--r--ports/uwebsockets/portfile.cmake26
-rw-r--r--ports/websocketpp/CONTROL4
-rw-r--r--ports/websocketpp/portfile.cmake24
-rw-r--r--ports/wt/CONTROL4
-rw-r--r--ports/wt/add-disable-boost-autolink-option.patch26
-rw-r--r--ports/wt/portfile.cmake42
-rw-r--r--ports/wtl/CONTROL5
-rw-r--r--ports/wtl/portfile.cmake15
-rw-r--r--ports/xerces-c/CONTROL3
-rw-r--r--ports/xerces-c/portfile.cmake40
-rw-r--r--ports/yaml-cpp/CONTROL3
-rw-r--r--ports/yaml-cpp/portfile.cmake38
-rw-r--r--ports/zeromq/CONTROL3
-rw-r--r--ports/zeromq/portfile.cmake66
-rw-r--r--ports/zlib/CONTROL2
-rw-r--r--ports/zlib/LICENSE2
-rw-r--r--ports/zlib/portfile.cmake13
-rw-r--r--ports/zstd/CONTROL3
-rw-r--r--ports/zstd/portfile.cmake42
-rw-r--r--ports/zziplib/CMakeLists.txt70
-rw-r--r--ports/zziplib/CONTROL4
-rw-r--r--ports/zziplib/portfile.cmake22
-rw-r--r--scripts/bootstrap.ps112
-rw-r--r--scripts/buildsystems/msbuild/applocal.ps114
-rw-r--r--scripts/buildsystems/msbuild/vcpkg.targets68
-rw-r--r--scripts/buildsystems/vcpkg.cmake66
-rw-r--r--scripts/cmake/vcpkg_apply_patches.cmake30
-rw-r--r--scripts/cmake/vcpkg_build_cmake.cmake22
-rw-r--r--scripts/cmake/vcpkg_build_msbuild.cmake6
-rw-r--r--scripts/cmake/vcpkg_build_qmake.cmake36
-rw-r--r--scripts/cmake/vcpkg_common_functions.cmake6
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake62
-rw-r--r--scripts/cmake/vcpkg_configure_qmake.cmake44
-rw-r--r--scripts/cmake/vcpkg_copy_pdbs.cmake58
-rw-r--r--scripts/cmake/vcpkg_copy_tool_dependencies.cmake16
-rw-r--r--scripts/cmake/vcpkg_execute_required_process.cmake6
-rw-r--r--scripts/cmake/vcpkg_execute_required_process_repeat.cmake28
-rw-r--r--scripts/cmake/vcpkg_find_acquire_program.cmake64
-rw-r--r--scripts/cmake/vcpkg_install_cmake.cmake17
-rw-r--r--scripts/doVcpkgRelease.ps182
-rw-r--r--scripts/fetchDependency.ps179
-rw-r--r--scripts/findAnyMSBuildWithCppPlatformToolset.ps132
-rw-r--r--scripts/findVisualStudioInstallationInstances.ps135
-rw-r--r--scripts/ports.cmake13
-rw-r--r--scripts/templates/portfile.in.cmake1
-rw-r--r--toolsrc/VERSION.txt2
-rw-r--r--toolsrc/dirs.proj20
-rw-r--r--toolsrc/include/BinaryParagraph.h3
-rw-r--r--toolsrc/include/ImmutableSortedVector.h48
-rw-r--r--toolsrc/include/Paragraphs.h10
-rw-r--r--toolsrc/include/PostBuildLint.h (renamed from toolsrc/include/post_build_lint.h)2
-rw-r--r--toolsrc/include/PostBuildLint_BuildInfo.h21
-rw-r--r--toolsrc/include/PostBuildLint_BuildPolicies.h35
-rw-r--r--toolsrc/include/PostBuildLint_BuildType.h45
-rw-r--r--toolsrc/include/PostBuildLint_ConfigurationType.h14
-rw-r--r--toolsrc/include/PostBuildLint_LinkageType.h16
-rw-r--r--toolsrc/include/SourceParagraph.h19
-rw-r--r--toolsrc/include/StatusParagraphs.h13
-rw-r--r--toolsrc/include/coff_file_reader.h12
-rw-r--r--toolsrc/include/expected.h1
-rw-r--r--toolsrc/include/filesystem_fs.h5
-rw-r--r--toolsrc/include/metrics.h1
-rw-r--r--toolsrc/include/opt_bool.h32
-rw-r--r--toolsrc/include/package_spec.h7
-rw-r--r--toolsrc/include/pch.h42
-rw-r--r--toolsrc/include/triplet.h8
-rw-r--r--toolsrc/include/vcpkg.h33
-rw-r--r--toolsrc/include/vcpkg_Checks.h4
-rw-r--r--toolsrc/include/vcpkg_Commands.h124
-rw-r--r--toolsrc/include/vcpkg_Dependencies.h76
-rw-r--r--toolsrc/include/vcpkg_Environment.h14
-rw-r--r--toolsrc/include/vcpkg_Files.h53
-rw-r--r--toolsrc/include/vcpkg_Graphs.h13
-rw-r--r--toolsrc/include/vcpkg_Input.h10
-rw-r--r--toolsrc/include/vcpkg_Maps.h27
-rw-r--r--toolsrc/include/vcpkg_Sets.h6
-rw-r--r--toolsrc/include/vcpkg_Strings.h68
-rw-r--r--toolsrc/include/vcpkg_System.h37
-rw-r--r--toolsrc/include/vcpkg_cmd_arguments.h13
-rw-r--r--toolsrc/include/vcpkg_info.h10
-rw-r--r--toolsrc/include/vcpkg_optional.h5
-rw-r--r--toolsrc/include/vcpkg_paths.h9
-rw-r--r--toolsrc/include/vcpkglib.h31
-rw-r--r--toolsrc/include/vcpkglib_helpers.h8
-rw-r--r--toolsrc/src/BinaryParagraph.cpp66
-rw-r--r--toolsrc/src/MachineType.cpp (renamed from toolsrc/MachineType.cpp)1
-rw-r--r--toolsrc/src/Paragraphs.cpp170
-rw-r--r--toolsrc/src/PostBuildLint.cpp730
-rw-r--r--toolsrc/src/PostBuildLint_BuildInfo.cpp42
-rw-r--r--toolsrc/src/PostBuildLint_BuildPolicies.cpp66
-rw-r--r--toolsrc/src/PostBuildLint_BuildType.cpp68
-rw-r--r--toolsrc/src/PostBuildLint_ConfigurationType.cpp19
-rw-r--r--toolsrc/src/PostBuildLint_LinkageType.cpp34
-rw-r--r--toolsrc/src/SourceParagraph.cpp151
-rw-r--r--toolsrc/src/StatusParagraph.cpp9
-rw-r--r--toolsrc/src/StatusParagraphs.cpp2
-rw-r--r--toolsrc/src/Stopwatch.cpp3
-rw-r--r--toolsrc/src/coff_file_reader.cpp152
-rw-r--r--toolsrc/src/commands_available_commands.cpp45
-rw-r--r--toolsrc/src/commands_build.cpp131
-rw-r--r--toolsrc/src/commands_build_external.cpp33
-rw-r--r--toolsrc/src/commands_cache.cpp69
-rw-r--r--toolsrc/src/commands_contact.cpp14
-rw-r--r--toolsrc/src/commands_create.cpp11
-rw-r--r--toolsrc/src/commands_edit.cpp12
-rw-r--r--toolsrc/src/commands_hash.cpp45
-rw-r--r--toolsrc/src/commands_help.cpp87
-rw-r--r--toolsrc/src/commands_helpers.cpp7
-rw-r--r--toolsrc/src/commands_import.cpp86
-rw-r--r--toolsrc/src/commands_install.cpp239
-rw-r--r--toolsrc/src/commands_installation.cpp176
-rw-r--r--toolsrc/src/commands_integrate.cpp (renamed from toolsrc/src/commands_integration.cpp)17
-rw-r--r--toolsrc/src/commands_list.cpp66
-rw-r--r--toolsrc/src/commands_other.cpp100
-rw-r--r--toolsrc/src/commands_owns.cpp28
-rw-r--r--toolsrc/src/commands_portsdiff.cpp167
-rw-r--r--toolsrc/src/commands_remove.cpp202
-rw-r--r--toolsrc/src/commands_search.cpp74
-rw-r--r--toolsrc/src/commands_update.cpp19
-rw-r--r--toolsrc/src/commands_version.cpp17
-rw-r--r--toolsrc/src/lib.cpp511
-rw-r--r--toolsrc/src/main.cpp246
-rw-r--r--toolsrc/src/metrics.cpp50
-rw-r--r--toolsrc/src/opt_bool.cpp29
-rw-r--r--toolsrc/src/package_spec.cpp15
-rw-r--r--toolsrc/src/package_spec_parse_result.cpp4
-rw-r--r--toolsrc/src/pch.cpp1
-rw-r--r--toolsrc/src/post_build_lint.cpp433
-rw-r--r--toolsrc/src/tests_dependencies.cpp39
-rw-r--r--toolsrc/src/tests_paragraph.cpp (renamed from toolsrc/src/test.cpp)80
-rw-r--r--toolsrc/src/triplet.cpp12
-rw-r--r--toolsrc/src/vcpkg.cpp345
-rw-r--r--toolsrc/src/vcpkg_Checks.cpp11
-rw-r--r--toolsrc/src/vcpkg_Dependencies.cpp157
-rw-r--r--toolsrc/src/vcpkg_Environment.cpp153
-rw-r--r--toolsrc/src/vcpkg_Files.cpp101
-rw-r--r--toolsrc/src/vcpkg_Input.cpp13
-rw-r--r--toolsrc/src/vcpkg_Strings.cpp100
-rw-r--r--toolsrc/src/vcpkg_System.cpp16
-rw-r--r--toolsrc/src/vcpkg_cmd_arguments.cpp36
-rw-r--r--toolsrc/src/vcpkg_info.cpp35
-rw-r--r--toolsrc/src/vcpkg_metrics_uploader.cpp4
-rw-r--r--toolsrc/src/vcpkg_paths.cpp17
-rw-r--r--toolsrc/src/vcpkg_version.cpp25
-rw-r--r--toolsrc/src/vcpkglib.cpp240
-rw-r--r--toolsrc/src/vcpkglib_helpers.cpp62
-rw-r--r--toolsrc/vcpkg.sln20
-rw-r--r--toolsrc/vcpkg/vcpkg.vcxproj53
-rw-r--r--toolsrc/vcpkg/vcpkg.vcxproj.filters88
-rw-r--r--toolsrc/vcpkgcommon/vcpkgcommon.vcxproj144
-rw-r--r--toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters66
-rw-r--r--toolsrc/vcpkglib/vcpkglib.vcxproj112
-rw-r--r--toolsrc/vcpkglib/vcpkglib.vcxproj.filters231
-rw-r--r--toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj140
-rw-r--r--toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj.filters27
-rw-r--r--toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj18
-rw-r--r--toolsrc/vcpkgtest/vcpkgtest.vcxproj22
-rw-r--r--toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters5
602 files changed, 25391 insertions, 4576 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9fa0b2b27..b631be48b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,330 @@
+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:
+ - anax 2.1.0-1
+ - aws-sdk-cpp 1.0.34-1
+ - azure-storage-cpp 2.5.0
+ - charls 2.0.0
+ - dimcli 1.0.3
+ - entityx 1.2.0
+ - freeimage 3.17.0
+ - gdal 1.11.3
+ - globjects 1.0.0
+ - http-parser 2.7.1
+ - icu 58.1
+ - libflac 1.3.1-1
+ - libssh2 1.8.0
+ - nana 1.4.1
+ - qca 2.2.0
+ - sfml 2.4.1
+ - shaderc 2df47b51d83ad83cbc2e7f8ff2b56776293e8958
+ - uwebsockets 0.12.0
+ - yaml-cpp 0.5.4 candidate
+ * Update ports:
+ - boost 1.62-6 -> 1.62-8
+ - curl 7.51.0-1 -> 7.51.0-2
+ - gflags 2.1.2 -> 2.2.0-2
+ - glbinding 2.1.1 -> 2.1.1-1
+ - glslang 1c573fbcfba6b3d631008b1babc838501ca925d3 -> 1c573fbcfba6b3d631008b1babc838501ca925d3-1
+ - harfbuzz 1.3.2 -> 1.3.4
+ - jxrlib 1.1-1 -> 1.1-2
+ - libraw 0.17.2 -> 0.17.2-2
+ - lua 5.3.3 -> 5.3.3-1
+ - openssl 1.0.2j -> 1.0.2j-1
+ * Improvements in the post-build checks:
+ - Add check for files in the `<package>\` dir and `<package>\debug\` dir
+ * Introduce pre-install checks:
+ - The `install` command now checks that files will not be overwrriten when installing a package. A particular file can only be owned by a single package
+ * Introduce 'lib\manul-link\' directory. Libraries placing the lib files in that directory are not automatically added to the link line
+ * Disable all interactions with CMake registry
+ * `vcpkg /?` is now a valid equivalent of `vcpkg help`
+ * Fixes and improvements in existing portfiles and the `vcpkg` tool itself
+
+-- vcpkg team <vcpkg@microsoft.com> MON, 12 Dec 2016 18:15:00 -0800
+
+
+vcpkg (0.0.61)
+--------------
+ * Add ports:
+ - cairo 1.14.6
+ - clockutils 1.1.1
+ - directxtk oct2016-1
+ - directxtk12 oct2016
+ - glslang 1c573fbcfba6b3d631008b1babc838501ca925d3
+ - libodb-pgsql 2.4.0
+ - pixman 0.34.0
+ - proj 4.9.3
+ - zstd 1.1.1
+ * Update ports:
+ - chakracore 1.3.0 -> 1.3.1
+ - curl 7.51.0 -> 7.51.0-1
+ - dxut 11.14 -> 11.14-2
+ - fmt 3.0.1 -> 3.0.1-1
+ - freetype 2.6.3-1 -> 2.6.3-2
+ - rxcpp 2.3.0 -> 3.0.0
+ - think-cell-range 1d785d9 -> e2d3018
+ - tiff 4.0.6 -> 4.0.6-1
+ * Fixes and improvements in existing portfiles and the `vcpkg` tool itself
+
+-- vcpkg team <vcpkg@microsoft.com> MON, 28 Nov 2016 18:30:00 -0800
+
+
+vcpkg (0.0.60)
+--------------
+ * Add ports:
+ - box2d 2.3.1-374664b
+ - decimal-for-cpp 1.12
+ - jsoncpp 1.7.7
+ - libpq 9.6.1
+ - libxslt 1.1.29
+ - poco 1.7.6-2
+ - qt5 5.7-1
+ - signalrclient 1.0.0-beta1
+ - soci 2016.10.22
+ - tclap 1.2.1
+ * Update ports:
+ - boost 1.62-1 -> 1.62-6
+ - chakracore 1.2.0.0 -> 1.3.0
+ - eigen3 3.2.10-2 -> 3.3.0
+ - fmt 3.0.0-1 -> 3.0.1
+ - jxrlib 1.1 -> 1.1-1
+ - libbson 1.4.2 -> 1.5.0-rc6
+ - libuv 1.9.1 -> 1.10.1
+ - libwebp 0.5.1 -> 0.5.1-1
+ - mongo-c-driver 1.4.2 -> 1.5.0-rc6
+ - mongo-cxx-driver 3.0.2 -> 3.0.3
+ - pcre 8.38 -> 8.38-1
+ - sdl2 2.0.4 -> 2.0.5
+ * `vcpkg` has exceeded 100 libraries!
+ * Rework dependency handling
+ * Many more portfiles now support static builds. The remaining ones warn that static is not yet supported and will perform a dynamic build instead
+ * The triplet file is now automatically included and is available in every portfile
+ * Improvements in the post-build checks:
+ - Introduce `BUILD_INFO` file. This contains information about the settings used in the build. The post-build checks use this file to choose what checks to perform
+ - Add CRT checks
+ - Improve coff file reader. It is now more robust and it correctly handles a couple of corner cases
+ - A few miscellaneous checks to further prevent potential issues with the produced packages
+ * Improve integration and fix related issues
+ * Add support for VS 2017
+ * Introduce function that tries to repeatedly build up to a number of failures. This reduces/resolves issues from libraries with flaky builds
+ * Many fixes and improvements in existing portfiles and the `vcpkg` tool itself
+
+-- vcpkg team <vcpkg@microsoft.com> WED, 23 Nov 2016 15:30:00 -0800
+
+
+vcpkg (0.0.51)
+--------------
+ * Add simple substring search to `vcpkg cache`
+ * Add simple substring search to `vcpkg list`
+
+-- vcpkg team <vcpkg@microsoft.com> MON, 07 Nov 2016 14:45:00 -0800
+
+
+vcpkg (0.0.50)
+--------------
+ * Add ports:
+ - apr 1.5.2
+ - assimp 3.3.1
+ - boost-di 1.0.1
+ - bullet3 2.83.7.98d4780
+ - catch 1.5.7
+ - chakracore 1.2.0.0
+ - cppwinrt 1.010.0.14393.0
+ - cppzmq 0.0.0-1
+ - cryptopp 5.6.5
+ - double-conversion 2.0.1
+ - dxut 11.14
+ - fastlz 1.0
+ - freeglut 3.0.0
+ - geos 3.5.0
+ - gettext 0.19
+ - glbinding 2.1.1
+ - glog 0.3.4-0472b91
+ - harfbuzz 1.3.2
+ - jxrlib 1.1
+ - libbson 1.4.2
+ - libccd 2.0.0
+ - libmariadb 2.3.1
+ - libmysql 5.7.16
+ - libodb 2.4.0
+ - libodb-sqlite 2.4.0
+ - libogg 1.3.2
+ - libraw 0.17.2
+ - libtheora 1.1.1
+ - libvorbis
+ - libwebp 0.5.1
+ - libxml2 2.9.4
+ - log4cplus 1.1.3-RC7
+ - lua 5.3.3
+ - mongo-c-driver 1.4.2
+ - mongo-cxx-driver 3.0.2
+ - nanodbc 2.12.4
+ - openjpeg 2.1.2
+ - pcre 8.38
+ - pdcurses 3.4
+ - physfs 2.0.3
+ - rxcpp 2.3.0
+ - spdlog 0.11.0
+ - tbb 20160916
+ - think-cell-range 1d785d9
+ - utfcpp 2.3.4
+ - wt 3.3.6
+ - wtl 9.1
+ - zeromq 4.2.0
+ - zziplib 0.13.62
+ * Update ports:
+ - boost 1.62 -> 1.62-1
+ - cpprestsdk 2.8 -> 2.9.0-1
+ - curl 7.48.0 -> 7.51.0
+ - eigen3 3.2.9 -> 3.2.10-2
+ - freetype 2.6.3 -> 2.6.3-1
+ - glew 1.13.0 -> 2.0.0
+ - openssl 1.0.2h -> 1.0.2j
+ - range-v3 0.0.0-1 -> 20150729-vcpkg2
+ - sqlite3 3120200 -> 3.15.0
+ * Add support for static libraries
+ * Add more post build checks
+ * Improve post build checks related to verifying information in the dll/pdb files (e.g. architecture)
+ * Many fixes in existing portfiles
+ * Various updates in FAQ
+ * Release builds now create pdbs (debug builds already did)
+
+-- vcpkg team <vcpkg@microsoft.com> MON, 07 Nov 2016 00:01:00 -0800
+
+
vcpkg (0.0.40)
--------------
* Add ports:
@@ -30,7 +357,7 @@ vcpkg (0.0.40)
* Add mirror support
* `vcpkg` now checks for valid package names: only ASCII lowercase chars, digits, or dashes are allowed
* `vcpkg create` now also creates a templated CONTROL file
- * `vcpkg create` now checks for invalid chars in the zip path
+ * `vcpkg create` now checks for invalid chars in the zip path
* `vcpkg edit` now throws an error if it cannot launch an editor
* Fix `vcpkg integrate` to only apply to C++ projects instead of all projects
* Fix `vcpkg integrate` locale-specific failures
diff --git a/README.md b/README.md
index 1a34c1c4a..1026e2129 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,12 @@ Vcpkg helps you get C and C++ libraries on Windows. This tool and ecosystem are
For short description of available commands, run `vcpkg help`.
## Quick Start
-If there is no `vcpkg.exe` (such as after a `git clone`), run
+Prerequisites:
+- Visual Studio 2015 Update 3 or
+- Visual Studio 2017
+- `git.exe` available in your path
+
+Clone this repository, then run
```
C:\src\vcpkg> powershell -exec bypass scripts\bootstrap.ps1
```
@@ -18,12 +23,12 @@ 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. 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 "15" Preview. 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.
-See a 4 mm [demo in video](https://www.youtube.com/watch?v=y41WFKbQFTw).
+See a 4 minute [demo in video](https://www.youtube.com/watch?v=y41WFKbQFTw).
## Contributing
Vcpkg is built with your contributions. Here are some ways you can contribute:
@@ -31,7 +36,7 @@ Vcpkg is built with your contributions. Here are some ways you can contribute:
* [Submit Issues](https://github.com/Microsoft/vcpkg/issues) in vcpkg or existing packages
* [Submit Fixes and New Packages](https://github.com/Microsoft/vcpkg/pulls)
-Please refer to our [Contribution guidelines](docs/CONTRIBUTING.md) for more details.
+Please refer to our [Contribution guidelines](CONTRIBUTING.md) for more details.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md
index f67ce3313..b6a219b4f 100644
--- a/docs/EXAMPLES.md
+++ b/docs/EXAMPLES.md
@@ -6,7 +6,7 @@ Vcpkg helps you get C and C++ libraries on Windows.
For short description of available commands, run `./vcpkg help`.
## Table of Contents
-- <a href="#example-1">Example 1: Using the C++ REST SDK</a>
+- <a href="#example-1">Example 1: Using Sqlite</a>
- <a href="#example-1-1">Step 1: Build</a>
- <a href="#example-1-2">Step 2: Use</a>
- <a href="#example-1-2-a">Option A: VS Project (User-wide integration)</a>
@@ -17,49 +17,35 @@ For short description of available commands, run `./vcpkg help`.
- <a href="example-3-patch-libpng.md">Example 3: Patching libpng to work for uwp-x86</a>
<a name="example-1"></a>
-## Example 1: C++ REST SDK
+## Example 1: Using Sqlite
<a name="example-1-1"></a>
### Step 1: Build
-First, we need to know what name C++ REST SDK goes by in the ports tree. To do that, we'll run the `search` command and inspect the output:
+First, we need to know what name [Sqlite](https://sqlite.org) goes by in the ports tree. To do that, we'll run the `search` command and inspect the output:
```
-PS D:\src\vcpkg> .\vcpkg search
-boost 1.60 Peer-reviewed portable C++ source libraries
-cpprestsdk 2.8 C++11 JSON, REST, and OAuth library The C++ RES...
-curl 7.48.0 A library for transferring data with URLs
-expat 2.1.1 XML parser library written in C
-freetype 2.6.3 A library to render fonts.
-glew 1.13.0 The OpenGL Extension Wrangler Library (GLEW) is a...
-glfw3 3.1.2 GLFW is a free, Open Source, multi-platform libra...
-libjpeg-turbo 1.4.90-1 libjpeg-turbo is a JPEG image codec that uses SIM...
-libpng 1.6.24-1 libpng is a library implementing an interface for...
-libuv 1.9.1 libuv is a multi-platform support library with a ...
-libwebsockets 2.0.0 Libwebsockets is a lightweight pure C library bui...
-mpg123 1.23.3 mpg123 is a real time MPEG 1.0/2.0/2.5 audio play...
-openal-soft 1.17.2 OpenAL Soft is an LGPL-licensed, cross-platform, ...
-opencv 3.1.0 computer vision library
-opengl 10.0.10240.0 Open Graphics Library (OpenGL)[3][4][5] is a cros...
-openssl 1.0.2h OpenSSL is an open source project that provides a...
-range-v3 0.0.0-1 Range library for C++11/14/17.
-rapidjson 1.0.2-1 A fast JSON parser/generator for C++ with both SA...
-sdl2 2.0.4 Simple DirectMedia Layer is a cross-platform deve...
-sqlite3 3120200 SQLite is a software library that implements a se...
-tiff 4.0.6 A library that supports the manipulation of TIFF ...
-tinyxml2 3.0.0 A simple, small, efficient, C++ XML parser
-zlib 1.2.8 A compression library
+PS D:\src\vcpkg> .\vcpkg search sqlite
+libodb-sqlite 2.4.0 Sqlite support for the ODB ORM library
+sqlite3 3.15.0 SQLite is a software library that implements a se...
+
+If your library is not listed, please open an issue at:
+ https://github.com/Microsoft/vcpkg/issues
```
-Looking at the list, we can see that the port is named "cpprestsdk".
+Looking at the list, we can see that the port is named "sqlite3". You can also run the `search` command without arguments to see the full list of packages.
-Installing is then as simple as using the `install` command. Since we haven't built this library before, we'll first see an error message indicating that the control file failed to load, then the port will automatically begin building (and install when completed).
+Installing is then as simple as using the `install` command.
```
-PS D:\src\vcpkg> .\vcpkg install cpprestsdk
+PS D:\src\vcpkg> .\vcpkg install sqlite3
-- CURRENT_INSTALLED_DIR=D:/src/vcpkg/installed/x86-windows
-- DOWNLOADS=D:/src/vcpkg/downloads
--- CURRENT_PACKAGES_DIR=D:/src/vcpkg/packages/cpprestsdk_x86-windows
--- CURRENT_BUILDTREES_DIR=D:/src/vcpkg/buildtrees/cpprestsdk
--- CURRENT_PORT_DIR=D:/src/vcpkg/ports/cpprestsdk/.
--- Cloning done
--- Adding worktree and patching done
+-- CURRENT_PACKAGES_DIR=D:/src/vcpkg/packages/sqlite3_x86-windows
+-- CURRENT_BUILDTREES_DIR=D:/src/vcpkg/buildtrees/sqlite3
+-- CURRENT_PORT_DIR=D:/src/vcpkg/ports/sqlite3/.
+-- Downloading https://sqlite.org/2016/sqlite-amalgamation-3150000.zip...
+-- Downloading https://sqlite.org/2016/sqlite-amalgamation-3150000.zip... OK
+-- Testing integrity of downloaded file...
+-- Testing integrity of downloaded file... OK
+-- Extracting source D:/src/vcpkg/downloads/sqlite-amalgamation-3150000.zip
+-- Extracting done
-- Configuring x86-windows-rel
-- Configuring x86-windows-rel done
-- Configuring x86-windows-dbg
@@ -72,19 +58,21 @@ PS D:\src\vcpkg> .\vcpkg install cpprestsdk
-- Package x86-windows-rel done
-- Package x86-windows-dbg
-- Package x86-windows-dbg done
-Package cpprestsdk:x86-windows is installed
+-- Performing post-build validation
+-- Performing post-build validation done
+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\cpprestsdk_x86-windows`). This allows you to quickly uninstall and reinstall the library in the future using the `remove` and `install` commands.
+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
-cpprestsdk:x86-windows 2.8 A modern C++11 library to connect with web servic...
+sqlite3:x86-windows 3.15.0 SQLite is a software library that implements a se...
```
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.
@@ -105,7 +93,9 @@ Installing new libraries will make them instantly available.
```
*Note: You will need to restart Visual Studio or perform a Build to update intellisense with the changes.*
-To remove the integration for your user, you can use `./vcpkg integrate remove`.
+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`.
<a name="example-1-2-b"></a>
#### Option B: CMake (Toolchain File)
@@ -118,22 +108,19 @@ Let's first make a simple CMake project with a main file.
cmake_minimum_required(VERSION 3.0)
project(test)
-find_library(CPPREST_LIBRARY cpprest_2_8)
-find_path(CPPREST_INCLUDE_DIR cpprest/version.h)
+find_package(Sqlite3 REQUIRED)
-include_directories(${CPPREST_INCLUDE_DIR})
-link_libraries(${CPPREST_LIBRARY})
+link_libraries(sqlite3)
add_executable(main main.cpp)
```
```cpp
// main.cpp
-#include <cpprest/json.h>
+#include <sqlite3.h>
#include <stdio.h>
int main()
{
- auto v = web::json::value::parse(U("[1,2,3,4]"));
- printf("Success\n");
+ printf("%s\n", sqlite3_libversion());
return 0;
}
```
@@ -153,17 +140,19 @@ Build succeeded.
Time Elapsed 00:00:02.38
PS D:\src\cmake-test\build> .\Debug\main.exe
-Success
+3.15.0
```
+*Note: The correct sqlite3.dll is automatically copied to the output folder when building for x86-windows. You will need to distribute this along with your application.*
+
<a name="example-1-2-c"></a>
#### Option C: Other buildsystems
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/FAQ.md b/docs/FAQ.md
index 7bc57f605..0a82d320e 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -61,6 +61,9 @@ In a corporate scenario, we currently recommend building the libraries once and
## What Visual C++ toolsets are supported?
We plan to only support Visual Studio 2015 and above.
+## Why does Visual Studio not use my libraries with user-wide integration enabled?
+Enabling user-wide integration (`vcpkg integrate install`) changes the default for some project properties. In particular, "C/C++/General/Additional Include Directories" and "Linker/General/Additional Library Directories" are normally blank *without* user-wide integration. *With* integration, a blank value means that the augmented default supplied by vcpkg is overridden, and headers/libraries will not be found. To reinstate the default, set the properties to inherit from parent.
+
## Can I acquire my package's sources by Git url+tag?
Yes, however we prefer compressed archives of the specific release/commit since the internal downloads and build trees are meant to be read only. Github provides archives for every commit, tag, and branch, so it's always possible to perform this substitution for repositories hosted there.
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 301354cae..a06016abd 100644
--- a/ports/ace/portfile.cmake
+++ b/ports/ace/portfile.cmake
@@ -1,22 +1,25 @@
+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/ACE_wrappers/ace)
vcpkg_download_distfile(ARCHIVE
- URL "http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.0.zip"
- FILENAME "ACE-6.4.0.zip"
- SHA512 3543291332b96cf06a966dedda617169e8db051cebbbc4f05cdc2c2c9e7908174f8ed67bc152bbcd57541279d3addb1138f1fc092468e856c2bb04ee6ad2b95a
+ 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})
if (TRIPLET_SYSTEM_ARCH MATCHES "arm")
- message(FATAL_ERROR, "ARM is currently not supported.")
- return()
+ message(FATAL_ERROR "ARM is currently not supported.")
elseif (TRIPLET_SYSTEM_ARCH MATCHES "x86")
set(MSBUILD_PLATFORM "Win32")
else ()
set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH})
endif()
-# Add ace/config.h file
+# Add ace/config.h file
# see http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/ACE-INSTALL.html#win32
file(WRITE ${SOURCE_PATH}/config.h "#include \"ace/config-windows.h\"")
vcpkg_build_msbuild(
@@ -24,16 +27,16 @@ vcpkg_build_msbuild(
PLATFORM ${MSBUILD_PLATFORM}
)
-# ACE itself does not define an install target, so it is not clear which
-# headers are public and which not. For the moment we install everything
+# ACE itself does not define an install target, so it is not clear which
+# headers are public and which not. For the moment we install everything
# that is in the source path and ends in .h, .inl
function(install_ace_headers_subdirectory SOURCE_PATH RELATIVE_PATH)
file(GLOB HEADER_FILES ${SOURCE_PATH}/${RELATIVE_PATH}/*.h ${SOURCE_PATH}/${RELATIVE_PATH}/*.inl)
file(INSTALL ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ace/${RELATIVE_PATH})
endfunction()
-# We manually install header found in the ace directory because in that case
-# we are supposed to install also *cpp files, see ACE_wrappers\debian\libace-dev.install file
+# We manually install header found in the ace directory because in that case
+# we are supposed to install also *cpp files, see ACE_wrappers\debian\libace-dev.install file
file(GLOB HEADER_FILES ${SOURCE_PATH}/*.h ${SOURCE_PATH}/*.inl ${SOURCE_PATH}/*.cpp)
file(INSTALL ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ace/)
@@ -62,7 +65,7 @@ function(install_ace_library SOURCE_PATH ACE_LIBRARY)
${LIB_PATH}/${ACE_LIBRARY}.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
-
+
file(INSTALL
${LIB_PATH}/${ACE_LIBRARY}d.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
diff --git a/ports/anax/Add-bin-output.patch b/ports/anax/Add-bin-output.patch
new file mode 100644
index 000000000..333a92fdc
--- /dev/null
+++ b/ports/anax/Add-bin-output.patch
@@ -0,0 +1,10 @@
+--- a/CMakeLists.txt Tue Oct 13 13:47:40 2015
++++ b/CMakeLists.txt Tue Dec 06 11:13:23 2016
+@@ -161,6 +161,7 @@
+ # Library files
+ install(
+ TARGETS ${ANAX_LIBRARY_NAME}
++ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
diff --git a/ports/anax/CONTROL b/ports/anax/CONTROL
new file mode 100644
index 000000000..ce3da2f57
--- /dev/null
+++ b/ports/anax/CONTROL
@@ -0,0 +1,3 @@
+Source: anax
+Version: 2.1.0-1
+Description: An open source C++ entity system. <https://github.com/miguelmartin75/anax>
diff --git a/ports/anax/portfile.cmake b/ports/anax/portfile.cmake
new file mode 100644
index 000000000..ef14f7264
--- /dev/null
+++ b/ports/anax/portfile.cmake
@@ -0,0 +1,36 @@
+# 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/anax-2.1.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/miguelmartin75/anax/archive/v2.1.0.zip"
+ FILENAME "anax-2.1.0.zip"
+ SHA512 89f2df64add676ab48a19953b95d8eae1da9c8c5f3c0f6bc757a3bc99af6e4360c56c12d27d12c672ccd754b1f53a5e271533b381641f20e8cf3ca8ddda6cd1a
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/Add-bin-output.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/anax)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/anax/LICENSE ${CURRENT_PACKAGES_DIR}/share/anax/copyright)
diff --git a/ports/antlr4/CONTROL b/ports/antlr4/CONTROL
new file mode 100644
index 000000000..dbcf5219c
--- /dev/null
+++ b/ports/antlr4/CONTROL
@@ -0,0 +1,3 @@
+Source: antlr4
+Version: 4.6
+Description: ANother Tool for Language Recognition \ No newline at end of file
diff --git a/ports/antlr4/crt_mt.patch b/ports/antlr4/crt_mt.patch
new file mode 100644
index 000000000..d2e8a28da
--- /dev/null
+++ b/ports/antlr4/crt_mt.patch
@@ -0,0 +1,36 @@
+diff --git a/runtime/antlr4cpp-vs2015.vcxproj b/runtime/antlr4cpp-vs2015.vcxproj
+index 85fa3da..540f031 100644
+--- a/runtime/antlr4cpp-vs2015.vcxproj
++++ b/runtime/antlr4cpp-vs2015.vcxproj
+@@ -201,6 +201,7 @@
+ <DisableSpecificWarnings>4251</DisableSpecificWarnings>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ <MinimalRebuild>false</MinimalRebuild>
++ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+@@ -239,6 +240,7 @@
+ <DisableSpecificWarnings>4251</DisableSpecificWarnings>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ <MinimalRebuild>false</MinimalRebuild>
++ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+@@ -281,6 +283,7 @@
+ </ForcedIncludeFiles>
+ <DisableSpecificWarnings>4251</DisableSpecificWarnings>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
++ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+@@ -325,6 +328,7 @@
+ </ForcedIncludeFiles>
+ <DisableSpecificWarnings>4251</DisableSpecificWarnings>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
++ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
diff --git a/ports/antlr4/portfile.cmake b/ports/antlr4/portfile.cmake
new file mode 100644
index 000000000..8b11c95b0
--- /dev/null
+++ b/ports/antlr4/portfile.cmake
@@ -0,0 +1,74 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/runtime)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.antlr.org/download/antlr4-cpp-runtime-4.6-source.zip"
+ FILENAME "antlr4-cpp-runtime-4.6-source.zip"
+ SHA512 e123c2227e41ce80da5a3758725a018690ed70a4e10c23da26c966259e6bdafa192f4363f5a7e1181ef9a47bf3cc50d6b0ca7b26c8dd2b19222a7edf54de8de2
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+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")
+else()
+ 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}
+)
+
+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(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.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)
+
+if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
+ 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()
+
+
+# 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/antlr4/static.patch b/ports/antlr4/static.patch
new file mode 100644
index 000000000..fb54c5ae4
--- /dev/null
+++ b/ports/antlr4/static.patch
@@ -0,0 +1,12 @@
+diff --git a/antlr4-common.h b/antlr4-common.h
+index 197fd6d..34a62c8 100644
+--- a/antlr4-common.h
++++ b/antlr4-common.h
+@@ -34,6 +34,7 @@
+ #include <bitset>
+ #include <condition_variable>
+
++#define ANTLR4CPP_STATIC
+ // Defines for the Guid class and other platform dependent stuff.
+ #ifdef _WIN32
+ #pragma warning (disable: 4250) // Class inherits by dominance.
diff --git a/ports/apr/CONTROL b/ports/apr/CONTROL
new file mode 100644
index 000000000..eed3c518d
--- /dev/null
+++ b/ports/apr/CONTROL
@@ -0,0 +1,3 @@
+Source: apr
+Version: 1.5.2
+Description: The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.
diff --git a/ports/apr/portfile.cmake b/ports/apr/portfile.cmake
new file mode 100644
index 000000000..f65b44649
--- /dev/null
+++ b/ports/apr/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}
+#
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/apr-1.5.2)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.apache.org/dist/apr/apr-1.5.2.tar.bz2"
+ FILENAME "apr-1.5.2.tar.bz2"
+ SHA512 d1156ad16abf07887797777b56c2147c890f16d8445829b3e3b4917950d24c5fd2f8febd439992467a5ea0511da562c0fb4a7cfd8a235ab55882388bfa2b919d
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DINSTALL_PDB=OFF -DMIN_WINDOWS_VER=Windows7 -DAPR_HAVE_IPV6=ON
+ # 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 in debug builds.
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Both dynamic and static are built, so keep only the one needed
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/apr-1.lib
+ ${CURRENT_PACKAGES_DIR}/lib/aprapp-1.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/apr-1.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/aprapp-1.lib)
+else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libapr-1.lib
+ ${CURRENT_PACKAGES_DIR}/lib/libaprapp-1.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/libapr-1.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/libaprapp-1.lib)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+endif()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/apr)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/apr/LICENSE ${CURRENT_PACKAGES_DIR}/share/apr/copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/asio/portfile.cmake b/ports/asio/portfile.cmake
index 8c28b951b..345ddd673 100644
--- a/ports/asio/portfile.cmake
+++ b/ports/asio/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/asio-asio-1-10-6/asio/)
vcpkg_download_distfile(ARCHIVE
@@ -8,9 +9,8 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive(${ARCHIVE})
# Handle copyright
-file(COPY ${CURRENT_BUILDTREES_DIR}/src/asio-asio-1-10-6/asio/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/asio)
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/asio)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/asio/COPYING ${CURRENT_PACKAGES_DIR}/share/asio/copyright)
# Copy the asio header files
file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp" PATTERN "*.ipp")
-vcpkg_copy_pdbs()
diff --git a/ports/assimp/portfile.cmake b/ports/assimp/portfile.cmake
index cb173702a..452233265 100644
--- a/ports/assimp/portfile.cmake
+++ b/ports/assimp/portfile.cmake
@@ -6,8 +6,8 @@
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
+SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/assimp-3.3.1)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/assimp/assimp/archive/v3.3.1.zip"
FILENAME "assimp-3.3.1.zip"
@@ -16,7 +16,7 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_configure_cmake(
- SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/assimp-3.3.1
+ SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DASSIMP_BUILD_TESTS=False
-DASSIMP_BUILD_ASSIMP_VIEW=False
-DASSIMP_BUILD_ZLIB=False
@@ -34,5 +34,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
-file(COPY ${CURRENT_BUILDTREES_DIR}/src/assimp-3.3.1/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/assimp)
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/assimp)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/assimp/LICENSE ${CURRENT_PACKAGES_DIR}/share/assimp/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
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
new file mode 100644
index 000000000..18de04d46
--- /dev/null
+++ b/ports/aws-sdk-cpp/CONTROL
@@ -0,0 +1,3 @@
+Source: aws-sdk-cpp
+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/drop_git.patch b/ports/aws-sdk-cpp/drop_git.patch
new file mode 100644
index 000000000..491831bd7
--- /dev/null
+++ b/ports/aws-sdk-cpp/drop_git.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9d2a98a..ce58b68 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,7 +22,7 @@ if(CMAKE_MAJOR_VERSION LESS 3)
+ endif()
+
+ # git is required for Android builds and optional for all other platforms
+-find_package(Git)
++#find_package(Git)
+
+ # Cmake invocation variables:
+ # CUSTOM_MEMORY_MANAGEMENT - if set to 1, generates the sdk project files with custom memory management enabled, otherwise disables it
diff --git a/ports/aws-sdk-cpp/portfile.cmake b/ports/aws-sdk-cpp/portfile.cmake
new file mode 100644
index 000000000..21219c3c9
--- /dev/null
+++ b/ports/aws-sdk-cpp/portfile.cmake
@@ -0,0 +1,52 @@
+include(vcpkg_common_functions)
+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.61.tar.gz"
+ FILENAME "aws-sdk-cpp-1.0.61.tar.gz"
+ SHA512 aef0a85a32db24dc4fba0fc49c2533074580f3df628e787ff0808f03deea5dac42e19b1edc966706784e98cfed17a350c3eff4f222df7cc756065be56d1fc6a6
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+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)
+ set(FORCE_SHARED_CRT OFF)
+else()
+ set(FORCE_SHARED_CRT ON)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DENABLE_TESTING=OFF
+ -DFORCE_SHARED_CRT=${FORCE_SHARED_CRT}
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/lib/cmake
+ ${CURRENT_PACKAGES_DIR}/lib/pkgconfig
+ ${CURRENT_PACKAGES_DIR}/debug/lib/cmake
+ ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig
+ ${CURRENT_PACKAGES_DIR}/nuget
+ ${CURRENT_PACKAGES_DIR}/debug/nuget)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(GLOB LIB_FILES ${CURRENT_PACKAGES_DIR}/bin/*.lib)
+ file(GLOB DEBUG_LIB_FILES ${CURRENT_PACKAGES_DIR}/debug/bin/*.lib)
+ file(COPY ${LIB_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+ file(COPY ${DEBUG_LIB_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+ file(REMOVE ${LIB_FILES} ${DEBUG_LIB_FILES})
+
+ file(APPEND ${CURRENT_PACKAGES_DIR}/include/aws/core/SDKConfig.h "#define USE_IMPORT_EXPORT")
+endif()
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/aws-sdk-cpp RENAME copyright) \ No newline at end of file
diff --git a/ports/azure-storage-cpp/CONTROL b/ports/azure-storage-cpp/CONTROL
new file mode 100644
index 000000000..29c80c703
--- /dev/null
+++ b/ports/azure-storage-cpp/CONTROL
@@ -0,0 +1,5 @@
+Source: azure-storage-cpp
+Version: 2.6.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/cmake.patch b/ports/azure-storage-cpp/cmake.patch
new file mode 100644
index 000000000..9487ab458
--- /dev/null
+++ b/ports/azure-storage-cpp/cmake.patch
@@ -0,0 +1,169 @@
+diff --git a/Microsoft.WindowsAzure.Storage/CMakeLists.txt b/Microsoft.WindowsAzure.Storage/CMakeLists.txt
+index f037c7f..a4dd278 100644
+--- a/Microsoft.WindowsAzure.Storage/CMakeLists.txt
++++ b/Microsoft.WindowsAzure.Storage/CMakeLists.txt
+@@ -51,20 +51,25 @@ if(UNIX)
+ find_package(UnitTest++ REQUIRED)
+ endif()
+
+- option(BUILD_SHARED_LIBS "Build shared Libraries." ON)
+
+- file(GLOB WAS_HEADERS includes/was/*.h)
+- install(FILES ${WAS_HEADERS} DESTINATION include/was)
+- file(GLOB WASCORE_HEADERS includes/wascore/*.h)
+- install(FILES ${WASCORE_HEADERS} DESTINATION include/wascore)
+- file(GLOB WASCORE_DATA includes/wascore/*.dat)
+- install(FILES ${WASCORE_DATA} DESTINATION include/wascore)
++elseif(WIN32)
++ message("-- Setting WIN32 options")
++ find_package(Casablanca REQUIRED)
++ add_definitions(-DUNICODE -D_UNICODE -D_WIN32)
+ else()
+ message("-- Unsupported Build Platform.")
+ endif()
+
++option(BUILD_SHARED_LIBS "Build shared Libraries." ON)
++option(WASTORE_INSTALL_HEADERS "Install header files." ON)
++if(WASTORE_INSTALL_HEADERS)
++ file(GLOB WAS_HEADERS includes/was/*.h)
++ file(GLOB WASCORE_HEADERS includes/wascore/basic_types.h includes/wascore/constants.h)
++ file(GLOB WASCORE_DATA includes/wascore/*.dat)
++endif()
++
+ # Compiler (not platform) specific settings
+-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
++if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ message("-- Setting gcc options")
+
+ set(WARNINGS "-Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code")
+@@ -81,22 +86,29 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ add_definitions(-DBOOST_LOG_DYN_LINK)
+ endif()
+ add_definitions(-D_TURN_OFF_PLATFORM_STRING)
+-elseif((CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
+- message("-- Setting clang options")
++elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
++ message("-- Setting clang options")
+
+- set(WARNINGS "-Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls")
+- set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder -Wno-unused-local-typedefs")
+- set(WARNINGS "${WARNINGS} ${OSX_SUPPRESSIONS}")
++ set(WARNINGS "-Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls")
++ set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-reorder -Wno-unused-local-typedefs")
++ set(WARNINGS "${WARNINGS} ${OSX_SUPPRESSIONS}")
+
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration")
+- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
+- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration")
++ set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
++ set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
+
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
+- if (BUILD_SHARED_LIBS)
+- add_definitions(-DBOOST_LOG_DYN_LINK)
+- endif()
+- add_definitions(-D_TURN_OFF_PLATFORM_STRING)
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
++ if (BUILD_SHARED_LIBS)
++ add_definitions(-DBOOST_LOG_DYN_LINK)
++ endif()
++ add_definitions(-D_TURN_OFF_PLATFORM_STRING)
++elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
++ message("-- Setting MSVC options")
++ add_compile_options(/bigobj)
++ add_compile_options(/MP)
++ if(BUILD_SHARED_LIBS)
++ add_definitions(-DWASTORAGE_DLL -D_USRDLL)
++ endif()
+ else()
+ message("-- Unknown compiler, success is doubtful.")
+ endif()
+@@ -109,7 +121,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Binaries)
+ set(AZURESTORAGE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/includes)
+ set(AZURESTORAGE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/includes ${CASABLANCA_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} ${LibXML++_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} ${Glibmm_INCLUDE_DIRS})
+
+-
+ set(AZURESTORAGE_LIBRARY azurestorage)
+ set(AZURESTORAGE_LIBRARIES ${AZURESTORAGE_LIBRARY} ${CASABLANCA_LIBRARIES} ${Boost_LIBRARIES} ${Boost_FRAMEWORK} ${OPENSSL_LIBRARIES} ${LibXML++_LIBRARIES} ${UUID_LIBRARIES} ${Glibmm_LIBRARIES})
+
+diff --git a/Microsoft.WindowsAzure.Storage/cmake/Modules/FindCasablanca.cmake b/Microsoft.WindowsAzure.Storage/cmake/Modules/FindCasablanca.cmake
+index 5c1df3c..da66eb4 100644
+--- a/Microsoft.WindowsAzure.Storage/cmake/Modules/FindCasablanca.cmake
++++ b/Microsoft.WindowsAzure.Storage/cmake/Modules/FindCasablanca.cmake
+@@ -27,6 +27,7 @@ find_path(CASABLANCA_INCLUDE_DIR
+ find_library(CASABLANCA_LIBRARY
+ NAMES
+ cpprest
++ cpprest_2_9.lib
+ PATHS
+ ${CASABLANCA_PKGCONF_LIBRARY_DIRS}
+ ${CASABLANCA_DIR}
+diff --git a/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt b/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt
+index b08111f..74ba2fb 100644
+--- a/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt
++++ b/Microsoft.WindowsAzure.Storage/src/CMakeLists.txt
+@@ -2,7 +2,7 @@ include_directories(${Boost_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
+ include_directories(${AZURESTORAGE_INCLUDE_DIRS})
+
+ # THE ORDER OF FILES IS VERY /VERY/ IMPORTANT
+-if(UNIX)
++if(UNIX OR WIN32)
+ set(SOURCES
+ xmlhelpers.cpp
+ response_parsers.cpp
+@@ -64,24 +64,46 @@ if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+ endif()
+ if (APPLE)
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS}")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS}")
+ else()
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
++endif()
++
++if(MSVC)
++ add_compile_options(/Yustdafx.h)
++ set_source_files_properties(stdafx.cpp PROPERTIES COMPILE_FLAGS "/Ycstdafx.h")
++
++ if (NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
++ set_property(SOURCE stdafx.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
++ set_property(SOURCE ${SOURCES} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/stdafx.pch")
++ endif()
++
++ list(APPEND SOURCES stdafx.cpp)
+ endif()
+
+ add_library(${AZURESTORAGE_LIBRARY} ${SOURCES})
+
+ target_link_libraries(${AZURESTORAGE_LIBRARIES})
++if(WIN32)
++ target_link_libraries(${AZURESTORAGE_LIBRARY} Ws2_32.lib rpcrt4.lib xmllite.lib bcrypt.lib)
++endif()
+
+ # Portions specific to azure storage binary versioning and installation.
+ if(UNIX)
+ set_target_properties(${AZURESTORAGE_LIBRARY} PROPERTIES
+ SOVERSION ${AZURESTORAGE_VERSION_MAJOR}
+ VERSION ${AZURESTORAGE_VERSION_MAJOR}.${AZURESTORAGE_VERSION_MINOR})
+-
+- install(
+- TARGETS ${AZURESTORAGE_LIBRARY}
+- LIBRARY DESTINATION lib
+- ARCHIVE DESTINATION lib
+- )
++elseif(WIN32)
++ set_target_properties(${AZURESTORAGE_LIBRARY} PROPERTIES OUTPUT_NAME "wastorage")
+ endif()
++
++install(FILES ${WAS_HEADERS} DESTINATION include/was)
++install(FILES ${WASCORE_HEADERS} DESTINATION include/wascore)
++install(FILES ${WASCORE_DATA} DESTINATION include/wascore)
++
++install(
++ TARGETS ${AZURESTORAGE_LIBRARY}
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib
++)
diff --git a/ports/azure-storage-cpp/portfile.cmake b/ports/azure-storage-cpp/portfile.cmake
new file mode 100644
index 000000000..d83a6d854
--- /dev/null
+++ b/ports/azure-storage-cpp/portfile.cmake
@@ -0,0 +1,33 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/azure-storage-cpp-2.6.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
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/cmake.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}/Microsoft.WindowsAzure.Storage
+ OPTIONS
+ -DBUILD_TESTS=OFF
+ -DBUILD_SAMPLES=OFF
+)
+
+vcpkg_install_cmake()
+
+file(INSTALL
+ ${SOURCE_PATH}/LICENSE.txt
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/azure-storage-cpp RENAME copyright)
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/include)
+
+vcpkg_copy_pdbs()
+
diff --git a/ports/bond/portfile.cmake b/ports/bond/portfile.cmake
index 36a127738..8dbf7cf53 100644
--- a/ports/bond/portfile.cmake
+++ b/ports/bond/portfile.cmake
@@ -1,3 +1,7 @@
+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/bond-53ea13692925bee4ba494ee9de3614f15c09d85d)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/boost-di/CONTROL b/ports/boost-di/CONTROL
new file mode 100644
index 000000000..60ac13ceb
--- /dev/null
+++ b/ports/boost-di/CONTROL
@@ -0,0 +1,3 @@
+Source: boost-di
+Version: 1.0.1
+Description: C++14 Dependency Injection Library. \ No newline at end of file
diff --git a/ports/boost-di/portfile.cmake b/ports/boost-di/portfile.cmake
new file mode 100644
index 000000000..38a1f99bd
--- /dev/null
+++ b/ports/boost-di/portfile.cmake
@@ -0,0 +1,22 @@
+#header-only library
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/di-1.0.1)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/boost-experimental/di/archive/v1.0.1.tar.gz"
+ FILENAME "di-1.0.1.tar.gz"
+ SHA512 4e7270be51e7c8d0dcb6e0ba4bcf8e12904016086bdd59667954815f4acb03fc62447775885594a8403f5067a20b2520717fe979926d740dff0efa0c97ebf20c
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(INSTALL ${SOURCE_PATH}/include/boost
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+# boost-di license does not exist in source folder.
+# it shares the boost license.
+vcpkg_download_distfile(LICENSE
+ URLS http://www.boost.org/LICENSE_1_0.txt
+ FILENAME "boost-di-copyright"
+ SHA512 d6078467835dba8932314c1c1e945569a64b065474d7aced27c9a7acc391d52e9f234138ed9f1aa9cd576f25f12f557e0b733c14891d42c16ecdc4a7bd4d60b8
+)
+file(INSTALL ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost-di/copyright) \ No newline at end of file
diff --git a/ports/boost/CONTROL b/ports/boost/CONTROL
index fc0f3cef7..2cc98f16b 100644
--- a/ports/boost/CONTROL
+++ b/ports/boost/CONTROL
@@ -1,3 +1,4 @@
Source: boost
-Version: 1.62
+Version: 1.63
Description: Peer-reviewed portable C++ source libraries
+Build-Depends: zlib, bzip2
diff --git a/ports/boost/portfile.cmake b/ports/boost/portfile.cmake
index 03404b531..81424078e 100644
--- a/ports/boost/portfile.cmake
+++ b/ports/boost/portfile.cmake
@@ -1,13 +1,25 @@
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_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_iterator-hotfix_e7ebe14707130cda7b72e0ae5e93b17157fdb6a2.diff.fixed)
+FILE(WRITE ${DIFF2} "${content}")
+vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} PATCHES ${DIFF2})
+
if(NOT EXISTS ${SOURCE_PATH}/b2.exe)
message(STATUS "Bootstrapping")
vcpkg_execute_required_process(
@@ -19,32 +31,75 @@ endif()
message(STATUS "Bootstrapping done")
set(B2_OPTIONS
- --toolset=msvc
+ -sZLIB_INCLUDE="${CURRENT_INSTALLED_DIR}\\include"
+ -sBZIP2_INCLUDE="${CURRENT_INSTALLED_DIR}\\include"
-j$ENV{NUMBER_OF_PROCESSORS}
- -q
+ --debug-configuration
+ --hash
+
--without-python
+ toolset=msvc
threading=multi
- link=shared
- runtime-link=shared
- --debug-configuration
)
+
+if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ list(APPEND B2_OPTIONS runtime-link=shared)
+else()
+ list(APPEND B2_OPTIONS runtime-link=static)
+endif()
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ list(APPEND B2_OPTIONS link=shared)
+else()
+ list(APPEND B2_OPTIONS link=static)
+endif()
+
if(TRIPLET_SYSTEM_ARCH MATCHES "x64")
list(APPEND B2_OPTIONS address-model=64)
endif()
-if(TRIPLET_SYSTEM_NAME MATCHES "WindowsStore")
+if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
list(APPEND B2_OPTIONS windows-api=store)
set(ENV{BOOST_BUILD_PATH} ${CMAKE_CURRENT_LIST_DIR})
endif()
+# Add build type specific options
+set(B2_OPTIONS_DBG
+ ${B2_OPTIONS}
+ -sZLIB_BINARY=zlibd
+ -sZLIB_LIBPATH="${CURRENT_INSTALLED_DIR}\\debug\\lib"
+ -sBZIP2_BINARY=bz2
+ -sBZIP2_LIBPATH="${CURRENT_INSTALLED_DIR}\\debug\\lib"
+)
-file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
+set(B2_OPTIONS_REL
+ ${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)
+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(
+vcpkg_execute_required_process_repeat(
+ COUNT 2
COMMAND "${SOURCE_PATH}/b2.exe"
--stagedir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/stage
--build-dir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
- ${B2_OPTIONS}
+ ${B2_OPTIONS_REL}
variant=release
debug-symbols=on
WORKING_DIRECTORY ${SOURCE_PATH}
@@ -52,11 +107,12 @@ vcpkg_execute_required_process(
)
message(STATUS "Building ${TARGET_TRIPLET}-rel done")
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
-vcpkg_execute_required_process(
+vcpkg_execute_required_process_repeat(
+ COUNT 2
COMMAND "${SOURCE_PATH}/b2.exe"
--stagedir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/stage
--build-dir=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
- ${B2_OPTIONS}
+ ${B2_OPTIONS_DBG}
variant=debug
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME build-${TARGET_TRIPLET}-dbg
@@ -67,33 +123,63 @@ message(STATUS "Packaging headers")
file(
COPY ${SOURCE_PATH}/boost
DESTINATION ${CURRENT_PACKAGES_DIR}/include
- PATTERN "config/user.hpp" EXCLUDE
-)
-file(COPY ${SOURCE_PATH}/boost/config/user.hpp
- DESTINATION ${CURRENT_PACKAGES_DIR}/include/boost/config/
)
+
+# Disable Boost auto-link.
file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp
- "\n#define BOOST_ALL_DYN_LINK\n"
+ "\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"
+ )
+endif()
+
file(INSTALL ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost RENAME copyright)
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_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 "-sgd-" "-gd-" NEW_FILENAME ${NEW_FILENAME}) # For Debug libs
+ if (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})
+ endif()
+ endforeach()
+endfunction()
+
message(STATUS "Packaging ${TARGET_TRIPLET}-rel")
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/stage/lib/
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
FILES_MATCHING PATTERN "*.lib")
-file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/stage/lib/
- DESTINATION ${CURRENT_PACKAGES_DIR}/bin
- FILES_MATCHING PATTERN "*.dll")
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/stage/lib/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin
+ FILES_MATCHING PATTERN "*.dll")
+endif()
+file(GLOB RELEASE_LIBS ${CURRENT_PACKAGES_DIR}/lib/libboost*.lib)
+boost_rename_libs(RELEASE_LIBS)
message(STATUS "Packaging ${TARGET_TRIPLET}-rel done")
message(STATUS "Packaging ${TARGET_TRIPLET}-dbg")
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/stage/lib/
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
FILES_MATCHING PATTERN "*.lib")
-file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/stage/lib/
- DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
- FILES_MATCHING PATTERN "*.dll")
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/stage/lib/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
+ FILES_MATCHING PATTERN "*.dll")
+endif()
+file(GLOB DEBUG_LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/libboost*.lib)
+boost_rename_libs(DEBUG_LIBS)
message(STATUS "Packaging ${TARGET_TRIPLET}-dbg done")
-vcpkg_copy_pdbs() \ No newline at end of file
+vcpkg_copy_pdbs()
diff --git a/ports/box2d/CONTROL b/ports/box2d/CONTROL
new file mode 100644
index 000000000..7cfcb01a0
--- /dev/null
+++ b/ports/box2d/CONTROL
@@ -0,0 +1,3 @@
+Source: box2d
+Version: 2.3.1-374664b
+Description: Box2D (http://box2d.org) is an open source C++ engine for simulating rigid bodies in 2D.
diff --git a/ports/box2d/portfile.cmake b/ports/box2d/portfile.cmake
new file mode 100644
index 000000000..c0ed6c6c3
--- /dev/null
+++ b/ports/box2d/portfile.cmake
@@ -0,0 +1,77 @@
+
+# Get output directory
+set(PROJECT_ARCH_BITS "x64")
+if(TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ set(PROJECT_ARCH_BITS "x32")
+elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm")
+ message(FATAL_ERROR "ARM not supported")
+endif(TRIPLET_SYSTEM_ARCH MATCHES "x86")
+
+include(vcpkg_common_functions)
+find_program(GIT git)
+
+set(GIT_URL "https://github.com/erincatto/Box2D.git")
+set(GIT_REF "374664b")
+
+if(NOT EXISTS "${DOWNLOADS}/box2d.git")
+ message(STATUS "Cloning")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/box2d.git
+ WORKING_DIRECTORY ${DOWNLOADS}
+ LOGNAME clone
+ )
+endif(NOT EXISTS "${DOWNLOADS}/box2d.git")
+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}/box2d.git
+ LOGNAME worktree
+ )
+endif(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
+message(STATUS "Adding worktree done")
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/)
+
+# Put the licence and readme files where vcpkg expects it
+message(STATUS "Packaging license")
+file(COPY ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/box2d)
+file(COPY ${SOURCE_PATH}/Box2D/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/box2d)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/box2d/License.txt ${CURRENT_PACKAGES_DIR}/share/box2d/copyright)
+message(STATUS "Packaging license done")
+
+# Building:
+set(OUTPUTS_PATH "${SOURCE_PATH}/Box2D/Build/vs2015/bin/${PROJECT_ARCH_BITS}")
+
+vcpkg_build_msbuild(PROJECT_PATH ${SOURCE_PATH}/Box2D/Build/vs2015/Box2D.vcxproj)
+
+message(STATUS "Packaging ${TARGET_TRIPLET}-Release lib")
+file(
+ INSTALL ${OUTPUTS_PATH}/Release/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib
+ FILES_MATCHING PATTERN "*.lib"
+)
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/Box2D.lib ${CURRENT_PACKAGES_DIR}/lib/box2d.lib)
+message(STATUS "Packaging ${TARGET_TRIPLET}-Release lib done")
+
+message(STATUS "Packaging ${TARGET_TRIPLET}-Debug lib")
+file(
+ INSTALL ${OUTPUTS_PATH}/Debug/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
+ FILES_MATCHING PATTERN "*.lib"
+)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/Box2D.lib ${CURRENT_PACKAGES_DIR}/debug/lib/box2d.lib)
+message(STATUS "Packaging ${TARGET_TRIPLET}-Debug lib done")
+
+message(STATUS "Packaging headers")
+file(
+ COPY ${SOURCE_PATH}/Box2D/Box2D
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+ PATTERN "*.h"
+)
+message(STATUS "Packaging headers done")
+
+vcpkg_copy_pdbs()
diff --git a/ports/bullet3/portfile.cmake b/ports/bullet3/portfile.cmake
index 171b70bc6..2cd60a45f 100644
--- a/ports/bullet3/portfile.cmake
+++ b/ports/bullet3/portfile.cmake
@@ -1,4 +1,3 @@
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bullet3-98d47809b4273d97ea06c9b2137ada10af581bb9)
vcpkg_download_distfile(ARCHIVE
@@ -11,16 +10,16 @@ vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
- -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
- -DUSE_MSVC_RUNTIME_LIBRARY_DLL=ON
- -DBUILD_DEMOS=OFF
- -DBUILD_CPU_DEMOS=OFF
- -DBUILD_BULLET2_DEMOS=OFF
- -DBUILD_BULLET3=OFF
- -DBUILD_EXTRAS=OFF
- -DBUILD_UNIT_TESTS=OFF
- -DBUILD_SHARED_LIBS=ON
- -DINSTALL_LIBS=ON
+ -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
+ -DUSE_MSVC_RUNTIME_LIBRARY_DLL=ON
+ -DBUILD_DEMOS=OFF
+ -DBUILD_CPU_DEMOS=OFF
+ -DBUILD_BULLET2_DEMOS=OFF
+ -DBUILD_BULLET3=OFF
+ -DBUILD_EXTRAS=OFF
+ -DBUILD_UNIT_TESTS=OFF
+ -DBUILD_SHARED_LIBS=ON
+ -DINSTALL_LIBS=ON
)
vcpkg_build_cmake()
@@ -33,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()
+vcpkg_copy_pdbs() \ No newline at end of file
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.txt b/ports/cairo/CMakeLists.txt
new file mode 100644
index 000000000..348732130
--- /dev/null
+++ b/ports/cairo/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(cairo VERSION 1.14.6 LANGUAGES C CXX)
+add_subdirectory(src)
diff --git a/ports/cairo/CMakeLists_cairo.txt b/ports/cairo/CMakeLists_cairo.txt
new file mode 100644
index 000000000..85cf9457c
--- /dev/null
+++ b/ports/cairo/CMakeLists_cairo.txt
@@ -0,0 +1,313 @@
+set(CURRENT_INSTALLED_DIR ${CMAKE_PREFIX_PATH})
+
+# Add include directories
+include_directories("." "./win32" "${CURRENT_INSTALLED_DIR}/include")
+
+file(GLOB SOURCES
+"cairo-analysis-surface.c"
+"cairo-arc.c"
+"cairo-array.c"
+"cairo-atomic.c"
+"cairo-base64-stream.c"
+"cairo-base85-stream.c"
+"cairo-bentley-ottmann.c"
+"cairo-bentley-ottmann-rectangular.c"
+"cairo-bentley-ottmann-rectilinear.c"
+"cairo-botor-scan-converter.c"
+"cairo-boxes.c"
+"cairo-boxes-intersect.c"
+"cairo.c"
+"cairo-cache.c"
+"cairo-clip.c"
+"cairo-clip-boxes.c"
+"cairo-clip-polygon.c"
+"cairo-clip-region.c"
+"cairo-clip-surface.c"
+"cairo-color.c"
+"cairo-composite-rectangles.c"
+"cairo-compositor.c"
+"cairo-contour.c"
+"cairo-damage.c"
+"cairo-debug.c"
+"cairo-default-context.c"
+"cairo-device.c"
+"cairo-error.c"
+"cairo-fallback-compositor.c"
+"cairo-fixed.c"
+"cairo-font-face.c"
+"cairo-font-face-twin.c"
+"cairo-font-face-twin-data.c"
+"cairo-font-options.c"
+"cairo-freelist.c"
+"cairo-freed-pool.c"
+"cairo-gstate.c"
+"cairo-hash.c"
+"cairo-hull.c"
+"cairo-image-compositor.c"
+"cairo-image-info.c"
+"cairo-image-source.c"
+"cairo-image-surface.c"
+"cairo-line.c"
+"cairo-lzw.c"
+"cairo-matrix.c"
+"cairo-mask-compositor.c"
+"cairo-mesh-pattern-rasterizer.c"
+"cairo-mempool.c"
+"cairo-misc.c"
+"cairo-mono-scan-converter.c"
+"cairo-mutex.c"
+"cairo-no-compositor.c"
+"cairo-observer.c"
+"cairo-output-stream.c"
+"cairo-paginated-surface.c"
+"cairo-path-bounds.c"
+"cairo-path.c"
+"cairo-path-fill.c"
+"cairo-path-fixed.c"
+"cairo-path-in-fill.c"
+"cairo-path-stroke.c"
+"cairo-path-stroke-boxes.c"
+"cairo-path-stroke-polygon.c"
+"cairo-path-stroke-traps.c"
+"cairo-path-stroke-tristrip.c"
+"cairo-pattern.c"
+"cairo-pen.c"
+"cairo-polygon.c"
+"cairo-polygon-intersect.c"
+"cairo-polygon-reduce.c"
+"cairo-raster-source-pattern.c"
+"cairo-recording-surface.c"
+"cairo-rectangle.c"
+"cairo-rectangular-scan-converter.c"
+"cairo-region.c"
+"cairo-rtree.c"
+"cairo-scaled-font.c"
+"cairo-shape-mask-compositor.c"
+"cairo-slope.c"
+"cairo-spans.c"
+"cairo-spans-compositor.c"
+"cairo-spline.c"
+"cairo-stroke-dash.c"
+"cairo-stroke-style.c"
+"cairo-surface.c"
+"cairo-surface-clipper.c"
+"cairo-surface-fallback.c"
+"cairo-surface-observer.c"
+"cairo-surface-offset.c"
+"cairo-surface-snapshot.c"
+"cairo-surface-subsurface.c"
+"cairo-surface-wrapper.c"
+"cairo-time.c"
+"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"
+"cairo-traps-compositor.c"
+"cairo-unicode.c"
+"cairo-user-font.c"
+"cairo-version.c"
+"cairo-wideint.c"
+# win32
+"win32/cairo-win32-debug.c"
+"win32/cairo-win32-device.c"
+"win32/cairo-win32-gdi-compositor.c"
+"win32/cairo-win32-system.c"
+"win32/cairo-win32-surface.c"
+"win32/cairo-win32-display-surface.c"
+"win32/cairo-win32-printing-surface.c"
+"win32/cairo-win32-font.c"
+# generic font support
+"cairo-cff-subset.c"
+"cairo-scaled-font-subsets.c"
+"cairo-truetype-subset.c"
+"cairo-type1-fallback.c"
+"cairo-type1-glyph-names.c"
+"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"
+# png
+"cairo-png.c"
+# ps surface
+"cairo-ps-surface.c"
+# deflate source
+"cairo-deflate-stream.c"
+# svg surface
+"cairo-svg-surface.c"
+# script surface
+"cairo-script-surface.c"
+# fontconfig + freetype
+"cairo-ft-font.c"
+)
+
+set(CMAKE_DEBUG_POSTFIX "d")
+
+if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
+ # Make the zlib library available
+ find_library(ZLIB_DEBUG_IMPLIB NAMES zlibd)
+ if (ZLIB_DEBUG_IMPLIB STREQUAL ZLIB_DEBUG_IMPLIB-NOTFOUND)
+ message(FATAL_ERROR "The zlibd.lib import library could not be found. Check to ensure that zlib is properly installed.")
+ endif()
+ add_library(zlib UNKNOWN IMPORTED)
+ set_property(TARGET zlib PROPERTY IMPORTED_LOCATION "${ZLIB_DEBUG_IMPLIB}")
+
+ # Make the libpng library available
+ find_library(LIBPNG_DEBUG_IMPLIB NAMES libpng16d)
+ if (LIBPNG_DEBUG_IMPLIB STREQUAL LIBPNG_DEBUG_IMPLIB-NOTFOUND)
+ message(FATAL_ERROR "The libpng16d.lib import library could not be found. Check to ensure that libpng is properly installed.")
+ endif()
+ add_library(libpng UNKNOWN IMPORTED)
+ set_property(TARGET libpng PROPERTY IMPORTED_LOCATION "${LIBPNG_DEBUG_IMPLIB}")
+
+ # Make the pixman library available
+ find_library(PIXMAN_DEBUG_IMPLIB NAMES pixman-1d)
+ if (PIXMAN_DEBUG_IMPLIB STREQUAL PIXMAN_DEBUG_IMPLIB-NOTFOUND)
+ message(FATAL_ERROR "The pixman-1d.lib import library could not be found. Check to ensure that pixman is properly installed.")
+ endif()
+ add_library(pixman UNKNOWN IMPORTED)
+ set_property(TARGET pixman PROPERTY IMPORTED_LOCATION "${PIXMAN_DEBUG_IMPLIB}")
+
+elseif (${CMAKE_BUILD_TYPE} STREQUAL "Release")
+ # Make the zlib library available
+ find_library(ZLIB_RELEASE_IMPLIB NAMES zlib)
+ if (ZLIB_RELEASE_IMPLIB STREQUAL ZLIB_RELEASE_IMPLIB-NOTFOUND)
+ message(FATAL_ERROR "The zlib.lib import library could not be found. Check to ensure that zlib is properly installed.")
+ endif()
+ add_library(zlib UNKNOWN IMPORTED)
+ set_property(TARGET zlib PROPERTY IMPORTED_LOCATION "${ZLIB_RELEASE_IMPLIB}")
+
+ # Make the libpng library available
+ find_library(LIBPNG_RELEASE_IMPLIB NAMES libpng16)
+ if (LIBPNG_RELEASE_IMPLIB STREQUAL LIBPNG_RELEASE_IMPLIB-NOTFOUND)
+ message(FATAL_ERROR "The libpng16.lib import library could not be found. Check to ensure that libpng is properly installed.")
+ endif()
+ add_library(libpng UNKNOWN IMPORTED)
+ set_property(TARGET libpng PROPERTY IMPORTED_LOCATION "${LIBPNG_RELEASE_IMPLIB}")
+
+ # Make the pixman library available
+ find_library(PIXMAN_RELEASE_IMPLIB NAMES pixman-1)
+ if (PIXMAN_RELEASE_IMPLIB STREQUAL PIXMAN_RELEASE_IMPLIB-NOTFOUND)
+ message(FATAL_ERROR "The pixman-1.lib import library could not be found. Check to ensure that pixman is properly installed.")
+ endif()
+ add_library(pixman UNKNOWN IMPORTED)
+ set_property(TARGET pixman PROPERTY IMPORTED_LOCATION "${PIXMAN_RELEASE_IMPLIB}")
+
+else()
+ message(FATAL_ERROR "Unexpected value '${CMAKE_BUILD_TYPE}' for CMAKE_BUILD_TYPE.")
+endif()
+
+# Make the gdi32 library available
+find_library(GDI32_LIBRARY NAMES gdi32)
+if (GDI32_LIBRARY STREQUAL GDI32_LIBRARY-NOTFOUND)
+ message(FATAL_ERROR "The gdi32.lib import library could not be found. Check to ensure that the Windows SDK is installed.")
+endif()
+add_library(gdi32 UNKNOWN IMPORTED)
+set_property(TARGET gdi32 PROPERTY IMPORTED_LOCATION "${GDI32_LIBRARY}")
+
+# Make the msimg32 library available
+find_library(MSIMG32_LIBRARY NAMES msimg32)
+if (MSIMG32_LIBRARY STREQUAL MSIMG32_LIBRARY-NOTFOUND)
+ message(FATAL_ERROR "The msimg32.lib import library could not be found. Check to ensure that the Windows SDK is installed.")
+endif()
+add_library(msimg32 UNKNOWN IMPORTED)
+set_property(TARGET msimg32 PROPERTY IMPORTED_LOCATION "${MSIMG32_LIBRARY}")
+
+# Make the user32 library available
+find_library(USER32_LIBRARY NAMES user32)
+if (USER32_LIBRARY STREQUAL USER32_LIBRARY-NOTFOUND)
+ message(FATAL_ERROR "The user32.lib import library could not be found. Check to ensure that the Windows SDK is installed.")
+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 ${FREETYPE_LIBRARY} ${FONTCONFIG_LIBRARY})
+
+ install(TARGETS cairo
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION bin
+ ARCHIVE DESTINATION lib
+ )
+elseif (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ add_library(cairo-static ${SOURCES})
+ 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 ${FREETYPE_LIBRARY} ${FONTCONFIG_LIBRARY})
+
+ install(TARGETS cairo-static
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
+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
new file mode 100644
index 000000000..89ba03b79
--- /dev/null
+++ b/ports/cairo/CONTROL
@@ -0,0 +1,4 @@
+Source: cairo
+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, glib, freetype, fontconfig
diff --git a/ports/cairo/cairo-features.h b/ports/cairo/cairo-features.h
new file mode 100644
index 000000000..3a1963974
--- /dev/null
+++ b/ports/cairo/cairo-features.h
@@ -0,0 +1,36 @@
+#ifndef CAIRO_FEATURES_H
+#define CAIRO_FEATURES_H
+/* Chosen from the various possible defines in "../build/Makefile.win32.features.h""
+ guided by "../build/Makefile.win32.features". Modify at your own risk.
+*/
+
+/* Always for Win32 */
+#define CAIRO_HAS_WIN32_SURFACE 1
+#define CAIRO_HAS_WIN32_FONT 1
+
+/* Require libpng */
+#define CAIRO_HAS_PNG_FUNCTIONS 1
+#define CAIRO_HAS_PS_SURFACE 1
+#define CAIRO_HAS_PDF_SURFACE 1
+
+// Likely available
+#define CAIRO_HAS_SCRIPT_SURFACE 1
+#define CAIRO_HAS_SVG_SURFACE 1
+
+/* Always available */
+#define CAIRO_HAS_IMAGE_SURFACE 1
+#define CAIRO_HAS_MIME_SURFACE 1
+#define CAIRO_HAS_RECORDING_SURFACE 1
+#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
new file mode 100644
index 000000000..57b45e91c
--- /dev/null
+++ b/ports/cairo/portfile.cmake
@@ -0,0 +1,56 @@
+# 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/cairo-1.15.4)
+vcpkg_download_distfile(ARCHIVE
+ 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})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_cairo.txt DESTINATION ${SOURCE_PATH}/src)
+file(RENAME ${SOURCE_PATH}/src/CMakeLists_cairo.txt ${SOURCE_PATH}/src/CMakeLists.txt)
+file(COPY ${CURRENT_PORT_DIR}/cairo-features.h DESTINATION ${SOURCE_PATH}/src)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ )
+elseif (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ )
+endif()
+
+vcpkg_install_cmake()
+
+# Copy the appropriate header files.
+file(COPY
+"${SOURCE_PATH}/src/cairo.h"
+"${SOURCE_PATH}/src/cairo-deprecated.h"
+"${SOURCE_PATH}/src/cairo-features.h"
+"${SOURCE_PATH}/src/cairo-pdf.h"
+"${SOURCE_PATH}/src/cairo-ps.h"
+"${SOURCE_PATH}/src/cairo-script.h"
+"${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
+)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/cairo)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/cairo/COPYING ${CURRENT_PACKAGES_DIR}/share/cairo/copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/catch/CONTROL b/ports/catch/CONTROL
new file mode 100644
index 000000000..893563e15
--- /dev/null
+++ b/ports/catch/CONTROL
@@ -0,0 +1,3 @@
+Source: catch
+Version: 1.5.7
+Description: C++ Automated Test Cases in Headers
diff --git a/ports/catch/portfile.cmake b/ports/catch/portfile.cmake
new file mode 100644
index 000000000..5575af742
--- /dev/null
+++ b/ports/catch/portfile.cmake
@@ -0,0 +1,28 @@
+# 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}
+#
+
+#header-only library
+include(vcpkg_common_functions)
+
+vcpkg_download_distfile(HEADER
+ URLS "https://raw.githubusercontent.com/philsquared/Catch/e27c4ee04282f60aefcc9b1062a74f92cf6c1a2b/single_include/catch.hpp"
+ FILENAME "catch.hpp"
+ SHA512 c2fec38227bb1725c30f955583dbd012f86eef83512a0c154e91b77249df372db067710ae110463eb07adec722d214114fd6a2cebff7ee43c5fd567a6a1ba221
+)
+
+vcpkg_download_distfile(LICENSE
+ URLS "https://raw.githubusercontent.com/philsquared/Catch/e27c4ee04282f60aefcc9b1062a74f92cf6c1a2b/LICENSE_1_0.txt"
+ FILENAME "License_1_0.txt"
+ SHA512 d6078467835dba8932314c1c1e945569a64b065474d7aced27c9a7acc391d52e9f234138ed9f1aa9cd576f25f12f557e0b733c14891d42c16ecdc4a7bd4d60b8
+)
+
+file(COPY ${HEADER} DESTINATION ${CURRENT_PACKAGES_DIR}/include )
+file(COPY ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/catch )
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/catch/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/catch/copyright)
+
+
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 c0ea61800..24300fdfa 100644
--- a/ports/chakracore/CONTROL
+++ b/ports/chakracore/CONTROL
@@ -1,3 +1,3 @@
Source: chakracore
-Version: 1.2.0.0
+Version: 1.4.0
Description: Core part of the Chakra Javascript engine \ No newline at end of file
diff --git a/ports/chakracore/portfile.cmake b/ports/chakracore/portfile.cmake
index 6780b6b55..d4bec63d2 100644
--- a/ports/chakracore/portfile.cmake
+++ b/ports/chakracore/portfile.cmake
@@ -1,21 +1,17 @@
-include(vcpkg_common_functions)
-find_program(POWERSHELL powershell)
+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/ChakraCore-1.2.0.0)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ChakraCore-1.4.0)
vcpkg_download_distfile(ARCHIVE_FILE
- URLS "https://github.com/Microsoft/ChakraCore/archive/v1.2.0.0.tar.gz"
- FILENAME "ChakraCore-1.2.0.0.tar.gz"
- SHA512 53e487028a30605a4e2589c40b65da060ca4884617fdba8877557e4db75f911be4433d260132cce3526647622bdc742a0aacda1443a16dfed3d3fdd442539528
+ URLS "https://github.com/Microsoft/ChakraCore/archive/v1.4.0.tar.gz"
+ FILENAME "ChakraCore-1.4.0.tar.gz"
+ SHA512 d515d56ff1c5776ca4663e27daa4d1c7ca58c57f097799de756980771b5701e35639eefa4db5921d7327e6607b8920df3b30677eb467123e04536df0d971cebc
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
-message(STATUS "Patching JavascriptPromise.cpp for https://github.com/Microsoft/ChakraCore/issues/1429")
-vcpkg_execute_required_process(
- COMMAND ${POWERSHELL} -command (gc lib/runtime/library/JavascriptPromise.cpp -encoding utf7) -replace('«', '^<^<') -replace('»', '^>^>') | Set-Content lib/runtime/library/JavascriptPromise.cpp
- WORKING_DIRECTORY ${SOURCE_PATH}
-)
-message(STATUS "Patching done.")
-
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/Build/Chakra.Core.sln
)
diff --git a/ports/charls/0001_cmake.patch b/ports/charls/0001_cmake.patch
new file mode 100644
index 000000000..7f50a98e6
--- /dev/null
+++ b/ports/charls/0001_cmake.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1aa40a8..1051997 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -33,6 +33,7 @@ option (BUILD_TESTING "Build tests" ON)
+ if (WIN32)
+ if (BUILD_SHARED_LIBS)
+ add_definitions(-D CHARLS_DLL)
++ set_source_files_properties(src/interface.cpp PROPERTIES COMPILE_FLAGS -DCHARLS_DLL_BUILD)
+ else()
+ add_definitions(-D CHARLS_STATIC)
+ endif()
diff --git a/ports/charls/CONTROL b/ports/charls/CONTROL
new file mode 100644
index 000000000..8be1a5027
--- /dev/null
+++ b/ports/charls/CONTROL
@@ -0,0 +1,3 @@
+Source: charls
+Version: 2.0.0
+Description: CharLS, a C++ JPEG-LS library implementation. \ No newline at end of file
diff --git a/ports/charls/portfile.cmake b/ports/charls/portfile.cmake
new file mode 100644
index 000000000..69726f1c3
--- /dev/null
+++ b/ports/charls/portfile.cmake
@@ -0,0 +1,27 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/charls-2.0.0)
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "https://github.com/team-charls/charls/archive/2.0.0.tar.gz"
+ FILENAME "charls-2.0.0.tar.gz"
+ SHA512 0a2862fad6d65b941c81f5f838db1fdc6a4625887281ddbf27e21be9084f607d27c8a27d246d6252e08358b2ed4aa0c2b7407048ca559fb40e94313ca72487dd
+)
+vcpkg_extract_source_archive(${ARCHIVE_FILE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DBUILD_TESTING=OFF
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/charls RENAME copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/clockutils/CONTROL b/ports/clockutils/CONTROL
new file mode 100644
index 000000000..4ade8d5f0
--- /dev/null
+++ b/ports/clockutils/CONTROL
@@ -0,0 +1,3 @@
+Source: clockutils
+Version: 1.1.1
+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
new file mode 100644
index 000000000..c078673a6
--- /dev/null
+++ b/ports/clockutils/portfile.cmake
@@ -0,0 +1,37 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/clockUtils-1.1.1)
+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
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ SET(SHARED_FLAG ON)
+else()
+ SET(SHARED_FLAG OFF)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DWITH_LIBRARY_ARGPARSER=ON
+ -DWITH_LIBRARY_COMPRESSION=ON
+ -DWITH_LIBRARY_CONTAINER=ON
+ -DWITH_LIBRARY_INIPARSER=ON
+ -DWITH_LIBRARY_SOCKETS=ON
+ -DWITH_TESTING=OFF
+ -DCLOCKUTILS_BUILD_SHARED=${SHARED_FLAG}
+)
+
+vcpkg_build_cmake()
+vcpkg_install_cmake()
+
+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)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/cocos2d/portfile.cmake b/ports/cocos2d/portfile.cmake
deleted file mode 100644
index a4048090b..000000000
--- a/ports/cocos2d/portfile.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cocos2d-x-cocos2d-x-3.10)
-vcpkg_download_distfile(ARCHIVE_FILE
- URLS "https://github.com/cocos2d/cocos2d-x/archive/cocos2d-x-3.10.tar.gz"
- FILENAME "cocos2d-x-3.10.tar.gz"
- MD5 7c67068675ad28374448e844b0e463ff
-)
-vcpkg_download_distfile(DEPS_ARCHIVE_FILE
- URLS "https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-79.zip"
- FILENAME "cocos2d-x-v3-deps-79.zip"
- MD5 5d88ff867205080b9ee8da532437e891
-)
-
-vcpkg_extract_source_archive(${ARCHIVE_FILE})
-
-if(NOT EXISTS ${SOURCE_PATH}/external/unzip)
- message(STATUS "Extracting dependencies ${DEPS_ARCHIVE_FILE}")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/deps)
- vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} -E tar xjf ${DEPS_ARCHIVE_FILE}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/deps
- LOGNAME extract-deps
- )
- file(REMOVE_RECURSE ${SOURCE_PATH}/external)
- file(RENAME ${CURRENT_BUILDTREES_DIR}/deps/cocos2d-x-3rd-party-libs-bin-3-deps-79 ${SOURCE_PATH}/external)
-endif()
-message(STATUS "Extracting dependencies done")
-
-file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindGLFW3.cmake)
-
-vcpkg_configure_cmake(
- SOURCE_PATH ${SOURCE_PATH}
- OPTIONS
- -DUSE_CHIPMUNK=OFF
- -DUSE_BOX2D=OFF
- -DUSE_BULLET=OFF
- -DUSE_RECAST=OFF
- -DUSE_WEBP=OFF
- -DBUILD_SHARED_LIBS=ON
- -DUSE_PREBUILT_LIBS=OFF
-)
-
-vcpkg_install_cmake()
-
-file(INSTALL ${SOURCE_PATH}/licenses/LICENSE_cocos2d-x.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cocos2d-x RENAME copyright)
-vcpkg_copy_pdbs()
-
diff --git a/ports/constexpr/portfile.cmake b/ports/constexpr/portfile.cmake
index 137bf0e60..9563b6c15 100644
--- a/ports/constexpr/portfile.cmake
+++ b/ports/constexpr/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/constexpr-a98b1db39c909e0130d21d3910d4faf97035a625)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/cpprestsdk/0001-Use-find_package-on-Windows.-Enable-install-target-f.patch b/ports/cpprestsdk/0001_cmake.patch
index 40e6a5ce3..be8f2cff7 100644
--- a/ports/cpprestsdk/0001-Use-find_package-on-Windows.-Enable-install-target-f.patch
+++ b/ports/cpprestsdk/0001_cmake.patch
@@ -1,16 +1,5 @@
-From cc9d3ca4d1d16134a1976b89b58b11372a2798d5 Mon Sep 17 00:00:00 2001
-From: Robert Schumacher <roschuma@microsoft.com>
-Date: Wed, 4 May 2016 21:37:23 -0700
-Subject: [PATCH] Use find_package on Windows. Enable 'install' target for all
- systems.
-
----
- Release/CMakeLists.txt | 48 ++++++++++++++--------------------------------
- Release/src/CMakeLists.txt | 13 +++++++------
- 2 files changed, 21 insertions(+), 40 deletions(-)
-
diff --git a/Release/CMakeLists.txt b/Release/CMakeLists.txt
-index cbe840b..3045948 100644
+index 1274102..fe245e6 100644
--- a/Release/CMakeLists.txt
+++ b/Release/CMakeLists.txt
@@ -89,15 +89,6 @@ elseif(UNIX) # This includes OSX
@@ -29,10 +18,11 @@ index cbe840b..3045948 100644
elseif(WIN32)
option(BUILD_SHARED_LIBS "Build shared Libraries." ON)
option(BUILD_SAMPLES "Build samples." ON)
-@@ -114,36 +105,25 @@ elseif(WIN32)
+@@ -113,37 +104,25 @@ elseif(WIN32)
+ set(Casablanca_DEFINITIONS "" CACHE INTERNAL "Definitions for consume casablanca library")
endif()
add_definitions(${Casablanca_DEFINITIONS} -D_WINSOCK_DEPRECATED_NO_WARNINGS -DWIN32)
-
+-
- if (NOT CPPREST_EXCLUDE_WEBSOCKETS)
- set(NUGET_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../packages")
- set(PACKAGE_PATHS)
@@ -58,11 +48,12 @@ index cbe840b..3045948 100644
- endif()
-
- set(Boost_INCLUDE_DIR "${NUGET_PATH}/boost.1.58.0.0/lib/native/include")
+- endif()
+ if (NOT CPPREST_EXCLUDE_WEBSOCKETS AND NOT WINDOWS_STORE)
+ find_package(ZLIB REQUIRED)
+ find_package(OpenSSL REQUIRED)
+ find_package(Boost REQUIRED COMPONENTS regex system date_time)
- endif()
++ endif()
else()
message(FATAL_ERROR "-- Unsupported Build Platform.")
endif()
@@ -81,7 +72,7 @@ index cbe840b..3045948 100644
if(ANDROID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
diff --git a/Release/src/CMakeLists.txt b/Release/src/CMakeLists.txt
-index cf086ed..3e5fffa 100644
+index 4074905..da907e5 100644
--- a/Release/src/CMakeLists.txt
+++ b/Release/src/CMakeLists.txt
@@ -144,10 +144,11 @@ elseif(ANDROID)
@@ -102,6 +93,4 @@ index cf086ed..3e5fffa 100644
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
---
-2.8.1.windows.1
-
+\ No newline at end of file
diff --git a/ports/cpprestsdk/CONTROL b/ports/cpprestsdk/CONTROL
index eca83755b..f284f2b53 100644
--- a/ports/cpprestsdk/CONTROL
+++ b/ports/cpprestsdk/CONTROL
@@ -1,4 +1,5 @@
Source: cpprestsdk
-Version: 2.8
+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 11db7c379..f92c5147a 100644
--- a/ports/cpprestsdk/portfile.cmake
+++ b/ports/cpprestsdk/portfile.cmake
@@ -1,49 +1,39 @@
include(vcpkg_common_functions)
-find_program(GIT git)
-
-set(GIT_URL "https://github.com/Microsoft/cpprestsdk")
-set(GIT_REF "3542f07")
-
-if(NOT EXISTS "${DOWNLOADS}/cpprestsdk.git")
- message(STATUS "Cloning")
- vcpkg_execute_required_process(
- COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/cpprestsdk.git
- WORKING_DIRECTORY ${DOWNLOADS}
- LOGNAME clone
- )
-endif()
-message(STATUS "Cloning done")
-
-if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
- message(STATUS "Adding worktree and patching")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
- vcpkg_execute_required_process(
- COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REF}
- WORKING_DIRECTORY ${DOWNLOADS}/cpprestsdk.git
- LOGNAME worktree
- )
- message(STATUS "Patching")
- vcpkg_execute_required_process(
- COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/0001-Use-find_package-on-Windows.-Enable-install-target-f.patch --ignore-whitespace --whitespace=fix
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src
- LOGNAME patch
- )
-endif()
-message(STATUS "Adding worktree and patching done")
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cpprestsdk-2.9.0)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Microsoft/cpprestsdk/archive/v2.9.0.tar.gz"
+ FILENAME "cpprestsdk-2.9.0.tar.gz"
+ SHA512 c75de6ad33b3e8d2c6ba7c0955ed851d557f78652fb38a565de0cfbc99e7db89cb6fa405857512e5149df80356c51ae9335abd914c3c593fa6658ac50adf4e29
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch
+)
+
+SET(WEBSOCKETPP_PATH "${CURRENT_INSTALLED_DIR}/share/websocketpp")
vcpkg_configure_cmake(
- SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/Release
+ SOURCE_PATH ${SOURCE_PATH}/Release
OPTIONS
+ -DWEBSOCKETPP_CONFIG=${WEBSOCKETPP_PATH}
+ -DWEBSOCKETPP_CONFIG_VERSION=${WEBSOCKETPP_PATH}
-DBUILD_TESTS=OFF
-DBUILD_SAMPLES=OFF
- -DCPPREST_EXCLUDE_WEBSOCKETS=ON
+ -DCPPREST_EXCLUDE_WEBSOCKETS=OFF
OPTIONS_DEBUG
-DCASA_INSTALL_HEADERS=OFF
)
vcpkg_install_cmake()
-file(COPY ${CURRENT_BUILDTREES_DIR}/src/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cpprestsdk)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/cpprestsdk/license.txt ${CURRENT_PACKAGES_DIR}/share/cpprestsdk/copyright)
+file(INSTALL
+ ${SOURCE_PATH}/license.txt
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/cpprestsdk RENAME copyright)
+
vcpkg_copy_pdbs()
diff --git a/ports/cppwinrt/portfile.cmake b/ports/cppwinrt/portfile.cmake
index 927a17afb..452911172 100644
--- a/ports/cppwinrt/portfile.cmake
+++ b/ports/cppwinrt/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
find_program(GIT git)
diff --git a/ports/cppzmq/CONTROL b/ports/cppzmq/CONTROL
new file mode 100644
index 000000000..a7625e25d
--- /dev/null
+++ b/ports/cppzmq/CONTROL
@@ -0,0 +1,4 @@
+Source: cppzmq
+Version: 0.0.0-1
+Build-Depends: zeromq
+Description: lightweight messaging kernel, C++ bindings
diff --git a/ports/cppzmq/portfile.cmake b/ports/cppzmq/portfile.cmake
new file mode 100644
index 000000000..c2e03c81d
--- /dev/null
+++ b/ports/cppzmq/portfile.cmake
@@ -0,0 +1,16 @@
+#header-only library
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cppzmq-7faa9b061843fcbceb7ed94984ee8f20284ee759)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/zeromq/cppzmq/archive/7faa9b061843fcbceb7ed94984ee8f20284ee759.zip"
+ FILENAME "cppzmq-7faa.zip"
+ SHA512 10ba10f0e9a2387dc75fec01c2629b969f23d6152596a475474b701a4efccc4007c8eae5ec2a89f7f26e7d117f36016aaead16bf3325a8780bfd6419d84ac54e
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+# cppzmq is a single header library, so we just need to copy that file in the include directory
+file(INSTALL ${SOURCE_PATH}/zmq.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cppzmq)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/cppzmq/LICENSE ${CURRENT_PACKAGES_DIR}/share/cppzmq/copyright)
diff --git a/ports/cryptopp/CONTROL b/ports/cryptopp/CONTROL
new file mode 100644
index 000000000..2a38d8910
--- /dev/null
+++ b/ports/cryptopp/CONTROL
@@ -0,0 +1,3 @@
+Source: cryptopp
+Version: 5.6.5
+Description: Crypto++ is a free C++ class library of cryptographic schemes.
diff --git a/ports/cryptopp/portfile.cmake b/ports/cryptopp/portfile.cmake
new file mode 100644
index 000000000..4847c208b
--- /dev/null
+++ b/ports/cryptopp/portfile.cmake
@@ -0,0 +1,45 @@
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ message(STATUS "Warning: Dynamic building not supported. Building static.") # See note below
+ set(VCPKG_LIBRARY_LINKAGE static)
+endif()
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cryptopp-CRYPTOPP_5_6_5)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_5_6_5.zip"
+ FILENAME "CRYPTOPP_5_6_5.zip"
+ SHA512 abca8089e2d587f59c503d2d6412b3128d061784349c735f3ee46be1cb9e3d0d0fed9a9173765fa033eb2dc744e03810de45b8cc2f8ca1672a36e4123648ea44
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+# Dynamic linking should be avoided for Crypto++ to reduce the attack surface,
+# so generate a static lib for both dynamic and static vcpkg targets.
+# See also:
+# https://www.cryptopp.com/wiki/Visual_Studio#Dynamic_Runtime_Linking
+# https://www.cryptopp.com/wiki/Visual_Studio#The_DLL
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DBUILD_SHARED=OFF
+ -DBUILD_STATIC=ON
+ -DBUILD_TESTING=OFF
+ -DBUILD_DOCUMENTATION=OFF
+)
+
+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)
+
+# Remove executables
+file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/cryptest.exe)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/cryptest.exe)
+
+# Remove other files not required in package
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cryptopp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/cryptopp/License.txt ${CURRENT_PACKAGES_DIR}/share/cryptopp/copyright)
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/0001_cmake.patch b/ports/curl/0001_cmake.patch
new file mode 100644
index 000000000..db281e122
--- /dev/null
+++ b/ports/curl/0001_cmake.patch
@@ -0,0 +1,13 @@
+diff --git a/CMake/FindLibSSH2.cmake b/CMake/FindLibSSH2.cmake
+index 12a7c61..9839c67 100644
+--- a/CMake/FindLibSSH2.cmake
++++ b/CMake/FindLibSSH2.cmake
+@@ -12,7 +12,7 @@ endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
+ FIND_PATH(LIBSSH2_INCLUDE_DIR libssh2.h
+ )
+
+-FIND_LIBRARY(LIBSSH2_LIBRARY NAMES ssh2
++FIND_LIBRARY(LIBSSH2_LIBRARY NAMES ssh2 libssh2
+ )
+
+ if(LIBSSH2_INCLUDE_DIR)
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 259803ab7..9ae7e7e52 100644
--- a/ports/curl/CONTROL
+++ b/ports/curl/CONTROL
@@ -1,3 +1,4 @@
Source: curl
-Version: 7.48.0
-Description: A library for transferring data with URLs \ No newline at end of file
+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 4c1a7bf3a..35bfbd592 100644
--- a/ports/curl/portfile.cmake
+++ b/ports/curl/portfile.cmake
@@ -1,24 +1,61 @@
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/curl-7.48.0)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/curl-curl-7_51_0)
vcpkg_download_distfile(ARCHIVE_FILE
- URLS "https://curl.haxx.se/download/curl-7.48.0.tar.bz2"
- FILENAME "curl-7.48.0.tar.bz2"
- SHA512 9bb554eaf4ccaced0fa9b38de4f381eab84b96c1aa07a45d83ddfd38a925044d0fe9fac517263f67f009d2294a31c33dedb2267defbab0cb14f96091bbed5f92
+ URLS "https://github.com/curl/curl/archive/curl-7_51_0.tar.gz"
+ FILENAME "curl-7.51.0.tar.gz"
+ SHA512 88ec572efb1b2fb793dc26b627e54863718e774343283f0eb92022ce252f7798332d9d3f20f63e45c38576614a000abbf12570e91e14a118f150e0378f1a27e5
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
-vcpkg_configure_cmake(
+vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
- OPTIONS
- -DBUILD_CURL_TESTS=OFF
- -DBUILD_CURL_EXE=OFF
- -DENABLE_MANUAL=OFF
- OPTIONS_DEBUG
- -DENABLE_DEBUG=ON
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch
+ ${CMAKE_CURRENT_LIST_DIR}/0002_fix_uwp.patch
)
+if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ SET(CURL_STATICLIB OFF)
+else()
+ SET(CURL_STATICLIB ON)
+endif()
+
+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()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/curl RENAME copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+endif()
+
vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/decimal-for-cpp/CONTROL b/ports/decimal-for-cpp/CONTROL
new file mode 100644
index 000000000..72f0355f8
--- /dev/null
+++ b/ports/decimal-for-cpp/CONTROL
@@ -0,0 +1,4 @@
+Source: decimal-for-cpp
+Version:1.12
+Description: Decimal data type support, for COBOL-like fixed-point operations on currency values.
+
diff --git a/ports/decimal-for-cpp/portfile.cmake b/ports/decimal-for-cpp/portfile.cmake
new file mode 100644
index 000000000..3ad2aee46
--- /dev/null
+++ b/ports/decimal-for-cpp/portfile.cmake
@@ -0,0 +1,29 @@
+# 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}
+#
+
+#header-only library
+
+include(vcpkg_common_functions)
+
+vcpkg_download_distfile(HEADER
+ URLS "https://raw.githubusercontent.com/vpiotr/decimal_for_cpp/98287a0f0f48aaed2cc146d7682396ae08ed0aea/include/decimal.h"
+ FILENAME "decimal.h"
+ SHA512 9de1208760c74ff1e6b1a74957dabae33981d2f5d0ec402b48f27f4dc24c950ea69219a9ee9831959a8669a9c7908093d833a227924f1955cbe444a9f43c5f3a
+)
+
+vcpkg_download_distfile(LICENSE
+ URLS "https://raw.githubusercontent.com/vpiotr/decimal_for_cpp/98287a0f0f48aaed2cc146d7682396ae08ed0aea/doc/license.txt"
+ FILENAME "decimal-for-cpp-License.txt"
+ SHA512 0b2be46b07a0536404887fae9665d6532ffd4cbfefbec42926c14e055f538c1f3a73b6e61ab7fa1584e634ad99304133d18855197df0a914cbb835674cc67677
+)
+
+
+file(COPY ${HEADER} DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(COPY ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/decimal-for-cpp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/decimal-for-cpp/decimal-for-cpp-License.txt ${CURRENT_PACKAGES_DIR}/share/decimal-for-cpp/copyright)
+
diff --git a/ports/dimcli/CONTROL b/ports/dimcli/CONTROL
new file mode 100644
index 000000000..c85457c89
--- /dev/null
+++ b/ports/dimcli/CONTROL
@@ -0,0 +1,4 @@
+Source: dimcli
+Version: 1.0.3
+Description: C++ command line parser toolkit
+
diff --git a/ports/dimcli/portfile.cmake b/ports/dimcli/portfile.cmake
new file mode 100644
index 000000000..465e1699e
--- /dev/null
+++ b/ports/dimcli/portfile.cmake
@@ -0,0 +1,37 @@
+# Common Ambient Variables:
+# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
+# TARGET_TRIPLET is the current triplet (x86-windows, etc)
+# PORT is the current port name (zlib, etc)
+# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
+# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
+#
+
+set(ver 1.0.3)
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/dimcli-${ver})
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/gknowles/dimcli/archive/v${ver}.zip"
+ FILENAME "dimcli-${ver}.zip"
+ SHA512 5168aff22223cb85421fabd4ce82f3ec0bcab6551704484bc5b05be02ead23bd3d4a629c558a15f214e9d999eccc9c129649d066fdacfda3c839a40b48f8ec17
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+set(staticCrt OFF)
+if(VCPKG_CRT_LINKAGE STREQUAL static)
+ set(staticCrt ON)
+endif()
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DLINK_STATIC_RUNTIME:BOOL=${staticCrt}
+)
+
+vcpkg_install_cmake()
+
+# Remove includes from ${CMAKE_INSTALL_PREFIX}/debug
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+file(INSTALL "${SOURCE_PATH}/LICENSE"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/share/dimcli"
+ RENAME copyright)
+
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
new file mode 100644
index 000000000..97f97ecd9
--- /dev/null
+++ b/ports/directxtk/CONTROL
@@ -0,0 +1,3 @@
+Source: directxtk
+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
new file mode 100644
index 000000000..fc4418d75
--- /dev/null
+++ b/ports/directxtk/portfile.cmake
@@ -0,0 +1,51 @@
+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/DirectXTK-dec2016)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Microsoft/DirectXTK/archive/dec2016.tar.gz"
+ FILENAME "DirectXTK-dec2016.tar.gz"
+ SHA512 efb8a98d0872bf1835b274ba88615e88c4a58ab753c5ebef5a407c54d5f9a2197d1521f14651c60ea16c047918db6f54bf2ac58a6eb7330490b9bae619e8dad3
+)
+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}/DirectXTK_Desktop_2015.sln
+ PLATFORM ${BUILD_ARCH}
+)
+
+file(INSTALL
+ ${SOURCE_PATH}/Bin/Desktop_2015/${BUILD_ARCH}/Release/DirectXTK.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+
+file(INSTALL
+ ${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)
+file(MAKE_DIRECTORY ${DXTK_TOOL_PATH})
+
+file(INSTALL
+ ${SOURCE_PATH}/MakeSpriteFont/bin/Release/MakeSpriteFont.exe
+ DESTINATION ${DXTK_TOOL_PATH})
+
+file(INSTALL
+ ${SOURCE_PATH}/XWBTool/Bin/Desktop_2015/${BUILD_ARCH}/Release/XWBTool.exe
+ DESTINATION ${DXTK_TOOL_PATH})
+
+file(INSTALL
+ ${SOURCE_PATH}/Inc/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include/DirectXTK
+)
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/directxtk RENAME copyright)
diff --git a/ports/directxtk12/CONTROL b/ports/directxtk12/CONTROL
new file mode 100644
index 000000000..60393a1d9
--- /dev/null
+++ b/ports/directxtk12/CONTROL
@@ -0,0 +1,3 @@
+Source: directxtk12
+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
new file mode 100644
index 000000000..e6f2fb4d8
--- /dev/null
+++ b/ports/directxtk12/portfile.cmake
@@ -0,0 +1,38 @@
+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/DirectXTK12-dec2016)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Microsoft/DirectXTK12/archive/dec2016.tar.gz"
+ FILENAME "DirectXTK12-dec2016.tar.gz"
+ SHA512 7c98fbf1d7ef96807a38d396a87dacdc60fdcd7e461210d246cc424789c4c5c5fb1390db958c1bd1f77da8af756a9eae36813e5da6bbb0ea1432ff4004f1d010
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/DirectXTK_Desktop_2015_Win10.sln
+)
+
+IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ SET(BUILD_ARCH "Win32")
+ELSE()
+ SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
+ENDIF()
+
+file(INSTALL
+ ${SOURCE_PATH}/Bin/Desktop_2015_Win10/${BUILD_ARCH}/Release/DirectXTK12.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+file(INSTALL
+ ${SOURCE_PATH}/Bin/Desktop_2015_Win10/${BUILD_ARCH}/Debug/DirectXTK12.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+file(INSTALL
+ ${SOURCE_PATH}/Inc/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include/DirectXTK12
+)
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/directxtk12 RENAME copyright)
diff --git a/ports/doctest/portfile.cmake b/ports/doctest/portfile.cmake
index c392b2467..fd5f7fe4a 100644
--- a/ports/doctest/portfile.cmake
+++ b/ports/doctest/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/doctest-1.1.0)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/double-conversion/portfile.cmake b/ports/double-conversion/portfile.cmake
index 312946fea..05365d777 100644
--- a/ports/double-conversion/portfile.cmake
+++ b/ports/double-conversion/portfile.cmake
@@ -6,7 +6,14 @@
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
-include(${CMAKE_TRIPLET_FILE})
+# 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/double-conversion-d4d68e4e788bec89d55a6a3e33af674087837c82)
vcpkg_download_distfile(ARCHIVE
@@ -15,28 +22,16 @@ vcpkg_download_distfile(ARCHIVE
SHA512 1406dc22b4ea71e1a2490f96cfed3230e122b97607c83ba106df4e90c7e4bfdcfc136c88741e7f1127237b38b4944d462ec5a4627a71f5ea3fe14afbcc64cd44
)
vcpkg_extract_source_archive(${ARCHIVE})
-
-vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES ${CMAKE_CURRENT_LIST_DIR}/mscv_vers.patch
-)
-
-vcpkg_build_msbuild(
- PROJECT_PATH ${SOURCE_PATH}/msvc/double-conversion.vcxproj
-)
-
-message(STATUS "Installing")
-file(INSTALL
- ${SOURCE_PATH}/msvc/Debug/Win32/double-conversion.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
-)
-file(INSTALL
- ${SOURCE_PATH}/msvc/Release/Win32/double-conversion.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/lib
-)
-
-file(COPY ${SOURCE_PATH}/double-conversion DESTINATION ${CURRENT_PACKAGES_DIR}/include)
-
+vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=True)
+vcpkg_install_cmake()
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
+file(RENAME ${CURRENT_PACKAGES_DIR}/CMake ${CURRENT_PACKAGES_DIR}/share/double-conversion)
+file(READ ${CURRENT_PACKAGES_DIR}/debug/CMake/double-conversionLibraryDepends-debug.cmake DEBUG_MODULE)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${DEBUG_MODULE}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/double-conversion/double-conversionLibraryDepends-debug.cmake "${DEBUG_MODULE}")
+#file(COPY ${SOURCE_PATH}/double-conversion DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/CMake)
vcpkg_copy_pdbs()
message(STATUS "Installing done")
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/dxut/CONTROL b/ports/dxut/CONTROL
new file mode 100644
index 000000000..372a98d72
--- /dev/null
+++ b/ports/dxut/CONTROL
@@ -0,0 +1,3 @@
+Source: dxut
+Version: 11.14-2
+Description: A "GLUT"-like framework for Direct3D 11.x Win32 desktop applications \ No newline at end of file
diff --git a/ports/dxut/portfile.cmake b/ports/dxut/portfile.cmake
new file mode 100644
index 000000000..97dc8b2e3
--- /dev/null
+++ b/ports/dxut/portfile.cmake
@@ -0,0 +1,48 @@
+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/DXUT-sept2016)
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "https://github.com/Microsoft/DXUT/archive/sept2016.tar.gz"
+ FILENAME "DXUT-sept2016.tar.gz"
+ SHA512 190006c194284a1f5d614477896b0469a59ece05dff37477dadbe98808a5c33e274c0c1bb1390f22d1b5e06c9f534f4b50d6002157b2a391e01c2192b8e08869
+)
+vcpkg_extract_source_archive(${ARCHIVE_FILE})
+
+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}/DXUT_2015.sln
+ PLATFORM ${BUILD_ARCH}
+)
+
+file(INSTALL
+ ${SOURCE_PATH}/Core/
+ ${SOURCE_PATH}/Optional/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+ FILES_MATCHING PATTERN "*.h"
+)
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/include/Bin)
+
+file(INSTALL
+ ${SOURCE_PATH}/Core/Bin/Desktop_2015/${BUILD_ARCH}/Release/DXUT.lib
+ ${SOURCE_PATH}/Optional/Bin/Desktop_2015/${BUILD_ARCH}/Release/DXUTOpt.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+
+file(INSTALL
+ ${SOURCE_PATH}/Core/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DXUT.lib
+ ${SOURCE_PATH}/Optional/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DXUTOpt.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+vcpkg_copy_pdbs()
+
+file(INSTALL ${SOURCE_PATH}/MIT.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/dxut RENAME copyright)
+
+message(STATUS "Installing done")
diff --git a/ports/eigen3/CONTROL b/ports/eigen3/CONTROL
index cbbb0bcdd..aa5c5542d 100644
--- a/ports/eigen3/CONTROL
+++ b/ports/eigen3/CONTROL
@@ -1,3 +1,3 @@
Source: eigen3
-Version: 3.2.9
+Version: 3.3.0
Description: C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
diff --git a/ports/eigen3/portfile.cmake b/ports/eigen3/portfile.cmake
index fd62466a5..0a1e88e47 100644
--- a/ports/eigen3/portfile.cmake
+++ b/ports/eigen3/portfile.cmake
@@ -1,21 +1,27 @@
+#header-only library
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/eigen-eigen-dc6cfdf9bcec)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/eigen-eigen-26667be4f70b)
vcpkg_download_distfile(ARCHIVE
- URLS "http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2"
- FILENAME "eigen-3.2.9.tar.bz2"
- SHA512 2734ce70e0b04dc5839715a3cc9b8f90e05b341cfca42a7d586df213a9a14fe5642c76ccf36c16d020ae167c0d6e4d5cc306f0b3bf1f519c58372b0736ca7e63
+ URLS "http://bitbucket.org/eigen/eigen/get/3.3.0.tar.bz2"
+ FILENAME "eigen-3.3.0.tar.bz2"
+ SHA512 a1919accc9fcf64eca17b3e60a78eefeb1a187c261c28b8480604f36cf366cd6323e966d6b948f8a4ce0ae3213a3815bccd34661d1d8fb33315def4304bf163e
)
vcpkg_extract_source_archive(${ARCHIVE})
-file(GLOB_RECURSE GARBAGE ${SOURCE_PATH}/Eigen/CMakeLists.*)
+file(GLOB_RECURSE GARBAGE ${SOURCE_PATH}/Eigen/CMakeLists.* ${SOURCE_PATH}/unsupported/Eigen/CMakeLists.*)
if(GARBAGE)
file(REMOVE ${GARBAGE})
endif()
# Put the licence file where vcpkg expects it
-file(COPY ${SOURCE_PATH}/COPYING.README DESTINATION ${CURRENT_PACKAGES_DIR}/share/eigen3/COPYING.README)
+file(COPY ${SOURCE_PATH}/COPYING.README DESTINATION ${CURRENT_PACKAGES_DIR}/share/eigen3)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/eigen3/COPYING.README ${CURRENT_PACKAGES_DIR}/share/eigen3/copyright)
# Copy the eigen header files
-file(COPY ${SOURCE_PATH}/Eigen/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/Eigen/)
-vcpkg_copy_pdbs()
+file(COPY ${SOURCE_PATH}/Eigen ${SOURCE_PATH}/signature_of_eigen3_matrix_library
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(COPY ${SOURCE_PATH}/unsupported/Eigen
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include/unsupported)
+
+# Copy signature file so tools can locate the eigen headers
+file(COPY DESTINATION ${CURRENT_PACKAGES_DIR}/include)
diff --git a/ports/entityx/CONTROL b/ports/entityx/CONTROL
new file mode 100644
index 000000000..f522fe702
--- /dev/null
+++ b/ports/entityx/CONTROL
@@ -0,0 +1,3 @@
+Source: entityx
+Version: 1.2.0
+Description: EntityX - A fast, type-safe C++ Entity-Component system. <https://github.com/alecthomas/entityx>
diff --git a/ports/entityx/portfile.cmake b/ports/entityx/portfile.cmake
new file mode 100644
index 000000000..d7bcdbe1b
--- /dev/null
+++ b/ports/entityx/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/entityx-1.2.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/alecthomas/entityx/archive/1.2.0.zip"
+ FILENAME "entityx-1.2.0.zip"
+ SHA512 4d7009f0412fbccd7bee72713d53424c3b4fa39da62b87729dd84a710a059db27e65ca27b927285c82af09997caea125d85571824133d9b71b4e3c4eebd9917c
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ SET(SHARED_FLAG ON)
+else()
+ SET(SHARED_FLAG OFF)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ # OPTIONS_RELEASE -DOPTIMIZE=1
+ # OPTIONS_DEBUG -DDEBUGGABLE=1
+ -DENTITYX_BUILD_SHARED=${SHARED_FLAG}
+ -DENTITYX_BUILD_TESTING=false
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/entityx)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/entityx/COPYING ${CURRENT_PACKAGES_DIR}/share/entityx/copyright)
diff --git a/ports/expat/portfile.cmake b/ports/expat/portfile.cmake
index 7f547d091..37180d97b 100644
--- a/ports/expat/portfile.cmake
+++ b/ports/expat/portfile.cmake
@@ -7,16 +7,24 @@ vcpkg_download_distfile(ARCHIVE_FILE
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(EXPAT_LINKAGE ON)
+else()
+ set(EXPAT_LINKAGE OFF)
+endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DBUILD_examples=OFF
-DBUILD_tests=OFF
-DBUILD_tools=OFF
+ -DBUILD_shared=${EXPAT_LINKAGE}
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/expat RENAME copyright)
+
vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/fastlz/CMakeLists.txt b/ports/fastlz/CMakeLists.txt
new file mode 100644
index 000000000..79a7a2a73
--- /dev/null
+++ b/ports/fastlz/CMakeLists.txt
@@ -0,0 +1,16 @@
+CMAKE_MINIMUM_REQUIRED ( VERSION 2.6)
+
+add_library (fastlz fastlz.c)
+
+install (TARGETS fastlz DESTINATION
+ RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+)
+IF (NOT DEFINED SKIP_INSTALL_HEADERS)
+ INSTALL(
+ FILES
+ fastlz.h
+ DESTINATION include
+ )
+ENDIF () \ No newline at end of file
diff --git a/ports/fastlz/CONTROL b/ports/fastlz/CONTROL
new file mode 100644
index 000000000..089ba333e
--- /dev/null
+++ b/ports/fastlz/CONTROL
@@ -0,0 +1,3 @@
+Source: fastlz
+Version: 1.0
+Description: A lightning-fast lossless compression library
diff --git a/ports/fastlz/portfile.cmake b/ports/fastlz/portfile.cmake
new file mode 100644
index 000000000..16a727246
--- /dev/null
+++ b/ports/fastlz/portfile.cmake
@@ -0,0 +1,26 @@
+set(FASTLZ_HASH f1217348a868bdb9ee0730244475aee05ab329c5)
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/FastLZ-${FASTLZ_HASH})
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/ariya/FastLZ/archive/${FASTLZ_HASH}.zip"
+ FILENAME "fastlz-${FASTLZ_HASH}.zip"
+ SHA512 edfefbf4151e7ea6451a6fbb6d464a2a0f48ab50622f936634ec3ea4542ad3e1f075892a422e0fc5a23f2092be4ec890e6f91c4622bcd0d195fed84d4044d5df
+)
+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_WINDOWS_EXPORT_ALL_SYMBOLS=ON
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/fastlz)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/fastlz/LICENSE ${CURRENT_PACKAGES_DIR}/share/fastlz/copyright)
+vcpkg_copy_pdbs()
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 a84adbfc3..ce2bfc4e0 100644
--- a/ports/fmt/CONTROL
+++ b/ports/fmt/CONTROL
@@ -1,3 +1,3 @@
Source: fmt
-Version: 3.0.0-1
+Version: 3.0.1-2
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 4e1c69903..3ea33e779 100644
--- a/ports/fmt/portfile.cmake
+++ b/ports/fmt/portfile.cmake
@@ -1,31 +1,49 @@
+#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/fmt-3.0.0)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/fmt-3.0.1)
vcpkg_download_distfile(ARCHIVE_FILE
- URLS "https://github.com/fmtlib/fmt/archive/3.0.0.tar.gz"
- FILENAME "fmt-3.0.0.tar.gz"
- SHA512 20c9b1ffe8b46cb5d22015122fc698a75ad854709d3de1a1316b6040d86f54bada4e6d7263f2f1fd94cb13ac37ee9447c162c6aec3f3af650455e8a8a9804871
+ URLS "https://github.com/fmtlib/fmt/archive/3.0.1.tar.gz"
+ FILENAME "fmt-3.0.1.tar.gz"
+ SHA512 daf5dfb2fe63eb611983fa248bd2182c6202cf1c4f0fc236f357040fce8e87ad531cdf59090306bb313ea333d546e516f467b385e05094e696d0ca091310aad6
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
+ -DFMT_CMAKE_DIR=share/fmt
-DFMT_TEST=OFF
-DFMT_DOC=OFF
+ -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
)
vcpkg_install_cmake()
file(INSTALL ${SOURCE_PATH}/LICENSE.rst DESTINATION ${CURRENT_PACKAGES_DIR}/share/fmt RENAME copyright)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+ 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)
+
+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(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/fmt/fmt-config-version.cmake ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-config-version.cmake)
-file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/fmt/fmt-config.cmake ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-config.cmake)
-file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/fmt/fmt-targets-release.cmake ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-release.cmake)
-file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/fmt/fmt-targets.cmake ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets.cmake)
-file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/cmake)
-file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/fmt/fmt-targets.cmake ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
+#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}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake "${FMT_DEBUG_MODULE}")
+
+file(READ ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake FMT_DEBUG_MODULE)
+string(REPLACE "lib/fmt.dll" "bin/fmt.dll" FMT_DEBUG_MODULE ${FMT_DEBUG_MODULE})
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake "${FMT_DEBUG_MODULE}")
+file(READ ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-release.cmake FMT_RELEASE_MODULE)
+string(REPLACE "lib/fmt.dll" "bin/fmt.dll" FMT_RELEASE_MODULE ${FMT_RELEASE_MODULE})
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-release.cmake "${FMT_RELEASE_MODULE}")
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
vcpkg_copy_pdbs()
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/freeglut/portfile.cmake b/ports/freeglut/portfile.cmake
index 53bde914e..929d8b9e4 100644
--- a/ports/freeglut/portfile.cmake
+++ b/ports/freeglut/portfile.cmake
@@ -1,5 +1,5 @@
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freeglut-3.0.0)
vcpkg_download_distfile(ARCHIVE
URLS "http://downloads.sourceforge.net/project/freeglut/freeglut/3.0.0/freeglut-3.0.0.tar.gz"
FILENAME "freeglut-3.0.0.tar.gz"
@@ -7,11 +7,21 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(${ARCHIVE})
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(FREEGLUT_STATIC OFF)
+ set(FREEGLUT_DYNAMIC ON)
+else()
+ set(FREEGLUT_STATIC ON)
+ set(FREEGLUT_DYNAMIC OFF)
+endif()
+
vcpkg_configure_cmake(
- SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freeglut-3.0.0
+ SOURCE_PATH ${SOURCE_PATH}
OPTIONS
- -DFREEGLUT_BUILD_STATIC_LIBS=OFF
+ -DFREEGLUT_BUILD_STATIC_LIBS=${FREEGLUT_STATIC}
+ -DFREEGLUT_BUILD_SHARED_LIBS=${FREEGLUT_DYNAMIC}
-DFREEGLUT_BUILD_DEMOS=OFF
+ -DINSTALL_PDB=OFF # Installing pdbs failed on debug static. So, disable it and let vcpkg_copy_pdbs() do it
)
vcpkg_install_cmake()
@@ -19,5 +29,7 @@ vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
-file(COPY ${CURRENT_BUILDTREES_DIR}/src/freeglut-3.0.0/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freeglut)
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freeglut)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/freeglut/COPYING ${CURRENT_PACKAGES_DIR}/share/freeglut/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/freeimage/CMakeLists.txt b/ports/freeimage/CMakeLists.txt
new file mode 100644
index 000000000..80a40b43b
--- /dev/null
+++ b/ports/freeimage/CMakeLists.txt
@@ -0,0 +1,148 @@
+cmake_minimum_required(VERSION 3.4)
+
+include(GNUInstallDirs)
+
+project(FreeImage C CXX)
+
+find_package(zlib REQUIRED)
+find_package(PNG REQUIRED)
+find_package(JPEG REQUIRED)
+find_package(TIFF REQUIRED)
+find_package(OPENJPEG REQUIRED)
+
+# Include some custom Find***.cmake modules
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+
+find_package(WEBP REQUIRED)
+find_package(JXR REQUIRED)
+find_package(LibRaw REQUIRED)
+
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+
+set(REAL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Source)
+
+# Add a debug postfix
+set(CMAKE_DEBUG_POSTFIX "d")
+
+# For now the internal copy of OpenEXR is used (as a private always static library)
+file(GLOB OPENEXR_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/OpenEXR/Half/*.h
+ ${REAL_SOURCE_DIR}/OpenEXR/Iex/*.h
+ ${REAL_SOURCE_DIR}/OpenEXR/IexMath/*.h
+ ${REAL_SOURCE_DIR}/OpenEXR/IlmImf/*.h
+ ${REAL_SOURCE_DIR}/OpenEXR/IlmThread/*.h
+ ${REAL_SOURCE_DIR}/OpenEXR/Imath/*.h
+ ${REAL_SOURCE_DIR}/OpenEXR/*.h)
+
+file(GLOB OPENEXR_SRCS ${REAL_SOURCE_DIR}/OpenEXR/Half/*.cpp
+ ${REAL_SOURCE_DIR}/OpenEXR/Iex/*.cpp
+ ${REAL_SOURCE_DIR}/OpenEXR/IexMath/*.cpp
+ ${REAL_SOURCE_DIR}/OpenEXR/IlmImf/*.cpp
+ ${REAL_SOURCE_DIR}/OpenEXR/IlmThread/*.cpp
+ ${REAL_SOURCE_DIR}/OpenEXR/Imath/*.cpp)
+
+add_library(FreeImage_Private_OpenEXR STATIC ${OPENEXR_PRIVATE_HEADERS} ${OPENEXR_SRCS})
+
+set(FreeImage_Private_OpenEXR_INCLUDE_DIRS ${REAL_SOURCE_DIR}/OpenEXR
+ ${REAL_SOURCE_DIR}/OpenEXR/Half
+ ${REAL_SOURCE_DIR}/OpenEXR/Iex
+ ${REAL_SOURCE_DIR}/OpenEXR/IexMath
+ ${REAL_SOURCE_DIR}/OpenEXR/IlmImf
+ ${REAL_SOURCE_DIR}/OpenEXR/IlmThread
+ ${REAL_SOURCE_DIR}/OpenEXR/Imath)
+
+target_include_directories(FreeImage_Private_OpenEXR PRIVATE ${FreeImage_Private_OpenEXR_INCLUDE_DIRS}
+ ${ZLIB_INCLUDE_DIRS})
+
+# List the public header files
+set(PUBLIC_HEADERS ${REAL_SOURCE_DIR}/FreeImage.h)
+
+# List the private header files
+set(ROOT_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/CacheFile.h
+ ${REAL_SOURCE_DIR}/FreeImageIO.h
+ ${REAL_SOURCE_DIR}/MapIntrospector.h
+ ${REAL_SOURCE_DIR}/Plugin.h
+ ${REAL_SOURCE_DIR}/Quantizers.h
+ ${REAL_SOURCE_DIR}/ToneMapping.h
+ ${REAL_SOURCE_DIR}/Utilities.h
+ ${REAL_SOURCE_DIR}/DeprecationManager/DeprecationMgr.h)
+
+file(GLOB FREEIMAGE_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/FreeImage/*.h)
+file(GLOB FREEIMAGE_TOOLKIT_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/FreeImageToolkit/*.h)
+file(GLOB METADATA_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/Metadata/*.h)
+
+set(PRIVATE_HEADERS ${ROOT_PRIVATE_HEADERS}
+ ${FREEIMAGE_PRIVATE_HEADERS}
+ ${FREEIMAGE_TOOLKIT_PRIVATE_HEADERS}
+ ${METADATA_PRIVATE_HEADERS})
+
+# List the source files
+file(GLOB DEPRECATION_SRCS ${REAL_SOURCE_DIR}/DeprecationManager/*.cpp)
+file(GLOB FREEIMAGE_TOOLKIT_SRCS ${REAL_SOURCE_DIR}/FreeImageToolkit/*.cpp)
+file(GLOB FREEIMAGE_SRCS ${REAL_SOURCE_DIR}/FreeImage/*.cpp)
+file(GLOB METADATA_SRCS ${REAL_SOURCE_DIR}/Metadata/*.cpp)
+
+# The G3 plugin is disabled because it require the private copy of tiff
+list(REMOVE_ITEM FREEIMAGE_SRCS ${REAL_SOURCE_DIR}/FreeImage/PluginG3.cpp)
+
+# The JPEGTransform plugin is disable because it requires a private copy of jpeg
+list(REMOVE_ITEM FREEIMAGE_TOOLKIT_SRCS ${REAL_SOURCE_DIR}/FreeImageToolkit/JPEGTransform.cpp)
+
+
+set(SRCS ${DEPRECATION_SRCS}
+ ${FREEIMAGE_SRCS}
+ ${FREEIMAGE_TOOLKIT_SRCS}
+ ${METADATA_SRCS}
+)
+
+# If FreeImage is used as a static library, FREEIMAGE_LIB
+# needs to be defined (at the C preprocessor level) to correctly
+# define (to nothing instead of _declspec(dllimport) ) the DLL_API macro.
+# For this purpouse we include (depending on the BUILD_SHARED_LIBS )
+# the appropriate FreeImageConfig.h .
+if(${BUILD_SHARED_LIBS})
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FreeImageConfig-dynamic.h ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h)
+else()
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FreeImageConfig-static.h ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h)
+endif()
+list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h)
+
+add_library(FreeImage ${SRCS} ${PRIVATE_HEADERS} ${PUBLIC_HEADERS})
+
+if(${BUILD_SHARED_LIBS})
+ target_compile_definitions(FreeImage PRIVATE -DFREEIMAGE_EXPORTS)
+else()
+ target_compile_definitions(FreeImage PRIVATE -DFREEIMAGE_LIB)
+endif()
+
+target_include_directories(FreeImage PRIVATE ${REAL_SOURCE_DIR}
+ ${ZLIB_INCLUDE_DIRS}
+ ${JPEG_INCLUDE_DIRS}
+ ${TIFF_INCLUDE_DIRS}
+ ${PNG_INCLUDE_DIRS}
+ ${OPENJPEG_INCLUDE_DIRS}
+ ${WEBP_INCLUDE_DIRS}
+ ${JXR_INCLUDE_DIRS}
+ ${LibRaw_INCLUDE_DIRS}
+ ${FreeImage_Private_OpenEXR_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR})
+
+
+target_link_libraries(FreeImage ${ZLIB_LIBRARIES}
+ ${JPEG_LIBRARIES}
+ ${TIFF_LIBRARIES}
+ ${PNG_LIBRARIES}
+ ${OPENJPEG_LIBRARIES}
+ ${WEBP_LIBRARIES}
+ ${JXR_LIBRARIES}
+ ${LibRaw_LIBRARIES}
+ FreeImage_Private_OpenEXR)
+
+target_compile_definitions(FreeImage PRIVATE ${PNG_DEFINITIONS})
+
+install(TARGETS FreeImage
+ COMPONENT runtime
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib)
+
+install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) \ No newline at end of file
diff --git a/ports/freeimage/CONTROL b/ports/freeimage/CONTROL
new file mode 100644
index 000000000..961acc4be
--- /dev/null
+++ b/ports/freeimage/CONTROL
@@ -0,0 +1,4 @@
+Source: freeimage
+Version: 3.17.0
+Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openjpeg, libwebp, libraw, jxrlib
+Description: Support library for graphics image formats
diff --git a/ports/freeimage/FreeImageConfig-dynamic.h b/ports/freeimage/FreeImageConfig-dynamic.h
new file mode 100644
index 000000000..d87b65b4c
--- /dev/null
+++ b/ports/freeimage/FreeImageConfig-dynamic.h
@@ -0,0 +1,5 @@
+#ifndef FREEIMAGE_CONFIG_H
+#define FREEIMAGE_CONFIG_H
+
+
+#endif
diff --git a/ports/freeimage/FreeImageConfig-static.h b/ports/freeimage/FreeImageConfig-static.h
new file mode 100644
index 000000000..ed723490e
--- /dev/null
+++ b/ports/freeimage/FreeImageConfig-static.h
@@ -0,0 +1,6 @@
+#ifndef FREEIMAGE_CONFIG_H
+#define FREEIMAGE_CONFIG_H
+
+#define FREEIMAGE_LIB
+
+#endif
diff --git a/ports/freeimage/cmake/FindJXR.cmake b/ports/freeimage/cmake/FindJXR.cmake
new file mode 100644
index 000000000..7e4a5d45e
--- /dev/null
+++ b/ports/freeimage/cmake/FindJXR.cmake
@@ -0,0 +1,28 @@
+# - Find JXR
+# Find the JXR library
+# This module defines
+# JXR_INCLUDE_DIRS, where to find jxrlib/JXRGlue.h
+# JXR_LIBRARIES, the libraries needed to use JXR
+#
+
+find_path(JXR_INCLUDE_DIRS
+ NAMES JXRGlue.h
+ PATH_SUFFIXES jxrlib
+)
+mark_as_advanced(JXR_INCLUDE_DIRS)
+
+include(SelectLibraryConfigurations)
+
+find_library(JPEGXR_LIBRARY_RELEASE NAMES jpegxr PATH_SUFFIXES lib)
+find_library(JPEGXR_LIBRARY_DEBUG NAMES jpegxrd PATH_SUFFIXES lib)
+select_library_configurations(JPEGXR)
+
+find_library(JXRGLUE_LIBRARY_RELEASE NAMES jxrglue PATH_SUFFIXES lib)
+find_library(JXRGLUE_LIBRARY_DEBUG NAMES jxrglued PATH_SUFFIXES lib)
+select_library_configurations(JXRGLUE)
+
+set(JXR_LIBRARIES ${JPEGXR_LIBRARY} ${JXRGLUE_LIBRARY})
+mark_as_advanced(JXR_LIBRARIES)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(JXR DEFAULT_MSG JXR_INCLUDE_DIRS JXR_LIBRARIES)
diff --git a/ports/freeimage/cmake/FindWEBP.cmake b/ports/freeimage/cmake/FindWEBP.cmake
new file mode 100644
index 000000000..9b8516e15
--- /dev/null
+++ b/ports/freeimage/cmake/FindWEBP.cmake
@@ -0,0 +1,26 @@
+# - 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)
+
+set(WEBP_LIBRARIES ${WEBP_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(WEBP DEFAULT_MSG WEBP_INCLUDE_DIRS WEBP_LIBRARIES)
diff --git a/ports/freeimage/disable-plugins-depending-on-internal-third-party-libraries.patch b/ports/freeimage/disable-plugins-depending-on-internal-third-party-libraries.patch
new file mode 100644
index 000000000..28d0e3a42
--- /dev/null
+++ b/ports/freeimage/disable-plugins-depending-on-internal-third-party-libraries.patch
@@ -0,0 +1,71 @@
+diff --git a/Source/FreeImage.h b/Source/FreeImage.h
+index e2d1c5a..cc66b7d 100644
+--- a/Source/FreeImage.h
++++ b/Source/FreeImage.h
+@@ -410,7 +410,11 @@ FI_ENUM(FREE_IMAGE_FORMAT) {
+ FIF_DDS = 24,
+ FIF_GIF = 25,
+ FIF_HDR = 26,
+- FIF_FAXG3 = 27,
++/* vcpkg: The G3 fax format plugin is deliberately disabled in our build of
++ FreeImage, since it requires usage of the vendored copy of libtiff. */
++#if 0
++ FIF_FAXG3 = 27,
++#endif
+ FIF_SGI = 28,
+ FIF_EXR = 29,
+ FIF_J2K = 30,
+@@ -476,6 +480,9 @@ FI_ENUM(FREE_IMAGE_DITHER) {
+ /** Lossless JPEG transformations
+ Constants used in FreeImage_JPEGTransform
+ */
++/* vcpkg: The JPEGTransform functions are deliberately disabled in our build
++ of FreeImage, since they require usage of the vendored copy of libjpeg. */
++#if 0
+ FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
+ FIJPEG_OP_NONE = 0, //! no transformation
+ FIJPEG_OP_FLIP_H = 1, //! horizontal flip
+@@ -486,6 +493,7 @@ FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
+ FIJPEG_OP_ROTATE_180 = 6, //! 180-degree rotation
+ FIJPEG_OP_ROTATE_270 = 7 //! 270-degree clockwise (or 90 ccw)
+ };
++#endif
+
+ /** Tone mapping operators.
+ Constants used in FreeImage_ToneMapping.
+@@ -1077,6 +1085,9 @@ DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model,
+ // JPEG lossless transformation routines
+ // --------------------------------------------------------------------------
+
++/* vcpkg: The JPEGTransform functions are deliberately disabled in our build
++ of FreeImage, since they require usage of the vendored copy of libjpeg. */
++#if 0
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
+@@ -1085,7 +1096,7 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformFromHandle(FreeImageIO* src_io,
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
+ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
+-
++#endif
+
+ // --------------------------------------------------------------------------
+ // Image manipulation toolkit
+diff --git a/Source/FreeImage/Plugin.cpp b/Source/FreeImage/Plugin.cpp
+index 57ebffd..a93440f 100644
+--- a/Source/FreeImage/Plugin.cpp
++++ b/Source/FreeImage/Plugin.cpp
+@@ -263,7 +263,11 @@ FreeImage_Initialise(BOOL load_local_plugins_only) {
+ s_plugins->AddNode(InitDDS);
+ s_plugins->AddNode(InitGIF);
+ s_plugins->AddNode(InitHDR);
+- s_plugins->AddNode(InitG3);
++/* vcpkg: The G3 fax format plugin is deliberately disabled in our build of FreeImage
+++ since it requires usage of the vendored copy of libtiff. */
++#if 0
++ s_plugins->AddNode(InitG3);
++#endif
+ s_plugins->AddNode(InitSGI);
+ s_plugins->AddNode(InitEXR);
+ s_plugins->AddNode(InitJ2K);
diff --git a/ports/freeimage/portfile.cmake b/ports/freeimage/portfile.cmake
new file mode 100644
index 000000000..3e403f9ea
--- /dev/null
+++ b/ports/freeimage/portfile.cmake
@@ -0,0 +1,56 @@
+include(${CMAKE_TRIPLET_FILE})
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/FreeImage)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://downloads.sourceforge.net/freeimage/FreeImage3170.zip"
+ FILENAME "FreeImage3170.zip"
+ SHA512 703c2626c0bcfe73eb40d720f45745208ca9650a7730759680a2b38ad3f6c719a43008477032bc70b76a95761f7d4b6f901b961359d36b54ace906dd78fb391b
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/FreeImageConfig-static.h DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/FreeImageConfig-dynamic.h DESTINATION ${SOURCE_PATH})
+
+# Copy some useful Find***.cmake modules
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake DESTINATION ${SOURCE_PATH})
+
+# This is not strictly necessary, but to make sure
+# that no "internal" libraries are used by removing them
+# Note that the only "internal" dependency used is OpenEXR
+file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibJPEG)
+file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibPNG)
+file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibTIFF4)
+file(REMOVE_RECURSE ${SOURCE_PATH}/Source/ZLib)
+file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibOpenJPEG)
+file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibJXR)
+file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibWebP)
+file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibRawLite)
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/disable-plugins-depending-on-internal-third-party-libraries.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/use-external-jpeg.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/use-external-jxrlib.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/use-external-libtiff.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/use-external-openjpeg.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/use-external-png-zlib.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/use-external-rawlib.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/use-external-webp.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/use-freeimage-config-include.patch"
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/license-fi.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/freeimage)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/freeimage/license-fi.txt ${CURRENT_PACKAGES_DIR}/share/freeimage/copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/freeimage/use-external-jpeg.patch b/ports/freeimage/use-external-jpeg.patch
new file mode 100644
index 000000000..2df2c9d2d
--- /dev/null
+++ b/ports/freeimage/use-external-jpeg.patch
@@ -0,0 +1,17 @@
+diff --git a/Source/FreeImage/PluginJPEG.cpp b/Source/FreeImage/PluginJPEG.cpp
+index 573989c..aaeefa4 100644
+--- a/Source/FreeImage/PluginJPEG.cpp
++++ b/Source/FreeImage/PluginJPEG.cpp
+@@ -35,9 +35,9 @@ extern "C" {
+ #undef FAR
+ #include <setjmp.h>
+
+-#include "../LibJPEG/jinclude.h"
+-#include "../LibJPEG/jpeglib.h"
+-#include "../LibJPEG/jerror.h"
++#include <stdio.h>
++#include <jpeglib.h>
++#include <jerror.h>
+ }
+
+ #include "FreeImage.h"
diff --git a/ports/freeimage/use-external-jxrlib.patch b/ports/freeimage/use-external-jxrlib.patch
new file mode 100644
index 000000000..d86a18e82
--- /dev/null
+++ b/ports/freeimage/use-external-jxrlib.patch
@@ -0,0 +1,14 @@
+diff --git a/Source/FreeImage/PluginJXR.cpp b/Source/FreeImage/PluginJXR.cpp
+index 0e14e09..8eb9d5d 100644
+--- a/Source/FreeImage/PluginJXR.cpp
++++ b/Source/FreeImage/PluginJXR.cpp
+@@ -23,7 +23,8 @@
+ #include "Utilities.h"
+ #include "../Metadata/FreeImageTag.h"
+
+-#include "../LibJXR/jxrgluelib/JXRGlue.h"
++#define INITGUID
++#include <JXRGlue.h>
+
+ // ==========================================================
+ // Plugin Interface
diff --git a/ports/freeimage/use-external-libtiff.patch b/ports/freeimage/use-external-libtiff.patch
new file mode 100644
index 000000000..f2ddd9ba6
--- /dev/null
+++ b/ports/freeimage/use-external-libtiff.patch
@@ -0,0 +1,174 @@
+diff --git a/Source/FreeImage/PluginTIFF.cpp b/Source/FreeImage/PluginTIFF.cpp
+index 1b45453..562fdd7 100644
+--- a/Source/FreeImage/PluginTIFF.cpp
++++ b/Source/FreeImage/PluginTIFF.cpp
+@@ -37,7 +37,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibTIFF4/tiffiop.h"
++#include <tiffio.h>
+ #include "../Metadata/FreeImageTag.h"
+ #include "../OpenEXR/Half/half.h"
+
+diff --git a/Source/Metadata/XTIFF.cpp b/Source/Metadata/XTIFF.cpp
+index d5be902..8dbcd5d 100644
+--- a/Source/Metadata/XTIFF.cpp
++++ b/Source/Metadata/XTIFF.cpp
+@@ -29,7 +29,7 @@
+ #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+ #endif
+
+-#include "../LibTIFF4/tiffiop.h"
++#include <tiffio.h>
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+@@ -40,6 +40,43 @@
+ // Extended TIFF Directory GEO Tag Support
+ // ----------------------------------------------------------
+
++// vcpkg: function imported from libtiff/tif_dirinfo.c, in which it is not exported
++/*
++ * Return size of TIFFDataType in bytes.
++ *
++ * XXX: We need a separate function to determine the space needed
++ * to store the value. For TIFF_RATIONAL values TIFFDataWidth() returns 8,
++ * but we use 4-byte float to represent rationals.
++ */
++int
++FreeImage_TIFFDataSize(TIFFDataType type)
++{
++ switch (type)
++ {
++ case TIFF_BYTE:
++ case TIFF_SBYTE:
++ case TIFF_ASCII:
++ case TIFF_UNDEFINED:
++ return 1;
++ case TIFF_SHORT:
++ case TIFF_SSHORT:
++ return 2;
++ case TIFF_LONG:
++ case TIFF_SLONG:
++ case TIFF_FLOAT:
++ case TIFF_IFD:
++ case TIFF_RATIONAL:
++ case TIFF_SRATIONAL:
++ return 4;
++ case TIFF_DOUBLE:
++ case TIFF_LONG8:
++ case TIFF_SLONG8:
++ case TIFF_IFD8:
++ return 8;
++ default:
++ return 0;
++ }
++}
+ /**
+ Tiff info structure.
+ Entry format:
+@@ -224,6 +261,33 @@ tiff_write_geotiff_profile(TIFF *tif, FIBITMAP *dib) {
+ // TIFF EXIF tag reading & writing
+ // ----------------------------------------------------------
+
++static uint32 exif_tag_ids[] = {
++ EXIFTAG_EXPOSURETIME, EXIFTAG_FNUMBER, EXIFTAG_EXPOSUREPROGRAM,
++ EXIFTAG_SPECTRALSENSITIVITY, EXIFTAG_ISOSPEEDRATINGS, EXIFTAG_OECF,
++ EXIFTAG_EXIFVERSION, EXIFTAG_DATETIMEORIGINAL, EXIFTAG_DATETIMEDIGITIZED,
++ EXIFTAG_COMPONENTSCONFIGURATION, EXIFTAG_COMPRESSEDBITSPERPIXEL,
++ EXIFTAG_SHUTTERSPEEDVALUE, EXIFTAG_APERTUREVALUE,
++ EXIFTAG_BRIGHTNESSVALUE, EXIFTAG_EXPOSUREBIASVALUE,
++ EXIFTAG_MAXAPERTUREVALUE, EXIFTAG_SUBJECTDISTANCE, EXIFTAG_METERINGMODE,
++ EXIFTAG_LIGHTSOURCE, EXIFTAG_FLASH, EXIFTAG_FOCALLENGTH,
++ EXIFTAG_SUBJECTAREA, EXIFTAG_MAKERNOTE, EXIFTAG_USERCOMMENT,
++ EXIFTAG_SUBSECTIME, EXIFTAG_SUBSECTIMEORIGINAL,
++ EXIFTAG_SUBSECTIMEDIGITIZED, EXIFTAG_FLASHPIXVERSION, EXIFTAG_COLORSPACE,
++ EXIFTAG_PIXELXDIMENSION, EXIFTAG_PIXELYDIMENSION,
++ EXIFTAG_RELATEDSOUNDFILE, EXIFTAG_FLASHENERGY,
++ EXIFTAG_SPATIALFREQUENCYRESPONSE, EXIFTAG_FOCALPLANEXRESOLUTION,
++ EXIFTAG_FOCALPLANEYRESOLUTION, EXIFTAG_FOCALPLANERESOLUTIONUNIT,
++ EXIFTAG_SUBJECTLOCATION, EXIFTAG_EXPOSUREINDEX, EXIFTAG_SENSINGMETHOD,
++ EXIFTAG_FILESOURCE, EXIFTAG_SCENETYPE, EXIFTAG_CFAPATTERN,
++ EXIFTAG_CUSTOMRENDERED, EXIFTAG_EXPOSUREMODE, EXIFTAG_WHITEBALANCE,
++ EXIFTAG_DIGITALZOOMRATIO, EXIFTAG_FOCALLENGTHIN35MMFILM,
++ EXIFTAG_SCENECAPTURETYPE, EXIFTAG_GAINCONTROL, EXIFTAG_CONTRAST,
++ EXIFTAG_SATURATION, EXIFTAG_SHARPNESS, EXIFTAG_DEVICESETTINGDESCRIPTION,
++ EXIFTAG_SUBJECTDISTANCERANGE, EXIFTAG_GAINCONTROL, EXIFTAG_GAINCONTROL,
++ EXIFTAG_IMAGEUNIQUEID
++};
++static int nExifTags = sizeof(exif_tag_ids) / sizeof(exif_tag_ids[0]);
++
+ /**
+ Read a single Exif tag
+
+@@ -575,43 +639,10 @@ tiff_read_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) {
+
+ // loop over all Core Directory Tags
+ // ### uses private data, but there is no other way
++ // -> vcpkg: Best we can do without private headers is to hard-code a list of known EXIF tags and read those
+ if(md_model == TagLib::EXIF_MAIN) {
+- const TIFFDirectory *td = &tif->tif_dir;
+-
+- uint32 lastTag = 0; //<- used to prevent reading some tags twice (as stored in tif_fieldinfo)
+-
+- for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) {
+- const TIFFField *fld = tif->tif_fields[fi];
+-
+- const uint32 tag_id = TIFFFieldTag(fld);
+-
+- if(tag_id == lastTag) {
+- continue;
+- }
+-
+- // test if tag value is set
+- // (lifted directly from LibTiff _TIFFWriteDirectory)
+-
+- if( fld->field_bit == FIELD_CUSTOM ) {
+- int is_set = FALSE;
+-
+- for(int ci = 0; ci < td->td_customValueCount; ci++ ) {
+- is_set |= (td->td_customValues[ci].info == fld);
+- }
+-
+- if( !is_set ) {
+- continue;
+- }
+-
+- } else if(!TIFFFieldSet(tif, fld->field_bit)) {
+- continue;
+- }
+-
+- // process *all* other tags (some will be ignored)
+-
+- tiff_read_exif_tag(tif, tag_id, dib, md_model);
+-
+- lastTag = tag_id;
++ for (int i = 0; i < nExifTags; ++i) {
++ tiff_read_exif_tag(tif, exif_tag_ids[i], dib, md_model);
+ }
+
+ }
+@@ -723,10 +754,9 @@ tiff_write_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) {
+
+ TagLib& tag_lib = TagLib::instance();
+
+- for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) {
+- const TIFFField *fld = tif->tif_fields[fi];
+-
+- const uint32 tag_id = TIFFFieldTag(fld);
++ for (int fi = 0, nfi = nExifTags; nfi > 0; nfi--, fi++) {
++ const uint32 tag_id = exif_tag_ids[fi];
++ const TIFFField *fld = TIFFFieldWithTag(tif, tag_id);
+
+ if(skip_write_field(tif, tag_id)) {
+ // skip tags that are already handled by the LibTIFF writing process
+@@ -749,7 +779,7 @@ tiff_write_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) {
+ continue;
+ }
+ // type of storage may differ (e.g. rationnal array vs float array type)
+- if((unsigned)_TIFFDataSize(tif_tag_type) != FreeImage_TagDataWidth(tag_type)) {
++ if((unsigned)FreeImage_TIFFDataSize(tif_tag_type) != FreeImage_TagDataWidth(tag_type)) {
+ // skip tag or _TIFFmemcpy will fail
+ continue;
+ }
diff --git a/ports/freeimage/use-external-openjpeg.patch b/ports/freeimage/use-external-openjpeg.patch
new file mode 100644
index 000000000..fa4f8e7b6
--- /dev/null
+++ b/ports/freeimage/use-external-openjpeg.patch
@@ -0,0 +1,39 @@
+diff --git a/Source/FreeImage/J2KHelper.cpp b/Source/FreeImage/J2KHelper.cpp
+index 1776c3b..538f1c5 100644
+--- a/Source/FreeImage/J2KHelper.cpp
++++ b/Source/FreeImage/J2KHelper.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+ #include "J2KHelper.h"
+
+ // --------------------------------------------------------------------------
+diff --git a/Source/FreeImage/PluginJ2K.cpp b/Source/FreeImage/PluginJ2K.cpp
+index b8bcfc8..621a903 100644
+--- a/Source/FreeImage/PluginJ2K.cpp
++++ b/Source/FreeImage/PluginJ2K.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+ #include "J2KHelper.h"
+
+ // ==========================================================
+diff --git a/Source/FreeImage/PluginJP2.cpp b/Source/FreeImage/PluginJP2.cpp
+index 742fe2c..c57f626 100644
+--- a/Source/FreeImage/PluginJP2.cpp
++++ b/Source/FreeImage/PluginJP2.cpp
+@@ -21,7 +21,7 @@
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../LibOpenJPEG/openjpeg.h"
++#include <openjpeg.h>
+ #include "J2KHelper.h"
+
+ // ==========================================================
diff --git a/ports/freeimage/use-external-png-zlib.patch b/ports/freeimage/use-external-png-zlib.patch
new file mode 100644
index 000000000..fc7837e43
--- /dev/null
+++ b/ports/freeimage/use-external-png-zlib.patch
@@ -0,0 +1,40 @@
+diff --git a/Source/FreeImage/PluginPNG.cpp b/Source/FreeImage/PluginPNG.cpp
+index ba2ef17..c3c5cd6 100644
+--- a/Source/FreeImage/PluginPNG.cpp
++++ b/Source/FreeImage/PluginPNG.cpp
+@@ -40,8 +40,8 @@
+
+ // ----------------------------------------------------------
+
+-#include "../ZLib/zlib.h"
+-#include "../LibPNG/png.h"
++#include <zlib.h>
++#include <png.h>
+
+ // ----------------------------------------------------------
+
+diff --git a/Source/FreeImage/ZLibInterface.cpp b/Source/FreeImage/ZLibInterface.cpp
+index 3ab6d32..725618b 100644
+--- a/Source/FreeImage/ZLibInterface.cpp
++++ b/Source/FreeImage/ZLibInterface.cpp
+@@ -19,10 +19,9 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../ZLib/zlib.h"
++#include <zlib.h>
+ #include "FreeImage.h"
+ #include "Utilities.h"
+-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
+
+ /**
+ Compresses a source buffer into a target buffer, using the ZLib library.
+@@ -115,7 +114,7 @@ FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_s
+ return 0;
+ case Z_OK: {
+ // patch header, setup crc and length (stolen from mod_trace_output)
+- BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code
++ BYTE *p = target + 8; *p++ = 2; *p = 0x03; // xflags, os_code
+ crc = crc32(crc, source, source_size);
+ memcpy(target + 4 + dest_len, &crc, 4);
+ memcpy(target + 8 + dest_len, &source_size, 4);
diff --git a/ports/freeimage/use-external-rawlib.patch b/ports/freeimage/use-external-rawlib.patch
new file mode 100644
index 000000000..6afa0bffa
--- /dev/null
+++ b/ports/freeimage/use-external-rawlib.patch
@@ -0,0 +1,13 @@
+diff --git a/Source/FreeImage/PluginRAW.cpp b/Source/FreeImage/PluginRAW.cpp
+index e9bd5bf..c7f8758 100644
+--- a/Source/FreeImage/PluginRAW.cpp
++++ b/Source/FreeImage/PluginRAW.cpp
+@@ -19,7 +19,7 @@
+ // Use at your own risk!
+ // ==========================================================
+
+-#include "../LibRawLite/libraw/libraw.h"
++#include <libraw/libraw.h>
+
+ #include "FreeImage.h"
+ #include "Utilities.h"
diff --git a/ports/freeimage/use-external-webp.patch b/ports/freeimage/use-external-webp.patch
new file mode 100644
index 000000000..ae6328431
--- /dev/null
+++ b/ports/freeimage/use-external-webp.patch
@@ -0,0 +1,18 @@
+diff --git a/Source/FreeImage/PluginWebP.cpp b/Source/FreeImage/PluginWebP.cpp
+index 9fb0b69..c401447 100644
+--- a/Source/FreeImage/PluginWebP.cpp
++++ b/Source/FreeImage/PluginWebP.cpp
+@@ -24,10 +24,9 @@
+
+ #include "../Metadata/FreeImageTag.h"
+
+-#include "../LibWebP/src/webp/decode.h"
+-#include "../LibWebP/src/webp/encode.h"
+-#include "../LibWebP/src/enc/vp8enci.h"
+-#include "../LibWebP/src/webp/mux.h"
++#include <webp/decode.h>
++#include <webp/encode.h>
++#include <webp/mux.h>
+
+ // ==========================================================
+ // Plugin Interface
diff --git a/ports/freeimage/use-freeimage-config-include.patch b/ports/freeimage/use-freeimage-config-include.patch
new file mode 100644
index 000000000..4927aff5b
--- /dev/null
+++ b/ports/freeimage/use-freeimage-config-include.patch
@@ -0,0 +1,16 @@
+diff --git a/Source/FreeImage.h b/Source/FreeImage.h
+index cc66b7d..cc66812 100644
+--- a/Source/FreeImage.h
++++ b/Source/FreeImage.h
+@@ -32,6 +32,11 @@
+ #define FREEIMAGE_MINOR_VERSION 17
+ #define FREEIMAGE_RELEASE_SERIAL 0
+
++// vcpkg specific includes --------------------------------------------------
++// Include FreeImageConfig.h to define FREEIMAGE_LIB in static builds,
++// or do not define it in dynamic builds
++#include "FreeImageConfig.h"
++
+ // Compiler options ---------------------------------------------------------
+
+ #include <wchar.h> // needed for UNICODE functions
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 39def18fc..866033e3c 100644
--- a/ports/freetype/CONTROL
+++ b/ports/freetype/CONTROL
@@ -1,3 +1,4 @@
Source: freetype
-Version: 2.6.3-1
+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 f0d5728f6..360345f1c 100644
--- a/ports/freetype/portfile.cmake
+++ b/ports/freetype/portfile.cmake
@@ -11,13 +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
- -DBUILD_SHARED_LIBS=ON
-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/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch b/ports/gdal/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch
new file mode 100644
index 000000000..e29cc5b8e
--- /dev/null
+++ b/ports/gdal/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch
@@ -0,0 +1,70 @@
+From 823171a129401d226ac4821fb997ce585045170c Mon Sep 17 00:00:00 2001
+From: Manuel Massing <m.massing@warped-space.de>
+Date: Wed, 23 Nov 2016 23:50:12 +0100
+Subject: [PATCH] Add support for MSVC1900 (backported from GDAL2)
+
+---
+ nmake.opt | 6 ++++++
+ port/cpl_config.h.vc | 8 +++++---
+ 2 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/nmake.opt b/nmake.opt
+index 8900135..4d1c4fa 100644
+--- a/nmake.opt
++++ b/nmake.opt
+@@ -31,6 +31,7 @@
+ # Check version of Visual C++ compiler:
+ # nmake -f makefile.vc MSVC_VER=xxxx
+ # where xxxx is one of following:
++# 1900 = 14.0(2015)
+ # 1800 = 12.0(2013)
+ # 1700 = 11.0(2012)
+ # 1600 = 10.0(2010)
+@@ -627,8 +628,13 @@ GDALLIB = $(GDAL_ROOT)/gdal.lib
+ !ENDIF
+
+ !IFDEF ODBC_SUPPORTED
++!IF $(MSVC_VER) >= 1900
++# legacy_stdio_definitions.lib : https://connect.microsoft.com/VisualStudio/feedback/details/1134693/vs-2015-ctp-5-c-vsnwprintf-s-and-other-functions-are-not-exported-in-appcrt140-dll-breaking-linkage-of-static-libraries
++ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib
++!ELSE
+ ODBCLIB = odbc32.lib odbccp32.lib user32.lib
+ !ENDIF
++!ENDIF
+
+ !IF DEFINED(MRSID_DIR) || DEFINED(MRSID_RASTER_DIR) || DEFINED(MRSID_LIDAR_DIR)
+ !IF "$(MRSID_PLUGIN)" != "YES"
+diff --git a/port/cpl_config.h.vc b/port/cpl_config.h.vc
+index bfff8f6..fe7b82a 100644
+--- a/port/cpl_config.h.vc
++++ b/port/cpl_config.h.vc
+@@ -1,5 +1,5 @@
+
+-/* We define this here in general so that a VC++ build will publically
++/* We define this here in general so that a VC++ build will publicly
+ declare STDCALL interfaces even if an application is built against it
+ using MinGW */
+
+@@ -17,7 +17,9 @@
+ #if defined(_MSC_VER) && (_MSC_VER < 1500)
+ # define vsnprintf _vsnprintf
+ #endif
+-#define snprintf _snprintf
++#if defined(_MSC_VER) && (_MSC_VER < 1900)
++# define snprintf _snprintf
++#endif
+
+ #define HAVE_GETCWD 1
+ /* gmt_notunix.h from GMT project also redefines getcwd. See #3138 */
+@@ -86,7 +88,7 @@
+ /* Set the native cpu bit order */
+ #define HOST_FILLORDER FILLORDER_LSB2MSB
+
+-/* Define as 0 or 1 according to the floating point format suported by the
++/* Define as 0 or 1 according to the floating point format supported by the
+ machine */
+ #define HAVE_IEEEFP 1
+
+--
+2.10.1.windows.1
+
diff --git a/ports/gdal/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch b/ports/gdal/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch
new file mode 100644
index 000000000..0ffcac5fb
--- /dev/null
+++ b/ports/gdal/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch
@@ -0,0 +1,50 @@
+From b25c3dc49ca1bcf9a789cf64c9fa8694e35127f0 Mon Sep 17 00:00:00 2001
+From: Manuel Massing <m.massing@warped-space.de>
+Date: Sun, 27 Nov 2016 09:57:04 +0100
+Subject: [PATCH 2/2] Add variable CXX_CRT_FLAGS to allow for selection of C
+ runtime linkage in nmake build.
+
+---
+ nmake.opt | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/nmake.opt b/nmake.opt
+index 4d1c4fa..47c2df8 100644
+--- a/nmake.opt
++++ b/nmake.opt
+@@ -125,18 +125,28 @@ CXX_PDB_FLAGS=/Zi /Fd$(GDAL_ROOT)\gdal$(VERSION).pdb
+ CXX_PDB_FLAGS=
+ !ENDIF
+
++# Flags to choose CRT variant to link against (e.g. static: /MT, /MTd, dynamic: /MD, /MDd)
++# Ensure MRSID_CONFIG in mrsid/nmake.opt is set appropriately as well
++!IFNDEF CXX_CRT_FLAGS
++!IFNDEF DEBUG
++CXX_CRT_FLAGS=/MD
++!ELSE
++CXX_CRT_FLAGS=/MDd
++!ENDIF
++!ENDIF
++
+ !IFNDEF OPTFLAGS
+ !IF $(MSVC_VER) >= 1400
+ !IFNDEF DEBUG
+-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MD /EHsc /Ox /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
++OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /Ox /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
+ !ELSE
+-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MD /EHsc /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
++OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
+ !ENDIF
+ !ELSE
+ !IFNDEF DEBUG
+-OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /Ox /DNDEBUG
++OPTFLAGS= $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /GR /Ox /DNDEBUG
+ !ELSE
+-OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /DDEBUG
++OPTFLAGS= $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /GR /DDEBUG
+ !ENDIF
+ !ENDIF #MSVC_VER
+ !ENDIF # OPTFLAGS
+--
+2.10.1.windows.1
+
diff --git a/ports/gdal/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch b/ports/gdal/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch
new file mode 100644
index 000000000..1065a2982
--- /dev/null
+++ b/ports/gdal/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch
@@ -0,0 +1,26 @@
+From 9da0cb6eed442ebf3eea232cd85e26c155c963ef Mon Sep 17 00:00:00 2001
+From: Manuel Massing <m.massing@warped-space.de>
+Date: Tue, 29 Nov 2016 12:43:58 +0100
+Subject: [PATCH 3/4] - Ensures inclusion of PDB in release dll if so requested
+
+---
+ gdal/nmake.opt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/nmake.opt b/nmake.opt
+index 47c2df8..4844d22 100644
+--- a/nmake.opt
++++ b/nmake.opt
+@@ -174,6 +174,9 @@ SOFTWARNFLAGS= /wd4244 /wd4702 /wd4701 /wd4013 /wd4706 /wd4057 /wd4210 /wd4305
+ # Linker debug options
+ !IFDEF DEBUG
+ LDEBUG= /debug
++!ELSEIFDEF WITH_PDB
++# Ensures that PDB is included in release DLL if so requested
++LDEBUG= /debug /opt:ref /opt:icf
+ !ENDIF
+
+ # Uncomment the following if you are building for 64-bit windows
+--
+2.10.1.windows.1
+
diff --git a/ports/gdal/CONTROL b/ports/gdal/CONTROL
new file mode 100644
index 000000000..16b1caa7e
--- /dev/null
+++ b/ports/gdal/CONTROL
@@ -0,0 +1,4 @@
+Source: gdal
+Version: 1.11.3-1
+Description: The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data.
+Build-Depends: proj, libpng
diff --git a/ports/gdal/portfile.cmake b/ports/gdal/portfile.cmake
new file mode 100644
index 000000000..9bf301664
--- /dev/null
+++ b/ports/gdal/portfile.cmake
@@ -0,0 +1,143 @@
+if (TRIPLET_SYSTEM_ARCH MATCHES "arm")
+ message(FATAL_ERROR " ARM is currently not supported.")
+endif()
+
+include(vcpkg_common_functions)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://download.osgeo.org/gdal/1.11.3/gdal1113.zip"
+ FILENAME "gdal1113.zip"
+ SHA512 42feb98a54019d3b6ac54f598f299a57e117db500c662d39faa9d5f5090f03c1b8d7680242e1abd8035738edc4fc3197ae118a0ce50733691a76a5cf377bcd46
+)
+
+# Extract source into archictecture specific directory, because GDALs' nmake based build currently does not
+# support out of source builds.
+set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/gdal-1.11.3)
+set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/gdal-1.11.3)
+
+foreach(BUILD_TYPE debug release)
+ vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE})
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-1.11.3
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch
+ ${CMAKE_CURRENT_LIST_DIR}/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch
+ ${CMAKE_CURRENT_LIST_DIR}/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch
+ )
+endforeach()
+
+find_program(NMAKE nmake REQUIRED)
+
+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
+)
+
+if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ list(APPEND NMAKE_OPTIONS WIN64=YES)
+endif()
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ list(APPEND NMAKE_OPTIONS PROJ_FLAGS=-DPROJ_STATIC)
+else()
+ # Enables PDBs for release and debug builds
+ list(APPEND NMAKE_OPTIONS WITH_PDB=1)
+endif()
+
+if (VCPKG_CRT_LINKAGE STREQUAL static)
+ set(LINKAGE_FLAGS "/MT")
+else()
+ set(LINKAGE_FLAGS "/MD")
+endif()
+
+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
+)
+################
+# Release build
+################
+message(STATUS "Building ${TARGET_TRIPLET}-rel")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} -f makefile.vc
+ "${NMAKE_OPTIONS_REL}"
+ WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
+ LOGNAME nmake-build-${TARGET_TRIPLET}-release
+)
+message(STATUS "Building ${TARGET_TRIPLET}-rel done")
+
+################
+# Debug build
+################
+message(STATUS "Building ${TARGET_TRIPLET}-dbg")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /G -f makefile.vc
+ "${NMAKE_OPTIONS_DBG}"
+ WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
+ LOGNAME nmake-build-${TARGET_TRIPLET}-debug
+)
+message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
+
+message(STATUS "Packaging ${TARGET_TRIPLET}")
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/gdal/html)
+
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} -f makefile.vc
+ "${NMAKE_OPTIONS_REL}"
+ "install"
+ "devinstall"
+ WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
+ LOGNAME nmake-install-${TARGET_TRIPLET}
+)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/gdal_i.lib)
+ file(COPY ${SOURCE_PATH_DEBUG}/gdal.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+ file(COPY ${SOURCE_PATH_RELEASE}/gdal.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gdal.lib ${CURRENT_PACKAGES_DIR}/debug/lib/gdald.lib)
+else()
+ file(GLOB EXE_FILES ${CURRENT_PACKAGES_DIR}/bin/*.exe)
+ file(REMOVE ${EXE_FILES} ${CURRENT_PACKAGES_DIR}/lib/gdal.lib)
+ file(COPY ${SOURCE_PATH_DEBUG}/gdal111.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(COPY ${SOURCE_PATH_DEBUG}/gdal_i.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gdal_i.lib ${CURRENT_PACKAGES_DIR}/lib/gdal.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gdal_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/gdald.lib)
+endif()
+
+# Copy over PDBs
+vcpkg_copy_pdbs()
+
+# Handle copyright
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/gdal/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/gdal/copyright)
+
+message(STATUS "Packaging ${TARGET_TRIPLET} done")
diff --git a/ports/geos/CONTROL b/ports/geos/CONTROL
new file mode 100644
index 000000000..c0ec7b134
--- /dev/null
+++ b/ports/geos/CONTROL
@@ -0,0 +1,3 @@
+Source: geos
+Version: 3.5.0
+Description: Geometry Engine Open Source
diff --git a/ports/geos/portfile.cmake b/ports/geos/portfile.cmake
new file mode 100644
index 000000000..7cd50db58
--- /dev/null
+++ b/ports/geos/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/3.5)
+#downloading 3.5 from their SVN repo and not the release tarball
+#because the 3.5 release did not build on windows, and fixes were backported
+#without generating a new release tarball (I don't think very many GIS people use win)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://trac.osgeo.org/geos/browser/branches/3.5?rev=4261&format=zip"
+ FILENAME "geos-3.5.0.zip"
+ SHA512 3b91e8992f60b99a3f01069d955b71bce425ae5e5c599252fa26a337494e1a5a8ea796be124766d054710d6c03806f56dc1c63539b4660e2bb894d7ef779d4b9
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+#we need to do this because GEOS deploy process is totally broken for cmake
+#file(DOWNLOAD http://svn.osgeo.org/geos/tags/3.5.0/cmake/modules/GenerateSourceGroups.cmake
+# ${SOURCE_PATH}/cmake/modules/GenerateSourceGroups.cmake)
+file(WRITE ${SOURCE_PATH}/geos_svn_revision.h "#define GEOS_SVN_REVISION 4261")
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DGEOS_ENABLE_TESTS=False
+ -DBUILD_TESTING=False
+)
+
+vcpkg_build_cmake()
+vcpkg_install_cmake()
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/geos)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/geos/COPYING ${CURRENT_PACKAGES_DIR}/share/geos/copyright)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libgeos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libgeos.lib)
+else()
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geos.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos_c.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geos_c.lib)
+
+endif()
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/gettext/0001-Fix-macro-definitions.patch b/ports/gettext/0001-Fix-macro-definitions.patch
new file mode 100644
index 000000000..506c43dba
--- /dev/null
+++ b/ports/gettext/0001-Fix-macro-definitions.patch
@@ -0,0 +1,45 @@
+From df8121a8822245df0b191b7d3b1654611fdac1b2 Mon Sep 17 00:00:00 2001
+From: vlj <vljn.ovi@gmail.com>
+Date: Tue, 1 Nov 2016 23:09:06 +0100
+Subject: [PATCH] Fix macro definitions.
+
+---
+ gettext-0.19/gettext-runtime/intl/printf-parse.c | 4 +++-
+ gettext-0.19/gettext-runtime/intl/xsize.h | 6 ++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/gettext-0.19/gettext-runtime/intl/printf-parse.c b/gettext-0.19/gettext-runtime/intl/printf-parse.c
+index 0e2d2c7..8cedfc6 100644
+--- a/gettext-0.19/gettext-runtime/intl/printf-parse.c
++++ b/gettext-0.19/gettext-runtime/intl/printf-parse.c
+@@ -48,7 +48,9 @@
+ #include <stddef.h>
+
+ /* Get intmax_t. */
+-#if defined IN_LIBINTL || defined IN_LIBASPRINTF
++#if _MSC_VER
++# define intmax_t long int
++#elif defined IN_LIBINTL || defined IN_LIBASPRINTF
+ # if HAVE_STDINT_H_WITH_UINTMAX
+ # include <stdint.h>
+ # endif
+diff --git a/gettext-0.19/gettext-runtime/intl/xsize.h b/gettext-0.19/gettext-runtime/intl/xsize.h
+index c256665..d09e79f 100644
+--- a/gettext-0.19/gettext-runtime/intl/xsize.h
++++ b/gettext-0.19/gettext-runtime/intl/xsize.h
+@@ -27,6 +27,12 @@
+ # include <stdint.h>
+ #endif
+
++#ifdef _WIN32
++# define _GL_INLINE_HEADER_BEGIN
++# define _GL_INLINE_HEADER_END
++# define _GL_INLINE static inline
++#endif
++
+ #ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+ #endif
+--
+2.10.1.windows.1
+
diff --git a/ports/gettext/CMakeLists.txt b/ports/gettext/CMakeLists.txt
new file mode 100644
index 000000000..410ff9c0a
--- /dev/null
+++ b/ports/gettext/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(gettext-runtime) \ No newline at end of file
diff --git a/ports/gettext/CMakeLists_libintl.txt b/ports/gettext/CMakeLists_libintl.txt
new file mode 100644
index 000000000..f01cf632c
--- /dev/null
+++ b/ports/gettext/CMakeLists_libintl.txt
@@ -0,0 +1,54 @@
+cmake_policy(SET CMP0005 OLD)
+
+project(libintl)
+
+include_directories(".")
+
+FILE(GLOB SOURCES
+"intl/bindtextdom.c"
+"intl/dcgettext.c"
+"intl/dcigettext.c"
+"intl/dcngettext.c"
+"intl/dgettext.c"
+"intl/dngettext.c"
+"intl/explodename.c"
+"intl/finddomain.c"
+"intl/gettext.c"
+"intl/hash-string.c"
+"intl/intl-compat.c"
+"intl/l10nflist.c"
+"intl/langprefs.c"
+"intl/loadmsgcat.c"
+"intl/localcharset.c"
+"intl/localealias.c"
+"intl/localename.c"
+"intl/lock.c"
+"intl/log.c"
+"intl/ngettext.c"
+"intl/osdep.c"
+"intl/plural-exp.c"
+"intl/plural.c"
+"intl/printf.c"
+"intl/relocatable.c"
+"intl/textdomain.c"
+"intl/version.c"
+)
+
+set(LOCALDIR "c:\\gettext")
+
+add_definitions(-DLOCALEDIR=\\\"${LOCALDIR}\\\")
+add_definitions(-DLOCALE_ALIAS_PATH=\\\"${LOCALDIR}\\\")
+add_definitions(-DLIBDIR=\\\"${LOCALDIR}\\\")
+add_definitions(-DINSTALLDIR=\\\"${LOCALDIR}\\\")
+add_definitions("-DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL -DENABLE_RELOCATABLE=1 -DIN_LIBRARY")
+
+add_definitions("-DNO_XMALLOC -Dset_relocation_prefix=libintl_set_relocation_prefix -Drelocate=libintl_relocate -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H -D_CRT_SECURE_NO_WARNINGS")
+
+add_library(libintl ${SOURCES})
+
+install(TARGETS libintl
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION bin
+ ARCHIVE DESTINATION lib
+)
+
diff --git a/ports/gettext/CONTROL b/ports/gettext/CONTROL
new file mode 100644
index 000000000..3ab837168
--- /dev/null
+++ b/ports/gettext/CONTROL
@@ -0,0 +1,3 @@
+Source: gettext
+Version: 0.19
+Description: The GNU gettext utilities are a set of tools that provides a framework to help other GNU packages produce multi-lingual messages
diff --git a/ports/gettext/config.h b/ports/gettext/config.h
new file mode 100644
index 000000000..cde9f23b4
--- /dev/null
+++ b/ports/gettext/config.h
@@ -0,0 +1,666 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to the number of bits in type 'ptrdiff_t'. */
+#define BITSIZEOF_PTRDIFF_T sizeof(ptrdiff_t)
+
+/* Define to the number of bits in type 'sig_atomic_t'. */
+#define BITSIZEOF_SIG_ATOMIC_T 32
+
+/* Define to the number of bits in type 'size_t'. */
+#define BITSIZEOF_SIZE_T sizeof(size_t)
+
+/* Define to the number of bits in type 'wchar_t'. */
+#define BITSIZEOF_WCHAR_T 16
+
+/* Define to the number of bits in type 'wint_t'. */
+#define BITSIZEOF_WINT_T 16
+
+/* 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 if mono is the preferred C# implementation. */
+/* #undef CSHARP_CHOICE_MONO */
+
+/* Define if pnet is the preferred C# implementation. */
+/* #undef CSHARP_CHOICE_PNET */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+#define ENABLE_NLS 1
+
+/* Define to 1 if the package shall run at any location in the filesystem. */
+/* #undef ENABLE_RELOCATABLE */
+
+/* Define to 1 when using the gnulib module fwriteerror. */
+#define GNULIB_FWRITEERROR 1
+
+/* 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 to 1 if you have the `argz_count' function. */
+/* #undef HAVE_ARGZ_COUNT */
+
+/* Define to 1 if you have the <argz.h> header file. */
+/* #undef HAVE_ARGZ_H */
+
+/* Define to 1 if you have the `argz_next' function. */
+/* #undef HAVE_ARGZ_NEXT */
+
+/* Define to 1 if you have the `argz_stringify' function. */
+/* #undef HAVE_ARGZ_STRINGIFY */
+
+/* Define to 1 if you have the `asprintf' function. */
+/* #undef HAVE_ASPRINTF */
+
+/* Define to 1 if you have the `atexit' function. */
+#define HAVE_ATEXIT 1
+
+/* Define to 1 if you have the <bp-sym.h> header file. */
+/* #undef HAVE_BP_SYM_H */
+
+/* Define to 1 if the compiler understands __builtin_expect. */
+/* #undef HAVE_BUILTIN_EXPECT */
+
+/* Define to 1 if you have the `canonicalize_file_name' function. */
+/* #undef HAVE_CANONICALIZE_FILE_NAME */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+ CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+ the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the declaration of `canonicalize_file_name', and to
+ 0 if you don't. */
+#define HAVE_DECL_CANONICALIZE_FILE_NAME 0
+
+/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_CLEARERR_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
+ don't. */
+#define HAVE_DECL_FEOF_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_FERROR_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_FFLUSH_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_FGETS_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_FPUTC_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_FPUTS_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_FREAD_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_FWRITE_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_GETCHAR_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
+ don't. */
+#define HAVE_DECL_GETC_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
+ */
+#define HAVE_DECL_GETENV 1
+
+/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if
+ you don't. */
+#define HAVE_DECL_PUTCHAR_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you
+ don't. */
+#define HAVE_DECL_PUTC_UNLOCKED 0
+
+/* Define to 1 if you have the declaration of `strdup', and to 0 if you don't.
+ */
+#define HAVE_DECL_STRDUP 1
+
+/* Define to 1 if you have the declaration of `strerror', and to 0 if you
+ don't. */
+/* #undef HAVE_DECL_STRERROR */
+
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+ don't. */
+#define HAVE_DECL_STRERROR_R 0
+
+/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
+ don't. */
+#define HAVE_DECL_STRNLEN 0
+
+/* Define to 1 if you have the declaration of `wcwidth', and to 0 if you
+ don't. */
+#define HAVE_DECL_WCWIDTH 0
+
+/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
+ don't. */
+#define HAVE_DECL__SNPRINTF 1
+
+/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
+ don't. */
+#define HAVE_DECL__SNWPRINTF 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define if you have the declaration of environ. */
+#define HAVE_ENVIRON_DECL 1
+
+/* Define to 1 if you have the `fwprintf' function. */
+#define HAVE_FWPRINTF 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `getegid' function. */
+/* #undef HAVE_GETEGID */
+
+/* Define to 1 if you have the `geteuid' function. */
+/* #undef HAVE_GETEUID */
+
+/* Define to 1 if you have the `getgid' function. */
+/* #undef HAVE_GETGID */
+
+/* Define to 1 if you have the <getopt.h> header file. */
+/* #undef HAVE_GETOPT_H */
+
+/* Define to 1 if you have the `getopt_long_only' function. */
+/* #undef HAVE_GETOPT_LONG_ONLY */
+
+/* Define to 1 if you have the `getpagesize' function. */
+/* #undef HAVE_GETPAGESIZE */
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* #undef HAVE_GETTEXT */
+
+/* Define to 1 if you have the `getuid' function. */
+/* #undef HAVE_GETUID */
+
+/* Define if you have the iconv() function and it works. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <iconv.h> header file. */
+/* #undef HAVE_ICONV_H */
+
+/* Define if your compiler supports the #include_next directive. */
+/* #undef HAVE_INCLUDE_NEXT */
+
+/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
+/* #undef HAVE_INTMAX_T */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
+ declares uintmax_t. */
+/* #undef HAVE_INTTYPES_H_WITH_UINTMAX */
+
+/* Define to 1 if you have the `iswcntrl' function. */
+#define HAVE_ISWCNTRL 1
+
+/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
+/* #undef HAVE_LANGINFO_CODESET */
+
+/* Define if your <locale.h> file defines LC_MESSAGES. */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if the system has the type `long long int'. */
+/* #undef HAVE_LONG_LONG_INT */
+
+/* Define to 1 if you have the <mach-o/dyld.h> header file. */
+/* #undef HAVE_MACH_O_DYLD_H */
+
+/* Define if the 'malloc' function is POSIX compliant. */
+/* #undef HAVE_MALLOC_POSIX */
+
+/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
+/* #undef HAVE_MBRTOWC */
+
+/* Define to 1 if <wchar.h> declares mbstate_t. */
+#define HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the `memchr' function. */
+#define HAVE_MEMCHR 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mempcpy' function. */
+/* #undef HAVE_MEMPCPY */
+
+/* Define to 1 if you have a working `mmap' system call. */
+/* #undef HAVE_MMAP */
+
+/* Define to 1 if you have the `munmap' function. */
+/* #undef HAVE_MUNMAP */
+
+/* Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if
+ _GNU_SOURCE is defined. */
+/* #undef HAVE_NL_LOCALE_NAME */
+
+/* Define if your printf() function supports format strings with positions. */
+/* #undef HAVE_POSIX_PRINTF */
+
+/* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */
+/* #undef HAVE_PTHREAD_MUTEX_RECURSIVE */
+
+/* Define if the POSIX multithreading library has read/write locks. */
+/* #undef HAVE_PTHREAD_RWLOCK */
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the `readlink' function. */
+/* #undef HAVE_READLINK */
+
+/* Define to 1 if you have the <search.h> header file. */
+#define HAVE_SEARCH_H 1
+
+/* Define to 1 if you have the `setenv' function. */
+/* #undef HAVE_SETENV */
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if 'sig_atomic_t' is a signed integer type. */
+#define HAVE_SIGNED_SIG_ATOMIC_T 1
+
+/* Define to 1 if 'wchar_t' is a signed integer type. */
+/* #undef HAVE_SIGNED_WCHAR_T */
+
+/* Define to 1 if 'wint_t' is a signed integer type. */
+/* #undef HAVE_SIGNED_WINT_T */
+
+/* Define to 1 if you have the `snprintf' function. */
+/* #undef HAVE_SNPRINTF */
+
+/* Define to 1 if stdbool.h conforms to C99. */
+/* #undef HAVE_STDBOOL_H */
+
+/* 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. */
+/* #undef HAVE_STDINT_H */
+
+/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
+ uintmax_t. */
+/* #undef HAVE_STDINT_H_WITH_UINTMAX */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `stpcpy' function. */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+/* #undef HAVE_STRCASECMP */
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+/* #undef HAVE_STRERROR_R */
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtol' function. */
+#define HAVE_STRTOL 1
+
+/* Define to 1 if you have the `strtoul' function. */
+#define HAVE_STRTOUL 1
+
+/* Define to 1 if you have the <sys/bitypes.h> header file. */
+/* #undef HAVE_SYS_BITYPES_H */
+
+/* Define to 1 if you have the <sys/inttypes.h> header file. */
+/* #undef HAVE_SYS_INTTYPES_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+/* #undef HAVE_SYS_PARAM_H */
+
+/* Define to 1 if you have the <sys/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 `tsearch' function. */
+/* #undef HAVE_TSEARCH */
+
+/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
+/* #undef HAVE_UINTMAX_T */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+/* #undef HAVE_UNSIGNED_LONG_LONG_INT */
+
+/* Define to 1 or 0, depending whether the compiler supports simple visibility
+ declarations. */
+#define HAVE_VISIBILITY 0
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define if you have the 'wchar_t' type. */
+#define HAVE_WCHAR_T 1
+
+/* Define to 1 if you have the `wcslen' function. */
+#define HAVE_WCSLEN 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define to 1 if you have the `wcwidth' function. */
+/* #undef HAVE_WCWIDTH */
+
+/* Define if you have the 'wint_t' type. */
+#define HAVE_WINT_T 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+/* #undef HAVE__BOOL */
+
+/* Define to 1 if you have the `_NSGetExecutablePath' function. */
+/* #undef HAVE__NSGETEXECUTABLEPATH */
+
+/* Define to 1 if you have the `__fsetlocking' function. */
+/* #undef HAVE___FSETLOCKING */
+
+/* Define as const if the declaration of iconv() needs const. */
+/* #undef ICONV_CONST */
+
+/* Define to a symbolic name denoting the flavor of iconv_open()
+ implementation. */
+/* #undef ICONV_FLAVOR */
+
+/* Define to the value of ${prefix}, as a string. */
+/* #define INSTALLPREFIX "/usr/local" */
+
+/* Define if integer division by zero raises signal SIGFPE. */
+#define INTDIV0_RAISES_SIGFPE 0
+
+/* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */
+#define MALLOC_0_IS_NONNULL 1
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#define NO_MINUS_C_MINUS_O 1
+
+/* Name of package */
+#define PACKAGE "gettext-runtime"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
+/* #undef PRI_MACROS_BROKEN */
+
+/* Define if the pthread_in_use() detection is hard. */
+/* #undef PTHREAD_IN_USE_DETECTION_HARD */
+
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'ptrdiff_t'. */
+#define PTRDIFF_T_SUFFIX
+
+/* Define this to 1 if strerror is broken. */
+/* #undef REPLACE_STRERROR */
+
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'sig_atomic_t'. */
+#define SIG_ATOMIC_T_SUFFIX
+
+/* Define as the maximum value of type 'size_t', if the system doesn't define
+ it. */
+#define SIZE_MAX (((1UL << 31) - 1) * 2 + 1)
+
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'size_t'. */
+#define SIZE_T_SUFFIX u
+
+/* 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 strerror_r returns char *. */
+/* #undef STRERROR_R_CHAR_P */
+
+/* Define if the POSIX multithreading library can be used. */
+/* #undef USE_POSIX_THREADS */
+
+/* Define if references to the POSIX multithreading library should be made
+ weak. */
+/* #undef USE_POSIX_THREADS_WEAK */
+
+/* Define if the GNU Pth multithreading library can be used. */
+/* #undef USE_PTH_THREADS */
+
+/* Define if references to the GNU Pth multithreading library should be made
+ weak. */
+/* #undef USE_PTH_THREADS_WEAK */
+
+/* Define if the old Solaris multithreading library can be used. */
+/* #undef USE_SOLARIS_THREADS */
+
+/* Define if references to the old Solaris multithreading library should be
+ made weak. */
+/* #undef USE_SOLARIS_THREADS_WEAK */
+
+/* Define to 1 if you want getc etc. to use unlocked I/O if available.
+ Unlocked I/O can improve performance in unithreaded apps, but it is not
+ safe for multithreaded apps. */
+#define USE_UNLOCKED_IO 0
+
+/* Define if the Win32 multithreading API can be used. */
+#define USE_WIN32_THREADS 1
+
+/* Version number of package */
+#define VERSION "0.17"
+
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'wchar_t'. */
+#define WCHAR_T_SUFFIX
+
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+ 'wint_t'. */
+#define WINT_T_SUFFIX
+
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Define to rpl_ if the getopt replacement functions and variables should be
+ used. */
+#define __GETOPT_PREFIX rpl_
+
+/* 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 a type if <wchar.h> does not define. */
+/* #undef mbstate_t */
+
+/* Define as the type of the result of subtracting two pointers, if the system
+ doesn't define it. */
+/* #undef ptrdiff_t */
+
+/* Define to a replacement function name for realpath(). */
+#define realpath rpl_realpath
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+ nothing if this is not supported. Do not define if restrict is
+ supported directly. */
+#define restrict
+/* Work around a bug in Sun C++: it does not support _Restrict, even
+ though the corresponding Sun C compiler does, which causes
+ "#define restrict _Restrict" in the previous line. Perhaps some future
+ version of Sun C++ will work with _Restrict; if so, it'll probably
+ define __RESTRICT, just as Sun C does. */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define as a signed type of the same size as size_t. */
+#ifdef _WIN64
+#define ssize_t __int64
+#else
+#define ssize_t __int32
+#endif
+
+/* Define to rpl_strnlen if the replacement function should be used. */
+#define strnlen rpl_strnlen
+
+/* Define to unsigned long or unsigned long long if <stdint.h> and
+ <inttypes.h> don't define. */
+#ifdef _WIN64
+#define uintmax_t unsigned __int64
+#else
+#define uintmax_t unsigned __int32
+#endif
+
+#define __libc_lock_t gl_lock_t
+#define __libc_lock_define gl_lock_define
+#define __libc_lock_define_initialized gl_lock_define_initialized
+#define __libc_lock_init gl_lock_init
+#define __libc_lock_lock gl_lock_lock
+#define __libc_lock_unlock gl_lock_unlock
+#define __libc_lock_recursive_t gl_recursive_lock_t
+#define __libc_lock_define_recursive gl_recursive_lock_define
+#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized
+#define __libc_lock_init_recursive gl_recursive_lock_init
+#define __libc_lock_lock_recursive gl_recursive_lock_lock
+#define __libc_lock_unlock_recursive gl_recursive_lock_unlock
+#if 0
+#define glthread_in_use libintl_thread_in_use
+#define glthread_lock_init libintl_lock_init
+#define glthread_lock_lock libintl_lock_lock
+#define glthread_lock_unlock libintl_lock_unlock
+#define glthread_lock_destroy libintl_lock_destroy
+#define glthread_rwlock_init libintl_rwlock_init
+#define glthread_rwlock_rdlock libintl_rwlock_rdlock
+#define glthread_rwlock_wrlock libintl_rwlock_wrlock
+#define glthread_rwlock_unlock libintl_rwlock_unlock
+#define glthread_rwlock_destroy libintl_rwlock_destroy
+#define glthread_recursive_lock_init libintl_recursive_lock_init
+#define glthread_recursive_lock_lock libintl_recursive_lock_lock
+#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock
+#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy
+#define glthread_once libintl_once
+#define glthread_once_call libintl_once_call
+#define glthread_once_singlethreaded libintl_once_singlethreaded
+#endif
+
+
+/* On Windows, variables that may be in a DLL must be marked specially. */
+#if (defined _MSC_VER && defined _DLL) && !defined IN_RELOCWRAPPER
+# define DLL_VARIABLE __declspec (dllimport)
+#else
+# define DLL_VARIABLE
+#endif
+
+/* Extra OS/2 (emx+gcc) defines. */
+#ifdef __EMX__
+# include "intl/os2compat.h"
+#endif
+
diff --git a/ports/gettext/libgnuintl.h b/ports/gettext/libgnuintl.h
new file mode 100644
index 000000000..eac6c8c25
--- /dev/null
+++ b/ports/gettext/libgnuintl.h
@@ -0,0 +1,423 @@
+/* Message catalogs for internationalization.
+Copyright (C) 1995-1997, 2000-2007 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU Library General Public License as published
+by the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+USA. */
+
+#ifndef _LIBINTL_H
+#define _LIBINTL_H 1
+
+#ifdef BUILDING_LIBINTL
+#define LIBINTL_DLL_EXPORTED __declspec(dllexport)
+#else
+#define LIBINTL_DLL_EXPORTED
+#endif
+
+#include <locale.h>
+
+/* The LC_MESSAGES locale category is the category used by the functions
+gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
+On systems that don't define it, use an arbitrary value instead.
+On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
+then includes <libintl.h> (i.e. this file!) and then only defines
+LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
+in this case. */
+#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
+# define LC_MESSAGES 1729
+#endif
+
+/* We define an additional symbol to signal that we use the GNU
+implementation of gettext. */
+#define __USE_GNU_GETTEXT 1
+
+/* Provide information about the supported file formats. Returns the
+maximum minor revision number supported for a given major revision. */
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
+ ((major) == 0 || (major) == 1 ? 1 : -1)
+
+/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
+precedence over _conio_gettext. */
+#ifdef __DJGPP__
+# undef gettext
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /* Version number: (major<<16) + (minor<<8) + subminor */
+#define LIBINTL_VERSION 0x001100
+ extern LIBINTL_DLL_EXPORTED int libintl_version;
+
+
+ /* We redirect the functions to those prefixed with "libintl_". This is
+ necessary, because some systems define gettext/textdomain/... in the C
+ library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
+ If we used the unprefixed names, there would be cases where the
+ definition in the C library would override the one in the libintl.so
+ shared library. Recall that on ELF systems, the symbols are looked
+ up in the following order:
+ 1. in the executable,
+ 2. in the shared libraries specified on the link command line, in order,
+ 3. in the dependencies of the shared libraries specified on the link
+ command line,
+ 4. in the dlopen()ed shared libraries, in the order in which they were
+ dlopen()ed.
+ The definition in the C library would override the one in libintl.so if
+ either
+ * -lc is given on the link command line and -lintl isn't, or
+ * -lc is given on the link command line before -lintl, or
+ * libintl.so is a dependency of a dlopen()ed shared library but not
+ linked to the executable at link time.
+ Since Solaris gettext() behaves differently than GNU gettext(), this
+ would be unacceptable.
+
+ The redirection happens by default through macros in C, so that &gettext
+ is independent of the compilation unit, but through inline functions in
+ C++, in order not to interfere with the name mangling of class fields or
+ class methods called 'gettext'. */
+
+ /* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
+ If he doesn't, we choose the method. A third possible method is
+ _INTL_REDIRECT_ASM, supported only by GCC. */
+#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
+# if __GNUC__ >= 2 && !(__APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
+# define _INTL_REDIRECT_ASM
+# else
+# ifdef __cplusplus
+# define _INTL_REDIRECT_INLINE
+# else
+# define _INTL_REDIRECT_MACROS
+# endif
+# endif
+#endif
+ /* Auxiliary macros. */
+#ifdef _INTL_REDIRECT_ASM
+# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
+# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
+# define _INTL_STRINGIFY(prefix) #prefix
+#else
+# define _INTL_ASM(cname)
+#endif
+
+ /* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
+ its n-th argument literally. This enables GCC to warn for example about
+ printf (gettext ("foo %y")). */
+#if __GNUC__ >= 3 && !(__APPLE_CC__ > 1 && defined __cplusplus)
+# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
+#else
+# define _INTL_MAY_RETURN_STRING_ARG(n)
+#endif
+
+ /* Look up MSGID in the current default message catalog for the current
+ LC_MESSAGES locale. If not found, returns MSGID itself (the default
+ text). */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_gettext(const char *__msgid)
+ _INTL_MAY_RETURN_STRING_ARG(1);
+ static inline char *gettext(const char *__msgid)
+ {
+ return libintl_gettext(__msgid);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define gettext libintl_gettext
+#endif
+ extern LIBINTL_DLL_EXPORTED char *gettext(const char *__msgid)
+ _INTL_ASM(libintl_gettext)
+ _INTL_MAY_RETURN_STRING_ARG(1);
+#endif
+
+ /* Look up MSGID in the DOMAINNAME message catalog for the current
+ LC_MESSAGES locale. */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_dgettext(const char *__domainname, const char *__msgid)
+ _INTL_MAY_RETURN_STRING_ARG(2);
+ static inline char *dgettext(const char *__domainname, const char *__msgid)
+ {
+ return libintl_dgettext(__domainname, __msgid);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dgettext libintl_dgettext
+#endif
+ extern LIBINTL_DLL_EXPORTED char *dgettext(const char *__domainname, const char *__msgid)
+ _INTL_ASM(libintl_dgettext)
+ _INTL_MAY_RETURN_STRING_ARG(2);
+#endif
+
+ /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+ locale. */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_dcgettext(const char *__domainname, const char *__msgid,
+ int __category)
+ _INTL_MAY_RETURN_STRING_ARG(2);
+ static inline char *dcgettext(const char *__domainname, const char *__msgid,
+ int __category)
+ {
+ return libintl_dcgettext(__domainname, __msgid, __category);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dcgettext libintl_dcgettext
+#endif
+ extern LIBINTL_DLL_EXPORTED char *dcgettext(const char *__domainname, const char *__msgid,
+ int __category)
+ _INTL_ASM(libintl_dcgettext)
+ _INTL_MAY_RETURN_STRING_ARG(2);
+#endif
+
+
+ /* Similar to `gettext' but select the plural form corresponding to the
+ number N. */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_ngettext(const char *__msgid1, const char *__msgid2,
+ unsigned long int __n)
+ _INTL_MAY_RETURN_STRING_ARG(1) _INTL_MAY_RETURN_STRING_ARG(2);
+ static inline char *ngettext(const char *__msgid1, const char *__msgid2,
+ unsigned long int __n)
+ {
+ return libintl_ngettext(__msgid1, __msgid2, __n);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define ngettext libintl_ngettext
+#endif
+ extern LIBINTL_DLL_EXPORTED char *ngettext(const char *__msgid1, const char *__msgid2,
+ unsigned long int __n)
+ _INTL_ASM(libintl_ngettext)
+ _INTL_MAY_RETURN_STRING_ARG(1) _INTL_MAY_RETURN_STRING_ARG(2);
+#endif
+
+ /* Similar to `dgettext' but select the plural form corresponding to the
+ number N. */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_dngettext(const char *__domainname, const char *__msgid1,
+ const char *__msgid2, unsigned long int __n)
+ _INTL_MAY_RETURN_STRING_ARG(2) _INTL_MAY_RETURN_STRING_ARG(3);
+ static inline char *dngettext(const char *__domainname, const char *__msgid1,
+ const char *__msgid2, unsigned long int __n)
+ {
+ return libintl_dngettext(__domainname, __msgid1, __msgid2, __n);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dngettext libintl_dngettext
+#endif
+ extern LIBINTL_DLL_EXPORTED char *dngettext(const char *__domainname,
+ const char *__msgid1, const char *__msgid2,
+ unsigned long int __n)
+ _INTL_ASM(libintl_dngettext)
+ _INTL_MAY_RETURN_STRING_ARG(2) _INTL_MAY_RETURN_STRING_ARG(3);
+#endif
+
+ /* Similar to `dcgettext' but select the plural form corresponding to the
+ number N. */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_dcngettext(const char *__domainname,
+ const char *__msgid1, const char *__msgid2,
+ unsigned long int __n, int __category)
+ _INTL_MAY_RETURN_STRING_ARG(2) _INTL_MAY_RETURN_STRING_ARG(3);
+ static inline char *dcngettext(const char *__domainname,
+ const char *__msgid1, const char *__msgid2,
+ unsigned long int __n, int __category)
+ {
+ return libintl_dcngettext(__domainname, __msgid1, __msgid2, __n, __category);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dcngettext libintl_dcngettext
+#endif
+ extern LIBINTL_DLL_EXPORTED char *dcngettext(const char *__domainname,
+ const char *__msgid1, const char *__msgid2,
+ unsigned long int __n, int __category)
+ _INTL_ASM(libintl_dcngettext)
+ _INTL_MAY_RETURN_STRING_ARG(2) _INTL_MAY_RETURN_STRING_ARG(3);
+#endif
+
+
+
+ /* Set the current default message catalog to DOMAINNAME.
+ If DOMAINNAME is null, return the current default.
+ If DOMAINNAME is "", reset to the default of "messages". */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_textdomain(const char *__domainname);
+ static inline char *textdomain(const char *__domainname)
+ {
+ return libintl_textdomain(__domainname);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define textdomain libintl_textdomain
+#endif
+ extern LIBINTL_DLL_EXPORTED char *textdomain(const char *__domainname)
+ _INTL_ASM(libintl_textdomain);
+#endif
+
+ /* Specify that the DOMAINNAME message catalog will be found
+ in DIRNAME rather than in the system locale data base. */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_bindtextdomain(const char *__domainname,
+ const char *__dirname);
+ static inline char *bindtextdomain(const char *__domainname,
+ const char *__dirname)
+ {
+ return libintl_bindtextdomain(__domainname, __dirname);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define bindtextdomain libintl_bindtextdomain
+#endif
+ extern LIBINTL_DLL_EXPORTED char *bindtextdomain(const char *__domainname, const char *__dirname)
+ _INTL_ASM(libintl_bindtextdomain);
+#endif
+
+ /* Specify the character encoding in which the messages from the
+ DOMAINNAME message catalog will be returned. */
+#ifdef _INTL_REDIRECT_INLINE
+ extern LIBINTL_DLL_EXPORTED char *libintl_bind_textdomain_codeset(const char *__domainname,
+ const char *__codeset);
+ static inline char *bind_textdomain_codeset(const char *__domainname,
+ const char *__codeset)
+ {
+ return libintl_bind_textdomain_codeset(__domainname, __codeset);
+ }
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define bind_textdomain_codeset libintl_bind_textdomain_codeset
+#endif
+ extern LIBINTL_DLL_EXPORTED char *bind_textdomain_codeset(const char *__domainname,
+ const char *__codeset)
+ _INTL_ASM(libintl_bind_textdomain_codeset);
+#endif
+
+
+
+ /* Support for format strings with positions in *printf(), following the
+ POSIX/XSI specification.
+ Note: These replacements for the *printf() functions are visible only
+ in source files that #include <libintl.h> or #include "gettext.h".
+ Packages that use *printf() in source files that don't refer to _()
+ or gettext() but for which the format string could be the return value
+ of _() or gettext() need to add this #include. Oh well. */
+
+#if !0
+
+#include <stdio.h>
+#include <stddef.h>
+
+ /* Get va_list. */
+#if __STDC__ || defined __cplusplus || defined _MSC_VER
+# include <stdarg.h>
+#else
+# include <varargs.h>
+#endif
+
+#undef fprintf
+#define fprintf libintl_fprintf
+ extern LIBINTL_DLL_EXPORTED int fprintf(FILE *, const char *, ...);
+#undef vfprintf
+#define vfprintf libintl_vfprintf
+ extern LIBINTL_DLL_EXPORTED int vfprintf(FILE *, const char *, va_list);
+
+#undef printf
+#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
+ /* Don't break __attribute__((format(printf,M,N))).
+ This redefinition is only possible because the libc in NetBSD, Cygwin,
+ mingw does not have a function __printf__. */
+# define libintl_printf __printf__
+#endif
+#define printf libintl_printf
+ extern LIBINTL_DLL_EXPORTED int printf(const char *, ...);
+#undef vprintf
+#define vprintf libintl_vprintf
+ extern LIBINTL_DLL_EXPORTED int vprintf(const char *, va_list);
+
+#undef sprintf
+#define sprintf libintl_sprintf
+ extern LIBINTL_DLL_EXPORTED int sprintf(char *, const char *, ...);
+#undef vsprintf
+#define vsprintf libintl_vsprintf
+ extern LIBINTL_DLL_EXPORTED int vsprintf(char *, const char *, va_list);
+
+#if 0
+
+#undef snprintf
+#define snprintf libintl_snprintf
+ extern LIBINTL_DLL_EXPORTED int snprintf(char *, size_t, const char *, ...);
+#undef vsnprintf
+#define vsnprintf libintl_vsnprintf
+ extern LIBINTL_DLL_EXPORTED int vsnprintf(char *, size_t, const char *, va_list);
+
+#endif
+
+#if 0
+
+#undef asprintf
+#define asprintf libintl_asprintf
+ extern LIBINTL_DLL_EXPORTED int asprintf(char **, const char *, ...);
+#undef vasprintf
+#define vasprintf libintl_vasprintf
+ extern LIBINTL_DLL_EXPORTED int vasprintf(char **, const char *, va_list);
+
+#endif
+
+#if 0
+
+#undef fwprintf
+#define fwprintf libintl_fwprintf
+ extern LIBINTL_DLL_EXPORTED int fwprintf(FILE *, const wchar_t *, ...);
+#undef vfwprintf
+#define vfwprintf libintl_vfwprintf
+ extern LIBINTL_DLL_EXPORTED int vfwprintf(FILE *, const wchar_t *, va_list);
+
+#undef wprintf
+#define wprintf libintl_wprintf
+ extern LIBINTL_DLL_EXPORTED int wprintf(const wchar_t *, ...);
+#undef vwprintf
+#define vwprintf libintl_vwprintf
+ extern LIBINTL_DLL_EXPORTED int vwprintf(const wchar_t *, va_list);
+
+#undef swprintf
+#define swprintf libintl_swprintf
+ extern LIBINTL_DLL_EXPORTED int swprintf(wchar_t *, size_t, const wchar_t *, ...);
+#undef vswprintf
+#define vswprintf libintl_vswprintf
+ extern LIBINTL_DLL_EXPORTED int vswprintf(wchar_t *, size_t, const wchar_t *, va_list);
+
+#endif
+
+#endif
+
+
+ /* Support for relocatable packages. */
+
+ /* Sets the original and the current installation prefix of the package.
+ Relocation simply replaces a pathname starting with the original prefix
+ by the corresponding pathname with the current prefix instead. Both
+ prefixes should be directory names without trailing slash (i.e. use ""
+ instead of "/"). */
+#define libintl_set_relocation_prefix libintl_set_relocation_prefix
+ extern LIBINTL_DLL_EXPORTED void
+ libintl_set_relocation_prefix(const char *orig_prefix,
+ const char *curr_prefix);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* libintl.h */ \ No newline at end of file
diff --git a/ports/gettext/portfile.cmake b/ports/gettext/portfile.cmake
new file mode 100644
index 000000000..f14f7a707
--- /dev/null
+++ b/ports/gettext/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}
+#
+
+#Based on https://github.com/winlibs/gettext
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gettext-0.19)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.tar.gz"
+ FILENAME "gettext-0.19.tar.gz"
+ SHA512 a5db035c582ff49d45ee6eab9466b2bef918e413a882019c204a9d8903cb3770ddfecd32c971ea7c7b037c7b69476cf7c56dcabc8b498b94ab99f132516c9922
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_libintl.txt DESTINATION ${SOURCE_PATH}/gettext-runtime)
+file(RENAME ${SOURCE_PATH}/gettext-runtime/CMakeLists_libintl.txt ${SOURCE_PATH}/gettext-runtime/CMakeLists.txt)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/libgnuintl.h DESTINATION ${SOURCE_PATH}/gettext-runtime/intl)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h DESTINATION ${SOURCE_PATH}/gettext-runtime)
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-Fix-macro-definitions.patch"
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+)
+
+vcpkg_install_cmake()
+
+file(COPY ${SOURCE_PATH}/gettext-runtime/intl/libgnuintl.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(RENAME ${CURRENT_PACKAGES_DIR}/include/libgnuintl.h ${CURRENT_PACKAGES_DIR}/include/libintl.h)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gettext)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/gettext/COPYING ${CURRENT_PACKAGES_DIR}/share/gettext/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/gflags/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch b/ports/gflags/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch
deleted file mode 100644
index d099ea616..000000000
--- a/ports/gflags/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 5af642bdfe023a7c857d1d26593af586516bf696 Mon Sep 17 00:00:00 2001
-From: Sergey Sharybin <sergey.vfx@gmail.com>
-Date: Thu, 31 Dec 2015 17:16:26 +0500
-Subject: [PATCH] Fix some compilation warnings with MSVC 2015
-
-MSVC 2015 already defines vsnprintf() and va_copy().
----
- src/windows_port.cc | 2 ++
- src/windows_port.h | 2 ++
- 2 files changed, 4 insertions(+)
-
-diff --git a/src/windows_port.cc b/src/windows_port.cc
-index 1f40458..b5b7194 100644
---- a/src/windows_port.cc
-+++ b/src/windows_port.cc
-@@ -44,6 +44,7 @@
-
- // These call the windows _vsnprintf, but always NUL-terminate.
- #if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */
-+#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */
-
- #ifdef _MSC_VER
- # pragma warning(push)
-@@ -68,4 +69,5 @@ int snprintf(char *str, size_t size, const char *format, ...) {
- return r;
- }
-
-+#endif /* if !(defined(_MSC_VER) && _MSC_VER >= 1900) */
- #endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */
-diff --git a/src/windows_port.h b/src/windows_port.h
-index c8ff24f..554b9c9 100644
---- a/src/windows_port.h
-+++ b/src/windows_port.h
-@@ -63,12 +63,14 @@
- * name vsnprintf, since windows defines that (but not snprintf (!)).
- */
- #if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */
-+#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */
- extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size,
- const char *format, ...);
- extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size,
- const char *format, va_list ap);
- #define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
- #define va_copy(dst, src) (dst) = (src)
-+#endif
- #endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */
-
- #ifdef _MSC_VER
---
-2.10.0.windows.1
-
diff --git a/ports/gflags/CONTROL b/ports/gflags/CONTROL
index 03977243f..b84a3b67d 100644
--- a/ports/gflags/CONTROL
+++ b/ports/gflags/CONTROL
@@ -1,3 +1,3 @@
Source: gflags
-Version: 2.1.2
+Version: 2.2.0-2
Description: A C++ library that implements commandline flags processing
diff --git a/ports/gflags/portfile.cmake b/ports/gflags/portfile.cmake
index ca315ae31..37fea35c3 100644
--- a/ports/gflags/portfile.cmake
+++ b/ports/gflags/portfile.cmake
@@ -1,53 +1,58 @@
include(vcpkg_common_functions)
find_program(GIT git)
-set(GIT_URL "https://github.com/gflags/gflags.git")
-set(GIT_TAG "v2.1.2")
-
-if(NOT EXISTS "${DOWNLOADS}/gflags.git")
- message(STATUS "Cloning")
- vcpkg_execute_required_process(
- COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/gflags.git
- WORKING_DIRECTORY ${DOWNLOADS}
- LOGNAME clone
- )
-endif()
-message(STATUS "Cloning done")
-
-if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
- message(STATUS "Adding worktree and patching")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
- vcpkg_execute_required_process(
- COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_TAG}
- WORKING_DIRECTORY ${DOWNLOADS}/gflags.git
- LOGNAME worktree
- )
- message(STATUS "Patching")
- vcpkg_execute_required_process(
- COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-some-compilation-warnings-with-MSVC-2015.patch --ignore-whitespace --whitespace=fix
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src
- LOGNAME patch
- )
-endif()
-message(STATUS "Adding worktree and patching done")
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/gflags/gflags/archive/v2.2.0.zip"
+ FILENAME "gflags-v2.2.0.zip"
+ SHA512 638d094cdcc759a35ebd0e57900216deec6113242d2dcc964beff7b88cf56e3dbab3dce6e10a055bfd94cb5daebb8632382219a5ef40a689e14c76b263d3eca5)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gflags-2.2.0)
vcpkg_configure_cmake(
- SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src
+ SOURCE_PATH ${SOURCE_PATH}
OPTIONS
- -DBUILD_SHARED_LIBS=ON
+ -DGFLAGS_REGISTER_BUILD_DIR:BOOL=OFF
+ -DGFLAGS_REGISTER_INSTALL_PREFIX:BOOL=OFF
+ -DBUILD_gflags_nothreads_LIB:BOOL=OFF
)
vcpkg_install_cmake()
-file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gflags.dll ${CURRENT_PACKAGES_DIR}/bin/gflags.dll)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gflags.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gflags.dll)
+endif()
+
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
file(RENAME ${CURRENT_PACKAGES_DIR}/cmake ${CURRENT_PACKAGES_DIR}/share/gflags)
-file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gflags.dll ${CURRENT_PACKAGES_DIR}/bin/gflags.dll)
-file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gflags_nothreads.dll ${CURRENT_PACKAGES_DIR}/bin/gflags_nothreads.dll)
-file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gflags.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gflags.dll)
-file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gflags_nothreads.dll ${CURRENT_PACKAGES_DIR}/debug/bin/gflags_nothreads.dll)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+file(READ ${CURRENT_PACKAGES_DIR}/debug/cmake/gflags-targets-debug.cmake GFLAGS_DEBUG_MODULE)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" GFLAGS_DEBUG_MODULE "${GFLAGS_DEBUG_MODULE}")
+string(REPLACE "/Lib/gflags.dll" "/bin/gflags.dll" GFLAGS_DEBUG_MODULE "${GFLAGS_DEBUG_MODULE}")
+string(REPLACE "/Lib/gflags_nothreads.dll" "/bin/gflags_nothreads.dll" GFLAGS_DEBUG_MODULE "${GFLAGS_DEBUG_MODULE}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets-debug.cmake "${GFLAGS_DEBUG_MODULE}")
+
+file(READ ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets-release.cmake GFLAGS_RELEASE_MODULE)
+string(REPLACE "/Lib/gflags.dll" "/bin/gflags.dll" GFLAGS_RELEASE_MODULE "${GFLAGS_RELEASE_MODULE}")
+string(REPLACE "/Lib/gflags_nothreads.dll" "/bin/gflags_nothreads.dll" GFLAGS_RELEASE_MODULE "${GFLAGS_RELEASE_MODULE}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets-release.cmake "${GFLAGS_RELEASE_MODULE}")
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake)
+
+file(READ ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets.cmake GFLAGS_CONFIG_MODULE)
+string(REPLACE "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)"
+ "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)"
+ GFLAGS_CONFIG_MODULE "${GFLAGS_CONFIG_MODULE}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/gflags/gflags-targets.cmake "${GFLAGS_CONFIG_MODULE}")
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
+file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/gflags RENAME copyright)
-file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/gflags RENAME copyright)
+file(RENAME ${CURRENT_PACKAGES_DIR}/Include ${CURRENT_PACKAGES_DIR}/include)
+file(RENAME ${CURRENT_PACKAGES_DIR}/Lib ${CURRENT_PACKAGES_DIR}/lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/Lib ${CURRENT_PACKAGES_DIR}/debug/lib)
vcpkg_copy_pdbs()
diff --git a/ports/glbinding/CONTROL b/ports/glbinding/CONTROL
new file mode 100644
index 000000000..5e7ec029c
--- /dev/null
+++ b/ports/glbinding/CONTROL
@@ -0,0 +1,3 @@
+Source: glbinding
+Version: 2.1.1-1
+Description: glbinding is an MIT licensed, cross-platform C++ binding for the OpenGL API
diff --git a/ports/glbinding/portfile.cmake b/ports/glbinding/portfile.cmake
new file mode 100644
index 000000000..165c8d889
--- /dev/null
+++ b/ports/glbinding/portfile.cmake
@@ -0,0 +1,60 @@
+# 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/glbinding-2.1.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/cginternals/glbinding/archive/v2.1.1.zip"
+ FILENAME "glbinding-2.1.1.zip"
+ SHA512 66b21853a4f4760b7b22cafd5211958769c513e83be999018fe79cf56a9271e0e28566caaa2286393f54ac2154d564a68d12159598d03c965adf6756f3753f11
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH})
+#vcpkg_build_cmake()
+vcpkg_install_cmake()
+
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
+file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/glbinding ${CURRENT_PACKAGES_DIR}/share/glbinding)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake)
+
+file(READ ${CURRENT_PACKAGES_DIR}/debug/cmake/glbinding/glbinding-export-debug.cmake GLBINDING_DEBUG_MODULE)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" GLBINDING_DEBUG_MODULE "${GLBINDING_DEBUG_MODULE}")
+string(REPLACE "glbindingd.dll" "bin/glbindingd.dll" GLBINDING_DEBUG_MODULE "${GLBINDING_DEBUG_MODULE}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/glbinding/glbinding-export-debug.cmake "${GLBINDING_DEBUG_MODULE}")
+file(READ ${CURRENT_PACKAGES_DIR}/share/glbinding/glbinding-export-release.cmake RELEASE_CONF)
+string(REPLACE "glbinding.dll" "bin/glbinding.dll" RELEASE_CONF "${RELEASE_CONF}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/glbinding/glbinding-export-release.cmake "${RELEASE_CONF}")
+file(REMOVE ${CURRENT_PACKAGES_DIR}/glbinding-config.cmake)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/glbinding-config.cmake)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/glbinding/glbinding-export.cmake ${CURRENT_PACKAGES_DIR}/share/glbinding/glbinding-config.cmake)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/glbinding.dll ${CURRENT_PACKAGES_DIR}/bin/glbinding.dll)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/glbindingd.dll ${CURRENT_PACKAGES_DIR}/debug/bin/glbindingd.dll)
+endif()
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake)
+file(RENAME ${CURRENT_PACKAGES_DIR}/data ${CURRENT_PACKAGES_DIR}/share/data)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/data)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/AUTHORS
+ ${CURRENT_PACKAGES_DIR}/LICENSE
+ ${CURRENT_PACKAGES_DIR}/README.md
+ ${CURRENT_PACKAGES_DIR}/VERSION
+ ${CURRENT_PACKAGES_DIR}/debug/AUTHORS
+ ${CURRENT_PACKAGES_DIR}/debug/LICENSE
+ ${CURRENT_PACKAGES_DIR}/debug/README.md
+ ${CURRENT_PACKAGES_DIR}/debug/VERSION
+ )
+
+# 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)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/glew/CONTROL b/ports/glew/CONTROL
index f38f2dc40..21051a475 100644
--- a/ports/glew/CONTROL
+++ b/ports/glew/CONTROL
@@ -1,3 +1,3 @@
Source: glew
-Version: 1.13.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 3b35830f6..c975ca099 100644
--- a/ports/glew/portfile.cmake
+++ b/ports/glew/portfile.cmake
@@ -1,60 +1,87 @@
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glew-1.13.0)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glew-2.0.0)
vcpkg_download_distfile(ARCHIVE_FILE
- URLS "http://downloads.sourceforge.net/project/glew/glew/1.13.0/glew-1.13.0.tgz"
- FILENAME "glew-1.13.0.tgz"
- SHA512 8fc8d7c0d2cd9235ea51db9972f492701827bff40642fdb3cc54c10b0737dba8e6d8d0dcd8c5aa5bfaaae39c6198ba3d4292cd1662fbe1977eb9a5d187ba635f
+ URLS "https://sourceforge.net/projects/glew/files/glew/2.0.0/glew-2.0.0.tgz"
+ FILENAME "glew-2.0.0.tgz"
+ SHA512 e9bcd5f19a4495ce6511dfd76e64b4e4d958603c513ee9063eb9fe24fc6e0413f168620661230f1baef558f2f907cef7fe7ab2bdf957a6f7bda5fe96e9319c6a
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
SET(BUILD_ARCH "Win32")
ELSEIF(TRIPLET_SYSTEM_ARCH MATCHES "arm")
- MESSAGE(FATAL_ERROR, " ARM is currently not supported.")
- RETURN()
+ MESSAGE(FATAL_ERROR " ARM is currently not supported.")
ELSE()
SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
ENDIF()
-if(NOT EXISTS ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj)
- message(STATUS "Upgrading projects")
- file(READ ${SOURCE_PATH}/build/vc12/glew_shared.vcxproj PROJ)
- string(REPLACE
- "<PlatformToolset>v120</PlatformToolset>"
- "<PlatformToolset>v140</PlatformToolset>"
- PROJ ${PROJ})
- string(REPLACE
- "opengl32.lib%"
- "opengl32.lib\;%"
- PROJ ${PROJ})
- file(WRITE ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj ${PROJ})
-endif()
+# TODO: Maybe switch to glews' cmake build system in the future
+FOREACH(LINKAGE shared static)
+ if(NOT EXISTS ${SOURCE_PATH}/build/vc12/glew_${LINKAGE}14.vcxproj)
+ message(STATUS "Upgrading " ${LINKAGE} " project")
+ file(READ ${SOURCE_PATH}/build/vc12/glew_${LINKAGE}.vcxproj PROJ)
+ string(REPLACE
+ "<PlatformToolset>v120</PlatformToolset>"
+ "<PlatformToolset>v140</PlatformToolset>"
+ PROJ ${PROJ})
+ string(REPLACE
+ "opengl32.lib%"
+ "opengl32.lib\;%"
+ PROJ ${PROJ})
+
+ if (LINKAGE STREQUAL "static")
+ string(REPLACE
+ "MultiThreadedDebugDLL"
+ "MultiThreadedDebug"
+ PROJ ${PROJ}
+ )
+ endif()
+ file(WRITE ${SOURCE_PATH}/build/vc12/glew_${LINKAGE}14.vcxproj ${PROJ})
+ endif()
+ENDFOREACH(LINKAGE)
message(STATUS "Upgrading projects done")
-vcpkg_build_msbuild(
- PROJECT_PATH ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj
-)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/build/vc12/glew_static14.vcxproj
+ )
+else()
+ vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/build/vc12/glew_shared14.vcxproj
+ )
+endif()
+
message(STATUS "Installing")
-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
-)
-file(INSTALL
- ${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/lib
-)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(INSTALL
+ ${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32d.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME glew32.lib
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib
+ )
+else()
+ file(INSTALL
+ ${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32sd.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
+ )
+endif()
+
file(INSTALL
${SOURCE_PATH}/include/GL
DESTINATION ${CURRENT_PACKAGES_DIR}/include
diff --git a/ports/glfw3/portfile.cmake b/ports/glfw3/portfile.cmake
index 8c0a90601..69f496969 100644
--- a/ports/glfw3/portfile.cmake
+++ b/ports/glfw3/portfile.cmake
@@ -12,9 +12,9 @@ if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/patch.stamp)
string(REPLACE "\"@GLFW_LIB_NAME@\"" "NAMES @GLFW_LIB_NAME@ @GLFW_LIB_NAME@dll"
CONFIG ${CONFIG}
)
- string(REPLACE "@PACKAGE_CMAKE_INSTALL_PREFIX@" "@PACKAGE_CMAKE_INSTALL_PREFIX@/../.."
- CONFIG ${CONFIG}
- )
+ #string(REPLACE "@PACKAGE_CMAKE_INSTALL_PREFIX@" "@PACKAGE_CMAKE_INSTALL_PREFIX@/../.."
+ # CONFIG ${CONFIG}
+ #)
file(WRITE ${SOURCE_PATH}/src/glfw3Config.cmake.in ${CONFIG})
file(APPEND ${SOURCE_PATH}/src/glfw3Config.cmake.in "set(GLFW3_LIBRARIES \${GLFW3_LIBRARY})\n")
file(WRITE ${CURRENT_BUILDTREES_DIR}/patch.stamp)
@@ -23,34 +23,41 @@ endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
- -DBUILD_SHARED_LIBS=ON
-DGLFW_BUILD_EXAMPLES=OFF
-DGLFW_BUILD_TESTS=OFF
-DGLFW_BUILD_DOCS=OFF
-DPACKAGE_CMAKE_INSTALL_PREFIX=\${CMAKE_CURRENT_LIST_DIR}/../..
- # OPTIONS_RELEASE -DOPTIMIZE=1
- # OPTIONS_DEBUG -DDEBUGGABLE=1
)
vcpkg_install_cmake()
-file(MAKE_DIRECTORY
- ${CURRENT_PACKAGES_DIR}/bin
- ${CURRENT_PACKAGES_DIR}/debug/bin
- ${CURRENT_PACKAGES_DIR}/share
-)
-file(RENAME ${CURRENT_PACKAGES_DIR}/lib/glfw3.dll ${CURRENT_PACKAGES_DIR}/bin/glfw3.dll)
-file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/glfw3.dll ${CURRENT_PACKAGES_DIR}/debug/bin/glfw3.dll)
-
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/glfw3 ${CURRENT_PACKAGES_DIR}/share/glfw3)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
-file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/glfw3/glfw3Targets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/glfw3/glfw3Targets-debug.cmake)
+file(READ ${CURRENT_PACKAGES_DIR}/share/glfw3/glfw3Targets.cmake _contents)
+set(pattern "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n")
+string(REPLACE "${pattern}${pattern}${pattern}" "${pattern}${pattern}" _contents "${_contents}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/glfw3/glfw3Targets.cmake ${_contents})
+
+file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/glfw3/glfw3Targets-debug.cmake _contents)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" _contents "${_contents}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/glfw3/glfw3Targets-debug.cmake "${_contents}")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/glfw3.lib)
-file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/glfw3.lib)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/glfw3.dll ${CURRENT_PACKAGES_DIR}/bin/glfw3.dll)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/glfw3.dll ${CURRENT_PACKAGES_DIR}/debug/bin/glfw3.dll)
+ foreach(_conf release
+ debug)
+ file(READ ${CURRENT_PACKAGES_DIR}/share/glfw3/glfw3Targets-${_conf}.cmake _contents)
+ string(REPLACE "lib/glfw3.dll" "bin/glfw3.dll" _contents "${_contents}")
+ file(WRITE ${CURRENT_PACKAGES_DIR}/share/glfw3/glfw3Targets-${_conf}.cmake "${_contents}")
+ endforeach()
+
+endif()
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glfw3)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/glfw3/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/glfw3/copyright)
diff --git a/ports/gli/CONTROL b/ports/gli/CONTROL
new file mode 100644
index 000000000..8d89bc2d1
--- /dev/null
+++ b/ports/gli/CONTROL
@@ -0,0 +1,3 @@
+Source: gli
+Version: 0.8.2
+Description: OpenGL Image (GLI) https://gli.g-truc.net
diff --git a/ports/gli/portfile.cmake b/ports/gli/portfile.cmake
new file mode 100644
index 000000000..c0854909f
--- /dev/null
+++ b/ports/gli/portfile.cmake
@@ -0,0 +1,20 @@
+#header-only library
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gli-0.8.2.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/g-truc/gli/archive/0.8.2.0.tar.gz"
+ FILENAME "0.8.2.0.tar.gz"
+ SHA512 c254a4e1497d0add985e4a882c552db99c512cc0e9cc72145d51a6e7deada817d624d9818099a47136a8a3ef1223a26a34e355e3c713166f0bb062e506059834
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+# Remove glm/CMakeLists.txt
+file(REMOVE ${SOURCE_PATH}/glm/CMakeLists.txt)
+
+# Put the license file where vcpkg expects it
+file(COPY ${SOURCE_PATH}/external/glm/copying.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/gli/)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/gli/copying.txt ${CURRENT_PACKAGES_DIR}/share/gli/copyright)
+
+# Copy the glm header files
+file(GLOB HEADER_FILES ${SOURCE_PATH}/gli/*)
+file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/gli)
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/glm/portfile.cmake b/ports/glm/portfile.cmake
index 6b749b2de..4780a1b39 100644
--- a/ports/glm/portfile.cmake
+++ b/ports/glm/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glm)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/globjects/CONTROL b/ports/globjects/CONTROL
new file mode 100644
index 000000000..7917bacac
--- /dev/null
+++ b/ports/globjects/CONTROL
@@ -0,0 +1,5 @@
+Source: globjects
+Maintainer: mattias@mattiascibien.net
+Version: 1.0.0
+Build-Depends: glbinding, glm
+Description: C++ library strictly wrapping OpenGL objects. <https://github.com/cginternals/globjects>
diff --git a/ports/globjects/portfile.cmake b/ports/globjects/portfile.cmake
new file mode 100644
index 000000000..5ab880ad6
--- /dev/null
+++ b/ports/globjects/portfile.cmake
@@ -0,0 +1,61 @@
+# 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/globjects-1.0.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/cginternals/globjects/archive/v1.0.0.zip"
+ FILENAME "globjects-1.0.0.zip"
+ SHA512 e03ae16786b11891a61f0e2f85b0d98a858d1bad3cf4c45944982d6a753dbaa8b28975dc02153360a5ac0f3be73fe86c91af130cfc0dda7459dd782f16868eeb
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH})
+#vcpkg_build_cmake()
+vcpkg_install_cmake()
+
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
+file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/globjects ${CURRENT_PACKAGES_DIR}/share/globjects)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake)
+
+file(READ ${CURRENT_PACKAGES_DIR}/debug/cmake/globjects/globjects-export-debug.cmake globjects_DEBUG_MODULE)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" globjects_DEBUG_MODULE "${globjects_DEBUG_MODULE}")
+string(REPLACE "globjectsd.dll" "bin/globjectsd.dll" globjects_DEBUG_MODULE "${globjects_DEBUG_MODULE}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-export-debug.cmake "${globjects_DEBUG_MODULE}")
+file(READ ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-export-release.cmake RELEASE_CONF)
+string(REPLACE "globjects.dll" "bin/globjects.dll" RELEASE_CONF "${RELEASE_CONF}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-export-release.cmake "${RELEASE_CONF}")
+file(REMOVE ${CURRENT_PACKAGES_DIR}/globjects-config.cmake)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/globjects-config.cmake)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-export.cmake ${CURRENT_PACKAGES_DIR}/share/globjects/globjects-config.cmake)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/globjects.dll ${CURRENT_PACKAGES_DIR}/bin/globjects.dll)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/globjectsd.dll ${CURRENT_PACKAGES_DIR}/debug/bin/globjectsd.dll)
+endif()
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake)
+file(RENAME ${CURRENT_PACKAGES_DIR}/data ${CURRENT_PACKAGES_DIR}/share/data)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/data)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/AUTHORS
+ ${CURRENT_PACKAGES_DIR}/LICENSE
+ ${CURRENT_PACKAGES_DIR}/README.md
+ ${CURRENT_PACKAGES_DIR}/VERSION
+ ${CURRENT_PACKAGES_DIR}/debug/AUTHORS
+ ${CURRENT_PACKAGES_DIR}/debug/LICENSE
+ ${CURRENT_PACKAGES_DIR}/debug/README.md
+ ${CURRENT_PACKAGES_DIR}/debug/VERSION
+ )
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/globjects)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/globjects/LICENSE ${CURRENT_PACKAGES_DIR}/share/globjects/copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/glog/portfile.cmake b/ports/glog/portfile.cmake
index 1790d8649..4895be694 100644
--- a/ports/glog/portfile.cmake
+++ b/ports/glog/portfile.cmake
@@ -6,12 +6,15 @@
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
-include(${CMAKE_TRIPLET_FILE})
+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/glog-0472b91c5defdf90cff7292e3bf7bd86770a9a0a)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/google/glog/archive/0472b91c5defdf90cff7292e3bf7bd86770a9a0a.zip"
- FILENAME "glog-0472b91c5defdf90cff7292e3bf7bd86770a9a0a"
+ FILENAME "glog-0472b91c5defdf90cff7292e3bf7bd86770a9a0a.zip"
SHA512 24506ad1cc05e8361379b925ecfc8f32cc47692a47598401cca340eb2a528fe28b8b0d3636983056c7910469d105095bd3bacacff6278bffa18d85603c3dbfa8
)
vcpkg_extract_source_archive(${ARCHIVE})
diff --git a/ports/glslang/0001-Fix-export-symbol-for-Windows.patch b/ports/glslang/0001-Fix-export-symbol-for-Windows.patch
new file mode 100644
index 000000000..80ce58da4
--- /dev/null
+++ b/ports/glslang/0001-Fix-export-symbol-for-Windows.patch
@@ -0,0 +1,86 @@
+From 1ccadd2cb6db3ce5a00635f65db21e561eb7f705 Mon Sep 17 00:00:00 2001
+From: vlj <vljn.ovi@gmail.com>
+Date: Fri, 25 Nov 2016 17:12:35 +0100
+Subject: [PATCH] Fix export symbol for Windows.
+
+---
+ StandAlone/CMakeLists.txt | 1 +
+ StandAlone/ResourceLimits.cpp | 3 +++
+ StandAlone/ResourceLimits.h | 10 ++++++++++
+ 3 files changed, 14 insertions(+)
+
+diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt
+index 231ba27..3aff02e 100644
+--- a/StandAlone/CMakeLists.txt
++++ b/StandAlone/CMakeLists.txt
+@@ -2,6 +2,7 @@ add_library(glslang-default-resource-limits
+ ${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
+ )
+ set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
++set_property(TARGET glslang-default-resource-limits PROPERTY COMPILE_DEFINITIONS DLLEXPORT)
+
+ target_include_directories(glslang-default-resource-limits
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+diff --git a/StandAlone/ResourceLimits.cpp b/StandAlone/ResourceLimits.cpp
+index e22ec80..634d9c9 100644
+--- a/StandAlone/ResourceLimits.cpp
++++ b/StandAlone/ResourceLimits.cpp
+@@ -41,6 +41,7 @@
+
+ namespace glslang {
+
++DLL_EXPORT
+ const TBuiltInResource DefaultTBuiltInResource = {
+ /* .MaxLights = */ 32,
+ /* .MaxClipPlanes = */ 6,
+@@ -137,6 +138,7 @@ const TBuiltInResource DefaultTBuiltInResource = {
+ /* .generalConstantMatrixVectorIndexing = */ 1,
+ }};
+
++DLL_EXPORT
+ std::string GetDefaultTBuiltInResourceString()
+ {
+ std::ostringstream ostream;
+@@ -239,6 +241,7 @@ std::string GetDefaultTBuiltInResourceString()
+ return ostream.str();
+ }
+
++DLL_EXPORT
+ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
+ {
+ static const char* delims = " \t\n\r";
+diff --git a/StandAlone/ResourceLimits.h b/StandAlone/ResourceLimits.h
+index 9c3eb3e..932a59f 100644
+--- a/StandAlone/ResourceLimits.h
++++ b/StandAlone/ResourceLimits.h
+@@ -39,17 +39,27 @@
+
+ #include "glslang/Include/ResourceLimits.h"
+
++#ifdef DLLEXPORT
++#define DLL_EXPORT __declspec(dllexport)
++#else
++#define DLL_EXPORT __declspec(dllimport)
++#endif
++
+ namespace glslang {
+
+ // These are the default resources for TBuiltInResources, used for both
+ // - parsing this string for the case where the user didn't supply one,
+ // - dumping out a template for user construction of a config file.
++
++DLL_EXPORT
+ extern const TBuiltInResource DefaultTBuiltInResource;
+
+ // Returns the DefaultTBuiltInResource as a human-readable string.
++DLL_EXPORT
+ std::string GetDefaultTBuiltInResourceString();
+
+ // Decodes the resource limits from |config| to |resources|.
++DLL_EXPORT
+ void DecodeResourceLimits(TBuiltInResource* resources, char* config);
+
+ } // end namespace glslang
+--
+2.10.2.windows.1
+
diff --git a/ports/glslang/CONTROL b/ports/glslang/CONTROL
new file mode 100644
index 000000000..3b81f5287
--- /dev/null
+++ b/ports/glslang/CONTROL
@@ -0,0 +1,3 @@
+Source: glslang
+Version: 1c573fbcfba6b3d631008b1babc838501ca925d3-1
+Description: Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator
diff --git a/ports/glslang/copyright b/ports/glslang/copyright
new file mode 100644
index 000000000..dfffea6a8
--- /dev/null
+++ b/ports/glslang/copyright
@@ -0,0 +1,35 @@
+//
+//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
+//Copyright (C) 2012-2013 LunarG, Inc.
+//
+//All rights reserved.
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+// Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+//
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//POSSIBILITY OF SUCH DAMAGE.
+//
diff --git a/ports/glslang/portfile.cmake b/ports/glslang/portfile.cmake
new file mode 100644
index 000000000..9fd6ae468
--- /dev/null
+++ b/ports/glslang/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)
+find_program(GIT git)
+
+set(GIT_URL "https://github.com/KhronosGroup/glslang.git")
+set(GIT_REF "1c573fbcfba6b3d631008b1babc838501ca925d3")
+
+if(NOT EXISTS "${DOWNLOADS}/glslang.git")
+ message(STATUS "Cloning")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/glslang.git
+ WORKING_DIRECTORY ${DOWNLOADS}
+ LOGNAME clone
+ )
+endif()
+
+if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
+ message(STATUS "Adding worktree and patching")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REF}
+ WORKING_DIRECTORY ${DOWNLOADS}/glslang.git
+ LOGNAME worktree
+ )
+ message(STATUS "Patching")
+endif()
+
+set(VCPKG_LIBRARY_LINKAGE "static")
+
+vcpkg_configure_cmake(
+ SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src"
+)
+
+vcpkg_install_cmake()
+
+file(COPY "${CURRENT_BUILDTREES_DIR}/src/glslang/Public" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang)
+file(COPY "${CURRENT_BUILDTREES_DIR}/src/glslang/Include" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang)
+file(COPY "${CURRENT_BUILDTREES_DIR}/src/glslang/MachineIndependent/Versions.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang/MachineIndependent)
+file(COPY "${CURRENT_BUILDTREES_DIR}/src/SPIRV/Logger.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/SPIRV)
+file(COPY "${CURRENT_BUILDTREES_DIR}/src/SPIRV/spirv.hpp" DESTINATION ${CURRENT_PACKAGES_DIR}/include/SPIRV)
+file(COPY "${CURRENT_BUILDTREES_DIR}/src/SPIRV/GlslangToSpv.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/SPIRV)
+file(COPY "${CURRENT_PACKAGES_DIR}/bin/glslangValidator.exe" DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
+file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/glslangValidator.exe")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/glslangValidator.exe")
+file(COPY "${CURRENT_PACKAGES_DIR}/bin/spirv-remap.exe" DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
+file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/spirv-remap.exe")
+file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/spirv-remap.exe")
+
+file(GLOB BIN_DIR "${CURRENT_PACKAGES_DIR}/bin/*")
+list(LENGTH BIN_DIR BIN_DIR_SIZE)
+if(${BIN_DIR_SIZE} EQUAL 0)
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
+endif()
+file(GLOB DEBUG_BIN_DIR "${CURRENT_PACKAGES_DIR}/debug/bin/*")
+list(LENGTH DEBUG_BIN_DIR DEBUG_BIN_DIR_SIZE)
+if(${DEBUG_BIN_DIR_SIZE} EQUAL 0)
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
+endif()
+
+# Handle copyright
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/glslang)
diff --git a/ports/grpc/CONTROL b/ports/grpc/CONTROL
index ece5b96ce..b9d19da4c 100644
--- a/ports/grpc/CONTROL
+++ b/ports/grpc/CONTROL
@@ -1,4 +1,4 @@
Source: grpc
-Version: 1.1.0-dev-1674f65
+Version: 1.1.0-dev-1674f65-1
Build-Depends: zlib, openssl, protobuf
Description: An RPC library and framework \ No newline at end of file
diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake
index 53f262c7e..ffd71d137 100644
--- a/ports/grpc/portfile.cmake
+++ b/ports/grpc/portfile.cmake
@@ -1,3 +1,7 @@
+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)
@@ -51,7 +55,9 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake
file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/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/gsl/portfile.cmake b/ports/gsl/portfile.cmake
index e674cf2e4..8ccd6f2c7 100644
--- a/ports/gsl/portfile.cmake
+++ b/ports/gsl/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gsl-fd5ad87bf25cb5e87104ee58106dee9bc809cd93)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/gtest/portfile.cmake b/ports/gtest/portfile.cmake
index 710736d0d..d1ba722d7 100644
--- a/ports/gtest/portfile.cmake
+++ b/ports/gtest/portfile.cmake
@@ -1,3 +1,7 @@
+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)
@@ -33,8 +37,6 @@ message(STATUS "Adding worktree and patching done")
vcpkg_configure_cmake(
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src
- OPTIONS
- -DBUILD_SHARED_LIBS=ON
)
vcpkg_install_cmake()
@@ -51,4 +53,15 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest_main.dll ${CURRENT_PACKAGES_
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)
+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)
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gtest_main.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gtest_main.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gmock.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gmock.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gmock_main.lib ${CURRENT_PACKAGES_DIR}/lib/manual-link/gmock_main.lib)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gtest.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gtest_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gtest_main.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gmock.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gmock_main.lib)
+
vcpkg_copy_pdbs()
diff --git a/ports/harfbuzz/0001-Add-an-extra-path-input-for-Freetype.patch b/ports/harfbuzz/0001-Add-an-extra-path-input-for-Freetype.patch
deleted file mode 100644
index 75b81c28f..000000000
--- a/ports/harfbuzz/0001-Add-an-extra-path-input-for-Freetype.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From be3c446b1dd798b835052188813ee4e7cf135a81 Mon Sep 17 00:00:00 2001
-From: Vincent Lejeune <vljn.ovi@gmail.com>
-Date: Wed, 12 Oct 2016 00:27:35 +0200
-Subject: [PATCH] Add an extra path input for Freetype.
-
----
- win32/config-msvc.mak | 3 +++
- win32/detectenv-msvc.mak | 2 +-
- 2 files changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak
-index e0c6468..1ad0913 100644
---- a/win32/config-msvc.mak
-+++ b/win32/config-msvc.mak
-@@ -124,6 +124,9 @@ HB_DEFINES = $(HB_DEFINES) /DHAVE_CAIRO=1
-
- # Enable freetype if desired
- !if "$(FREETYPE)" == "1"
-+HB_CFLAGS = \
-+ $(HB_CFLAGS) \
-+ /I$(FREETYPE_DIR)
- HB_DEFINES = $(HB_DEFINES) /DHAVE_FREETYPE=1
- HB_SOURCES = $(HB_SOURCES) $(HB_FT_sources)
- HB_HEADERS = $(HB_HEADERS) $(HB_FT_headers)
-diff --git a/win32/detectenv-msvc.mak b/win32/detectenv-msvc.mak
-index 83d8786..ad67493 100644
---- a/win32/detectenv-msvc.mak
-+++ b/win32/detectenv-msvc.mak
-@@ -129,7 +129,7 @@ LDFLAGS_ARCH = /machine:x86
- !if "$(VALID_CFGSET)" == "TRUE"
- CFLAGS = $(CFLAGS_ADD) /W3 /Zi /I.. /I..\src /I. /I$(PREFIX)\include
-
--LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(PREFIX)\lib /DEBUG
-+LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(PREFIX)\lib /libpath:$(VCPKG_LIB_DIR) /DEBUG
-
- !if "$(CFG)" == "debug"
- LDFLAGS = $(LDFLAGS_BASE)
---
-2.10.0.windows.1
-
diff --git a/ports/harfbuzz/0001-Set-d-suffix-for-debug-freetype-lib.patch b/ports/harfbuzz/0001-Set-d-suffix-for-debug-freetype-lib.patch
deleted file mode 100644
index fce3ba562..000000000
--- a/ports/harfbuzz/0001-Set-d-suffix-for-debug-freetype-lib.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 2be3a687a3079c3988d718293e4ee5d8fc9797b7 Mon Sep 17 00:00:00 2001
-From: vlj <vljn.ovi@gmail.com>
-Date: Sat, 8 Oct 2016 21:14:57 +0200
-Subject: [PATCH] Set d suffix for debug freetype lib.
-
----
- win32/config-msvc.mak | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak
-index 9cc6608..236aef7 100644
---- a/win32/config-msvc.mak
-+++ b/win32/config-msvc.mak
-@@ -12,7 +12,11 @@ HB_GLIB_LIBS = glib-2.0.lib
- HB_GOBJECT_DEP_LIBS = gobject-2.0.lib $(HB_GLIB_LIBS)
-
- # Freetype is needed for building FreeType support and hb-view
-+!if "$(CFG)" == "debug"
-+FREETYPE_LIB = freetyped.lib
-+!else
- FREETYPE_LIB = freetype.lib
-+!endif
-
- # Cairo is needed for building hb-view
- CAIRO_LIB = cairo.lib
---
-2.10.0.windows.1
-
diff --git a/ports/harfbuzz/CONTROL b/ports/harfbuzz/CONTROL
index dd5207077..6a54dc583 100644
--- a/ports/harfbuzz/CONTROL
+++ b/ports/harfbuzz/CONTROL
@@ -1,4 +1,4 @@
Source: harfbuzz
-Version: 1.3.2
+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 6a46dda10..ac3252455 100644
--- a/ports/harfbuzz/portfile.cmake
+++ b/ports/harfbuzz/portfile.cmake
@@ -6,36 +6,48 @@
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
-include(${CMAKE_TRIPLET_FILE})
+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/harfbuzz-1.3.2)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/harfbuzz-1.3.4)
find_program(NMAKE nmake)
vcpkg_download_distfile(ARCHIVE
- URLS "https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.3.2.tar.bz2"
- FILENAME "harfbuzz-1.3.2.tar.bz2"
- SHA512 19f846ee75d8a2d94da2a2b489fa8e54a5120599f998e451187f6695aa3931b28c491bbc0837892eaaebbd1da3441effe01f5f2470454f83cfa6a7c510ebcb32
+ URLS "https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.3.4.tar.bz2"
+ 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)
-vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-Add-an-extra-path-input-for-Freetype.patch"
- PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-Set-d-suffix-for-debug-freetype-lib.patch"
-)
+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" 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(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} VCPKG_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} VCPKG_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
)
@@ -43,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
)
@@ -52,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 ${CURRENT_BUILDTREES_DIR}/src/harfbuzz-1.3.2/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/harfbuzz)
+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/http-parser/CMakeLists.txt b/ports/http-parser/CMakeLists.txt
new file mode 100644
index 000000000..d959fff79
--- /dev/null
+++ b/ports/http-parser/CMakeLists.txt
@@ -0,0 +1,21 @@
+cmake_minimum_required (VERSION 3.4)
+project (http-parser)
+
+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"
+)
+
+if (NOT SKIP_INSTALL_HEADERS)
+ 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
new file mode 100644
index 000000000..605f3354c
--- /dev/null
+++ b/ports/http-parser/CONTROL
@@ -0,0 +1,3 @@
+Source: http-parser
+Version: 2.7.1-1
+Description: HTTP Parser. \ No newline at end of file
diff --git a/ports/http-parser/portfile.cmake b/ports/http-parser/portfile.cmake
new file mode 100644
index 000000000..728293eed
--- /dev/null
+++ b/ports/http-parser/portfile.cmake
@@ -0,0 +1,29 @@
+# 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/http-parser-2.7.1)
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "https://github.com/nodejs/http-parser/archive/v2.7.1.zip"
+ FILENAME "http-parser-2.7.1.zip"
+ SHA512 9fb8b855ba7edb47628c91ac062d7ffce9c4bb8d6b8237d861d7926af989fb3e354c113821bdab1b8ac910f5f1064ca1339947aa20d56f6806b919b0cd6b6eae
+)
+vcpkg_extract_source_archive(${ARCHIVE_FILE})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS_DEBUG
+ -DSKIP_INSTALL_HEADERS=ON
+)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE-MIT DESTINATION ${CURRENT_PACKAGES_DIR}/share/http-parser)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/http-parser/LICENSE-MIT ${CURRENT_PACKAGES_DIR}/share/http-parser/copyright) \ No newline at end of file
diff --git a/ports/icu/CONTROL b/ports/icu/CONTROL
new file mode 100644
index 000000000..80a6eb9a6
--- /dev/null
+++ b/ports/icu/CONTROL
@@ -0,0 +1,3 @@
+Source: icu
+Version: 58.2-1
+Description: Mature and widely used Unicode and localization library.
diff --git a/ports/icu/portfile.cmake b/ports/icu/portfile.cmake
new file mode 100644
index 000000000..f2bf7fb6e
--- /dev/null
+++ b/ports/icu/portfile.cmake
@@ -0,0 +1,83 @@
+if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+ message(FATAL_ERROR "Error: ARM and/or UWP builds are currently not supported.")
+endif()
+
+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/icu)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://download.icu-project.org/files/icu4c/58.2/icu4c-58_2-src.zip"
+ FILENAME "icu4c-58_2-src.zip"
+ SHA512 b985b553186d11d9e5157fc981af5483c435a7b4f3df9574d253d6229ecaf8af0f722488542c3f64f9726ad25e17978eae970d78300a55479df74495f6745d16)
+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}/source/allinone/allinone.sln
+ PLATFORM ${BUILD_ARCH})
+
+# force rebuild of database as it sometimes gets overriden by dummy one
+vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/source/data/makedata.vcxproj
+ PLATFORM ${BUILD_ARCH})
+
+set(ICU_VERSION 58)
+if(TRIPLET_SYSTEM_ARCH MATCHES "x64")
+ set(ICU_BIN bin64)
+ set(ICU_LIB lib64)
+else()
+ set(ICU_BIN bin)
+ set(ICU_LIB lib)
+endif()
+
+function(install_module MODULENAME)
+ if(${MODULENAME} STREQUAL icudt) # Database doesn't have debug mode
+ set(DEBUG_DLLNAME ${MODULENAME}${ICU_VERSION}.dll)
+ set(DEBUG_LIBNAME ${MODULENAME}.lib)
+ else()
+ set(DEBUG_DLLNAME ${MODULENAME}${ICU_VERSION}d.dll)
+ set(DEBUG_LIBNAME ${MODULENAME}d.lib)
+ endif()
+ set(RELEASE_DLLNAME ${MODULENAME}${ICU_VERSION}.dll)
+ set(RELEASE_LIBNAME ${MODULENAME}.lib)
+ file(INSTALL
+ ${SOURCE_PATH}/${ICU_BIN}/${RELEASE_DLLNAME}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+ file(INSTALL
+ ${SOURCE_PATH}/${ICU_BIN}/${DEBUG_DLLNAME}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(INSTALL
+ ${SOURCE_PATH}/${ICU_LIB}/${RELEASE_LIBNAME}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+ file(INSTALL
+ ${SOURCE_PATH}/${ICU_LIB}/${DEBUG_LIBNAME}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+endfunction()
+
+install_module(icuuc) # Common library
+install_module(icuio) # Unicode stdio
+install_module(icutu) # Tool utility library
+install_module(icuin) # I18n library
+install_module(icudt) # Database
+
+vcpkg_copy_pdbs()
+
+file(INSTALL
+ ${SOURCE_PATH}/include/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+file(COPY
+ ${SOURCE_PATH}/LICENSE
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/icu)
+file(RENAME
+ ${CURRENT_PACKAGES_DIR}/share/icu/LICENSE
+ ${CURRENT_PACKAGES_DIR}/share/icu/copyright)
diff --git a/ports/jsoncpp/CONTROL b/ports/jsoncpp/CONTROL
new file mode 100644
index 000000000..d4ac63bd3
--- /dev/null
+++ b/ports/jsoncpp/CONTROL
@@ -0,0 +1,3 @@
+Source: jsoncpp
+Version: 1.7.7
+Description: jsoncpp is an implementation of a JSON reader and writer in C++. JSON (JavaScript Object Notation) is a lightweight data-interchange format that it is easy to parse and redeable for human.
diff --git a/ports/jsoncpp/portfile.cmake b/ports/jsoncpp/portfile.cmake
new file mode 100644
index 000000000..f4b89adca
--- /dev/null
+++ b/ports/jsoncpp/portfile.cmake
@@ -0,0 +1,49 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/jsoncpp-1.7.7)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.zip"
+ FILENAME "jsoncpp-1.7.7.zip"
+ SHA512 3801faab0b1982bc41dac3049e0f7d24ea3dc759b77afc1ca7365b95a36460f87a74a0f5c6efd4c4a315ea2ca904b38f454b0a70133cda339c4a01ae8049cecb
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(JSONCPP_STATIC OFF)
+ set(JSONCPP_DYNAMIC ON)
+else()
+ set(JSONCPP_STATIC ON)
+ set(JSONCPP_DYNAMIC OFF)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DJSONCPP_WITH_CMAKE_PACKAGE:BOOL=ON
+ -DBUILD_STATIC_LIBS:BOOL=${JSONCPP_STATIC}
+ -DBUILD_SHARED_LIBS:BOOL=${JSONCPP_DYNAMIC}
+)
+
+vcpkg_install_cmake()
+
+# Fix CMake files
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/jsoncpp ${CURRENT_PACKAGES_DIR}/share/jsoncpp)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
+file(READ ${CURRENT_PACKAGES_DIR}/share/jsoncpp/jsoncppConfig.cmake _contents)
+string(REPLACE "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n\n" "\n" _contents "${_contents}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/jsoncpp/jsoncppConfig.cmake ${_contents})
+
+file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/jsoncpp/jsoncppConfig-debug.cmake _contents)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" _contents "${_contents}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/jsoncpp/jsoncppConfig-debug.cmake "${_contents}")
+
+# Remove useless files in debug
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/jsoncpp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/jsoncpp/LICENSE ${CURRENT_PACKAGES_DIR}/share/jsoncpp/copyright)
+
+# Copy pdb files
+vcpkg_copy_pdbs()
diff --git a/ports/jxrlib/CMakeLists.txt b/ports/jxrlib/CMakeLists.txt
new file mode 100644
index 000000000..17f16bea4
--- /dev/null
+++ b/ports/jxrlib/CMakeLists.txt
@@ -0,0 +1,102 @@
+# Copyright Mathieu Malaterre <malat@debian.org>
+# BSD (Same as jxrlib)
+# Based on https://jxrlib.codeplex.com/discussions/440294
+# and modified for vcpkg packaging
+cmake_minimum_required(VERSION 2.8)
+project(jxrlib C)
+
+# Need shared libs for ABI
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+
+# Add a debug postfix
+set(CMAKE_DEBUG_POSTFIX "d")
+
+# helper macro to preserve original Makefile convention
+macro(JXR_MAKE_OBJ SET_NAME)
+ foreach(src ${SRC_${SET_NAME}})
+ list(APPEND OBJ_${SET_NAME} ${DIR_${SET_NAME}}/${src})
+ endforeach()
+endmacro()
+
+include(TestBigEndian)
+test_big_endian(ISBIGENDIAN)
+if(ISBIGENDIAN)
+ set(DEF_ENDIAN _BIG__ENDIAN_)
+endif()
+
+set(DIR_SYS image/sys)
+set(DIR_DEC image/decode)
+set(DIR_ENC image/encode)
+
+set(DIR_GLUE jxrgluelib)
+set(DIR_TEST jxrtestlib)
+set(DIR_EXEC jxrencoderdecoder)
+
+if(NOT JXRLIB_INSTALL_BIN_DIR)
+ set(JXRLIB_INSTALL_BIN_DIR "bin")
+endif()
+
+if(NOT JXRLIB_INSTALL_LIB_DIR)
+ set(JXRLIB_INSTALL_LIB_DIR "lib")
+endif()
+
+if(NOT JXRLIB_INSTALL_INCLUDE_DIR)
+ set(JXRLIB_INSTALL_INCLUDE_DIR "include/jxrlib")
+endif()
+
+include_directories(
+ common/include
+ ${DIR_SYS}
+ ${DIR_GLUE}
+ ${DIR_TEST}
+)
+
+
+# JPEG-XR
+set(SRC_SYS adapthuff.c image.c strcodec.c strPredQuant.c strTransform.c perfTimerANSI.c)
+JXR_MAKE_OBJ(SYS)
+set(SRC_DEC decode.c postprocess.c segdec.c strdec.c strInvTransform.c strPredQuantDec.c JXRTranscode.c)
+JXR_MAKE_OBJ(DEC)
+set(SRC_ENC encode.c segenc.c strenc.c strFwdTransform.c strPredQuantEnc.c)
+JXR_MAKE_OBJ(ENC)
+
+add_library(jpegxr ${OBJ_ENC} ${OBJ_DEC} ${OBJ_SYS})
+set_property(TARGET jpegxr
+ PROPERTY COMPILE_DEFINITIONS DISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}
+)
+set_property(TARGET jpegxr PROPERTY LINK_INTERFACE_LIBRARIES "")
+install(TARGETS jpegxr
+ EXPORT JXRLibTargets
+ RUNTIME DESTINATION ${JXRLIB_INSTALL_BIN_DIR}
+ LIBRARY DESTINATION ${JXRLIB_INSTALL_LIB_DIR}
+ ARCHIVE DESTINATION ${JXRLIB_INSTALL_LIB_DIR}
+)
+
+# JXR-GLUE
+set(SRC_GLUE JXRGlue.c JXRMeta.c JXRGluePFC.c JXRGlueJxr.c)
+JXR_MAKE_OBJ(GLUE)
+set(SRC_TEST JXRTest.c JXRTestBmp.c JXRTestHdr.c JXRTestPnm.c JXRTestTif.c JXRTestYUV.c)
+JXR_MAKE_OBJ(TEST)
+
+add_library(jxrglue ${OBJ_GLUE} ${OBJ_TEST})
+set_property(TARGET jxrglue
+ PROPERTY COMPILE_DEFINITIONS DISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}
+)
+set_property(TARGET jxrglue PROPERTY LINK_INTERFACE_LIBRARIES "")
+install(TARGETS jxrglue
+ EXPORT JXRLibTargets
+ RUNTIME DESTINATION ${JXRLIB_INSTALL_BIN_DIR}
+ LIBRARY DESTINATION ${JXRLIB_INSTALL_LIB_DIR}
+ ARCHIVE DESTINATION ${JXRLIB_INSTALL_LIB_DIR}
+)
+
+target_link_libraries(jxrglue jpegxr)
+
+# install rules
+install(FILES jxrgluelib/JXRGlue.h jxrgluelib/JXRMeta.h jxrtestlib/JXRTest.h
+ image/sys/windowsmediaphoto.h
+ DESTINATION ${JXRLIB_INSTALL_INCLUDE_DIR} COMPONENT Headers
+)
+install(DIRECTORY common/include/ DESTINATION ${JXRLIB_INSTALL_INCLUDE_DIR}
+ FILES_MATCHING PATTERN "*.h"
+) \ No newline at end of file
diff --git a/ports/jxrlib/CONTROL b/ports/jxrlib/CONTROL
new file mode 100644
index 000000000..062850e06
--- /dev/null
+++ b/ports/jxrlib/CONTROL
@@ -0,0 +1,3 @@
+Source: jxrlib
+Version: 1.1-2
+Description: Open source implementation of the jpegxr image format standard.
diff --git a/ports/jxrlib/LICENSE b/ports/jxrlib/LICENSE
new file mode 100644
index 000000000..2b6f03f6c
--- /dev/null
+++ b/ports/jxrlib/LICENSE
@@ -0,0 +1,23 @@
+Copyright © Microsoft Corp.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ • Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ • Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/ports/jxrlib/portfile.cmake b/ports/jxrlib/portfile.cmake
new file mode 100644
index 000000000..57c9dc1fe
--- /dev/null
+++ b/ports/jxrlib/portfile.cmake
@@ -0,0 +1,29 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=jxrlib&changeSetId=e922fa50cdf9a58f40cad07553bcaa2883d3c5bf"
+ FILENAME "jxrlib_1_1.zip"
+ SHA512 6e8b579108444e9bea8d01f57e2ac3b63963c084adb8e265cfd82bb1199b8bd168b8aa41319cf34b87e97db1d72d0f3cc2d3dac881fcd1a6f398fe808d55772d
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+# The file guiddef.h is part of the Windows SDK,
+# we then remove the local copy shipped with jxrlib
+file(REMOVE ${SOURCE_PATH}/common/include/guiddef.h)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS:BOOL=ON
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/jxrlib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/jxrlib/LICENSE ${CURRENT_PACKAGES_DIR}/share/jxrlib/copyright)
+
+vcpkg_copy_pdbs() \ 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/0001_cmake.patch b/ports/libbson/0001_cmake.patch
deleted file mode 100644
index af1f1a598..000000000
--- a/ports/libbson/0001_cmake.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index d09a298..e64a6cd 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -12,7 +12,6 @@ include(CheckIncludeFile)
- include(CheckStructHasMember)
- include(CheckSymbolExists)
- include(TestBigEndian)
--include(InstallRequiredSystemLibraries)
-
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/build/cmake)
-
-@@ -47,13 +46,6 @@ TEST_BIG_ENDIAN(BSON_BIG_ENDIAN)
- set (BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES 0)
- set (BSON_HAVE_DECIMAL128 0)
-
--#librt needed on linux for clock_gettime
--find_library(RT_LIBRARY rt)
--if (RT_LIBRARY)
-- #set required libraries for CHECK_FUNCTION_EXISTS
-- set(CMAKE_REQUIRED_LIBRARIES ${RT_LIBRARY})
--endif()
--
- # See https://public.kitware.com/Bug/view.php?id=15659
- CHECK_SYMBOL_EXISTS(snprintf stdio.h BSON_HAVE_SNPRINTF)
- if (NOT BSON_HAVE_SNPRINTF)
-@@ -314,7 +306,7 @@ install(
- )
- install(
- FILES ${HEADERS}
-- DESTINATION "include/libbson-${BSON_API_VERSION}"
-+ DESTINATION "include"
- )
-
- set(VERSION "${BSON_VERSION}")
diff --git a/ports/libbson/CONTROL b/ports/libbson/CONTROL
index 71f48c354..371dfcf0c 100644
--- a/ports/libbson/CONTROL
+++ b/ports/libbson/CONTROL
@@ -1,3 +1,3 @@
Source: libbson
-Version: 1.4.2
+Version: 1.5.1
Description: libbson is a library providing useful routines related to building, parsing, and iterating BSON documents. \ No newline at end of file
diff --git a/ports/libbson/portfile.cmake b/ports/libbson/portfile.cmake
index ca7e97c16..ce2ccea40 100644
--- a/ports/libbson/portfile.cmake
+++ b/ports/libbson/portfile.cmake
@@ -1,25 +1,52 @@
-include(${CMAKE_TRIPLET_FILE})
-include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libbson-1.4.2)
-
-vcpkg_download_distfile(ARCHIVE
- URLS "https://github.com/mongodb/libbson/releases/download/1.4.2/libbson-1.4.2.tar.gz"
- FILENAME "libbson-1.4.2.tar.gz"
- SHA512 4cc8f833978483af3dcbc30bede33f2a9b448930fabf7be2d5581c8368e875dc1707d31eae209c747e69be1f82fa525c7362c5ac9c4e0b6b3f3346dd5147860e
-)
-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()
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-
-file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libbson)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/libbson/COPYING ${CURRENT_PACKAGES_DIR}/share/libbson/copyright) \ No newline at end of file
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libbson-1.5.1)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/mongodb/libbson/archive/1.5.1.tar.gz"
+ FILENAME "libbson-1.5.1.tar.gz"
+ SHA512 b641e23ca041e532fe566167ad0292d12934e0fae2c110f81bf6ca3b71b5d01b651a604a7ce6da0d1b54b98cd95674ef331ef4e23c2dedfc706f371eac4efaec
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DENABLE_TESTS=OFF
+ -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON
+)
+
+vcpkg_install_cmake()
+
+file(RENAME
+ ${CURRENT_PACKAGES_DIR}/include/libbson-1.0
+ ${CURRENT_PACKAGES_DIR}/temp)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include)
+file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include)
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/bson-1.0.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/bson-1.0.lib)
+
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/lib/bson-static-1.0.lib
+ ${CURRENT_PACKAGES_DIR}/lib/bson-1.0.lib)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/debug/lib/bson-static-1.0.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/bson-1.0.lib)
+
+ # drop the __declspec(dllimport) when building static
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/static.patch
+ )
+else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/bson-static-1.0.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/bson-static-1.0.lib)
+endif()
+
+file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libbson RENAME copyright) \ No newline at end of file
diff --git a/ports/libbson/static.patch b/ports/libbson/static.patch
new file mode 100644
index 000000000..adb52fa4f
--- /dev/null
+++ b/ports/libbson/static.patch
@@ -0,0 +1,13 @@
+diff --git a/bson-macros.h b/bson-macros.h
+index 909bf6c..0a1f612 100644
+--- a/bson-macros.h
++++ b/bson-macros.h
+@@ -69,7 +69,7 @@
+ # ifdef BSON_COMPILATION
+ # define BSON_API __declspec(dllexport)
+ # else
+-# define BSON_API __declspec(dllimport)
++# define BSON_API
+ # endif
+ #elif defined(__GNUC__)
+ # define BSON_API __attribute__ ((visibility ("default")))
diff --git a/ports/libccd/CONTROL b/ports/libccd/CONTROL
new file mode 100644
index 000000000..3a3a0252d
--- /dev/null
+++ b/ports/libccd/CONTROL
@@ -0,0 +1,3 @@
+Source: libccd
+Version: 2.0.0
+Description: Library for collision detection between two convex shapes
diff --git a/ports/libccd/portfile.cmake b/ports/libccd/portfile.cmake
new file mode 100644
index 000000000..963000ec5
--- /dev/null
+++ b/ports/libccd/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/libccd-16b9379fb6e8610566fe5e1396166daf7106f165)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/danfis/libccd/archive/16b9379fb6e8610566fe5e1396166daf7106f165.zip"
+ FILENAME "libccd-16b9379fb6e8610566fe5e1396166daf7106f165.zip"
+ SHA512 6cb3ea713f1b1ac1bf48c9ee7e14cb85b3ec5c822ce239330913edc00cb84c846b49ec090cbfa226ef8de70bac97199eb2bf4c651225e3cfc6f6a9dd441aa7db
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+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()
+
+# Avoid a copy of file in debug
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/BSD-LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libccd RENAME copyright)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
+
+# Miscellaneous cleanup
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/ccd)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/ccd)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
+
+vcpkg_copy_pdbs() \ No newline at end of file
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
new file mode 100644
index 000000000..afe55f55e
--- /dev/null
+++ b/ports/libflac/CMakeLists.txt
@@ -0,0 +1,73 @@
+cmake_minimum_required(VERSION 2.6)
+cmake_policy(SET CMP0005 NEW) # do not escape preprocessor defines
+
+project(libflac)
+
+if(NOT DEFINED LIBFLAC_ARCHITECTURE)
+ message(FATAL_ERROR "Target architecture not specified")
+endif()
+
+file(GLOB LIBFLAC_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/libFLAC/*.c
+ ${PROJECT_SOURCE_DIR}/src/share/win_utf8_io/win_utf8_io.c)
+
+file(GLOB LIBFLACXX_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/libFLAC++/*.cpp)
+
+include_directories(${PROJECT_SOURCE_DIR}/include)
+include_directories(${PROJECT_SOURCE_DIR}/src/libFLAC/include)
+
+if(NOT LIBFLAC_ARCHITECTURE MATCHES arm)
+ add_definitions(-DFLAC__SSE_OS)
+ add_definitions(-DFLAC__HAS_X86INTRIN)
+endif()
+
+if(LIBFLAC_ARCHITECTURE MATCHES x86)
+ add_definitions(-DFLAC__CPU_IA32)
+elseif(LIBFLAC_ARCHITECTURE MATCHES x64)
+ add_definitions(-DFLAC__CPU_X86_64)
+endif()
+
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+ add_definitions(-DFLAC__OVERFLOW_DETECT)
+endif()
+
+add_definitions(-DVERSION="1.3.1")
+add_definitions(-DFLAC__HAS_OGG)
+add_definitions(-DFLAC__ALIGN_MALLOC_DATA) # 32 byte boundary
+add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
+
+add_library(libFLAC ${LIBFLAC_SOURCES})
+add_library(libFLACXX ${LIBFLACXX_SOURCES})
+
+set_target_properties(libFLAC PROPERTIES OUTPUT_NAME flac)
+set_target_properties(libFLACXX PROPERTIES OUTPUT_NAME flac++)
+
+find_library(OGG_LIBRARY ogg)
+find_path(OGG_INCLUDE_DIR ogg/ogg.h)
+
+include_directories(${OGG_INCLUDE_DIR})
+target_link_libraries(libFLAC ${OGG_LIBRARY})
+target_link_libraries(libFLACXX libFLAC)
+
+if(BUILD_SHARED_LIBS)
+ set_target_properties(libFLACXX PROPERTIES COMPILE_FLAGS -DFLACPP_API_EXPORTS)
+ set_target_properties(libFLAC PROPERTIES COMPILE_FLAGS -DFLAC_API_EXPORTS)
+else()
+ add_definitions(-DFLAC__NO_DLL)
+endif()
+
+install(TARGETS libFLAC libFLACXX
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+
+if(NOT DEFINED LIBFLAC_SKIP_HEADERS)
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/FLAC/
+ DESTINATION include/FLAC
+ FILES_MATCHING PATTERN "*.h")
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/FLAC++/
+ DESTINATION include/FLAC++
+ FILES_MATCHING PATTERN "*.h")
+endif()
diff --git a/ports/libflac/CONTROL b/ports/libflac/CONTROL
new file mode 100644
index 000000000..9b1a37531
--- /dev/null
+++ b/ports/libflac/CONTROL
@@ -0,0 +1,4 @@
+Source: libflac
+Version: 1.3.1-1
+Description: Library for manipulating FLAC files
+Build-Depends: libogg
diff --git a/ports/libflac/portfile.cmake b/ports/libflac/portfile.cmake
new file mode 100644
index 000000000..4ed496fb8
--- /dev/null
+++ b/ports/libflac/portfile.cmake
@@ -0,0 +1,35 @@
+ # libFLAC uses winapi functions not available in WindowsStore
+if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm OR 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)
+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)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+
+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)
+
+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")
+endif()
+
+# This license (BSD) is relevant only for library - if someone would want to install
+# FLAC cmd line tools as well additional license (GPL) should be included
+file(COPY ${SOURCE_PATH}/COPYING.Xiph DESTINATION ${CURRENT_PACKAGES_DIR}/share/libflac)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libflac/COPYING.Xiph ${CURRENT_PACKAGES_DIR}/share/libflac/copyright)
diff --git a/ports/libiconv/0003-Fix-uwp.patch b/ports/libiconv/0003-Fix-uwp.patch
new file mode 100644
index 000000000..0b2444166
--- /dev/null
+++ b/ports/libiconv/0003-Fix-uwp.patch
@@ -0,0 +1,25 @@
+diff --git a/libcharset/lib/localcharset.c b/libcharset/lib/localcharset.c
+index 3aceb42..dadd95a 100644
+--- a/libcharset/lib/localcharset.c
++++ b/libcharset/lib/localcharset.c
+@@ -455,7 +455,10 @@ locale_charset (void)
+ # endif
+
+ #elif defined WIN32_NATIVE
+-
++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
++ // GetACP() not available to UWP apps
++ codeset = NULL;
++#else
+ static char buf[2 + 10 + 1];
+
+ /* Woe32 has a function returning the locale's codepage as a number:
+@@ -467,7 +470,7 @@ locale_charset (void)
+ encoding is the best bet. */
+ sprintf (buf, "CP%u", GetACP ());
+ codeset = buf;
+-
++#endif
+ #elif defined OS2
+
+ const char *locale;
diff --git a/ports/libiconv/CMakeLists.txt b/ports/libiconv/CMakeLists.txt
index 46575ca27..0d2a2a4d3 100644
--- a/ports/libiconv/CMakeLists.txt
+++ b/ports/libiconv/CMakeLists.txt
@@ -55,6 +55,8 @@ list(APPEND Libiconv_headers ${Libiconv_BINARY_DIR}/localcharset.h)
#
set(libname libiconv)
+add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+
configure_file(
${Libiconv_SOURCE_DIR}/include/iconv.h.build.in
${Libiconv_BINARY_DIR}/iconv.h
diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake
index dc1e1a3a3..46bd2f9e9 100644
--- a/ports/libiconv/portfile.cmake
+++ b/ports/libiconv/portfile.cmake
@@ -1,5 +1,5 @@
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14)
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz"
FILENAME "libiconv-1.14.tar.gz"
@@ -8,22 +8,23 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive(${ARCHIVE})
#Since libiconv uses automake, make and configure, we use a custom CMake file
-file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14/)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_apply_patches(
- SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14/
+ SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Add-export-definitions.patch
${CMAKE_CURRENT_LIST_DIR}/0002-Config-for-MSVC.patch
+ ${CMAKE_CURRENT_LIST_DIR}/0003-Fix-uwp.patch
)
vcpkg_configure_cmake(
- SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14
+ SOURCE_PATH ${SOURCE_PATH}
)
vcpkg_install_cmake()
# Handle copyright
-file(COPY ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.14/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/libiconv)
+file(COPY ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/libiconv)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libiconv/COPYING.LIB ${CURRENT_PACKAGES_DIR}/share/libiconv/copyright)
# clean out the debug include
diff --git a/ports/libjpeg-turbo/portfile.cmake b/ports/libjpeg-turbo/portfile.cmake
index ba68bc48b..aaa01547c 100644
--- a/ports/libjpeg-turbo/portfile.cmake
+++ b/ports/libjpeg-turbo/portfile.cmake
@@ -16,10 +16,19 @@ vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
set(ENV{PATH} "${NASM_EXE_PATH};$ENV{PATH}")
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(BUILD_STATIC OFF)
+ set(NOT_BUILD_STATIC ON)
+else()
+ set(BUILD_STATIC ON)
+ set(NOT_BUILD_STATIC OFF)
+endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
- -DENABLE_STATIC=OFF
+ -DENABLE_STATIC=${BUILD_STATIC}
+ -DENABLE_SHARED=${NOT_BUILD_STATIC}
-DWITH_CRT_DLL=ON
-DENABLE_EXECUTABLES=OFF
-DINSTALL_DOCS=OFF
@@ -29,6 +38,14 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
+# Rename libraries for static builds
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(RENAME "${CURRENT_PACKAGES_DIR}/lib/jpeg-static.lib" "${CURRENT_PACKAGES_DIR}/lib/jpeg.lib")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/lib/turbojpeg-static.lib" "${CURRENT_PACKAGES_DIR}/lib/turbojpeg.lib")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/jpeg-static.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/jpeg.lib")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/turbojpeg-static.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/turbojpeg.lib")
+endif()
+
file(COPY
${SOURCE_PATH}/LICENSE.md
DESTINATION ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo
diff --git a/ports/liblzma/CMakeLists.txt b/ports/liblzma/CMakeLists.txt
new file mode 100644
index 000000000..5bf723c2f
--- /dev/null
+++ b/ports/liblzma/CMakeLists.txt
@@ -0,0 +1,104 @@
+cmake_minimum_required(VERSION 3.0)
+project(liblzma)
+
+add_definitions(-DHAVE_CONFIG_H)
+if(BUILD_SHARED_LIBS)
+ add_definitions(-DLIBLZMADLL_EXPORTS)
+ add_definitions(-DDLL_EXPORT)
+endif()
+
+include_directories(windows)
+include_directories(src/liblzma/common)
+include_directories(src/common)
+include_directories(src/liblzma/api)
+include_directories(src/liblzma/check)
+include_directories(src/liblzma/delta)
+include_directories(src/liblzma/lz)
+include_directories(src/liblzma/lzma)
+include_directories(src/liblzma/rangecoder)
+include_directories(src/liblzma/simple)
+
+add_library(liblzma
+ src/common/tuklib_cpucores.c
+ src/common/tuklib_physmem.c
+ src/liblzma/check/check.c
+ src/liblzma/check/crc32_fast.c
+ src/liblzma/check/crc32_table.c
+ src/liblzma/check/crc64_fast.c
+ src/liblzma/check/crc64_table.c
+ src/liblzma/check/sha256.c
+ src/liblzma/common/alone_decoder.c
+ src/liblzma/common/alone_encoder.c
+ src/liblzma/common/auto_decoder.c
+ src/liblzma/common/block_buffer_decoder.c
+ src/liblzma/common/block_buffer_encoder.c
+ src/liblzma/common/block_decoder.c
+ src/liblzma/common/block_encoder.c
+ src/liblzma/common/block_header_decoder.c
+ src/liblzma/common/block_header_encoder.c
+ src/liblzma/common/block_util.c
+ src/liblzma/common/common.c
+ src/liblzma/common/easy_buffer_encoder.c
+ src/liblzma/common/easy_decoder_memusage.c
+ src/liblzma/common/easy_encoder.c
+ src/liblzma/common/easy_encoder_memusage.c
+ src/liblzma/common/easy_preset.c
+ src/liblzma/common/filter_buffer_decoder.c
+ src/liblzma/common/filter_buffer_encoder.c
+ src/liblzma/common/filter_common.c
+ src/liblzma/common/filter_decoder.c
+ src/liblzma/common/filter_encoder.c
+ src/liblzma/common/filter_flags_decoder.c
+ src/liblzma/common/filter_flags_encoder.c
+ src/liblzma/common/hardware_cputhreads.c
+ src/liblzma/common/hardware_physmem.c
+ src/liblzma/common/index.c
+ src/liblzma/common/index_decoder.c
+ src/liblzma/common/index_encoder.c
+ src/liblzma/common/index_hash.c
+ src/liblzma/common/outqueue.c
+ src/liblzma/common/stream_buffer_decoder.c
+ src/liblzma/common/stream_buffer_encoder.c
+ src/liblzma/common/stream_decoder.c
+ src/liblzma/common/stream_encoder.c
+ src/liblzma/common/stream_encoder_mt.c
+ src/liblzma/common/stream_flags_common.c
+ src/liblzma/common/stream_flags_decoder.c
+ src/liblzma/common/stream_flags_encoder.c
+ src/liblzma/common/vli_decoder.c
+ src/liblzma/common/vli_encoder.c
+ src/liblzma/common/vli_size.c
+ src/liblzma/delta/delta_common.c
+ src/liblzma/delta/delta_decoder.c
+ src/liblzma/delta/delta_encoder.c
+ src/liblzma/lzma/fastpos_table.c
+ src/liblzma/lzma/lzma2_decoder.c
+ src/liblzma/lzma/lzma2_encoder.c
+ src/liblzma/lzma/lzma_decoder.c
+ src/liblzma/lzma/lzma_encoder.c
+ src/liblzma/lzma/lzma_encoder_optimum_fast.c
+ src/liblzma/lzma/lzma_encoder_optimum_normal.c
+ src/liblzma/lzma/lzma_encoder_presets.c
+ src/liblzma/lz/lz_decoder.c
+ src/liblzma/lz/lz_encoder.c
+ src/liblzma/lz/lz_encoder_mf.c
+ src/liblzma/rangecoder/price_table.c
+ src/liblzma/simple/arm.c
+ src/liblzma/simple/armthumb.c
+ src/liblzma/simple/ia64.c
+ src/liblzma/simple/powerpc.c
+ src/liblzma/simple/simple_coder.c
+ src/liblzma/simple/simple_decoder.c
+ src/liblzma/simple/simple_encoder.c
+ src/liblzma/simple/sparc.c
+ src/liblzma/simple/x86.c)
+
+install(TARGETS liblzma
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+
+if(NOT LIBLZMA_SKIP_HEADERS)
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/liblzma/api/lzma DESTINATION include)
+ install(FILES ${PROJECT_SOURCE_DIR}/src/liblzma/api/lzma.h DESTINATION include)
+endif()
diff --git a/ports/liblzma/CONTROL b/ports/liblzma/CONTROL
new file mode 100644
index 000000000..648316130
--- /dev/null
+++ b/ports/liblzma/CONTROL
@@ -0,0 +1,3 @@
+Source: liblzma
+Version: 5.2.2
+Description: Compression library with an API similar to that of zlib.
diff --git a/ports/liblzma/auto-define-lzma-api-static.patch b/ports/liblzma/auto-define-lzma-api-static.patch
new file mode 100644
index 000000000..b2643fe6a
--- /dev/null
+++ b/ports/liblzma/auto-define-lzma-api-static.patch
@@ -0,0 +1,14 @@
+diff --git a/lzma.h b/lzma.h
+index ce675a7..ac0fc98 100644
+--- a/lzma.h
++++ b/lzma.h
+@@ -187,6 +187,9 @@
+ * need to worry about LZMA_API_STATIC. Also the calling convention is
+ * omitted on Cygwin but not on MinGW.
+ */
++
++#define LZMA_API_STATIC
++
+ #ifndef LZMA_API_IMPORT
+ # if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__)
+ # define LZMA_API_IMPORT __declspec(dllimport)
diff --git a/ports/liblzma/portfile.cmake b/ports/liblzma/portfile.cmake
new file mode 100644
index 000000000..bb2b6e083
--- /dev/null
+++ b/ports/liblzma/portfile.cmake
@@ -0,0 +1,29 @@
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/xz-5.2.2)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://tukaani.org/xz/xz-5.2.2.tar.gz"
+ FILENAME "xz-5.2.2.tar.gz"
+ SHA512 8d6249f93c5c43e1c8eeb21f93b22330fd54575e20bbb4af3d06721192d9f0ca3351878964c9640238ac410b7dd9f16329793c7be7355c7ca0db92c6db6ab813)
+
+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
+ -DLIBLZMA_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-lzma-api-static.patch)
+endif()
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/liblzma)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/liblzma/COPYING ${CURRENT_PACKAGES_DIR}/share/liblzma/copyright)
diff --git a/ports/libmariadb/CONTROL b/ports/libmariadb/CONTROL
new file mode 100644
index 000000000..26e23810a
--- /dev/null
+++ b/ports/libmariadb/CONTROL
@@ -0,0 +1,3 @@
+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
new file mode 100644
index 000000000..3dba9c7d1
--- /dev/null
+++ b/ports/libmariadb/portfile.cmake
@@ -0,0 +1,71 @@
+
+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/libmodplug/CONTROL b/ports/libmodplug/CONTROL
new file mode 100644
index 000000000..8aca622a4
--- /dev/null
+++ b/ports/libmodplug/CONTROL
@@ -0,0 +1,3 @@
+Source: libmodplug
+Version: 0.8.8.5-bb25b05
+Description: The ModPlug mod file playing library.
diff --git a/ports/libmodplug/automagically-define-modplug-static.patch b/ports/libmodplug/automagically-define-modplug-static.patch
new file mode 100644
index 000000000..b7982b2d3
--- /dev/null
+++ b/ports/libmodplug/automagically-define-modplug-static.patch
@@ -0,0 +1,13 @@
+diff --git a/libmodplug/modplug.h b/libmodplug/modplug.h
+index 3ffbf9d..fd19ae5 100644
+--- a/libmodplug/modplug.h
++++ b/libmodplug/modplug.h
+@@ -11,6 +11,8 @@
+ extern "C" {
+ #endif
+
++#define MODPLUG_STATIC
++
+ #if defined(_WIN32) || defined(__CYGWIN__)
+ # if defined(MODPLUG_BUILD) && defined(DLL_EXPORT) /* building libmodplug as a dll for windows */
+ # define MODPLUG_EXPORT __declspec(dllexport)
diff --git a/ports/libmodplug/portfile.cmake b/ports/libmodplug/portfile.cmake
new file mode 100644
index 000000000..6d2070975
--- /dev/null
+++ b/ports/libmodplug/portfile.cmake
@@ -0,0 +1,30 @@
+
+set(MODPLUG_HASH bb25b059a963f62aa0a3fe4c580da7da47f2b9c0)
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libmodplug-${MODPLUG_HASH})
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Konstanty/libmodplug/archive/${MODPLUG_HASH}.zip"
+ FILENAME "libmodplug-0.8.8.5-${MODPLUG_HASH}.zip"
+ SHA512 65840b7748284b400dfe99775e18f44dcc4846bc0ff522d18b9ded42c7032e10683e453110d530722d9e22547b7e5f4878ebfff92f232691cbd5b0638c48d88b)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH})
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/modplug.dll ${CURRENT_PACKAGES_DIR}/bin/modplug.dll)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/modplug.dll ${CURRENT_PACKAGES_DIR}/debug/bin/modplug.dll)
+ vcpkg_copy_pdbs()
+else()
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/automagically-define-modplug-static.patch)
+endif()
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmodplug)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libmodplug/COPYING ${CURRENT_PACKAGES_DIR}/share/libmodplug/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..4e5564972 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
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 ae2550f34..4d711fef5 100644
--- a/ports/libmysql/portfile.cmake
+++ b/ports/libmysql/portfile.cmake
@@ -1,64 +1,86 @@
-include(${CMAKE_TRIPLET_FILE})
-include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mysql-server-mysql-5.7.16)
-
-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}/debug/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
+)
+
+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/libodb-pgsql/CMakeLists.txt b/ports/libodb-pgsql/CMakeLists.txt
new file mode 100644
index 000000000..cb510e805
--- /dev/null
+++ b/ports/libodb-pgsql/CMakeLists.txt
@@ -0,0 +1,43 @@
+cmake_minimum_required(VERSION 3.0)
+project(libodb-pgsql VERSION 2.4.0 LANGUAGES CXX)
+find_package(odb 2.4.0 REQUIRED COMPONENTS libodb)
+find_package(PostgreSQL REQUIRED)
+set(LIBODB_INSTALL_HEADERS ON CACHE BOOL "Install the header files (a debug install)")
+file(GLOB_RECURSE libodb_src LIST_DIRECTORIES False
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ *.cxx)
+list(FILTER libodb_src EXCLUDE REGEX /posix/.*)
+add_library(libodb-pgsql ${libodb_src})
+target_include_directories(libodb-pgsql
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+
+)
+
+target_link_libraries(libodb-pgsql PRIVATE odb::libodb ${PostgreSQL_LIBRARY})
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(libodb-pgsql PRIVATE
+ -DLIBODB_PGSQL_DYNAMIC_LIB)
+else()
+ target_compile_definitions(libodb-pgsql PRIVATE
+ -DLIBODB_PGSQL_STATIC_LIB)
+endif()
+install(TARGETS libodb-pgsql EXPORT odb_pgsqlConfig
+ COMPONENT pgsql
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+if(LIBODB_INSTALL_HEADERS)
+install(DIRECTORY odb DESTINATION include/
+ COMPONENT sqlite
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "*.hxx"
+ PATTERN "*.ixx"
+ PATTERN "*.txx"
+)
+endif()
+install(EXPORT odb_pgsqlConfig NAMESPACE odb:: COMPONENT pgsql DESTINATION share/odb)
+export(TARGETS libodb-pgsql NAMESPACE odb:: FILE odb_pgsqlConfig.cmake) \ No newline at end of file
diff --git a/ports/libodb-pgsql/CONTROL b/ports/libodb-pgsql/CONTROL
new file mode 100644
index 000000000..a2daa777a
--- /dev/null
+++ b/ports/libodb-pgsql/CONTROL
@@ -0,0 +1,4 @@
+Source: libodb-pgsql
+Version: 2.4.0
+Description: Description: PostgreSQL support for the ODB ORM library
+Build-Depends: libodb, libpq \ No newline at end of file
diff --git a/ports/libodb-pgsql/portfile.cmake b/ports/libodb-pgsql/portfile.cmake
new file mode 100644
index 000000000..752f98b70
--- /dev/null
+++ b/ports/libodb-pgsql/portfile.cmake
@@ -0,0 +1,25 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libodb-pgsql-2.4.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.codesynthesis.com/download/odb/2.4/libodb-pgsql-2.4.0.tar.gz"
+ FILENAME "libodb-pgsql-2.4.0.tar.gz"
+ SHA512 535515356233b815f144c0098940174f7a530e7fa4e930c0a9ebdc255fdb8bac8cdcceac31f25be4864105323e00bfe50808efa648e7c8ffb5a944e52f514b69
+)
+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
+ -DLIBODB_INSTALL_HEADERS=OFF
+)
+vcpkg_build_cmake()
+vcpkg_install_cmake()
+
+file(READ ${CURRENT_PACKAGES_DIR}/debug/share/odb/odb_pgsqlConfig-debug.cmake LIBODB_DEBUG_TARGETS)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" LIBODB_DEBUG_TARGETS "${LIBODB_DEBUG_TARGETS}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/odb/odb_pgsqlConfig-debug.cmake "${LIBODB_DEBUG_TARGETS}")
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libodb-pgsql)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libodb-pgsql/LICENSE ${CURRENT_PACKAGES_DIR}/share/libodb-pgsql/copyright)
+vcpkg_copy_pdbs()
diff --git a/ports/libodb-sqlite/CMakeLists.txt b/ports/libodb-sqlite/CMakeLists.txt
new file mode 100644
index 000000000..bd1717899
--- /dev/null
+++ b/ports/libodb-sqlite/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.0)
+project(libodb-sqlite VERSION 2.4.0 LANGUAGES CXX)
+find_package(odb 2.4.0 REQUIRED COMPONENTS libodb)
+find_package(sqlite3 REQUIRED)
+set(LIBODB_INSTALL_HEADERS ON CACHE BOOL "Install the header files (a debug install)")
+file(GLOB_RECURSE libodb_src LIST_DIRECTORIES False
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ *.cxx)
+list(FILTER libodb_src EXCLUDE REGEX /posix/.*)
+add_library(libodb-sqlite ${libodb_src})
+target_include_directories(libodb-sqlite
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+
+)
+
+target_link_libraries(libodb-sqlite PRIVATE odb::libodb sqlite3)
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(libodb-sqlite PRIVATE
+ -DLIBODB_SQLITE_DYNAMIC_LIB
+ -DLIBODB_SQLITE_HAVE_UNLOCK_NOTIFY)
+else()
+ target_compile_definitions(libodb-sqlite PRIVATE
+ -DLIBODB_SQLITE_STATIC_LIB
+ -DLIBODB_SQLITE_HAVE_UNLOCK_NOTIFY)
+endif()
+install(TARGETS libodb-sqlite EXPORT odb_sqliteConfig
+ COMPONENT sqlite
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+if(LIBODB_INSTALL_HEADERS)
+install(DIRECTORY odb DESTINATION include/
+ COMPONENT sqlite
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "*.hxx"
+ PATTERN "*.ixx"
+ PATTERN "*.txx"
+)
+endif()
+install(EXPORT odb_sqliteConfig NAMESPACE odb:: COMPONENT sqlite DESTINATION share/odb)
+export(TARGETS libodb-sqlite NAMESPACE odb:: FILE odb_sqliteConfig.cmake) \ No newline at end of file
diff --git a/ports/libodb-sqlite/CONTROL b/ports/libodb-sqlite/CONTROL
new file mode 100644
index 000000000..5a87fb847
--- /dev/null
+++ b/ports/libodb-sqlite/CONTROL
@@ -0,0 +1,4 @@
+Source: libodb-sqlite
+Version: 2.4.0
+Description: Sqlite support for the ODB ORM library
+Build-Depends: libodb, sqlite3
diff --git a/ports/libodb-sqlite/portfile.cmake b/ports/libodb-sqlite/portfile.cmake
new file mode 100644
index 000000000..a1228f4ed
--- /dev/null
+++ b/ports/libodb-sqlite/portfile.cmake
@@ -0,0 +1,33 @@
+# 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/libodb-sqlite-2.4.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.codesynthesis.com/download/odb/2.4/libodb-sqlite-2.4.0.tar.gz"
+ FILENAME "libodb-sqlite-2.4.0.tar.gz"
+ SHA512 af16da7c82cf8845ca3b393fbd8957a92b05ebc925a5191f20d414ab558345850073cd9c46457d0ef0edfb12ebcb27f267b934c9c69ef598380242fe920c8577
+)
+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
+ -DLIBODB_INSTALL_HEADERS=OFF
+)
+vcpkg_build_cmake()
+vcpkg_install_cmake()
+
+file(READ ${CURRENT_PACKAGES_DIR}/debug/share/odb/odb_sqliteConfig-debug.cmake LIBODB_DEBUG_TARGETS)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" LIBODB_DEBUG_TARGETS "${LIBODB_DEBUG_TARGETS}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/odb/odb_sqliteConfig-debug.cmake "${LIBODB_DEBUG_TARGETS}")
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libodb-sqlite)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libodb-sqlite/LICENSE ${CURRENT_PACKAGES_DIR}/share/libodb-sqlite/copyright)
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/libodb/CMakeLists.txt b/ports/libodb/CMakeLists.txt
new file mode 100644
index 000000000..b4aef5817
--- /dev/null
+++ b/ports/libodb/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 3.0)
+project(libodb VERSION 2.4.0 LANGUAGES CXX)
+set(LIBODB_INSTALL_HEADERS ON CACHE BOOL "Install the header files (a debug install)")
+file(GLOB_RECURSE libodb_src LIST_DIRECTORIES False
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ *.cxx)
+list(FILTER libodb_src EXCLUDE REGEX /posix/.*)
+add_library(libodb ${libodb_src})
+target_include_directories(libodb
+ PUBLIC
+ $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+
+)
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(libodb PRIVATE
+ -DLIBODB_DYNAMIC_LIB)
+else()
+ target_compile_definitions(libodb PRIVATE
+ -DLIBODB_STATIC_LIB)
+endif()
+install(TARGETS libodb EXPORT odb_libodbConfig
+ COMPONENT libodb
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+if(LIBODB_INSTALL_HEADERS)
+install(DIRECTORY odb DESTINATION include/
+ COMPONENT libodb
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "*.hxx"
+ PATTERN "*.ixx"
+ PATTERN "*.txx"
+)
+endif()
+install(EXPORT odb_libodbConfig NAMESPACE odb:: COMPONENT libodb DESTINATION share/odb)
+export(TARGETS libodb NAMESPACE odb:: FILE odb_libodbConfig.cmake)
diff --git a/ports/libodb/CONTROL b/ports/libodb/CONTROL
new file mode 100644
index 000000000..f9645d098
--- /dev/null
+++ b/ports/libodb/CONTROL
@@ -0,0 +1,3 @@
+Source: libodb
+Version: 2.4.0
+Description: ODB library, base runtime for the ODB ORM solution
diff --git a/ports/libodb/odbConfig.cmake b/ports/libodb/odbConfig.cmake
new file mode 100644
index 000000000..afe51dc16
--- /dev/null
+++ b/ports/libodb/odbConfig.cmake
@@ -0,0 +1,10 @@
+set(_supported_components libodb sqlite pgsql)
+
+foreach(_comp ${odb_FIND_COMPONENTS})
+ if(NOT ";${_supported_components};" MATCHES _comp)
+ set(odb_FOUND False)
+ set(odb_NOTFOUND_MESSAGE "Unsupported component: ${_comp}")
+ endif()
+ include("${CMAKE_CURRENT_LIST_DIR}/odb_${_comp}Config.cmake")
+endforeach()
+set(odb_FOUND True) \ No newline at end of file
diff --git a/ports/libodb/portfile.cmake b/ports/libodb/portfile.cmake
new file mode 100644
index 000000000..21d715499
--- /dev/null
+++ b/ports/libodb/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)
+include(CMakePackageConfigHelpers)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libodb-2.4.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.codesynthesis.com/download/odb/2.4/libodb-2.4.0.tar.gz"
+ FILENAME "libodb-2.4.0.tar.gz"
+ SHA512 f1311458634695eb6ba307ebfd492e3b260e7beb06db1c5c46df58c339756be4006322cdc4e42d055bf5b2ad14ce4656ddcafcc4e16c282034db8a77d255c3eb
+)
+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
+ -DLIBODB_INSTALL_HEADERS=OFF
+)
+vcpkg_build_cmake()
+vcpkg_install_cmake()
+file(READ ${CURRENT_PACKAGES_DIR}/debug/share/odb/odb_libodbConfig-debug.cmake LIBODB_DEBUG_TARGETS)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" LIBODB_DEBUG_TARGETS "${LIBODB_DEBUG_TARGETS}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/odb/odb_libodbConfig-debug.cmake "${LIBODB_DEBUG_TARGETS}")
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/odbConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/odb)
+write_basic_package_version_file(${CURRENT_PACKAGES_DIR}/share/odb/odbConfigVersion.cmake
+ VERSION 2.4.0
+ COMPATIBILITY SameMajorVersion
+)
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libodb)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libodb/LICENSE ${CURRENT_PACKAGES_DIR}/share/libodb/copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/libogg/CONTROL b/ports/libogg/CONTROL
new file mode 100644
index 000000000..266cf4c2b
--- /dev/null
+++ b/ports/libogg/CONTROL
@@ -0,0 +1,3 @@
+Source: libogg
+Version: 1.3.2
+Description: Ogg is a multimedia container format, and the native file and stream format for the Xiph.org multimedia codecs.
diff --git a/ports/libogg/portfile.cmake b/ports/libogg/portfile.cmake
new file mode 100644
index 000000000..4127a6aef
--- /dev/null
+++ b/ports/libogg/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}
+#
+
+include(vcpkg_common_functions)
+find_program(GIT git)
+
+set(GIT_URL "https://git.xiph.org/ogg.git")
+set(GIT_REF "cab46b19847eb1d38aeda73ab4708716e5776366")
+
+if(NOT EXISTS "${DOWNLOADS}/ogg.git")
+ message(STATUS "Cloning")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/ogg.git
+ WORKING_DIRECTORY ${DOWNLOADS}
+ LOGNAME clone
+ )
+endif()
+
+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}/ogg.git
+ LOGNAME worktree
+ )
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src
+)
+
+vcpkg_install_cmake()
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+# Handle copyright
+file(COPY ${CURRENT_BUILDTREES_DIR}/src/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libogg)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libogg/COPYING ${CURRENT_PACKAGES_DIR}/share/libogg/copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/libpng/portfile.cmake b/ports/libpng/portfile.cmake
index 3b6768560..f7be6cca1 100644
--- a/ports/libpng/portfile.cmake
+++ b/ports/libpng/portfile.cmake
@@ -1,4 +1,3 @@
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libpng-1.6.24)
@@ -36,9 +35,7 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
-if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
- vcpkg_copy_pdbs()
-else()
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libpng16_static.lib ${CURRENT_PACKAGES_DIR}/lib/libpng16.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libpng16_staticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libpng16d.lib)
endif()
@@ -51,3 +48,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/libpng)
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpng)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpng/LICENSE ${CURRENT_PACKAGES_DIR}/share/libpng/copyright)
+vcpkg_copy_pdbs()
diff --git a/ports/libpq/CMakeLists.txt b/ports/libpq/CMakeLists.txt
new file mode 100644
index 000000000..54e929a5b
--- /dev/null
+++ b/ports/libpq/CMakeLists.txt
@@ -0,0 +1,82 @@
+cmake_minimum_required(VERSION 3.5)
+project(libpq VERSION 9.6.1 LANGUAGES C)
+
+find_package(OpenSSL REQUIRED)
+set(CMAKE_DEBUG_POSTFIX "d")
+configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config.h)
+configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h.win32 ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_ext.h)
+configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/port/win32.h ${CMAKE_CURRENT_LIST_DIR}/src/include/pg_config_os.h)
+file(WRITE src/interfaces/libpq/pg_config_paths.h "#define SYSCONFDIR \"\"")
+set(INSTALL_INCLUDES ON CACHE BOOL "Install include files")
+set(pg_port_src
+ src/port/getaddrinfo.c
+ src/port/pgstrcasecmp.c
+ src/port/pqsignal.c
+ src/port/thread.c
+ src/port/inet_aton.c
+ src/port/crypt.c
+ src/port/noblock.c
+ src/port/chklocale.c
+ src/port/inet_net_ntop.c
+ src/port/snprintf.c
+ src/port/strlcpy.c
+ src/port/dirent.c
+ src/port/dirmod.c
+ src/port/pgsleep.c
+ src/port/open.c
+ src/port/system.c
+ src/port/win32error.c
+ src/port/win32setlocale.c
+)
+set(pg_backend_src
+ src/backend/libpq/md5.c
+ src/backend/libpq/ip.c
+ src/backend/utils/mb/wchar.c
+ src/backend/utils/mb/encnames.c
+)
+set(pg_libpq_src
+ src/interfaces/libpq/fe-auth.c
+ src/interfaces/libpq/fe-connect.c
+ src/interfaces/libpq/fe-exec.c
+ src/interfaces/libpq/fe-lobj.c
+ src/interfaces/libpq/fe-misc.c
+ src/interfaces/libpq/fe-print.c
+ src/interfaces/libpq/fe-protocol2.c
+ src/interfaces/libpq/fe-protocol3.c
+ src/interfaces/libpq/fe-secure-openssl.c
+ src/interfaces/libpq/fe-secure.c
+ src/interfaces/libpq/libpq-events.c
+ src/interfaces/libpq/pqexpbuffer.c
+ src/interfaces/libpq/pthread-win32.c
+ src/interfaces/libpq/win32.c
+ src/interfaces/libpq/libpq-dist.rc
+)
+set(pg_libpq_interface
+ src/include/postgres_ext.h
+ src/include/pg_config_ext.h
+ src/include/pg_config.h
+ src/interfaces/libpq/libpq-fe.h
+ )
+set(pg_libpq_catalog_interface
+ src/include/catalog/pg_type.h
+ src/include/catalog/genbki.h
+)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_DEBUG_POSTFIX "d")
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+add_library(libpq ${pg_port_src} ${pg_backend_src} ${pg_libpq_src})
+target_compile_definitions(libpq PRIVATE -DFRONTEND -DENABLE_THREAD_SAFETY -DUSE_OPENSSL -D_CRT_SECURE_NO_WARNINGS)
+target_link_libraries(libpq PRIVATE OpenSSL::SSL ws2_32 secur32 advapi32 shell32)
+target_include_directories(libpq PRIVATE src/include src/include/port/win32 src/include/port/win32_msvc src/port)
+set_target_properties(libpq PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
+install(TARGETS libpq
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+ )
+if(INSTALL_INCLUDES)
+ install(FILES ${pg_libpq_interface} DESTINATION include)
+ install(DIRECTORY src/include/libpq DESTINATION include)
+ install(FILES ${pg_libpq_catalog_interface} DESTINATION include/catalog)
+endif() \ No newline at end of file
diff --git a/ports/libpq/CONTROL b/ports/libpq/CONTROL
new file mode 100644
index 000000000..580a06857
--- /dev/null
+++ b/ports/libpq/CONTROL
@@ -0,0 +1,4 @@
+Source: libpq
+Version: 9.6.1
+Description: The official database access API of postgresql
+Build-Depends: openssl
diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake
new file mode 100644
index 000000000..50ac67bb7
--- /dev/null
+++ b/ports/libpq/portfile.cmake
@@ -0,0 +1,33 @@
+# 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/postgresql-9.6.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://ftp.postgresql.org/pub/source/v9.6.1/postgresql-9.6.1.tar.bz2"
+ FILENAME "postgresql-9.6.1.tar.bz2"
+ SHA512 f27af67f9a96f6327150330bf091a803e10eabbac4e488cf5e4d72907e2eb1dbde7282fe0b89fd75711fd8bdcdb3688b5a9eac1e4d6871f4e8681c9c8b0e7c45
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
+ # OPTIONS_RELEASE -DOPTIMIZE=1
+ OPTIONS_DEBUG -DINSTALL_INCLUDES=OFF
+)
+
+vcpkg_install_cmake()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpq)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpq/COPYRIGHT ${CURRENT_PACKAGES_DIR}/share/libpq/copyright)
+
+
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/libraw/CONTROL b/ports/libraw/CONTROL
new file mode 100644
index 000000000..b10e10794
--- /dev/null
+++ b/ports/libraw/CONTROL
@@ -0,0 +1,4 @@
+Source: libraw
+Version: 0.17.2-2
+Build-Depends: libjpeg-turbo
+Description: raw image decoder library
diff --git a/ports/libraw/portfile.cmake b/ports/libraw/portfile.cmake
new file mode 100644
index 000000000..159251c28
--- /dev/null
+++ b/ports/libraw/portfile.cmake
@@ -0,0 +1,56 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LibRaw-0.17.2)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://www.libraw.org/data/LibRaw-0.17.2.zip"
+ FILENAME "LibRaw-0.17.2"
+ SHA512 97d34c84dafdcad300d607fbd4df7b120aea1ecdbc2783a8616bc423fa6a7a15adfbeb975f8dab021be09d08ef466c401a3b65bfd1abcfa49d31d4ab91873e60
+)
+set(LIBRAW_CMAKE_COMMIT "a71f3b83ee3dccd7be32f9a2f410df4d9bdbde0a")
+set(LIBRAW_CMAKE_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LibRaw-cmake-${LIBRAW_CMAKE_COMMIT})
+vcpkg_download_distfile(CMAKE_BUILD_ARCHIVE
+ URLS "https://github.com/LibRaw/LibRaw-cmake/archive/${LIBRAW_CMAKE_COMMIT}.zip"
+ FILENAME "LibRaw-cmake-${LIBRAW_CMAKE_COMMIT}"
+ SHA512 54216e6760e2339dc3bf4b4be533a13160047cabfc033a06da31f2226c43fc93eaea9672af83589e346ce9231c1a57910ac5e800759e692fe2cd9d53b7fba0c6
+)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_extract_source_archive(${CMAKE_BUILD_ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src)
+
+# Copy the CMake build system from the external repo
+file(COPY ${LIBRAW_CMAKE_SOURCE_PATH}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${LIBRAW_CMAKE_SOURCE_PATH}/cmake DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DINSTALL_CMAKE_MODULE_PATH=${CURRENT_PACKAGES_DIR}/share/libraw
+)
+
+vcpkg_install_cmake()
+
+# Rename thread-safe version to be "raw.lib". This is unfortunately needed
+# because otherwise libraries that build on top of libraw have to choose.
+file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/raw.lib ${CURRENT_PACKAGES_DIR}/debug/lib/raw.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/raw_r.lib ${CURRENT_PACKAGES_DIR}/lib/raw.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/raw_r.lib ${CURRENT_PACKAGES_DIR}/debug/lib/raw.lib)
+
+# Cleanup
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(GLOB RELEASE_EXECUTABLES ${CURRENT_PACKAGES_DIR}/bin/*.exe)
+file(REMOVE ${RELEASE_EXECUTABLES})
+file(GLOB DEBUG_EXECUTABLES ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
+file(REMOVE ${DEBUG_EXECUTABLES})
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/raw.dll ${CURRENT_PACKAGES_DIR}/debug/bin/raw.dll)
+endif()
+
+# Rename cmake module into a config in order to allow more flexible lookup rules
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libraw/FindLibRaw.cmake ${CURRENT_PACKAGES_DIR}/share/libraw/LibRaw-config.cmake)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/libraw)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libraw/COPYRIGHT ${CURRENT_PACKAGES_DIR}/share/libraw/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
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
new file mode 100644
index 000000000..715ffa0bd
--- /dev/null
+++ b/ports/libssh2/CONTROL
@@ -0,0 +1,4 @@
+Source: libssh2
+Version: 1.8.0-1
+Build-Depends: zlib, openssl
+Description: The SSH library \ No newline at end of file
diff --git a/ports/libssh2/LICENSE b/ports/libssh2/LICENSE
new file mode 100644
index 000000000..d629fbd3f
--- /dev/null
+++ b/ports/libssh2/LICENSE
@@ -0,0 +1,41 @@
+/* Copyright (c) 2004-2007 Sara Golemon <sarag@libssh2.org>
+ * Copyright (c) 2005,2006 Mikhail Gusarov <dottedmag@dottedmag.net>
+ * Copyright (c) 2006-2007 The Written Word, Inc.
+ * Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
+ * Copyright (c) 2009-2014 Daniel Stenberg
+ * Copyright (C) 2008, 2009 Simon Josefsson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms,
+ * with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the
+ * following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the copyright holder nor the names
+ * of any other contributors may be used to endorse or
+ * promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */ \ No newline at end of file
diff --git a/ports/libssh2/portfile.cmake b/ports/libssh2/portfile.cmake
new file mode 100644
index 000000000..2e3ee5009
--- /dev/null
+++ b/ports/libssh2/portfile.cmake
@@ -0,0 +1,36 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libssh2-1.8.0)
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "https://www.libssh2.org/download/libssh2-1.8.0.tar.gz"
+ FILENAME "libssh2-1.8.0.tar.gz"
+ SHA512 289aa45c4f99653bebf5f99565fe9c519abc204feb2084b47b7cc3badc8bf4ecdedd49ea6acdce8eb902b3c00995d5f92a3ca77b2508b92f04ae0e7de7287558
+)
+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
+ -DBUILD_EXAMPLES=OFF
+ -DBUILD_TESTING=OFF
+ -DENABLE_ZLIB_COMPRESSION=ON
+ OPTIONS_DEBUG
+ -DENABLE_DEBUG_LOGGING=OFF
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share)
+
+file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libssh2 RENAME copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/libtheora/CMakeLists.txt b/ports/libtheora/CMakeLists.txt
new file mode 100644
index 000000000..a13c5a8e6
--- /dev/null
+++ b/ports/libtheora/CMakeLists.txt
@@ -0,0 +1,68 @@
+project(theora)
+
+set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
+FIND_PACKAGE(OGG REQUIRED)
+
+file(GLOB HEADERS
+"include/theora/codec.h"
+"include/theora/theora.h"
+"include/theora/theoradec.h"
+)
+
+
+include_directories("include")
+include_directories(${OGG_INCLUDE_DIR})
+
+file(GLOB SOURCES
+"lib/analyze.c"
+"lib/encapiwrapper.c"
+"lib/encfrag.c"
+"lib/encinfo.c"
+"lib/encode.c"
+#"lib/encoder_disabled.c"
+"lib/enquant.c"
+"lib/fdct.c"
+"lib/huffenc.c"
+"lib/mathops.c"
+"lib/mcenc.c"
+"lib/rate.c"
+"lib/tokenize.c"
+"lib/x86_vc/mmxencfrag.c"
+"lib/x86_vc/mmxfdct.c"
+"lib/x86_vc/x86cpu.c"
+"lib/x86_vc/x86enc.c"
+"lib/apiwrapper.c"
+"lib/bitpack.c"
+"lib/decapiwrapper.c"
+"lib/decinfo.c"
+"lib/decode.c"
+"lib/dequant.c"
+"lib/fragment.c"
+"lib/huffdec.c"
+"lib/idct.c"
+"lib/info.c"
+"lib/internal.c"
+"lib/quant.c"
+"lib/state.c"
+"lib/x86_vc/mmxfrag.c"
+"lib/x86_vc/mmxidct.c"
+"lib/x86_vc/mmxstate.c"
+"lib/x86_vc/x86state.c"
+"win32/xmingw32/libtheoradec-all.def"
+)
+
+add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_BIND_TO_CURRENT_CRT_VERSION)
+if (${BUILD_SHARED_LIBS})
+ add_definitions(-DLIBTHEORA_EXPORTS)
+endif()
+
+add_library(theora ${SOURCES} ${HEADERS})
+target_link_libraries(theora ${OGG_LIBRARY})
+
+install(FILES ${HEADERS} DESTINATION include/theora)
+
+install(TARGETS theora
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION bin
+ ARCHIVE DESTINATION lib
+)
diff --git a/ports/libtheora/CONTROL b/ports/libtheora/CONTROL
new file mode 100644
index 000000000..7d373c1cf
--- /dev/null
+++ b/ports/libtheora/CONTROL
@@ -0,0 +1,4 @@
+Source: libtheora
+Version: 1.1.1
+Description: Theora is a free and open video compression format from the Xiph.org Foundation.
+Build-Depends: libogg
diff --git a/ports/libtheora/FindOGG.cmake b/ports/libtheora/FindOGG.cmake
new file mode 100644
index 000000000..fc0d15feb
--- /dev/null
+++ b/ports/libtheora/FindOGG.cmake
@@ -0,0 +1,8 @@
+find_path(OGG_INCLUDE_DIR NAMES ogg/ogg.h)
+
+find_library(OGG_LIBRARY NAMES ogg)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OGG DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR)
+
+mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY)
diff --git a/ports/libtheora/portfile.cmake b/ports/libtheora/portfile.cmake
new file mode 100644
index 000000000..0d63621e5
--- /dev/null
+++ b/ports/libtheora/portfile.cmake
@@ -0,0 +1,31 @@
+# Common Ambient Variables:
+# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
+# TARGET_TRIPLET is the current triplet (x86-windows, etc)
+# PORT is the current port name (zlib, etc)
+# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
+# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
+#
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libtheora-1.1.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"
+ FILENAME "libtheora-1.1.1.tar.bz2"
+ SHA512 9ab9b3af1c35d16a7d6d84f61f59ef3180132e30c27bdd7c0fa2683e0d00e2c791accbc7fd2c90718cc947d8bd10ee4a5940fb55f90f1fd7b0ed30583a47dbbd
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindOGG.cmake DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libtheora)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libtheora/LICENSE ${CURRENT_PACKAGES_DIR}/share/libtheora/copyright)
diff --git a/ports/libuv/CONTROL b/ports/libuv/CONTROL
index 32d44cf39..6401d169d 100644
--- a/ports/libuv/CONTROL
+++ b/ports/libuv/CONTROL
@@ -1,3 +1,3 @@
Source: libuv
-Version: 1.9.1
+Version: 1.10.1
Description: libuv is a multi-platform support library with a focus on asynchronous I/O. \ No newline at end of file
diff --git a/ports/libuv/portfile.cmake b/ports/libuv/portfile.cmake
index d5aafdb21..173d3bcdc 100644
--- a/ports/libuv/portfile.cmake
+++ b/ports/libuv/portfile.cmake
@@ -1,9 +1,9 @@
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.9.1)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src/libuv-1.10.1)
vcpkg_download_distfile(ARCHIVE
- URLS "https://github.com/libuv/libuv/archive/v1.9.1.zip"
- FILENAME "libuv-v1.9.1.zip"
- SHA512 3eb8711e3612fb3f5a1ddeb4614b2bec29c022ac5c6c2590bc5239825d758a73be0819c52747956a029859ef4e416bf3fce16665bac2c6c4890f736b47c38226
+ URLS "https://github.com/libuv/libuv/archive/v1.10.1.zip"
+ FILENAME "libuv-v1.10.1.zip"
+ SHA512 5a1e4b8e4584fccbc3df5bb46cf0efd7165169709d9b2a0e06fe534afbf7a262500cf665441ef64f8f7029b535f722119ab0faa4fb1367b05452d88a3e02bd2b
)
if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src)
@@ -16,49 +16,27 @@ if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-src)
)
endif()
-find_program(PYTHON2
- NAMES python2 python
- PATHS C:/python27 ENV PYTHON
-)
-if(NOT PYTHON2 MATCHES "NOTFOUND")
- execute_process(
- COMMAND ${PYTHON2} --version
- OUTPUT_VARIABLE PYTHON_VER_CHECK_OUT
- ERROR_VARIABLE PYTHON_VER_CHECK_ERR
- )
- set(PYTHON_VER_CHECK "${PYTHON_VER_CHECK_OUT}${PYTHON_VER_CHECK_ERR}")
- debug_message("PYTHON_VER_CHECK=${PYTHON_VER_CHECK}")
- if(NOT PYTHON_VER_CHECK MATCHES "Python 2.7")
- set(PYTHON2 PYTHON2-NOTFOUND)
- find_program(PYTHON2
- NAMES python2 python
- PATHS C:/python27 ENV PYTHON
- NO_SYSTEM_ENVIRONMENT_PATH
- )
- 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"
- "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"
- )
-endif()
+vcpkg_find_acquire_program(PYTHON2)
-set(ENV{GYP_MSVS_VERSION} 2015)
set(ENV{PYTHON} ${PYTHON2})
+set(ENV{GYP_MSVS_VERSION} 2015)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(LIBUV_LINKAGE shared)
+else()
+ set(LIBUV_LINKAGE static)
+endif()
if(TRIPLET_SYSTEM_ARCH MATCHES "x86|x64")
message(STATUS "Building Release")
vcpkg_execute_required_process(
- COMMAND cmd /c vcbuild.bat release ${TRIPLET_SYSTEM_ARCH} shared
+ COMMAND cmd /c vcbuild.bat release ${TRIPLET_SYSTEM_ARCH} ${LIBUV_LINKAGE}
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME ${TARGET_TRIPLET}-build-rel
)
message(STATUS "Building Debug")
vcpkg_execute_required_process(
- COMMAND cmd /c vcbuild.bat debug ${TRIPLET_SYSTEM_ARCH} shared
+ COMMAND cmd /c vcbuild.bat debug ${TRIPLET_SYSTEM_ARCH} ${LIBUV_LINKAGE}
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME ${TARGET_TRIPLET}-build-dbg
)
@@ -66,15 +44,7 @@ else()
message(FATAL_ERROR "Unsupported platform")
endif()
-file(MAKE_DIRECTORY
- ${CURRENT_PACKAGES_DIR}/include
- ${CURRENT_PACKAGES_DIR}/lib
- ${CURRENT_PACKAGES_DIR}/bin
- ${CURRENT_PACKAGES_DIR}/debug/lib
- ${CURRENT_PACKAGES_DIR}/debug/bin
- ${CURRENT_PACKAGES_DIR}/share/libuv
- )
-
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include)
file(COPY
${SOURCE_PATH}/include/tree.h
${SOURCE_PATH}/include/uv.h
@@ -84,23 +54,21 @@ file(COPY
${SOURCE_PATH}/include/uv-win.h
DESTINATION ${CURRENT_PACKAGES_DIR}/include)
-file(COPY
- ${SOURCE_PATH}/Debug/libuv.dll
- DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
-file(COPY
- ${SOURCE_PATH}/Debug/libuv.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
-file(COPY
- ${SOURCE_PATH}/Release/libuv.dll
- DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
-file(COPY
- ${SOURCE_PATH}/Release/libuv.lib
- DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
-file(COPY
- ${SOURCE_PATH}/LICENSE
- DESTINATION ${CURRENT_PACKAGES_DIR}/share/libuv)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib ${CURRENT_PACKAGES_DIR}/debug/lib)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(COPY ${SOURCE_PATH}/Debug/libuv.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+ file(COPY ${SOURCE_PATH}/Release/libuv.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+ file(COPY ${SOURCE_PATH}/Debug/libuv.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(COPY ${SOURCE_PATH}/Release/libuv.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+else()
+ file(COPY ${SOURCE_PATH}/Debug/lib/libuv.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+ file(COPY ${SOURCE_PATH}/Release/lib/libuv.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+endif()
+
+
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/libuv)
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libuv)
-file(RENAME
- ${CURRENT_PACKAGES_DIR}/share/libuv/LICENSE
- ${CURRENT_PACKAGES_DIR}/share/libuv/copyright)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libuv/LICENSE ${CURRENT_PACKAGES_DIR}/share/libuv/copyright)
vcpkg_copy_pdbs()
diff --git a/ports/libvorbis/0001-Add-vorbisenc.c-to-vorbis-library.patch b/ports/libvorbis/0001-Add-vorbisenc.c-to-vorbis-library.patch
new file mode 100644
index 000000000..0f713029d
--- /dev/null
+++ b/ports/libvorbis/0001-Add-vorbisenc.c-to-vorbis-library.patch
@@ -0,0 +1,25 @@
+From 0046f290a31b603a4caa9b728b54447b95ee5aa1 Mon Sep 17 00:00:00 2001
+From: vlj <vljn.ovi@gmail.com>
+Date: Mon, 24 Oct 2016 23:59:55 +0200
+Subject: [PATCH] Add vorbisenc.c to vorbis library.
+
+---
+ lib/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index a682ed4..2043294 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -68,7 +68,7 @@ include_directories(.)
+ include_directories(${OGG_INCLUDE_DIRS})
+
+ if (NOT BUILD_FRAMEWORK)
+- add_library(vorbis ${VORBIS_HEADERS} ${VORBIS_SOURCES})
++ add_library(vorbis ${VORBIS_HEADERS} ${VORBIS_SOURCES} ${VORBISENC_SOURCES})
+ add_library(vorbisenc ${VORBISENC_SOURCES})
+ add_library(vorbisfile ${VORBISFILE_SOURCES})
+
+--
+2.10.0.windows.1
+
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
new file mode 100644
index 000000000..db9b1f530
--- /dev/null
+++ b/ports/libvorbis/CONTROL
@@ -0,0 +1,4 @@
+Source: libvorbis
+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
new file mode 100644
index 000000000..757196caf
--- /dev/null
+++ b/ports/libvorbis/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 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)
+
+set(GIT_URL "https://git.xiph.org/vorbis.git")
+set(GIT_REF "143caf4023a90c09a5eb685fdd46fb9b9c36b1ee")
+
+if(NOT EXISTS "${DOWNLOADS}/vorbis.git")
+ message(STATUS "Cloning")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/vorbis.git
+ WORKING_DIRECTORY ${DOWNLOADS}
+ LOGNAME clone
+ )
+endif()
+
+if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
+ message(STATUS "Adding worktree and patching")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REF}
+ WORKING_DIRECTORY ${DOWNLOADS}/vorbis.git
+ LOGNAME worktree
+ )
+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)
+file(TO_NATIVE_PATH "${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/debug/lib/ogg.lib" OGG_LIB_DBG)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src
+ OPTIONS -DOGG_INCLUDE_DIRS=${OGG_INCLUDE}
+ OPTIONS_RELEASE -DOGG_LIBRARIES=${OGG_LIB_REL}
+ OPTIONS_DEBUG -DOGG_LIBRARIES=${OGG_LIB_DBG}
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${CURRENT_BUILDTREES_DIR}/src/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libvorbis)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libvorbis/COPYING ${CURRENT_PACKAGES_DIR}/share/libvorbis/copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/libwebp/0001-add-install-to-cmake.patch b/ports/libwebp/0001-add-install-to-cmake.patch
new file mode 100644
index 000000000..3f9cfc0c5
--- /dev/null
+++ b/ports/libwebp/0001-add-install-to-cmake.patch
@@ -0,0 +1,21 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3cb9c3b..f05800d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -276,6 +276,16 @@ foreach(I_FILE RANGE ${WEBP_SIMD_FILES_TO_INCLUDE_RANGE})
+ )
+ endforeach()
+
++# Install the headers
++file(GLOB PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/webp/*.h)
++install(FILES ${PUBLIC_HEADERS} DESTINATION include/webp)
++
++# Install the library
++install(TARGETS webp
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib)
++
+ # Build the executables if asked for.
+ if(WEBP_BUILD_CWEBP OR WEBP_BUILD_DWEBP)
+ # Example utility library.
diff --git a/ports/libwebp/0002-add-missing-directory-to-cmake.patch b/ports/libwebp/0002-add-missing-directory-to-cmake.patch
new file mode 100644
index 000000000..a1d230479
--- /dev/null
+++ b/ports/libwebp/0002-add-missing-directory-to-cmake.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9172f66..df46bd1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -249,6 +249,7 @@ parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/dec "${WEBP_SRCS}")
+ parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/demux "${WEBP_SRCS}")
+ parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/dsp "${WEBP_SRCS}")
+ parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/enc "${WEBP_SRCS}")
++parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/mux "${WEBP_SRCS}")
+ parse_Makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/utils "${WEBP_SRCS}")
+
+ # Remove the files specific to SIMD we don't user.
diff --git a/ports/libwebp/CONTROL b/ports/libwebp/CONTROL
new file mode 100644
index 000000000..608ba2f59
--- /dev/null
+++ b/ports/libwebp/CONTROL
@@ -0,0 +1,3 @@
+Source: libwebp
+Version: 0.5.1-1
+Description: Lossy compression of digital photographic images.
diff --git a/ports/libwebp/portfile.cmake b/ports/libwebp/portfile.cmake
new file mode 100644
index 000000000..8b4c653a9
--- /dev/null
+++ b/ports/libwebp/portfile.cmake
@@ -0,0 +1,31 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libwebp-0.5.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/webmproject/libwebp/archive/v0.5.1.zip"
+ FILENAME "libwebp-0.5.1.zip"
+ SHA512 1d9b218e3b6df50e7bc71b1338619b142a9dcd6cb7cbde2e7a4182b12a353f4f1d830b94dbeb7e6e8aac6e6613ec1aa368ce00a6945cdb7686eb94b287b9fd4e
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-add-install-to-cmake.patch
+ ${CMAKE_CURRENT_LIST_DIR}/0002-add-missing-directory-to-cmake.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ # dllexport support seem to be broken
+ OPTIONS -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS:BOOL=ON
+ -DCMAKE_DEBUG_POSTFIX=d
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libwebp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libwebp/COPYING ${CURRENT_PACKAGES_DIR}/share/libwebp/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
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 5253f6fa8..43502a52a 100644
--- a/ports/libwebsockets/portfile.cmake
+++ b/ports/libwebsockets/portfile.cmake
@@ -1,3 +1,7 @@
+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/libwebsockets-2.0.0)
vcpkg_download_distfile(ARCHIVE
@@ -7,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/libxml2/0001-Fix-makefile.patch b/ports/libxml2/0001-Fix-makefile.patch
new file mode 100644
index 000000000..0e6c774dd
--- /dev/null
+++ b/ports/libxml2/0001-Fix-makefile.patch
@@ -0,0 +1,60 @@
+---
+ win32/Makefile.msvc | 22 ++++++++++++----------
+ 1 file changed, 12 insertions(+), 10 deletions(-)
+
+diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
+index d16c1a2..de9e22e 100644
+--- a/win32/Makefile.msvc
++++ b/win32/Makefile.msvc
+@@ -28,11 +28,11 @@ XML_A = $(XML_BASENAME)_a.lib
+ XML_A_DLL = $(XML_BASENAME)_a_dll.lib
+
+ # Place where we let the compiler put its output.
+-BINDIR = bin.msvc
+-XML_INTDIR = int.msvc
+-XML_INTDIR_A = int.a.msvc
+-XML_INTDIR_A_DLL = int.a.dll.msvc
+-UTILS_INTDIR = int.utils.msvc
++BINDIR = $(OUTDIR)\bin.msvc
++XML_INTDIR = $(OUTDIR)\int.msvc
++XML_INTDIR_A = $(OUTDIR)\int.a.msvc
++XML_INTDIR_A_DLL = $(OUTDIR)\int.a.dll.msvc
++UTILS_INTDIR = $(OUTDIR)\int.utils.msvc
+
+ # The preprocessor and its options.
+ CPP = cl.exe /EP
+@@ -72,16 +72,18 @@ LIBS =
+ LIBS = $(LIBS) wsock32.lib ws2_32.lib
+ !endif
+ !if "$(WITH_ICONV)" == "1"
+-LIBS = $(LIBS) iconv.lib
++LIBS = $(LIBS) libiconv.lib libcharset.lib
+ !endif
+ !if "$(WITH_ICU)" == "1"
+ LIBS = $(LIBS) icu.lib
+ !endif
+ !if "$(WITH_ZLIB)" == "1"
+-# could be named differently zdll or zlib
+-# LIBS = $(LIBS) zdll.lib
++!if "$(DEBUG)" == "1"
++LIBS = $(LIBS) zlibd.lib
++!else
+ LIBS = $(LIBS) zlib.lib
+ !endif
++!endif
+ !if "$(WITH_LZMA)" == "1"
+ LIBS = $(LIBS) liblzma.lib
+ !endif
+@@ -101,10 +103,10 @@ ARFLAGS = /nologo
+ CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7
+ LDFLAGS = $(LDFLAGS) /DEBUG
+ !else
+ CFLAGS = $(CFLAGS) /D "NDEBUG" /O2
+ # commented out as this break VC10 c.f. 634846
+ # LDFLAGS = $(LDFLAGS) /OPT:NOWIN98
+-LDFLAGS = $(LDFLAGS)
++LDFLAGS = $(LDFLAGS) /DEBUG /OPT:REF /OPT:ICF
+ !endif
+
+ # Libxml object files.
+--
diff --git a/ports/libxml2/CONTROL b/ports/libxml2/CONTROL
new file mode 100644
index 000000000..538060dae
--- /dev/null
+++ b/ports/libxml2/CONTROL
@@ -0,0 +1,4 @@
+Source: libxml2
+Version: 2.9.4
+Description: Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform)
+Build-Depends: zlib, libiconv
diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake
new file mode 100644
index 000000000..bb4e043b3
--- /dev/null
+++ b/ports/libxml2/portfile.cmake
@@ -0,0 +1,169 @@
+# 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/libxml2-2.9.4)
+vcpkg_download_distfile(ARCHIVE
+ URLS "ftp://xmlsoft.org/libxml2/libxml2-2.9.4.tar.gz"
+ FILENAME "libxml2-2.9.4.tar.gz"
+ SHA512 f5174ab1a3a0ec0037a47f47aa47def36674e02bfb42b57f609563f84c6247c585dbbb133c056953a5adb968d328f18cbc102eb0d00d48eb7c95478389e5daf9
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+find_program(NMAKE nmake)
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}/
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-makefile.patch
+)
+
+set(SCRIPTS_DIR ${SOURCE_PATH}/win32)
+
+set(CONFIGURE_COMMAND_TEMPLATE cscript configure.js
+ zlib=yes
+ cruntime=@CRUNTIME@
+ debug=@DEBUGMODE@
+ prefix=@INSTALL_DIR@
+ include=@INCLUDE_DIR@
+ lib=@LIB_DIR@
+ bindir=@INSTALL_BIN_DIR@
+)
+
+
+#
+# Release
+#
+
+message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
+
+if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ set(CRUNTIME /MD)
+else()
+ set(CRUNTIME /MT)
+endif()
+set(DEBUGMODE no)
+set(LIB_DIR ${CURRENT_INSTALLED_DIR}/lib)
+set(INCLUDE_DIR ${CURRENT_INSTALLED_DIR}/include)
+set(INSTALL_DIR ${CURRENT_PACKAGES_DIR})
+set(INSTALL_BIN_DIR "$(PREFIX)/tools")
+file(TO_NATIVE_PATH "${LIB_DIR}" LIB_DIR)
+file(TO_NATIVE_PATH "${INCLUDE_DIR}" INCLUDE_DIR)
+file(TO_NATIVE_PATH "${INSTALL_DIR}" INSTALL_DIR)
+file(TO_NATIVE_PATH "${INSTALL_BIN_DIR}" INSTALL_BIN_DIR)
+string(CONFIGURE "${CONFIGURE_COMMAND_TEMPLATE}" CONFIGURE_COMMAND)
+vcpkg_execute_required_process(
+ COMMAND ${CONFIGURE_COMMAND}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME config-${TARGET_TRIPLET}-rel
+)
+# Handle build output directory
+file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" OUTDIR)
+file(MAKE_DIRECTORY "${OUTDIR}")
+message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
+
+message(STATUS "Building ${TARGET_TRIPLET}-rel")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /f Makefile.msvc rebuild OUTDIR=${OUTDIR}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME build-${TARGET_TRIPLET}-rel
+)
+message(STATUS "Building ${TARGET_TRIPLET}-rel done")
+
+message(STATUS "Installing ${TARGET_TRIPLET}-rel")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /f Makefile.msvc install OUTDIR=${OUTDIR}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME install-${TARGET_TRIPLET}-rel
+)
+message(STATUS "Installing ${TARGET_TRIPLET}-rel done")
+
+
+#
+# Debug
+#
+
+message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
+
+if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ set(CRUNTIME /MDd)
+else()
+ set(CRUNTIME /MTd)
+endif()
+set(DEBUGMODE yes)
+set(LIB_DIR ${CURRENT_INSTALLED_DIR}/debug/lib)
+set(INSTALL_DIR ${CURRENT_PACKAGES_DIR}/debug)
+file(TO_NATIVE_PATH "${LIB_DIR}" LIB_DIR)
+file(TO_NATIVE_PATH "${INSTALL_DIR}" INSTALL_DIR)
+string(CONFIGURE "${CONFIGURE_COMMAND_TEMPLATE}" CONFIGURE_COMMAND)
+
+vcpkg_execute_required_process(
+ COMMAND ${CONFIGURE_COMMAND}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME config-${TARGET_TRIPLET}-dbg
+)
+# Handle build output directory
+file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" OUTDIR)
+file(MAKE_DIRECTORY "${OUTDIR}")
+message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
+
+message(STATUS "Building ${TARGET_TRIPLET}-dbg")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /f Makefile.msvc rebuild OUTDIR=${OUTDIR}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME build-${TARGET_TRIPLET}-dbg
+)
+message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
+
+message(STATUS "Installing ${TARGET_TRIPLET}-dbg")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /f Makefile.msvc install OUTDIR=${OUTDIR}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME install-${TARGET_TRIPLET}-dbg
+)
+message(STATUS "Installing ${TARGET_TRIPLET}-dbg done")
+
+#
+# Cleanup
+#
+
+# You have to define LIBXML_STATIC or not, depending on how you link
+file(READ ${CURRENT_PACKAGES_DIR}/include/libxml2/libxml/xmlexports.h XMLEXPORTS_H)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ string(REPLACE "!defined(LIBXML_STATIC)" "0" XMLEXPORTS_H "${XMLEXPORTS_H}")
+else()
+ string(REPLACE "!defined(LIBXML_STATIC)" "1" XMLEXPORTS_H "${XMLEXPORTS_H}")
+endif()
+file(WRITE ${CURRENT_PACKAGES_DIR}/include/libxml2/libxml/xmlexports.h "${XMLEXPORTS_H}")
+
+# Remove tools and debug include directories
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/tools)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/tools)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Move includes to the expected directory
+file(RENAME ${CURRENT_PACKAGES_DIR}/include/libxml2/libxml ${CURRENT_PACKAGES_DIR}/include/libxml)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/libxml2)
+
+# The makefile builds both static and dynamic libraries, so remove the ones we don't want
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libxml2_a.lib ${CURRENT_PACKAGES_DIR}/lib/libxml2_a_dll.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2_a_dll.lib)
+else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libxml2.lib ${CURRENT_PACKAGES_DIR}/lib/libxml2_a_dll.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2_a_dll.lib)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+ # Rename the libs to match the dynamic lib names
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libxml2_a.lib ${CURRENT_PACKAGES_DIR}/lib/libxml2.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libxml2.lib)
+endif()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxml2)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libxml2/COPYING ${CURRENT_PACKAGES_DIR}/share/libxml2/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/libxslt/0001-Fix-makefile.patch b/ports/libxslt/0001-Fix-makefile.patch
new file mode 100644
index 000000000..73d627860
--- /dev/null
+++ b/ports/libxslt/0001-Fix-makefile.patch
@@ -0,0 +1,73 @@
+---
+ win32/Makefile.msvc | 29 +++++++++++++++--------------
+ 1 file changed, 15 insertions(+), 14 deletions(-)
+
+diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
+index 23a02d2..b13dd26 100644
+--- a/win32/Makefile.msvc
++++ b/win32/Makefile.msvc
+@@ -22,7 +22,7 @@ BASEDIR = ..
+ XSLT_SRCDIR = $(BASEDIR)\libxslt
+ EXSLT_SRCDIR = $(BASEDIR)\libexslt
+ UTILS_SRCDIR = $(BASEDIR)\xsltproc
+-BINDIR = bin.msvc
++BINDIR = $(OUTDIR)\bin.msvc
+
+ # Names of various input and output components.
+ XSLT_NAME = xslt
+@@ -39,11 +39,11 @@ EXSLT_DEF = $(EXSLT_BASENAME).def
+ EXSLT_A = $(EXSLT_BASENAME)_a.lib
+
+ # Places where intermediate files produced by the compiler go
+-XSLT_INTDIR = int.xslt.msvc
+-XSLT_INTDIR_A = int.xslta.msvc
+-EXSLT_INTDIR = int.exslt.msvc
+-EXSLT_INTDIR_A = int.exslta.msvc
+-UTILS_INTDIR = int.utils.msvc
++XSLT_INTDIR = $(OUTDIR)\int.xslt.msvc
++XSLT_INTDIR_A = $(OUTDIR)\int.xslta.msvc
++EXSLT_INTDIR = $(OUTDIR)\int.exslt.msvc
++EXSLT_INTDIR_A = $(OUTDIR)\int.exslta.msvc
++UTILS_INTDIR = $(OUTDIR)\int.utils.msvc
+
+ # The preprocessor and its options.
+ CPP = cl.exe /EP
+@@ -59,7 +59,13 @@ CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
+ LD = link.exe
+ LDFLAGS = /nologo
+ LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX)
+-LIBS = wsock32.lib
++# The libraries are needed for static builds (the makefile builds all tools and dlls)
++LIBS = wsock32.lib libiconv.lib libcharset.lib
++!if "$(DEBUG)" == "1"
++LIBS = $(LIBS) zlibd.lib
++!else
++LIBS = $(LIBS) zlib.lib
++!endif
+
+ # The archiver and its options.
+ AR = lib.exe
+@@ -71,6 +77,7 @@ CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7
+ LDFLAGS = $(LDFLAGS) /DEBUG
+ !else
+ CFLAGS = $(CFLAGS) /D "NDEBUG" /O2
++LDFLAGS = $(LDFLAGS) /DEBUG /OPT:REF /OPT:ICF
+ !endif
+
+ # Libxslt object files.
+@@ -309,13 +316,7 @@ $(UTILS_INTDIR) :
+ # An implicit rule for xsltproc and friends.
+ APPLIBS = $(LIBS)
+ !if "$(STATIC)" == "1"
+-APPLIBS = $(LIBS) libxml2_a.lib
+-!if "$(WITH_ICONV)" == "1"
+-APPLIBS = $(APPLIBS) iconv.lib
+-!endif
+-!if "$(WITH_ZLIB)" == "1"
+-APPLIBS = $(APPLIBS) zlib.lib
+-!endif
++APPLIBS = $(LIBS) libxml2.lib
+ {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
+ $(CC) /D "LIBXML_STATIC" /D "LIBXSLT_STATIC" /D "LIBEXSLT_STATIC" \
+ $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $<
+--
diff --git a/ports/libxslt/CONTROL b/ports/libxslt/CONTROL
new file mode 100644
index 000000000..c329b8705
--- /dev/null
+++ b/ports/libxslt/CONTROL
@@ -0,0 +1,4 @@
+Source: libxslt
+Version: 1.1.29
+Description: Libxslt is a XSLT library implemented in C for XSLT 1.0 and most of EXSLT
+Build-Depends: libxml2
diff --git a/ports/libxslt/portfile.cmake b/ports/libxslt/portfile.cmake
new file mode 100644
index 000000000..2343ba99f
--- /dev/null
+++ b/ports/libxslt/portfile.cmake
@@ -0,0 +1,176 @@
+# 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/libxslt-1.1.29)
+vcpkg_download_distfile(ARCHIVE
+ URLS "ftp://xmlsoft.org/libxslt/libxslt-1.1.29.tar.gz"
+ FILENAME "libxslt-1.1.29.tar.gz"
+ SHA512 a1ce555a74a9dabe65e8f64bb66e27e77760fd76940d88f2d59f58dd63ca73c8ae59f3fcbd8e76c8f92ff992fb0c09328528c20ea38ccac83e63252106bf5f31
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+find_program(NMAKE nmake)
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}/
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-makefile.patch
+)
+
+set(SCRIPTS_DIR ${SOURCE_PATH}/win32)
+
+set(CONFIGURE_COMMAND_TEMPLATE cscript configure.js
+ cruntime=@CRUNTIME@
+ debug=@DEBUGMODE@
+ prefix=@INSTALL_DIR@
+ include=@INCLUDE_DIR@
+ lib=@LIB_DIR@
+ bindir=$(PREFIX)\\tools\\
+ sodir=$(PREFIX)\\bin\\
+)
+
+# Create some directories ourselves, because the makefile doesn't
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+#
+# Release
+#
+
+message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
+
+if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ set(CRUNTIME /MD)
+else()
+ set(CRUNTIME /MT)
+endif()
+set(DEBUGMODE no)
+set(LIB_DIR ${CURRENT_INSTALLED_DIR}/lib)
+set(INCLUDE_DIR ${CURRENT_INSTALLED_DIR}/include)
+set(INSTALL_DIR ${CURRENT_PACKAGES_DIR})
+file(TO_NATIVE_PATH "${LIB_DIR}" LIB_DIR)
+file(TO_NATIVE_PATH "${INCLUDE_DIR}" INCLUDE_DIR)
+file(TO_NATIVE_PATH "${INSTALL_DIR}" INSTALL_DIR)
+string(CONFIGURE "${CONFIGURE_COMMAND_TEMPLATE}" CONFIGURE_COMMAND)
+vcpkg_execute_required_process(
+ COMMAND ${CONFIGURE_COMMAND}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME config-${TARGET_TRIPLET}-rel
+)
+# Handle build output directory
+file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" OUTDIR)
+file(MAKE_DIRECTORY "${OUTDIR}")
+message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
+
+message(STATUS "Building ${TARGET_TRIPLET}-rel")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /f Makefile.msvc rebuild OUTDIR=${OUTDIR}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME build-${TARGET_TRIPLET}-rel
+)
+message(STATUS "Building ${TARGET_TRIPLET}-rel done")
+
+message(STATUS "Installing ${TARGET_TRIPLET}-rel")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /f Makefile.msvc install OUTDIR=${OUTDIR}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME install-${TARGET_TRIPLET}-rel
+)
+message(STATUS "Installing ${TARGET_TRIPLET}-rel done")
+
+
+#
+# Debug
+#
+
+message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
+
+if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ set(CRUNTIME /MDd)
+else()
+ set(CRUNTIME /MTd)
+endif()
+set(DEBUGMODE yes)
+set(LIB_DIR ${CURRENT_INSTALLED_DIR}/debug/lib)
+set(INSTALL_DIR ${CURRENT_PACKAGES_DIR}/debug)
+file(TO_NATIVE_PATH "${LIB_DIR}" LIB_DIR)
+file(TO_NATIVE_PATH "${INSTALL_DIR}" INSTALL_DIR)
+string(CONFIGURE "${CONFIGURE_COMMAND_TEMPLATE}" CONFIGURE_COMMAND)
+
+vcpkg_execute_required_process(
+ COMMAND ${CONFIGURE_COMMAND}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME config-${TARGET_TRIPLET}-dbg
+)
+# Handle build output directory
+file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" OUTDIR)
+file(MAKE_DIRECTORY "${OUTDIR}")
+message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
+
+message(STATUS "Building ${TARGET_TRIPLET}-dbg")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /f Makefile.msvc rebuild OUTDIR=${OUTDIR}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME build-${TARGET_TRIPLET}-dbg
+)
+message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
+
+message(STATUS "Installing ${TARGET_TRIPLET}-dbg")
+vcpkg_execute_required_process(
+ COMMAND ${NMAKE} /f Makefile.msvc install OUTDIR=${OUTDIR}
+ WORKING_DIRECTORY ${SCRIPTS_DIR}
+ LOGNAME install-${TARGET_TRIPLET}-dbg
+)
+message(STATUS "Installing ${TARGET_TRIPLET}-dbg done")
+
+#
+# Cleanup
+#
+
+# You have to define LIB(E)XSLT_STATIC or not, depending on how you link
+file(READ ${CURRENT_PACKAGES_DIR}/include/libxslt/xsltexports.h XSLTEXPORTS_H)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ string(REPLACE "!defined(LIBXSLT_STATIC)" "0" XSLTEXPORTS_H "${XSLTEXPORTS_H}")
+else()
+ string(REPLACE "!defined(LIBXSLT_STATIC)" "1" XSLTEXPORTS_H "${XSLTEXPORTS_H}")
+endif()
+file(WRITE ${CURRENT_PACKAGES_DIR}/include/libxslt/xsltexports.h "${XSLTEXPORTS_H}")
+
+file(READ ${CURRENT_PACKAGES_DIR}/include/libexslt/exsltexports.h EXSLTEXPORTS_H)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ string(REPLACE "!defined(LIBEXSLT_STATIC)" "0" EXSLTEXPORTS_H "${EXSLTEXPORTS_H}")
+else()
+ string(REPLACE "!defined(LIBEXSLT_STATIC)" "1" EXSLTEXPORTS_H "${EXSLTEXPORTS_H}")
+endif()
+file(WRITE ${CURRENT_PACKAGES_DIR}/include/libexslt/exsltexports.h "${EXSLTEXPORTS_H}")
+
+# Remove tools and debug include directories
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/tools)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/tools)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# The makefile builds both static and dynamic libraries, so remove the ones we don't want
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libxslt_a.lib ${CURRENT_PACKAGES_DIR}/lib/libexslt_a.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libxslt_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libexslt_a.lib)
+else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libxslt.lib ${CURRENT_PACKAGES_DIR}/lib/libexslt.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libxslt.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libexslt.lib)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+ # Rename the libs to match the dynamic lib names
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libxslt_a.lib ${CURRENT_PACKAGES_DIR}/lib/libxslt.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libexslt_a.lib ${CURRENT_PACKAGES_DIR}/lib/libexslt.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libxslt_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libxslt.lib)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libexslt_a.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libexslt.lib)
+endif()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxslt)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/libxslt/COPYING ${CURRENT_PACKAGES_DIR}/share/libxslt/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/lmdb/CONTROL b/ports/lmdb/CONTROL
new file mode 100644
index 000000000..bda09ee71
--- /dev/null
+++ b/ports/lmdb/CONTROL
@@ -0,0 +1,3 @@
+Source: lmdb
+Version: 0.9.18-1
+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..18fd36fd6
--- /dev/null
+++ b/ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch
@@ -0,0 +1,3932 @@
+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..0110402 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.
+@@ -116,7 +149,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 +162,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 +228,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 +279,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 +303,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 +339,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 +358,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 +380,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 +434,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 +459,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 +618,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 +809,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 +840,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 +867,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 +896,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 +963,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 +1048,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 +1089,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 +1119,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 +1174,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 +1190,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 +1223,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 +1247,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 +1315,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 +1362,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,7 +1389,7 @@ 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 */
++ mdb_size_t me_mapsize; /**< size of the data memory map */
+ off_t me_size; /**< current file size */
+ pgno_t me_maxpg; /**< me_mapsize / me_psize */
+ MDB_dbx *me_dbxs; /**< array of static DB info */
+@@ -1253,6 +1423,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 +1475,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 +1504,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 +1537,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 +1589,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 +1600,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 +1634,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 +1734,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 +1762,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 +1858,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 +1875,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 +1956,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 +2030,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 +2042,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 +2068,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 +2111,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 +2300,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 +2339,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 +2376,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 +2424,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 +2441,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 +2459,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 +2614,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 +2638,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 +2688,7 @@ done:
+ }
+ }
+ }
++ MDB_PAGE_UNREF(mc->mc_txn, mp);
+ return 0;
+
+ fail:
+@@ -2447,7 +2697,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 +2706,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 +2726,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 +2977,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 +3015,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 +3058,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 +3096,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 +3124,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 +3148,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 +3200,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 +3254,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 +3310,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 +3401,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 +3515,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;
++ off_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;
++ off_t wpos = 0, next_pos = 1; /* impossible pos, so pos != next_pos */
+ int n = 0;
+ #endif
+
+@@ -3266,7 +3572,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 +3623,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 +3631,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 +3836,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 +3874,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 +3934,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 +4004,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,7 +4034,7 @@ mdb_env_write_meta(MDB_txn *txn)
+ MDB_env *env;
+ MDB_meta meta, metab, *mp;
+ unsigned flags;
+- size_t mapsize;
++ mdb_size_t mapsize;
+ off_t off;
+ int rc, len, toggle;
+ char *ptr;
+@@ -3734,11 +4046,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 +4179,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 +4190,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 +4210,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 +4288,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 +4298,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 +4316,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 +4366,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 +4480,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 +4499,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 +4540,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,6 +4822,10 @@ 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;
+
+@@ -4616,19 +4977,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 +5020,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 +5048,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 +5113,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 +5153,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 +5262,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 +5310,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 +5336,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 +5381,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 +5405,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 +5436,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 +5552,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 +5564,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 +5600,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 +5648,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 +5664,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 +5679,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
++ off_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 +5996,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 +6010,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 +6051,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 +6081,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 +6102,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 +6123,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 +6175,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 +6198,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 +6242,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 +6283,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 +6308,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 +6334,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 +6350,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 +6362,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 +6384,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 +6419,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 +6443,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 +6463,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 +6473,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 +6487,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 +6508,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 +6530,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 +6552,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 +6562,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 +6574,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 +6596,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 +6623,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 +6692,7 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data,
+ }
+ }
+ rc = 0;
++ mc->mc_flags &= ~C_EOF;
+ goto set2;
+ }
+ }
+@@ -5961,25 +6781,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 +6817,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 +6848,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 +6863,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 +6895,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 +6941,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 +6991,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 +7006,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 +7058,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 +7320,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 +7440,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 +7472,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 +7564,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 +7646,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 +7746,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 +7775,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 +7875,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 +7916,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 +7973,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 +7996,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 +8105,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 +8125,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 +8143,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 +8153,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 +8180,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 +8188,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 +8207,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 +8273,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 +8307,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 +8361,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 +8509,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 +8603,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 +8634,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 +8680,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 +8737,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 +8825,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 +8854,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 +8909,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 +8970,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 +8982,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 +8990,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 +9047,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 +9080,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 +9200,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 +9208,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 +9226,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 +9243,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 +9624,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 +9638,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 +9659,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 +9684,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 +9695,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 +9741,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 +9788,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 +9811,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 +9839,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 +9888,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 +9953,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 +10020,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 +10081,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 +10520,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 +10543,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 +10551,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 +10561,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 +10584,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 +10598,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 +10719,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 +10824,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/log4cplus/portfile.cmake b/ports/log4cplus/portfile.cmake
index 78620597a..1eb1a7a59 100644
--- a/ports/log4cplus/portfile.cmake
+++ b/ports/log4cplus/portfile.cmake
@@ -1,4 +1,3 @@
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/log4cplus-REL_1_1_3-RC7)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/lua/CMakeLists.txt b/ports/lua/CMakeLists.txt
index 76ee6e15c..68de76788 100644
--- a/ports/lua/CMakeLists.txt
+++ b/ports/lua/CMakeLists.txt
@@ -25,22 +25,29 @@ src/ltable.c src/ltablib.c src/ltm.c src/lundump.c src/lutf8lib.c src/lvm.c src/
# append headers to sources to make them show up in MSVC GUI
LIST(APPEND SRC_LIBLUA ${HDR_LIBLUA})
-IF (BUILD_SHARED_LIBS)
- ADD_DEFINITIONS ( -DLUA_BUILD_AS_DLL )
-ENDIF ()
-
# remove warnings
ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS )
#DLL
ADD_LIBRARY ( lua ${SRC_LIBLUA} )
+IF (BUILD_SHARED_LIBS)
+ TARGET_COMPILE_DEFINITIONS (lua PRIVATE -DLUA_BUILD_AS_DLL )
+ENDIF ()
+
INSTALL ( TARGETS lua
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
)
+IF (NOT DEFINED SKIP_INSTALL_TOOLS)
+ ADD_EXECUTABLE ( luac src/luac.c ${SRC_LIBLUA} ) # compiler
+ ADD_EXECUTABLE ( luai src/lua.c ${SRC_LIBLUA} ) # interpreter
+ SET_TARGET_PROPERTIES ( luai PROPERTIES OUTPUT_NAME lua PDB_NAME luai )
+ INSTALL ( TARGETS luai luac RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/tools )
+ENDIF ()
+
IF (NOT DEFINED SKIP_INSTALL_HEADERS)
INSTALL(
FILES
@@ -51,4 +58,4 @@ IF (NOT DEFINED SKIP_INSTALL_HEADERS)
src/lauxlib.h
DESTINATION include
)
-ENDIF () \ No newline at end of file
+ENDIF ()
diff --git a/ports/lua/CONTROL b/ports/lua/CONTROL
index ae661f3f6..b284bfa85 100644
--- a/ports/lua/CONTROL
+++ b/ports/lua/CONTROL
@@ -1,3 +1,3 @@
Source: lua
-Version: 5.3.3
+Version: 5.3.3-2
Description: a powerful, fast, lightweight, embeddable scripting language
diff --git a/ports/lua/portfile.cmake b/ports/lua/portfile.cmake
index f8c1071f7..0778a77f9 100644
--- a/ports/lua/portfile.cmake
+++ b/ports/lua/portfile.cmake
@@ -6,7 +6,6 @@
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lua-5.3.3)
vcpkg_download_distfile(ARCHIVE
@@ -22,6 +21,7 @@ vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
+ -DSKIP_INSTALL_TOOLS=ON
)
vcpkg_install_cmake()
diff --git a/ports/lz4/CMakeLists.txt b/ports/lz4/CMakeLists.txt
new file mode 100644
index 000000000..a5366f5ab
--- /dev/null
+++ b/ports/lz4/CMakeLists.txt
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 3.0)
+project(lz4)
+
+if(BUILD_SHARED_LIBS)
+ add_definitions(-DLZ4_DLL_EXPORT)
+endif()
+add_definitions(-DXXH_NAMESPACE=LZ4_)
+
+add_library(lz4
+ lib/lz4.c
+ lib/lz4frame.c
+ lib/lz4hc.c
+ lib/xxhash.c)
+
+install(TARGETS lz4
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+
+if(NOT LZ4_SKIP_INCLUDES)
+ install(FILES
+ lib/lz4.h
+ lib/lz4frame.h
+ lib/lz4hc.h
+ DESTINATION include)
+endif()
diff --git a/ports/lz4/CONTROL b/ports/lz4/CONTROL
new file mode 100644
index 000000000..90be24a5b
--- /dev/null
+++ b/ports/lz4/CONTROL
@@ -0,0 +1,3 @@
+Source: lz4
+Version: 1.7.4.2
+Description: Lossless compression algorithm, providing compression speed at 400 MB/s per core.
diff --git a/ports/lz4/auto-define-import-macro.patch b/ports/lz4/auto-define-import-macro.patch
new file mode 100644
index 000000000..48b4585ea
--- /dev/null
+++ b/ports/lz4/auto-define-import-macro.patch
@@ -0,0 +1,28 @@
+diff --git a/lz4.h b/lz4.h
+index 7420ad8..c1c3e56 100644
+--- a/lz4.h
++++ b/lz4.h
+@@ -73,6 +73,9 @@ extern "C" {
+ * LZ4_DLL_EXPORT :
+ * Enable exporting of functions when building a Windows DLL
+ */
++
++#define LZ4_DLL_IMPORT 1
++
+ #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
+ # define LZ4LIB_API __declspec(dllexport)
+ #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
+diff --git a/lz4frame.h b/lz4frame.h
+index 3104d2e..4442461 100644
+--- a/lz4frame.h
++++ b/lz4frame.h
+@@ -55,6 +55,9 @@ extern "C" {
+ * LZ4_DLL_EXPORT :
+ * Enable exporting of functions when building a Windows DLL
+ */
++
++#define LZ4_DLL_IMPORT 1
++
+ #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
+ # define LZ4FLIB_API __declspec(dllexport)
+ #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
diff --git a/ports/lz4/portfile.cmake b/ports/lz4/portfile.cmake
new file mode 100644
index 000000000..9e2153e4b
--- /dev/null
+++ b/ports/lz4/portfile.cmake
@@ -0,0 +1,29 @@
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lz4-1.7.4.2)
+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)
+
+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
+ -DLZ4_SKIP_INCLUDES=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}/lib/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/lz4)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/lz4/LICENSE ${CURRENT_PACKAGES_DIR}/share/lz4/copyright)
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/0001_cmake.patch b/ports/mongo-c-driver/0001_cmake.patch
deleted file mode 100644
index a2f9087e7..000000000
--- a/ports/mongo-c-driver/0001_cmake.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index b3fc5b9..5a106ca 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -20,7 +20,6 @@ option(ENABLE_EXPERIMENTAL_FEATURES
-
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/build/cmake)
-
--include(InstallRequiredSystemLibraries)
- include(FindBSON REQUIRED)
-
- if (NOT (ENABLE_SSL STREQUAL DARWIN
-@@ -563,7 +562,7 @@ install(
- )
- install(
- FILES ${HEADERS}
-- DESTINATION "include/libmongoc-${MONGOC_API_VERSION}"
-+ DESTINATION "include"
- )
-
- # Define pkg-config files
-diff --git a/build/cmake/FindBSON.cmake b/build/cmake/FindBSON.cmake
-index 4ac39ea..bf6ecab 100644
---- a/build/cmake/FindBSON.cmake
-+++ b/build/cmake/FindBSON.cmake
-@@ -11,7 +11,7 @@ endif ()
-
- find_path(BSON_INCLUDE_DIR
- NAMES
-- libbson-1.0/bson.h
-+ bson.h
- HINTS
- ${BSON_ROOT_DIR}
- ${_BSON_INCLUDEDIR}
-@@ -19,8 +19,6 @@ find_path(BSON_INCLUDE_DIR
- include
- )
-
--set(BSON_INCLUDE_DIR "${BSON_INCLUDE_DIR}/libbson-1.0")
--
- if(WIN32 AND NOT CYGWIN)
- if(MSVC)
- find_library(BSON
diff --git a/ports/mongo-c-driver/CONTROL b/ports/mongo-c-driver/CONTROL
index b0cec868c..c77352848 100644
--- a/ports/mongo-c-driver/CONTROL
+++ b/ports/mongo-c-driver/CONTROL
@@ -1,4 +1,4 @@
Source: mongo-c-driver
-Version: 1.4.2
+Version: 1.5.1
Build-Depends: libbson
Description: Client library written in C for MongoDB. \ No newline at end of file
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 df84008e4..3d551e084 100644
--- a/ports/mongo-c-driver/portfile.cmake
+++ b/ports/mongo-c-driver/portfile.cmake
@@ -1,27 +1,53 @@
-include(${CMAKE_TRIPLET_FILE})
-include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mongo-c-driver-1.4.2)
-
-vcpkg_download_distfile(ARCHIVE
- URLS "https://github.com/mongodb/mongo-c-driver/releases/download/1.4.2/mongo-c-driver-1.4.2.tar.gz"
- FILENAME "mongo-c-driver-1.4.2.tar.gz"
- SHA512 402b9d0f2ae957a07336c9a6d971440472acef8e17a3ba5e89635ca454a13d4b7cf5f9b71151ed6182c012efb5fac6684acfc00443c6bca07cdd04b9f7eddaeb
-)
-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}
- OPTIONS
- -DBSON_ROOT_DIR=${CURRENT_INSTALLED_DIR}
-)
-
-vcpkg_install_cmake()
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-
-file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/COPYING ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/copyright) \ No newline at end of file
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mongo-c-driver-1.5.1)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/mongodb/mongo-c-driver/archive/1.5.1.tar.gz"
+ FILENAME "mongo-c-driver-1.5.1.tar.gz"
+ SHA512 2977e6e1fb3c45256161d2c9bd711fea69b9f8c9ff15362fa636068e0a347c42e10d72fed5649504b552c8212f21cb1ae74d2dc8ca3d1388f49e63b2baf6e16d
+)
+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()
+
+file(RENAME
+ ${CURRENT_PACKAGES_DIR}/include/libmongoc-1.0
+ ${CURRENT_PACKAGES_DIR}/temp)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include)
+file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include)
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/mongoc-1.0.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/mongoc-1.0.lib)
+
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/lib/mongoc-static-1.0.lib
+ ${CURRENT_PACKAGES_DIR}/lib/mongoc-1.0.lib)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mongoc-static-1.0.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mongoc-1.0.lib)
+else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/mongoc-static-1.0.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/mongoc-static-1.0.lib)
+endif()
+
+file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver RENAME copyright) \ No newline at end of file
diff --git a/ports/mongo-cxx-driver/0001_cmake.patch b/ports/mongo-cxx-driver/0001_cmake.patch
deleted file mode 100644
index 6e93e4755..000000000
--- a/ports/mongo-cxx-driver/0001_cmake.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 695f64c..87807d6 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -59,7 +59,6 @@ set(CMAKE_CXX_EXTENSIONS OFF)
-
- # Include the required modules
- include(GenerateExportHeader)
--include(InstallRequiredSystemLibraries)
-
- # If the user did not customize the install prefix,
- # set it to live under build so we don't inadverently pollute /usr/local
-diff --git a/cmake/FindLibBSON.cmake b/cmake/FindLibBSON.cmake
-index 52f5de0..7a0be52 100644
---- a/cmake/FindLibBSON.cmake
-+++ b/cmake/FindLibBSON.cmake
-@@ -26,7 +26,7 @@ if(LIBBSON_DIR)
- # Trust the user's override path by default
- set(LIBBSON_LIBRARIES bson-1.0 CACHE INTERNAL "")
- set(LIBBSON_LIBRARY_DIRS ${LIBBSON_DIR}/lib CACHE INTERNAL "")
-- set(LIBBSON_INCLUDE_DIRS ${LIBBSON_DIR}/include/libbson-1.0 CACHE INTERNAL "")
-+ set(LIBBSON_INCLUDE_DIRS ${LIBBSON_DIR}/include CACHE INTERNAL "")
- find_package_handle_standard_args(LIBBSON DEFAULT_MSG LIBBSON_LIBRARIES LIBBSON_LIBRARY_DIRS LIBBSON_INCLUDE_DIRS)
- elseif (PKG_CONFIG_FOUND)
- # The best we can do until libbson starts installing a libbson-config.cmake file
-diff --git a/cmake/FindLibMongoC.cmake b/cmake/FindLibMongoC.cmake
-index 830de11..7e0bc76 100644
---- a/cmake/FindLibMongoC.cmake
-+++ b/cmake/FindLibMongoC.cmake
-@@ -26,7 +26,7 @@ if(LIBMONGOC_DIR)
- # Trust the user's override path by default
- set(LIBMONGOC_LIBRARIES mongoc-1.0 CACHE INTERNAL "")
- set(LIBMONGOC_LIBRARY_DIRS ${LIBMONGOC_DIR}/lib CACHE INTERNAL "")
-- set(LIBMONGOC_INCLUDE_DIRS ${LIBMONGOC_DIR}/include/libmongoc-1.0 CACHE INTERNAL "")
-+ set(LIBMONGOC_INCLUDE_DIRS ${LIBMONGOC_DIR}/include CACHE INTERNAL "")
- find_package_handle_standard_args(LIBMONGOC DEFAULT_MSG LIBMONGOC_LIBRARIES LIBMONGOC_LIBRARY_DIRS LIBMONGOC_INCLUDE_DIRS)
- elseif (PKG_CONFIG_FOUND)
- # The best we can do until libMONGOC starts installing a libmongoc-config.cmake file
-diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt
-index cea1bc9..481529c 100644
---- a/src/bsoncxx/CMakeLists.txt
-+++ b/src/bsoncxx/CMakeLists.txt
-@@ -60,7 +60,7 @@ endif()
-
- set(BSONCXX_VERSION ${BSONCXX_VERSION_MAJOR}.${BSONCXX_VERSION_MINOR}.${BSONCXX_VERSION_PATCH}${BSONCXX_VERSION_EXTRA})
- set(BSONCXX_INLINE_NAMESPACE "v${BSONCXX_ABI_VERSION}")
--set(BSONCXX_HEADER_INSTALL_DIR "include/bsoncxx/${BSONCXX_INLINE_NAMESPACE}" CACHE INTERNAL "")
-+set(BSONCXX_HEADER_INSTALL_DIR "include" CACHE INTERNAL "")
-
- set(LIBBSON_REQUIRED_VERSION 1.3.4)
- set(LIBBSON_REQUIRED_ABI_VERSION 1.0)
-diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt
-index fdbe61a..7d5c2c9 100644
---- a/src/mongocxx/CMakeLists.txt
-+++ b/src/mongocxx/CMakeLists.txt
-@@ -32,7 +32,7 @@ set(MONGOCXX_ABI_VERSION _noabi)
-
- set(MONGOCXX_VERSION ${MONGOCXX_VERSION_MAJOR}.${MONGOCXX_VERSION_MINOR}.${MONGOCXX_VERSION_PATCH}${MONGOCXX_VERSION_EXTRA})
- set(MONGOCXX_INLINE_NAMESPACE "v${MONGOCXX_ABI_VERSION}")
--set(MONGOCXX_HEADER_INSTALL_DIR "include/mongocxx/${MONGOCXX_INLINE_NAMESPACE}" CACHE INTERNAL "")
-+set(MONGOCXX_HEADER_INSTALL_DIR "include" CACHE INTERNAL "")
-
- add_subdirectory(config)
-
diff --git a/ports/mongo-cxx-driver/CONTROL b/ports/mongo-cxx-driver/CONTROL
index 1e2611b13..41c958400 100644
--- a/ports/mongo-cxx-driver/CONTROL
+++ b/ports/mongo-cxx-driver/CONTROL
@@ -1,4 +1,4 @@
Source: mongo-cxx-driver
-Version: 3.0.2
+Version: 3.0.3
Build-Depends: boost,libbson,mongo-c-driver
Description: MongoDB C++ Driver. \ No newline at end of file
diff --git a/ports/mongo-cxx-driver/disable_shared.patch b/ports/mongo-cxx-driver/disable_shared.patch
new file mode 100644
index 000000000..5f2f9a04e
--- /dev/null
+++ b/ports/mongo-cxx-driver/disable_shared.patch
@@ -0,0 +1,46 @@
+diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt
+index a9a7ada..6b87a6d 100644
+--- a/src/bsoncxx/CMakeLists.txt
++++ b/src/bsoncxx/CMakeLists.txt
+@@ -117,9 +117,15 @@ if (WIN32)
+ )
+ endif()
+
+-add_library(bsoncxx SHARED
+- ${bsoncxx_sources}
+-)
++if(BUILD_SHARED_LIBS)
++ add_library(bsoncxx SHARED
++ ${bsoncxx_sources}
++ )
++else()
++ add_library(bsoncxx SHARED
++ exception/error_code.cpp
++ )
++endif()
+
+ set(bsoncxx_libs ${LIBBSON_LIBRARIES})
+
+diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt
+index 2ef54e4..53a13f7 100644
+--- a/src/mongocxx/CMakeLists.txt
++++ b/src/mongocxx/CMakeLists.txt
+@@ -134,9 +134,15 @@ set_target_properties(mongocxx_mocked PROPERTIES
+ VERSION ${MONGOCXX_VERSION}
+ )
+
+-add_library(mongocxx SHARED
+- ${mongocxx_sources}
+-)
++if(BUILD_SHARED_LIBS)
++ add_library(mongocxx SHARED
++ ${mongocxx_sources}
++ )
++else()
++ add_library(mongocxx SHARED
++ exception/error_code.cpp
++ )
++endif()
+
+ set_target_properties (mongocxx PROPERTIES
+ OUTPUT_NAME mongocxx
diff --git a/ports/mongo-cxx-driver/disable_test_and_example.patch b/ports/mongo-cxx-driver/disable_test_and_example.patch
new file mode 100644
index 000000000..d542628f7
--- /dev/null
+++ b/ports/mongo-cxx-driver/disable_test_and_example.patch
@@ -0,0 +1,149 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4538920..e783ff5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -74,66 +74,66 @@ endif()
+
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+-add_custom_target(hugo_dir
+- COMMAND ${CMAKE_COMMAND} -E make_directory hugo
+-)
+-
+-add_custom_target(hugo
+- DEPENDS hugo_dir
+- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs
+- COMMAND hugo
+- VERBATIM
+-)
+-
+-add_custom_target(hugo-deploy
+- DEPENDS hugo
+- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+- COMMAND etc/deploy-to-ghpages.pl --hugo git@github.com:mongodb/mongo-cxx-driver
+- VERBATIM
+-)
+-
+-add_custom_target(docs_dir_current
+- COMMAND ${CMAKE_COMMAND} -E make_directory docs/api/current
+-)
+-
+-add_custom_target(doxygen-current
+- DEPENDS docs_dir_current
+- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+- COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile
+- VERBATIM
+-)
+-
+-add_custom_target(doxygen-all
+- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+- COMMAND etc/generate-all-apidocs.pl
+- VERBATIM
+-)
+-
+-add_custom_target(doxygen-deploy
+- DEPENDS doxygen-all
+- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+- COMMAND etc/deploy-to-ghpages.pl --doxygen git@github.com:mongodb/mongo-cxx-driver
+- VERBATIM
+-)
+-
+-add_custom_target(format
+- python ${CMAKE_SOURCE_DIR}/etc/clang_format.py format
+- VERBATIM
+-)
+-
+-add_custom_target(format-lint
+- python ${CMAKE_SOURCE_DIR}/etc/clang_format.py lint
+- VERBATIM
+-)
+-
+-add_custom_target(docs
+- DEPENDS hugo doxygen-current
+-)
+-
+-set(THIRD_PARTY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party)
++#add_custom_target(hugo_dir
++# COMMAND ${CMAKE_COMMAND} -E make_directory hugo
++#)
++#
++#add_custom_target(hugo
++# DEPENDS hugo_dir
++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs
++# COMMAND hugo
++# VERBATIM
++#)
++#
++#add_custom_target(hugo-deploy
++# DEPENDS hugo
++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
++# COMMAND etc/deploy-to-ghpages.pl --hugo git@github.com:mongodb/mongo-cxx-driver
++# VERBATIM
++#)
++#
++#add_custom_target(docs_dir_current
++# COMMAND ${CMAKE_COMMAND} -E make_directory docs/api/current
++#)
++#
++#add_custom_target(doxygen-current
++# DEPENDS docs_dir_current
++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
++# COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile
++# VERBATIM
++#)
++#
++#add_custom_target(doxygen-all
++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
++# COMMAND etc/generate-all-apidocs.pl
++# VERBATIM
++#)
++#
++#add_custom_target(doxygen-deploy
++# DEPENDS doxygen-all
++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
++# COMMAND etc/deploy-to-ghpages.pl --doxygen git@github.com:mongodb/mongo-cxx-driver
++# VERBATIM
++#)
++#
++#add_custom_target(format
++# python ${CMAKE_SOURCE_DIR}/etc/clang_format.py format
++# VERBATIM
++#)
++#
++#add_custom_target(format-lint
++# python ${CMAKE_SOURCE_DIR}/etc/clang_format.py lint
++# VERBATIM
++#)
++#
++#add_custom_target(docs
++# DEPENDS hugo doxygen-current
++#)
++#
++#set(THIRD_PARTY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party)
+
+ enable_testing()
+
+ add_subdirectory(src)
+
+-add_subdirectory(examples EXCLUDE_FROM_ALL)
++#add_subdirectory(examples EXCLUDE_FROM_ALL)
+diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt
+index 010f5e4..a9a7ada 100644
+--- a/src/bsoncxx/CMakeLists.txt
++++ b/src/bsoncxx/CMakeLists.txt
+@@ -202,4 +202,4 @@ install(
+ DESTINATION lib/cmake/libbsoncxx-${BSONCXX_VERSION}
+ )
+
+-add_subdirectory(test)
++#add_subdirectory(test)
+diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt
+index 12d188b..2ef54e4 100644
+--- a/src/mongocxx/CMakeLists.txt
++++ b/src/mongocxx/CMakeLists.txt
+@@ -209,4 +209,4 @@ install(
+ DESTINATION lib/cmake/libmongocxx-${MONGOCXX_VERSION}
+ )
+
+-add_subdirectory(test)
++#add_subdirectory(test)
diff --git a/ports/mongo-cxx-driver/portfile.cmake b/ports/mongo-cxx-driver/portfile.cmake
index fa29b14a3..137088109 100644
--- a/ports/mongo-cxx-driver/portfile.cmake
+++ b/ports/mongo-cxx-driver/portfile.cmake
@@ -1,31 +1,89 @@
-include(${CMAKE_TRIPLET_FILE})
-include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mongo-cxx-driver-r3.0.2)
-
-vcpkg_download_distfile(ARCHIVE
- URLS "https://codeload.github.com/mongodb/mongo-cxx-driver/zip/r3.0.2"
- FILENAME "mongo-cxx-driver-r3.0.2.zip"
- SHA512 f3f1902df22ad58090ec2d4f22c9746d32b12552934d0eaf686b7e3b2e65ac9eeff9e28944cde75c5f5834735e8b76f879e1ca0e7095195f22e3ce6dd92b4524
-)
-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}
- OPTIONS
- -DLIBBSON_DIR=${CURRENT_INSTALLED_DIR}
- -DLIBMONGOC_DIR=${CURRENT_INSTALLED_DIR}
-)
-
-vcpkg_install_cmake()
-
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-
-file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-cxx-driver)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/mongo-cxx-driver/LICENSE ${CURRENT_PACKAGES_DIR}/share/mongo-cxx-driver/copyright) \ No newline at end of file
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mongo-cxx-driver-r3.1.0)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/mongodb/mongo-cxx-driver/archive/r3.1.0.tar.gz"
+ FILENAME "mongo-cxx-driver-r3.1.0.tar.gz"
+ SHA512 2c9323f5e28304057b6ed6fc8bf33aad14db1313e234eaa74a96fb4cf93e99d24fd8c7c3f20b4b29cda7b1fe5c58f08dcb5cddcffbf62259c08334312fda4fba
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/disable_test_and_example.patch
+ ${CMAKE_CURRENT_LIST_DIR}/disable_shared.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DLIBBSON_DIR=${CURRENT_INSTALLED_DIR}
+ -DLIBMONGOC_DIR=${CURRENT_INSTALLED_DIR}
+ -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON
+)
+
+vcpkg_install_cmake()
+
+file(RENAME
+ ${CURRENT_PACKAGES_DIR}/include/bsoncxx/v_noabi/bsoncxx
+ ${CURRENT_PACKAGES_DIR}/temp)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/bsoncxx)
+file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include/bsoncxx)
+
+file(RENAME
+ ${CURRENT_PACKAGES_DIR}/include/mongocxx/v_noabi/mongocxx
+ ${CURRENT_PACKAGES_DIR}/temp)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/mongocxx)
+file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include/mongocxx)
+
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/lib/cmake
+ ${CURRENT_PACKAGES_DIR}/debug/lib/cmake
+
+ ${CURRENT_PACKAGES_DIR}/include/bsoncxx/cmake
+ ${CURRENT_PACKAGES_DIR}/include/bsoncxx/config/private
+ ${CURRENT_PACKAGES_DIR}/include/bsoncxx/private
+ ${CURRENT_PACKAGES_DIR}/include/bsoncxx/test
+ ${CURRENT_PACKAGES_DIR}/include/bsoncxx/third_party
+
+ ${CURRENT_PACKAGES_DIR}/include/mongocxx/cmake
+ ${CURRENT_PACKAGES_DIR}/include/mongocxx/config/private
+ ${CURRENT_PACKAGES_DIR}/include/mongocxx/test
+ ${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}/debug/include)
+
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/bsoncxx.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/bsoncxx.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/mongocxx.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/mongocxx.lib)
+
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/lib/libbsoncxx.lib
+ ${CURRENT_PACKAGES_DIR}/lib/bsoncxx.lib)
+ file(RENAME
+ ${CURRENT_PACKAGES_DIR}/debug/lib/libmongocxx.lib
+ ${CURRENT_PACKAGES_DIR}/debug/lib/mongocxx.lib)
+
+ # define MONGOCXX_STATIC in config/export.hpp
+ vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/static.patch
+ )
+else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libbsoncxx.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libbsoncxx.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libmongocxx.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libmongocxx.lib)
+endif()
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-cxx-driver RENAME copyright) \ No newline at end of file
diff --git a/ports/mongo-cxx-driver/static.patch b/ports/mongo-cxx-driver/static.patch
new file mode 100644
index 000000000..a485efe3d
--- /dev/null
+++ b/ports/mongo-cxx-driver/static.patch
@@ -0,0 +1,12 @@
+diff --git a/mongocxx/config/export.hpp b/mongocxx/config/export.hpp
+index 61a3e74..7fc951c 100644
+--- a/mongocxx/config/export.hpp
++++ b/mongocxx/config/export.hpp
+@@ -2,6 +2,7 @@
+ #ifndef MONGOCXX_API_H
+ #define MONGOCXX_API_H
+
++#define MONGOCXX_STATIC
+ #ifdef MONGOCXX_STATIC
+ # define MONGOCXX_API
+ # define MONGOCXX_PRIVATE
diff --git a/ports/mpg123/portfile.cmake b/ports/mpg123/portfile.cmake
index 68d0f7baa..0308bb17e 100644
--- a/ports/mpg123/portfile.cmake
+++ b/ports/mpg123/portfile.cmake
@@ -1,3 +1,7 @@
+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/mpg123-1.23.3)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/mpir/CONTROL b/ports/mpir/CONTROL
index 6d8646f93..0a1f1601b 100644
--- a/ports/mpir/CONTROL
+++ b/ports/mpir/CONTROL
@@ -1,3 +1,3 @@
-Source: mpir
-Version: 2.7.2
+Source: mpir
+Version: 2.7.2-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 e2f7040d6..a57c53328 100644
--- a/ports/mpir/portfile.cmake
+++ b/ports/mpir/portfile.cmake
@@ -1,49 +1,73 @@
-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(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2)
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "http://mpir.org/mpir-2.7.2.tar.bz2"
+ FILENAME "mpir-2.7.2.tar.bz2"
+ SHA512 8436a0123201f9e30130ea340331c5a6445dddb58ce1f6c6a3a8303c310ac5b3c279c83b5c520a757cba82c2b14e92da44583e0eec287090cf69cbb29d516a9c
+)
+vcpkg_extract_source_archive(${ARCHIVE_FILE})
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj
+ )
+else()
+ vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/build.vc14/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/nana/CONTROL b/ports/nana/CONTROL
new file mode 100644
index 000000000..e7692526f
--- /dev/null
+++ b/ports/nana/CONTROL
@@ -0,0 +1,4 @@
+Source: nana
+Version: 1.4.1
+Description: Cross-platform library for GUI programming in modern C++ style.
+Build-Depends: zlib, libpng, libjpeg-turbo
diff --git a/ports/nana/fix-linking.patch b/ports/nana/fix-linking.patch
new file mode 100644
index 000000000..a687e228b
--- /dev/null
+++ b/ports/nana/fix-linking.patch
@@ -0,0 +1,51 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5c9c9c9..ae35185 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -149,26 +149,20 @@ endif ()
+ # Find PNG
+ if(NANA_CMAKE_ENABLE_PNG)
+ add_definitions(-DNANA_ENABLE_PNG)
+- set(NANA_LINKS "${NANA_LINKS} -lpng")
+ if(NANA_CMAKE_LIBPNG_FROM_OS)
+- find_package(PNG)
+- if (PNG_FOUND)
+- include_directories( ${PNG_INCLUDE_DIRS})
+- add_definitions(-DUSE_LIBPNG_FROM_OS)
+- endif(PNG_FOUND)
++ find_package(PNG REQUIRED)
++ include_directories(${PNG_INCLUDE_DIRS})
++ add_definitions(-DUSE_LIBPNG_FROM_OS)
+ endif(NANA_CMAKE_LIBPNG_FROM_OS)
+ endif(NANA_CMAKE_ENABLE_PNG)
+
+ # Find JPEG
+ if(NANA_CMAKE_ENABLE_JPEG)
+ add_definitions(-DNANA_ENABLE_JPEG)
+- set(NANA_LINKS "${NANA_LINKS} -ljpeg")
+ if(NANA_CMAKE_LIBJPEG_FROM_OS)
+- find_package(JPEG)
+- if (JPEG_FOUND)
+- include_directories( ${JPEG_INCLUDE_DIRS})
+- add_definitions(-DUSE_LIBJPEG_FROM_OS)
+- endif(JPEG_FOUND)
++ find_package(JPEG REQUIRED)
++ include_directories(${JPEG_INCLUDE_DIRS})
++ add_definitions(-DUSE_LIBJPEG_FROM_OS)
+ endif(NANA_CMAKE_LIBJPEG_FROM_OS)
+ endif(NANA_CMAKE_ENABLE_JPEG)
+
+@@ -253,7 +247,12 @@ endforeach(subdir ${NANA_SOURCE_SUBDIRS})
+
+ include_directories(${NANA_INCLUDE_DIR})
+ add_library(${PROJECT_NAME} ${sources} )
+-target_link_libraries(${PROJECT_NAME} ${NANA_LINKS})
++if(NANA_CMAKE_ENABLE_JPEG AND NANA_CMAKE_LIBJPEG_FROM_OS)
++ target_link_libraries(${PROJECT_NAME} ${JPEG_LIBRARIES})
++endif()
++if(NANA_CMAKE_ENABLE_PNG AND NANA_CMAKE_LIBPNG_FROM_OS)
++ target_link_libraries(${PROJECT_NAME} ${PNG_LIBRARIES})
++endif()
+
+ # Headers: use INCLUDE_DIRECTORIES
+ # Libraries: use FIND_LIBRARY and link with the result of it (try to avoid LINK_DIRECTORIES)
diff --git a/ports/nana/portfile.cmake b/ports/nana/portfile.cmake
new file mode 100644
index 000000000..66fca68fa
--- /dev/null
+++ b/ports/nana/portfile.cmake
@@ -0,0 +1,36 @@
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/nana)
+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)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-linking.patch")
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
+ -DNANA_CMAKE_ENABLE_PNG=ON
+ -DNANA_CMAKE_ENABLE_JPEG=ON
+ OPTIONS_DEBUG
+ -DNANA_CMAKE_INSTALL_INCLUDES=OFF)
+
+vcpkg_install_cmake()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/nana.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/nana.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+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)
diff --git a/ports/nanodbc/portfile.cmake b/ports/nanodbc/portfile.cmake
index 997042e18..fc735f03f 100644
--- a/ports/nanodbc/portfile.cmake
+++ b/ports/nanodbc/portfile.cmake
@@ -1,4 +1,7 @@
-include(${CMAKE_TRIPLET_FILE})
+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/nanodbc-2.12.4)
@@ -11,7 +14,7 @@ vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
- PATCHES
+ PATCHES
${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch
${CMAKE_CURRENT_LIST_DIR}/0002_msvc14_codecvt.patch
${CMAKE_CURRENT_LIST_DIR}/0003_export_def.patch
@@ -26,7 +29,7 @@ vcpkg_configure_cmake(
-DNANODBC_USE_UNICODE=ON
)
-vcpkg_install_cmake()
+vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
diff --git a/ports/ogre/0001-use-vcpkg-freeimage.patch b/ports/ogre/0001-use-vcpkg-freeimage.patch
new file mode 100644
index 000000000..0266e5e89
--- /dev/null
+++ b/ports/ogre/0001-use-vcpkg-freeimage.patch
@@ -0,0 +1,17 @@
+diff --git a/OgreMain/CMakeLists.txt b/OgreMain/CMakeLists.txt
+index 6a43378..22f950e 100644
+--- a/OgreMain/CMakeLists.txt
++++ b/OgreMain/CMakeLists.txt
+@@ -220,7 +220,11 @@ endif ()
+ list(APPEND HEADER_FILES ${THREAD_HEADER_FILES})
+
+ # Add needed definitions and nedmalloc include dir
+-add_definitions(-DOGRE_NONCLIENT_BUILD -DFREEIMAGE_LIB -D_MT -D_USRDLL)
++# vcpkg specific patch: we removed -DFREEIMAGE_LIB
++# from the defines, because vcpkg's freeimage can
++# be both static or dynamic, and FREEIMAGE_LIB
++# remove all the symbol exporting declaration from FreeImage.h
++add_definitions(-DOGRE_NONCLIENT_BUILD -D_MT -D_USRDLL)
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/nedmalloc)
+
+ set(LIBRARIES ${PLATFORM_LIBS})
diff --git a/ports/ogre/0002-ogre-cmake-dir-as-option.patch b/ports/ogre/0002-ogre-cmake-dir-as-option.patch
new file mode 100644
index 000000000..c5d75e20c
--- /dev/null
+++ b/ports/ogre/0002-ogre-cmake-dir-as-option.patch
@@ -0,0 +1,19 @@
+diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt
+index 4c496b7..feb4017 100644
+--- a/CMake/CMakeLists.txt
++++ b/CMake/CMakeLists.txt
+@@ -14,10 +14,12 @@
+ #############################################################
+
+ if(WIN32 OR APPLE)
+- set(OGRE_CMAKE_DIR "CMake")
++ set(OGRE_DEFAULT_CMAKE_DIR "CMake")
+ else()
+- set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake")
++ set(OGRE_DEFAULT_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake")
+ endif()
++set(OGRE_CMAKE_DIR ${OGRE_DEFAULT_CMAKE_DIR} CACHE STRING "Install directory for CMake files.")
++mark_as_advanced(OGRE_DEFAULT_CMAKE_DIR)
+
+ set(INST_FILES
+ Packages/FindOIS.cmake
diff --git a/ports/ogre/0003-use-flat-installation.patch b/ports/ogre/0003-use-flat-installation.patch
new file mode 100644
index 000000000..c5a382c1f
--- /dev/null
+++ b/ports/ogre/0003-use-flat-installation.patch
@@ -0,0 +1,41 @@
+diff --git a/CMake/Utils/OgreConfigTargets.cmake b/CMake/Utils/OgreConfigTargets.cmake
+index c6b3b40..2da7ebf 100644
+--- a/CMake/Utils/OgreConfigTargets.cmake
++++ b/CMake/Utils/OgreConfigTargets.cmake
+@@ -41,15 +41,28 @@ if (NOT OGRE_RUNTIME_OUTPUT)
+ set(OGRE_RUNTIME_OUTPUT ${OGRE_BINARY_DIR}/bin)
+ endif ()
+
++option(OGRE_NO_INSTALLATION_SUFFIXES_ON_WIN32 "Do not install in configuration-specific directories in Windows" FALSE)
++
+ if (WIN32)
+- set(OGRE_RELEASE_PATH "/Release")
+- set(OGRE_RELWDBG_PATH "/RelWithDebInfo")
+- set(OGRE_MINSIZE_PATH "/MinSizeRel")
+- set(OGRE_DEBUG_PATH "/Debug")
+- set(OGRE_LIB_RELEASE_PATH "/Release")
+- set(OGRE_LIB_RELWDBG_PATH "/RelWithDebInfo")
+- set(OGRE_LIB_MINSIZE_PATH "/MinSizeRel")
+- set(OGRE_LIB_DEBUG_PATH "/Debug")
++ if (OGRE_NO_INSTALLATION_SUFFIXES_ON_WIN32)
++ set(OGRE_RELEASE_PATH "")
++ set(OGRE_RELWDBG_PATH "")
++ set(OGRE_MINSIZE_PATH "")
++ set(OGRE_DEBUG_PATH "")
++ set(OGRE_LIB_RELEASE_PATH "")
++ set(OGRE_LIB_RELWDBG_PATH "")
++ set(OGRE_LIB_MINSIZE_PATH "")
++ set(OGRE_LIB_DEBUG_PATH "/")
++ else ()
++ set(OGRE_RELEASE_PATH "/Release")
++ set(OGRE_RELWDBG_PATH "/RelWithDebInfo")
++ set(OGRE_MINSIZE_PATH "/MinSizeRel")
++ set(OGRE_DEBUG_PATH "/Debug")
++ set(OGRE_LIB_RELEASE_PATH "/Release")
++ set(OGRE_LIB_RELWDBG_PATH "/RelWithDebInfo")
++ set(OGRE_LIB_MINSIZE_PATH "/MinSizeRel")
++ set(OGRE_LIB_DEBUG_PATH "/Debug")
++ endif ()
+ set(OGRE_PLUGIN_PATH "/opt")
+ set(OGRE_SAMPLE_PATH "/opt/samples")
+ elseif (UNIX)
diff --git a/ports/ogre/CONTROL b/ports/ogre/CONTROL
new file mode 100644
index 000000000..40d9e2416
--- /dev/null
+++ b/ports/ogre/CONTROL
@@ -0,0 +1,4 @@
+Source: ogre
+Version: 1.9.0
+Build-Depends: freeimage, freetype, zlib, zziplib
+Description: 3D Object-Oriented Graphics Rendering Engine
diff --git a/ports/ogre/OGREConfig.cmake b/ports/ogre/OGREConfig.cmake
new file mode 100644
index 000000000..a20544431
--- /dev/null
+++ b/ports/ogre/OGREConfig.cmake
@@ -0,0 +1,37 @@
+#.rst:
+# OGREConfig
+# ------------
+#
+# Dummy OGREConfig to simplify use of OGRE-provided FindOGRE module.
+#
+# This file is provided as part of the vcpkg port of OGRE .
+# It is meant to be found automatically by find_package(OGRE),
+# but then offloads all the real work to the FindOGRE module by temporarly
+# adding its directory to CMAKE_MODULE_PATH
+#
+# See the FindOGRE module to see the defined variables::
+#
+
+# Temporarly add the directory in which OGREConfig.cmake is contained to
+# get access to the FindOGRE module
+get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+set(ORIGINAL_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
+list(APPEND CMAKE_MODULE_PATH ${SELF_DIR})
+find_package(OGRE MODULE)
+
+# Leave CMAKE_MODULE_PATH as we found it
+set(CMAKE_MODULE_PATH ${ORIGINAL_CMAKE_MODULE_PATH})
+
+# Handle components
+# imported from https://github.com/Kitware/CMake/blob/v3.7.1/Modules/CMakePackageConfigHelpers.cmake#L300
+macro(check_required_components _NAME)
+ foreach(comp ${${_NAME}_FIND_COMPONENTS})
+ if(NOT ${_NAME}_${comp}_FOUND)
+ if(${_NAME}_FIND_REQUIRED_${comp})
+ set(${_NAME}_FOUND FALSE)
+ endif()
+ endif()
+ endforeach()
+endmacro()
+
+check_required_components(OGRE) \ No newline at end of file
diff --git a/ports/ogre/portfile.cmake b/ports/ogre/portfile.cmake
new file mode 100644
index 000000000..a0989a4a2
--- /dev/null
+++ b/ports/ogre/portfile.cmake
@@ -0,0 +1,60 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sinbad-ogre-dd30349ea667)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://bitbucket.org/sinbad/ogre/get/v1-9-0.zip"
+ FILENAME "ogre-v1-9-0.zip"
+ SHA512 de7315a2450ecf0d9073e6a8f0c54737e041016f7ad820556d10701c7d23eefab9d3473476a8e95447c30ab21518b8e4cfb0271db72494ea67a3dea284c9a3d3
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-use-vcpkg-freeimage.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/0002-ogre-cmake-dir-as-option.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/0003-use-flat-installation.patch"
+)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ set(OGRE_STATIC ON)
+else()
+ set(OGRE_STATIC OFF)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DOGRE_USE_BOOST:BOOL=OFF
+ -DOGRE_BUILD_RENDERSYSTEM_D3D9:BOOL=OFF
+ -DOGRE_INSTALL_DEPENDENCIES:BOOL=OFF
+ -DOGRE_COPY_DEPENDENCIES:BOOL=OFF
+ -DOGRE_BUILD_TOOLS:BOOL=OFF
+ -DOGRE_CMAKE_DIR:STRING=share/ogre
+ -DOGRE_STATIC:BOOL=${OGRE_STATIC}
+ -DOGRE_INSTALL_SAMPLES:BOOL=OFF
+ -DOGRE_INSTALL_TOOLS:BOOL=OFF
+ # We disable this option because it is broken and we rely on vcpkg_copy_pdbs
+ -DOGRE_INSTALL_PDB:BOOL=OFF
+ -DOGRE_BUILD_DOCS:BOOL=OFF
+ -DOGRE_INSTALL_DOCS:BOOL=OFF
+ -DOGRE_INSTALL_SAMPLES_SOURCE:BOOL=OFF
+ -DOGRE_NO_INSTALLATION_SUFFIXES_ON_WIN32:BOOL=ON
+)
+
+vcpkg_install_cmake()
+
+# Add a OGREConfig.cmake to simplify the process of finding vcpkg OGRE
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/OGREConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/ogre)
+
+# Remove debug includes
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Remove debug CMake files
+# Note that at the moment OGRE do not export imported targets,
+# so we do not need to copy the debug imported targets in the
+# release CMake path
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/ogre)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/ogre/COPYING ${CURRENT_PACKAGES_DIR}/share/ogre/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/openal-soft/portfile.cmake b/ports/openal-soft/portfile.cmake
index 856ac9367..bfb8b4ffb 100644
--- a/ports/openal-soft/portfile.cmake
+++ b/ports/openal-soft/portfile.cmake
@@ -1,3 +1,7 @@
+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/openal-soft-1.17.2)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake
index 49fa463a2..224c99c42 100644
--- a/ports/opencv/portfile.cmake
+++ b/ports/opencv/portfile.cmake
@@ -1,3 +1,7 @@
+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/opencv-92387b1ef8fad15196dd5f7fb4931444a68bc93a)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/openjpeg/CONTROL b/ports/openjpeg/CONTROL
new file mode 100644
index 000000000..f137d0ebc
--- /dev/null
+++ b/ports/openjpeg/CONTROL
@@ -0,0 +1,3 @@
+Source: openjpeg
+Version: 2.1.2
+Description: JPEG 2000 image library
diff --git a/ports/openjpeg/portfile.cmake b/ports/openjpeg/portfile.cmake
new file mode 100644
index 000000000..dfa25881d
--- /dev/null
+++ b/ports/openjpeg/portfile.cmake
@@ -0,0 +1,41 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openjpeg-2.1.2)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/uclouvain/openjpeg/archive/v2.1.2.zip"
+ FILENAME "openjpeg-2.1.2.zip"
+ SHA512 45518b92b2a8e7218ab3efdebe1acf0437c01ab2e4d5769da17103a76ba38a7305fb36d0ceeca0576d53c071a3482d2d3f01d6e48a569191290bfba9274ef7b4
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DBUILD_CODEC:BOOL=OFF
+ -DOPENJPEG_INSTALL_PACKAGE_DIR=share/openjpeg
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle debug cmake config files (see https://github.com/Microsoft/vcpkg/issues/77)
+file(READ ${CURRENT_PACKAGES_DIR}/debug/share/openjpeg/OpenJPEGTargets-debug.cmake OPENJPEG_DEBUG_MODULE)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" OPENJPEG_DEBUG_MODULE "${OPENJPEG_DEBUG_MODULE}")
+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
diff --git a/ports/openssl/CMakeLists.txt b/ports/openssl/CMakeLists.txt
index ff034bb9a..a82f14d60 100644
--- a/ports/openssl/CMakeLists.txt
+++ b/ports/openssl/CMakeLists.txt
@@ -2,25 +2,31 @@ cmake_minimum_required(VERSION 3.0)
project(openssl NONE)
include(vcpkg_execute_required_process)
+include(vcpkg_apply_patches)
+set(SOURCE_PATH ${CMAKE_CURRENT_BINARY_DIR}/openssl-${OPENSSL_VERSION})
-find_package(ZLIB REQUIRED)
find_program(PERL perl)
find_program(NMAKE nmake)
message(STATUS "Extracting source ${OPENSSL_SOURCE_ARCHIVE}")
vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} -E tar xjf ${OPENSSL_SOURCE_ARCHIVE}
+ COMMAND ${CMAKE_COMMAND} -E tar xjf "${OPENSSL_SOURCE_ARCHIVE}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
LOGNAME extract-${TARGET_TRIPLET}-rel
)
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/PerlScriptSpaceInPathFixes.patch
+ ${CMAKE_CURRENT_LIST_DIR}/ConfigureIncludeQuotesFix.patch
+ ${CMAKE_CURRENT_LIST_DIR}/STRINGIFYPatch.patch
+)
+
set(CONFIGURE_COMMAND ${PERL} Configure
- no-idea
- no-mdc2
- no-rc5
+ enable-static-engine
+ enable-capieng
no-asm
- zlib-dynamic
- --with-zlib-include=${ZLIB_INCLUDE_DIRS}
+ no-ssl2
)
if(TARGET_TRIPLET MATCHES "x86-windows")
@@ -35,18 +41,18 @@ endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(OPENSSLDIR ${CURRENT_PACKAGES_DIR}/debug)
- list(GET ZLIB_LIBRARIES -1 ZLIB_DEBUG_LIBRARY)
list(APPEND CONFIGURE_COMMAND
debug-${OPENSSL_ARCH}
- --openssldir=${OPENSSLDIR}
- --with-zlib-lib=${ZLIB_DEBUG_LIBRARY}
+ "--prefix=${OPENSSLDIR}"
+ "--openssldir=${OPENSSLDIR}"
+
)
else()
set(OPENSSLDIR ${CURRENT_PACKAGES_DIR})
list(APPEND CONFIGURE_COMMAND
${OPENSSL_ARCH}
- --openssldir=${OPENSSLDIR}
- --with-zlib-lib=${ZLIB_LIBRARIES}
+ "--prefix=${OPENSSLDIR}"
+ "--openssldir=${OPENSSLDIR}"
)
endif()
@@ -61,8 +67,16 @@ vcpkg_execute_required_process(
LOGNAME configure-do-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}
)
-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}
-)
-add_custom_target(openssl ALL DEPENDS ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll) \ No newline at end of file
+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}
+ )
+ 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}
+ )
+ 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 cc539a03e..6fb520404 100644
--- a/ports/openssl/CONTROL
+++ b/ports/openssl/CONTROL
@@ -1,4 +1,3 @@
Source: openssl
-Version: 1.0.2h
-Build-Depends: zlib
-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/ConfigureIncludeQuotesFix.patch b/ports/openssl/ConfigureIncludeQuotesFix.patch
new file mode 100644
index 000000000..1689ec4e0
--- /dev/null
+++ b/ports/openssl/ConfigureIncludeQuotesFix.patch
@@ -0,0 +1,13 @@
+diff --git a/Configure b/Configure
+index c98107a..77ad9d3 100644
+--- a/Configure
++++ b/Configure
+@@ -970,7 +970,7 @@ PROCESS_ARGS:
+ }
+ elsif (/^--with-zlib-include=(.*)$/)
+ {
+- $withargs{"zlib-include"}="-I$1";
++ $withargs{"zlib-include"}="-I\"$1\"";
+ }
+ elsif (/^--with-fipsdir=(.*)$/)
+ {
diff --git a/ports/openssl/PerlScriptSpaceInPathFixes.patch b/ports/openssl/PerlScriptSpaceInPathFixes.patch
new file mode 100644
index 000000000..b3a52fc97
--- /dev/null
+++ b/ports/openssl/PerlScriptSpaceInPathFixes.patch
@@ -0,0 +1,35 @@
+diff --git a/util/copy.pl b/util/copy.pl
+index eba6d58..5d971a2 100644
+--- a/util/copy.pl
++++ b/util/copy.pl
+@@ -19,7 +19,7 @@ foreach $arg (@ARGV) {
+ next;
+ }
+ $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
+- foreach (glob $arg)
++ foreach (glob "\"$arg\"")
+ {
+ push @filelist, $_;
+ }
+diff --git a/util/mk1mf.pl b/util/mk1mf.pl
+index 128a405..fd853da 100644
+--- a/util/mk1mf.pl
++++ b/util/mk1mf.pl
+@@ -427,7 +427,7 @@ EOF
+ {
+ $extra_install .= <<"EOF"
+ \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
+- \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\"
++ \$(CP) \$(E_SHLIB) \"\$(INSTALLTOP)${o}lib${o}engines\"
+ EOF
+ }
+ }
+@@ -607,7 +607,7 @@ install: all
+ \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
+ \$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
+ \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\"
+- \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\"
++ \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep\" \"\$(INSTALLTOP)${o}bin\"
+ \$(MKDIR) \"\$(OPENSSLDIR)\"
+ \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
+ $extra_install
diff --git a/ports/openssl/STRINGIFYPatch.patch b/ports/openssl/STRINGIFYPatch.patch
new file mode 100644
index 000000000..dd8f9c297
--- /dev/null
+++ b/ports/openssl/STRINGIFYPatch.patch
@@ -0,0 +1,23 @@
+diff --git a/crypto/cversion.c b/crypto/cversion.c
+index bfff699..17b7912 100644
+--- a/crypto/cversion.c
++++ b/crypto/cversion.c
+@@ -56,6 +56,9 @@
+ * [including the GNU Public Licence.]
+ */
+
++#define STRINGIFY2(x) #x
++#define STRINGIFY(x) STRINGIFY2(x)
++
+ #include "cryptlib.h"
+
+ #ifndef NO_WINDOWS_BRAINDEATH
+@@ -79,7 +82,7 @@ const char *SSLeay_version(int t)
+ }
+ if (t == SSLEAY_CFLAGS) {
+ #ifdef CFLAGS
+- return (CFLAGS);
++ return STRINGIFY(CFLAGS);
+ #else
+ return ("compiler: information not available");
+ #endif
diff --git a/ports/openssl/make-openssl.bat b/ports/openssl/make-openssl.bat
new file mode 100644
index 000000000..4c038094d
--- /dev/null
+++ b/ports/openssl/make-openssl.bat
@@ -0,0 +1,10 @@
+set build=%1
+
+perl Configure no-asm no-hw no-dso VC-WINUNIVERSAL
+
+call ms\do_winuniversal.bat
+
+call ms\setVSvars.bat universal10.0%build%
+
+nmake -f ms\ntdll.mak
+
diff --git a/ports/openssl/portfile-uwp.cmake b/ports/openssl/portfile-uwp.cmake
new file mode 100644
index 000000000..289c549fc
--- /dev/null
+++ b/ports/openssl/portfile-uwp.cmake
@@ -0,0 +1,109 @@
+# 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 static)
+ message(FATAL_ERROR "Static building not supported yet")
+endif()
+
+if (NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ message(FATAL_ERROR "This portfile only supports UWP")
+endif()
+
+if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
+ set(UWP_PLATFORM "arm")
+elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(UWP_PLATFORM "x64")
+elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ set(UWP_PLATFORM "Win32")
+else ()
+ message(FATAL_ERROR "Unsupported architecture")
+endif()
+
+include(vcpkg_common_functions)
+
+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}")
+
+vcpkg_download_distfile(ARCHIVE
+ 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})
+
+file(REMOVE_RECURSE ${SOURCE_PATH}/tmp32dll)
+file(REMOVE_RECURSE ${SOURCE_PATH}/out32dll)
+file(REMOVE_RECURSE ${SOURCE_PATH}/inc32dll)
+
+file(COPY
+${CMAKE_CURRENT_LIST_DIR}/make-openssl.bat
+DESTINATION ${SOURCE_PATH})
+
+message(STATUS "Build ${TARGET_TRIPLET}")
+
+vcpkg_execute_required_process(
+ COMMAND ${SOURCE_PATH}/make-openssl.bat ${UWP_PLATFORM}
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME make-openssl-${TARGET_TRIPLET}
+)
+
+
+message(STATUS "Build ${TARGET_TRIPLET} done")
+
+
+
+file(
+ COPY ${SOURCE_PATH}/inc32/openssl
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+
+
+
+file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl RENAME copyright)
diff --git a/ports/openssl/portfile.cmake b/ports/openssl/portfile.cmake
index 9f45f0ce4..b13258119 100644
--- a/ports/openssl/portfile.cmake
+++ b/ports/openssl/portfile.cmake
@@ -1,5 +1,11 @@
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ include(${CMAKE_CURRENT_LIST_DIR}/portfile-uwp.cmake)
+ return()
+endif()
+
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-1.0.2h)
+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)
@@ -7,12 +13,17 @@ 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.2h.tar.gz"
- FILENAME "openssl-1.0.2h.tar.gz"
- SHA512 780601f6f3f32f42b6d7bbc4c593db39a3575f9db80294a10a68b2b0bb79448d9bd529ca700b9977354cbdfc65887c76af0aa7b90d3ee421f74ab53e6f15c303
+ URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
+ FILENAME "openssl-${OPENSSL_VERSION}.tar.gz"
+ SHA512 0d314b42352f4b1df2c40ca1094abc7e9ad684c5c35ea997efdd58204c70f22a1abcb17291820f0fff3769620a4e06906034203d31eb1a4d540df3e0db294016
)
-file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY
+${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt
+${CMAKE_CURRENT_LIST_DIR}/PerlScriptSpaceInPathFixes.patch
+${CMAKE_CURRENT_LIST_DIR}/ConfigureIncludeQuotesFix.patch
+${CMAKE_CURRENT_LIST_DIR}/STRINGIFYPatch.patch
+DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
@@ -24,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.2h
+ -DVERSION=${OPENSSL_VERSION}
-DTARGET_TRIPLET=${TARGET_TRIPLET}
)
@@ -51,11 +62,13 @@ file(REMOVE
${CURRENT_PACKAGES_DIR}/debug/openssl.cnf
${CURRENT_PACKAGES_DIR}/openssl.cnf
)
-if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/engines)
- file(RENAME ${CURRENT_PACKAGES_DIR}/lib/engines ${CURRENT_PACKAGES_DIR}/bin/engines)
-endif()
-if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/engines)
- file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/engines ${CURRENT_PACKAGES_DIR}/debug/bin/engines)
-endif()
+
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl RENAME copyright)
-vcpkg_copy_pdbs()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ # They should be empty, only the exes deleted above were in these directories
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/)
+endif()
+
+vcpkg_copy_pdbs() \ No newline at end of file
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/pcre/CONTROL b/ports/pcre/CONTROL
new file mode 100644
index 000000000..cf6d6c2a5
--- /dev/null
+++ b/ports/pcre/CONTROL
@@ -0,0 +1,4 @@
+Source: pcre
+Version: 8.38-1
+Description: Perl Compatible Regular Expresions
+Build-Depends: zlib
diff --git a/ports/pcre/portfile.cmake b/ports/pcre/portfile.cmake
new file mode 100644
index 000000000..87f4ec7cb
--- /dev/null
+++ b/ports/pcre/portfile.cmake
@@ -0,0 +1,56 @@
+# 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/pcre-8.39)
+vcpkg_download_distfile(ARCHIVE
+ 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})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DPCRE_BUILD_TESTS=NO
+ -DPCRE_BUILD_PCREGREP=NO
+ -DPCRE_BUILD_PCRE32=YES
+ -DPCRE_BUILD_PCRE16=YES
+ -DPCRE_BUILD_PCRE8=YES
+ -DPCRE_SUPPORT_JIT=YES
+ -DPCRE_SUPPORT_UTF=YES
+ -DPCRE_SUPPORT_UNICODE_PROPERTIES=YES
+ # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
+ # OPTIONS_RELEASE -DOPTIMIZE=1
+ # OPTIONS_DEBUG -DDEBUGGABLE=1
+)
+
+vcpkg_install_cmake()
+
+foreach(FILE ${CURRENT_PACKAGES_DIR}/include/pcre.h ${CURRENT_PACKAGES_DIR}/include/pcreposix.h)
+ file(READ ${FILE} PCRE_H)
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ string(REPLACE "defined(PCRE_STATIC)" "1" PCRE_H "${PCRE_H}")
+ else()
+ string(REPLACE "defined(PCRE_STATIC)" "0" PCRE_H "${PCRE_H}")
+ endif()
+ file(WRITE ${FILE} "${PCRE_H}")
+endforeach()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/man)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/man)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/pcre)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/pcre/COPYING ${CURRENT_PACKAGES_DIR}/share/pcre/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/pdcurses/CONTROL b/ports/pdcurses/CONTROL
new file mode 100644
index 000000000..66f0f4535
--- /dev/null
+++ b/ports/pdcurses/CONTROL
@@ -0,0 +1,3 @@
+Source: pdcurses
+Version: 3.4
+Description: Public Domain Curses - a curses library for environments that don't fit the termcap/terminfo model.
diff --git a/ports/pdcurses/LICENSE b/ports/pdcurses/LICENSE
new file mode 100644
index 000000000..ec633d8f2
--- /dev/null
+++ b/ports/pdcurses/LICENSE
@@ -0,0 +1,7 @@
+The core package is in the public domain, but small portions of PDCurses are subject to copyright under various licenses.
+
+The win32 files are released to the public domain.
+
+If you use PDCurses in an application, an acknowledgement would be appreciated, but is not mandatory. If you make corrections or enhancements to PDCurses, please forward them to the current maintainer for the benefit of other users.
+
+This software is provided AS IS with NO WARRANTY whatsoever. \ No newline at end of file
diff --git a/ports/pdcurses/portfile.cmake b/ports/pdcurses/portfile.cmake
new file mode 100644
index 000000000..4c43e68d2
--- /dev/null
+++ b/ports/pdcurses/portfile.cmake
@@ -0,0 +1,70 @@
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src)
+find_program(NMAKE nmake)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://downloads.sourceforge.net/project/pdcurses/pdcurses/3.4/pdcurs34.zip"
+ FILENAME "pdcurs34.zip"
+ SHA512 0b916bfe37517abb80df7313608cc4e1ed7659a41ce82763000dfdfa5b8311ffd439193c74fc84a591f343147212bf1caf89e7db71f1f7e4fa70f534834cb039
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+set(PDC_NMAKE_CMD ${NMAKE} /A -f vcpkg.mak WIDE=Y UTF8=Y)
+set(PDC_NMAKE_CWD ${SOURCE_PATH}/win32)
+set(PDC_PDCLIB ${SOURCE_PATH}/win32/pdcurses)
+
+file(READ ${SOURCE_PATH}/win32/vcwin32.mak PDC_MAK)
+string(REPLACE " -pdb:none" "" PDC_MAK ${PDC_MAK})
+string(REPLACE "/MACHINE:IX86 " "" PDC_MAK ${PDC_MAK})
+file(WRITE ${SOURCE_PATH}/win32/vcpkg.mak ${PDC_MAK})
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ set(PDC_NMAKE_CMD ${PDC_NMAKE_CMD} DLL=Y)
+endif()
+
+message(STATUS "Build ${TARGET_TRIPLET}-rel")
+vcpkg_execute_required_process(
+ COMMAND ${PDC_NMAKE_CMD}
+ WORKING_DIRECTORY ${PDC_NMAKE_CWD}
+ LOGNAME build-${TARGET_TRIPLET}-rel
+)
+message(STATUS "Build ${TARGET_TRIPLET}-rel done")
+
+file (
+ COPY ${PDC_PDCLIB}.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib
+)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ file (
+ COPY ${PDC_PDCLIB}.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin
+ )
+endif()
+
+message(STATUS "Build ${TARGET_TRIPLET}-dbg")
+vcpkg_execute_required_process(
+ COMMAND ${PDC_NMAKE_CMD} DEBUG=Y
+ WORKING_DIRECTORY ${PDC_NMAKE_CWD}
+ LOGNAME build-${TARGET_TRIPLET}-dbg
+)
+message(STATUS "Build ${TARGET_TRIPLET}-dbg done")
+
+file (
+ COPY ${PDC_PDCLIB}.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
+)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ file (
+ COPY ${PDC_PDCLIB}.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
+ )
+endif()
+
+file(
+ COPY ${SOURCE_PATH}/curses.h ${SOURCE_PATH}/panel.h ${SOURCE_PATH}/term.h
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+)
+file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/pdcurses RENAME copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/physfs/CONTROL b/ports/physfs/CONTROL
new file mode 100644
index 000000000..3e502435f
--- /dev/null
+++ b/ports/physfs/CONTROL
@@ -0,0 +1,3 @@
+Source: physfs
+Version: 2.0.3
+Description: a library to provide abstract access to various archives
diff --git a/ports/physfs/portfile.cmake b/ports/physfs/portfile.cmake
new file mode 100644
index 000000000..082cc7740
--- /dev/null
+++ b/ports/physfs/portfile.cmake
@@ -0,0 +1,33 @@
+# 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 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/physfs-2.0.3)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://icculus.org/physfs/downloads/physfs-2.0.3.tar.bz2"
+ FILENAME "physfs-2.0.3.tar.bz2"
+ SHA512 47eff0c81b8dc3bb526766b0a8ad2437d2951867880116d6e6e8f2ec1490e263541fb741867fed6517cc3fa8a9c5651b36e3e02a499f19cfdc5c7261c9707e80
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+)
+
+vcpkg_install_cmake()
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/test_physfs.exe)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/test_physfs.exe)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/physfs)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/physfs/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/physfs/copyright)
diff --git a/ports/pixman/CMakeLists.txt b/ports/pixman/CMakeLists.txt
new file mode 100644
index 000000000..aad6ec778
--- /dev/null
+++ b/ports/pixman/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.0)
+project(pixman VERSION 0.32.0 LANGUAGES C CXX)
+
+add_subdirectory(pixman) \ No newline at end of file
diff --git a/ports/pixman/CMakeLists_pixman.txt b/ports/pixman/CMakeLists_pixman.txt
new file mode 100644
index 000000000..c8030bcd6
--- /dev/null
+++ b/ports/pixman/CMakeLists_pixman.txt
@@ -0,0 +1,53 @@
+# Add include directories
+include_directories(".")
+
+FILE(GLOB SOURCES
+"pixman.c"
+"pixman-access.c"
+"pixman-access-accessors.c"
+"pixman-bits-image.c"
+"pixman-combine32.c"
+"pixman-combine-float.c"
+"pixman-conical-gradient.c"
+"pixman-filter.c"
+"pixman-x86.c"
+"pixman-mips.c"
+"pixman-arm.c"
+"pixman-ppc.c"
+"pixman-edge.c"
+"pixman-edge-accessors.c"
+"pixman-fast-path.c"
+"pixman-glyph.c"
+"pixman-general.c"
+"pixman-gradient-walker.c"
+"pixman-image.c"
+"pixman-implementation.c"
+"pixman-linear-gradient.c"
+"pixman-matrix.c"
+"pixman-noop.c"
+"pixman-radial-gradient.c"
+"pixman-region16.c"
+"pixman-region32.c"
+"pixman-solid-fill.c"
+"pixman-timer.c"
+"pixman-trap.c"
+"pixman-utils.c"
+"pixman-sse2.c"
+)
+
+set(CMAKE_DEBUG_POSTFIX "d")
+
+add_library(pixman-1 ${SOURCES})
+
+# pixman requires the three PACKAGE* definitions in order to compile. The USE_SSE2 definition lets it use SSE2 instructions for speed. Every target machine should have SSE2 these days.
+target_compile_definitions(pixman-1 PUBLIC PACKAGE="pixman-1" PUBLIC PACKAGE_VERSION="0.34.0" PUBLIC PACKAGE_BUGREPORT="" PUBLIC USE_SSE2)
+
+# pixman produces a lot of warnings which are disabled here because they otherwise fill up the log files
+target_compile_options(pixman-1 PUBLIC "/wd4244" PUBLIC "/wd4146" PUBLIC "/wd4996") # PUBLIC "/D_CRT_SECURE_NO_WARNINGS"
+
+# The LIBRARY DESTINATION here is lib rather than bin because pixman must always be compiled as a static library since it has no exports.
+install(TARGETS pixman-1
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
diff --git a/ports/pixman/CONTROL b/ports/pixman/CONTROL
new file mode 100644
index 000000000..3603242d0
--- /dev/null
+++ b/ports/pixman/CONTROL
@@ -0,0 +1,3 @@
+Source: pixman
+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
new file mode 100644
index 000000000..ac6de80f0
--- /dev/null
+++ b/ports/pixman/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}
+#
+
+include(vcpkg_common_functions)
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pixman-0.34.0)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.cairographics.org/releases/pixman-0.34.0.tar.gz"
+ FILENAME "pixman-0.34.0.tar.gz"
+ SHA512 81caca5b71582b53aaac473bc37145bd66ba9acebb4773fa8cdb51f4ed7fbcb6954790d8633aad85b2826dd276bcce725e26e37997a517760e9edd72e2669a6d
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_pixman.txt DESTINATION ${SOURCE_PATH}/pixman)
+file(RENAME ${SOURCE_PATH}/pixman/CMakeLists_pixman.txt ${SOURCE_PATH}/pixman/CMakeLists.txt)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
+)
+
+vcpkg_install_cmake()
+
+# Copy the appropriate header files.
+file(COPY
+"${SOURCE_PATH}/pixman/pixman.h"
+"${SOURCE_PATH}/pixman/pixman-accessor.h"
+"${SOURCE_PATH}/pixman/pixman-combine32.h"
+"${SOURCE_PATH}/pixman/pixman-compiler.h"
+"${SOURCE_PATH}/pixman/pixman-edge-imp.h"
+"${SOURCE_PATH}/pixman/pixman-inlines.h"
+"${SOURCE_PATH}/pixman/pixman-private.h"
+"${SOURCE_PATH}/pixman/pixman-version.h"
+DESTINATION
+${CURRENT_PACKAGES_DIR}/include
+)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/pixman)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/pixman/COPYING ${CURRENT_PACKAGES_DIR}/share/pixman/copyright)
+
+vcpkg_copy_pdbs()
diff --git a/ports/poco/CONTROL b/ports/poco/CONTROL
new file mode 100644
index 000000000..ae2758c1f
--- /dev/null
+++ b/ports/poco/CONTROL
@@ -0,0 +1,4 @@
+Source: poco
+Version: 1.7.6-3
+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
diff --git a/ports/poco/config_h.patch b/ports/poco/config_h.patch
new file mode 100644
index 000000000..1387fd0c9
--- /dev/null
+++ b/ports/poco/config_h.patch
@@ -0,0 +1,13 @@
+diff --git a/Foundation/include/Poco/Config.h b/Foundation/include/Poco/Config.h
+index 003b6dc..55b8eed 100644
+--- a/Foundation/include/Poco/Config.h
++++ b/Foundation/include/Poco/Config.h
+@@ -31,7 +31,7 @@
+
+
+ // Define to disable implicit linking
+-// #define POCO_NO_AUTOMATIC_LIBS
++#define POCO_NO_AUTOMATIC_LIBS
+
+
+ // Define to disable automatic initialization
diff --git a/ports/poco/find_pcre.patch b/ports/poco/find_pcre.patch
new file mode 100644
index 000000000..b846660f7
--- /dev/null
+++ b/ports/poco/find_pcre.patch
@@ -0,0 +1,13 @@
+diff --git a/cmake/FindPCRE.cmake b/cmake/FindPCRE.cmake
+index 03f07df..4da1895 100644
+--- a/cmake/FindPCRE.cmake
++++ b/cmake/FindPCRE.cmake
+@@ -16,7 +16,7 @@ ENDIF (PCRE_INCLUDE_DIRS)
+
+ FIND_PATH(PCRE_INCLUDE_DIR pcre.h)
+
+-SET(PCRE_NAMES pcre)
++SET(PCRE_NAMES pcred pcre)
+ FIND_LIBRARY(PCRE_LIBRARY NAMES ${PCRE_NAMES} )
+
+ # handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
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
new file mode 100644
index 000000000..e774c3c17
--- /dev/null
+++ b/ports/poco/portfile.cmake
@@ -0,0 +1,66 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/poco-poco-1.7.6-release)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/pocoproject/poco/archive/poco-1.7.6-release.tar.gz"
+ FILENAME "poco-poco-1.7.6-release.tar.gz"
+ SHA512 a02b7ff66acf080942517b3b8644d6e5c7136c5edc6e58fd13083a74b97b5619253fc9db7863284a565226f95410ad4da1fa9738d14885f560aeb03c1f7c18aa
+)
+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}/foundation-public-include-pcre.patch
+)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ set(POCO_STATIC ON)
+else()
+ 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, ...
+)
+
+vcpkg_install_cmake()
+
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools)
+file(RENAME ${CURRENT_PACKAGES_DIR}/bin/cpspc.exe ${CURRENT_PACKAGES_DIR}/tools/cpspc.exe)
+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)
+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)
+endif()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake)
+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
diff --git a/ports/proj/0001-CMake-add-detection-of-recent-visual-studio-versions.patch b/ports/proj/0001-CMake-add-detection-of-recent-visual-studio-versions.patch
new file mode 100644
index 000000000..9be5438aa
--- /dev/null
+++ b/ports/proj/0001-CMake-add-detection-of-recent-visual-studio-versions.patch
@@ -0,0 +1,26 @@
+From ca8bb14234091ab7b1ada2b9e5abb04f40d459cb Mon Sep 17 00:00:00 2001
+From: Manuel Massing <Manuel Massing m.massing@warped-space.de>
+Date: Tue, 22 Nov 2016 12:00:39 +0100
+Subject: [PATCH 1/3] CMake: add detection of recent visual studio versions
+
+---
+ cmake/Proj4SystemInfo.cmake | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/cmake/Proj4SystemInfo.cmake b/cmake/Proj4SystemInfo.cmake
+index 294a50b..c7fb6bf 100644
+--- a/cmake/Proj4SystemInfo.cmake
++++ b/cmake/Proj4SystemInfo.cmake
+@@ -50,6 +50,9 @@ if(WIN32)
+ if(MSVC_VERSION EQUAL 1800)
+ set(PROJ_COMPILER_NAME "msvc-12.0") #Visual Studio 2013
+ endif()
++ if(MSVC_VERSION EQUAL 1900)
++ set(PROJ_COMPILER_NAME "msvc-14.0") #Visual Studio 2015
++ endif()
+ endif(MSVC)
+
+ if(MINGW)
+--
+2.9.2.windows.1
+
diff --git a/ports/proj/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch b/ports/proj/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch
new file mode 100644
index 000000000..2c470570e
--- /dev/null
+++ b/ports/proj/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch
@@ -0,0 +1,52 @@
+From 1265d13f29259be05535241e9bcbfcf16857dc06 Mon Sep 17 00:00:00 2001
+From: Manuel Massing <Manuel Massing m.massing@warped-space.de>
+Date: Tue, 22 Nov 2016 12:04:10 +0100
+Subject: [PATCH 2/3] CMake: fix error by only setting properties for targets
+ which are actually defined
+
+---
+ src/CMakeLists.txt | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 8d7e7d1..59ad00a 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -22,25 +22,30 @@ if(NOT MSVC)
+ endif ()
+ endif ()
+
++
+ if(BUILD_CS2CS)
+- include(bin_cs2cs.cmake)
++ list(APPEND BINARY_TARGETS cs2cs)
++ include(bin_cs2cs.cmake)
+ endif(BUILD_CS2CS)
+
+ if(BUILD_PROJ)
++ list(APPEND BINARY_TARGETS proj)
+ include(bin_proj.cmake)
+ endif(BUILD_PROJ)
+
+ if(BUILD_GEOD)
++ list(APPEND BINARY_TARGETS geod)
+ include(bin_geod.cmake)
+ include(bin_geodtest.cmake)
+ endif(BUILD_GEOD)
+
+ if(BUILD_NAD2BIN)
++ list(APPEND BINARY_TARGETS nad2bin)
+ include(bin_nad2bin.cmake)
+ endif(BUILD_NAD2BIN)
+
+-if (MSVC OR CMAKE_CONFIGURATION_TYPES)
++if ((MSVC OR CMAKE_CONFIGURATION_TYPES) AND BINARY_TARGETS)
+ # Add _d suffix for your debug versions of the tools
+- set_target_properties (cs2cs binproj geod nad2bin PROPERTIES
+- DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
++ set_target_properties(${BINARY_TARGETS} PROPERTIES
++ DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
+ endif ()
+--
+2.9.2.windows.1
+
diff --git a/ports/proj/0003-CMake-configurable-cmake-config-install-location.patch b/ports/proj/0003-CMake-configurable-cmake-config-install-location.patch
new file mode 100644
index 000000000..5870e12ea
--- /dev/null
+++ b/ports/proj/0003-CMake-configurable-cmake-config-install-location.patch
@@ -0,0 +1,98 @@
+From 0be627798d943558c674d4d92767ca255d847631 Mon Sep 17 00:00:00 2001
+From: Manuel Massing <Manuel Massing m.massing@warped-space.de>
+Date: Tue, 22 Nov 2016 12:26:39 +0100
+Subject: [PATCH 3/3] CMake: configurable cmake config install location
+
+---
+ CMakeLists.txt | 1 +
+ cmake/CMakeLists.txt | 14 +++++++-------
+ cmake/Proj4InstallPath.cmake | 12 +++++++++---
+ 3 files changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cde21f0..1b1f892 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -106,6 +106,7 @@ set(LIBDIR "${DEFAULT_LIBDIR}" CACHE PATH "The directory to install libraries in
+ set(DATADIR "${DEFAULT_DATADIR}" CACHE PATH "The directory to install data files into.")
+ set(DOCDIR "${DEFAULT_DOCDIR}" CACHE PATH "The directory to install doc files into.")
+ set(INCLUDEDIR "${DEFAULT_INCLUDEDIR}" CACHE PATH "The directory to install includes into.")
++set(CMAKEDIR "${DEFAULT_CMAKE_CONFIGDIR}" CACHE PATH "The directory to install cmake files into.")
+
+ #################################################################################
+ # Build configured components
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index 742da0e..2bdef0d 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -2,13 +2,13 @@
+ # ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative
+ # path to the root from there. (Note that the whole install tree can
+ # be relocated.)
+-if (NOT WIN32)
+- set (INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}")
+- set (PROJECT_ROOT_DIR "../../..")
+-else ()
+- set (INSTALL_CMAKE_DIR "cmake")
+- set (PROJECT_ROOT_DIR "..")
+-endif ()
++
++set (INSTALL_CMAKE_DIR ${CMAKEDIR})
++if(NOT IS_ABSOLUTE ${INSTALL_CMAKE_DIR})
++ set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKEDIR}")
++endif()
++
++file(RELATIVE_PATH PROJECT_ROOT_DIR ${INSTALL_CMAKE_DIR} ${CMAKE_INSTALL_PREFIX})
+
+ string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
+ configure_file (project-config.cmake.in project-config.cmake @ONLY)
+diff --git a/cmake/Proj4InstallPath.cmake b/cmake/Proj4InstallPath.cmake
+index da1491c..826fb29 100644
+--- a/cmake/Proj4InstallPath.cmake
++++ b/cmake/Proj4InstallPath.cmake
+@@ -28,13 +28,15 @@ if(WIN32)
+ set(DEFAULT_DATA_SUBDIR share)
+ set(DEFAULT_INCLUDE_SUBDIR local/include)
+ set(DEFAULT_DOC_SUBDIR share/doc/proj)
++ set(DEFAULT_CMAKE_CONFIG_SUBDIR "cmake")
+ else()
+- # Common locatoins for Unix and Mac OS X
++ # Common locations for Unix and Mac OS X
+ set(DEFAULT_BIN_SUBDIR bin)
+ set(DEFAULT_LIB_SUBDIR lib)
+ set(DEFAULT_DATA_SUBDIR share/proj)
+ set(DEFAULT_DOC_SUBDIR doc/proj)
+ set(DEFAULT_INCLUDE_SUBDIR include)
++ set(DEFAULT_CMAKE_CONFIG_SUBDIR "share/cmake/${PROJECT_NAME}")
+ endif()
+
+ # Locations are changeable by user to customize layout of PDAL installation
+@@ -49,19 +51,23 @@ set(PROJ_DATA_SUBDIR ${DEFAULT_DATA_SUBDIR} CACHE STRING
+ "Subdirectory where data will be installed")
+ set(PROJ_DOC_SUBDIR ${DEFAULT_DOC_SUBDIR} CACHE STRING
+ "Subdirectory where data will be installed")
+-
++set(PROJ_CMAKE_CONFIG_SUBDIR ${DEFAULT_CMAKE_CONFIG_SUBDIR} CACHE STRING
++ "Subdirectory where cmake configuration files will be installed")
++
+ # Mark *DIR variables as advanced and dedicated to use by power-users only.
+ mark_as_advanced(PROJ_ROOT_DIR
+ PROJ_BIN_SUBDIR
+ PROJ_LIB_SUBDIR
+ PROJ_INCLUDE_SUBDIR
+ PROJ_DATA_SUBDIR
+- PROJ_DOC_SUBDIR )
++ PROJ_DOC_SUBDIR
++ PROJ_CMAKE_CONFIG_SUBDIR)
+
+ set(DEFAULT_BINDIR "${PROJ_BIN_SUBDIR}")
+ set(DEFAULT_LIBDIR "${PROJ_LIB_SUBDIR}")
+ set(DEFAULT_DATADIR "${PROJ_DATA_SUBDIR}")
+ set(DEFAULT_DOCDIR "${PROJ_DOC_SUBDIR}")
+ set(DEFAULT_INCLUDEDIR "${PROJ_INCLUDE_SUBDIR}")
++set(DEFAULT_CMAKE_CONFIGDIR "${PROJ_CMAKE_CONFIG_SUBDIR}")
+
+
+--
+2.9.2.windows.1
+
diff --git a/ports/proj/CONTROL b/ports/proj/CONTROL
new file mode 100644
index 000000000..b706ca11a
--- /dev/null
+++ b/ports/proj/CONTROL
@@ -0,0 +1,3 @@
+Source: proj
+Version: 4.9.3
+Description: PROJ.4 library for cartographic projections
diff --git a/ports/proj/portfile.cmake b/ports/proj/portfile.cmake
new file mode 100644
index 000000000..6007ab62a
--- /dev/null
+++ b/ports/proj/portfile.cmake
@@ -0,0 +1,57 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/proj-4.9.3)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://download.osgeo.org/proj/proj-4.9.3.zip"
+ FILENAME "proj-4.9.3.zip"
+ SHA512 c9703008cd1f75fe1239b180158e560b9b88ae2ffd900b72923c716908eb86d1abbc4230647af5e3131f8c34481bdc66b03826d669620161ffcfbe67801cb631
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}/
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/0001-CMake-add-detection-of-recent-visual-studio-versions.patch
+ ${CMAKE_CURRENT_LIST_DIR}/0002-CMake-fix-error-by-only-setting-properties-for-targe.patch
+ ${CMAKE_CURRENT_LIST_DIR}/0003-CMake-configurable-cmake-config-install-location.patch
+)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ list(APPEND CMAKE_OPTIONS "-DBUILD_LIBPROJ_SHARED=YES")
+else()
+ list(APPEND CMAKE_OPTIONS "-DBUILD_LIBPROJ_SHARED=NO")
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS ${CMAKE_OPTIONS}
+ -DPROJ_LIB_SUBDIR=lib
+ -DPROJ_INCLUDE_SUBDIR=include
+ -DPROJ_DATA_SUBDIR=share/proj
+ -DPROJ_CMAKE_CONFIG_SUBDIR=share/proj
+ -DBUILD_CS2CS=NO
+ -DBUILD_PROJ=NO
+ -DBUILD_GEOD=NO
+ -DBUILD_NAD2BIN=NO
+ -DPROJ4_TESTS=NO
+)
+
+vcpkg_install_cmake()
+
+
+# Rename library and adapt cmake configuration
+# N.B. debug cmake export is not copied, as it's not relocatable
+file(READ ${CURRENT_PACKAGES_DIR}/share/proj/proj4-targets-release.cmake PROJ4_TARGETS_RELEASE)
+string(REPLACE "proj_4_9.lib" "proj.lib" PROJ4_TARGETS_RELEASE ${PROJ4_TARGETS_RELEASE})
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/proj/proj4-targets-release.cmake ${PROJ4_TARGETS_RELEASE})
+
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/proj_4_9.lib ${CURRENT_PACKAGES_DIR}/lib/proj.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/proj_4_9_d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/projd.lib)
+
+# Remove duplicate headers installed from debug build
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+# Remove data installed from debug build
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/proj)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/proj/COPYING ${CURRENT_PACKAGES_DIR}/share/proj/copyright)
diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake
index 522a68634..5853c1e4a 100644
--- a/ports/protobuf/portfile.cmake
+++ b/ports/protobuf/portfile.cmake
@@ -1,3 +1,4 @@
+#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"
@@ -22,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}")
@@ -35,10 +48,9 @@ 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)
+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)
diff --git a/ports/qca/0001-fix-path-for-vcpkg.patch b/ports/qca/0001-fix-path-for-vcpkg.patch
new file mode 100644
index 000000000..9db22af1d
--- /dev/null
+++ b/ports/qca/0001-fix-path-for-vcpkg.patch
@@ -0,0 +1,63 @@
+From a3a8d50f3bdcb4df630f7126718c21f23efd7832 Mon Sep 17 00:00:00 2001
+From: Alexander Kaspar <alexander.kaspar@gmail.com>
+Date: Wed, 30 Nov 2016 15:45:12 +0100
+Subject: [PATCH] fix path for vcpkg
+
+---
+ CMakeLists.txt | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 605621b..3b5a9be 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -277,7 +277,7 @@ if(DEVELOPER_MODE)
+ # To prefer plugins from build tree when run qca from build tree
+ file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf
+ "[Paths]
+-Plugins=${CMAKE_BINARY_DIR}/lib/${QCA_LIB_NAME}
++Plugins=${CMAKE_BINARY_DIR}/bin/${QCA_LIB_NAME}
+ ")
+ endif()
+
+@@ -320,7 +320,7 @@ else (qca_CERTSTORE)
+ set( qca_CERTSTORE "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem")
+ # note that INSTALL_FILES targets are relative to the current installation prefix...
+ if(NOT DEVELOPER_MODE)
+- install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/certs")
++ install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/share/qca/certs")
+ endif()
+ endif (qca_CERTSTORE)
+ message(STATUS "certstore path: " ${qca_CERTSTORE})
+@@ -401,10 +401,10 @@ endif(DOXYGEN_FOUND)
+ include(CMakePackageConfigHelpers)
+ configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/QcaConfig.cmake.in"
+- "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}Config.cmake"
+- INSTALL_DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE}
++ "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}Config.cmake"
++ INSTALL_DESTINATION ${CMAKE_BINARY_DIR}/share/qca/cmake
+ )
+-write_basic_config_version_file("${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake" VERSION ${QCA_LIB_VERSION_STRING} COMPATIBILITY AnyNewerVersion)
++write_basic_config_version_file("${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake" VERSION ${QCA_LIB_VERSION_STRING} COMPATIBILITY AnyNewerVersion)
+
+ if(NOT DEVELOPER_MODE)
+
+@@ -472,10 +472,10 @@ if(NOT DEVELOPER_MODE)
+ endif()
+ endif()
+
+- install(EXPORT ${QCA_CONFIG_NAME_BASE}Targets DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE} FILE ${QCA_CONFIG_NAME_BASE}Targets.cmake)
++ install(EXPORT ${QCA_CONFIG_NAME_BASE}Targets DESTINATION ${QCA_PREFIX_INSTALL_DIR}/share/qca/cmake FILE ${QCA_CONFIG_NAME_BASE}Targets.cmake)
+ install(FILES
+- "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}Config.cmake"
+- "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${QCA_CONFIG_NAME_BASE}/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake"
+- DESTINATION ${QCA_LIBRARY_INSTALL_DIR}/cmake/${QCA_CONFIG_NAME_BASE}
++ "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}Config.cmake"
++ "${CMAKE_BINARY_DIR}/share/qca/cmake/${QCA_CONFIG_NAME_BASE}ConfigVersion.cmake"
++ DESTINATION ${QCA_PREFIX_INSTALL_DIR}/share/qca/cmake
+ )
+ endif()
+--
+2.8.1.windows.1
+
diff --git a/ports/qca/CONTROL b/ports/qca/CONTROL
new file mode 100644
index 000000000..cbe923bb4
--- /dev/null
+++ b/ports/qca/CONTROL
@@ -0,0 +1,4 @@
+Source: qca
+Version: 2.2.0
+Description: Qt Cryptographic Architecture (QCA). Sources: https://cgit.kde.org/qca.git/
+Build-Depends: qt5
diff --git a/ports/qca/mk-ca-bundle.pl b/ports/qca/mk-ca-bundle.pl
new file mode 100644
index 000000000..9574f1dbf
--- /dev/null
+++ b/ports/qca/mk-ca-bundle.pl
@@ -0,0 +1,554 @@
+#!/usr/bin/perl -w
+# ***************************************************************************
+# * _ _ ____ _
+# * Project ___| | | | _ \| |
+# * / __| | | | |_) | |
+# * | (__| |_| | _ <| |___
+# * \___|\___/|_| \_\_____|
+# *
+# * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+# *
+# * This software is licensed as described in the file COPYING, which
+# * you should have received as part of this distribution. The terms
+# * are also available at https://curl.haxx.se/docs/copyright.html.
+# *
+# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# * copies of the Software, and permit persons to whom the Software is
+# * furnished to do so, under the terms of the COPYING file.
+# *
+# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# * KIND, either express or implied.
+# *
+# ***************************************************************************
+# This Perl script creates a fresh ca-bundle.crt file for use with libcurl.
+# It downloads certdata.txt from Mozilla's source tree (see URL below),
+# then parses certdata.txt and extracts CA Root Certificates into PEM format.
+# These are then processed with the OpenSSL commandline tool to produce the
+# final ca-bundle.crt file.
+# The script is based on the parse-certs script written by Roland Krikava.
+# This Perl script works on almost any platform since its only external
+# dependency is the OpenSSL commandline tool for optional text listing.
+# Hacked by Guenter Knauf.
+#
+use Encode;
+use Getopt::Std;
+use MIME::Base64;
+use strict;
+use vars qw($opt_b $opt_d $opt_f $opt_h $opt_i $opt_k $opt_l $opt_m $opt_n $opt_p $opt_q $opt_s $opt_t $opt_u $opt_v $opt_w);
+use List::Util;
+use Text::Wrap;
+my $MOD_SHA = "Digest::SHA";
+eval "require $MOD_SHA";
+if ($@) {
+ $MOD_SHA = "Digest::SHA::PurePerl";
+ eval "require $MOD_SHA";
+}
+eval "require LWP::UserAgent";
+
+my %urls = (
+ 'nss' =>
+ 'https://hg.mozilla.org/projects/nss/raw-file/tip/lib/ckfw/builtins/certdata.txt',
+ 'central' =>
+ 'https://hg.mozilla.org/mozilla-central/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
+ 'aurora' =>
+ 'https://hg.mozilla.org/releases/mozilla-aurora/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
+ 'beta' =>
+ 'https://hg.mozilla.org/releases/mozilla-beta/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
+ 'release' =>
+ 'https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
+);
+
+$opt_d = 'release';
+
+# If the OpenSSL commandline is not in search path you can configure it here!
+my $openssl = 'openssl';
+
+my $version = '1.27';
+
+$opt_w = 76; # default base64 encoded lines length
+
+# default cert types to include in the output (default is to include CAs which may issue SSL server certs)
+my $default_mozilla_trust_purposes = "SERVER_AUTH";
+my $default_mozilla_trust_levels = "TRUSTED_DELEGATOR";
+$opt_p = $default_mozilla_trust_purposes . ":" . $default_mozilla_trust_levels;
+
+my @valid_mozilla_trust_purposes = (
+ "DIGITAL_SIGNATURE",
+ "NON_REPUDIATION",
+ "KEY_ENCIPHERMENT",
+ "DATA_ENCIPHERMENT",
+ "KEY_AGREEMENT",
+ "KEY_CERT_SIGN",
+ "CRL_SIGN",
+ "SERVER_AUTH",
+ "CLIENT_AUTH",
+ "CODE_SIGNING",
+ "EMAIL_PROTECTION",
+ "IPSEC_END_SYSTEM",
+ "IPSEC_TUNNEL",
+ "IPSEC_USER",
+ "TIME_STAMPING",
+ "STEP_UP_APPROVED"
+);
+
+my @valid_mozilla_trust_levels = (
+ "TRUSTED_DELEGATOR", # CAs
+ "NOT_TRUSTED", # Don't trust these certs.
+ "MUST_VERIFY_TRUST", # This explicitly tells us that it ISN'T a CA but is otherwise ok. In other words, this should tell the app to ignore any other sources that claim this is a CA.
+ "TRUSTED" # This cert is trusted, but only for itself and not for delegates (i.e. it is not a CA).
+);
+
+my $default_signature_algorithms = $opt_s = "MD5";
+
+my @valid_signature_algorithms = (
+ "MD5",
+ "SHA1",
+ "SHA256",
+ "SHA384",
+ "SHA512"
+);
+
+$0 =~ s@.*(/|\\)@@;
+$Getopt::Std::STANDARD_HELP_VERSION = 1;
+getopts('bd:fhiklmnp:qs:tuvw:');
+
+if(!defined($opt_d)) {
+ # to make plain "-d" use not cause warnings, and actually still work
+ $opt_d = 'release';
+}
+
+# Use predefined URL or else custom URL specified on command line.
+my $url;
+if(defined($urls{$opt_d})) {
+ $url = $urls{$opt_d};
+ if(!$opt_k && $url !~ /^https:\/\//i) {
+ die "The URL for '$opt_d' is not HTTPS. Use -k to override (insecure).\n";
+ }
+}
+else {
+ $url = $opt_d;
+}
+
+my $curl = `curl -V`;
+
+if ($opt_i) {
+ print ("=" x 78 . "\n");
+ print "Script Version : $version\n";
+ print "Perl Version : $]\n";
+ print "Operating System Name : $^O\n";
+ print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n";
+ print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n";
+ print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n" if($LWP::UserAgent::VERSION);
+ print "LWP.pm Version : ${LWP::VERSION}\n" if($LWP::VERSION);
+ print "Digest::SHA.pm Version : ${Digest::SHA::VERSION}\n" if ($Digest::SHA::VERSION);
+ print "Digest::SHA::PurePerl.pm Version : ${Digest::SHA::PurePerl::VERSION}\n" if ($Digest::SHA::PurePerl::VERSION);
+ print ("=" x 78 . "\n");
+}
+
+sub warning_message() {
+ if ( $opt_d =~ m/^risk$/i ) { # Long Form Warning and Exit
+ print "Warning: Use of this script may pose some risk:\n";
+ print "\n";
+ print " 1) If you use HTTP URLs they are subject to a man in the middle attack\n";
+ print " 2) Default to 'release', but more recent updates may be found in other trees\n";
+ print " 3) certdata.txt file format may change, lag time to update this script\n";
+ print " 4) Generally unwise to blindly trust CAs without manual review & verification\n";
+ print " 5) Mozilla apps use additional security checks aren't represented in certdata\n";
+ print " 6) Use of this script will make a security engineer grind his teeth and\n";
+ print " swear at you. ;)\n";
+ exit;
+ } else { # Short Form Warning
+ print "Warning: Use of this script may pose some risk, -d risk for more details.\n";
+ }
+}
+
+sub HELP_MESSAGE() {
+ print "Usage:\t${0} [-b] [-d<certdata>] [-f] [-i] [-k] [-l] [-n] [-p<purposes:levels>] [-q] [-s<algorithms>] [-t] [-u] [-v] [-w<l>] [<outputfile>]\n";
+ print "\t-b\tbackup an existing version of ca-bundle.crt\n";
+ print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n";
+ print "\t\t Valid names are:\n";
+ print "\t\t ", join( ", ", map { ( $_ =~ m/$opt_d/ ) ? "$_ (default)" : "$_" } sort keys %urls ), "\n";
+ print "\t-f\tforce rebuild even if certdata.txt is current\n";
+ print "\t-i\tprint version info about used modules\n";
+ print "\t-k\tallow URLs other than HTTPS, enable HTTP fallback (insecure)\n";
+ print "\t-l\tprint license info about certdata.txt\n";
+ print "\t-m\tinclude meta data in output\n";
+ print "\t-n\tno download of certdata.txt (to use existing)\n";
+ print wrap("\t","\t\t", "-p\tlist of Mozilla trust purposes and levels for certificates to include in output. Takes the form of a comma separated list of purposes, a colon, and a comma separated list of levels. (default: $default_mozilla_trust_purposes:$default_mozilla_trust_levels)"), "\n";
+ print "\t\t Valid purposes are:\n";
+ print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_purposes ) ), "\n";
+ print "\t\t Valid levels are:\n";
+ print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_levels ) ), "\n";
+ print "\t-q\tbe really quiet (no progress output at all)\n";
+ print wrap("\t","\t\t", "-s\tcomma separated list of certificate signatures/hashes to output in plain text mode. (default: $default_signature_algorithms)\n");
+ print "\t\t Valid signature algorithms are:\n";
+ print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_signature_algorithms ) ), "\n";
+ print "\t-t\tinclude plain text listing of certificates\n";
+ print "\t-u\tunlink (remove) certdata.txt after processing\n";
+ print "\t-v\tbe verbose and print out processed CAs\n";
+ print "\t-w <l>\twrap base64 output lines after <l> chars (default: ${opt_w})\n";
+ exit;
+}
+
+sub VERSION_MESSAGE() {
+ print "${0} version ${version} running Perl ${]} on ${^O}\n";
+}
+
+warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i );
+HELP_MESSAGE() if ($opt_h);
+
+sub report($@) {
+ my $output = shift;
+
+ print STDERR $output . "\n" unless $opt_q;
+}
+
+sub is_in_list($@) {
+ my $target = shift;
+
+ return defined(List::Util::first { $target eq $_ } @_);
+}
+
+# Parses $param_string as a case insensitive comma separated list with optional whitespace
+# validates that only allowed parameters are supplied
+sub parse_csv_param($$@) {
+ my $description = shift;
+ my $param_string = shift;
+ my @valid_values = @_;
+
+ my @values = map {
+ s/^\s+//; # strip leading spaces
+ s/\s+$//; # strip trailing spaces
+ uc $_ # return the modified string as upper case
+ } split( ',', $param_string );
+
+ # Find all values which are not in the list of valid values or "ALL"
+ my @invalid = grep { !is_in_list($_,"ALL",@valid_values) } @values;
+
+ if ( scalar(@invalid) > 0 ) {
+ # Tell the user which parameters were invalid and print the standard help message which will exit
+ print "Error: Invalid ", $description, scalar(@invalid) == 1 ? ": " : "s: ", join( ", ", map { "\"$_\"" } @invalid ), "\n";
+ HELP_MESSAGE();
+ }
+
+ @values = @valid_values if ( is_in_list("ALL",@values) );
+
+ return @values;
+}
+
+sub sha256 {
+ my $result;
+ if ($Digest::SHA::VERSION || $Digest::SHA::PurePerl::VERSION) {
+ open(FILE, $_[0]) or die "Can't open '$_[0]': $!";
+ binmode(FILE);
+ $result = $MOD_SHA->new(256)->addfile(*FILE)->hexdigest;
+ close(FILE);
+ } else {
+ # Use OpenSSL command if Perl Digest::SHA modules not available
+ $result = `"$openssl" dgst -r -sha256 "$_[0]"`;
+ $result =~ s/^([0-9a-f]{64}) .+/$1/is;
+ }
+ return $result;
+}
+
+
+sub oldhash {
+ my $hash = "";
+ open(C, "<$_[0]") || return 0;
+ while(<C>) {
+ chomp;
+ if($_ =~ /^\#\# SHA256: (.*)/) {
+ $hash = $1;
+ last;
+ }
+ }
+ close(C);
+ return $hash;
+}
+
+if ( $opt_p !~ m/:/ ) {
+ print "Error: Mozilla trust identifier list must include both purposes and levels\n";
+ HELP_MESSAGE();
+}
+
+(my $included_mozilla_trust_purposes_string, my $included_mozilla_trust_levels_string) = split( ':', $opt_p );
+my @included_mozilla_trust_purposes = parse_csv_param( "trust purpose", $included_mozilla_trust_purposes_string, @valid_mozilla_trust_purposes );
+my @included_mozilla_trust_levels = parse_csv_param( "trust level", $included_mozilla_trust_levels_string, @valid_mozilla_trust_levels );
+
+my @included_signature_algorithms = parse_csv_param( "signature algorithm", $opt_s, @valid_signature_algorithms );
+
+sub should_output_cert(%) {
+ my %trust_purposes_by_level = @_;
+
+ foreach my $level (@included_mozilla_trust_levels) {
+ # for each level we want to output, see if any of our desired purposes are included
+ return 1 if ( defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ) );
+ }
+
+ return 0;
+}
+
+my $crt = $ARGV[0] || 'ca-bundle.crt';
+(my $txt = $url) =~ s@(.*/|\?.*)@@g;
+
+my $stdout = $crt eq '-';
+my $resp;
+my $fetched;
+
+my $oldhash = oldhash($crt);
+
+report "SHA256 of old file: $oldhash";
+
+if(!$opt_n) {
+ report "Downloading $txt ...";
+
+ # If we have an HTTPS URL then use curl
+ if($url =~ /^https:\/\//i) {
+ if($curl) {
+ if($curl =~ /^Protocols:.* https( |$)/m) {
+ report "Get certdata with curl!";
+ my $proto = !$opt_k ? "--proto =https" : "";
+ my $quiet = $opt_q ? "-s" : "";
+ my @out = `curl -w %{response_code} $proto $quiet -o "$txt" "$url"`;
+ if(@out && $out[0] == 200) {
+ $fetched = 1;
+ report "Downloaded $txt";
+ }
+ else {
+ report "Failed downloading via HTTPS with curl";
+ if(-e $txt && !unlink($txt)) {
+ report "Failed to remove '$txt': $!";
+ }
+ }
+ }
+ else {
+ report "curl lacks https support";
+ }
+ }
+ else {
+ report "curl not found";
+ }
+ }
+
+ # If nothing was fetched then use LWP
+ if(!$fetched) {
+ if($url =~ /^https:\/\//i) {
+ report "Falling back to HTTP";
+ $url =~ s/^https:\/\//http:\/\//i;
+ }
+ if(!$opt_k) {
+ report "URLs other than HTTPS are disabled by default, to enable use -k";
+ exit 1;
+ }
+ report "Get certdata with LWP!";
+ if(!defined(${LWP::UserAgent::VERSION})) {
+ report "LWP is not available (LWP::UserAgent not found)";
+ exit 1;
+ }
+ my $ua = new LWP::UserAgent(agent => "$0/$version");
+ $ua->env_proxy();
+ $resp = $ua->mirror($url, $txt);
+ if($resp && $resp->code eq '304') {
+ report "Not modified";
+ exit 0 if -e $crt && !$opt_f;
+ }
+ else {
+ $fetched = 1;
+ report "Downloaded $txt";
+ }
+ if(!$resp || $resp->code !~ /^(?:200|304)$/) {
+ report "Unable to download latest data: "
+ . ($resp? $resp->code . ' - ' . $resp->message : "LWP failed");
+ exit 1 if -e $crt || ! -r $txt;
+ }
+ }
+}
+
+my $filedate = $resp ? $resp->last_modified : (stat($txt))[9];
+my $datesrc = "as of";
+if(!$filedate) {
+ # mxr.mozilla.org gave us a time, hg.mozilla.org does not!
+ $filedate = time();
+ $datesrc="downloaded on";
+}
+
+# get the hash from the download file
+my $newhash= sha256($txt);
+
+if(!$opt_f && $oldhash eq $newhash) {
+ report "Downloaded file identical to previous run\'s source file. Exiting";
+ exit;
+}
+
+report "SHA256 of new file: $newhash";
+
+my $currentdate = scalar gmtime($filedate);
+
+my $format = $opt_t ? "plain text and " : "";
+if( $stdout ) {
+ open(CRT, '> -') or die "Couldn't open STDOUT: $!\n";
+} else {
+ open(CRT,">$crt.~") or die "Couldn't open $crt.~: $!\n";
+}
+print CRT <<EOT;
+##
+## Bundle of CA Root Certificates
+##
+## Certificate data from Mozilla ${datesrc}: ${currentdate} GMT
+##
+## This is a bundle of X.509 certificates of public Certificate Authorities
+## (CA). These were automatically extracted from Mozilla's root certificates
+## file (certdata.txt). This file can be found in the mozilla source tree:
+## ${url}
+##
+## It contains the certificates in ${format}PEM format and therefore
+## can be directly used with curl / libcurl / php_curl, or with
+## an Apache+mod_ssl webserver for SSL client authentication.
+## Just configure this file as the SSLCACertificateFile.
+##
+## Conversion done with mk-ca-bundle.pl version $version.
+## SHA256: $newhash
+##
+
+EOT
+
+report "Processing '$txt' ...";
+my $caname;
+my $certnum = 0;
+my $skipnum = 0;
+my $start_of_cert = 0;
+my @precert;
+
+open(TXT,"$txt") or die "Couldn't open $txt: $!\n";
+while (<TXT>) {
+ if (/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) {
+ print CRT;
+ print if ($opt_l);
+ while (<TXT>) {
+ print CRT;
+ print if ($opt_l);
+ last if (/\*\*\*\*\* END LICENSE BLOCK \*\*\*\*\*/);
+ }
+ }
+ elsif(/^# (Issuer|Serial Number|Subject|Not Valid Before|Not Valid After |Fingerprint \(MD5\)|Fingerprint \(SHA1\)):/) {
+ push @precert, $_;
+ next;
+ }
+ elsif(/^#|^\s*$/) {
+ undef @precert;
+ next;
+ }
+ chomp;
+
+ # this is a match for the start of a certificate
+ if (/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/) {
+ $start_of_cert = 1
+ }
+ if ($start_of_cert && /^CKA_LABEL UTF8 \"(.*)\"/) {
+ $caname = $1;
+ }
+ my %trust_purposes_by_level;
+ if ($start_of_cert && /^CKA_VALUE MULTILINE_OCTAL/) {
+ my $data;
+ while (<TXT>) {
+ last if (/^END/);
+ chomp;
+ my @octets = split(/\\/);
+ shift @octets;
+ for (@octets) {
+ $data .= chr(oct);
+ }
+ }
+ # scan forwards until the trust part
+ while (<TXT>) {
+ last if (/^CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST/);
+ chomp;
+ }
+ # now scan the trust part to determine how we should trust this cert
+ while (<TXT>) {
+ last if (/^#/);
+ if (/^CKA_TRUST_([A-Z_]+)\s+CK_TRUST\s+CKT_NSS_([A-Z_]+)\s*$/) {
+ if ( !is_in_list($1,@valid_mozilla_trust_purposes) ) {
+ report "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2";
+ } elsif ( !is_in_list($2,@valid_mozilla_trust_levels) ) {
+ report "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2";
+ } else {
+ push @{$trust_purposes_by_level{$2}}, $1;
+ }
+ }
+ }
+
+ if ( !should_output_cert(%trust_purposes_by_level) ) {
+ $skipnum ++;
+ } else {
+ my $encoded = MIME::Base64::encode_base64($data, '');
+ $encoded =~ s/(.{1,${opt_w}})/$1\n/g;
+ my $pem = "-----BEGIN CERTIFICATE-----\n"
+ . $encoded
+ . "-----END CERTIFICATE-----\n";
+ print CRT "\n$caname\n";
+ print CRT @precert if($opt_m);
+ my $maxStringLength = length(decode('UTF-8', $caname, Encode::FB_CROAK));
+ if ($opt_t) {
+ foreach my $key (keys %trust_purposes_by_level) {
+ my $string = $key . ": " . join(", ", @{$trust_purposes_by_level{$key}});
+ $maxStringLength = List::Util::max( length($string), $maxStringLength );
+ print CRT $string . "\n";
+ }
+ }
+ print CRT ("=" x $maxStringLength . "\n");
+ if (!$opt_t) {
+ print CRT $pem;
+ } else {
+ my $pipe = "";
+ foreach my $hash (@included_signature_algorithms) {
+ $pipe = "|$openssl x509 -" . $hash . " -fingerprint -noout -inform PEM";
+ if (!$stdout) {
+ $pipe .= " >> $crt.~";
+ close(CRT) or die "Couldn't close $crt.~: $!";
+ }
+ open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
+ print TMP $pem;
+ close(TMP) or die "Couldn't close openssl pipe: $!";
+ if (!$stdout) {
+ open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
+ }
+ }
+ $pipe = "|$openssl x509 -text -inform PEM";
+ if (!$stdout) {
+ $pipe .= " >> $crt.~";
+ close(CRT) or die "Couldn't close $crt.~: $!";
+ }
+ open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
+ print TMP $pem;
+ close(TMP) or die "Couldn't close openssl pipe: $!";
+ if (!$stdout) {
+ open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
+ }
+ }
+ report "Parsing: $caname" if ($opt_v);
+ $certnum ++;
+ $start_of_cert = 0;
+ }
+ undef @precert;
+ }
+
+}
+close(TXT) or die "Couldn't close $txt: $!\n";
+close(CRT) or die "Couldn't close $crt.~: $!\n";
+unless( $stdout ) {
+ if ($opt_b && -e $crt) {
+ my $bk = 1;
+ while (-e "$crt.~${bk}~") {
+ $bk++;
+ }
+ rename $crt, "$crt.~${bk}~" or die "Failed to create backup $crt.~$bk}~: $!\n";
+ } elsif( -e $crt ) {
+ unlink( $crt ) or die "Failed to remove $crt: $!\n";
+ }
+ rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n";
+}
+if($opt_u && -e $txt && !unlink($txt)) {
+ report "Failed to remove $txt: $!\n";
+}
+report "Done ($certnum CA certs processed, $skipnum skipped).";
diff --git a/ports/qca/portfile.cmake b/ports/qca/portfile.cmake
new file mode 100644
index 000000000..072c4b7cb
--- /dev/null
+++ b/ports/qca/portfile.cmake
@@ -0,0 +1,123 @@
+# This portfile adds the Qt Cryptographic Arcitecture
+# Changes to the original build:
+# No -qt5 suffix, which is recommended just for Linux
+# Output directories according to vcpkg
+# Updated certstore. See certstore.pem in the output dirs
+#
+
+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)
+vcpkg_find_acquire_program(PERL)
+get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
+set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}")
+
+# Set git variables to qca version 2.2.0 commit
+set(GIT_URL "git://anongit.kde.org/qca.git")
+set(GIT_REF "19ec49f89a0a560590ec733c549b92e199792837") # Commit
+
+# Prepare source dir
+if(NOT EXISTS "${DOWNLOADS}/qca.git")
+ message(STATUS "Cloning")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/qca.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}/qca.git
+ LOGNAME worktree
+ )
+endif()
+message(STATUS "Adding worktree done")
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/)
+
+# Apply the patch to install to the expected folders
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-fix-path-for-vcpkg.patch
+)
+
+# According to:
+# https://www.openssl.org/docs/faq.html#USER16
+# it is up to developers or admins to maintain CAs.
+# So we do it here:
+message(STATUS "Importing certstore")
+file(REMOVE ${SOURCE_PATH}/certs/rootcerts.pem)
+# Using file(DOWNLOAD) to use https
+file(DOWNLOAD https://raw.githubusercontent.com/mozilla/gecko-dev/master/security/nss/lib/ckfw/builtins/certdata.txt
+ ${CMAKE_CURRENT_LIST_DIR}/certdata.txt
+ TLS_VERIFY ON
+)
+vcpkg_execute_required_process(
+ COMMAND ${PERL} ${CMAKE_CURRENT_LIST_DIR}/mk-ca-bundle.pl -n ${SOURCE_PATH}/certs/rootcerts.pem
+ WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
+ LOGNAME ca-bundle
+)
+message(STATUS "Importing certstore done")
+
+# Configure and build
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ CURRENT_PACKAGES_DIR ${CURRENT_PACKAGES_DIR}
+ OPTIONS
+ -DBUILD_SHARED_LIBS=ON
+ -DUSE_RELATIVE_PATHS=ON
+ -DQT4_BUILD=OFF
+ -DBUILD_TESTS=OFF
+ -DBUILD_TOOLS=OFF
+ -DQCA_SUFFIX=OFF
+ -DQCA_FEATURE_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/share/qca/mkspecs/features
+ OPTIONS_DEBUG
+ -DQCA_PLUGINS_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/bin/Qca
+ OPTIONS_RELEASE
+ -DQCA_PLUGINS_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/bin/Qca
+)
+
+vcpkg_install_cmake()
+
+# Patch and copy cmake files
+message(STATUS "Patching files")
+file(READ
+ ${CURRENT_PACKAGES_DIR}/debug/share/qca/cmake/QcaTargets-debug.cmake
+ QCA_DEBUG_CONFIG
+)
+string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" QCA_DEBUG_CONFIG "${QCA_DEBUG_CONFIG}")
+file(WRITE
+ ${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets-debug.cmake
+ "${QCA_DEBUG_CONFIG}"
+)
+
+file(READ ${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets.cmake
+ QCA_TARGET_CONFIG
+)
+string(REPLACE "packages/qca_" "installed/" QCA_TARGET_CONFIG "${QCA_TARGET_CONFIG}")
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets.cmake
+ "${QCA_TARGET_CONFIG}"
+)
+
+# Remove unneeded dirs
+file(REMOVE_RECURSE
+ ${CURRENT_BUILDTREES_DIR}/share/man
+ ${CURRENT_PACKAGES_DIR}/share/man
+ ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/debug/share
+)
+message(STATUS "Patching files done")
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/qca)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/qca/COPYING ${CURRENT_PACKAGES_DIR}/share/qca/copyright)
diff --git a/ports/qt5/CONTROL b/ports/qt5/CONTROL
new file mode 100644
index 000000000..40bde5f2a
--- /dev/null
+++ b/ports/qt5/CONTROL
@@ -0,0 +1,4 @@
+Source: qt5
+Version: 5.7.1-2
+Description: Qt5 application framework main components. Webengine, examples and tests not included.
+Build-Depends: sqlite3, libpq
diff --git a/ports/qt5/fixcmake.py b/ports/qt5/fixcmake.py
new file mode 100644
index 000000000..bd37c1e54
--- /dev/null
+++ b/ports/qt5/fixcmake.py
@@ -0,0 +1,44 @@
+import os
+import re
+from glob import glob
+
+files = [y for x in os.walk('.') for y in glob(os.path.join(x[0], '*.cmake'))]
+
+for f in files:
+ openedfile = open(f, "r")
+ builder = ""
+ exepattern = re.compile("_install_prefix}/bin/[a-z]+.exe")
+ for line in openedfile:
+ if "_install_prefix}/bin/${LIB_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line
+ builder += " else()"
+ builder += "\n " + line.replace("/bin/", "/debug/bin/")
+ builder += " endif()\n"
+ elif "_install_prefix}/lib/${LIB_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line
+ builder += " else()"
+ builder += "\n " + line.replace("/lib/", "/debug/lib/")
+ builder += " endif()\n"
+ elif "_install_prefix}/lib/${IMPLIB_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line
+ builder += " else()"
+ builder += "\n " + line.replace("/lib/", "/debug/lib/")
+ builder += " endif()\n"
+ elif "_install_prefix}/lib/qtmaind.lib" in line:
+ builder += line.replace("/lib/", "/debug/lib/")
+ elif "_install_prefix}/plugins/${PLUGIN_LOCATION}" in line:
+ builder += " if (${Configuration} STREQUAL \"RELEASE\")"
+ builder += "\n " + line
+ builder += " else()"
+ builder += "\n " + line.replace("/plugins/", "/debug/plugins/")
+ builder += " endif()\n"
+ elif exepattern.search(line) != None:
+ builder += line.replace("/bin/", "/tools/")
+ else:
+ builder += line
+ new_file = open(f, "w")
+ new_file.write(builder)
+ new_file.close() \ No newline at end of file
diff --git a/ports/qt5/portfile.cmake b/ports/qt5/portfile.cmake
new file mode 100644
index 000000000..2b337df02
--- /dev/null
+++ b/ports/qt5/portfile.cmake
@@ -0,0 +1,167 @@
+include(${CMAKE_TRIPLET_FILE})
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/qt-5.7.1)
+set(OUTPUT_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+set(ENV{QTDIR} ${OUTPUT_PATH}/qtbase)
+set(ENV{PATH} "${OUTPUT_PATH}/qtbase/bin;$ENV{PATH}")
+
+find_program(NMAKE nmake)
+vcpkg_find_acquire_program(JOM)
+vcpkg_find_acquire_program(PERL)
+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{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}")
+set(ENV{LIB} "${CURRENT_INSTALLED_DIR}/lib;$ENV{LIB}")
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "http://download.qt.io/official_releases/qt/5.7/5.7.1/single/qt-everywhere-opensource-src-5.7.1.7z"
+ FILENAME "qt-5.7.1.7z"
+ SHA512 3ffcf490a1c0107a05113aebbf70015c50d05fbb35439273c243133ddb146d51aacae15ecd6411d563cc8cfe103df896394c365a69bc48fc86c3bce6a1af3107
+)
+vcpkg_extract_source_archive(${ARCHIVE_FILE})
+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()
+
+file(MAKE_DIRECTORY ${OUTPUT_PATH})
+if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
+ list(APPEND QT_RUNTIME_LINKAGE "-static")
+ list(APPEND QT_RUNTIME_LINKAGE "-static-runtime")
+ 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()
+
+message(STATUS "Configuring ${TARGET_TRIPLET}")
+vcpkg_execute_required_process(
+ COMMAND "${SOURCE_PATH}/configure.bat"
+ -confirm-license -opensource -platform win32-msvc2015
+ -debug-and-release -force-debug-info ${QT_RUNTIME_LINKAGE}
+ -qt-zlib
+ -qt-libjpeg
+ -no-libpng
+ -no-freetype
+ -qt-pcre
+ -no-harfbuzz
+ -system-sqlite
+ -nomake examples -nomake tests -skip webengine
+ -qt-sql-sqlite -qt-sql-psql
+ -prefix ${CURRENT_PACKAGES_DIR}
+ -bindir ${CURRENT_PACKAGES_DIR}/bin
+ -hostbindir ${CURRENT_PACKAGES_DIR}/tools
+ -archdatadir ${CURRENT_PACKAGES_DIR}/share/qt5
+ -datadir ${CURRENT_PACKAGES_DIR}/share/qt5
+ -plugindir ${CURRENT_PACKAGES_DIR}/plugins
+ WORKING_DIRECTORY ${OUTPUT_PATH}
+ LOGNAME configure-${TARGET_TRIPLET}
+)
+message(STATUS "Configure ${TARGET_TRIPLET} done")
+
+message(STATUS "Building ${TARGET_TRIPLET}")
+vcpkg_execute_required_process_repeat(
+ COUNT 5
+ COMMAND ${JOM}
+ WORKING_DIRECTORY ${OUTPUT_PATH}
+ LOGNAME build-${TARGET_TRIPLET}
+)
+message(STATUS "Build ${TARGET_TRIPLET} done")
+
+message(STATUS "Installing ${TARGET_TRIPLET}")
+vcpkg_execute_required_process(
+ COMMAND ${JOM} -j1 install
+ WORKING_DIRECTORY ${OUTPUT_PATH}
+ LOGNAME install-${TARGET_TRIPLET}
+)
+message(STATUS "Install ${TARGET_TRIPLET} done")
+
+message(STATUS "Packaging ${TARGET_TRIPLET}")
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake)
+
+if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ file(INSTALL ${CURRENT_PACKAGES_DIR}/bin
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug
+ FILES_MATCHING PATTERN "*d.dll"
+ )
+ file(INSTALL ${CURRENT_PACKAGES_DIR}/bin
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug
+ FILES_MATCHING PATTERN "*d.pdb"
+ )
+ file(GLOB DEBUG_BIN_FILES "${CURRENT_PACKAGES_DIR}/bin/*d.dll")
+ 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)
+endif()
+
+file(INSTALL ${CURRENT_PACKAGES_DIR}/lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug
+ FILES_MATCHING PATTERN "*d.lib"
+)
+file(INSTALL ${CURRENT_PACKAGES_DIR}/lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug
+ FILES_MATCHING PATTERN "*d.prl"
+)
+file(INSTALL ${CURRENT_PACKAGES_DIR}/lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug
+ FILES_MATCHING PATTERN "*d.pdb"
+)
+file(GLOB DEBUG_LIB_FILES "${CURRENT_PACKAGES_DIR}/lib/*d.lib")
+file(REMOVE ${DEBUG_LIB_FILES})
+file(GLOB DEBUG_LIB_FILES "${CURRENT_PACKAGES_DIR}/lib/*d.prl")
+file(REMOVE ${DEBUG_LIB_FILES})
+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)
+file(GLOB BINARY_TOOLS "${CURRENT_PACKAGES_DIR}/bin/*.exe")
+file(INSTALL ${BINARY_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
+file(REMOVE ${BINARY_TOOLS})
+file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/plugins")
+file(GLOB_RECURSE DEBUG_PLUGINS
+ "${CURRENT_PACKAGES_DIR}/plugins/*d.dll"
+ "${CURRENT_PACKAGES_DIR}/plugins/*d.pdb"
+)
+foreach(file ${DEBUG_PLUGINS})
+ get_filename_component(file_n ${file} NAME)
+ file(RELATIVE_PATH file_rel "${CURRENT_PACKAGES_DIR}/plugins" ${file})
+ get_filename_component(rel_dir ${file_rel} DIRECTORY)
+ 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)
+endif()
+
+vcpkg_execute_required_process(
+ COMMAND ${PYTHON3} ${CMAKE_CURRENT_LIST_DIR}/fixcmake.py
+ WORKING_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/cmake
+ LOGNAME fix-cmake
+)
+
+file(INSTALL ${SOURCE_PATH}/LICENSE.LGPLv3 DESTINATION ${CURRENT_PACKAGES_DIR}/share/qt5 RENAME copyright)
+
+vcpkg_copy_pdbs()
+
diff --git a/ports/qt5/set-shared-qmakespec.patch b/ports/qt5/set-shared-qmakespec.patch
new file mode 100644
index 000000000..d4b7c2a82
--- /dev/null
+++ b/ports/qt5/set-shared-qmakespec.patch
@@ -0,0 +1,18 @@
+diff --git a/qtbase/mkspecs/common/msvc-desktop.conf b/qtbase/mkspecs/common/msvc-desktop.conf
+index 80fcd9b..1b9d57b 100644
+--- a/qtbase/mkspecs/common/msvc-desktop.conf
++++ b/qtbase/mkspecs/common/msvc-desktop.conf
+@@ -29,9 +29,9 @@
+ QMAKE_YACCFLAGS = -d
+ QMAKE_CFLAGS = -nologo -Zc:wchar_t
+ QMAKE_CFLAGS_WARN_ON = -W3
+ QMAKE_CFLAGS_WARN_OFF = -W0
+-QMAKE_CFLAGS_RELEASE = -O2 -MT
+-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
+-QMAKE_CFLAGS_DEBUG = -Zi -MTd
++QMAKE_CFLAGS_RELEASE = -O2 -MD
++QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
++QMAKE_CFLAGS_DEBUG = -Zi -MDd
+ QMAKE_CFLAGS_YACC =
+ QMAKE_CFLAGS_LTCG = -GL
+ \ No newline at end of file
diff --git a/ports/qt5/set-static-qmakespec.patch b/ports/qt5/set-static-qmakespec.patch
new file mode 100644
index 000000000..26b312f2f
--- /dev/null
+++ b/ports/qt5/set-static-qmakespec.patch
@@ -0,0 +1,18 @@
+diff --git a/qtbase/mkspecs/common/msvc-desktop.conf b/qtbase/mkspecs/common/msvc-desktop.conf
+index 1b9d57b..80fcd9b 100644
+--- a/qtbase/mkspecs/common/msvc-desktop.conf
++++ b/qtbase/mkspecs/common/msvc-desktop.conf
+@@ -29,9 +29,9 @@
+ QMAKE_YACCFLAGS = -d
+ QMAKE_CFLAGS = -nologo -Zc:wchar_t
+ QMAKE_CFLAGS_WARN_ON = -W3
+ QMAKE_CFLAGS_WARN_OFF = -W0
+-QMAKE_CFLAGS_RELEASE = -O2 -MD
+-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
+-QMAKE_CFLAGS_DEBUG = -Zi -MDd
++QMAKE_CFLAGS_RELEASE = -O2 -MT
++QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
++QMAKE_CFLAGS_DEBUG = -Zi -MTd
+ QMAKE_CFLAGS_YACC =
+ QMAKE_CFLAGS_LTCG = -GL
+ \ No newline at end of file
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/ragel/CONTROL b/ports/ragel/CONTROL
index 086159ab3..78aaf1679 100644
--- a/ports/ragel/CONTROL
+++ b/ports/ragel/CONTROL
@@ -1,3 +1,3 @@
Source: ragel
Version: 6.9
-Description:
+Description:Ragel State Machine Compiler
diff --git a/ports/ragel/portfile.cmake b/ports/ragel/portfile.cmake
index 2c1f09de9..c240fdefd 100644
--- a/ports/ragel/portfile.cmake
+++ b/ports/ragel/portfile.cmake
@@ -6,9 +6,8 @@
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ragel-6.9)
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ragel-6.9)
vcpkg_download_distfile(ARCHIVE
URLS "http://www.colm.net/files/ragel/ragel-6.9.tar.gz"
FILENAME "ragel-6.9.tar.gz"
@@ -37,5 +36,5 @@ vcpkg_install_cmake()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/ragel.txt)
# Handle copyright
-file(COPY ${CURRENT_BUILDTREES_DIR}/src/ragel-6.9/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/ragel)
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/ragel)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/ragel/COPYING ${CURRENT_PACKAGES_DIR}/share/ragel/copyright)
diff --git a/ports/range-v3/CONTROL b/ports/range-v3/CONTROL
index a04b8d3b7..aa8ad164d 100644
--- a/ports/range-v3/CONTROL
+++ b/ports/range-v3/CONTROL
@@ -1,3 +1,3 @@
Source: range-v3
-Version: 0.0.0-1
+Version: 20150729-vcpkg2
Description: Range library for C++11/14/17.
diff --git a/ports/range-v3/portfile.cmake b/ports/range-v3/portfile.cmake
index 692adf347..24ac932e1 100644
--- a/ports/range-v3/portfile.cmake
+++ b/ports/range-v3/portfile.cmake
@@ -1,12 +1,20 @@
+#header-only library
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/Range-V3-VS2015-ede9ad367fd5ec764fecb039c874614bd908e6b6)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/range-v3-6eb5c831ffe12cd5cb96390dbe917ca1b248772d)
vcpkg_download_distfile(ARCHIVE
- URLS "https://github.com/Microsoft/Range-V3-VS2015/archive/ede9ad367fd5ec764fecb039c874614bd908e6b6.zip"
- FILENAME "range-v3-ede9ad367fd5ec764fecb039c874614bd908e6b6.zip"
- SHA512 e978c7694471d8616c248647b77689f377b3e2517347abde8629b140e5994de8bf686565a24cdd7dd222f325d43b775f5e478c91220dce75313985499b134637
+ URLS "https://github.com/ericniebler/range-v3/archive/6eb5c831ffe12cd5cb96390dbe917ca1b248772d.zip"
+ FILENAME "range-v3-6eb5c831ffe12cd5cb96390dbe917ca1b248772d.zip"
+ SHA512 2605af46c2c049f66dc982b1c4e506a8f115d47cc6c61a80f08921c667e52ad3097c485280ee43711c84b84a1490929e085b89cf9ad4c83b93222315210e92aa
+)
+vcpkg_download_distfile(DIFF
+ URLS "https://github.com/Microsoft/Range-V3-VS2015/compare/fork_base...2cb66781c8ac72a55fff1436e8fc8170a2ce8509.diff"
+ FILENAME "range-v3-fork_base_to_2cb66781c8ac72a55fff1436e8fc8170a2ce8509.diff"
+ SHA512 5c1728387967a5c14596d6d71e7c28f0206c22b652f4c96955711bcb805816eb106b62fcfde0a7d514eeed28fe6ce1f8c593fa3ef7df70f8da3b88b6d79c1515
)
vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} PATCHES ${DIFF})
+
file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/range-v3)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/range-v3/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/range-v3/copyright)
file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp")
diff --git a/ports/rapidjson/portfile.cmake b/ports/rapidjson/portfile.cmake
index d907210d0..3d923cb95 100644
--- a/ports/rapidjson/portfile.cmake
+++ b/ports/rapidjson/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/rapidxml/portfile.cmake b/ports/rapidxml/portfile.cmake
index 90dd06911..a5f3190d0 100644
--- a/ports/rapidxml/portfile.cmake
+++ b/ports/rapidxml/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rapidxml-1.13)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/rxcpp/CONTROL b/ports/rxcpp/CONTROL
index b4440da35..02b873816 100644
--- a/ports/rxcpp/CONTROL
+++ b/ports/rxcpp/CONTROL
@@ -1,3 +1,3 @@
Source: rxcpp
-Version: 2.3.0
+Version: 3.0.0
Description: Reactive Extensions for C++ \ No newline at end of file
diff --git a/ports/rxcpp/portfile.cmake b/ports/rxcpp/portfile.cmake
index 15d0dc15c..4a321222d 100644
--- a/ports/rxcpp/portfile.cmake
+++ b/ports/rxcpp/portfile.cmake
@@ -1,12 +1,12 @@
-include(${CMAKE_TRIPLET_FILE})
+#header-only library
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/RxCpp-2.3.0)
-vcpkg_download_distfile(ARCHIVE_FILE
- URLS "https://github.com/Reactive-Extensions/RxCpp/archive/v2.3.0.tar.gz"
- FILENAME "RxCpp-2.3.0.tar.gz"
- SHA512 180cf36777b0c14e989b4b79f01fcda7ecabfe4b3cee3ad7343138497578af02745de63f74941ec228eac3fccca4a7dfdfdd1c4d16a89438022dca6f9968953f
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/RxCpp-3.0.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Reactive-Extensions/RxCpp/archive/v3.0.0.tar.gz"
+ FILENAME "RxCpp-v3.0.0.tar.gz"
+ SHA512 6d810b6163d0920d531f32a13729e290c81b47d5fc9c3e3d3d8a25d27a6f0671fec097d091bef7383b7e556e9e5471db087bb955e7f4fd9a5fdc9e7b06050844
)
-vcpkg_extract_source_archive(${ARCHIVE_FILE})
+vcpkg_extract_source_archive(${ARCHIVE})
file(INSTALL
${SOURCE_PATH}/Rx/v2/src/rxcpp
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/sdl2/CONTROL b/ports/sdl2/CONTROL
index 5a05183f2..c0d747691 100644
--- a/ports/sdl2/CONTROL
+++ b/ports/sdl2/CONTROL
@@ -1,3 +1,3 @@
Source: sdl2
-Version: 2.0.4
-Description: Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. \ No newline at end of file
+Version: 2.0.5-2
+Description: Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
diff --git a/ports/sdl2/dont-ignore-default-libs.patch b/ports/sdl2/dont-ignore-default-libs.patch
new file mode 100644
index 000000000..c9f4c6079
--- /dev/null
+++ b/ports/sdl2/dont-ignore-default-libs.patch
@@ -0,0 +1,22 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 54a23f0..91c5736 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1549,7 +1549,7 @@ if(SDL_SHARED)
+ SOVERSION ${LT_REVISION}
+ OUTPUT_NAME "SDL2")
+ endif()
+- if(MSVC)
++ if(MSVC AND NOT LIBC)
+ # Don't try to link with the default set of libraries.
+ set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
+ set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
+@@ -1564,7 +1564,7 @@ if(SDL_STATIC)
+ add_library(SDL2-static STATIC ${SOURCE_FILES})
+ set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2")
+ set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC})
+- if(MSVC)
++ if(MSVC AND NOT LIBC)
+ set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
+ set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
+ set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
diff --git a/ports/sdl2/portfile.cmake b/ports/sdl2/portfile.cmake
index bfd4a8f63..185e39665 100644
--- a/ports/sdl2/portfile.cmake
+++ b/ports/sdl2/portfile.cmake
@@ -1,13 +1,19 @@
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.4)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2-2.0.5)
vcpkg_download_distfile(ARCHIVE_FILE
- URLS "http://libsdl.org/release/SDL2-2.0.4.tar.gz"
- FILENAME "SDL2-2.0.4.tar.gz"
- SHA512 dd0a95878639856c0f4b8a579ace8071379ab64519fa139b22d3ed857a0f0db87a75bc8480c7207e02fbffd1fdbd448e3c0b882c451675b0e2f1a945af02e1d6
+ URLS "http://libsdl.org/release/SDL2-2.0.5.tar.gz"
+ FILENAME "SDL2-2.0.5.tar.gz"
+ SHA512 6401f5df08c08316c09bc6ac5b28345c5184bb25770baa5c94c0a582ae130ddf73bb736e44bb31f4e427c1ddbbeec4755a6a5f530b6b4c3d0f13ebc78ddc1750
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
-if(TRIPLET_SYSTEM_NAME MATCHES "WindowsStore")
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/dont-ignore-default-libs.patch
+)
+
+if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
)
@@ -28,10 +34,26 @@ if(TRIPLET_SYSTEM_NAME MATCHES "WindowsStore")
file(COPY ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/include/include ${CURRENT_PACKAGES_DIR}/include/SDL2)
else()
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ set(SDL_STATIC_LIB ON)
+ set(SDL_SHARED_LIB OFF)
+ else()
+ set(SDL_STATIC_LIB OFF)
+ set(SDL_SHARED_LIB ON)
+ endif()
+ if(VCPKG_CRT_LINKAGE STREQUAL static)
+ set(SDL_STATIC_CRT ON)
+ else()
+ set(SDL_STATIC_CRT OFF)
+ endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
- -DSDL_STATIC=OFF
+ -DSDL_STATIC=${SDL_STATIC_LIB}
+ -DSDL_SHARED=${SDL_SHARED_LIB}
+ -DFORCE_STATIC_VCRT=${SDL_STATIC_CRT}
+ -DLIBC=ON
)
vcpkg_install_cmake()
@@ -39,5 +61,10 @@ else()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
endif()
+file(COPY ${CURRENT_PACKAGES_DIR}/lib/SDL2main.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/SDL2main.lib)
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/SDL2main.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/SDL2main.lib)
+
file(INSTALL ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2 RENAME copyright)
vcpkg_copy_pdbs()
diff --git a/ports/sery/portfile.cmake b/ports/sery/portfile.cmake
index 900ca74e0..d6ebad5b6 100644
--- a/ports/sery/portfile.cmake
+++ b/ports/sery/portfile.cmake
@@ -1,3 +1,7 @@
+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/Sery-1.0")
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/sfml/CMakeLists.txt b/ports/sfml/CMakeLists.txt
new file mode 100644
index 000000000..e8e16edec
--- /dev/null
+++ b/ports/sfml/CMakeLists.txt
@@ -0,0 +1,122 @@
+cmake_minimum_required(VERSION 2.6)
+project(SFML)
+
+include_directories(${PROJECT_SOURCE_DIR}/include)
+include_directories(${PROJECT_SOURCE_DIR}/src)
+
+if(NOT BUILD_SHARED_LIBS)
+ add_definitions(-DSFML_STATIC)
+endif()
+add_definitions(-DUNICODE -D_UNICODE)
+add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
+
+# import SFML's 'sfml_add_library' macro and find_package utils
+
+set(VERSION_MAJOR 2)
+set(SFML_OS_WINDOWS ON)
+set(SFML_GENERATE_PDB ON)
+include(cmake/macros.cmake)
+set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules/)
+
+# system module
+
+file(GLOB SFML_SYSTEM_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/SFML/System/*.cpp
+ ${PROJECT_SOURCE_DIR}/src/SFML/System/Win32/*cpp)
+
+sfml_add_library(sfml-system
+ SOURCES ${SFML_SYSTEM_SOURCES}
+ EXTERNAL_LIBS winmm)
+
+# window module
+
+file(GLOB SFML_WINDOW_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/SFML/Window/*.cpp
+ ${PROJECT_SOURCE_DIR}/src/SFML/Window/Win32/*cpp)
+
+list(REMOVE_ITEM SFML_WINDOW_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/SFML/Window/EGLCheck.cpp
+ ${PROJECT_SOURCE_DIR}/src/SFML/Window/EglContext.cpp)
+
+sfml_add_library(sfml-window
+ SOURCES ${SFML_WINDOW_SOURCES}
+ DEPENDS sfml-system
+ EXTERNAL_LIBS winmm gdi32 opengl32)
+
+# network module
+
+file(GLOB SFML_NETWORK_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/SFML/Network/*.cpp
+ ${PROJECT_SOURCE_DIR}/src/SFML/Network/Win32/*cpp)
+
+sfml_add_library(sfml-network
+ SOURCES ${SFML_NETWORK_SOURCES}
+ DEPENDS sfml-system
+ EXTERNAL_LIBS ws2_32)
+
+# audio module
+
+file(GLOB SFML_AUDIO_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/SFML/Audio/*.cpp)
+
+find_package(OpenAL REQUIRED)
+find_package(Vorbis REQUIRED)
+find_package(FLAC REQUIRED)
+
+sfml_add_library(sfml-audio
+ SOURCES ${SFML_AUDIO_SOURCES}
+ DEPENDS sfml-system
+ EXTERNAL_LIBS ${OPENAL_LIBRARY} ${VORBIS_LIBRARIES} ${FLAC_LIBRARY})
+
+target_include_directories(sfml-audio SYSTEM PRIVATE ${OPENAL_INCLUDE_DIR})
+target_include_directories(sfml-audio SYSTEM PRIVATE ${VORBIS_INCLUDE_DIRS})
+target_include_directories(sfml-audio SYSTEM PRIVATE ${FLAC_INCLUDE_DIR})
+
+# graphics module
+
+file(GLOB SFML_GRAPHICS_SOURCES
+ ${PROJECT_SOURCE_DIR}/src/SFML/Graphics/*.cpp)
+
+find_package(JPEG REQUIRED)
+find_package(Freetype REQUIRED) # fails to find debug lib
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+ find_library(FREETYPE_DEBUG_LIBRARY freetyped)
+ set(FREETYPE_ACTUAL_LIBRARY ${FREETYPE_DEBUG_LIBRARY})
+else()
+ set(FREETYPE_ACTUAL_LIBRARY ${FREETYPE_LIBRARY})
+endif()
+find_path(STB_HEADERS stb_image.h)
+
+sfml_add_library(sfml-graphics
+ SOURCES ${SFML_GRAPHICS_SOURCES}
+ DEPENDS sfml-system sfml-window
+ EXTERNAL_LIBS ${FREETYPE_ACTUAL_LIBRARY} ${JPEG_LIBRARY} opengl32)
+
+target_include_directories(sfml-graphics SYSTEM PRIVATE ${STB_HEADERS})
+target_include_directories(sfml-graphics SYSTEM PRIVATE ${FREETYPE_INCLUDE_DIRS})
+target_include_directories(sfml-graphics SYSTEM PRIVATE ${JPEG_INCLUDE_DIR})
+set_target_properties(sfml-graphics PROPERTIES COMPILE_FLAGS -DSTBI_FAILURE_USERMSG)
+
+# main module
+
+add_library(sfml-main STATIC ${PROJECT_SOURCE_DIR}/src/SFML/Main/MainWin32.cpp)
+set_target_properties(sfml-main PROPERTIES DEBUG_POSTFIX -d)
+install(TARGETS sfml-main ARCHIVE DESTINATION lib)
+
+# headers
+
+if(NOT DEFINED SFML_SKIP_HEADERS)
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)
+endif()
+
+# log linked libraries
+
+message(STATUS "Link-time dependencies:")
+message(STATUS " " ${VORBIS_LIBRARY})
+message(STATUS " " ${VORBISFILE_LIBRARY})
+message(STATUS " " ${VORBISENC_LIBRARY})
+message(STATUS " " ${OGG_LIBRARY})
+message(STATUS " " ${OPENAL_LIBRARY})
+message(STATUS " " ${FLAC_LIBRARY})
+message(STATUS " " ${FREETYPE_ACTUAL_LIBRARY})
+message(STATUS " " ${JPEG_LIBRARY})
diff --git a/ports/sfml/CONTROL b/ports/sfml/CONTROL
new file mode 100644
index 000000000..175aaa0ab
--- /dev/null
+++ b/ports/sfml/CONTROL
@@ -0,0 +1,4 @@
+Source: sfml
+Version: 2.4.1
+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
new file mode 100644
index 000000000..916b033ef
--- /dev/null
+++ b/ports/sfml/portfile.cmake
@@ -0,0 +1,34 @@
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SFML-2.4.1)
+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)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(REMOVE_RECURSE ${SOURCE_PATH}/extlibs)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS_DEBUG
+ -DSFML_SKIP_HEADERS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+# don't force users to define SFML_STATIC while using static library
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(APPEND ${CURRENT_PACKAGES_DIR}/include/SFML/Config.hpp "#undef SFML_API_IMPORT\n#define SFML_API_IMPORT\n")
+endif()
+
+# move sfml-main to manual link dir
+file(COPY ${CURRENT_PACKAGES_DIR}/lib/sfml-main.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/sfml-main.lib)
+file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/sfml-main-d.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
+file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/sfml-main-d.lib)
+
+file(COPY ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sfml)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/sfml/license.txt ${CURRENT_PACKAGES_DIR}/share/sfml/copyright)
diff --git a/ports/shaderc/0001-Do-not-generate-build-version.inc.patch b/ports/shaderc/0001-Do-not-generate-build-version.inc.patch
new file mode 100644
index 000000000..41cc81220
--- /dev/null
+++ b/ports/shaderc/0001-Do-not-generate-build-version.inc.patch
@@ -0,0 +1,30 @@
+From e8e12e856cbc41f9bdcc83bc87eb5013df199ee1 Mon Sep 17 00:00:00 2001
+From: vlj <vljn.ovi@gmail.com>
+Date: Fri, 2 Dec 2016 16:36:25 +0100
+Subject: [PATCH] Do not generate build-version.inc
+
+---
+ CMakeLists.txt | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a4c2fac..5544a2d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -53,8 +53,8 @@ add_subdirectory(libshaderc)
+ add_subdirectory(glslc)
+ add_subdirectory(examples)
+
+-add_custom_target(build-version
+- ${PYTHON_EXE}
+- ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
+- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR}
+- COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")
++#add_custom_target(build-version
++# ${PYTHON_EXE}
++# ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
++# ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR}
++# COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")
+--
+2.10.2.windows.1
+
diff --git a/ports/shaderc/CMakeLists.txt b/ports/shaderc/CMakeLists.txt
new file mode 100644
index 000000000..3dc7be973
--- /dev/null
+++ b/ports/shaderc/CMakeLists.txt
@@ -0,0 +1,29 @@
+option(SUFFIX_D "Add d Suffix to lib" ${SUFFIX_D})
+if(NOT ${SUFFIX_D})
+ find_library(GLSLANG glslang)
+ find_library(OSDEPENDENT OSDependent)
+ find_library(OGLCOMPILER OGLCompiler)
+ find_library(HLSLLIB HLSL)
+ find_library(SPIRVLIB SPIRV)
+ELSE()
+ find_library(GLSLANG glslangd)
+ find_library(OSDEPENDENT OSDependentd)
+ find_library(OGLCOMPILER OGLCompilerd)
+ find_library(HLSLLIB HLSLd)
+ find_library(SPIRVLIB SPIRVd)
+ENDIF()
+
+add_library(glslang STATIC IMPORTED GLOBAL)
+set_property(TARGET glslang PROPERTY IMPORTED_LOCATION "${GLSLANG}")
+
+add_library(OSDependent STATIC IMPORTED GLOBAL)
+set_property(TARGET OSDependent PROPERTY IMPORTED_LOCATION "${OSDEPENDENT}")
+
+add_library(OGLCompiler STATIC IMPORTED GLOBAL)
+set_property(TARGET OGLCompiler PROPERTY IMPORTED_LOCATION "${OGLCOMPILER}")
+
+add_library(HLSL STATIC IMPORTED GLOBAL)
+set_property(TARGET HLSL PROPERTY IMPORTED_LOCATION "${HLSLLIB}")
+
+add_library(SPIRV STATIC IMPORTED GLOBAL)
+set_property(TARGET SPIRV PROPERTY IMPORTED_LOCATION "${SPIRVLIB}")
diff --git a/ports/shaderc/CMakeLists_spirv.txt b/ports/shaderc/CMakeLists_spirv.txt
new file mode 100644
index 000000000..6aa738b1f
--- /dev/null
+++ b/ports/shaderc/CMakeLists_spirv.txt
@@ -0,0 +1,14 @@
+option(SUFFIX_D "Add d Suffix to lib" ${SUFFIX_D})
+if(NOT ${SUFFIX_D})
+ find_library(SPIRVTOOLSOPT spirv-tools-opt)
+ find_library(SPIRVTOOLS spirv-tools)
+ELSE()
+ find_library(SPIRVTOOLSOPT spirv-tools-opt)
+ find_library(SPIRVTOOLS spirv-tools)
+ENDIF()
+
+add_library(SPIRV-Tools-opt STATIC IMPORTED GLOBAL)
+set_property(TARGET SPIRV-Tools-opt PROPERTY IMPORTED_LOCATION "${SPIRVTOOLSOPT}")
+
+add_library(SPIRV-Tools STATIC IMPORTED GLOBAL)
+set_property(TARGET SPIRV-Tools PROPERTY IMPORTED_LOCATION "${SPIRVTOOLS}") \ No newline at end of file
diff --git a/ports/shaderc/CONTROL b/ports/shaderc/CONTROL
new file mode 100644
index 000000000..6cab280a6
--- /dev/null
+++ b/ports/shaderc/CONTROL
@@ -0,0 +1,4 @@
+Source: shaderc
+Version: 2df47b51d83ad83cbc2e7f8ff2b56776293e8958
+Description: A collection of tools, libraries and tests for shader compilation.
+Build-Depends: glslang, spirv-tools
diff --git a/ports/shaderc/build-version.inc b/ports/shaderc/build-version.inc
new file mode 100644
index 000000000..853e89916
--- /dev/null
+++ b/ports/shaderc/build-version.inc
@@ -0,0 +1,3 @@
+"shaderc v2016.2-dev unknown hash, 2016-12-02\n"
+"spirv-tools v2016.6-dev unknown hash, 2016-12-02\n"
+"glslang unknown hash, 2016-12-02\n"
diff --git a/ports/shaderc/portfile.cmake b/ports/shaderc/portfile.cmake
new file mode 100644
index 000000000..eb17aa827
--- /dev/null
+++ b/ports/shaderc/portfile.cmake
@@ -0,0 +1,79 @@
+# 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)
+find_program(GIT git)
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src)
+
+set(SHADERC_GIT_URL "https://github.com/google/shaderc.git")
+set(SHADERC_GIT_REF "2df47b51d83ad83cbc2e7f8ff2b56776293e8958")
+if(NOT EXISTS "${DOWNLOADS}/shaderc.git")
+ message(STATUS "Cloning")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} clone --bare ${SHADERC_GIT_URL} ${DOWNLOADS}/shaderc.git
+ WORKING_DIRECTORY ${DOWNLOADS}
+ LOGNAME clone
+ )
+endif()
+if(NOT EXISTS "${SOURCE_PATH}/.git")
+ message(STATUS "Adding worktree and patching")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} worktree add -f --detach ${SOURCE_PATH} ${SHADERC_GIT_REF}
+ WORKING_DIRECTORY ${DOWNLOADS}/shaderc.git
+ LOGNAME worktree
+ )
+ message(STATUS "Patching")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/0001-Do-not-generate-build-version.inc.patch --ignore-whitespace --whitespace=fix
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME patch
+ )
+endif()
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/third_party/glslang)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_spirv.txt DESTINATION ${SOURCE_PATH}/third_party/spirv-tools)
+file(RENAME ${SOURCE_PATH}/third_party/spirv-tools/CMakeLists_spirv.txt ${SOURCE_PATH}/third_party/spirv-tools/CMakeLists.txt)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/build-version.inc DESTINATION ${SOURCE_PATH}/glslc/src)
+
+#Note: glslang and spir tools doesn't export symbol and need to be build as static lib for cmake to work
+set(VCPKG_LIBRARY_LINKAGE "static")
+set(OPTIONS)
+if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
+ list(APPEND OPTIONS -DSHADERC_ENABLE_SHARED_CRT=ON)
+endif()
+
+# shaderc uses python to manipulate copyright information
+vcpkg_find_acquire_program(PYTHON3)
+get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY)
+set(ENV{PATH} "${PYTHON3_EXE_PATH};$ENV{PATH}")
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS -DSHADERC_SKIP_TESTS=true ${OPTIONS}
+ OPTIONS_DEBUG -DSUFFIX_D=true
+ OPTIONS_RELEASE -DSUFFIX_D=false
+)
+
+vcpkg_install_cmake()
+
+file(GLOB EXES "${CURRENT_PACKAGES_DIR}/bin/*.exe")
+file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
+
+#Safe to remove as libs are static
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
+
+
+file(WRITE ${CURRENT_PACKAGES_DIR}/include/shaderc.txt)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/shaderc)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/shaderc/LICENSE ${CURRENT_PACKAGES_DIR}/share/shaderc/copyright)
diff --git a/ports/signalrclient/0001_cmake.patch b/ports/signalrclient/0001_cmake.patch
new file mode 100644
index 000000000..809667960
--- /dev/null
+++ b/ports/signalrclient/0001_cmake.patch
@@ -0,0 +1,75 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8c73730..4cd9074 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,7 +1,9 @@
+ cmake_minimum_required (VERSION 2.8.11)
+ project (signalrclient)
+
++if(NOT WIN32)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -L -lcpprest")
++endif()
+
+ set(CPPREST_INCLUDE_DIR "" CACHE FILEPATH "Path to casablanca include dir")
+
+@@ -16,4 +18,32 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+
+ add_subdirectory(src/signalrclient)
+-add_subdirectory(test)
++if(NOT DISABLE_TESTS)
++ add_subdirectory(test)
++endif()
++
++if(BUILD_SHARED_LIBS)
++ install(FILES include/signalrclient/_exports.h DESTINATION include/signalrclient)
++else()
++ file(READ include/signalrclient/_exports.h EXPORTS_H)
++ string(REPLACE "#ifdef NO_SIGNALRCLIENT_EXPORTS" "#if 1" EXPORTS_H_2 ${EXPORTS_H})
++ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/_exports.h ${EXPORTS_H_2})
++
++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/_exports.h DESTINATION include/signalrclient)
++endif()
++
++set(HEADERS
++ include/signalrclient/connection.h
++ include/signalrclient/connection_state.h
++ include/signalrclient/hub_connection.h
++ include/signalrclient/hub_exception.h
++ include/signalrclient/hub_proxy.h
++ include/signalrclient/log_writer.h
++ include/signalrclient/trace_level.h
++ include/signalrclient/transport_type.h
++ include/signalrclient/web_exception.h)
++
++install(
++ FILES ${HEADERS}
++ DESTINATION "include/signalrclient"
++)
+diff --git a/src/signalrclient/CMakeLists.txt b/src/signalrclient/CMakeLists.txt
+index 76a5e1b..db141eb 100644
+--- a/src/signalrclient/CMakeLists.txt
++++ b/src/signalrclient/CMakeLists.txt
+@@ -22,6 +22,21 @@ set (SOURCES
+ websocket_transport.cpp
+ )
+
+-add_library (signalrclient SHARED ${SOURCES})
++if(BUILD_SHARED_LIBS)
++ add_definitions(-DSIGNALRCLIENT_EXPORTS)
++else()
++ add_definitions(-DNO_SIGNALRCLIENT_EXPORTS)
++endif()
++
++add_definitions(-DUNICODE -D_UNICODE)
++
++add_library (signalrclient ${SOURCES})
+
+ target_link_libraries(signalrclient ${CPPREST_SO})
++
++install(
++ TARGETS signalrclient
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib
++ RUNTIME DESTINATION bin
++)
diff --git a/ports/signalrclient/CONTROL b/ports/signalrclient/CONTROL
new file mode 100644
index 000000000..a5673e964
--- /dev/null
+++ b/ports/signalrclient/CONTROL
@@ -0,0 +1,4 @@
+Source: signalrclient
+Version: 1.0.0-beta1
+Build-Depends: cpprestsdk
+Description: C++ client for SignalR. \ No newline at end of file
diff --git a/ports/signalrclient/portfile.cmake b/ports/signalrclient/portfile.cmake
new file mode 100644
index 000000000..22e91acab
--- /dev/null
+++ b/ports/signalrclient/portfile.cmake
@@ -0,0 +1,34 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SignalR-Client-Cpp-1.0.0-beta1)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/aspnet/SignalR-Client-Cpp/archive/1.0.0-beta1.tar.gz"
+ FILENAME "SignalR-Client-Cpp-1.0.0-beta1.tar.gz"
+ SHA512 e0090415aa724087dbe2a317a4642d6359b134e00e836ea70c71bc9186dc8d6bba097666711ab18d9b0a390e1e5f59be2f55279b6859ac20d558b901bf5fe2f2
+)
+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}
+ OPTIONS_DEBUG
+ -DCPPREST_SO=${CURRENT_INSTALLED_DIR}/debug/lib/cpprest_2_9.lib
+ OPTIONS_RELEASE
+ -DCPPREST_SO=${CURRENT_INSTALLED_DIR}/lib/cpprest_2_9.lib
+ OPTIONS
+ -DCPPREST_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include
+ -DDISABLE_TESTS=ON
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# copy license
+file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/signalrclient)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/signalrclient/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/signalrclient/copyright) \ No newline at end of file
diff --git a/ports/smpeg2/CMakeLists.txt b/ports/smpeg2/CMakeLists.txt
new file mode 100644
index 000000000..9f061cfb8
--- /dev/null
+++ b/ports/smpeg2/CMakeLists.txt
@@ -0,0 +1,57 @@
+cmake_minimum_required(VERSION 2.6)
+project(SMPEG2)
+
+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})
+
+add_definitions(-DNOCONTROLS -DTHREADED_AUDIO)
+
+# some c++ code just assumes memset is available
+file(WRITE ${CMAKE_SOURCE_DIR}/declare_memset.h "#include <string.h>\n")
+add_definitions(-FIdeclare_memset.h)
+
+add_library(smpeg2
+ audio/bitwindow.cpp
+ audio/filter.cpp
+ audio/filter_2.cpp
+ audio/hufftable.cpp
+ audio/mpeglayer1.cpp
+ audio/mpeglayer2.cpp
+ audio/mpeglayer3.cpp
+ audio/mpegtable.cpp
+ audio/mpegtoraw.cpp
+ audio/MPEGaudio.cpp
+ video/decoders.cpp
+ video/floatdct.cpp
+ video/gdith.cpp
+ video/jrevdct.cpp
+ video/motionvec.cpp
+ video/parseblock.cpp
+ video/readfile.cpp
+ video/util.cpp
+ video/video.cpp
+ video/MPEGvideo.cpp
+ MPEG.cpp
+ MPEGlist.cpp
+ MPEGring.cpp
+ MPEGstream.cpp
+ MPEGsystem.cpp
+ smpeg.cpp)
+
+target_link_libraries(smpeg2 ${SDL_LIBRARY})
+
+install(TARGETS smpeg2
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+
+if(NOT DEFINED SMPEG_SKIP_HEADERS)
+ install(FILES smpeg.h MPEGframe.h DESTINATION include)
+endif()
+
+message(STATUS "Link-time dependencies:")
+message(STATUS " " ${SDL_LIBRARY})
diff --git a/ports/smpeg2/CONTROL b/ports/smpeg2/CONTROL
new file mode 100644
index 000000000..8465a6446
--- /dev/null
+++ b/ports/smpeg2/CONTROL
@@ -0,0 +1,4 @@
+Source: smpeg2
+Version: 2.0.0
+Description: SDL MPEG Player Library
+Build-Depends: sdl2
diff --git a/ports/smpeg2/correct-sdl-headers-dir.patch b/ports/smpeg2/correct-sdl-headers-dir.patch
new file mode 100644
index 000000000..601b6c8a8
--- /dev/null
+++ b/ports/smpeg2/correct-sdl-headers-dir.patch
@@ -0,0 +1,17 @@
+diff --git a/smpeg.h b/smpeg.h
+index 6bc2dbd..d12c8f8 100644
+--- a/smpeg.h
++++ b/smpeg.h
+@@ -22,9 +22,9 @@
+ #ifndef _SMPEG_H_
+ #define _SMPEG_H_
+
+-#include "SDL.h"
+-#include "SDL_mutex.h"
+-#include "SDL_audio.h"
++#include "SDL2/SDL.h"
++#include "SDL2/SDL_mutex.h"
++#include "SDL2/SDL_audio.h"
+ #include "MPEGframe.h"
+
+ #ifdef __cplusplus
diff --git a/ports/smpeg2/portfile.cmake b/ports/smpeg2/portfile.cmake
new file mode 100644
index 000000000..43e6e623e
--- /dev/null
+++ b/ports/smpeg2/portfile.cmake
@@ -0,0 +1,27 @@
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/smpeg2-2.0.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.libsdl.org/projects/smpeg/release/smpeg2-2.0.0.tar.gz"
+ FILENAME "smpeg2-2.0.0.tar.gz"
+ SHA512 80a779d01e7aa76778ef6ceea8041537db9e4b354df413214c4413c875cb98551891cef98fa0f057cc6a3222e4983da9ae65b86bdad2f87f9e2a6751837e2baf)
+
+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})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS_DEBUG
+ -DSMPEG_SKIP_HEADERS=ON)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/smpeg2)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/smpeg2/COPYING ${CURRENT_PACKAGES_DIR}/share/smpeg2/copyright)
diff --git a/ports/soci/CONTROL b/ports/soci/CONTROL
new file mode 100644
index 000000000..5480bb712
--- /dev/null
+++ b/ports/soci/CONTROL
@@ -0,0 +1,3 @@
+Source: soci
+Version: 2016.10.22
+Description: SOCI database access library
diff --git a/ports/soci/portfile.cmake b/ports/soci/portfile.cmake
new file mode 100644
index 000000000..0358297c5
--- /dev/null
+++ b/ports/soci/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/soci-6eb1a3e9775ab7cdbf0f7f5aa5891792313cd8d9)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/SOCI/soci/archive/6eb1a3e9775ab7cdbf0f7f5aa5891792313cd8d9.zip"
+ FILENAME "soci-master-2016.10.22.zip"
+ SHA512 6bb0f7d3442de627089760485d3e663f12873b4871c4b4b4dfac5d380bad014865ac8382f7356e02514e9140f187dea8dcf8d6c25ac9c3e827e9fa69e9ed13b5
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(SOCI_STATIC OFF)
+ set(SOCI_DYNAMIC ON)
+elseif(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ set(SOCI_STATIC ON)
+ set(SOCI_DYNAMIC OFF)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DSOCI_TESTS=OFF
+ -DSOCI_CXX_C11=ON
+ -DSOCI_LIBDIR=lib # This is to always have output in the lib folder and not lib64 for 64-bit builds
+ -DSOCI_STATIC=${SOCI_STATIC}
+ -DSOCI_SHARED=${SOCI_DYNAMIC}
+)
+
+vcpkg_install_cmake()
+
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/soci)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/SOCI.cmake ${CURRENT_PACKAGES_DIR}/share/soci/SOCIConfig.cmake)
+file(RENAME ${CURRENT_PACKAGES_DIR}/cmake/SOCI-release.cmake ${CURRENT_PACKAGES_DIR}/share/soci/SOCI-release.cmake)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/cmake/SOCI-debug.cmake ${CURRENT_PACKAGES_DIR}/share/soci/SOCI-debug.cmake)
+file(READ ${CURRENT_PACKAGES_DIR}/share/soci/SOCIConfig.cmake CONFIG_FILE)
+set(pattern "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n")
+string(REPLACE "${pattern}" "${pattern}${pattern}" CONFIG_FILE ${CONFIG_FILE})
+file(WRITE ${CURRENT_PACKAGES_DIR}/share/soci/SOCIConfig.cmake ${CONFIG_FILE})
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake)
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/soci)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/soci/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/soci/copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/spdlog/portfile.cmake b/ports/spdlog/portfile.cmake
index 849bd8feb..f8a4c61ff 100644
--- a/ports/spdlog/portfile.cmake
+++ b/ports/spdlog/portfile.cmake
@@ -1,4 +1,4 @@
-include(${CMAKE_TRIPLET_FILE})
+#header-only library
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/spdlog-0.11.0)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/spirv-tools/CONTROL b/ports/spirv-tools/CONTROL
new file mode 100644
index 000000000..eacc40ff9
--- /dev/null
+++ b/ports/spirv-tools/CONTROL
@@ -0,0 +1,3 @@
+Source: spirv-tools
+Version: 1.1-f72189c249ba143c6a89a4cf1e7d53337b2ddd40
+Description: API and commands for processing SPIR-V modules
diff --git a/ports/spirv-tools/portfile.cmake b/ports/spirv-tools/portfile.cmake
new file mode 100644
index 000000000..c9bb5f85f
--- /dev/null
+++ b/ports/spirv-tools/portfile.cmake
@@ -0,0 +1,78 @@
+# 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)
+find_program(GIT git)
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src)
+
+set(GIT_URL "https://github.com/KhronosGroup/SPIRV-Tools.git")
+set(GIT_REF "f72189c249ba143c6a89a4cf1e7d53337b2ddd40")
+
+if(NOT EXISTS "${DOWNLOADS}/spirv-tools.git")
+ message(STATUS "Cloning")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/spirv-tools.git
+ WORKING_DIRECTORY ${DOWNLOADS}
+ LOGNAME clone
+ )
+endif()
+
+if(NOT EXISTS "${SOURCE_PATH}/.git")
+ message(STATUS "Adding worktree and patching")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} worktree add -f --detach ${SOURCE_PATH} ${GIT_REF}
+ WORKING_DIRECTORY ${DOWNLOADS}/spirv-tools.git
+ LOGNAME worktree
+ )
+ message(STATUS "Patching")
+endif()
+
+set(SPIRVHEADERS_GIT_URL "https://github.com/KhronosGroup/SPIRV-Headers.git")
+set(SPIRVHEADERS_GIT_REF "bd47a9abaefac00be692eae677daed1b977e625c")
+
+if(NOT EXISTS "${DOWNLOADS}/SPIRV-Headers.git")
+ message(STATUS "Cloning")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} clone --bare ${SPIRVHEADERS_GIT_URL} ${DOWNLOADS}/SPIRV-Headers.git
+ WORKING_DIRECTORY ${DOWNLOADS}
+ LOGNAME clone
+ )
+endif()
+
+if(NOT EXISTS "${SOURCE_PATH}/external/spirv-headers/.git")
+ message(STATUS "Adding worktree and patching")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} worktree add -f --detach ${SOURCE_PATH}/external/spirv-headers ${SPIRVHEADERS_GIT_REF}
+ WORKING_DIRECTORY ${DOWNLOADS}/SPIRV-Headers.git
+ LOGNAME worktree
+ )
+endif()
+
+set(VCPKG_LIBRARY_LINKAGE "static")
+
+vcpkg_configure_cmake(
+ SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src"
+ # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
+ # OPTIONS_RELEASE -DOPTIMIZE=1
+ # OPTIONS_DEBUG -DDEBUGGABLE=1
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(GLOB EXES "${CURRENT_PACKAGES_DIR}/bin/*.exe")
+file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
+file(REMOVE ${EXES})
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/spirv-tools)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/spirv-tools/LICENSE ${CURRENT_PACKAGES_DIR}/share/spirv-tools/copyright)
diff --git a/ports/sqlite3/CMakeLists.txt b/ports/sqlite3/CMakeLists.txt
index 3d5f73a4a..dbe636b79 100644
--- a/ports/sqlite3/CMakeLists.txt
+++ b/ports/sqlite3/CMakeLists.txt
@@ -2,15 +2,30 @@ cmake_minimum_required(VERSION 3.0)
project(sqlite3 C)
include_directories(${SOURCE})
-add_library(sqlite3 SHARED ${SOURCE}/sqlite3.c)
-target_compile_definitions(sqlite3 PRIVATE $<$<CONFIG:Debug>:-DSQLITE_DEBUG> "-DSQLITE_API=__declspec(dllexport)")
-if(TRIPLET_SYSTEM_NAME MATCHES "WindowsStore")
+if(BUILD_SHARED_LIBS)
+ set(API "-DSQLITE_API=__declspec(dllexport)")
+else()
+ set(API "-DSQLITE_API=extern")
+endif()
+add_library(sqlite3 ${SOURCE}/sqlite3.c)
+
+
+target_compile_definitions(sqlite3 PRIVATE
+ $<$<CONFIG:Debug>:-DSQLITE_DEBUG>
+ ${API}
+ -DSQLITE_ENABLE_RTREE
+ -DSQLITE_ENABLE_UNLOCK_NOTIFY
+ )
+target_include_directories(sqlite3 INTERFACE $<INSTALL_INTERFACE:include>)
+
+if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
target_compile_definitions(sqlite3 PRIVATE -DSQLITE_OS_WINRT=1)
endif()
-install(TARGETS sqlite3
+install(TARGETS sqlite3 EXPORT sqlite3Config
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${SOURCE}/sqlite3.h ${SOURCE}/sqlite3ext.h DESTINATION include CONFIGURATIONS Release)
+install(EXPORT sqlite3Config DESTINATION share/sqlite3) \ No newline at end of file
diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL
index 886051482..e382a6f85 100644
--- a/ports/sqlite3/CONTROL
+++ b/ports/sqlite3/CONTROL
@@ -1,3 +1,3 @@
Source: sqlite3
-Version: 3120200
+Version: 3.15.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 114a7186f..8302e9d3e 100644
--- a/ports/sqlite3/portfile.cmake
+++ b/ports/sqlite3/portfile.cmake
@@ -1,19 +1,27 @@
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR})
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-3150000)
vcpkg_download_distfile(ARCHIVE
- URLS "http://www.sqlite.org/2016/sqlite-amalgamation-3120200.zip"
- FILENAME "sqlite-amalgamation-3120200.zip"
- SHA512 92e1cc09dc4d4e9dd4c189e4a5061664f11971eb3e14c4c59e1f489f201411b08a31dae9e6fc50fffd49bb72f88ac3d99b7c7cd5e334b3079c165ee1c4f5a16e
+ 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=${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-3120200
+ -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/stb/portfile.cmake b/ports/stb/portfile.cmake
index 432d84604..1c00e99db 100644
--- a/ports/stb/portfile.cmake
+++ b/ports/stb/portfile.cmake
@@ -1,3 +1,4 @@
+#header-only library
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/stb-e713a69f1ea6ee1e0d55725ed0731520045a5993)
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/szip/CONTROL b/ports/szip/CONTROL
new file mode 100644
index 000000000..cabcb582b
--- /dev/null
+++ b/ports/szip/CONTROL
@@ -0,0 +1,3 @@
+Source: szip
+Version: 2.1
+Description: Szip compression software, providing lossless compression of scientific data
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..06040cedc
--- /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
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=1
+ -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/tbb/CONTROL b/ports/tbb/CONTROL
new file mode 100644
index 000000000..b82b70555
--- /dev/null
+++ b/ports/tbb/CONTROL
@@ -0,0 +1,3 @@
+Source: tbb
+Version: 20160916
+Description: Intel's Threading Building Blocks.
diff --git a/ports/tbb/portfile.cmake b/ports/tbb/portfile.cmake
new file mode 100644
index 000000000..fc761f113
--- /dev/null
+++ b/ports/tbb/portfile.cmake
@@ -0,0 +1,82 @@
+# 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 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/tbb2017_20160916oss)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb2017_20160916oss_win_1.zip"
+ FILENAME "tbb2017_20160916oss_win_1.zip"
+ SHA512 14bbc54aa0c4506bab6e6fdb7e9e562cbc88881cb683a8bd690e3101177e55433f25a2143e7af1ed52edacb44dc92fab354e1f2101bc13b33b3ea137def8bdd1
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+# Installation
+message(STATUS "Installing")
+file(COPY
+ ${SOURCE_PATH}/include/tbb
+ ${SOURCE_PATH}/include/serial
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(BIN_PATH ${SOURCE_PATH}/bin/intel64/vc14)
+ set(LIB_PATH ${SOURCE_PATH}/lib/intel64/vc14)
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ set(BIN_PATH ${SOURCE_PATH}/bin/ia32/vc14)
+ set(LIB_PATH ${SOURCE_PATH}/lib/ia32/vc14)
+else()
+ message(FATAL_ERROR "Unsupported architecture")
+endif()
+
+file(COPY
+ ${LIB_PATH}/tbb.lib
+ ${LIB_PATH}/tbb_preview.lib
+ ${LIB_PATH}/tbbmalloc.lib
+ ${LIB_PATH}/tbbmalloc_proxy.lib
+ ${LIB_PATH}/tbbproxy.lib
+ ${LIB_PATH}/tbbproxy.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+file(COPY
+ ${LIB_PATH}/tbb_debug.lib
+ ${LIB_PATH}/tbb_preview_debug.lib
+ ${LIB_PATH}/tbbmalloc_debug.lib
+ ${LIB_PATH}/tbbmalloc_proxy_debug.lib
+ ${LIB_PATH}/tbbproxy_debug.lib
+ ${LIB_PATH}/tbbproxy_debug.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+file(COPY
+ ${BIN_PATH}/tbb.dll
+ ${BIN_PATH}/tbb_preview.dll
+ ${BIN_PATH}/tbbmalloc.dll
+ ${BIN_PATH}/tbbmalloc_proxy.dll
+ ${BIN_PATH}/tbb.pdb
+ ${BIN_PATH}/tbb_preview.pdb
+ ${BIN_PATH}/tbbmalloc.pdb
+ ${BIN_PATH}/tbbmalloc_proxy.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+file(COPY
+ ${BIN_PATH}/tbb_debug.dll
+ ${BIN_PATH}/tbb_preview_debug.dll
+ ${BIN_PATH}/tbbmalloc_debug.dll
+ ${BIN_PATH}/tbbmalloc_proxy_debug.dll
+ ${BIN_PATH}/tbb_debug.pdb
+ ${BIN_PATH}/tbb_preview_debug.pdb
+ ${BIN_PATH}/tbbmalloc_debug.pdb
+ ${BIN_PATH}/tbbmalloc_proxy_debug.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+message(STATUS "Installing done")
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/tbb)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/tbb/LICENSE ${CURRENT_PACKAGES_DIR}/share/tbb/copyright)
diff --git a/ports/tcl/portfile.cmake b/ports/tcl/portfile.cmake
deleted file mode 100644
index d8b19097a..000000000
--- a/ports/tcl/portfile.cmake
+++ /dev/null
@@ -1,63 +0,0 @@
-include(vcpkg_common_functions)
-vcpkg_download_distfile(ARCHIVE
- URLS "http://prdownloads.sourceforge.net/tcl/tcl8.6.5-src.tar.gz"
- FILENAME "tcl8.6.5-src.tar.gz"
- MD5 0e6426a4ca9401825fbc6ecf3d89a326
-)
-
-find_program(NMAKE nmake)
-
-if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/x86-windows-rel)
- message(STATUS "Extracting source ${ARCHIVE} for Release")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-rel)
- vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} -E tar xjf ${ARCHIVE}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-rel
- LOGNAME extract-x86-windows-rel
- )
-endif()
-if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg)
- message(STATUS "Extracting source ${ARCHIVE} for Debug")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg)
- vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} -E tar xjf ${ARCHIVE}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg
- LOGNAME extract-x86-windows-dbg
- )
-endif()
-message(STATUS "Extracting done")
-
-message(STATUS "Building x86-windows-rel")
-vcpkg_execute_required_process(
- COMMAND ${NMAKE} -f makefile.vc release
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-rel/tcl8.6.5/win
- LOGNAME build-x86-windows-rel
-)
-message(STATUS "Building x86-windows-rel done")
-
-message(STATUS "Building x86-windows-dbg")
-vcpkg_execute_required_process(
- COMMAND ${NMAKE} -f makefile.vc release OPTS=symbols
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg/tcl8.6.5/win
- LOGNAME build-x86-windows-rel
-)
-message(STATUS "Building x86-windows-dbg done")
-
-message(STATUS "Installing x86-windows-rel")
-vcpkg_execute_required_process(
- COMMAND ${NMAKE} -f makefile.vc install INSTALLDIR=${CURRENT_PACKAGES_DIR} SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}\\share\\tcltk\\tcl8.6
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-rel/tcl8.6.5/win
- LOGNAME install-x86-windows-rel
-)
-message(STATUS "Installing x86-windows-rel done")
-
-message(STATUS "Installing x86-windows-dbg")
-vcpkg_execute_required_process(
- COMMAND ${NMAKE} -f makefile.vc install INSTALLDIR=${CURRENT_PACKAGES_DIR}\\debug OPTS=symbols SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}\\debug\\share\\tcltk\\tcl8.6
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg/tcl8.6.5/win
- LOGNAME install-x86-windows-dbg
-)
-message(STATUS "Installing x86-windows-dbg done")
-
-file(INSTALL ${CURRENT_BUILDTREES_DIR}/x86-windows-rel/tcl8.6.5/license.terms DESTINATION ${CURRENT_PACKAGES_DIR}/share/tcl RENAME copyright)
-vcpkg_copy_pdbs()
diff --git a/ports/tclap/CONTROL b/ports/tclap/CONTROL
new file mode 100644
index 000000000..1e086a845
--- /dev/null
+++ b/ports/tclap/CONTROL
@@ -0,0 +1,3 @@
+Source: tclap
+Version: 1.2.1
+Description: Templatized command-line argument parser for C++
diff --git a/ports/tclap/portfile.cmake b/ports/tclap/portfile.cmake
new file mode 100644
index 000000000..8f41d076f
--- /dev/null
+++ b/ports/tclap/portfile.cmake
@@ -0,0 +1,18 @@
+#header-only library
+include(vcpkg_common_functions)
+set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/tclap-1.2.1")
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://downloads.sourceforge.net/project/tclap/tclap-1.2.1.tar.gz"
+ FILENAME "tclap-1.2.1.tar.gz"
+ SHA512 8bd6ee724600880840048c7b36f02d31b1aa4910b17f80fb04aef89b1f1917856d9979ec488edbd457b66d9d689aea97540abb842a8b902bbd75c66a6e07b9b1
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+# Copy all header files
+file(COPY "${SOURCE_PATH}/include/tclap"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/include"
+ FILES_MATCHING PATTERN "*.h")
+
+# Handle copyright
+file(COPY "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/tclap")
+file(RENAME "${CURRENT_PACKAGES_DIR}/share/tclap/COPYING" "${CURRENT_PACKAGES_DIR}/share/tclap/copyright")
diff --git a/ports/think-cell-range/CONTROL b/ports/think-cell-range/CONTROL
new file mode 100644
index 000000000..3b5872232
--- /dev/null
+++ b/ports/think-cell-range/CONTROL
@@ -0,0 +1,5 @@
+Source: think-cell-range
+Maintainer: jfrederich@gmail.com
+Version: e2d3018
+Description: think-cell's range library <https://think-cell.com>, <https://github.com/think-cell/range>, <https://www.think-cell.com/en/career/talks/ranges/#1>
+Build-Depends: boost
diff --git a/ports/think-cell-range/portfile.cmake b/ports/think-cell-range/portfile.cmake
new file mode 100644
index 000000000..858461e36
--- /dev/null
+++ b/ports/think-cell-range/portfile.cmake
@@ -0,0 +1,16 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/range-e2d3018c3a797e7328dea005e72b34cace8b1fc6)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/think-cell/range/archive/e2d3018c3a797e7328dea005e72b34cace8b1fc6.zip"
+ FILENAME "think-cell_range-e2d3018.zip"
+ SHA512 13c74aba4950a84fdf446c976564030b18a740c5ce42b7650116a0559ba9e9a59471ff0f80132c626bc442402b3717805d3615b9ea70751e2dd1e648fd9f7916
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(INSTALL ${SOURCE_PATH}/range DESTINATION ${CURRENT_PACKAGES_DIR}/include/think-cell FILES_MATCHING PATTERN "*.h")
+
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/think-cell-range)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/think-cell-range/COPYING ${CURRENT_PACKAGES_DIR}/share/think-cell-range/copyright)
+file(COPY ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/think-cell-range)
+
+file(COPY ${SOURCE_PATH}/range/range.example.cpp DESTINATION ${CURRENT_PACKAGES_DIR}/share/think-cell-range)
diff --git a/ports/tiff/CONTROL b/ports/tiff/CONTROL
index df11c0e9c..0c82029fb 100644
--- a/ports/tiff/CONTROL
+++ b/ports/tiff/CONTROL
@@ -1,3 +1,4 @@
Source: tiff
-Version: 4.0.6
+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/add-component-options.patch b/ports/tiff/add-component-options.patch
new file mode 100644
index 000000000..513d37ad6
--- /dev/null
+++ b/ports/tiff/add-component-options.patch
@@ -0,0 +1,43 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1ee6fd4..439e26a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -122,6 +122,11 @@ set(EXTRA_DIST
+ nmake.opt
+ libtiff-4.pc.in)
+
++option(BUILD_TOOLS "Build tool executables" ON)
++option(BUILD_DOCS "Build docs" ON)
++option(BUILD_CONTRIB "Build contributed executables" ON)
++option(BUILD_TESTS "Build tests" ON)
++
+ # These are annoyingly verbose, produce false positives or don't work
+ # nicely with all supported compiler versions, so are disabled unless
+ # explicitly enabled.
+@@ -719,12 +724,20 @@ endif()
+ # Process subdirectories
+ add_subdirectory(port)
+ add_subdirectory(libtiff)
+-add_subdirectory(tools)
+-add_subdirectory(test)
+-add_subdirectory(contrib)
+-add_subdirectory(build)
+-add_subdirectory(man)
+-add_subdirectory(html)
++if(BUILD_TOOLS)
++ add_subdirectory(tools)
++endif()
++if(BUILD_TESTS)
++ add_subdirectory(test)
++endif()
++if(BUILD_CONTRIB)
++ add_subdirectory(contrib)
++endif()
++if(BUILD_DOCS)
++ add_subdirectory(build)
++ add_subdirectory(man)
++ add_subdirectory(html)
++endif()
+
+ #message(STATUS "EXTRA_DIST: ${EXTRA_DIST}")
+
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 647b61019..281d681b9 100644
--- a/ports/tiff/portfile.cmake
+++ b/ports/tiff/portfile.cmake
@@ -7,9 +7,20 @@ vcpkg_download_distfile(ARCHIVE
)
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(
SOURCE_PATH ${SOURCE_PATH}
- OPTIONS -Dcxx=OFF
+ OPTIONS
+ -Dcxx=OFF
+ -DBUILD_TOOLS=OFF
+ -DBUILD_DOCS=OFF
+ -DBUILD_CONTRIB=OFF
+ -DBUILD_TESTS=OFF
)
vcpkg_install_cmake()
@@ -19,18 +30,10 @@ file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/share
${CURRENT_PACKAGES_DIR}/share
)
-file(COPY
+file(INSTALL
${SOURCE_PATH}/COPYRIGHT
DESTINATION ${CURRENT_PACKAGES_DIR}/share/tiff
+ RENAME copyright
)
-file(RENAME
- ${CURRENT_PACKAGES_DIR}/share/tiff/COPYRIGHT
- ${CURRENT_PACKAGES_DIR}/share/tiff/c2
-)
-file(RENAME
- ${CURRENT_PACKAGES_DIR}/share/tiff/c2
- ${CURRENT_PACKAGES_DIR}/share/tiff/copyright
-)
-file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
-file(REMOVE ${EXES})
+
vcpkg_copy_pdbs()
diff --git a/ports/tk/portfile.cmake b/ports/tk/portfile.cmake
deleted file mode 100644
index 0391b0b30..000000000
--- a/ports/tk/portfile.cmake
+++ /dev/null
@@ -1,63 +0,0 @@
-include(vcpkg_common_functions)
-vcpkg_download_distfile(ARCHIVE
- URLS "http://prdownloads.sourceforge.net/tcl/tk8.6.5-src.tar.gz"
- FILENAME "tk8.6.5-src.tar.gz"
- MD5 11dbbd425c3e0201f20d6a51482ce6c4
-)
-
-find_program(NMAKE nmake)
-
-if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/x86-windows-rel)
- message(STATUS "Extracting source ${ARCHIVE} for Release")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-rel)
- vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} -E tar xjf ${ARCHIVE}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-rel
- LOGNAME extract-x86-windows-rel
- )
-endif()
-if(NOT EXISTS ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg)
- message(STATUS "Extracting source ${ARCHIVE} for Debug")
- file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg)
- vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} -E tar xjf ${ARCHIVE}
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg
- LOGNAME extract-x86-windows-dbg
- )
-endif()
-message(STATUS "Extracting done")
-
-message(STATUS "Building x86-windows-rel")
-vcpkg_execute_required_process(
- COMMAND ${NMAKE} -f makefile.vc release TCLDIR=${CURRENT_BUILDTREES_DIR}\\x86-windows-rel\\tcl8.6.5
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-rel/tk8.6.5/win
- LOGNAME build-x86-windows-rel
-)
-message(STATUS "Building x86-windows-rel done")
-
-message(STATUS "Building x86-windows-dbg")
-vcpkg_execute_required_process(
- COMMAND ${NMAKE} -f makefile.vc release OPTS=symbols TCLDIR=${CURRENT_BUILDTREES_DIR}\\x86-windows-dbg\\tcl8.6.5
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg/tk8.6.5/win
- LOGNAME build-x86-windows-dbg
-)
-message(STATUS "Building x86-windows-dbg done")
-
-message(STATUS "Installing x86-windows-rel")
-vcpkg_execute_required_process(
- COMMAND ${NMAKE} -f makefile.vc install INSTALLDIR=${CURRENT_PACKAGES_DIR} SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}\\share\\tcltk\\tk8.6
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-rel/tk8.6.5/win
- LOGNAME install-x86-windows-rel
-)
-message(STATUS "Installing x86-windows-rel done")
-
-message(STATUS "Installing x86-windows-dbg")
-vcpkg_execute_required_process(
- COMMAND ${NMAKE} -f makefile.vc install INSTALLDIR=${CURRENT_PACKAGES_DIR}\\debug OPTS=symbols SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}\\debug\\share\\tcltk\\tk8.6
- WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/x86-windows-dbg/tk8.6.5/win
- LOGNAME install-x86-windows-dbg
-)
-message(STATUS "Installing x86-windows-dbg done")
-
-file(INSTALL ${CURRENT_BUILDTREES_DIR}/x86-windows-rel/tk8.6.5/license.terms DESTINATION ${CURRENT_PACKAGES_DIR}/share/tk RENAME copyright)
-vcpkg_copy_pdbs()
diff --git a/ports/utfcpp/CONTROL b/ports/utfcpp/CONTROL
new file mode 100644
index 000000000..619e8b2b3
--- /dev/null
+++ b/ports/utfcpp/CONTROL
@@ -0,0 +1,3 @@
+Source: utfcpp
+Version: 2.3.4
+Description: UTF-8 with C++ in a Portable Way
diff --git a/ports/utfcpp/portfile.cmake b/ports/utfcpp/portfile.cmake
new file mode 100644
index 000000000..56599dd3a
--- /dev/null
+++ b/ports/utfcpp/portfile.cmake
@@ -0,0 +1,15 @@
+#header-only library
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/utfcpp-2.3.4)
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "https://github.com/nemtrif/utfcpp/archive/v2.3.4.tar.gz"
+ FILENAME "utfcpp-2.3.4.tar.gz"
+ SHA512 1baa67c4efb926bba97dfbc869ac057d5d6cf67e94879fc0854ec3d75a5bae7c47cb3e9fd9cbc7bed9ca5daf40f173c0349bce2f6aa34a400bdf77d01522ff2f
+)
+vcpkg_extract_source_archive(${ARCHIVE_FILE})
+
+# Put the licence file where vcpkg expects it
+file(INSTALL ${SOURCE_PATH}/source/utf8.h DESTINATION ${CURRENT_PACKAGES_DIR}/share/utfcpp RENAME copyright)
+
+# Copy the utf8-cpp header files
+file(COPY ${SOURCE_PATH}/source/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
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
new file mode 100644
index 000000000..f4004a5bb
--- /dev/null
+++ b/ports/uwebsockets/0001_cmake.patch
@@ -0,0 +1,40 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1fadf72..6ee984d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,7 +18,11 @@ 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()
+ 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)
+ endif (UNIX)
+
+-add_subdirectory(examples)
++#add_subdirectory(examples)
++
++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()
++endif()
++
++install(
++ TARGETS uWS
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib
++)
+\ No newline at end of file \ No newline at end of file
diff --git a/ports/uwebsockets/CONTROL b/ports/uwebsockets/CONTROL
new file mode 100644
index 000000000..840990004
--- /dev/null
+++ b/ports/uwebsockets/CONTROL
@@ -0,0 +1,4 @@
+Source: uwebsockets
+Version: 0.12.0
+Build-Depends: libuv, openssl, zlib
+Description: Highly scalable cross-platform WebSocket & HTTP library for C++11 and Node.js \ No newline at end of file
diff --git a/ports/uwebsockets/portfile.cmake b/ports/uwebsockets/portfile.cmake
new file mode 100644
index 000000000..881f35086
--- /dev/null
+++ b/ports/uwebsockets/portfile.cmake
@@ -0,0 +1,26 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/uwebsockets-0.12.0)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/uWebSockets/uWebSockets/archive/v0.12.0.zip"
+ FILENAME "uwebsockets-v0.12.0.zip"
+ SHA512 ea10682608d5f6c8b246f186dfc2f14f496858cc7e468880b96b111f10058daf529f1aa9662a851e21494dde9a4faadf2b9904483dac5350d0ca8736500cdda8
+)
+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()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/uwebsockets)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/uwebsockets/LICENSE ${CURRENT_PACKAGES_DIR}/share/uwebsockets/copyright)
+vcpkg_copy_pdbs()
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
new file mode 100644
index 000000000..d7ac2c535
--- /dev/null
+++ b/ports/wt/CONTROL
@@ -0,0 +1,4 @@
+Source: wt
+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
new file mode 100644
index 000000000..7e2bdb47c
--- /dev/null
+++ b/ports/wt/portfile.cmake
@@ -0,0 +1,42 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/wt-3.3.6)
+
+vcpkg_download_distfile(ARCHIVE_FILE
+ URLS "https://github.com/kdeforche/wt/archive/3.3.6.tar.gz"
+ FILENAME "wt-3.3.6.tar.gz"
+ 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}
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DSHARED_LIBS=ON
+ -DENABLE_SSL=ON
+ -DBUILD_EXAMPLES=OFF
+ -DENABLE_POSTGRES=OFF
+ -DENABLE_FIREBIRD=OFF
+ -DENABLE_MYSQL=OFF
+ -DENABLE_QT4=OFF
+ -DBOOST_DYNAMIC=ON
+ -DDISABLE_BOOST_AUTOLINK=ON
+ -DENABLE_LIBWTTEST=OFF
+)
+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(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/wt RENAME copyright)
+vcpkg_copy_pdbs()
diff --git a/ports/wtl/CONTROL b/ports/wtl/CONTROL
new file mode 100644
index 000000000..6f8b6208e
--- /dev/null
+++ b/ports/wtl/CONTROL
@@ -0,0 +1,5 @@
+Source: wtl
+Maintainer: jfrederich@gmail.com
+Version: 9.1
+Description: Windows Template Library (WTL) is a C++ library for developing Windows applications and UI components.
+Build-Depends:
diff --git a/ports/wtl/portfile.cmake b/ports/wtl/portfile.cmake
new file mode 100644
index 000000000..c8d8c6c34
--- /dev/null
+++ b/ports/wtl/portfile.cmake
@@ -0,0 +1,15 @@
+#header-only library
+include(vcpkg_common_functions)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://downloads.sourceforge.net/project/wtl/WTL%209.1/WTL%209.1.5321%20Final/WTL91_5321_Final.zip?r=&ts=1477467616&use_mirror=netix"
+ FILENAME "WTL91_5321_Final.zip"
+ SHA512 52c583f6773839f7ad7fccf0ecba44ad00f41af4ae97d217619cc380ea9b71b90638ae35a5995f9eb08854db423896fec5f06b5cbd853f118eeddd05238a460a
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/wtl FILES_MATCHING PATTERN "*.h")
+
+file(COPY ${CURRENT_BUILDTREES_DIR}/src/MS-PL.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/wtl)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/wtl/MS-PL.txt ${CURRENT_PACKAGES_DIR}/share/wtl/copyright)
+
+file(COPY ${CURRENT_BUILDTREES_DIR}/src/samples DESTINATION ${CURRENT_PACKAGES_DIR}/share/wtl)
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/yaml-cpp/CONTROL b/ports/yaml-cpp/CONTROL
new file mode 100644
index 000000000..f55ccfc4f
--- /dev/null
+++ b/ports/yaml-cpp/CONTROL
@@ -0,0 +1,3 @@
+Source: yaml-cpp
+Version: 0.5.4 candidate
+Description: yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec.
diff --git a/ports/yaml-cpp/portfile.cmake b/ports/yaml-cpp/portfile.cmake
new file mode 100644
index 000000000..69f838884
--- /dev/null
+++ b/ports/yaml-cpp/portfile.cmake
@@ -0,0 +1,38 @@
+# Common Ambient Variables:
+# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
+# TARGET_TRIPLET is the current triplet (x86-windows, etc)
+# PORT is the current port name (zlib, etc)
+# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
+# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
+#
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/yaml-cpp-380ecb404ef99ba132154ed43dd2b84136b30b14)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/jbeder/yaml-cpp/archive/380ecb404ef99ba132154ed43dd2b84136b30b14.zip"
+ FILENAME "380ecb404ef99ba132154ed43dd2b84136b30b14.zip"
+ SHA512 7e090b53ba760f4f9a44701359fe2c30c05f1bbcd2cba78a8f9a88c651b09be6d592e65826fbacb9dd7317afbe3cd968be531b89f83e79f15cd97e9c27d17232
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+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()
+
+# Remove debug include files
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+# Remove cmake files
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/CMake)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/CMake)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/yaml-cpp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/yaml-cpp/LICENSE ${CURRENT_PACKAGES_DIR}/share/yaml-cpp/copyright)
+
diff --git a/ports/zeromq/CONTROL b/ports/zeromq/CONTROL
new file mode 100644
index 000000000..8274ec0fd
--- /dev/null
+++ b/ports/zeromq/CONTROL
@@ -0,0 +1,3 @@
+Source: zeromq
+Version: 4.2.0
+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
new file mode 100644
index 000000000..9abd4ed74
--- /dev/null
+++ b/ports/zeromq/portfile.cmake
@@ -0,0 +1,66 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/zeromq-4.2.0)
+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
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+# Map from triplet "x86" to "win32" as used in the vcxproj file.
+if (TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ set(MSBUILD_PLATFORM "Win32")
+else ()
+ set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH})
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/builds/msvc/vs2015/libzmq/libzmq.vcxproj
+ RELEASE_CONFIGURATION ReleaseDLL
+ DEBUG_CONFIGURATION DebugDLL
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/v140/dynamic/libzmq.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/v140/dynamic/libzmq.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/v140/dynamic/libzmq.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/v140/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
+ RELEASE_CONFIGURATION ReleaseLIB
+ DEBUG_CONFIGURATION DebugLIB
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Debug/v140/static/libzmq.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
+ )
+ file(INSTALL
+ ${SOURCE_PATH}/bin/${MSBUILD_PLATFORM}/Release/v140/static/libzmq.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib
+ )
+endif()
+
+
+file(INSTALL
+ ${SOURCE_PATH}/include/
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/zeromq)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/zeromq/COPYING ${CURRENT_PACKAGES_DIR}/share/zeromq/copyright)
+
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 ef42536dc..0d53d9e89 100644
--- a/ports/zlib/portfile.cmake
+++ b/ports/zlib/portfile.cmake
@@ -1,10 +1,9 @@
-include(${CMAKE_TRIPLET_FILE})
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})
@@ -18,9 +17,9 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
+# Both dynamic and static are built, so keep only the one needed
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/zlibstatic.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibstaticd.lib)
- vcpkg_copy_pdbs()
else()
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/zlib.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibd.lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
@@ -29,3 +28,5 @@ else()
endif()
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zlib RENAME copyright)
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/zstd/CONTROL b/ports/zstd/CONTROL
new file mode 100644
index 000000000..f92f610a4
--- /dev/null
+++ b/ports/zstd/CONTROL
@@ -0,0 +1,3 @@
+Source: zstd
+Version: 1.1.1
+Description: Zstandard - Fast real-time compression algorithm http://www.zstd.net
diff --git a/ports/zstd/portfile.cmake b/ports/zstd/portfile.cmake
new file mode 100644
index 000000000..0cb089ce5
--- /dev/null
+++ b/ports/zstd/portfile.cmake
@@ -0,0 +1,42 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/zstd-1.1.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/facebook/zstd/archive/v1.1.1.zip"
+ FILENAME "zstd-1.1.1.zip"
+ SHA512 c96a97519202a759c62f661c7bbaeaa0d48e4e78588a8232ad23fd78fe7c3440f1f07d996dcf07daa652569e1c5e39cb7b93103b9ec7845db05b161ec29a8dde
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}/build/cmake
+ OPTIONS -DZSTD_LEGACY_SUPPORT=1
+)
+vcpkg_build_cmake()
+
+# Manual install
+message(STATUS "Installing")
+
+file(COPY ${SOURCE_PATH}/lib/zstd.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(COPY ${SOURCE_PATH}/lib/common/zbuff.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+file(COPY ${SOURCE_PATH}/lib/dictBuilder/zdict.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+
+set(RELDIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/Release)
+set(DEBDIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/Debug)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ file(INSTALL ${RELDIR}/zstdlib.1.1.1024_${TRIPLET_SYSTEM_ARCH}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib RENAME zstdlib.lib)
+ file(INSTALL ${DEBDIR}/zstdlib.1.1.1024_${TRIPLET_SYSTEM_ARCH}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME zstdlib.lib)
+ file(INSTALL ${RELDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/bin FILES_MATCHING PATTERN "*.dll")
+ file(INSTALL ${DEBDIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin FILES_MATCHING PATTERN "*.dll")
+ vcpkg_copy_pdbs()
+else()
+ file(INSTALL ${RELDIR}/zstdlib_${TRIPLET_SYSTEM_ARCH}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib RENAME zstdlib.lib)
+ file(INSTALL ${DEBDIR}/zstdlib_${TRIPLET_SYSTEM_ARCH}.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME zstdlib.lib)
+endif()
+
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zstd)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/zstd/LICENSE ${CURRENT_PACKAGES_DIR}/share/zstd/copyright)
+
+message(STATUS "Installing done")
diff --git a/ports/zziplib/CMakeLists.txt b/ports/zziplib/CMakeLists.txt
new file mode 100644
index 000000000..7f46079e9
--- /dev/null
+++ b/ports/zziplib/CMakeLists.txt
@@ -0,0 +1,70 @@
+cmake_minimum_required(VERSION 3.0)
+
+include(GNUInstallDirs)
+
+project(zziplib C)
+
+find_package(zlib)
+
+include_directories(${ZLIB_INCLUDE_DIRS})
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+if(MSVC)
+ set(CMAKE_DEBUG_POSTFIX "d")
+ add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
+ add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
+endif()
+
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+
+# List the header files
+set(HEADERS zzip/__debug.h
+ zzip/__dirent.h
+ zzip/__fnmatch.h
+ zzip/__hints.h
+ zzip/__mmap.h
+ zzip/_config.h
+ zzip/_msvc.h
+ zzip/autoconf.h
+ zzip/conf.h
+ zzip/fetch.h
+ zzip/file.h
+ zzip/format.h
+ zzip/fseeko.h
+ zzip/info.h
+ zzip/lib.h
+ zzip/memdisk.h
+ zzip/mmapped.h
+ zzip/plugin.h
+ zzip/stdint.h
+ zzip/types.h
+ zzip/write.h
+ zzip/zzip.h
+)
+
+# List the source files
+set(SRCS zzip/dir.c
+ zzip/err.c
+ zzip/fetch.c
+ zzip/file.c
+ zzip/info.c
+ zzip/plugin.c
+ zzip/stat.c
+ zzip/zip.c
+)
+
+add_library(zziplib ${SRCS} ${HEADERS})
+
+if(${BUILD_SHARED_LIBS})
+ target_compile_definitions(zziplib PRIVATE -DZZIPLIB_EXPORTS)
+endif()
+
+target_link_libraries(zziplib ${ZLIB_LIBRARIES})
+
+install(TARGETS zziplib
+ COMPONENT runtime
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib)
+
+install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip) \ No newline at end of file
diff --git a/ports/zziplib/CONTROL b/ports/zziplib/CONTROL
new file mode 100644
index 000000000..235b72c63
--- /dev/null
+++ b/ports/zziplib/CONTROL
@@ -0,0 +1,4 @@
+Source: zziplib
+Version: 0.13.62
+Build-Depends: zlib
+Description: library providing read access on ZIP-archives
diff --git a/ports/zziplib/portfile.cmake b/ports/zziplib/portfile.cmake
new file mode 100644
index 000000000..2a7e18e56
--- /dev/null
+++ b/ports/zziplib/portfile.cmake
@@ -0,0 +1,22 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/zziplib-0.13.62)
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://sourceforge.net/projects/zziplib/files/zziplib13/0.13.62/zziplib-0.13.62.tar.bz2/download"
+ FILENAME "zziplib-0.13.62.tar.bz2"
+ SHA512 fd3b9e9015ba7603bdebd8f6a2ac6d11003705bfab22f3a0025f75455042664aea69440845b59e6f389417dff5ac777f49541d8cbacb2a220e67d20bb6973e25
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/zziplib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/zziplib/COPYING.LIB ${CURRENT_PACKAGES_DIR}/share/zziplib/copyright)
diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1
index 182155146..98ccb40ad 100644
--- a/scripts/bootstrap.ps1
+++ b/scripts/bootstrap.ps1
@@ -7,9 +7,12 @@ param(
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
-$gitHash = git rev-parse HEAD
+$gitHash = "unknownhash"
+if (Get-Command "git.exe" -ErrorAction SilentlyContinue)
+{
+ $gitHash = git rev-parse HEAD
+}
Write-Verbose("Git hash is " + $gitHash)
-$gitStartOfHash = $gitHash.substring(0,6)
$vcpkgSourcesPath = "$vcpkgRootDir\toolsrc"
Write-Verbose("vcpkg Path " + $vcpkgSourcesPath)
@@ -20,7 +23,10 @@ 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]
+ & $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /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 70528e078..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 = $(link /dump /imports $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" })
+ $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 3a74099f0..d1d804e94 100644
--- a/scripts/buildsystems/msbuild/vcpkg.targets
+++ b/scripts/buildsystems/msbuild/vcpkg.targets
@@ -1,57 +1,75 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'Win32||'">
- <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled>
- <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">x86-windows</VCPkgTriplet>
+ <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
+ <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x86-windows</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'Win32|Windows Store|10.0'">
- <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled>
- <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">x86-uwp</VCPkgTriplet>
+ <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
+ <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>
+ <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
+ <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x64-windows</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'x64|Windows Store|10.0'">
- <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled>
- <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">x64-uwp</VCPkgTriplet>
+ <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
+ <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x64-uwp</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'arm|Windows Store|10.0'">
- <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled>
- <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">arm-uwp</VCPkgTriplet>
+ <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
+ <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">arm-uwp</VcpkgTriplet>
</PropertyGroup>
- <PropertyGroup Condition="'$(VCPkgEnabled)' == 'true'">
- <VCPkgConfiguration Condition="'$(VCPkgConfiguration)' == ''">$(Configuration)</VCPkgConfiguration>
- <!-- Expected to ..\..\..\ over scripts\buildsystems\msbuild -->
- <VCPkgRoot Condition="'$(VCPkgRoot)' == ''">$(MSBuildThisFileDirectory)..\..\..\installed\$(VCPkgTriplet)\</VCPkgRoot>
+ <PropertyGroup Condition="'$(VcpkgEnabled)' == 'true'">
+ <VcpkgConfiguration Condition="'$(VcpkgConfiguration)' == ''">$(Configuration)</VcpkgConfiguration>
+ <VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), .vcpkg-root))\installed\$(VcpkgTriplet)\</VcpkgRoot>
</PropertyGroup>
- <ItemDefinitionGroup Condition="'$(VCPkgEnabled)' == 'true'">
+ <ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'">
<Link>
- <AdditionalDependencies Condition="'$(VCPkgConfiguration)' == 'Debug'">$(VCPkgRoot)debug\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalDependencies Condition="'$(VCPkgConfiguration)' == 'Release'">$(VCPkgRoot)lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Debug' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)debug\lib\*.lib</AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Release' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)lib\*.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Release'">%(AdditionalLibraryDirectories);$(VcpkgRoot)lib;$(VcpkgRoot)lib\manual-link</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Debug'">%(AdditionalLibraryDirectories);$(VcpkgRoot)debug\lib;$(VcpkgRoot)debug\lib\manual-link</AdditionalLibraryDirectories>
</Link>
<ClCompile>
- <AdditionalIncludeDirectories>$(VCPkgRoot)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgRoot)include</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
- <Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup" Condition="'$(VCPkgEnabled)' == 'true' and '$(OutputType)' == 'exe'">
+ <Target Name="VcpkgTripletSelection" BeforeTargets="ClCompile">
+ <Message Text="Using triplet &quot;$(VcpkgTriplet)&quot; from &quot;$(VcpkgRoot)&quot;" Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/>
+ <Message Text="Not using Vcpkg because VcpkgEnabled is &quot;$(VcpkgEnabled)&quot;" 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$(OutputPath)$(TargetName).$(OutputType)%22 %22$(VCPkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22"
- ConsoleToMSBuild="true">
+ <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"
+ 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$(OutputPath)$(TargetName).$(OutputType)%22 %22$(VCPkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22"
- ConsoleToMSBuild="true">
+ <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"
+ StandardOutputImportance="Normal">
<Output TaskParameter="ConsoleOutput" ItemName="ReferenceCopyLocalPaths" />
</Exec>
</Target>
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index 88acc8436..e7b2b20db 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -10,8 +10,25 @@ if(NOT VCPKG_TOOLCHAIN)
set(_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$")
set(_VCPKG_TARGET_TRIPLET_ARCH arm)
- else()
+ elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$")
+ set(_VCPKG_TARGET_TRIPLET_ARCH x86)
+ elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$")
+ set(_VCPKG_TARGET_TRIPLET_ARCH x64)
+ elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM")
+ set(_VCPKG_TARGET_TRIPLET_ARCH arm)
+ elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017")
set(_VCPKG_TARGET_TRIPLET_ARCH x86)
+ else()
+ find_program(_VCPKG_CL cl)
+ if(_VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$")
+ set(_VCPKG_TARGET_TRIPLET_ARCH x64)
+ elseif(_VCPKG_CL MATCHES "arm/cl.exe$")
+ set(_VCPKG_TARGET_TRIPLET_ARCH arm)
+ elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$")
+ set(_VCPKG_TARGET_TRIPLET_ARCH x86)
+ else()
+ message(FATAL_ERROR "Unable to determine target architecture.")
+ endif()
endif()
endif()
@@ -29,26 +46,47 @@ if(NOT VCPKG_TOOLCHAIN)
list(APPEND CMAKE_PREFIX_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug
)
+ list(APPEND CMAKE_LIBRARY_PATH
+ ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link
+ )
endif()
list(APPEND CMAKE_PREFIX_PATH
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
)
+ list(APPEND CMAKE_LIBRARY_PATH
+ ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link
+ )
- include_directories(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include)
+ set(Boost_COMPILER "-vc140")
set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools)
- option(OVERRIDE_ADD_EXECUTABLE "Automatically copy dependencies into the output directory for executables." ON)
- if(OVERRIDE_ADD_EXECUTABLE)
- function(add_executable name)
- _add_executable(${ARGV})
- add_custom_command(TARGET ${name} POST_BUILD
- COMMAND powershell -noprofile -executionpolicy UnRestricted -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1
- -targetBinary $<TARGET_FILE:${name}>
- -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
- -OutVariable out
- )
- endfunction()
- endif()
+ option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON)
+ function(add_executable name)
+ _add_executable(${ARGV})
+ list(FIND ARGV "IMPORTED" IMPORTED_IDX)
+ if(IMPORTED_IDX EQUAL -1)
+ if(VCPKG_APPLOCAL_DEPS)
+ add_custom_command(TARGET ${name} POST_BUILD
+ COMMAND powershell -noprofile -executionpolicy UnRestricted -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1
+ -targetBinary $<TARGET_FILE:${name}>
+ -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
+ -OutVariable out
+ )
+ endif()
+ set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false)
+ endif()
+ endfunction()
+
+ function(add_library name)
+ _add_library(${ARGV})
+ list(FIND ARGV "IMPORTED" IMPORTED_IDX)
+ list(FIND ARGV "INTERFACE" INTERFACE_IDX)
+ list(FIND ARGV "ALIAS" ALIAS_IDX)
+ if(IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1)
+ set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false)
+ endif()
+ endfunction()
+
set(VCPKG_TOOLCHAIN ON)
endif()
diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake
index 939edbd14..e17d53b08 100644
--- a/scripts/cmake/vcpkg_apply_patches.cmake
+++ b/scripts/cmake/vcpkg_apply_patches.cmake
@@ -1,5 +1,26 @@
+#.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)
set(PATCHNUM 0)
@@ -7,12 +28,17 @@ function(vcpkg_apply_patches)
message(STATUS "Applying patch ${PATCH}")
set(LOGNAME patch-${TARGET_TRIPLET}-${PATCHNUM})
execute_process(
- COMMAND ${GIT} --work-tree=. apply "${PATCH}" --ignore-whitespace --whitespace=nowarn --verbose
+ COMMAND ${GIT} --work-tree=. --git-dir=.git apply "${PATCH}" --ignore-whitespace --whitespace=nowarn --verbose
OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-out.log
ERROR_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-err.log
WORKING_DIRECTORY ${_ap_SOURCE_PATH}
RESULT_VARIABLE error_code
)
+
+ if(error_code AND NOT ${_ap_QUIET})
+ message(STATUS "Applying patch failed. This is expected if this patch was previously applied.")
+ endif()
+
message(STATUS "Applying patch ${PATCH} done")
math(EXPR PATCHNUM "${PATCHNUM}+1")
endforeach()
diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake
index 8ba4b9fae..3e8363a2c 100644
--- a/scripts/cmake/vcpkg_build_cmake.cmake
+++ b/scripts/cmake/vcpkg_build_cmake.cmake
@@ -1,7 +1,25 @@
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()
+
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 -- ${MSVC_EXTRA_ARGS}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME build-${TARGET_TRIPLET}-rel
)
@@ -9,7 +27,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 -- ${MSVC_EXTRA_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 5b422fe5e..f4a809e7f 100644
--- a/scripts/cmake/vcpkg_build_msbuild.cmake
+++ b/scripts/cmake/vcpkg_build_msbuild.cmake
@@ -55,6 +55,8 @@ 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
)
@@ -66,7 +68,9 @@ 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
)
-endfunction() \ No newline at end of file
+endfunction()
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 59824eb17..6e60bf2bc 100644
--- a/scripts/cmake/vcpkg_common_functions.cmake
+++ b/scripts/cmake/vcpkg_common_functions.cmake
@@ -1,10 +1,14 @@
include(vcpkg_download_distfile)
include(vcpkg_extract_source_archive)
include(vcpkg_execute_required_process)
+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_configure_cmake)
+include(vcpkg_configure_qmake)
include(vcpkg_apply_patches)
-include(vcpkg_copy_pdbs) \ No newline at end of file
+include(vcpkg_copy_pdbs)
+include(vcpkg_copy_tool_dependencies)
diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake
index 03b69e510..fbebe13a4 100644
--- a/scripts/cmake/vcpkg_configure_cmake.cmake
+++ b/scripts/cmake/vcpkg_configure_cmake.cmake
@@ -2,22 +2,39 @@ find_program(vcpkg_configure_cmake_NINJA ninja)
function(vcpkg_configure_cmake)
cmake_parse_arguments(_csc "" "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(TRIPLET_SYSTEM_NAME MATCHES "uwp" AND TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ 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(TRIPLET_SYSTEM_NAME MATCHES "uwp" 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(TRIPLET_SYSTEM_NAME MATCHES "uwp" 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()
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
@@ -30,16 +47,39 @@ function(vcpkg_configure_cmake)
endif()
if(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=ON)
+ 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"
)
-
+ if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic)
+ list(APPEND _csc_OPTIONS_DEBUG
+ "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1"
+ "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1"
+ )
+ list(APPEND _csc_OPTIONS_RELEASE
+ "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Zi"
+ "-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Zi"
+ )
+ elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
+ list(APPEND _csc_OPTIONS_DEBUG
+ "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1"
+ "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1"
+ )
+ list(APPEND _csc_OPTIONS_RELEASE
+ "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Zi"
+ "-DCMAKE_C_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Zi"
+ )
+ endif()
list(APPEND _csc_OPTIONS_RELEASE
- "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Zi"
- "-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Zi"
"-DCMAKE_SHARED_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF"
"-DCMAKE_EXE_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF"
)
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 b99649d59..61ad97728 100644
--- a/scripts/cmake/vcpkg_copy_pdbs.cmake
+++ b/scripts/cmake/vcpkg_copy_pdbs.cmake
@@ -1,4 +1,5 @@
function(vcpkg_copy_pdbs)
+
function(merge_filelist OUTVAR INVAR)
set(MSG "")
foreach(VAR ${${INVAR}})
@@ -7,32 +8,39 @@ function(vcpkg_copy_pdbs)
set(${OUTVAR} ${MSG} PARENT_SCOPE)
endfunction()
- file(GLOB_RECURSE DLLS ${CURRENT_PACKAGES_DIR}/bin/*.dll ${CURRENT_PACKAGES_DIR}/debug/bin/*.dll)
-
- set(DLLS_WITHOUT_MATCHING_PDBS)
-
- foreach(DLL ${DLLS})
- execute_process(COMMAND dumpbin /PDBPATH ${DLL}
- COMMAND findstr PDB
- OUTPUT_VARIABLE PDB_LINE
- ERROR_QUIET
- RESULT_VARIABLE error_code
- )
-
- if(NOT error_code AND PDB_LINE MATCHES "PDB file found at")
- string(REGEX MATCH '.*' PDB_PATH ${PDB_LINE}) # Extract the path which is in single quotes
- string(REPLACE ' "" PDB_PATH ${PDB_PATH}) # Remove single quotes
- get_filename_component(DLL_DIR ${DLL} DIRECTORY)
- file(COPY ${PDB_PATH} DESTINATION ${DLL_DIR})
- else()
- list(APPEND DLLS_WITHOUT_MATCHING_PDBS ${DLL})
- endif()
- endforeach()
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(GLOB_RECURSE DLLS ${CURRENT_PACKAGES_DIR}/bin/*.dll ${CURRENT_PACKAGES_DIR}/debug/bin/*.dll)
+
+ 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
+ OUTPUT_VARIABLE PDB_LINE
+ ERROR_QUIET
+ RESULT_VARIABLE error_code
+ )
- list(LENGTH DLLS_WITHOUT_MATCHING_PDBS UNMATCHED_DLLS_LENGTH)
- if(UNMATCHED_DLLS_LENGTH GREATER 0)
- merge_filelist(MSG DLLS_WITHOUT_MATCHING_PDBS)
- message(STATUS "Warning: Could not find a matching pdb file for:\n${MSG}")
+ if(NOT error_code AND PDB_LINE MATCHES "PDB file found at")
+ string(REGEX MATCH '.*' PDB_PATH ${PDB_LINE}) # Extract the path which is in single quotes
+ string(REPLACE ' "" PDB_PATH ${PDB_PATH}) # Remove single quotes
+ get_filename_component(DLL_DIR ${DLL} DIRECTORY)
+ file(COPY ${PDB_PATH} DESTINATION ${DLL_DIR})
+ else()
+ list(APPEND DLLS_WITHOUT_MATCHING_PDBS ${DLL})
+ 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)
+ message(STATUS "Warning: Could not find a matching pdb file for:\n${MSG}")
+ endif()
endif()
endfunction() \ No newline at end of file
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_execute_required_process.cmake b/scripts/cmake/vcpkg_execute_required_process.cmake
index bd6e56f7b..7feff08b2 100644
--- a/scripts/cmake/vcpkg_execute_required_process.cmake
+++ b/scripts/cmake/vcpkg_execute_required_process.cmake
@@ -12,9 +12,9 @@ function(vcpkg_execute_required_process)
file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}" NATIVE_BUILDTREES_DIR)
if(error_code)
message(FATAL_ERROR
- "Command failed: ${vcpkg_execute_required_process_COMMAND}\n"
- "Working Directory: ${vcpkg_execute_required_process_WORKING_DIRECTORY}\n"
- "See logs for more information:\n"
+ " Command failed: ${vcpkg_execute_required_process_COMMAND}\n"
+ " Working Directory: ${vcpkg_execute_required_process_WORKING_DIRECTORY}\n"
+ " See logs for more information:\n"
" ${NATIVE_BUILDTREES_DIR}\\${vcpkg_execute_required_process_LOGNAME}-out.log\n"
" ${NATIVE_BUILDTREES_DIR}\\${vcpkg_execute_required_process_LOGNAME}-err.log\n")
endif()
diff --git a/scripts/cmake/vcpkg_execute_required_process_repeat.cmake b/scripts/cmake/vcpkg_execute_required_process_repeat.cmake
new file mode 100644
index 000000000..d6fba132d
--- /dev/null
+++ b/scripts/cmake/vcpkg_execute_required_process_repeat.cmake
@@ -0,0 +1,28 @@
+# Usage: vcpkg_execute_required_process_repeat(COUNT <num> COMMAND <cmd> [<args>...] WORKING_DIRECTORY </path/to/dir> LOGNAME <my_log_name>)
+function(vcpkg_execute_required_process_repeat)
+ cmake_parse_arguments(vcpkg_execute_required_process_repeat "" "COUNT;WORKING_DIRECTORY;LOGNAME" "COMMAND" ${ARGN})
+ #debug_message("vcpkg_execute_required_process_repeat(${vcpkg_execute_required_process_repeat_COMMAND})")
+ foreach(loop_count RANGE ${vcpkg_execute_required_process_repeat_COUNT})
+ execute_process(
+ COMMAND ${vcpkg_execute_required_process_repeat_COMMAND}
+ OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_repeat_LOGNAME}-out.log
+ ERROR_FILE ${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_repeat_LOGNAME}-err.log
+ RESULT_VARIABLE error_code
+ WORKING_DIRECTORY ${vcpkg_execute_required_process_repeat_WORKING_DIRECTORY})
+ #debug_message("error_code=${error_code}")
+ file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}" NATIVE_BUILDTREES_DIR)
+ if(NOT error_code)
+ set(SUCCESSFUL_EXECUTION TRUE)
+ break()
+ endif()
+ endforeach(loop_count)
+ if (NOT ${SUCCESSFUL_EXECUTION})
+ message(FATAL_ERROR
+ " Command failed: ${vcpkg_execute_required_process_repeat_COMMAND}\n"
+ " Working Directory: ${vcpkg_execute_required_process_repeat_WORKING_DIRECTORY}\n"
+ " See logs for more information:\n"
+ " ${NATIVE_BUILDTREES_DIR}\\${vcpkg_execute_required_process_repeat_LOGNAME}-out.log\n"
+ " ${NATIVE_BUILDTREES_DIR}\\${vcpkg_execute_required_process_repeat_LOGNAME}-err.log\n"
+ )
+ endif()
+endfunction()
diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake
index 8f974240f..cd4a554f4 100644
--- a/scripts/cmake/vcpkg_find_acquire_program.cmake
+++ b/scripts/cmake/vcpkg_find_acquire_program.cmake
@@ -8,9 +8,9 @@ function(vcpkg_find_acquire_program VAR)
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)
@@ -24,6 +24,45 @@ function(vcpkg_find_acquire_program VAR)
set(ARCHIVE "yasm.exe")
set(NOEXTRACT ON)
set(HASH 850b26be5bbbdaeaf45ac39dd27f69f1a85e600c35afbd16b9f621396b3c7a19863ea3ff316b025b578fce0a8280eef2203306a2b3e46ee1389abb65313fb720)
+ 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)
+ elseif(VAR MATCHES "PYTHON2")
+ find_program(PYTHON2 NAMES python2 python PATHS C:/python27 ENV PYTHON)
+ if(NOT PYTHON2 MATCHES "NOTFOUND")
+ execute_process(
+ COMMAND ${PYTHON2} --version
+ OUTPUT_VARIABLE PYTHON_VER_CHECK_OUT
+ ERROR_VARIABLE PYTHON_VER_CHECK_ERR
+ )
+ set(PYTHON_VER_CHECK "${PYTHON_VER_CHECK_OUT}${PYTHON_VER_CHECK_ERR}")
+ debug_message("PYTHON_VER_CHECK=${PYTHON_VER_CHECK}")
+ if(NOT PYTHON_VER_CHECK MATCHES "Python 2.7")
+ set(PYTHON2 PYTHON2-NOTFOUND)
+ find_program(PYTHON2 NAMES python2 python PATHS C:/python27 ENV PYTHON NO_SYSTEM_ENVIRONMENT_PATH)
+ endif()
+ endif()
+ if(PYTHON2 MATCHES "NOTFOUND")
+ 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"
+ )
+ 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)
+ elseif(VAR MATCHES "7Z")
+ set(PROGNAME 7z)
+ set(PATHS "C:/Program Files/7-Zip" ${DOWNLOADS}/tools/7z/Files/7-Zip)
+ set(URL "http://7-zip.org/a/7z1604.msi")
+ set(ARCHIVE "7z1604.msi")
+ set(HASH 556f95f7566fe23704d136239e4cf5e2a26f939ab43b44145c91b70d031a088d553e5c21301f1242a2295dcde3143b356211f0108c68e65eef8572407618326d)
else()
message(FATAL "unknown tool ${VAR} -- unable to acquire.")
endif()
@@ -38,10 +77,21 @@ function(vcpkg_find_acquire_program VAR)
if(DEFINED NOEXTRACT)
file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME})
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}" 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}
+ )
+ endif()
endif()
find_program(${VAR} ${PROGNAME} PATHS ${PATHS})
diff --git a/scripts/cmake/vcpkg_install_cmake.cmake b/scripts/cmake/vcpkg_install_cmake.cmake
index 14f1bc94d..f29f3ce5d 100644
--- a/scripts/cmake/vcpkg_install_cmake.cmake
+++ b/scripts/cmake/vcpkg_install_cmake.cmake
@@ -1,7 +1,20 @@
function(vcpkg_install_cmake)
+ cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN})
+
+ set(MSVC_EXTRA_ARGS)
+
+ # Specifies the architecture of the toolset, NOT the architecture of the produced binary
+ 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()
+
message(STATUS "Package ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} --build . --config Release --target install
+ COMMAND ${CMAKE_COMMAND} --build . --config Release --target install -- /p:VCPkgLocalAppDataDisabled=true ${MSVC_EXTRA_ARGS}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME package-${TARGET_TRIPLET}-rel
)
@@ -9,7 +22,7 @@ function(vcpkg_install_cmake)
message(STATUS "Package ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} --build . --config Debug --target install
+ COMMAND ${CMAKE_COMMAND} --build . --config Debug --target install -- /p:VCPkgLocalAppDataDisabled=true ${MSVC_EXTRA_ARGS}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME package-${TARGET_TRIPLET}-dbg
)
diff --git a/scripts/doVcpkgRelease.ps1 b/scripts/doVcpkgRelease.ps1
deleted file mode 100644
index 97656ba69..000000000
--- a/scripts/doVcpkgRelease.ps1
+++ /dev/null
@@ -1,82 +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
-
- & "$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
-
- 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..8d31b0edb 100644
--- a/scripts/fetchDependency.ps1
+++ b/scripts/fetchDependency.ps1
@@ -51,12 +51,12 @@ 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 + "."
-
+ $noDescription = "Does not download " + $Dependency + "."
+
$userAllowedDownload = promptForDownload $title $message $yesDescription $noDescription
if (!$userAllowedDownload)
{
@@ -70,15 +70,21 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
if ($Dependency -ne "git") # git fails with BITS
{
- Start-BitsTransfer -Source $url -Destination $downloadPath -ErrorAction SilentlyContinue
+ try {
+ 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 +92,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 +105,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();
}
@@ -120,33 +126,33 @@ 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.7.2"
+ $downloadVersion = "3.7.2"
+ $url = "https://cmake.org/files/v3.7/cmake-3.7.2-win32-x86.zip"
+ $downloadPath = "$downloadsDir\cmake-3.7.2-win32-x86.zip"
+ $expectedDownloadedFileHash = "ec5e299d412e0272e01d4de5bf07718f42c96361f83d51cc39f91bf49cc3e5c3"
+ $executableFromDownload = "$downloadsDir\cmake-3.7.2-win32-x86\bin\cmake.exe"
$extractionType = $ExtractionType_ZIP
}
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"
+ $downloadVersion = "2.11.0"
+ $url = "https://github.com/git-for-windows/git/releases/download/v2.11.0.windows.3/PortableGit-2.11.0.3-32-bit.7z.exe" # We choose the 32-bit version
+ $downloadPath = "$downloadsDir\PortableGit-2.11.0.3-32-bit.7z.exe"
+ $expectedDownloadedFileHash = "8bf3769c37945e991903dd1b988c6b1d97bbf0f3afc9851508974f38bf94dc01"
# 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.
+ # Therefore, choosing the cmd dir here as well.
$executableFromDownload = "$downloadsDir\PortableGit\cmd\git.exe"
$extractionType = $ExtractionType_SELF_EXTRACTING_7Z
}
@@ -155,7 +161,12 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
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
@@ -186,7 +197,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
if (-not (Test-Path $executableFromDownload))
{
Invoke-Command $downloadPath "-y" -waitForExit:$true
- }
+ }
}
else
{
@@ -197,6 +208,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
{
throw [System.IO.FileNotFoundException] ("Could not detect or download " + $Dependency)
}
+
+ return $downloadPath
}
SelectProgram $Dependency \ No newline at end of file
diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1
new file mode 100644
index 000000000..1be4a4e6d
--- /dev/null
+++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1
@@ -0,0 +1,32 @@
+[CmdletBinding()]
+param(
+
+)
+
+$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
+
+# VS2017
+$VisualStudio2017InstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1
+foreach ($instance in $VisualStudio2017InstallationInstances)
+{
+ $VCFolder= "$instance\VC\Tools\MSVC\"
+
+ if (Test-Path $VCFolder)
+ {
+ return "$instance\MSBuild\15.0\Bin\MSBuild.exe","v141"
+ }
+}
+
+# VS2015
+$CandidateProgramFiles = "${env:PROGRAMFILES(X86)}", "${env:PROGRAMFILES}"
+foreach ($ProgramFiles in $CandidateProgramFiles)
+{
+ $clExe= "$ProgramFiles\Microsoft Visual Studio 14.0\\VC\bin\cl.exe"
+
+ if (Test-Path $clExe)
+ {
+ return "$ProgramFiles\MSBuild\14.0\Bin\MSBuild.exe","v140"
+ }
+}
+
+throw "Could not find MSBuild with C++ support. VS2015 or above with C++ support need to be installed." \ No newline at end of file
diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1
new file mode 100644
index 000000000..951975758
--- /dev/null
+++ b/scripts/findVisualStudioInstallationInstances.ps1
@@ -0,0 +1,35 @@
+[CmdletBinding()]
+param(
+
+)
+
+Import-Module BitsTransfer
+
+$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
+$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
+
+$downloadsDir = "$vcpkgRootDir\downloads"
+
+$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget"
+$nugetPackageDir = "$downloadsDir\nuget-packages"
+
+$SetupAPIVersion = "1.5.125-rc"
+$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Version $SetupAPIVersion -OutputDirectory $nugetPackageDir -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/ports.cmake b/scripts/ports.cmake
index 44cb386be..c03b005ea 100644
--- a/scripts/ports.cmake
+++ b/scripts/ports.cmake
@@ -33,7 +33,6 @@ endif()
if(CMD MATCHES "^BUILD$")
string(REGEX REPLACE "([^-]*)-([^-]*)" "\\1" TRIPLET_SYSTEM_ARCH ${TARGET_TRIPLET})
- string(REGEX REPLACE "([^-]*)-([^-]*)" "\\2" TRIPLET_SYSTEM_NAME ${TARGET_TRIPLET})
set(CMAKE_TRIPLET_FILE ${VCPKG_ROOT_DIR}/triplets/${TARGET_TRIPLET}.cmake)
if(NOT EXISTS ${CMAKE_TRIPLET_FILE})
@@ -70,7 +69,19 @@ if(CMD MATCHES "^BUILD$")
endif()
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR} ${CURRENT_PACKAGES_DIR})
+ include(${CMAKE_TRIPLET_FILE})
include(${CURRENT_PORT_DIR}/portfile.cmake)
+
+ 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}\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()
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 804d8d216..c848b6445 100644
--- a/scripts/templates/portfile.in.cmake
+++ b/scripts/templates/portfile.in.cmake
@@ -6,7 +6,6 @@
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
-include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/@ROOT_NAME@)
vcpkg_download_distfile(ARCHIVE
diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt
index fe0104ac9..fcedfa235 100644
--- a/toolsrc/VERSION.txt
+++ b/toolsrc/VERSION.txt
@@ -1 +1 @@
-"0.0.40" \ No newline at end of file
+"0.0.71" \ 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/BinaryParagraph.h b/toolsrc/include/BinaryParagraph.h
index 01979c924..3d9cfb9fb 100644
--- a/toolsrc/include/BinaryParagraph.h
+++ b/toolsrc/include/BinaryParagraph.h
@@ -2,7 +2,6 @@
#include <unordered_map>
#include "SourceParagraph.h"
-#include "triplet.h"
#include "package_spec.h"
namespace vcpkg
@@ -10,7 +9,7 @@ namespace vcpkg
struct BinaryParagraph
{
BinaryParagraph();
- explicit BinaryParagraph(const std::unordered_map<std::string, std::string>& fields);
+ explicit BinaryParagraph(std::unordered_map<std::string, std::string> fields);
BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet);
std::string displayname() const;
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
new file mode 100644
index 000000000..761b49759
--- /dev/null
+++ b/toolsrc/include/Paragraphs.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "filesystem_fs.h"
+#include <unordered_map>
+
+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);
+}
diff --git a/toolsrc/include/post_build_lint.h b/toolsrc/include/PostBuildLint.h
index bc916a7af..215a237aa 100644
--- a/toolsrc/include/post_build_lint.h
+++ b/toolsrc/include/PostBuildLint.h
@@ -2,7 +2,7 @@
#include "package_spec.h"
#include "vcpkg_paths.h"
-namespace vcpkg
+namespace vcpkg::PostBuildLint
{
void 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..ff996b2b6
--- /dev/null
+++ b/toolsrc/include/PostBuildLint_BuildInfo.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <unordered_map>
+#include "Paragraphs.h"
+#include "PostBuildLint_BuildPolicies.h"
+#include "opt_bool.h"
+
+namespace vcpkg::PostBuildLint
+{
+ struct BuildInfo
+ {
+ static BuildInfo create(std::unordered_map<std::string, std::string> pgh);
+
+ std::string crt_linkage;
+ std::string 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..187ba6d64
--- /dev/null
+++ b/toolsrc/include/PostBuildLint_BuildPolicies.h
@@ -0,0 +1,35 @@
+#pragma once
+#include <string>
+
+namespace vcpkg::PostBuildLint::BuildPolicies
+{
+ enum class backing_enum_t
+ {
+ UNKNOWN = 0,
+ EMPTY_PACKAGE,
+ DLLS_WITHOUT_LIBS
+ };
+
+ struct type
+ {
+ 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:
+ type();
+ backing_enum_t backing_enum;
+ };
+
+ static constexpr int value_count = 3;
+ const std::vector<type>& values();
+
+
+ static constexpr type UNKNOWN(backing_enum_t::UNKNOWN);
+ static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE);
+ static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS);
+
+ 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..a5cb24f49
--- /dev/null
+++ b/toolsrc/include/PostBuildLint_BuildType.h
@@ -0,0 +1,45 @@
+#pragma once
+#include "PostBuildLint_ConfigurationType.h"
+#include "PostBuildLint_LinkageType.h"
+#include <vector>
+#include <regex>
+
+namespace vcpkg::PostBuildLint
+{
+ 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);
+}
diff --git a/toolsrc/include/PostBuildLint_ConfigurationType.h b/toolsrc/include/PostBuildLint_ConfigurationType.h
new file mode 100644
index 000000000..55dede921
--- /dev/null
+++ b/toolsrc/include/PostBuildLint_ConfigurationType.h
@@ -0,0 +1,14 @@
+#pragma once
+#pragma once
+#include <string>
+
+namespace vcpkg::PostBuildLint
+{
+ enum class ConfigurationType
+ {
+ DEBUG = 1,
+ RELEASE = 2
+ };
+
+ std::string to_string(const ConfigurationType& conf);
+}
diff --git a/toolsrc/include/PostBuildLint_LinkageType.h b/toolsrc/include/PostBuildLint_LinkageType.h
new file mode 100644
index 000000000..7cca97639
--- /dev/null
+++ b/toolsrc/include/PostBuildLint_LinkageType.h
@@ -0,0 +1,16 @@
+#pragma once
+#include <string>
+
+namespace vcpkg::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);
+}
diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h
index 72dca8324..5ae9b38b8 100644
--- a/toolsrc/include/SourceParagraph.h
+++ b/toolsrc/include/SourceParagraph.h
@@ -5,16 +5,31 @@
namespace vcpkg
{
+ struct triplet;
+
+ struct dependency
+ {
+ std::string name;
+ std::string qualifier;
+ };
+
+ std::ostream& operator<<(std::ostream& os, const dependency& p);
+
struct SourceParagraph
{
SourceParagraph();
- explicit SourceParagraph(const std::unordered_map<std::string, std::string>& fields);
+ explicit SourceParagraph(std::unordered_map<std::string, std::string> fields);
std::string name;
std::string version;
std::string description;
std::string maintainer;
- std::vector<std::string> depends;
+ std::vector<dependency> depends;
};
+
+ std::vector<std::string> filter_dependencies(const std::vector<vcpkg::dependency>& deps, const triplet& t);
+
+ std::vector<vcpkg::dependency> expand_qualified_dependencies(const std::vector<std::string>& depends);
+ std::vector<std::string> parse_depends(const std::string& depends_string);
}
diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h
index 9446d432c..11491cf4e 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
{
@@ -13,6 +14,10 @@ namespace vcpkg
using iterator = container::reverse_iterator;
using const_iterator = container::const_reverse_iterator;
+ const_iterator find(const package_spec& spec) const
+ {
+ return find(spec.name(), spec.target_triplet());
+ }
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);
@@ -21,22 +26,22 @@ namespace vcpkg
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/coff_file_reader.h b/toolsrc/include/coff_file_reader.h
index 81f107f10..24fbf4576 100644
--- a/toolsrc/include/coff_file_reader.h
+++ b/toolsrc/include/coff_file_reader.h
@@ -1,12 +1,10 @@
#pragma once
#include <vector>
#include "MachineType.h"
-#include <filesystem>
+#include "filesystem_fs.h"
-namespace vcpkg {namespace COFFFileReader
+namespace vcpkg::COFFFileReader
{
- namespace fs = std::tr2::sys;
-
struct dll_info
{
MachineType machine_type;
@@ -17,7 +15,7 @@ namespace vcpkg {namespace COFFFileReader
std::vector<MachineType> machine_types;
};
- dll_info read_dll(const fs::path path);
+ dll_info read_dll(const fs::path& path);
- lib_info read_lib(const fs::path path);
-}}
+ lib_info read_lib(const fs::path& path);
+}
diff --git a/toolsrc/include/expected.h b/toolsrc/include/expected.h
index affabcc02..cbb513b22 100644
--- a/toolsrc/include/expected.h
+++ b/toolsrc/include/expected.h
@@ -1,5 +1,6 @@
#pragma once
+#include <system_error>
#include "vcpkg_Checks.h"
namespace vcpkg
diff --git a/toolsrc/include/filesystem_fs.h b/toolsrc/include/filesystem_fs.h
new file mode 100644
index 000000000..ece485c23
--- /dev/null
+++ b/toolsrc/include/filesystem_fs.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#include <filesystem>
+
+namespace fs = std::tr2::sys; \ No newline at end of file
diff --git a/toolsrc/include/metrics.h b/toolsrc/include/metrics.h
index 52662cd97..a0f4fc61d 100644
--- a/toolsrc/include/metrics.h
+++ b/toolsrc/include/metrics.h
@@ -13,6 +13,7 @@ namespace vcpkg
void TrackProperty(const std::string& name, const std::string& value);
void TrackProperty(const std::string& name, const std::wstring& value);
bool GetCompiledMetricsEnabled();
+ std::wstring GetSQMUser();
void Upload(const std::string& payload);
void Flush();
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..56f24f161
--- /dev/null
+++ b/toolsrc/include/pch.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
+#include <Windows.h>
+#include <shellapi.h>
+#include <Shlobj.h>
+#include <winhttp.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/triplet.h b/toolsrc/include/triplet.h
index bc99a17df..32ea2e711 100644
--- a/toolsrc/include/triplet.h
+++ b/toolsrc/include/triplet.h
@@ -8,20 +8,12 @@ namespace vcpkg
{
static triplet from_canonical_name(const std::string& triplet_as_string);
- enum class BuildType
- {
- DYNAMIC,
- STATIC
- };
-
static const triplet X86_WINDOWS;
static const triplet X64_WINDOWS;
static const triplet X86_UWP;
static const triplet X64_UWP;
static const triplet ARM_UWP;
- BuildType build_type() const;
-
const std::string& canonical_name() const;
std::string architecture() const;
diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h
deleted file mode 100644
index a4a0682cf..000000000
--- a/toolsrc/include/vcpkg.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#pragma once
-
-#include <filesystem>
-#include <vector>
-#include <unordered_map>
-#include "package_spec.h"
-#include "BinaryParagraph.h"
-#include "StatusParagraphs.h"
-#include "vcpkg_paths.h"
-
-namespace vcpkg
-{
- namespace fs = std::tr2::sys;
-
- extern bool g_do_dry_run;
-
- 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);
- std::string shorten_description(const std::string& desc);
-
- StatusParagraphs database_load_check(const vcpkg_paths& paths);
-
- std::vector<std::string> get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db);
-
- void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db);
- void deinstall_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs& status_db);
-
- void search_file(const vcpkg_paths& paths, const std::string& file_substr, const StatusParagraphs& status_db);
-
- void binary_import(const vcpkg_paths& paths, const fs::path& include_directory, const fs::path& project_directory, const BinaryParagraph& control_file_data);
-
- const std::string& version();
-} // namespace vcpkg
diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h
index 9d9b21ed6..a58b38ac0 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();
@@ -46,4 +46,4 @@ namespace vcpkg {namespace Checks
exit_with_message(Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
}
}
-}}
+}
diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h
index 978519820..8d772b255 100644
--- a/toolsrc/include/vcpkg_Commands.h
+++ b/toolsrc/include/vcpkg_Commands.h
@@ -3,42 +3,112 @@
#include "vcpkg_cmd_arguments.h"
#include "vcpkg_paths.h"
-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);
+
+ namespace Build
+ {
+ void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir);
+ void perform_and_exit(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 print_usage();
- void print_example(const char* command_and_arguments);
- std::string create_example_string(const char* command_and_arguments);
- void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
+ namespace Install
+ {
+ 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 Remove
+ {
+ 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 Update
+ {
+ void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
+ }
- void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
- void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
- 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 Create
+ {
+ void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
+ }
- void cache_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 integrate_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
+ namespace Search
+ {
+ 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 List
+ {
+ 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);
+ namespace Import
+ {
+ 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 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
+ {
+ void perform_and_exit(const vcpkg_cmd_arguments& args);
+ }
+
+ namespace Contact
+ {
+ 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
@@ -52,7 +122,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 9dc32fc41..b63816089 100644
--- a/toolsrc/include/vcpkg_Dependencies.h
+++ b/toolsrc/include/vcpkg_Dependencies.h
@@ -2,12 +2,78 @@
#include <vector>
#include "package_spec.h"
#include "StatusParagraphs.h"
-#include <unordered_set>
#include "vcpkg_paths.h"
+#include "vcpkg_optional.h"
-namespace vcpkg {namespace Dependencies
+namespace vcpkg::Dependencies
{
- std::vector<package_spec> create_dependency_ordered_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
+ enum class request_type
+ {
+ UNKNOWN,
+ USER_REQUESTED,
+ AUTO_SELECTED
+ };
- std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db);
-}}
+ enum class install_plan_type
+ {
+ UNKNOWN,
+ BUILD_AND_INSTALL,
+ INSTALL,
+ ALREADY_INSTALLED
+ };
+
+ struct install_plan_action
+ {
+ 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 vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
+}
diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h
index 877ac7deb..e4dd47472 100644
--- a/toolsrc/include/vcpkg_Environment.h
+++ b/toolsrc/include/vcpkg_Environment.h
@@ -1,7 +1,7 @@
#pragma once
#include "vcpkg_paths.h"
-namespace vcpkg {namespace Environment
+namespace vcpkg::Environment
{
void ensure_nuget_on_path(const vcpkg_paths& paths);
@@ -14,4 +14,14 @@ namespace vcpkg {namespace Environment
ensure_cmake_on_path(paths);
ensure_git_on_path(paths);
}
-}}
+
+ const fs::path& get_dumpbin_exe(const vcpkg_paths& paths);
+
+ struct vcvarsall_and_platform_toolset
+ {
+ fs::path path;
+ std::wstring platform_toolset;
+ };
+
+ const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths);
+}
diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h
index 445713965..3f9570946 100644
--- a/toolsrc/include/vcpkg_Files.h
+++ b/toolsrc/include/vcpkg_Files.h
@@ -1,17 +1,56 @@
#pragma once
#include "expected.h"
-#include <filesystem>
+#include "filesystem_fs.h"
+#include <iterator>
-namespace vcpkg {namespace Files
+namespace vcpkg::Files
{
static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)";
- void check_is_directory(const std::tr2::sys::path& dirpath);
+ void check_is_directory(const fs::path& dirpath);
- bool has_invalid_chars_for_filesystem(const std::string s);
+ bool has_invalid_chars_for_filesystem(const std::string& s);
- expected<std::string> get_contents(const std::tr2::sys::path& file_path) noexcept;
+ expected<std::string> read_contents(const fs::path& file_path) noexcept;
- std::tr2::sys::path find_file_recursively_up(const std::tr2::sys::path& starting_dir, const std::string& filename);
-}}
+ expected<std::vector<std::string>> read_all_lines(const fs::path& file_path);
+
+ void write_all_lines(const fs::path& file_path, const std::vector<std::string>& lines);
+
+ fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename);
+
+ template <class Pred>
+ void non_recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector<fs::path>* output)
+ {
+ std::copy_if(fs::directory_iterator(dir), fs::directory_iterator(), std::back_inserter(*output), predicate);
+ }
+
+ template <class Pred>
+ void recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector<fs::path>* output)
+ {
+ std::copy_if(fs::recursive_directory_iterator(dir), fs::recursive_directory_iterator(), std::back_inserter(*output), predicate);
+ }
+
+ template <class Pred>
+ std::vector<fs::path> recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate)
+ {
+ std::vector<fs::path> v;
+ recursive_find_matching_paths_in_dir(dir, predicate, &v);
+ return v;
+ }
+
+ void recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension, std::vector<fs::path>* output);
+
+ std::vector<fs::path> recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension);
+
+ void recursive_find_all_files_in_dir(const fs::path& dir, std::vector<fs::path>* output);
+
+ std::vector<fs::path> recursive_find_all_files_in_dir(const fs::path& dir);
+
+ void non_recursive_find_all_files_in_dir(const fs::path& dir, std::vector<fs::path>* output);
+
+ 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 81b189f0e..933d9ac67 100644
--- a/toolsrc/include/vcpkg_Graphs.h
+++ b/toolsrc/include/vcpkg_Graphs.h
@@ -1,8 +1,9 @@
#pragma once
#include <unordered_map>
+#include <unordered_set>
-namespace vcpkg { namespace Graphs
+namespace vcpkg::Graphs
{
enum class ExplorationStatus
{
@@ -21,7 +22,7 @@ namespace vcpkg { namespace Graphs
{
static void find_topological_sort_internal(V vertex,
ExplorationStatus& status,
- const std::unordered_map<V, std::vector<V>>& adjacency_list,
+ const std::unordered_map<V, std::unordered_set<V>>& adjacency_list,
std::unordered_map<V, ExplorationStatus>& exploration_status,
std::vector<V>& sorted)
{
@@ -63,7 +64,7 @@ namespace vcpkg { namespace Graphs
void add_edge(V u, V v)
{
this->vertices[v];
- this->vertices[u].push_back(v);
+ this->vertices[u].insert(v);
}
std::vector<V> find_topological_sort() const
@@ -108,12 +109,12 @@ namespace vcpkg { namespace Graphs
return indegrees;
}
- const std::unordered_map<V, std::vector<V>>& adjacency_list() const
+ const std::unordered_map<V, std::unordered_set<V>>& adjacency_list() const
{
return this->vertices;
}
private:
- std::unordered_map<V, std::vector<V>> vertices;
+ std::unordered_map<V, std::unordered_set<V>> vertices;
};
-}}
+}
diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h
index bbf3adfbf..96cbeecc3 100644
--- a/toolsrc/include/vcpkg_Input.h
+++ b/toolsrc/include/vcpkg_Input.h
@@ -3,13 +3,13 @@
#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 char* example_text);
+ package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const std::string& example_text);
- std::vector<package_spec> check_and_get_package_specs(const std::vector<std::string>& package_specs_as_strings, const triplet& default_target_triplet, const char* example_text);
+ std::vector<package_spec> check_and_get_package_specs(const std::vector<std::string>& package_specs_as_strings, const triplet& default_target_triplet, const std::string& example_text);
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 5b7b8ed46..5e2f92f55 100644
--- a/toolsrc/include/vcpkg_Maps.h
+++ b/toolsrc/include/vcpkg_Maps.h
@@ -2,8 +2,9 @@
#include <unordered_map>
#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)
@@ -15,4 +16,26 @@ namespace vcpkg { namespace Maps
}
return key_set;
}
-}}
+
+ template <typename K, typename V>
+ std::vector<K> extract_keys(const std::unordered_map<K, V>& input_map)
+ {
+ std::vector<K> key_set;
+ for (auto const& element : input_map)
+ {
+ key_set.push_back(element.first);
+ }
+ return key_set;
+ }
+
+ template <typename K, typename V>
+ std::vector<K> extract_keys(const std::map<K, V>& input_map)
+ {
+ std::vector<K> key_set;
+ for (auto const& element : input_map)
+ {
+ key_set.push_back(element.first);
+ }
+ 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 70526198c..8d5d7135b 100644
--- a/toolsrc/include/vcpkg_Strings.h
+++ b/toolsrc/include/vcpkg_Strings.h
@@ -1,8 +1,8 @@
#pragma once
-#include <string>
+#include <vector>
-namespace vcpkg {namespace Strings {namespace details
+namespace vcpkg::Strings::details
{
inline const char* to_printf_arg(const std::string& s)
{
@@ -42,9 +42,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)
@@ -67,4 +67,62 @@ namespace vcpkg {namespace Strings
std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern);
std::string ascii_to_lowercase(const std::string& input);
-}}
+
+ template <class T, class Transformer>
+ static std::string join(const std::vector<T>& v, const std::string& prefix, const std::string& delimiter, const std::string& suffix, Transformer transformer)
+ {
+ if (v.empty())
+ {
+ return std::string();
+ }
+
+ std::string output;
+ size_t size = v.size();
+
+ output.append(prefix);
+ output.append(transformer(v.at(0)));
+
+ for (size_t i = 1; i < size; ++i)
+ {
+ output.append(delimiter);
+ output.append(transformer(v.at(i)));
+ }
+
+ output.append(suffix);
+ return output;
+ }
+
+ static std::string join(const std::vector<std::string>& v, const std::string& prefix, const std::string& delimiter, const std::string& suffix);
+
+ class Joiner
+ {
+ public:
+ static Joiner on(const std::string& delimiter);
+
+ Joiner& prefix(const std::string& prefix);
+ Joiner& suffix(const std::string& suffix);
+
+ std::string join(const std::vector<std::string>& v) const;
+
+ template <class T, class Transformer>
+ std::string join(const std::vector<T>& v, Transformer transformer) const
+ {
+ return Strings::join(v, this->m_prefix, this->m_delimiter, this->m_suffix, transformer);
+ }
+
+ private:
+ explicit Joiner(const std::string& delimiter);
+
+ std::string m_prefix;
+ std::string m_delimiter;
+ std::string m_suffix;
+ };
+
+ 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 c420464c1..c9195163c 100644
--- a/toolsrc/include/vcpkg_System.h
+++ b/toolsrc/include/vcpkg_System.h
@@ -1,12 +1,11 @@
#pragma once
#include "vcpkg_Strings.h"
+#include "filesystem_fs.h"
-#include <filesystem>
-
-namespace vcpkg {namespace System
+namespace vcpkg::System
{
- std::tr2::sys::path get_exe_path_of_current_process();
+ fs::path get_exe_path_of_current_process();
struct exit_code_and_output
{
@@ -37,8 +36,28 @@ namespace vcpkg {namespace System
void print(const char* message);
void println(const char* message);
- void print(color c, const char* message);
- void println(color c, const char* message);
+ void print(const color c, const char* message);
+ void println(const color c, const char* message);
+
+ inline void print(const std::string& message)
+ {
+ return print(message.c_str());
+ }
+
+ inline void println(const std::string& message)
+ {
+ return println(message.c_str());
+ }
+
+ inline void print(const color c, const std::string& message)
+ {
+ return print(c, message.c_str());
+ }
+
+ inline void println(const color c, const std::string& message)
+ {
+ return println(c, message.c_str());
+ }
template <class...Args>
void print(const char* messageTemplate, const Args&... messageArgs)
@@ -47,7 +66,7 @@ namespace vcpkg {namespace System
}
template <class...Args>
- void print(color c, const char* messageTemplate, const Args&... messageArgs)
+ void print(const color c, const char* messageTemplate, const Args&... messageArgs)
{
return print(c, Strings::format(messageTemplate, messageArgs...).c_str());
}
@@ -59,7 +78,7 @@ namespace vcpkg {namespace System
}
template <class...Args>
- void println(color c, const char* messageTemplate, const Args&... messageArgs)
+ void println(const color c, const char* messageTemplate, const Args&... messageArgs)
{
return println(c, Strings::format(messageTemplate, messageArgs...).c_str());
}
@@ -74,4 +93,4 @@ namespace vcpkg {namespace System
};
std::wstring wdupenv_str(const wchar_t* varname) noexcept;
-}}
+}
diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h
index 95feb4814..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,20 +14,20 @@ 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;
std::unordered_set<std::string> check_and_get_optional_command_arguments(const std::vector<std::string>& valid_options) const;
void check_max_arg_count(const size_t expected_arg_count) const;
- void check_max_arg_count(const size_t expected_arg_count, const char* example_text) const;
+ void check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const;
void check_min_arg_count(const size_t expected_arg_count) const;
- void check_min_arg_count(const size_t expected_arg_count, const char* example_text) const;
+ void check_min_arg_count(const size_t expected_arg_count, const std::string& example_text) const;
void check_exact_arg_count(const size_t expected_arg_count) const;
- void check_exact_arg_count(const size_t expected_arg_count, const char* example_text) const;
+ void check_exact_arg_count(const size_t expected_arg_count, const std::string& example_text) const;
private:
std::unordered_set<std::string> optional_command_arguments;
diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h
new file mode 100644
index 000000000..5380e0158
--- /dev/null
+++ b/toolsrc/include/vcpkg_info.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include <string>
+
+namespace vcpkg::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 046b6836c..ba6defb9f 100644
--- a/toolsrc/include/vcpkg_paths.h
+++ b/toolsrc/include/vcpkg_paths.h
@@ -1,18 +1,20 @@
#pragma once
-#include <filesystem>
+#include "filesystem_fs.h"
#include "expected.h"
#include "package_spec.h"
+#include "BinaryParagraph.h"
namespace vcpkg
{
- namespace fs = std::tr2::sys;
-
struct vcpkg_paths
{
static expected<vcpkg_paths> create(const fs::path& vcpkg_root_dir);
fs::path package_dir(const package_spec& spec) const;
fs::path port_dir(const package_spec& spec) const;
+ fs::path build_info_file_path(const package_spec& spec) const;
+ fs::path listfile_path(const BinaryParagraph& pgh) const;
+
bool is_valid_triplet(const triplet& t) const;
fs::path root;
@@ -22,6 +24,7 @@ namespace vcpkg
fs::path ports;
fs::path installed;
fs::path triplets;
+ fs::path scripts;
fs::path buildsystems;
fs::path buildsystems_msbuild_targets;
diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h
new file mode 100644
index 000000000..b1653d197
--- /dev/null
+++ b/toolsrc/include/vcpkglib.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "package_spec.h"
+#include "BinaryParagraph.h"
+#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);
+
+ 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/vcpkglib_helpers.h b/toolsrc/include/vcpkglib_helpers.h
index 72711d63b..8a08513f3 100644
--- a/toolsrc/include/vcpkglib_helpers.h
+++ b/toolsrc/include/vcpkglib_helpers.h
@@ -2,11 +2,13 @@
#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);
std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname);
+ std::string remove_required_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname);
- std::vector<std::string> parse_depends(const std::string& depends_string);
-}}
+ std::string shorten_description(const std::string& desc);
+}
diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/BinaryParagraph.cpp
index 48d04f686..f949677a3 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"
@@ -6,28 +7,57 @@ using namespace vcpkg::details;
namespace vcpkg
{
+ //
+ namespace BinaryParagraphRequiredField
+ {
+ static const std::string PACKAGE = "Package";
+ static const std::string VERSION = "Version";
+ static const std::string ARCHITECTURE = "Architecture";
+ static const std::string MULTI_ARCH = "Multi-Arch";
+ }
+
+ namespace BinaryParagraphOptionalField
+ {
+ static const std::string DESCRIPTION = "Description";
+ static const std::string MAINTAINER = "Maintainer";
+ 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(const std::unordered_map<std::string, std::string>& fields) :
- version(required_field(fields, "Version")),
- description(optional_field(fields, "Description")),
- maintainer(optional_field(fields, "Maintainer"))
+ BinaryParagraph::BinaryParagraph(std::unordered_map<std::string, std::string> fields)
{
- const std::string name = required_field(fields, "Package");
- const triplet target_triplet = triplet::from_canonical_name(required_field(fields, "Architecture"));
+ const std::string name = details::remove_required_field(&fields, BinaryParagraphRequiredField::PACKAGE);
+ const std::string architecture = details::remove_required_field(&fields, BinaryParagraphRequiredField::ARCHITECTURE);
+ const triplet target_triplet = triplet::from_canonical_name(architecture);
+
this->spec = package_spec::from_name_and_triplet(name, target_triplet).get_or_throw();
+ this->version = details::remove_required_field(&fields, BinaryParagraphRequiredField::VERSION);
- {
- std::string multi_arch = required_field(fields, "Multi-Arch");
- Checks::check_throw(multi_arch == "same", "Multi-Arch must be 'same' but was %s", multi_arch);
- }
+ this->description = details::remove_optional_field(&fields, BinaryParagraphOptionalField::DESCRIPTION);
+ this->maintainer = details::remove_optional_field(&fields, BinaryParagraphOptionalField::MAINTAINER);
- std::string deps = optional_field(fields, "Depends");
- if (!deps.empty())
- {
- this->depends.clear();
- this->depends = parse_depends(deps);
- }
+ std::string multi_arch = details::remove_required_field(&fields, BinaryParagraphRequiredField::MULTI_ARCH);
+ Checks::check_exit(multi_arch == "same", "Multi-Arch must be 'same' but was %s", multi_arch);
+
+ std::string deps = details::remove_optional_field(&fields, BinaryParagraphOptionalField::DEPENDS);
+ this->depends = parse_depends(deps);
}
BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet)
@@ -36,12 +66,12 @@ namespace vcpkg
this->version = spgh.version;
this->description = spgh.description;
this->maintainer = spgh.maintainer;
- this->depends = spgh.depends;
+ this->depends = filter_dependencies(spgh.depends, target_triplet);
}
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/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
new file mode 100644
index 000000000..6dde5da7c
--- /dev/null
+++ b/toolsrc/src/Paragraphs.cpp
@@ -0,0 +1,170 @@
+#include "pch.h"
+#include "Paragraphs.h"
+#include "vcpkg_Files.h"
+
+namespace vcpkg::Paragraphs
+{
+ struct Parser
+ {
+ Parser(const char* c, const char* e) : cur(c), end(e)
+ {
+ }
+
+ private:
+ const char* cur;
+ const char* const end;
+
+ void peek(char& ch) const
+ {
+ if (cur == end)
+ ch = 0;
+ else
+ ch = *cur;
+ }
+
+ void next(char& ch)
+ {
+ if (cur == end)
+ ch = 0;
+ else
+ {
+ ++cur;
+ peek(ch);
+ }
+ }
+
+ void skip_spaces(char& ch)
+ {
+ while (ch == ' ' || ch == '\t')
+ next(ch);
+ }
+
+ static bool is_alphanum(char ch)
+ {
+ return (ch >= 'A' && ch <= 'Z')
+ || (ch >= 'a' && ch <= 'z')
+ || (ch >= '0' && ch <= '9');
+ }
+
+ static bool is_lineend(char ch)
+ {
+ return ch == '\r' || ch == '\n' || ch == 0;
+ }
+
+ void get_fieldvalue(char& ch, std::string& fieldvalue)
+ {
+ fieldvalue.clear();
+
+ auto beginning_of_line = cur;
+ do
+ {
+ // scan to end of current line (it is part of the field value)
+ while (!is_lineend(ch))
+ next(ch);
+
+ fieldvalue.append(beginning_of_line, cur);
+
+ if (ch == '\r')
+ next(ch);
+ if (ch == '\n')
+ next(ch);
+
+ if (is_alphanum(ch))
+ {
+ // Line begins a new field.
+ return;
+ }
+
+ beginning_of_line = cur;
+
+ // Line may continue the current field with data or terminate the paragraph,
+ // depending on first nonspace character.
+ skip_spaces(ch);
+
+ if (is_lineend(ch))
+ {
+ // Line was whitespace or empty.
+ // This terminates the field and the paragraph.
+ // We leave the blank line's whitespace consumed, because it doesn't matter.
+ return;
+ }
+
+ // First nonspace is not a newline. This continues the current field value.
+ // We forcibly convert all newlines into single '\n' for ease of text handling later on.
+ fieldvalue.push_back('\n');
+ }
+ while (true);
+ }
+
+ void get_fieldname(char& ch, std::string& fieldname)
+ {
+ auto begin_fieldname = cur;
+ while (is_alphanum(ch) || ch == '-')
+ next(ch);
+ Checks::check_throw(ch == ':', "Expected ':'");
+ fieldname = std::string(begin_fieldname, cur);
+
+ // skip ': '
+ next(ch);
+ skip_spaces(ch);
+ }
+
+ void get_paragraph(char& ch, std::unordered_map<std::string, std::string>& fields)
+ {
+ fields.clear();
+ std::string fieldname;
+ std::string fieldvalue;
+ do
+ {
+ get_fieldname(ch, fieldname);
+
+ auto it = fields.find(fieldname);
+ Checks::check_throw(it == fields.end(), "Duplicate field");
+
+ get_fieldvalue(ch, fieldvalue);
+
+ fields.emplace(fieldname, fieldvalue);
+ }
+ while (!is_lineend(ch));
+ }
+
+ public:
+ std::vector<std::unordered_map<std::string, std::string>> get_paragraphs()
+ {
+ std::vector<std::unordered_map<std::string, std::string>> paragraphs;
+
+ char ch;
+ peek(ch);
+
+ while (ch != 0)
+ {
+ if (ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t')
+ {
+ next(ch);
+ continue;
+ }
+
+ paragraphs.emplace_back();
+ get_paragraph(ch, paragraphs.back());
+ }
+
+ return paragraphs;
+ }
+ };
+
+ std::vector<std::unordered_map<std::string, std::string>> get_paragraphs(const fs::path& control_path)
+ {
+ 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();
+ }
+}
diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp
new file mode 100644
index 000000000..90bd55843
--- /dev/null
+++ b/toolsrc/src/PostBuildLint.cpp
@@ -0,0 +1,730 @@
+#include "pch.h"
+#include "vcpkg_paths.h"
+#include "package_spec.h"
+#include "vcpkg_Files.h"
+#include "vcpkg_System.h"
+#include "vcpkg_Environment.h"
+#include "coff_file_reader.h"
+#include "PostBuildLint_BuildInfo.h"
+#include "PostBuildLint_BuildType.h"
+
+namespace vcpkg::PostBuildLint
+{
+ enum class lint_status
+ {
+ SUCCESS = 0,
+ ERROR_DETECTED = 1
+ };
+
+ 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)
+ {
+ const fs::path include_dir = package_dir / "include";
+ if (!fs::exists(include_dir) || fs::is_empty(include_dir))
+ {
+ System::println(System::color::warning, "The folder /include is empty. This indicates the library was not correctly installed.");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_for_files_in_debug_include_directory(const fs::path& package_dir)
+ {
+ const fs::path debug_include_dir = package_dir / "debug" / "include";
+ std::vector<fs::path> files_found;
+
+ Files::recursive_find_matching_paths_in_dir(debug_include_dir, [&](const fs::path& current)
+ {
+ return !fs::is_directory(current) && current.extension() != ".ifc";
+ }, &files_found);
+
+ if (!files_found.empty())
+ {
+ System::println(System::color::warning, "Include files should not be duplicated into the /debug/include directory. If this cannot be disabled in the project cmake, use\n"
+ " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)"
+ );
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_for_files_in_debug_share_directory(const fs::path& package_dir)
+ {
+ const fs::path debug_share = package_dir / "debug" / "share";
+
+ if (fs::exists(debug_share) && !fs::is_empty(debug_share))
+ {
+ System::println(System::color::warning, "No files should be present in /debug/share");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_folder_lib_cmake(const fs::path& package_dir)
+ {
+ const fs::path lib_cmake = package_dir / "lib" / "cmake";
+ if (fs::exists(lib_cmake))
+ {
+ System::println(System::color::warning, "The /lib/cmake folder should be moved to just /cmake");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_for_misplaced_cmake_files(const fs::path& package_dir, const package_spec& spec)
+ {
+ std::vector<fs::path> misplaced_cmake_files;
+ Files::recursive_find_files_with_extension_in_dir(package_dir / "cmake", ".cmake", &misplaced_cmake_files);
+ Files::recursive_find_files_with_extension_in_dir(package_dir / "debug" / "cmake", ".cmake", &misplaced_cmake_files);
+ Files::recursive_find_files_with_extension_in_dir(package_dir / "lib" / "cmake", ".cmake", &misplaced_cmake_files);
+ Files::recursive_find_files_with_extension_in_dir(package_dir / "debug" / "lib" / "cmake", ".cmake", &misplaced_cmake_files);
+
+ if (!misplaced_cmake_files.empty())
+ {
+ System::println(System::color::warning, "The following cmake files were found outside /share/%s. Please place cmake files in /share/%s.", spec.name(), spec.name());
+ Files::print_paths(misplaced_cmake_files);
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_folder_debug_lib_cmake(const fs::path& package_dir)
+ {
+ const fs::path lib_cmake_debug = package_dir / "debug" / "lib" / "cmake";
+ if (fs::exists(lib_cmake_debug))
+ {
+ System::println(System::color::warning, "The /debug/lib/cmake folder should be moved to just /debug/cmake");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_for_dlls_in_lib_dirs(const fs::path& package_dir)
+ {
+ std::vector<fs::path> dlls;
+ Files::recursive_find_files_with_extension_in_dir(package_dir / "lib", ".dll", &dlls);
+ Files::recursive_find_files_with_extension_in_dir(package_dir / "debug" / "lib", ".dll", &dlls);
+
+ if (!dlls.empty())
+ {
+ System::println(System::color::warning, "\nThe following dlls were found in /lib and /debug/lib. Please move them to /bin or /debug/bin, respectively.");
+ Files::print_paths(dlls);
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_for_copyright_file(const package_spec& spec, const vcpkg_paths& paths)
+ {
+ const fs::path packages_dir = paths.packages / spec.dir();
+ const fs::path copyright_file = packages_dir / "share" / spec.name() / "copyright";
+ if (fs::exists(copyright_file))
+ {
+ return lint_status::SUCCESS;
+ }
+ const fs::path current_buildtrees_dir = paths.buildtrees / spec.name();
+ const fs::path current_buildtrees_dir_src = current_buildtrees_dir / "src";
+
+ std::vector<fs::path> potential_copyright_files;
+ // Only searching one level deep
+ for (auto it = fs::recursive_directory_iterator(current_buildtrees_dir_src); it != fs::recursive_directory_iterator(); ++it)
+ {
+ if (it.depth() > 1)
+ {
+ continue;
+ }
+
+ const std::string filename = it->path().filename().string();
+ if (filename == "LICENSE" || filename == "LICENSE.txt" || filename == "COPYING")
+ {
+ potential_copyright_files.push_back(it->path());
+ }
+ }
+
+ System::println(System::color::warning, "The software license must be available at ${CURRENT_PACKAGES_DIR}/share/%s/copyright .", spec.name());
+ if (potential_copyright_files.size() == 1) // if there is only one candidate, provide the cmake lines needed to place it in the proper location
+ {
+ const fs::path found_file = potential_copyright_files[0];
+ const fs::path relative_path = found_file.string().erase(0, current_buildtrees_dir.string().size() + 1); // The +1 is needed to remove the "/"
+ System::println("\n file(COPY ${CURRENT_BUILDTREES_DIR}/%s DESTINATION ${CURRENT_PACKAGES_DIR}/share/%s)\n"
+ " file(RENAME ${CURRENT_PACKAGES_DIR}/share/%s/%s ${CURRENT_PACKAGES_DIR}/share/%s/copyright)",
+ relative_path.generic_string(), spec.name(), spec.name(), found_file.filename().generic_string(), spec.name());
+ return lint_status::ERROR_DETECTED;
+ }
+
+ if (potential_copyright_files.size() > 1)
+ {
+ System::println(System::color::warning, "The following files are potential copyright files:");
+ Files::print_paths(potential_copyright_files);
+ }
+
+ System::println(" %s/share/%s/copyright", packages_dir.generic_string(), spec.name());
+ return lint_status::ERROR_DETECTED;
+ }
+
+ static lint_status check_for_exes(const fs::path& package_dir)
+ {
+ std::vector<fs::path> exes;
+ Files::recursive_find_files_with_extension_in_dir(package_dir / "bin", ".exe", &exes);
+ Files::recursive_find_files_with_extension_in_dir(package_dir / "debug" / "bin", ".exe", &exes);
+
+ if (!exes.empty())
+ {
+ System::println(System::color::warning, "The following EXEs were found in /bin and /debug/bin. EXEs are not valid distribution targets.");
+ Files::print_paths(exes);
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ 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());
+ System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
+ Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
+
+ if (ec_data.output.find("ordinal hint RVA name") == std::string::npos)
+ {
+ dlls_with_no_exports.push_back(dll);
+ }
+ }
+
+ if (!dlls_with_no_exports.empty())
+ {
+ System::println(System::color::warning, "The following DLLs have no exports:");
+ Files::print_paths(dlls_with_no_exports);
+ System::println(System::color::warning, "DLLs without any exports are likely a bug in the build script.");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ 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")
+ {
+ return lint_status::SUCCESS;
+ }
+
+ 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());
+ System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
+ Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
+
+ if (ec_data.output.find("App Container") == std::string::npos)
+ {
+ dlls_with_improper_uwp_bit.push_back(dll);
+ }
+ }
+
+ if (!dlls_with_improper_uwp_bit.empty())
+ {
+ System::println(System::color::warning, "The following DLLs do not have the App Container bit set:");
+ Files::print_paths(dlls_with_improper_uwp_bit);
+ System::println(System::color::warning, "This bit is required for Windows Store apps.");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ struct file_and_arch
+ {
+ fs::path file;
+ std::string actual_arch;
+ };
+
+ static std::string get_actual_architecture(const MachineType& machine_type)
+ {
+ switch (machine_type)
+ {
+ case MachineType::AMD64:
+ case MachineType::IA64:
+ return "x64";
+ case MachineType::I386:
+ return "x86";
+ case MachineType::ARM:
+ case MachineType::ARMNT:
+ return "arm";
+ default:
+ return "Machine Type Code = " + std::to_string(static_cast<uint16_t>(machine_type));
+ }
+ }
+
+ static void print_invalid_architecture_files(const std::string& expected_architecture, std::vector<file_and_arch> binaries_with_invalid_architecture)
+ {
+ System::println(System::color::warning, "The following files were built for an incorrect architecture:");
+ System::println("");
+ for (const file_and_arch& b : binaries_with_invalid_architecture)
+ {
+ System::println(" %s", b.file.generic_string());
+ System::println("Expected %s, but was: %s", expected_architecture, b.actual_arch);
+ System::println("");
+ }
+ }
+
+ static lint_status check_dll_architecture(const std::string& expected_architecture, const std::vector<fs::path>& files)
+ {
+ std::vector<file_and_arch> binaries_with_invalid_architecture;
+
+ for (const fs::path& file : files)
+ {
+ Checks::check_exit(file.extension() == ".dll", "The file extension was not .dll: %s", file.generic_string());
+ COFFFileReader::dll_info info = COFFFileReader::read_dll(file);
+ const std::string actual_architecture = get_actual_architecture(info.machine_type);
+
+ if (expected_architecture != actual_architecture)
+ {
+ binaries_with_invalid_architecture.push_back({file, actual_architecture});
+ }
+ }
+
+ if (!binaries_with_invalid_architecture.empty())
+ {
+ print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture);
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_lib_architecture(const std::string& expected_architecture, const std::vector<fs::path>& files)
+ {
+ std::vector<file_and_arch> binaries_with_invalid_architecture;
+
+ for (const fs::path& file : files)
+ {
+ Checks::check_exit(file.extension() == ".lib", "The file extension was not .lib: %s", file.generic_string());
+ COFFFileReader::lib_info info = COFFFileReader::read_lib(file);
+ Checks::check_exit(info.machine_types.size() == 1, "Found more than 1 architecture in file %s", file.generic_string());
+
+ 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});
+ }
+ }
+
+ if (!binaries_with_invalid_architecture.empty())
+ {
+ print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture);
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_no_dlls_present(const std::vector<fs::path>& dlls)
+ {
+ if (dlls.empty())
+ {
+ return lint_status::SUCCESS;
+ }
+
+ System::println(System::color::warning, "DLLs should not be present in a static build, but the following DLLs were found:");
+ Files::print_paths(dlls);
+ return lint_status::ERROR_DETECTED;
+ }
+
+ static lint_status check_matching_debug_and_release_binaries(const std::vector<fs::path>& debug_binaries, const std::vector<fs::path>& release_binaries)
+ {
+ const size_t debug_count = debug_binaries.size();
+ const size_t release_count = release_binaries.size();
+ if (debug_count == release_count)
+ {
+ return lint_status::SUCCESS;
+ }
+
+ System::println(System::color::warning, "Mismatching number of debug and release binaries. Found %d for debug but %d for release.", debug_count, release_count);
+ System::println("Debug binaries");
+ Files::print_paths(debug_binaries);
+
+ System::println("Release binaries");
+ Files::print_paths(release_binaries);
+
+ if (debug_count == 0)
+ {
+ System::println(System::color::warning, "Debug binaries were not found");
+ }
+ if (release_count == 0)
+ {
+ System::println(System::color::warning, "Release binaries were not found");
+ }
+
+ System::println("");
+
+ return lint_status::ERROR_DETECTED;
+ }
+
+ 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)
+ {
+ auto it = policies.find(BuildPolicies::DLLS_WITHOUT_LIBS);
+ if (it != policies.cend() && it->second == opt_bool_t::DISABLED)
+ {
+ return lint_status::SUCCESS;
+ }
+
+ if (lib_count == 0 && dll_count != 0)
+ {
+ 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;
+ }
+
+ 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())
+ {
+ 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);
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_bin_folders_are_not_present_in_static_build(const fs::path& package_dir)
+ {
+ const fs::path bin = package_dir / "bin";
+ const fs::path debug_bin = package_dir / "debug" / "bin";
+
+ if (!fs::exists(bin) && !fs::exists(debug_bin))
+ {
+ return lint_status::SUCCESS;
+ }
+
+ if (fs::exists(bin))
+ {
+ System::println(System::color::warning, R"(There should be no bin\ directory in a static build, but %s is present.)", bin.generic_string());
+ }
+
+ if (fs::exists(debug_bin))
+ {
+ System::println(System::color::warning, R"(There should be no debug\bin\ directory in a static build, but %s is present.)", debug_bin.generic_string());
+ }
+
+ System::println(System::color::warning, R"(If the creation of bin\ and/or debug\bin\ cannot be disabled, use this in the portfile to remove them)" "\n"
+ "\n"
+ R"###( if(VCPKG_LIBRARY_LINKAGE STREQUAL static))###""\n"
+ R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin))###""\n"
+ R"###( endif())###"
+ "\n"
+ );
+
+ return lint_status::ERROR_DETECTED;
+ }
+
+ static lint_status check_no_empty_folders(const fs::path& dir)
+ {
+ const std::vector<fs::path> empty_directories = Files::recursive_find_matching_paths_in_dir(dir, [](const fs::path& current)
+ {
+ return fs::is_directory(current) && fs::is_empty(current);
+ });
+
+ if (!empty_directories.empty())
+ {
+ System::println(System::color::warning, "There should be no empty directories in %s", dir.generic_string());
+ 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"
+ "\n"
+ R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/a/dir ${CURRENT_PACKAGES_DIR}/some/other/dir))###""\n"
+ "\n");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ struct BuildType_and_file
+ {
+ fs::path file;
+ BuildType build_type;
+ };
+
+ static lint_status check_crt_linkage_of_libs(const BuildType& expected_build_type, const std::vector<fs::path>& libs, const fs::path dumpbin_exe)
+ {
+ std::vector<BuildType> bad_build_types = BuildType::values();
+ 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());
+ 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)
+ {
+ 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});
+ break;
+ }
+ }
+ }
+
+ if (!libs_with_invalid_crt.empty())
+ {
+ System::println(System::color::warning, "Expected %s crt linkage, but the following libs had invalid crt linkage:", expected_build_type.toString());
+ System::println("");
+ for (const BuildType_and_file btf : libs_with_invalid_crt)
+ {
+ System::println(" %s: %s", btf.file.generic_string(), btf.build_type.toString());
+ }
+ System::println("");
+
+ System::println(System::color::warning, "To inspect the lib files, use:\n dumpbin.exe /directives mylibfile.lib");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ struct OutdatedDynamicCrt_and_file
+ {
+ fs::path file;
+ OutdatedDynamicCrt outdated_crt;
+ };
+
+ 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 = 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());
+ 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.regex))
+ {
+ dlls_with_outdated_crt.push_back({dll, outdated_crt});
+ break;
+ }
+ }
+ }
+
+ if (!dlls_with_outdated_crt.empty())
+ {
+ System::println(System::color::warning, "Detected outdated dynamic CRT in the following files:");
+ System::println("");
+ for (const OutdatedDynamicCrt_and_file btf : dlls_with_outdated_crt)
+ {
+ System::println(" %s: %s", btf.file.generic_string(), btf.outdated_crt.name);
+ }
+ System::println("");
+
+ System::println(System::color::warning, "To inspect the dll files, use:\n dumpbin.exe /dependents mydllfile.dll");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static lint_status check_no_files_in_package_dir_and_debug_dir(const fs::path& package_dir)
+ {
+ std::vector<fs::path> misplaced_files;
+
+ Files::non_recursive_find_matching_paths_in_dir(package_dir, [](const fs::path& current)
+ {
+ const std::string filename = current.filename().generic_string();
+ return !fs::is_directory(current) && !((_stricmp(filename.c_str(), "CONTROL") == 0 || _stricmp(filename.c_str(), "BUILD_INFO") == 0));
+ }, &misplaced_files);
+
+ const fs::path debug_dir = package_dir / "debug";
+ Files::non_recursive_find_all_files_in_dir(debug_dir, &misplaced_files);
+
+ if (!misplaced_files.empty())
+ {
+ System::println(System::color::warning, "The following files are placed in\n%s and\n%s: ", package_dir.generic_string(), debug_dir.generic_string());
+ Files::print_paths(misplaced_files);
+ System::println(System::color::warning, "Files cannot be present in those directories.\n");
+ return lint_status::ERROR_DETECTED;
+ }
+
+ return lint_status::SUCCESS;
+ }
+
+ static void operator +=(size_t& left, const lint_status& right)
+ {
+ left += static_cast<size_t>(right);
+ }
+
+ 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;
+
+ auto it = build_info.policies.find(BuildPolicies::EMPTY_PACKAGE);
+ if (it != build_info.policies.cend() && it->second == opt_bool_t::ENABLED)
+ {
+ 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);
+ error_count += check_folder_lib_cmake(package_dir);
+ error_count += check_for_misplaced_cmake_files(package_dir, spec);
+ error_count += check_folder_debug_lib_cmake(package_dir);
+ error_count += check_for_dlls_in_lib_dirs(package_dir);
+ error_count += check_for_copyright_file(spec, paths);
+ error_count += check_for_exes(package_dir);
+
+ const fs::path debug_lib_dir = package_dir / "debug" / "lib";
+ const fs::path release_lib_dir = package_dir / "lib";
+ const fs::path debug_bin_dir = package_dir / "debug" / "bin";
+ const fs::path release_bin_dir = package_dir / "bin";
+
+ const std::vector<fs::path> debug_libs = Files::recursive_find_files_with_extension_in_dir(debug_lib_dir, ".lib");
+ const std::vector<fs::path> release_libs = Files::recursive_find_files_with_extension_in_dir(release_lib_dir, ".lib");
+
+ error_count += check_matching_debug_and_release_binaries(debug_libs, release_libs);
+
+ std::vector<fs::path> libs;
+ libs.insert(libs.cend(), debug_libs.cbegin(), debug_libs.cend());
+ libs.insert(libs.cend(), release_libs.cbegin(), release_libs.cend());
+
+ error_count += check_lib_architecture(spec.target_triplet().architecture(), libs);
+
+ switch (linkage_type_value_of(build_info.library_linkage))
+ {
+ case LinkageType::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(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, 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, dumpbin_exe);
+ break;
+ }
+ case LinkageType::STATIC:
+ {
+ std::vector<fs::path> dlls;
+ Files::recursive_find_files_with_extension_in_dir(package_dir, ".dll", &dlls);
+ error_count += check_no_dlls_present(dlls);
+
+ 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, dumpbin_exe);
+ error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, linkage_type_value_of(build_info.crt_linkage)), release_libs, dumpbin_exe);
+ break;
+ }
+ case LinkageType::UNKNOWN:
+ {
+ error_count += 1;
+ System::println(System::color::warning, "Unknown library_linkage architecture: [ %s ]", build_info.library_linkage);
+ break;
+ }
+ 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;
+ }
+
+ void 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);
+
+ 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");
+ }
+}
diff --git a/toolsrc/src/PostBuildLint_BuildInfo.cpp b/toolsrc/src/PostBuildLint_BuildInfo.cpp
new file mode 100644
index 000000000..63107acd1
--- /dev/null
+++ b/toolsrc/src/PostBuildLint_BuildInfo.cpp
@@ -0,0 +1,42 @@
+#include "pch.h"
+#include "PostBuildLint_BuildInfo.h"
+#include "vcpkg_Checks.h"
+#include "opt_bool.h"
+#include "vcpkglib_helpers.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;
+ build_info.crt_linkage = details::remove_required_field(&pgh, BuildInfoRequiredField::CRT_LINKAGE);
+ build_info.library_linkage = details::remove_required_field(&pgh, BuildInfoRequiredField::LIBRARY_LINKAGE);
+
+ // 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::UNKNOWN, "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..4e5ac3cea
--- /dev/null
+++ b/toolsrc/src/PostBuildLint_BuildPolicies.cpp
@@ -0,0 +1,66 @@
+#include "pch.h"
+#include "PostBuildLint_BuildPolicies.h"
+#include "vcpkg_Checks.h"
+
+namespace vcpkg::PostBuildLint::BuildPolicies
+{
+ static const std::string NAME_UNKNOWN = "PolicyUnknown";
+ static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
+ static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
+
+ 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 UNKNOWN:
+ return NAME_UNKNOWN;
+ default:
+ Checks::unreachable();
+ }
+ }
+
+ 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";
+
+ switch (this->backing_enum)
+ {
+ case EMPTY_PACKAGE:
+ return CMAKE_VARIABLE_EMPTY_PACKAGE;
+ case DLLS_WITHOUT_LIBS:
+ return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS;
+ case UNKNOWN:
+ Checks::exit_with_message("No CMake command corresponds to UNKNOWN");
+ default:
+ Checks::unreachable();
+ }
+ }
+
+ type::type(): backing_enum(backing_enum_t::UNKNOWN) {}
+
+ const std::vector<type>& values()
+ {
+ static const std::vector<type>& v = {UNKNOWN, EMPTY_PACKAGE, DLLS_WITHOUT_LIBS};
+ return v;
+ }
+
+ 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;
+ }
+
+ return BuildPolicies::UNKNOWN;
+ }
+}
diff --git a/toolsrc/src/PostBuildLint_BuildType.cpp b/toolsrc/src/PostBuildLint_BuildType.cpp
new file mode 100644
index 000000000..b4e199aee
--- /dev/null
+++ b/toolsrc/src/PostBuildLint_BuildType.cpp
@@ -0,0 +1,68 @@
+#include "pch.h"
+#include "PostBuildLint_BuildType.h"
+#include "vcpkg_Checks.h"
+
+namespace vcpkg::PostBuildLint
+{
+ 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])");
+
+ 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();
+ }
+
+ 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);
+ }
+}
diff --git a/toolsrc/src/PostBuildLint_ConfigurationType.cpp b/toolsrc/src/PostBuildLint_ConfigurationType.cpp
new file mode 100644
index 000000000..9c3499cac
--- /dev/null
+++ b/toolsrc/src/PostBuildLint_ConfigurationType.cpp
@@ -0,0 +1,19 @@
+#include "pch.h"
+#include "PostBuildLint_ConfigurationType.h"
+#include "vcpkg_Checks.h"
+
+namespace vcpkg::PostBuildLint
+{
+ std::string to_string(const ConfigurationType& conf)
+ {
+ switch (conf)
+ {
+ case ConfigurationType::DEBUG:
+ return "Debug";
+ case ConfigurationType::RELEASE:
+ return "Release";
+ default:
+ Checks::unreachable();
+ }
+ }
+}
diff --git a/toolsrc/src/PostBuildLint_LinkageType.cpp b/toolsrc/src/PostBuildLint_LinkageType.cpp
new file mode 100644
index 000000000..8a3f35be8
--- /dev/null
+++ b/toolsrc/src/PostBuildLint_LinkageType.cpp
@@ -0,0 +1,34 @@
+#include "pch.h"
+#include "PostBuildLint_LinkageType.h"
+#include "vcpkg_Checks.h"
+
+namespace vcpkg::PostBuildLint
+{
+ 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();
+ }
+ }
+}
diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp
index 374121ae9..8bfe8e84d 100644
--- a/toolsrc/src/SourceParagraph.cpp
+++ b/toolsrc/src/SourceParagraph.cpp
@@ -1,20 +1,145 @@
+#include "pch.h"
#include "SourceParagraph.h"
#include "vcpkglib_helpers.h"
+#include "vcpkg_System.h"
+#include "vcpkg_Maps.h"
+#include "triplet.h"
-using namespace vcpkg::details;
+namespace vcpkg
+{
+ //
+ namespace SourceParagraphRequiredField
+ {
+ static const std::string SOURCE = "Source";
+ static const std::string VERSION = "Version";
+ }
-vcpkg::SourceParagraph::SourceParagraph() = default;
+ namespace SourceParagraphOptionalField
+ {
+ static const std::string DESCRIPTION = "Description";
+ static const std::string MAINTAINER = "Maintainer";
+ static const std::string BUILD_DEPENDS = "Build-Depends";
+ }
-vcpkg::SourceParagraph::SourceParagraph(const std::unordered_map<std::string, std::string>& fields):
- name(required_field(fields, "Source")),
- version(required_field(fields, "Version")),
- description(optional_field(fields, "Description")),
- maintainer(optional_field(fields, "Maintainer"))
-{
- std::string deps = optional_field(fields, "Build-Depends");
- if (!deps.empty())
+ static const std::vector<std::string>& get_list_of_valid_fields()
+ {
+ static const std::vector<std::string> valid_fields =
+ {
+ SourceParagraphRequiredField::SOURCE,
+ SourceParagraphRequiredField::VERSION,
+
+ SourceParagraphOptionalField::DESCRIPTION,
+ SourceParagraphOptionalField::MAINTAINER,
+ SourceParagraphOptionalField::BUILD_DEPENDS
+ };
+
+ return valid_fields;
+ }
+
+ SourceParagraph::SourceParagraph() = default;
+
+ SourceParagraph::SourceParagraph(std::unordered_map<std::string, std::string> fields)
+ {
+ this->name = details::remove_required_field(&fields, SourceParagraphRequiredField::SOURCE);
+ this->version = details::remove_required_field(&fields, SourceParagraphRequiredField::VERSION);
+ this->description = details::remove_optional_field(&fields, SourceParagraphOptionalField::DESCRIPTION);
+ this->maintainer = details::remove_optional_field(&fields, SourceParagraphOptionalField::MAINTAINER);
+
+ std::string deps = details::remove_optional_field(&fields, SourceParagraphOptionalField::BUILD_DEPENDS);
+ this->depends = expand_qualified_dependencies(parse_depends(deps));
+
+ if (!fields.empty())
+ {
+ 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::Joiner::on("\n ").join(remaining_fields);
+ const std::string valid_fields_as_string = Strings::Joiner::on("\n ").join(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);
+ System::println("This is the list of valid fields (case-sensitive): \n\n %s\n", valid_fields_as_string);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ std::vector<dependency> vcpkg::expand_qualified_dependencies(const std::vector<std::string>& depends)
+ {
+ auto convert = [&](const std::string& depend_string) -> dependency {
+ auto pos = depend_string.find(' ');
+ if (pos == std::string::npos)
+ return{ depend_string, "" };
+ // expect of the form "\w+ \[\w+\]"
+ dependency dep;
+ dep.name = depend_string.substr(0, pos);
+ if (depend_string.c_str()[pos + 1] != '[' || depend_string[depend_string.size() - 1] != ']')
+ {
+ // Error, but for now just slurp the entire string.
+ return{ depend_string, "" };
+ }
+ dep.qualifier = depend_string.substr(pos + 2, depend_string.size() - pos - 3);
+ return dep;
+ };
+
+ std::vector<vcpkg::dependency> ret;
+
+ for (auto&& depend_string : depends)
+ {
+ ret.push_back(convert(depend_string));
+ }
+
+ return ret;
+ }
+
+ std::vector<std::string> parse_depends(const std::string& depends_string)
+ {
+ if (depends_string.empty())
+ {
+ return{};
+ }
+
+ std::vector<std::string> out;
+
+ size_t cur = 0;
+ do
+ {
+ auto pos = depends_string.find(',', cur);
+ if (pos == std::string::npos)
+ {
+ out.push_back(depends_string.substr(cur));
+ break;
+ }
+ out.push_back(depends_string.substr(cur, pos - cur));
+
+ // skip comma and space
+ ++pos;
+ if (depends_string[pos] == ' ')
+ {
+ ++pos;
+ }
+
+ cur = pos;
+ } while (cur != std::string::npos);
+
+ return out;
+ }
+
+ std::vector<std::string> filter_dependencies(const std::vector<vcpkg::dependency>& deps, const triplet& t)
+ {
+ std::vector<std::string> ret;
+ for (auto&& dep : deps)
+ {
+ if (dep.qualifier.empty() || t.canonical_name().find(dep.qualifier) != std::string::npos)
+ {
+ ret.push_back(dep.name);
+ }
+ }
+ return ret;
+ }
+
+ std::ostream & operator<<(std::ostream & os, const dependency & p)
{
- this->depends.clear();
- this->depends = parse_depends(deps);
- };
+ os << p.name;
+ return os;
+ }
}
diff --git a/toolsrc/src/StatusParagraph.cpp b/toolsrc/src/StatusParagraph.cpp
index 5aa425969..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"
@@ -5,6 +6,12 @@ using namespace vcpkg::details;
namespace vcpkg
{
+ //
+ namespace BinaryParagraphRequiredField
+ {
+ static const std::string STATUS = "Status";
+ }
+
StatusParagraph::StatusParagraph() : want(want_t::error), state(install_state_t::error)
{
}
@@ -19,7 +26,7 @@ namespace vcpkg
StatusParagraph::StatusParagraph(const std::unordered_map<std::string, std::string>& fields)
: package(fields)
{
- std::string status_field = required_field(fields, "Status");
+ std::string status_field = required_field(fields, BinaryParagraphRequiredField::STATUS);
auto b = status_field.begin();
auto mark = b;
diff --git a/toolsrc/src/StatusParagraphs.cpp b/toolsrc/src/StatusParagraphs.cpp
index 3e23c519a..c2398d2b8 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
diff --git a/toolsrc/src/Stopwatch.cpp b/toolsrc/src/Stopwatch.cpp
index 550f1ebd8..ec7af60b6 100644
--- a/toolsrc/src/Stopwatch.cpp
+++ b/toolsrc/src/Stopwatch.cpp
@@ -1,3 +1,4 @@
+#include "pch.h"
#include "Stopwatch.h"
#include "vcpkg_Checks.h"
@@ -88,7 +89,7 @@ namespace vcpkg
return Strings::format("%.4g ns", nanos_as_double);
}
- Stopwatch::Stopwatch() : m_isRunning(false), m_elapsedNanos(), m_startTick()
+ Stopwatch::Stopwatch() : m_isRunning(false), m_elapsedNanos(0), m_startTick()
{
}
diff --git a/toolsrc/src/coff_file_reader.cpp b/toolsrc/src/coff_file_reader.cpp
index 593bb18d1..f48f912c1 100644
--- a/toolsrc/src/coff_file_reader.cpp
+++ b/toolsrc/src/coff_file_reader.cpp
@@ -1,14 +1,10 @@
+#include "pch.h"
#include "coff_file_reader.h"
-#include <iostream>
-#include <cstdint>
-#include <algorithm>
#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)
@@ -34,9 +30,9 @@ namespace vcpkg {namespace COFFFileReader
return data;
}
- static void verify_equal_strings(const char* expected, const char* actual, int size)
+ static void verify_equal_strings(const char* expected, const char* actual, int size, const char* label)
{
- Checks::check_exit(memcmp(expected, actual, size) == 0, "Incorrect string found. Expected: %s but found %s", expected, actual);
+ Checks::check_exit(memcmp(expected, actual, size) == 0, "Incorrect string (%s) found. Expected: (%s) but found (%s)", label, expected, actual);
}
static void read_and_verify_PE_signature(fstream& fs)
@@ -52,17 +48,17 @@ namespace vcpkg {namespace COFFFileReader
fs.seekg(offset_to_PE_signature);
char signature[PE_SIGNATURE_SIZE];
fs.read(signature, PE_SIGNATURE_SIZE);
- verify_equal_strings(PE_SIGNATURE, signature, PE_SIGNATURE_SIZE);
+ verify_equal_strings(PE_SIGNATURE, signature, PE_SIGNATURE_SIZE, "PE_SIGNATURE");
fs.seekg(offset_to_PE_signature + PE_SIGNATURE_SIZE, ios_base::beg);
}
- static fpos_t align_to(const fpos_t unaligned_offset, const int alignment_size)
+ static fpos_t align_to_size(const uint64_t unaligned, const uint64_t alignment_size)
{
- fpos_t aligned_offset = unaligned_offset - 1;
- aligned_offset /= alignment_size;
- aligned_offset += 1;
- aligned_offset *= alignment_size;
- return aligned_offset;
+ fpos_t aligned = unaligned - 1;
+ aligned /= alignment_size;
+ aligned += 1;
+ aligned *= alignment_size;
+ return aligned;
}
struct coff_file_header
@@ -77,14 +73,6 @@ namespace vcpkg {namespace COFFFileReader
return ret;
}
- static coff_file_header peek(fstream& fs)
- {
- auto original_pos = fs.tellg().seekpos();
- coff_file_header ret = read(fs);
- fs.seekg(original_pos);
- return ret;
- }
-
MachineType machineType() const
{
static const size_t MACHINE_TYPE_OFFSET = 0;
@@ -113,8 +101,11 @@ namespace vcpkg {namespace COFFFileReader
ret.data.resize(HEADER_SIZE);
fs.read(&ret.data[0], HEADER_SIZE);
- const std::string header_end = ret.data.substr(HEADER_END_OFFSET, HEADER_END_SIZE);
- verify_equal_strings(HEADER_END, header_end.c_str(), HEADER_END_SIZE);
+ if (ret.data[0] != '\0') // Due to freeglut. github issue #223
+ {
+ const std::string header_end = ret.data.substr(HEADER_END_OFFSET, HEADER_END_SIZE);
+ verify_equal_strings(HEADER_END, header_end.c_str(), HEADER_END_SIZE, "LIB HEADER_END");
+ }
return ret;
}
@@ -128,17 +119,53 @@ namespace vcpkg {namespace COFFFileReader
uint64_t member_size() const
{
+ static const size_t ALIGNMENT_SIZE = 2;
+
static const size_t HEADER_SIZE_OFFSET = 48;
static const size_t HEADER_SIZE_FIELD_SIZE = 10;
const std::string as_string = data.substr(HEADER_SIZE_OFFSET, HEADER_SIZE_FIELD_SIZE);
// This is in ASCII decimal representation
const uint64_t value = std::strtoull(as_string.c_str(), nullptr, 10);
- return value;
+
+ const uint64_t aligned = align_to_size(value, ALIGNMENT_SIZE);
+ return aligned;
}
std::string data;
};
+ struct offsets_array
+ {
+ static offsets_array read(fstream& fs, const uint32_t offset_count)
+ {
+ static const size_t OFFSET_WIDTH = 4;
+
+ std::string raw_offsets;
+ const size_t raw_offset_size = offset_count * OFFSET_WIDTH;
+ raw_offsets.resize(raw_offset_size);
+ fs.read(&raw_offsets[0], raw_offset_size);
+
+ offsets_array ret;
+ for (uint32_t i = 0; i < offset_count; ++i)
+ {
+ const std::string value_as_string = raw_offsets.substr(OFFSET_WIDTH * i, OFFSET_WIDTH * (i + 1));
+ const uint32_t value = reinterpret_bytes<uint32_t>(value_as_string.c_str());
+
+ // Ignore offsets that point to offset 0. See vcpkg github #223 #288 #292
+ if (value != 0)
+ {
+ ret.data.push_back(value);
+ }
+ }
+
+ // Sort the offsets, because it is possible for them to be unsorted. See vcpkg github #292
+ std::sort(ret.data.begin(), ret.data.end());
+ return ret;
+ }
+
+ std::vector<uint32_t> data;
+ };
+
struct import_header
{
static const size_t HEADER_SIZE = 20;
@@ -168,14 +195,6 @@ namespace vcpkg {namespace COFFFileReader
return ret;
}
- static import_header peek(fstream& fs)
- {
- auto original_pos = fs.tellg().seekpos();
- import_header ret = read(fs);
- fs.seekg(original_pos);
- return ret;
- }
-
MachineType machineType() const
{
static const size_t MACHINE_TYPE_OFFSET = 6;
@@ -190,14 +209,6 @@ namespace vcpkg {namespace COFFFileReader
std::string data;
};
- static void skip_archive_member(fstream& fs, uint64_t member_size)
- {
- static const size_t ALIGNMENT_SIZE = 2;
-
- const fpos_t new_offset = align_to(member_size, ALIGNMENT_SIZE);
- fs.seekg(new_offset, ios_base::cur);
- }
-
static void read_and_verify_archive_file_signature(fstream& fs)
{
static const char* FILE_START = "!<arch>\n";
@@ -207,10 +218,10 @@ namespace vcpkg {namespace COFFFileReader
char file_start[FILE_START_SIZE];
fs.read(file_start, FILE_START_SIZE);
- verify_equal_strings(FILE_START, file_start, FILE_START_SIZE);
+ verify_equal_strings(FILE_START, file_start, FILE_START_SIZE, "LIB FILE_START");
}
- dll_info read_dll(const fs::path path)
+ dll_info read_dll(const fs::path& path)
{
std::fstream fs(path, std::ios::in | std::ios::binary | std::ios::ate);
Checks::check_exit(fs.is_open(), "Could not open file %s for reading", path.generic_string());
@@ -221,43 +232,76 @@ namespace vcpkg {namespace COFFFileReader
return {machine};
}
- lib_info read_lib(const fs::path path)
+ struct marker_t
+ {
+ void set_to_offset(const fpos_t position)
+ {
+ this->m_absolute_position = position;
+ }
+
+ void set_to_current_pos(fstream& fs)
+ {
+ this->m_absolute_position = fs.tellg().seekpos();
+ }
+
+ void seek_to_marker(fstream& fs) const
+ {
+ fs.seekg(this->m_absolute_position, ios_base::beg);
+ }
+
+ void advance_by(const uint64_t offset)
+ {
+ this->m_absolute_position += offset;
+ }
+
+ private:
+ fpos_t m_absolute_position = 0;
+ };
+
+ lib_info read_lib(const fs::path& path)
{
std::fstream fs(path, std::ios::in | std::ios::binary | std::ios::ate);
Checks::check_exit(fs.is_open(), "Could not open file %s for reading", path.generic_string());
read_and_verify_archive_file_signature(fs);
+ marker_t marker;
+ marker.set_to_current_pos(fs);
+
// First Linker Member
const archive_member_header first_linker_member_header = archive_member_header::read(fs);
Checks::check_exit(first_linker_member_header.name().substr(0, 2) == "/ ", "Could not find proper first linker member");
- skip_archive_member(fs, first_linker_member_header.member_size());
+ marker.advance_by(archive_member_header::HEADER_SIZE + first_linker_member_header.member_size());
+ marker.seek_to_marker(fs);
const archive_member_header second_linker_member_header = archive_member_header::read(fs);
Checks::check_exit(second_linker_member_header.name().substr(0, 2) == "/ ", "Could not find proper second linker member");
// The first 4 bytes contains the number of archive members
- const uint32_t archive_member_count = peek_value_from_stream<uint32_t>(fs);
- skip_archive_member(fs, second_linker_member_header.member_size());
+ const uint32_t archive_member_count = read_value_from_stream<uint32_t>(fs);
+ const offsets_array offsets = offsets_array::read(fs, archive_member_count);
+ marker.advance_by(archive_member_header::HEADER_SIZE + second_linker_member_header.member_size());
+ marker.seek_to_marker(fs);
bool hasLongnameMemberHeader = peek_value_from_stream<uint16_t>(fs) == 0x2F2F;
if (hasLongnameMemberHeader)
{
const archive_member_header longnames_member_header = archive_member_header::read(fs);
- skip_archive_member(fs, longnames_member_header.member_size());
+ marker.advance_by(archive_member_header::HEADER_SIZE + longnames_member_header.member_size());
+ marker.seek_to_marker(fs);
}
std::set<MachineType> machine_types;
// Next we have the obj and pseudo-object files
- for (uint32_t i = 0; i < archive_member_count; i++)
+ for (const uint32_t offset : offsets.data)
{
- const archive_member_header header = archive_member_header::read(fs);
+ marker.set_to_offset(offset + archive_member_header::HEADER_SIZE); // Skip the header, no need to read it.
+ marker.seek_to_marker(fs);
const uint16_t first_two_bytes = peek_value_from_stream<uint16_t>(fs);
const bool isImportHeader = getMachineType(first_two_bytes) == MachineType::UNKNOWN;
- const MachineType machine = isImportHeader ? import_header::peek(fs).machineType() : coff_file_header::peek(fs).machineType();
+ const MachineType machine = isImportHeader ? import_header::read(fs).machineType() : coff_file_header::read(fs).machineType();
machine_types.insert(machine);
- skip_archive_member(fs, header.member_size());
}
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..56056218b
--- /dev/null
+++ b/toolsrc/src/commands_available_commands.cpp
@@ -0,0 +1,45 @@
+#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},
+ {"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..c5a278450
--- /dev/null
+++ b/toolsrc/src/commands_build.cpp
@@ -0,0 +1,131 @@
+#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_Environment.h"
+#include "metrics.h"
+#include "vcpkg_info.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;
+ }
+
+ void build_package(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 Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths);
+ const std::wstring command = Strings::wformat(LR"("%s" %s >nul 2>&1 && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s -DVCPKG_PLATFORM_TOOLSET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")",
+ vcvarsall_bat.path.native(),
+ Strings::utf8_to_utf16(target_triplet.architecture()),
+ Strings::utf8_to_utf16(source_paragraph.name),
+ Strings::utf8_to_utf16(target_triplet.canonical_name()),
+ vcvarsall_bat.platform_toolset,
+ 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-" + spec.toString(), timer.microseconds());
+
+ if (return_code != 0)
+ {
+ System::println(System::color::error, "Error: building package %s failed", spec.toString());
+ 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."
+ , spec.toString(), Info::version());
+ TrackProperty("error", "build failed");
+ TrackProperty("build_error", spec.toString());
+ 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);
+ }
+
+ 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");
+
+ // 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.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", p.spec.toString());
+ }
+ System::println("");
+ exit(EXIT_FAILURE);
+ }
+
+ Environment::ensure_utilities_on_path(paths);
+ build_package(spgh, spec, paths, paths.port_dir(spec));
+ exit(EXIT_SUCCESS);
+ }
+}
diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp
new file mode 100644
index 000000000..5c3fa9857
--- /dev/null
+++ b/toolsrc/src/commands_build_external.cpp
@@ -0,0 +1,33 @@
+#include "pch.h"
+#include "vcpkg_Commands.h"
+#include "vcpkg_System.h"
+#include "vcpkg_Environment.h"
+#include "vcpkg_Input.h"
+#include "vcpkglib.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);
+
+ 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())
+ {
+ Commands::Build::build_package(*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]);
+ Commands::Help::print_example(Strings::format("%s zlib:x64-windows", args.command));
+ exit(EXIT_FAILURE);
+ }
+}
diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp
index 0d70f0f29..fa49a647f 100644
--- a/toolsrc/src/commands_cache.cpp
+++ b/toolsrc/src/commands_cache.cpp
@@ -1,36 +1,73 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkg_Files.h"
-#include "vcpkg.h"
+#include "Paragraphs.h"
+#include "BinaryParagraph.h"
-namespace vcpkg
+namespace vcpkg::Commands::Cache
{
- void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
+ static std::vector<BinaryParagraph> read_all_binary_paragraphs(const vcpkg_paths& paths)
{
- args.check_exact_arg_count(0);
+ std::vector<BinaryParagraph> output;
+ for (auto it = fs::directory_iterator(paths.packages); it != fs::directory_iterator(); ++it)
+ {
+ const fs::path& path = it->path();
+
+ try
+ {
+ auto file_contents = Files::read_contents(path / "CONTROL");
+ if (auto text = file_contents.get())
+ {
+ auto pghs = Paragraphs::parse_paragraphs(*text);
+ if (pghs.size() != 1)
+ continue;
+
+ const BinaryParagraph binary_paragraph = BinaryParagraph(pghs[0]);
+ output.push_back(binary_paragraph);
+ }
+ }
+ catch (std::runtime_error const&)
+ {
+ }
+ }
- auto begin_it = fs::directory_iterator(paths.packages);
- auto end_it = fs::directory_iterator();
+ return output;
+ }
+
+ 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", Commands::Help::create_example_string("cache png"));
+ args.check_max_arg_count(1, example);
- if (begin_it == end_it)
+ const std::vector<BinaryParagraph> binary_paragraphs = read_all_binary_paragraphs(paths);
+ if (binary_paragraphs.empty())
{
System::println("No packages are cached.");
exit(EXIT_SUCCESS);
}
- for (; begin_it != end_it; ++begin_it)
+ if (args.command_arguments.size() == 0)
{
- const auto& path = begin_it->path();
-
- auto file_contents = Files::get_contents(path / "CONTROL");
- if (auto text = file_contents.get())
+ for (const BinaryParagraph& binary_paragraph : binary_paragraphs)
+ {
+ const std::string displayname = binary_paragraph.displayname();
+ System::println(displayname);
+ }
+ }
+ else
+ {
+ // At this point there is 1 argument
+ for (const BinaryParagraph& binary_paragraph : binary_paragraphs)
{
- auto pghs = parse_paragraphs(*text);
- if (pghs.size() != 1)
+ const std::string displayname = binary_paragraph.displayname();
+ if (Strings::case_insensitive_ascii_find(displayname, args.command_arguments[0]) == displayname.end())
+ {
continue;
+ }
- auto src = BinaryParagraph(pghs[0]);
- System::println(src.displayname().c_str());
+ System::println(displayname);
}
}
diff --git a/toolsrc/src/commands_contact.cpp b/toolsrc/src/commands_contact.cpp
new file mode 100644
index 000000000..2be468fb8
--- /dev/null
+++ b/toolsrc/src/commands_contact.cpp
@@ -0,0 +1,14 @@
+#include "pch.h"
+#include "vcpkg_Commands.h"
+#include "vcpkg_System.h"
+#include "vcpkg_info.h"
+
+namespace vcpkg::Commands::Contact
+{
+ void perform_and_exit(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);
+ }
+}
diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp
index d1611eb5c..5042ab97b 100644
--- a/toolsrc/src/commands_create.cpp
+++ b/toolsrc/src/commands_create.cpp
@@ -1,16 +1,17 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkg_Environment.h"
#include "vcpkg_Files.h"
#include "vcpkg_Input.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")###");
- args.check_max_arg_count(3, example.c_str());
- args.check_min_arg_count(2, example.c_str());
+ static const std::string example = Commands::Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###");
+ args.check_max_arg_count(3, example);
+ args.check_min_arg_count(2, example);
const std::string port_name = args.command_arguments.at(0);
Environment::ensure_utilities_on_path(paths);
diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp
index f07a15875..dff30f7ad 100644
--- a/toolsrc/src/commands_edit.cpp
+++ b/toolsrc/src/commands_edit.cpp
@@ -1,16 +1,18 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkg_Input.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");
- args.check_exact_arg_count(1, example.c_str());
+ static const std::string example = Commands::Help::create_example_string("edit zlib");
+ args.check_exact_arg_count(1, example);
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 editor
std::wstring env_EDITOR = System::wdupenv_str(L"EDITOR");
@@ -27,7 +29,7 @@ namespace vcpkg
}
}
- std::wstring cmdLine = Strings::wformat(LR"("%s" "%s" "%s")", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native());
+ 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
new file mode 100644
index 000000000..4c0028f53
--- /dev/null
+++ b/toolsrc/src/commands_hash.cpp
@@ -0,0 +1,45 @@
+#include "pch.h"
+#include "vcpkg_Commands.h"
+#include "vcpkg_System.h"
+
+namespace vcpkg::Commands::Hash
+{
+ static void do_file_hash(fs::path const& path, std::wstring const& hashType)
+ {
+ auto cmd_line = Strings::wformat(LR"(CertUtil.exe -hashfile "%s" %s)",
+ path.c_str(), hashType.c_str());
+ auto 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));
+
+ std::string const& output = ec_data.output;
+
+ auto start = output.find_first_of("\r\n");
+ Checks::check_exit(start != std::string::npos, "Unexpected output format from command: %s", Strings::utf16_to_utf8(cmd_line));
+
+ auto end = output.find_first_of("\r\n", start + 1);
+ Checks::check_exit(end != std::string::npos, "Unexpected output format from command: %s", Strings::utf16_to_utf8(cmd_line));
+
+ auto hash = output.substr(start, end - start);
+ hash.erase(std::remove_if(hash.begin(), hash.end(), isspace), hash.end());
+ System::println(hash);
+ }
+
+ 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", 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);
+
+ if (args.command_arguments.size() == 1)
+ {
+ do_file_hash(args.command_arguments[0], L"SHA512");
+ }
+ if (args.command_arguments.size() == 2)
+ {
+ do_file_hash(args.command_arguments[0], Strings::utf8_to_utf16(args.command_arguments[1]));
+ }
+
+ exit(EXIT_SUCCESS);
+ }
+}
diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp
index 194e809b1..6068c22fb 100644
--- a/toolsrc/src/commands_help.cpp
+++ b/toolsrc/src/commands_help.cpp
@@ -1,20 +1,70 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
-#include "vcpkg.h"
#include "vcpkg_System.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.", vcpkg::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 help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
+ 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 perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{
args.check_max_arg_count(1);
if (args.command_arguments.empty())
@@ -35,21 +85,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 vcpkg@microsoft.com with any feedback.");
- 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 9cfc53d6c..7af2c7185 100644
--- a/toolsrc/src/commands_import.cpp
+++ b/toolsrc/src/commands_import.cpp
@@ -1,25 +1,97 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
-#include "vcpkg.h"
+#include "Paragraphs.h"
+#include "StatusParagraph.h"
+#include "vcpkg_Files.h"
-namespace vcpkg
+namespace vcpkg::Commands::Import
{
- void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
+ struct Binaries
{
- static const std::string example = create_example_string(R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)");
- args.check_exact_arg_count(3, example.c_str());
+ std::vector<fs::path> dlls;
+ std::vector<fs::path> libs;
+ };
+
+ static Binaries detect_files_in_directory_ending_with(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);
+ }
+ }
+
+ return binaries;
+ }
+
+ static void copy_files_into_directory(const std::vector<fs::path>& files, const fs::path& destination_folder)
+ {
+ fs::create_directory(destination_folder);
+
+ for (auto const& src_path : files)
+ {
+ fs::path dest_path = destination_folder / src_path.filename();
+ fs::copy(src_path, dest_path, fs::copy_options::overwrite_existing);
+ }
+ }
+
+ static void place_library_files_in(const fs::path& include_directory, const fs::path& project_directory, const fs::path& destination_path)
+ {
+ 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");
+
+ fs::path destination_include_directory = destination_path / "include";
+ fs::copy(include_directory, destination_include_directory, fs::copy_options::recursive | fs::copy_options::overwrite_existing);
+
+ copy_files_into_directory(release_binaries.dlls, destination_path / "bin");
+ copy_files_into_directory(release_binaries.libs, destination_path / "lib");
+
+ fs::create_directory(destination_path / "debug");
+ copy_files_into_directory(debug_binaries.dlls, destination_path / "debug" / "bin");
+ copy_files_into_directory(debug_binaries.libs, destination_path / "debug" / "lib");
+ }
+
+ static void do_import(const vcpkg_paths& paths, const fs::path& include_directory, const fs::path& project_directory, const BinaryParagraph& control_file_data)
+ {
+ fs::path library_destination_path = paths.package_dir(control_file_data.spec);
+ fs::create_directory(library_destination_path);
+ place_library_files_in(include_directory, project_directory, library_destination_path);
+
+ fs::path control_file_path = library_destination_path / "CONTROL";
+ std::ofstream(control_file_path) << control_file_data;
+ }
+
+ void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
+ {
+ 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);
const fs::path control_file_path(args.command_arguments[0]);
const fs::path include_directory(args.command_arguments[1]);
const fs::path project_directory(args.command_arguments[2]);
- auto pghs = get_paragraphs(control_file_path);
+ auto pghs = Paragraphs::get_paragraphs(control_file_path);
Checks::check_throw(pghs.size() == 1, "Invalid control file for package");
StatusParagraph spgh;
spgh.package = BinaryParagraph(pghs[0]);
auto& control_file_data = spgh.package;
- vcpkg::binary_import(paths, include_directory, project_directory, control_file_data);
+ do_import(paths, include_directory, project_directory, control_file_data);
exit(EXIT_SUCCESS);
}
}
diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp
new file mode 100644
index 000000000..1f5a2234d
--- /dev/null
+++ b/toolsrc/src/commands_install.cpp
@@ -0,0 +1,239 @@
+#include "pch.h"
+#include "vcpkg_Commands.h"
+#include "vcpkglib.h"
+#include "vcpkg_Environment.h"
+#include "metrics.h"
+#include "vcpkg_Files.h"
+#include "vcpkg_System.h"
+#include "vcpkg_Dependencies.h"
+#include "vcpkg_Input.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());
+ }
+
+ 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::Joiner::on("\n ").join(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);
+ 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 = 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);
+ Environment::ensure_utilities_on_path(paths);
+
+ 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)
+ {
+ Commands::Build::build_package(*action.plan.source_pgh, 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.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 7e7da9e3f..000000000
--- a/toolsrc/src/commands_installation.cpp
+++ /dev/null
@@ -1,176 +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"
-
-namespace vcpkg
-{
- static void create_binary_control_file(const vcpkg_paths& paths, const fs::path& port_dir, const triplet& target_triplet)
- {
- auto pghs = get_paragraphs(port_dir / "CONTROL");
- Checks::check_exit(pghs.size() == 1, "Error: invalid control file");
- auto bpgh = BinaryParagraph(SourceParagraph(pghs[0]), target_triplet);
- const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL";
- std::ofstream(binary_control_file) << bpgh;
- }
-
- static void build_internal(const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir)
- {
- const fs::path ports_cmake_script_path = paths.ports_cmake;
- auto&& target_triplet = spec.target_triplet();
- const std::wstring command = Strings::wformat(LR"("%%VS140COMNTOOLS%%..\..\VC\vcvarsall.bat" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")",
- Strings::utf8_to_utf16(target_triplet.architecture()),
- Strings::utf8_to_utf16(spec.name()),
- Strings::utf8_to_utf16(target_triplet.canonical_name()),
- port_dir.generic_wstring(),
- ports_cmake_script_path.generic_wstring());
-
- System::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), version());
- TrackProperty("error", "build failed");
- TrackProperty("build_error", to_string(spec));
- exit(EXIT_FAILURE);
- }
-
- perform_all_checks(spec, paths);
-
- create_binary_control_file(paths, port_dir, target_triplet);
-
- // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name;
- // delete_directory(port_buildtrees_dir);
- }
-
- static void build_internal(const package_spec& spec, const vcpkg_paths& paths)
- {
- return build_internal(spec, paths, paths.ports / spec.name());
- }
-
- void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
- {
- static const std::string example = create_example_string("install zlib zlib:x64-windows curl boost");
- args.check_min_arg_count(1, example.c_str());
- StatusParagraphs status_db = database_load_check(paths);
-
- std::vector<package_spec> specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example.c_str());
- Input::check_triplets(specs, paths);
- std::vector<package_spec> install_plan = Dependencies::create_dependency_ordered_install_plan(paths, specs, status_db);
- Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty");
- std::string specs_string = to_string(install_plan[0]);
- for (size_t i = 1; i < install_plan.size(); ++i)
- {
- specs_string.push_back(',');
- specs_string.append(to_string(install_plan[i]));
- }
- TrackProperty("installplan", specs_string);
- Environment::ensure_utilities_on_path(paths);
-
- for (const package_spec& spec : install_plan)
- {
- if (status_db.find_installed(spec.name(), spec.target_triplet()) != status_db.end())
- {
- System::println(System::color::success, "Package %s is already installed", spec);
- continue;
- }
-
- fs::path package_path = paths.package_dir(spec);
-
- expected<std::string> file_contents = Files::get_contents(package_path / "CONTROL");
-
- try
- {
- if (file_contents.error_code())
- {
- build_internal(spec, paths);
- file_contents = Files::get_contents(package_path / "CONTROL");
- if (file_contents.error_code())
- {
- file_contents.get_or_throw();
- }
- }
-
- auto pghs = parse_paragraphs(file_contents.get_or_throw());
- Checks::check_throw(pghs.size() == 1, "multiple paragraphs in control file");
- install_package(paths, BinaryParagraph(pghs[0]), status_db);
- System::println(System::color::success, "Package %s is installed", spec);
- }
- catch (const std::exception& e)
- {
- System::println(System::color::error, "Error: Could not install package %s: %s", 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.c_str());
- 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.c_str());
- Input::check_triplet(spec.target_triplet(), paths);
- std::unordered_set<package_spec> unmet_dependencies = Dependencies::find_unmet_dependencies(paths, spec, status_db);
- if (!unmet_dependencies.empty())
- {
- System::println(System::color::error, "The build command requires all dependencies to be already installed.");
- System::println("The following dependencies are missing:");
- System::println("");
- for (const package_spec& p : unmet_dependencies)
- {
- System::println(" %s", to_string(p));
- }
- System::println("");
- exit(EXIT_FAILURE);
- }
-
- Environment::ensure_utilities_on_path(paths);
- build_internal(spec, paths);
- exit(EXIT_SUCCESS);
- }
-
- void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
- {
- static const std::string example = create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
- args.check_exact_arg_count(2, example.c_str());
-
- expected<package_spec> current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet);
- if (auto spec = current_spec.get())
- {
- Input::check_triplet(spec->target_triplet(), paths);
- Environment::ensure_utilities_on_path(paths);
- const fs::path port_dir = args.command_arguments.at(1);
- build_internal(*spec, paths, port_dir);
- exit(EXIT_SUCCESS);
- }
-
- System::println(System::color::error, "Error: %s: %s", current_spec.error_code().message(), args.command_arguments[0]);
- print_example(Strings::format("%s zlib:x64-windows", args.command).c_str());
- exit(EXIT_FAILURE);
- }
-}
diff --git a/toolsrc/src/commands_integration.cpp b/toolsrc/src/commands_integrate.cpp
index 6a11d6ec4..03c51b5a7 100644
--- a/toolsrc/src/commands_integration.cpp
+++ b/toolsrc/src/commands_integrate.cpp
@@ -1,18 +1,11 @@
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <shellapi.h>
+#include "pch.h"
#include "vcpkg_Commands.h"
-#include "vcpkg.h"
-#include <fstream>
-#include <iostream>
-#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",
@@ -175,7 +168,7 @@ namespace vcpkg
bool should_install_system = true;
if (fs::exists(system_wide_targets_file))
{
- auto system_wide_file_contents = Files::get_contents(system_wide_targets_file);
+ 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+) -->)###");
@@ -295,11 +288,11 @@ 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.c_str());
+ args.check_exact_arg_count(1, example);
if (args.command_arguments[0] == "install")
{
diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp
index 194e4b435..34a9c2fc8 100644
--- a/toolsrc/src/commands_list.cpp
+++ b/toolsrc/src/commands_list.cpp
@@ -1,32 +1,68 @@
+#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
{
- void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
+ static void do_print(const StatusParagraph& pgh)
{
- args.check_exact_arg_count(0);
+ System::println("%-27s %-16s %s",
+ pgh.package.displayname(),
+ pgh.package.version,
+ details::shorten_description(pgh.package.description));
+ }
+
+ 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", Commands::Help::create_example_string("list png"));
+ args.check_max_arg_count(1, example);
- std::vector<std::string> packages_output;
- for (auto&& pgh : database_load_check(paths))
+ const StatusParagraphs status_paragraphs = database_load_check(paths);
+ std::vector<StatusParagraph> installed_packages;
+ for (auto&& pgh : status_paragraphs)
{
if (pgh->state == install_state_t::not_installed && pgh->want == want_t::purge)
continue;
- packages_output.push_back(Strings::format("%-27s %-16s %s",
- pgh->package.displayname(),
- pgh->package.version,
- shorten_description(pgh->package.description)));
+ installed_packages.push_back(*pgh);
+ }
+
+ if (installed_packages.empty())
+ {
+ System::println("No packages are installed. Did you mean `search`?");
+ exit(EXIT_SUCCESS);
}
- std::sort(packages_output.begin(), packages_output.end());
- for (auto&& package : packages_output)
+
+ std::sort(installed_packages.begin(), installed_packages.end(),
+ [ ]( const StatusParagraph& lhs, const StatusParagraph& rhs ) -> bool
+ {
+ return lhs.package.displayname() < rhs.package.displayname();
+ });
+
+ if (args.command_arguments.size() == 0)
{
- System::println(package.c_str());
+ for (const StatusParagraph& status_paragraph : installed_packages)
+ {
+ do_print(status_paragraph);
+ }
}
- if (packages_output.empty())
+ else
{
- System::println("No packages are installed. Did you mean `search`?");
+ // At this point there is 1 argument
+ for (const StatusParagraph& status_paragraph : installed_packages)
+ {
+ const std::string displayname = status_paragraph.package.displayname();
+ if (Strings::case_insensitive_ascii_find(displayname, args.command_arguments[0]) == displayname.end())
+ {
+ continue;
+ }
+
+ do_print(status_paragraph);
+ }
}
+
exit(EXIT_SUCCESS);
}
}
diff --git a/toolsrc/src/commands_other.cpp b/toolsrc/src/commands_other.cpp
deleted file mode 100644
index 07549a437..000000000
--- a/toolsrc/src/commands_other.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "vcpkg_Commands.h"
-#include "vcpkg_System.h"
-#include "vcpkg.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"
- "\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 char* command_and_arguments)
- {
- std::string cs = Strings::format("Example:\n"
- " vcpkg %s", command_and_arguments);
- return cs;
- }
-
- void print_example(const char* command_and_arguments)
- {
- System::println(create_example_string(command_and_arguments).c_str());
- }
-
- 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", 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},
- };
- 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}
- };
- return t;
- }
-}
diff --git a/toolsrc/src/commands_owns.cpp b/toolsrc/src/commands_owns.cpp
index b3dab2e44..6c4c20c44 100644
--- a/toolsrc/src/commands_owns.cpp
+++ b/toolsrc/src/commands_owns.cpp
@@ -1,13 +1,31 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
-#include "vcpkg.h"
+#include "vcpkglib.h"
-namespace vcpkg
+namespace vcpkg::Commands::Owns
{
- void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
+ static void search_file(const vcpkg_paths& paths, const std::string& file_substr, const StatusParagraphs& status_db)
{
- static const std::string example = Strings::format("The argument should be a pattern to search for. %s", create_example_string("owns zlib.dll"));
- args.check_exact_arg_count(1, example.c_str());
+ const std::vector<StatusParagraph_and_associated_files> installed_files = get_installed_files(paths, status_db);
+ for (const StatusParagraph_and_associated_files& pgh_and_file : installed_files)
+ {
+ const StatusParagraph& pgh = pgh_and_file.pgh;
+
+ for (const std::string& file : pgh_and_file.files)
+ {
+ if (file.find(file_substr) != std::string::npos)
+ {
+ System::println("%s: %s", pgh.package.displayname(), file);
+ }
+ }
+ }
+ }
+
+ 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", Commands::Help::create_example_string("owns zlib.dll"));
+ args.check_exact_arg_count(1, example);
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
new file mode 100644
index 000000000..e75633b3c
--- /dev/null
+++ b/toolsrc/src/commands_portsdiff.cpp
@@ -0,0 +1,167 @@
+#include "pch.h"
+#include "vcpkg_Commands.h"
+#include "vcpkg_System.h"
+#include "vcpkg_Maps.h"
+#include "Paragraphs.h"
+#include "SourceParagraph.h"
+#include "vcpkg_Environment.h"
+
+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';
+ }
+ }
+
+ static void do_print_name_and_previous_version_and_current_version(const std::vector<std::string>& ports_to_print,
+ const std::map<std::string, std::string>& previous_names_and_versions,
+ const std::map<std::string, std::string>& current_names_and_versions)
+ {
+ 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&)
+ {
+ }
+ }
+
+ 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 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)",
+ 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);
+ fs::remove_all(temp_checkout_path);
+ return names_and_versions;
+ }
+
+ static void check_commit_exists(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 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 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", Commands::Help::create_example_string("portsdiff mybranchname"));
+ args.check_min_arg_count(1, example);
+ args.check_max_arg_count(2, example);
+
+ 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);
+
+ 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);
+
+ // Already sorted, so set_difference can work on std::vector too
+ std::vector<std::string> current_ports = Maps::extract_keys(current_names_and_versions);
+ std::vector<std::string> previous_ports = Maps::extract_keys(previous_names_and_versions);
+
+ std::vector<std::string> added_ports;
+ std::set_difference(
+ current_ports.cbegin(), current_ports.cend(),
+ previous_ports.cbegin(), previous_ports.cend(),
+ std::back_inserter(added_ports));
+
+ if (!added_ports.empty())
+ {
+ System::println("\nThe following %d ports were added:\n", added_ports.size());
+ do_print_name_and_version(added_ports, current_names_and_versions);
+ }
+
+ std::vector<std::string> removed_ports;
+ std::set_difference(
+ previous_ports.cbegin(), previous_ports.cend(),
+ current_ports.cbegin(), current_ports.cend(),
+ std::back_inserter(removed_ports));
+
+ if (!removed_ports.empty())
+ {
+ System::println("\nThe following %d ports were removed:\n", removed_ports.size());
+ do_print_name_and_version(removed_ports, previous_names_and_versions);
+ }
+
+ std::vector<std::string> potentially_updated_ports;
+ std::set_intersection(
+ current_ports.cbegin(), current_ports.cend(),
+ previous_ports.cbegin(), previous_ports.cend(),
+ std::back_inserter(potentially_updated_ports));
+
+ std::vector<std::string> updated_ports;
+ std::copy_if(potentially_updated_ports.cbegin(), potentially_updated_ports.cend(), std::back_inserter(updated_ports),
+ [&](const std::string& port) -> bool
+ {
+ return current_names_and_versions.at(port) != previous_names_and_versions.at(port);
+ }
+ );
+
+ if (!updated_ports.empty())
+ {
+ System::println("\nThe following %d ports were updated:\n", updated_ports.size());
+ do_print_name_and_previous_version_and_current_version(updated_ports, previous_names_and_versions, current_names_and_versions);
+ }
+
+ if (added_ports.empty() && removed_ports.empty() && updated_ports.empty())
+ {
+ System::println("There were no changes in the ports between the two commits.");
+ }
+
+ exit(EXIT_SUCCESS);
+ }
+}
diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp
index 5bb9ecc96..f49104d1e 100644
--- a/toolsrc/src/commands_remove.cpp
+++ b/toolsrc/src/commands_remove.cpp
@@ -1,11 +1,18 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
-#include "vcpkg.h"
+#include "vcpkglib.h"
#include "vcpkg_System.h"
#include "vcpkg_Input.h"
+#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)
{
@@ -21,28 +28,199 @@ namespace vcpkg
}
}
- void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
+ static void remove_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs* status_db)
+ {
+ StatusParagraph& pkg = **status_db->find(spec.name(), spec.target_triplet());
+
+ pkg.want = want_t::purge;
+ pkg.state = install_state_t::half_installed;
+ write_update(paths, pkg);
+
+ std::fstream listfile(paths.listfile_path(pkg.package), std::ios_base::in | std::ios_base::binary);
+ if (listfile)
+ {
+ std::vector<fs::path> dirs_touched;
+ std::string suffix;
+ while (std::getline(listfile, suffix))
+ {
+ if (!suffix.empty() && suffix.back() == '\r')
+ suffix.pop_back();
+
+ std::error_code ec;
+
+ auto target = paths.installed / suffix;
+
+ auto status = fs::status(target, ec);
+ if (ec)
+ {
+ System::println(System::color::error, "failed: %s", ec.message());
+ continue;
+ }
+
+ if (fs::is_directory(status))
+ {
+ dirs_touched.push_back(target);
+ }
+ else if (fs::is_regular_file(status))
+ {
+ fs::remove(target, ec);
+ if (ec)
+ {
+ System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message());
+ }
+ }
+ else if (!fs::status_known(status))
+ {
+ System::println(System::color::warning, "Warning: unknown status: %s", target.u8string());
+ }
+ else
+ {
+ System::println(System::color::warning, "Warning: %s: cannot handle file type", target.u8string());
+ }
+ }
+
+ auto b = dirs_touched.rbegin();
+ auto e = dirs_touched.rend();
+ for (; b != e; ++b)
+ {
+ if (fs::directory_iterator(*b) == fs::directory_iterator())
+ {
+ std::error_code ec;
+ fs::remove(*b, ec);
+ if (ec)
+ {
+ System::println(System::color::error, "failed: %s", ec.message());
+ }
+ }
+ }
+
+ listfile.close();
+ fs::remove(paths.listfile_path(pkg.package));
+ }
+
+ pkg.state = install_state_t::not_installed;
+ write_update(paths, pkg);
+ }
+
+ static void sort_packages_by_name(std::vector<const package_spec_with_remove_plan*>* packages)
+ {
+ 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();
+ });
+ }
+
+ 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(&not_installed);
+ System::println("The following packages are not installed, so not removed:\n%s",
+ Strings::Joiner::on("\n ").prefix(" ").join(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::Joiner::on("\n").join(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 = create_example_string("remove zlib zlib:x64-windows curl boost");
- args.check_min_arg_count(1, example.c_str());
+ static const std::string example = Commands::Help::create_example_string("remove zlib zlib:x64-windows curl boost");
+ args.check_min_arg_count(1, example);
- const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_PURGE});
+ const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_PURGE, OPTION_RECURSE});
auto status_db = database_load_check(paths);
- std::vector<package_spec> specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example.c_str());
+ 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 bool alsoRemoveFolderFromPackages = options.find(OPTION_PURGE) != options.end();
+ const bool isRecursive = options.find(OPTION_RECURSE) != options.end();
+
+ const std::vector<package_spec_with_remove_plan> remove_plan = Dependencies::create_remove_plan(paths, specs, status_db);
+ Checks::check_exit(!remove_plan.empty(), "Remove plan cannot be empty");
- for (const package_spec& spec : specs)
+ 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();
+
+ 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 c90538e86..3a3226e4b 100644
--- a/toolsrc/src/commands_search.cpp
+++ b/toolsrc/src/commands_search.cpp
@@ -1,60 +1,74 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
-#include "vcpkg.h"
-#include <iostream>
-#include <iomanip>
+#include "Paragraphs.h"
+#include "vcpkglib_helpers.h"
+#include "SourceParagraph.h"
-namespace fs = std::tr2::sys;
-
-namespace vcpkg
+namespace vcpkg::Commands::Search
{
- template <class Pred>
- static void do_print(const vcpkg_paths& paths, Pred predicate)
+ static std::vector<SourceParagraph> read_all_source_paragraphs(const vcpkg_paths& paths)
{
+ std::vector<SourceParagraph> output;
for (auto it = fs::directory_iterator(paths.ports); it != fs::directory_iterator(); ++it)
{
const fs::path& path = it->path();
try
{
- auto pghs = get_paragraphs(path / "CONTROL");
+ auto pghs = Paragraphs::get_paragraphs(path / "CONTROL");
if (pghs.empty())
- continue;
- auto srcpgh = SourceParagraph(pghs[0]);
-
- if (predicate(srcpgh.name))
{
- std::cout << std::left
- << std::setw(20) << srcpgh.name << ' '
- << std::setw(16) << srcpgh.version << ' '
- << shorten_description(srcpgh.description) << '\n';
+ continue;
}
+
+ auto srcpgh = SourceParagraph(pghs[0]);
+ output.push_back(srcpgh);
}
catch (std::runtime_error const&)
{
}
}
+
+ return output;
+ }
+
+ static void do_print(const SourceParagraph& source_paragraph)
+ {
+ System::println("%-20s %-16s %s",
+ source_paragraph.name,
+ source_paragraph.version,
+ 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"));
- args.check_max_arg_count(1, example.c_str());
+ 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::vector<SourceParagraph> source_paragraphs = read_all_source_paragraphs(paths);
if (args.command_arguments.size() == 0)
{
- do_print(paths, [](std::string&) -> bool
- {
- return true;
- });
- exit(EXIT_SUCCESS);
+ for (const SourceParagraph& source_paragraph : source_paragraphs)
+ {
+ do_print(source_paragraph);
+ }
}
+ else
+ {
+ // At this point there is 1 argument
+ for (const SourceParagraph& source_paragraph : source_paragraphs)
+ {
+ if (Strings::case_insensitive_ascii_find(source_paragraph.name, args.command_arguments[0]) == source_paragraph.name.end())
+ {
+ continue;
+ }
- // At this point there is 1 argument
- do_print(paths, [&](std::string& port_name) -> bool
- {
- return Strings::case_insensitive_ascii_find(port_name, args.command_arguments[0]) != port_name.end();
- });
+ do_print(source_paragraph);
+ }
+ }
System::println("\nIf your library is not listed, please open an issue at:\n"
" https://github.com/Microsoft/vcpkg/issues");
diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp
index 5d531ef39..a42ae5341 100644
--- a/toolsrc/src/commands_update.cpp
+++ b/toolsrc/src/commands_update.cpp
@@ -1,11 +1,14 @@
+#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);
System::println("Using local portfile versions. To update the local portfiles, use `git pull`.");
@@ -21,7 +24,7 @@ namespace vcpkg
const auto& path = begin_it->path();
try
{
- auto pghs = get_paragraphs(path / "CONTROL");
+ auto pghs = Paragraphs::get_paragraphs(path / "CONTROL");
if (pghs.empty())
continue;
auto srcpgh = SourceParagraph(pghs[0]);
@@ -35,7 +38,7 @@ namespace vcpkg
std::string packages_list;
std::vector<std::string> packages_output;
- for (auto&& pgh : database_load_check(paths))
+ for (auto&& pgh : status_db)
{
if (pgh->state == install_state_t::not_installed && pgh->want == want_t::purge)
continue;
@@ -69,20 +72,20 @@ namespace vcpkg
System::println("\nTo update these packages, run\n vcpkg remove --purge <pkgs>...\n vcpkg install <pkgs>...");
}
- auto version_file = Files::get_contents(paths.root / "toolsrc" / "VERSION.txt");
+ auto version_file = Files::read_contents(paths.root / "toolsrc" / "VERSION.txt");
if (auto version_contents = version_file.get())
{
int maj1, min1, rev1;
auto num1 = sscanf_s(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1);
int maj2, min2, rev2;
- auto num2 = sscanf_s(version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2);
+ auto num2 = sscanf_s(Info::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..a521b2567
--- /dev/null
+++ b/toolsrc/src/commands_version.cpp
@@ -0,0 +1,17 @@
+#include "pch.h"
+#include "vcpkg_Commands.h"
+#include "vcpkg_System.h"
+#include "vcpkg_info.h"
+
+namespace vcpkg::Commands::Version
+{
+ void perform_and_exit(const vcpkg_cmd_arguments& args)
+ {
+ 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);
+ }
+}
diff --git a/toolsrc/src/lib.cpp b/toolsrc/src/lib.cpp
deleted file mode 100644
index 45b73ee07..000000000
--- a/toolsrc/src/lib.cpp
+++ /dev/null
@@ -1,511 +0,0 @@
-#include "vcpkg.h"
-#include <iostream>
-#include <iomanip>
-#include <fstream>
-#include <functional>
-#include <string>
-#include <unordered_map>
-#include <memory>
-#include <filesystem>
-#include <vector>
-#include <cassert>
-#include "vcpkg_Files.h"
-#include "vcpkg_System.h"
-
-using namespace vcpkg;
-
-bool vcpkg::g_do_dry_run = false;
-
-namespace
-{
- template <class M, class K, class V>
- auto find_or_default(const M& map, const K& key, const V& val)
- {
- auto it = map.find(key);
- if (it == map.end())
- return decltype(it->second)(val);
- else
- return it->second;
- }
-}
-
-namespace
-{
- std::fstream open_status_file(const vcpkg_paths& paths, std::ios_base::openmode mode = std::ios_base::app | std::ios_base::in | std::ios_base::out | std::ios_base::binary)
- {
- return std::fstream(paths.vcpkg_dir_status_file, mode);
- }
-}
-
-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::get_contents(vcpkg_dir_status_file).get_or_throw();
- auto pghs = 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 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);
-
- 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::get_contents(b->path()).get_or_throw();
- auto pghs = 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;
-}
-
-static fs::path listfile_path(const vcpkg_paths& paths, const BinaryParagraph& pgh)
-{
- return paths.vcpkg_dir_info / (pgh.fullstem() + ".list");
-}
-
-static std::string get_fullpkgname_from_listfile(const fs::path& path)
-{
- auto ret = path.stem().generic_u8string();
- std::replace(ret.begin(), ret.end(), '_', ':');
- return ret;
-}
-
-static 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 install_and_write_listfile(const vcpkg_paths& paths, const BinaryParagraph& bpgh)
-{
- std::fstream listfile(listfile_path(paths, bpgh), std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
-
- auto package_prefix_path = paths.package_dir(bpgh.spec);
- auto prefix_length = package_prefix_path.native().size();
-
- const triplet& target_triplet = bpgh.spec.target_triplet();
- const std::string& target_triplet_as_string = target_triplet.canonical_name();
- std::error_code ec;
- fs::create_directory(paths.installed / target_triplet_as_string, ec);
- listfile << target_triplet << "\n";
-
- for (auto it = fs::recursive_directory_iterator(package_prefix_path); it != fs::recursive_directory_iterator(); ++it)
- {
- const auto& filename = it->path().filename();
- if (fs::is_regular_file(it->status()) && (filename == "CONTROL" || filename == "control"))
- {
- // Do not copy the control file
- continue;
- }
-
- auto suffix = it->path().generic_u8string().substr(prefix_length + 1);
- auto 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());
- }
-
- listfile << target_triplet << "/" << suffix << "\n";
- }
- else if (fs::is_regular_file(status))
- {
- fs::copy_file(*it, target, ec);
- if (ec)
- {
- System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message());
- }
- listfile << target_triplet << "/" << suffix << "\n";
- }
- else if (!fs::status_known(status))
- {
- System::println(System::color::error, "failed: %s: unknown status", it->path().u8string());
- }
- else
- System::println(System::color::error, "failed: %s: cannot handle file type", it->path().u8string());
- }
-
- listfile.close();
-}
-
-// TODO: Refactoring between this function and install_package
-std::vector<std::string> vcpkg::get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db)
-{
- std::vector<std::unordered_map<std::string, std::string>> pghs;
- {
- const fs::path packages_dir_control_file_path = paths.package_dir(spec) / "CONTROL";
-
- auto control_contents_maybe = Files::get_contents(packages_dir_control_file_path);
- if (auto control_contents = control_contents_maybe.get())
- {
- try
- {
- pghs = parse_paragraphs(*control_contents);
- }
- catch (std::runtime_error)
- {
- }
- Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", packages_dir_control_file_path.string());
- return BinaryParagraph(pghs[0]).depends;
- }
- }
-
- const fs::path ports_dir_control_file_path = paths.port_dir(spec) / "CONTROL";
- auto control_contents_maybe = Files::get_contents(ports_dir_control_file_path);
- if (auto control_contents = control_contents_maybe.get())
- {
- try
- {
- pghs = parse_paragraphs(*control_contents);
- }
- catch (std::runtime_error)
- {
- }
- Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", ports_dir_control_file_path.string());
- return SourceParagraph(pghs[0]).depends;
- }
-
- Checks::exit_with_message("Could not find package named %s", spec);
-}
-
-void vcpkg::install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db)
-{
- StatusParagraph spgh;
- spgh.package = binary_paragraph;
- spgh.want = want_t::install;
- spgh.state = install_state_t::half_installed;
- for (const std::string& dependency : spgh.package.depends)
- {
- if (status_db.find_installed(dependency, spgh.package.spec.target_triplet()) == status_db.end())
- {
- std::abort();
- }
- }
- 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));
-}
-
-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;
-}
-
-void vcpkg::deinstall_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs& status_db)
-{
- auto package_it = status_db.find(spec.name(), spec.target_triplet());
- 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();
- }
-
- pkg.want = want_t::purge;
- pkg.state = install_state_t::half_installed;
- write_update(paths, pkg);
-
- std::fstream listfile(listfile_path(paths, pkg.package), std::ios_base::in | std::ios_base::binary);
- if (listfile)
- {
- std::vector<fs::path> dirs_touched;
- std::string suffix;
- while (std::getline(listfile, suffix))
- {
- if (!suffix.empty() && suffix.back() == '\r')
- suffix.pop_back();
-
- std::error_code ec;
-
- auto target = paths.installed / suffix;
-
- auto status = fs::status(target, ec);
- if (ec)
- {
- System::println(System::color::error, "failed: %s", ec.message());
- continue;
- }
-
- if (fs::is_directory(status))
- {
- dirs_touched.push_back(target);
- }
- else if (fs::is_regular_file(status))
- {
- fs::remove(target, ec);
- if (ec)
- {
- System::println(System::color::error, "failed: %s: %s", target.u8string(), ec.message());
- }
- }
- else if (!fs::status_known(status))
- {
- System::println(System::color::warning, "Warning: unknown status: %s", target.u8string());
- }
- else
- {
- System::println(System::color::warning, "Warning: %s: cannot handle file type", target.u8string());
- }
- }
-
- auto b = dirs_touched.rbegin();
- auto e = dirs_touched.rend();
- for (; b != e; ++b)
- {
- if (fs::directory_iterator(*b) == fs::directory_iterator())
- {
- std::error_code ec;
- fs::remove(*b, ec);
- if (ec)
- {
- System::println(System::color::error, "failed: %s", ec.message());
- }
- }
- }
-
- listfile.close();
- fs::remove(listfile_path(paths, pkg.package));
- }
-
- 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 vcpkg::search_file(const vcpkg_paths& paths, const std::string& file_substr, const StatusParagraphs& status_db)
-{
- std::string line;
-
- for (auto&& pgh : status_db)
- {
- if (pgh->state != install_state_t::installed)
- continue;
-
- std::fstream listfile(listfile_path(paths, pgh->package));
- while (std::getline(listfile, line))
- {
- if (line.empty())
- {
- continue;
- }
-
- if (line.find(file_substr) != std::string::npos)
- {
- System::println("%s: %s", pgh->package.displayname(), line);
- }
- }
- }
-}
-
-namespace
-{
- struct Binaries
- {
- std::vector<fs::path> dlls;
- std::vector<fs::path> libs;
- };
-
- Binaries detect_files_in_directory_ending_with(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);
- }
- }
-
- return binaries;
- }
-
- void copy_files_into_directory(const std::vector<fs::path>& files, const fs::path& destination_folder)
- {
- fs::create_directory(destination_folder);
-
- for (auto const& src_path : files)
- {
- fs::path dest_path = destination_folder / src_path.filename();
- fs::copy(src_path, dest_path, fs::copy_options::overwrite_existing);
- }
- }
-
- void place_library_files_in(const fs::path& include_directory, const fs::path& project_directory, const fs::path& destination_path)
- {
- 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");
-
- fs::path destination_include_directory = destination_path / "include";
- fs::copy(include_directory, destination_include_directory, fs::copy_options::recursive | fs::copy_options::overwrite_existing);
-
- copy_files_into_directory(release_binaries.dlls, destination_path / "bin");
- copy_files_into_directory(release_binaries.libs, destination_path / "lib");
-
- fs::create_directory(destination_path / "debug");
- copy_files_into_directory(debug_binaries.dlls, destination_path / "debug" / "bin");
- copy_files_into_directory(debug_binaries.libs, destination_path / "debug" / "lib");
- }
-}
-
-void vcpkg::binary_import(const vcpkg_paths& paths, const fs::path& include_directory, const fs::path& project_directory, const BinaryParagraph& control_file_data)
-{
- fs::path library_destination_path = paths.package_dir(control_file_data.spec);
- fs::create_directory(library_destination_path);
- place_library_files_in(include_directory, project_directory, library_destination_path);
-
- fs::path control_file_path = library_destination_path / "CONTROL";
- std::ofstream(control_file_path) << control_file_data;
-}
diff --git a/toolsrc/src/main.cpp b/toolsrc/src/main.cpp
deleted file mode 100644
index 2200cd105..000000000
--- a/toolsrc/src/main.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
-
-#include <iostream>
-#include <fstream>
-#include <memory>
-#include <cassert>
-#include "vcpkg.h"
-#include "vcpkg_Commands.h"
-#include "metrics.h"
-#include <Shlobj.h>
-#include "vcpkg_Files.h"
-#include "vcpkg_System.h"
-#include "vcpkg_Input.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::get_contents(localappdata / "vcpkg" / "config").get_or_throw();
-
- std::unordered_map<std::string, std::string> keys;
- auto pghs = 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", version());
-
- const std::string trimmed_command_line = trim_path_from_command_line(Strings::utf16_to_utf8(GetCommandLineW()));
- TrackProperty("cmdline", trimmed_command_line);
- loadConfig();
-
- 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"
- << " vcpkg@microsoft.com\n"
- << "containing a brief summary of what you were trying to do and the following data blob:\n"
- << "\n"
- << "Version=" << 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 ada065fd6..263d6eb74 100644
--- a/toolsrc/src/metrics.cpp
+++ b/toolsrc/src/metrics.cpp
@@ -1,21 +1,9 @@
+#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>
+#include "filesystem_fs.h"
#include "vcpkg_Strings.h"
#include "vcpkg_System.h"
-namespace fs = std::tr2::sys;
-
namespace vcpkg
{
static std::string GetCurrentDateTime()
@@ -237,6 +225,40 @@ true
return DISABLE_METRICS == 0;
}
+ std::wstring GetSQMUser()
+ {
+ LONG err;
+
+ struct RAII_HKEY {
+ HKEY hkey = nullptr;
+ ~RAII_HKEY()
+ {
+ if (hkey != nullptr)
+ RegCloseKey(hkey);
+ }
+ } HKCU_SQMClient;
+
+ err = RegOpenKeyExW(HKEY_CURRENT_USER, LR"(Software\Microsoft\SQMClient)", NULL, KEY_READ, &HKCU_SQMClient.hkey);
+ if (err != ERROR_SUCCESS)
+ {
+ 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", nullptr, &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)
{
g_metricmessage.user_id = user_id;
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/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp
deleted file mode 100644
index c68148fb2..000000000
--- a/toolsrc/src/post_build_lint.cpp
+++ /dev/null
@@ -1,433 +0,0 @@
-#include <filesystem>
-#include "vcpkg_paths.h"
-#include "package_spec.h"
-#include <iterator>
-#include <functional>
-#include "vcpkg_System.h"
-#include "coff_file_reader.h"
-
-namespace fs = std::tr2::sys;
-
-namespace vcpkg
-{
- enum class lint_status
- {
- SUCCESS = 0,
- ERROR_DETECTED = 1
- };
-
- static const fs::path DUMPBIN_EXE = R"(%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe)";
-
- namespace
- {
- void print_vector_of_files(const std::vector<fs::path>& paths)
- {
- System::println("");
- for (const fs::path& p : paths)
- {
- System::println(" %s", p.generic_string());
- }
- System::println("");
- }
-
- template <class Pred>
- void recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector<fs::path>& output)
- {
- std::copy_if(fs::recursive_directory_iterator(dir), fs::recursive_directory_iterator(), std::back_inserter(output), predicate);
- }
-
- void recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension, std::vector<fs::path>& output)
- {
- recursive_find_matching_paths_in_dir(dir, [&extension](const fs::path& current)
- {
- return !fs::is_directory(current) && current.extension() == extension;
- }, output);
- }
- }
-
- static lint_status check_for_files_in_include_directory(const package_spec& spec, const vcpkg_paths& paths)
- {
- const fs::path include_dir = paths.packages / spec.dir() / "include";
- if (!fs::exists(include_dir) || fs::is_empty(include_dir))
- {
- System::println(System::color::warning, "The folder /include is empty. This indicates the library was not correctly installed.");
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_for_files_in_debug_include_directory(const package_spec& spec, const vcpkg_paths& paths)
- {
- const fs::path debug_include_dir = paths.packages / spec.dir() / "debug" / "include";
- std::vector<fs::path> files_found;
-
- recursive_find_matching_paths_in_dir(debug_include_dir, [&](const fs::path& current)
- {
- return !fs::is_directory(current) && current.extension() != ".ifc";
- }, files_found);
-
- if (!files_found.empty())
- {
- System::println(System::color::warning, "Include files should not be duplicated into the /debug/include directory. If this cannot be disabled in the project cmake, use\n"
- " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)"
- );
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_for_files_in_debug_share_directory(const package_spec& spec, const vcpkg_paths& paths)
- {
- const fs::path debug_share = paths.packages / spec.dir() / "debug" / "share";
-
- if (fs::exists(debug_share) && !fs::is_empty(debug_share))
- {
- System::println(System::color::warning, "No files should be present in /debug/share");
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_folder_lib_cmake(const package_spec& spec, const vcpkg_paths& paths)
- {
- const fs::path lib_cmake = paths.packages / spec.dir() / "lib" / "cmake";
- if (fs::exists(lib_cmake))
- {
- System::println(System::color::warning, "The /lib/cmake folder should be moved to just /cmake");
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_for_misplaced_cmake_files(const package_spec& spec, const vcpkg_paths& paths)
- {
- const fs::path current_packages_dir = paths.packages / spec.dir();
- std::vector<fs::path> misplaced_cmake_files;
- recursive_find_files_with_extension_in_dir(current_packages_dir / "cmake", ".cmake", misplaced_cmake_files);
- recursive_find_files_with_extension_in_dir(current_packages_dir / "debug" / "cmake", ".cmake", misplaced_cmake_files);
- recursive_find_files_with_extension_in_dir(current_packages_dir / "lib" / "cmake", ".cmake", misplaced_cmake_files);
- recursive_find_files_with_extension_in_dir(current_packages_dir / "debug" / "lib" / "cmake", ".cmake", misplaced_cmake_files);
-
- if (!misplaced_cmake_files.empty())
- {
- System::println(System::color::warning, "The following cmake files were found outside /share/%s. Please place cmake files in /share/%s.", spec.name(), spec.name());
- print_vector_of_files(misplaced_cmake_files);
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_folder_debug_lib_cmake(const package_spec& spec, const vcpkg_paths& paths)
- {
- const fs::path lib_cmake_debug = paths.packages / spec.dir() / "debug" / "lib" / "cmake";
- if (fs::exists(lib_cmake_debug))
- {
- System::println(System::color::warning, "The /debug/lib/cmake folder should be moved to just /debug/cmake");
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_for_dlls_in_lib_dirs(const package_spec& spec, const vcpkg_paths& paths)
- {
- std::vector<fs::path> dlls;
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "lib", ".dll", dlls);
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "lib", ".dll", dlls);
-
- if (!dlls.empty())
- {
- System::println(System::color::warning, "\nThe following dlls were found in /lib and /debug/lib. Please move them to /bin or /debug/bin, respectively.");
- print_vector_of_files(dlls);
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_for_copyright_file(const package_spec& spec, const vcpkg_paths& paths)
- {
- const fs::path copyright_file = paths.packages / spec.dir() / "share" / spec.name() / "copyright";
- if (fs::exists(copyright_file))
- {
- return lint_status::SUCCESS;
- }
- const fs::path current_buildtrees_dir = paths.buildtrees / spec.name();
- const fs::path current_buildtrees_dir_src = current_buildtrees_dir / "src";
-
- std::vector<fs::path> potential_copyright_files;
- // Only searching one level deep
- for (auto it = fs::recursive_directory_iterator(current_buildtrees_dir_src); it != fs::recursive_directory_iterator(); ++it)
- {
- if (it.depth() > 1)
- {
- continue;
- }
-
- const std::string filename = it->path().filename().string();
- if (filename == "LICENSE" || filename == "LICENSE.txt" || filename == "COPYING")
- {
- potential_copyright_files.push_back(it->path());
- }
- }
-
- System::println(System::color::warning, "The software license must be available at ${CURRENT_PACKAGES_DIR}/share/%s/copyright .", spec.name());
- if (potential_copyright_files.size() == 1) // if there is only one candidate, provide the cmake lines needed to place it in the proper location
- {
- const fs::path found_file = potential_copyright_files[0];
- const fs::path relative_path = found_file.string().erase(0, current_buildtrees_dir.string().size() + 1); // The +1 is needed to remove the "/"
- System::println("\n file(COPY ${CURRENT_BUILDTREES_DIR}/%s DESTINATION ${CURRENT_PACKAGES_DIR}/share/%s)\n"
- " file(RENAME ${CURRENT_PACKAGES_DIR}/share/%s/%s ${CURRENT_PACKAGES_DIR}/share/%s/copyright)",
- relative_path.generic_string(), spec.name(), spec.name(), found_file.filename().generic_string(), spec.name());
- return lint_status::ERROR_DETECTED;
- }
-
- if (potential_copyright_files.size() > 1)
- {
- System::println(System::color::warning, "The following files are potential copyright files:");
- print_vector_of_files(potential_copyright_files);
- }
-
- const fs::path current_packages_dir = paths.packages / spec.dir();
- System::println(" %s/share/%s/copyright", current_packages_dir.generic_string(), spec.name());
-
- return lint_status::ERROR_DETECTED;
- }
-
- static lint_status check_for_exes(const package_spec& spec, const vcpkg_paths& paths)
- {
- std::vector<fs::path> exes;
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "bin", ".exe", exes);
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "bin", ".exe", exes);
-
- if (!exes.empty())
- {
- System::println(System::color::warning, "The following EXEs were found in /bin and /debug/bin. EXEs are not valid distribution targets.");
- print_vector_of_files(exes);
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_exports_of_dlls(const std::vector<fs::path>& dlls)
- {
- 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());
- System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
- Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
-
- if (ec_data.output.find("ordinal hint RVA name") == std::string::npos)
- {
- dlls_with_no_exports.push_back(dll);
- }
- }
-
- if (!dlls_with_no_exports.empty())
- {
- System::println(System::color::warning, "The following DLLs have no exports:");
- print_vector_of_files(dlls_with_no_exports);
- System::println(System::color::warning, "DLLs without any exports are likely a bug in the build script.");
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_uwp_bit_of_dlls(const std::string& expected_system_name, const std::vector<fs::path>& dlls)
- {
- if (expected_system_name != "uwp")
- {
- return lint_status::SUCCESS;
- }
-
- 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());
- System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
- Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
-
- if (ec_data.output.find("App Container") == std::string::npos)
- {
- dlls_with_improper_uwp_bit.push_back(dll);
- }
- }
-
- if (!dlls_with_improper_uwp_bit.empty())
- {
- System::println(System::color::warning, "The following DLLs do not have the App Container bit set:");
- print_vector_of_files(dlls_with_improper_uwp_bit);
- System::println(System::color::warning, "This bit is required for Windows Store apps.");
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- struct file_and_arch
- {
- fs::path file;
- std::string actual_arch;
- };
-
- static std::string get_actual_architecture(const MachineType& machine_type)
- {
- switch (machine_type)
- {
- case MachineType::AMD64:
- case MachineType::IA64:
- return "x64";
- case MachineType::I386:
- return "x86";
- case MachineType::ARM:
- case MachineType::ARMNT:
- return "arm";
- default:
- return "Machine Type Code = " + std::to_string(static_cast<uint16_t>(machine_type));
- }
- }
-
- static void print_invalid_architecture_files(const std::string& expected_architecture, std::vector<file_and_arch> binaries_with_invalid_architecture)
- {
- System::println(System::color::warning, "The following files were built for an incorrect architecture:");
- System::println("");
- for (const file_and_arch& b : binaries_with_invalid_architecture)
- {
- System::println(" %s", b.file.generic_string());
- System::println("Expected %s, but was: %s", expected_architecture, b.actual_arch);
- System::println("");
- }
- }
-
- static lint_status check_dll_architecture(const std::string& expected_architecture, const std::vector<fs::path>& files)
- {
- std::vector<file_and_arch> binaries_with_invalid_architecture;
-
- for (const fs::path& file : files)
- {
- Checks::check_exit(file.extension() == ".dll", "The file extension was not .dll: %s", file.generic_string());
- COFFFileReader::dll_info info = COFFFileReader::read_dll(file);
- const std::string actual_architecture = get_actual_architecture(info.machine_type);
-
- if (expected_architecture != actual_architecture)
- {
- binaries_with_invalid_architecture.push_back({file, actual_architecture});
- }
- }
-
- if (!binaries_with_invalid_architecture.empty())
- {
- print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture);
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_lib_architecture(const std::string& expected_architecture, const std::vector<fs::path>& files)
- {
- std::vector<file_and_arch> binaries_with_invalid_architecture;
-
- for (const fs::path& file : files)
- {
- Checks::check_exit(file.extension() == ".lib", "The file extension was not .lib: %s", file.generic_string());
- COFFFileReader::lib_info info = COFFFileReader::read_lib(file);
- Checks::check_exit(info.machine_types.size() == 1, "Found more than 1 architecture in file %s", file.generic_string());
-
- 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});
- }
- }
-
- if (!binaries_with_invalid_architecture.empty())
- {
- print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture);
- return lint_status::ERROR_DETECTED;
- }
-
- return lint_status::SUCCESS;
- }
-
- static lint_status check_no_dlls_present(const std::vector<fs::path>& dlls)
- {
- if (dlls.empty())
- {
- return lint_status::SUCCESS;
- }
-
- System::println(System::color::warning, "DLLs should not be present in a static build, but the following DLLs were found:");
- print_vector_of_files(dlls);
- return lint_status::ERROR_DETECTED;
- }
-
- static void operator +=(size_t& left, const lint_status& right)
- {
- left += static_cast<size_t>(right);
- }
-
- void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths)
- {
- System::println("-- Performing post-build validation");
- size_t error_count = 0;
- error_count += check_for_files_in_include_directory(spec, paths);
- error_count += check_for_files_in_debug_include_directory(spec, paths);
- error_count += check_for_files_in_debug_share_directory(spec, paths);
- error_count += check_folder_lib_cmake(spec, paths);
- error_count += check_for_misplaced_cmake_files(spec, paths);
- error_count += check_folder_debug_lib_cmake(spec, paths);
- error_count += check_for_dlls_in_lib_dirs(spec, paths);
- error_count += check_for_copyright_file(spec, paths);
- error_count += check_for_exes(spec, paths);
-
- triplet::BuildType build_type = spec.target_triplet().build_type();
- switch (build_type)
- {
- case triplet::BuildType::DYNAMIC:
- {
- std::vector<fs::path> dlls;
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "bin", ".dll", dlls);
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "bin", ".dll", dlls);
-
- error_count += check_exports_of_dlls(dlls);
- error_count += check_uwp_bit_of_dlls(spec.target_triplet().system(), dlls);
- error_count += check_dll_architecture(spec.target_triplet().architecture(), dlls);
- break;
- }
- case triplet::BuildType::STATIC:
- {
- std::vector<fs::path> dlls;
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir(), ".dll", dlls);
- error_count += check_no_dlls_present(dlls);
-
- break;
- }
-
- default:
- Checks::unreachable();
- }
-
- std::vector<fs::path> libs;
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "lib", ".lib", libs);
- recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "lib", ".lib", libs);
- error_count += check_lib_architecture(spec.target_triplet().architecture(), libs);
-
- if (error_count != 0)
- {
- const fs::path portfile = paths.ports / spec.name() / "portfile.cmake";
- System::println(System::color::error, "Found %u error(s). Please correct the portfile:\n %s", error_count, portfile.string());
- exit(EXIT_FAILURE);
- }
-
- System::println("-- Performing post-build validation done");
- }
-}
diff --git a/toolsrc/src/tests_dependencies.cpp b/toolsrc/src/tests_dependencies.cpp
new file mode 100644
index 000000000..bce1cab0e
--- /dev/null
+++ b/toolsrc/src/tests_dependencies.cpp
@@ -0,0 +1,39 @@
+#include "CppUnitTest.h"
+#include "SourceParagraph.h"
+#include "triplet.h"
+
+#pragma comment(lib,"version")
+#pragma comment(lib,"winhttp")
+
+using namespace Microsoft::VisualStudio::CppUnitTestFramework;
+
+using namespace vcpkg;
+
+namespace UnitTest1
+{
+ TEST_CLASS(DependencyTests)
+ {
+ public:
+ TEST_METHOD(parse_depends_one)
+ {
+ auto v = expand_qualified_dependencies(parse_depends("libA [windows]"));
+ Assert::AreEqual(size_t(1), v.size());
+ Assert::AreEqual("libA", v[0].name.c_str());
+ Assert::AreEqual("windows", v[0].qualifier.c_str());
+ }
+
+ TEST_METHOD(filter_depends)
+ {
+ auto deps = expand_qualified_dependencies(parse_depends("libA [windows], libB, libC [uwp]"));
+ auto v = filter_dependencies(deps, triplet::X64_WINDOWS);
+ Assert::AreEqual(size_t(2), v.size());
+ Assert::AreEqual("libA", v[0].c_str());
+ Assert::AreEqual("libB", v[1].c_str());
+
+ auto v2 = filter_dependencies(deps, triplet::ARM_UWP);
+ Assert::AreEqual(size_t(2), v.size());
+ Assert::AreEqual("libB", v2[0].c_str());
+ Assert::AreEqual("libC", v2[1].c_str());
+ }
+ };
+}
diff --git a/toolsrc/src/test.cpp b/toolsrc/src/tests_paragraph.cpp
index fc49b362d..fb20eee82 100644
--- a/toolsrc/src/test.cpp
+++ b/toolsrc/src/tests_paragraph.cpp
@@ -1,19 +1,20 @@
#include "CppUnitTest.h"
-#include "vcpkg.h"
+#include "Paragraphs.h"
+#include "BinaryParagraph.h"
#pragma comment(lib,"version")
#pragma comment(lib,"winhttp")
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
{
@@ -48,7 +49,7 @@ namespace UnitTest1
Assert::AreEqual("m", pgh.maintainer.c_str());
Assert::AreEqual("d", pgh.description.c_str());
Assert::AreEqual(size_t(1), pgh.depends.size());
- Assert::AreEqual("bd", pgh.depends[0].c_str());
+ Assert::AreEqual("bd", pgh.depends[0].name.c_str());
}
TEST_METHOD(SourceParagraph_Two_Depends)
@@ -60,8 +61,8 @@ namespace UnitTest1
});
Assert::AreEqual(size_t(2), pgh.depends.size());
- Assert::AreEqual("z", pgh.depends[0].c_str());
- Assert::AreEqual("openssl", pgh.depends[1].c_str());
+ Assert::AreEqual("z", pgh.depends[0].name.c_str());
+ Assert::AreEqual("openssl", pgh.depends[1].name.c_str());
}
TEST_METHOD(SourceParagraph_Three_Depends)
@@ -73,9 +74,28 @@ namespace UnitTest1
});
Assert::AreEqual(size_t(3), pgh.depends.size());
- Assert::AreEqual("z", pgh.depends[0].c_str());
- Assert::AreEqual("openssl", pgh.depends[1].c_str());
- Assert::AreEqual("xyz", pgh.depends[2].c_str());
+ Assert::AreEqual("z", pgh.depends[0].name.c_str());
+ Assert::AreEqual("openssl", pgh.depends[1].name.c_str());
+ Assert::AreEqual("xyz", pgh.depends[2].name.c_str());
+ }
+
+ TEST_METHOD(SourceParagraph_Construct_Qualified_Depends)
+ {
+ vcpkg::SourceParagraph pgh({
+ {"Source", "zlib"},
+ {"Version", "1.2.8"},
+ {"Build-Depends", "libA [windows], libB [uwp]"}
+ });
+
+ Assert::AreEqual("zlib", pgh.name.c_str());
+ Assert::AreEqual("1.2.8", pgh.version.c_str());
+ Assert::AreEqual("", pgh.maintainer.c_str());
+ Assert::AreEqual("", pgh.description.c_str());
+ Assert::AreEqual(size_t(2), pgh.depends.size());
+ Assert::AreEqual("libA", pgh.depends[0].name.c_str());
+ Assert::AreEqual("windows", pgh.depends[0].qualifier.c_str());
+ Assert::AreEqual("libB", pgh.depends[1].name.c_str());
+ Assert::AreEqual("uwp", pgh.depends[1].qualifier.c_str());
}
TEST_METHOD(BinaryParagraph_Construct_Minimum)
@@ -83,7 +103,7 @@ namespace UnitTest1
vcpkg::BinaryParagraph pgh({
{"Package", "zlib"},
{"Version", "1.2.8"},
- {"Architecture", "a"},
+ {"Architecture", "x86-windows"},
{"Multi-Arch", "same"},
});
@@ -91,7 +111,7 @@ namespace UnitTest1
Assert::AreEqual("1.2.8", pgh.version.c_str());
Assert::AreEqual("", pgh.maintainer.c_str());
Assert::AreEqual("", pgh.description.c_str());
- Assert::AreEqual("a", pgh.spec.target_triplet().canonical_name().c_str());
+ Assert::AreEqual("x86-windows", pgh.spec.target_triplet().canonical_name().c_str());
Assert::AreEqual(size_t(0), pgh.depends.size());
}
@@ -100,7 +120,7 @@ namespace UnitTest1
vcpkg::BinaryParagraph pgh({
{"Package", "s"},
{"Version", "v"},
- {"Architecture", "a"},
+ {"Architecture", "x86-windows"},
{"Multi-Arch", "same"},
{"Maintainer", "m"},
{"Description", "d"},
@@ -119,7 +139,7 @@ namespace UnitTest1
vcpkg::BinaryParagraph pgh({
{"Package", "zlib"},
{"Version", "1.2.8"},
- {"Architecture", "a"},
+ {"Architecture", "x86-windows"},
{"Multi-Arch", "same"},
{"Depends", "a, b, c"},
});
@@ -133,14 +153,14 @@ namespace UnitTest1
TEST_METHOD(parse_paragraphs_empty)
{
const char* str = "";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::IsTrue(pghs.empty());
}
TEST_METHOD(parse_paragraphs_one_field)
{
const char* str = "f1: v1";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual(size_t(1), pghs[0].size());
Assert::AreEqual("v1", pghs[0]["f1"].c_str());
@@ -151,7 +171,7 @@ namespace UnitTest1
const char* str =
"f1: v1\n"
"f2: v2";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual(size_t(2), pghs[0].size());
Assert::AreEqual("v1", pghs[0]["f1"].c_str());
@@ -166,7 +186,7 @@ namespace UnitTest1
"\n"
"f3: v3\n"
"f4: v4";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::AreEqual(size_t(2), pghs.size());
Assert::AreEqual(size_t(2), pghs[0].size());
Assert::AreEqual("v1", pghs[0]["f1"].c_str());
@@ -184,7 +204,7 @@ namespace UnitTest1
"F:\n"
"0:\n"
"F-2:\n";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual(size_t(5), pghs[0].size());
}
@@ -198,7 +218,7 @@ namespace UnitTest1
"\n"
"f3: v3\n"
"f4: v4";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::AreEqual(size_t(2), pghs.size());
}
@@ -207,7 +227,7 @@ namespace UnitTest1
const char* str =
"f1:\n"
"f2: ";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual(size_t(2), pghs[0].size());
Assert::AreEqual("", pghs[0]["f1"].c_str());
@@ -223,7 +243,7 @@ namespace UnitTest1
"f2:\r\n"
" f2\r\n"
" continue\r\n";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual("simple\n f1", pghs[0]["f1"].c_str());
Assert::AreEqual("\n f2\n continue", pghs[0]["f2"].c_str());
@@ -237,7 +257,7 @@ namespace UnitTest1
"\r\n"
"f3: v3\r\n"
"f4: v4";
- auto pghs = vcpkg::parse_paragraphs(str);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(str);
Assert::AreEqual(size_t(2), pghs.size());
Assert::AreEqual(size_t(2), pghs[0].size());
Assert::AreEqual("v1", pghs[0]["f1"].c_str());
@@ -253,16 +273,16 @@ namespace UnitTest1
vcpkg::BinaryParagraph pgh({
{"Package", "zlib"},
{"Version", "1.2.8"},
- {"Architecture", "a"},
+ {"Architecture", "x86-windows"},
{"Multi-Arch", "same"},
});
ss << pgh;
- auto pghs = vcpkg::parse_paragraphs(ss.str());
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str());
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual(size_t(4), pghs[0].size());
Assert::AreEqual("zlib", pghs[0]["Package"].c_str());
Assert::AreEqual("1.2.8", pghs[0]["Version"].c_str());
- Assert::AreEqual("a", pghs[0]["Architecture"].c_str());
+ Assert::AreEqual("x86-windows", pghs[0]["Architecture"].c_str());
Assert::AreEqual("same", pghs[0]["Multi-Arch"].c_str());
}
@@ -272,19 +292,19 @@ namespace UnitTest1
vcpkg::BinaryParagraph pgh({
{"Package", "zlib"},
{"Version", "1.2.8"},
- {"Architecture", "a"},
+ {"Architecture", "x86-windows"},
{"Description", "first line\n second line"},
{"Maintainer", "abc <abc@abc.abc>"},
{"Depends", "dep"},
{"Multi-Arch", "same"},
});
ss << pgh;
- auto pghs = vcpkg::parse_paragraphs(ss.str());
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str());
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual(size_t(7), pghs[0].size());
Assert::AreEqual("zlib", pghs[0]["Package"].c_str());
Assert::AreEqual("1.2.8", pghs[0]["Version"].c_str());
- Assert::AreEqual("a", pghs[0]["Architecture"].c_str());
+ Assert::AreEqual("x86-windows", pghs[0]["Architecture"].c_str());
Assert::AreEqual("same", pghs[0]["Multi-Arch"].c_str());
Assert::AreEqual("first line\n second line", pghs[0]["Description"].c_str());
Assert::AreEqual("dep", pghs[0]["Depends"].c_str());
@@ -296,12 +316,12 @@ namespace UnitTest1
vcpkg::BinaryParagraph pgh({
{"Package", "zlib"},
{"Version", "1.2.8"},
- {"Architecture", "a"},
+ {"Architecture", "x86-windows"},
{"Multi-Arch", "same"},
{"Depends", "a, b, c"},
});
ss << pgh;
- auto pghs = vcpkg::parse_paragraphs(ss.str());
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str());
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual("a, b, c", pghs[0]["Depends"].c_str());
}
diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp
index af2ca2a72..e1302d9ed 100644
--- a/toolsrc/src/triplet.cpp
+++ b/toolsrc/src/triplet.cpp
@@ -1,6 +1,6 @@
+#include "pch.h"
#include "triplet.h"
#include "vcpkg_Checks.h"
-#include <algorithm>
namespace vcpkg
{
@@ -64,14 +64,4 @@ namespace vcpkg
auto it = std::find(this->m_canonical_name.cbegin(), this->m_canonical_name.cend(), '-');
return std::string(it + 1, this->m_canonical_name.cend());
}
-
- triplet::BuildType triplet::build_type() const
- {
- if (this->m_canonical_name.find("static") != std::string::npos)
- {
- return BuildType::STATIC;
- }
-
- return BuildType::DYNAMIC;
- }
}
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index f705858cc..3e313c702 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -1,178 +1,249 @@
-#include "vcpkg.h"
-#include <regex>
+#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 "vcpkglib_helpers.h"
+#include "vcpkg_System.h"
+#include "vcpkg_Input.h"
+#include "Paragraphs.h"
+#include "vcpkg_info.h"
+#include "vcpkg_Strings.h"
-namespace
+using namespace vcpkg;
+
+bool g_debugging = false;
+
+void invalid_command(const std::string& cmd)
{
- using namespace vcpkg;
+ System::println(System::color::error, "invalid command: %s", cmd);
+ Commands::Help::print_usage();
+ exit(EXIT_FAILURE);
+}
- struct Parser
+static void inner(const vcpkg_cmd_arguments& args)
+{
+ TrackProperty("command", args.command);
+ if (args.command.empty())
{
- Parser(const char* c, const char* e) : cur(c), end(e)
- {
- }
+ Commands::Help::print_usage();
+ exit(EXIT_FAILURE);
+ }
- private:
- const char* cur;
- const char* const end;
+ if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c()))
+ {
+ return command_function(args);
+ }
- void peek(char& ch) const
- {
- if (cur == end)
- ch = 0;
- else
- ch = *cur;
- }
+ 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");
- void next(char& ch)
+ if (!vcpkg_root_dir_env.empty())
{
- if (cur == end)
- ch = 0;
- else
- {
- ++cur;
- peek(ch);
- }
+ vcpkg_root_dir = fs::absolute(vcpkg_root_dir_env);
}
-
- void skip_spaces(char& ch)
+ else
{
- while (ch == ' ' || ch == '\t')
- next(ch);
+ vcpkg_root_dir = Files::find_file_recursively_up(fs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root");
}
+ }
- static bool is_alphanum(char ch)
- {
- return (ch >= 'A' && ch <= 'Z')
- || (ch >= 'a' && ch <= 'z')
- || (ch >= '0' && ch <= '9');
- }
+ Checks::check_exit(!vcpkg_root_dir.empty(), "Error: Could not detect vcpkg-root.");
- static bool is_lineend(char ch)
- {
- return ch == '\r' || ch == '\n' || ch == 0;
- }
+ 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");
- void get_fieldvalue(char& ch, std::string& fieldvalue)
+ if (auto command_function = Commands::find(args.command, Commands::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())
{
- fieldvalue.clear();
-
- auto beginning_of_line = cur;
- do
- {
- // scan to end of current line (it is part of the field value)
- while (!is_lineend(ch))
- next(ch);
-
- fieldvalue.append(beginning_of_line, cur);
-
- if (ch == '\r')
- next(ch);
- if (ch == '\n')
- next(ch);
-
- if (is_alphanum(ch))
- {
- // Line begins a new field.
- return;
- }
-
- beginning_of_line = cur;
-
- // Line may continue the current field with data or terminate the paragraph,
- // depending on first nonspace character.
- skip_spaces(ch);
-
- if (is_lineend(ch))
- {
- // Line was whitespace or empty.
- // This terminates the field and the paragraph.
- // We leave the blank line's whitespace consumed, because it doesn't matter.
- return;
- }
-
- // First nonspace is not a newline. This continues the current field value.
- // We forcibly convert all newlines into single '\n' for ease of text handling later on.
- fieldvalue.push_back('\n');
- }
- while (true);
+ default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(vcpkg_default_triplet_env));
}
-
- void get_fieldname(char& ch, std::string& fieldname)
+ else
{
- auto begin_fieldname = cur;
- while (is_alphanum(ch) || ch == '-')
- next(ch);
- Checks::check_throw(ch == ':', "Expected ':'");
- fieldname = std::string(begin_fieldname, cur);
-
- // skip ': '
- next(ch);
- skip_spaces(ch);
+ default_target_triplet = triplet::X86_WINDOWS;
}
+ }
- void get_paragraph(char& ch, std::unordered_map<std::string, std::string>& fields)
- {
- fields.clear();
- std::string fieldname;
- std::string fieldvalue;
- do
- {
- get_fieldname(ch, fieldname);
+ Input::check_triplet(default_target_triplet, paths);
- auto it = fields.find(fieldname);
- Checks::check_throw(it == fields.end(), "Duplicate field");
+ if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a()))
+ {
+ return command_function(args, paths, default_target_triplet);
+ }
- get_fieldvalue(ch, fieldvalue);
+ return invalid_command(args.command);
+}
- fields.emplace(fieldname, fieldvalue);
- }
- while (!is_lineend(ch));
- }
+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];
- public:
- std::vector<std::unordered_map<std::string, std::string>> get_paragraphs()
+ for (size_t x = 1; x < pghs.size(); ++x)
{
- std::vector<std::unordered_map<std::string, std::string>> paragraphs;
+ for (auto&& p : pghs[x])
+ keys.insert(p);
+ }
- char ch;
- peek(ch);
+ 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
- while (ch != 0)
- {
- if (ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t')
- {
- next(ch);
- continue;
- }
+ SetUserInformation(user_id, user_time);
+ return;
+ }
+ catch (...)
+ {
+ }
- paragraphs.emplace_back();
- get_paragraph(ch, paragraphs.back());
- }
+ // 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 (...)
+ {
+ }
+}
- return paragraphs;
- }
- };
+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());
}
-namespace vcpkg
+int wmain(const int argc, const wchar_t* const* const argv)
{
- std::string shorten_description(const std::string& desc)
+ 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_t::UNSPECIFIED)
+ SetPrintMetrics(args.printmetrics == opt_bool_t::ENABLED);
+ if (args.sendmetrics != opt_bool_t::UNSPECIFIED)
+ SetSendMetrics(args.sendmetrics == opt_bool_t::ENABLED);
+
+ if (args.debug != opt_bool_t::UNSPECIFIED)
{
- auto simple_desc = std::regex_replace(desc.substr(0, 49), std::regex("\\n( |\\t)?"), "");
- if (desc.size() > 49)
- simple_desc.append("...");
- return simple_desc;
+ g_debugging = (args.debug == opt_bool_t::ENABLED);
}
- std::vector<std::unordered_map<std::string, std::string>> get_paragraphs(const fs::path& control_path)
+ if (g_debugging)
{
- return parse_paragraphs(Files::get_contents(control_path).get_or_throw());
+ inner(args);
+ exit(EXIT_FAILURE);
}
- std::vector<std::unordered_map<std::string, std::string>> parse_paragraphs(const std::string& str)
+ std::string exc_msg;
+ try
+ {
+ inner(args);
+ exit(EXIT_FAILURE);
+ }
+ catch (std::exception& e)
+ {
+ exc_msg = e.what();
+ }
+ catch (...)
{
- return Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs();
+ 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 << Strings::utf16_to_utf8(argv[x]) << "|\n";
+ std::cerr
+ << "\n";
}
diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp
index db6c03480..5c3fef27a 100644
--- a/toolsrc/src/vcpkg_Checks.cpp
+++ b/toolsrc/src/vcpkg_Checks.cpp
@@ -1,14 +1,17 @@
+#include "pch.h"
#include "vcpkg_Checks.h"
-
-#include <stdexcept>
#include "vcpkg_System.h"
-namespace vcpkg {namespace Checks
+namespace vcpkg::Checks
{
void unreachable()
{
System::println(System::color::error, "Error: Unreachable code was reached");
+#ifndef NDEBUG
+ std::abort();
+#else
exit(EXIT_FAILURE);
+#endif
}
void exit_with_message(const char* errorMessage)
@@ -37,4 +40,4 @@ namespace vcpkg {namespace Checks
exit_with_message(errorMessage);
}
}
-}}
+}
diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp
index 54b37cd11..5bd6c3eb9 100644
--- a/toolsrc/src/vcpkg_Dependencies.cpp
+++ b/toolsrc/src/vcpkg_Dependencies.cpp
@@ -1,23 +1,111 @@
+#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.h"
-#include "vcpkg_Maps.h"
-#include "vcpkg_Sets.h"
+#include "vcpkg_Files.h"
+#include "vcpkglib.h"
-namespace vcpkg { namespace Dependencies
+namespace vcpkg::Dependencies
{
- static Graphs::Graph<package_spec> build_dependency_graph(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db)
+ 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
+ Graphs::Graph<package_spec> graph;
+ graph.add_vertices(specs);
+
std::vector<package_spec> examine_stack(specs);
- std::unordered_set<package_spec> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies
+ while (!examine_stack.empty())
+ {
+ const package_spec spec = examine_stack.back();
+ examine_stack.pop_back();
+
+ if (was_examined.find(spec) != was_examined.end())
+ {
+ continue;
+ }
+
+ auto process_dependencies = [&](const std::vector<std::string>& dependencies_as_string)
+ {
+ for (const std::string& dep_as_string : dependencies_as_string)
+ {
+ const package_spec current_dep = package_spec::from_name_and_triplet(dep_as_string, spec.target_triplet()).get_or_throw();
+ graph.add_edge(spec, current_dep);
+ if (was_examined.find(current_dep) == was_examined.end())
+ {
+ examine_stack.push_back(std::move(current_dep));
+ }
+ }
+ };
+
+ auto it = status_db.find(spec);
+ if (it != status_db.end() && (*it)->want == want_t::install)
+ {
+ was_examined.emplace(spec, install_plan_action{install_plan_type::ALREADY_INSTALLED, nullptr, nullptr});
+ continue;
+ }
+
+ expected<BinaryParagraph> maybe_bpgh = try_load_cached_package(paths, spec);
+ if (BinaryParagraph* bpgh = maybe_bpgh.get())
+ {
+ process_dependencies(bpgh->depends);
+ was_examined.emplace(spec, install_plan_action{install_plan_type::INSTALL, std::make_unique<BinaryParagraph>(std::move(*bpgh)), nullptr});
+ continue;
+ }
+
+ expected<SourceParagraph> maybe_spgh = try_load_port(paths, spec.name());
+ 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()));
+ was_examined.emplace(spec, install_plan_action{install_plan_type::BUILD_AND_INSTALL, nullptr, std::make_unique<SourceParagraph>(std::move(*spgh))});
+ }
+
+ std::vector<package_spec_with_install_plan> ret;
+
+ const std::vector<package_spec> pkgs = graph.find_topological_sort();
+ for (const package_spec& pkg : pkgs)
+ {
+ 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 vcpkg_paths& paths, 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(examine_stack);
+ graph.add_vertices(specs);
+ std::vector<package_spec> examine_stack(specs);
while (!examine_stack.empty())
{
const package_spec spec = examine_stack.back();
@@ -28,40 +116,41 @@ namespace vcpkg { namespace Dependencies
continue;
}
- std::vector<std::string> dependencies_as_string = get_unmet_package_dependencies(paths, spec, status_db);
+ 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::string& dep_as_string : dependencies_as_string)
+ for (const std::unique_ptr<StatusParagraph>& an_installed_package : status_db)
{
- const package_spec current_dep = package_spec::from_name_and_triplet(dep_as_string, spec.target_triplet()).get_or_throw();
- auto it = status_db.find(current_dep.name(), current_dep.target_triplet());
- if (it != status_db.end() && (*it)->want == want_t::install)
- {
+ if (an_installed_package->want != want_t::install)
+ continue;
+ if (an_installed_package->package.spec.target_triplet() != spec.target_triplet())
continue;
- }
- graph.add_edge(spec, current_dep);
- if (was_examined.find(current_dep) == was_examined.end())
+ const std::vector<std::string>& deps = an_installed_package->package.depends;
+ if (std::find(deps.begin(), deps.end(), spec.name()) == deps.end())
{
- examine_stack.push_back(std::move(current_dep));
+ continue;
}
+
+ graph.add_edge(spec, an_installed_package.get()->package.spec);
+ examine_stack.push_back(an_installed_package.get()->package.spec);
}
- was_examined.insert(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));
}
- return graph;
- }
-
- std::vector<package_spec> create_dependency_ordered_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db)
- {
- return build_dependency_graph(paths, specs, status_db).find_topological_sort();
- }
+ std::vector<package_spec_with_remove_plan> ret;
- std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db)
- {
- const Graphs::Graph<package_spec> dependency_graph = build_dependency_graph(paths, {spec}, status_db);
- std::unordered_set<package_spec> key_set = Maps::extract_key_set(dependency_graph.adjacency_list());
- key_set.erase(spec);
- return key_set;
+ 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_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp
index d98b0f220..1babdc547 100644
--- a/toolsrc/src/vcpkg_Environment.cpp
+++ b/toolsrc/src/vcpkg_Environment.cpp
@@ -1,19 +1,19 @@
-#include <regex>
-#include <array>
+#include "pch.h"
#include "vcpkg_Environment.h"
#include "vcpkg_Commands.h"
-#include "vcpkg.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 void ensure_on_path(const std::array<int, 3>& version, const wchar_t* version_check_cmd, const wchar_t* install_cmd)
+ static void ensure_on_path(const std::array<int, 3>& version, const std::wstring& version_check_cmd, const std::wstring& install_cmd)
{
System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(version_check_cmd);
if (ec_data.exit_code == 0)
@@ -45,6 +45,13 @@ namespace vcpkg {namespace Environment
}
}
+ static std::wstring create_default_install_cmd(const vcpkg_paths& paths, const std::wstring& tool_name)
+ {
+ const fs::path script = paths.scripts / "fetchDependency.ps1";
+ // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned
+ return Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency %s", script.native(), tool_name);
+ }
+
void ensure_git_on_path(const vcpkg_paths& paths)
{
const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd";
@@ -56,13 +63,14 @@ namespace vcpkg {namespace Environment
_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");
+ static const std::wstring version_check_cmd = L"git --version 2>&1";
+ const std::wstring install_cmd = create_default_install_cmd(paths, L"git");
+ ensure_on_path(git_version, version_check_cmd, install_cmd);
}
void ensure_cmake_on_path(const vcpkg_paths& paths)
{
- const fs::path downloaded_cmake = paths.downloads / "cmake-3.5.2-win32-x86" / "bin";
+ const fs::path downloaded_cmake = paths.downloads / "cmake-3.7.2-win32-x86" / "bin";
const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s",
downloaded_cmake.native(),
System::wdupenv_str(L"PATH"),
@@ -70,18 +78,131 @@ namespace vcpkg {namespace Environment
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 constexpr std::array<int, 3> cmake_version = {3,7,2};
+ static const std::wstring version_check_cmd = L"cmake --version 2>&1";
+ const std::wstring install_cmd = create_default_install_cmd(paths, L"cmake");
+ ensure_on_path(cmake_version, version_check_cmd, install_cmd);
}
void ensure_nuget_on_path(const vcpkg_paths& paths)
{
- const std::wstring path_buf = Strings::wformat(L"%s;%s", paths.downloads.native(), System::wdupenv_str(L"PATH"));
+ const fs::path downloaded_nuget = paths.downloads / "nuget-3.5.0";
+ const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::wdupenv_str(L"PATH"));
_wputenv_s(L"PATH", path_buf.c_str());
- static constexpr std::array<int, 3> nuget_version = {1,0,0};
- // 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 constexpr std::array<int, 3> nuget_version = {3,3,0};
+ static const std::wstring version_check_cmd = L"nuget 2>&1";
+ const std::wstring install_cmd = create_default_install_cmd(paths, L"nuget");
+ ensure_on_path(nuget_version, version_check_cmd, install_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 = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s", script.native());
+ 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 const fs::path& get_VS2015_installation_instance()
+ {
+ static const fs::path vs2015_cmntools = fs::path(System::wdupenv_str(L"VS140COMNTOOLS")).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 vs2015_path;
+ }
+
+ static fs::path find_dumpbin_exe(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 std::string& instance : vs2017_installation_instances)
+ {
+ 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)
+ {
+ const fs::path dumpbin_path = subdir / "bin" / "HostX86" / "x86" / "dumpbin.exe";
+ paths_examined.push_back(dumpbin_path);
+ if (fs::exists(dumpbin_path))
+ {
+ return dumpbin_path;
+ }
+ }
+ }
+
+ // VS2015
+ const fs::path vs2015_dumpbin_exe = get_VS2015_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 fs::path vs2015_vcvarsall_bat = get_VS2015_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 vccarsall.bat.");
+ System::println("The following paths were examined:");
+ for (const fs::path& path : paths_examined)
+ {
+ 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;
}
-}}
+}
diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp
index 611aa7450..87700238d 100644
--- a/toolsrc/src/vcpkg_Files.cpp
+++ b/toolsrc/src/vcpkg_Files.cpp
@@ -1,25 +1,22 @@
+#include "pch.h"
#include "vcpkg_Files.h"
-#include <fstream>
-#include <filesystem>
-#include <regex>
+#include "vcpkg_System.h"
-namespace fs = std::tr2::sys;
-
-namespace vcpkg {namespace Files
+namespace vcpkg::Files
{
static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])");
void check_is_directory(const fs::path& dirpath)
{
- Checks::check_throw(fs::is_directory(dirpath), "The path %s is not a directory", dirpath.string());
+ Checks::check_exit(fs::is_directory(dirpath), "The path %s is not a directory", dirpath.string());
}
- bool has_invalid_chars_for_filesystem(const std::string s)
+ bool has_invalid_chars_for_filesystem(const std::string& s)
{
return std::regex_search(s, FILESYSTEM_INVALID_CHARACTERS_REGEX);
}
- expected<std::string> get_contents(const fs::path& file_path) noexcept
+ expected<std::string> read_contents(const fs::path& file_path) noexcept
{
std::fstream file_stream(file_path, std::ios_base::in | std::ios_base::binary);
if (file_stream.fail())
@@ -44,6 +41,35 @@ namespace vcpkg {namespace Files
return std::move(output);
}
+ expected<std::vector<std::string>> read_all_lines(const fs::path& file_path)
+ {
+ std::fstream file_stream(file_path, std::ios_base::in | std::ios_base::binary);
+ if (file_stream.fail())
+ {
+ return std::errc::no_such_file_or_directory;
+ }
+
+ std::vector<std::string> output;
+ std::string line;
+ while (std::getline(file_stream, line))
+ {
+ output.push_back(line);
+ }
+ file_stream.close();
+
+ return std::move(output);
+ }
+
+ void write_all_lines(const fs::path& file_path, const std::vector<std::string>& lines)
+ {
+ std::fstream output(file_path, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
+ for (const std::string& line : lines)
+ {
+ output << line << "\n";
+ }
+ output.close();
+ }
+
fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename)
{
fs::path current_dir = starting_dir;
@@ -58,4 +84,59 @@ namespace vcpkg {namespace Files
return current_dir;
}
-}}
+
+ void recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension, std::vector<fs::path>* output)
+ {
+ recursive_find_matching_paths_in_dir(dir, [&extension](const fs::path& current)
+ {
+ return !fs::is_directory(current) && current.extension() == extension;
+ }, output);
+ }
+
+ std::vector<fs::path> recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension)
+ {
+ std::vector<fs::path> v;
+ recursive_find_files_with_extension_in_dir(dir, extension, &v);
+ return v;
+ }
+
+ 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)
+ {
+ return !fs::is_directory(current);
+ }, output);
+ }
+
+ std::vector<fs::path> recursive_find_all_files_in_dir(const fs::path& dir)
+ {
+ std::vector<fs::path> v;
+ recursive_find_all_files_in_dir(dir, &v);
+ return v;
+ }
+
+ 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)
+ {
+ return !fs::is_directory(current);
+ }, output);
+ }
+
+ std::vector<fs::path> non_recursive_find_all_files_in_dir(const fs::path& dir)
+ {
+ std::vector<fs::path> v;
+ non_recursive_find_all_files_in_dir(dir, &v);
+ return v;
+ }
+
+ void print_paths(const std::vector<fs::path>& paths)
+ {
+ System::println("");
+ for (const fs::path& p : paths)
+ {
+ System::println(" %s", p.generic_string());
+ }
+ System::println("");
+ }
+}
diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg_Input.cpp
index f7aae1929..5720cadc0 100644
--- a/toolsrc/src/vcpkg_Input.cpp
+++ b/toolsrc/src/vcpkg_Input.cpp
@@ -1,11 +1,12 @@
+#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 char* example_text)
+ package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const std::string& example_text)
{
const std::string as_lowercase = Strings::ascii_to_lowercase(package_spec_as_string);
expected<package_spec> expected_spec = package_spec::from_string(as_lowercase, default_target_triplet);
@@ -20,7 +21,7 @@ namespace vcpkg {namespace Input
exit(EXIT_FAILURE);
}
- std::vector<package_spec> check_and_get_package_specs(const std::vector<std::string>& package_specs_as_strings, const triplet& default_target_triplet, const char* example_text)
+ std::vector<package_spec> check_and_get_package_specs(const std::vector<std::string>& package_specs_as_strings, const triplet& default_target_triplet, const std::string& example_text)
{
std::vector<package_spec> specs;
for (const std::string& spec : package_specs_as_strings)
@@ -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 56eeae7a0..3b9d6a859 100644
--- a/toolsrc/src/vcpkg_Strings.cpp
+++ b/toolsrc/src/vcpkg_Strings.cpp
@@ -1,12 +1,14 @@
+#include "pch.h"
#include "vcpkg_Strings.h"
-#include <cstdarg>
-#include <algorithm>
-#include <codecvt>
-#include <iterator>
-
-namespace vcpkg {namespace Strings {namespace details
+namespace vcpkg::Strings::details
{
+ // To disambiguate between two overloads
+ static const auto isspace = [](const char c)
+ {
+ return std::isspace(c);
+ };
+
std::string format_internal(const char* fmtstr, ...)
{
va_list lst;
@@ -32,9 +34,9 @@ namespace vcpkg {namespace Strings {namespace details
return output;
}
-}}}
+}
-namespace vcpkg {namespace Strings
+namespace vcpkg::Strings
{
std::wstring utf8_to_utf16(const std::string& s)
{
@@ -64,4 +66,84 @@ namespace vcpkg {namespace Strings
std::transform(output.begin(), output.end(), output.begin(), ::tolower);
return output;
}
-}}
+
+ std::string join(const std::vector<std::string>& v, const std::string& prefix, const std::string& delimiter, const std::string& suffix)
+ {
+ return join(v, prefix, delimiter, suffix, [](const std::string& i) -> std::string
+ {
+ return i;
+ });
+ }
+
+ Joiner Joiner::on(const std::string& delimiter)
+ {
+ return Joiner(delimiter);
+ }
+
+ Joiner& Joiner::prefix(const std::string& prefix)
+ {
+ this->m_prefix = prefix;
+ return *this;
+ }
+
+ Joiner& Joiner::suffix(const std::string& suffix)
+ {
+ this->m_suffix = suffix;
+ return *this;
+ }
+
+ std::string Joiner::join(const std::vector<std::string>& v) const
+ {
+ return Strings::join(v, this->m_prefix, this->m_delimiter, this->m_suffix);
+ }
+
+ Joiner::Joiner(const std::string& delimiter) : m_prefix(""), m_delimiter(delimiter), m_suffix("")
+ {
+ }
+
+ void trim(std::string* s)
+ {
+ s->erase(std::find_if_not(s->rbegin(), s->rend(), details::isspace).base(), s->end());
+ s->erase(s->begin(), std::find_if_not(s->begin(), s->end(), details::isspace));
+ }
+
+ std::string trimmed(const std::string& s)
+ {
+ auto whitespace_back = std::find_if_not(s.rbegin(), s.rend(), details::isspace).base();
+ auto whitespace_front = std::find_if_not(s.begin(), whitespace_back, details::isspace);
+ return std::string(whitespace_front, whitespace_back);
+ }
+
+ void trim_all_and_remove_whitespace_strings(std::vector<std::string>* strings)
+ {
+ for (std::string& s : *strings)
+ {
+ trim(&s);
+ }
+
+ strings->erase(std::remove_if(strings->begin(), strings->end(), [](const std::string& s)-> bool
+ {
+ 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 cc7080069..754a26741 100644
--- a/toolsrc/src/vcpkg_System.cpp
+++ b/toolsrc/src/vcpkg_System.cpp
@@ -1,11 +1,7 @@
+#include "pch.h"
#include "vcpkg_System.h"
-#include <iostream>
-#include <Windows.h>
-#include <regex>
-namespace fs = std::tr2::sys;
-
-namespace vcpkg {namespace System
+namespace vcpkg::System
{
fs::path get_exe_path_of_current_process()
{
@@ -58,7 +54,7 @@ namespace vcpkg {namespace System
std::cout << "\n";
}
- void print(color c, const char* message)
+ void print(const color c, const char* message)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -71,7 +67,7 @@ namespace vcpkg {namespace System
SetConsoleTextAttribute(hConsole, original_color);
}
- void println(color c, const char* message)
+ void println(const color c, const char* message)
{
print(c, message);
std::cout << "\n";
@@ -106,6 +102,6 @@ namespace vcpkg {namespace System
double Stopwatch2::microseconds() const
{
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;
+ reinterpret_cast<const LARGE_INTEGER*>(&start_time)->QuadPart) * 1000000.0 / reinterpret_cast<const LARGE_INTEGER*>(&freq)->QuadPart;
}
-}}
+}
diff --git a/toolsrc/src/vcpkg_cmd_arguments.cpp b/toolsrc/src/vcpkg_cmd_arguments.cpp
index a286ba9b7..fdeb6e877 100644
--- a/toolsrc/src/vcpkg_cmd_arguments.cpp
+++ b/toolsrc/src/vcpkg_cmd_arguments.cpp
@@ -1,11 +1,7 @@
-#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
+#include "pch.h"
#include "vcpkg_cmd_arguments.h"
#include "vcpkg_Commands.h"
-#include "vcpkg_Graphs.h"
-#include <unordered_set>
#include "metrics.h"
-#include "vcpkg.h"
#include "vcpkg_System.h"
namespace vcpkg
@@ -20,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);
}
@@ -28,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);
}
@@ -36,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;
@@ -98,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;
}
@@ -158,7 +154,7 @@ namespace vcpkg
System::println(System::color::error, "Unknown option(s) for command '%s':", this->command);
for (const std::string& option : options_copy)
{
- System::println(option.c_str());
+ System::println(option);
}
exit(EXIT_FAILURE);
}
@@ -181,7 +177,7 @@ namespace vcpkg
return check_exact_arg_count(expected_arg_count, "");
}
- void vcpkg_cmd_arguments::check_max_arg_count(const size_t expected_arg_count, const char* example_text) const
+ void vcpkg_cmd_arguments::check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const
{
const size_t actual_arg_count = command_arguments.size();
if (actual_arg_count > expected_arg_count)
@@ -192,7 +188,7 @@ namespace vcpkg
}
}
- void vcpkg_cmd_arguments::check_min_arg_count(const size_t expected_arg_count, const char* example_text) const
+ void vcpkg_cmd_arguments::check_min_arg_count(const size_t expected_arg_count, const std::string& example_text) const
{
const size_t actual_arg_count = command_arguments.size();
if (actual_arg_count < expected_arg_count)
@@ -203,7 +199,7 @@ namespace vcpkg
}
}
- void vcpkg_cmd_arguments::check_exact_arg_count(const size_t expected_arg_count, const char* example_text) const
+ void vcpkg_cmd_arguments::check_exact_arg_count(const size_t expected_arg_count, const std::string& example_text) const
{
const size_t actual_arg_count = command_arguments.size();
if (actual_arg_count != expected_arg_count)
diff --git a/toolsrc/src/vcpkg_info.cpp b/toolsrc/src/vcpkg_info.cpp
new file mode 100644
index 000000000..f8e214998
--- /dev/null
+++ b/toolsrc/src/vcpkg_info.cpp
@@ -0,0 +1,35 @@
+#include "pch.h"
+#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::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 f1f4a52ed..14fc9ae48 100644
--- a/toolsrc/src/vcpkg_metrics_uploader.cpp
+++ b/toolsrc/src/vcpkg_metrics_uploader.cpp
@@ -1,10 +1,8 @@
#include "metrics.h"
-#include <filesystem>
#include "vcpkg_Checks.h"
#include "vcpkg_Files.h"
#include <Windows.h>
-namespace fs = std::tr2::sys;
using namespace vcpkg;
int WINAPI
@@ -21,5 +19,5 @@ WinMain(
szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount);
Checks::check_exit(argCount == 2, "Requires exactly one argument, the path to the payload file");
- Upload(Files::get_contents(szArgList[1]).get_or_throw());
+ Upload(Files::read_contents(szArgList[1]).get_or_throw());
}
diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp
index 1f9eb0bc5..8d7060a02 100644
--- a/toolsrc/src/vcpkg_paths.cpp
+++ b/toolsrc/src/vcpkg_paths.cpp
@@ -1,4 +1,4 @@
-#include <filesystem>
+#include "pch.h"
#include "expected.h"
#include "vcpkg_paths.h"
#include "metrics.h"
@@ -32,8 +32,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";
@@ -41,7 +42,7 @@ 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;
}
@@ -55,6 +56,16 @@ namespace vcpkg
return this->ports / spec.name();
}
+ fs::path vcpkg_paths::build_info_file_path(const package_spec& spec) const
+ {
+ return this->package_dir(spec) / "BUILD_INFO";
+ }
+
+ fs::path vcpkg_paths::listfile_path(const BinaryParagraph& pgh) const
+ {
+ return this->vcpkg_dir_info / (pgh.fullstem() + ".list");
+ }
+
bool vcpkg_paths::is_valid_triplet(const triplet& t) const
{
auto it = fs::directory_iterator(this->triplets);
diff --git a/toolsrc/src/vcpkg_version.cpp b/toolsrc/src/vcpkg_version.cpp
deleted file mode 100644
index da52b7cab..000000000
--- a/toolsrc/src/vcpkg_version.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "vcpkg.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
-
-const std::string& vcpkg::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;
-}
diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp
new file mode 100644
index 000000000..06487684c
--- /dev/null
+++ b/toolsrc/src/vcpkglib.cpp
@@ -0,0 +1,240 @@
+#include "pch.h"
+#include "vcpkglib.h"
+#include "vcpkg_Files.h"
+#include "Paragraphs.h"
+#include "metrics.h"
+
+using 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 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);
+
+ 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 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);
+}
+
+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());
+
+#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
+}
+
+std::vector<StatusParagraph_and_associated_files> vcpkg::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;
+}
+
+expected<SourceParagraph> vcpkg::try_load_port(const fs::path& path)
+{
+ 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]);
+ }
+ catch (std::runtime_error const&)
+ {
+ }
+
+ 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())
+ {
+ 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]);
+ }
+ return control_contents_maybe.error_code();
+}
diff --git a/toolsrc/src/vcpkglib_helpers.cpp b/toolsrc/src/vcpkglib_helpers.cpp
index 3aa3735b0..6b96c25cb 100644
--- a/toolsrc/src/vcpkglib_helpers.cpp
+++ b/toolsrc/src/vcpkglib_helpers.cpp
@@ -1,8 +1,8 @@
+#include "pch.h"
#include "vcpkg_Checks.h"
#include "vcpkglib_helpers.h"
-#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)
{
@@ -13,41 +13,43 @@ namespace vcpkg {namespace details
}
return it->second;
- };
+ }
+
+ std::string remove_optional_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname)
+ {
+ auto it = fields->find(fieldname);
+ if (it == fields->end())
+ {
+ return std::string();
+ }
+
+ const std::string value = std::move(it->second);
+ fields->erase(it);
+ return value;
+ }
std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname)
{
auto it = fields.find(fieldname);
- vcpkg::Checks::check_throw(it != fields.end(), "Required field not present: %s", fieldname);
+ Checks::check_exit(it != fields.end(), "Required field not present: %s", fieldname);
return it->second;
- };
+ }
- std::vector<std::string> parse_depends(const std::string& depends_string)
+ std::string remove_required_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname)
{
- std::vector<std::string> out;
+ auto it = fields->find(fieldname);
+ Checks::check_exit(it != fields->end(), "Required field not present: %s", fieldname);
- size_t cur = 0;
- do
- {
- auto pos = depends_string.find(',', cur);
- if (pos == std::string::npos)
- {
- out.push_back(depends_string.substr(cur));
- break;
- }
- out.push_back(depends_string.substr(cur, pos - cur));
-
- // skip comma and space
- ++pos;
- if (depends_string[pos] == ' ')
- {
- ++pos;
- }
-
- cur = pos;
- }
- while (cur != std::string::npos);
+ const std::string value = std::move(it->second);
+ fields->erase(it);
+ return value;
+ }
- return out;
+ std::string shorten_description(const std::string& desc)
+ {
+ auto simple_desc = std::regex_replace(desc.substr(0, 49), std::regex("\\n( |\\t)?"), "");
+ if (desc.size() > 49)
+ 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 82d3e2163..c91bc2a75 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 Condition="'$(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,48 +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_import.cpp" />
- <ClCompile Include="..\src\commands_list.cpp" />
- <ClCompile Include="..\src\commands_owns.cpp" />
- <ClCompile Include="..\src\commands_remove.cpp" />
- <ClCompile Include="..\src\commands_search.cpp" />
- <ClCompile Include="..\src\commands_update.cpp" />
- <ClCompile Include="..\src\vcpkg_cmd_arguments.cpp" />
- <ClCompile Include="..\src\commands_other.cpp" />
- <ClCompile Include="..\src\vcpkg_Dependencies.cpp" />
- <ClCompile Include="..\src\vcpkg_Environment.cpp" />
- <ClCompile Include="..\src\commands_installation.cpp" />
- <ClCompile Include="..\src\commands_integration.cpp" />
- <ClCompile Include="..\src\main.cpp" />
- <ClCompile Include="..\src\commands_help.cpp" />
- <ClCompile Include="..\src\post_build_lint.cpp" />
- <ClCompile Include="..\src\vcpkg_Input.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\include\coff_file_reader.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 96a11162f..ca9723bbf 100644
--- a/toolsrc/vcpkg/vcpkg.vcxproj.filters
+++ b/toolsrc/vcpkg/vcpkg.vcxproj.filters
@@ -15,94 +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>
- </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>
</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 99e16e431..2a651e294 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 Condition="'$(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,8 +75,12 @@
<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'">
@@ -85,8 +89,12 @@
<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,29 +137,103 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\include\BinaryParagraph.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\Stopwatch.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_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\lib.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\Stopwatch.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" />
<ClCompile Include="..\src\SourceParagraph.cpp" />
<ClCompile Include="..\src\StatusParagraph.cpp" />
<ClCompile Include="..\src\StatusParagraphs.cpp" />
<ClCompile Include="..\src\triplet.cpp" />
- <ClCompile Include="..\src\vcpkg.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_Environment.cpp" />
+ <ClCompile Include="..\src\vcpkg_Files.cpp" />
+ <ClCompile Include="..\src\vcpkg_Input.cpp" />
<ClCompile Include="..\src\vcpkg_paths.cpp" />
- <ClCompile Include="..\src\vcpkg_version.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 eec73a445..99cbf7037 100644
--- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters
+++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters
@@ -15,15 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\src\vcpkg.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\src\lib.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\src\vcpkg_version.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\src\package_spec.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -51,11 +42,134 @@
<ClCompile Include="..\src\vcpkg_paths.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\Paragraphs.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vcpkg_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\metrics.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vcpkg_Input.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <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\Stopwatch.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>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\include\vcpkg.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\include\package_spec.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -83,5 +197,98 @@
<ClInclude Include="..\include\vcpkg_paths.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\include\Paragraphs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\include\vcpkg_info.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <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\Stopwatch.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>
</ItemGroup>
</Project> \ No newline at end of file
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..b66b7fd9d 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 Condition="'$(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>
@@ -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 3d9503374..224500d82 100644
--- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj
+++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj
@@ -19,37 +19,31 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\src\test.cpp" />
+ <ClCompile Include="..\src\tests_dependencies.cpp" />
+ <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 Condition="'$(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>
@@ -57,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>
@@ -105,6 +97,8 @@
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile />
<AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ <MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -116,11 +110,13 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <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>
@@ -139,6 +135,7 @@
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile />
<AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -159,6 +156,7 @@
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile />
<AdditionalOptions>/std:c++latest %(AdditionalOptions)</AdditionalOptions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters
index 9db7e6ef8..bbbc6bd40 100644
--- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters
+++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters
@@ -15,7 +15,10 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\src\test.cpp">
+ <ClCompile Include="..\src\tests_paragraph.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\tests_dependencies.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>