From 083dfc4d9cebd816b870186d10fbf591c1f13807 Mon Sep 17 00:00:00 2001 From: Olaf Date: Thu, 19 Jan 2017 14:23:52 +0100 Subject: [PATCH 01/40] Package lzo --- ports/lzo/CONTROL | 3 +++ ports/lzo/portfile.cmake | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 ports/lzo/CONTROL create mode 100644 ports/lzo/portfile.cmake 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/portfile.cmake b/ports/lzo/portfile.cmake new file mode 100644 index 000000000..a8a91e5e5 --- /dev/null +++ b/ports/lzo/portfile.cmake @@ -0,0 +1,32 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# 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/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_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() + +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) From 28bd54e0d04fce52577a563956e853f96c060566 Mon Sep 17 00:00:00 2001 From: sdcb Date: Fri, 20 Jan 2017 15:19:23 +0800 Subject: [PATCH 02/40] [libmysql] upgrade to 5.7.17 1. upgraded upstream mysql version to 5.7.17 2. simplified the patch size from 12K to 2K 3. enabled static build 4. switched mysql.h file to mysql/mysql.h --- ports/libmysql/0001_cmake.patch | 378 --------------------------- ports/libmysql/CONTROL | 4 +- ports/libmysql/boost_and_build.patch | 44 ++++ ports/libmysql/portfile.cmake | 148 ++++++----- 4 files changed, 125 insertions(+), 449 deletions(-) delete mode 100644 ports/libmysql/0001_cmake.patch create mode 100644 ports/libmysql/boost_and_build.patch 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 --#include --#include --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 --#include --#include --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 -- 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 --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 --#include --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 48412ccc7..2a7f7f33d 100644 --- a/ports/libmysql/portfile.cmake +++ b/ports/libmysql/portfile.cmake @@ -1,70 +1,80 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mysql-server-mysql-5.7.16) - -if (EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql.h") - message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.") -endif() - -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/mysql/mysql-server/archive/mysql-5.7.16.tar.gz" - FILENAME "mysql-server-mysql-5.7.16.tar.gz" - SHA512 30a3c55ebb15f18ededf814b66c108f18b2ced9c39e08319cdc9559ccf38d494ad9322098f2b04418ddf557e46d9d727be0e514be0ae982ac4f5186aa295b9c6 -) -vcpkg_extract_source_archive(${ARCHIVE}) - -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch -) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} -) - -vcpkg_install_cmake() - -# delete debug headers -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/debug/include) - -# delete useless vcruntime/scripts/bin/msg file -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/debug/share - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin - ${CURRENT_PACKAGES_DIR}/lib/debug) - -file(MAKE_DIRECTORY - ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin) - -# remove misc files -file(REMOVE - ${CURRENT_PACKAGES_DIR}/COPYING - ${CURRENT_PACKAGES_DIR}/my-default.ini - ${CURRENT_PACKAGES_DIR}/README - ${CURRENT_PACKAGES_DIR}/debug/COPYING - ${CURRENT_PACKAGES_DIR}/debug/my-default.ini - ${CURRENT_PACKAGES_DIR}/debug/README) - -# remove mysqlclient.lib -file(REMOVE - ${CURRENT_PACKAGES_DIR}/lib/mysqlclient.lib - ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlclient.lib) - -# correct the dll directory -file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/bin/libmysql.dll) -file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.dll) -file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/bin/libmysql.pdb) -file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.pdb) - -# copy license -file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmysql) +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 (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 From a5b381f1789014db0b9030dddbf82c94799fecca Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 20 Jan 2017 14:38:14 -0800 Subject: [PATCH 03/40] [libmysql] Create bin\ and debug\bin\ directories (also make identation consistent) --- ports/libmysql/portfile.cmake | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ports/libmysql/portfile.cmake b/ports/libmysql/portfile.cmake index 2a7f7f33d..592482544 100644 --- a/ports/libmysql/portfile.cmake +++ b/ports/libmysql/portfile.cmake @@ -2,20 +2,20 @@ 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 + 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 + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/boost_and_build.patch ) vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DWITHOUT_SERVER=ON -DWITH_UNIT_TESTS=OFF @@ -51,12 +51,12 @@ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/README) # remove not-related libs -file (REMOVE - ${CURRENT_PACKAGES_DIR}/lib/mysqlservices.lib +file (REMOVE + ${CURRENT_PACKAGES_DIR}/lib/mysqlservices.lib ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlservices.lib) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libmysql.lib ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb @@ -67,8 +67,10 @@ 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) From 83dcda1e11ae12c9e56c7e4664f6d7f64f961ee6 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 20 Jan 2017 14:47:06 -0800 Subject: [PATCH 04/40] [lzo] Fix compiler error. Add support for non-static triplets. --- ports/lzo/do-not-declare-setargv.patch | 17 +++++++++++++++++ ports/lzo/portfile.cmake | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 ports/lzo/do-not-declare-setargv.patch 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 index a8a91e5e5..227ef7ee0 100644 --- a/ports/lzo/portfile.cmake +++ b/ports/lzo/portfile.cmake @@ -15,8 +15,24 @@ vcpkg_download_distfile(ARCHIVE ) vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/do-not-declare-setargv.patch" +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(ENABLE_STATIC ON) + set(ENABLE_SHARED OFF) +else() + set(ENABLE_STATIC OFF) + set(ENABLE_SHARED ON) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DENABLE_STATIC=${ENABLE_STATIC} + -DENABLE_SHARED=${ENABLE_SHARED} # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 # OPTIONS_RELEASE -DOPTIMIZE=1 # OPTIONS_DEBUG -DDEBUGGABLE=1 From ed8e7ca79dad5b7bcf716efe25d975571e8e8c05 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 20 Jan 2017 17:03:11 -0800 Subject: [PATCH 05/40] [lzo] Disable dynamic builds again due to library not having appropriate dllexport annotations. --- ports/lzo/portfile.cmake | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/ports/lzo/portfile.cmake b/ports/lzo/portfile.cmake index 227ef7ee0..6df36269c 100644 --- a/ports/lzo/portfile.cmake +++ b/ports/lzo/portfile.cmake @@ -6,6 +6,11 @@ # 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 @@ -20,19 +25,8 @@ vcpkg_apply_patches( PATCHES "${CMAKE_CURRENT_LIST_DIR}/do-not-declare-setargv.patch" ) -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - set(ENABLE_STATIC ON) - set(ENABLE_SHARED OFF) -else() - set(ENABLE_STATIC OFF) - set(ENABLE_SHARED ON) -endif() - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS - -DENABLE_STATIC=${ENABLE_STATIC} - -DENABLE_SHARED=${ENABLE_SHARED} # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 # OPTIONS_RELEASE -DOPTIMIZE=1 # OPTIONS_DEBUG -DDEBUGGABLE=1 @@ -40,6 +34,8 @@ vcpkg_configure_cmake( vcpkg_install_cmake() +vcpkg_copy_pdbs() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) From 919d8ea1ec449e17262c86838b2e74c44b695dea Mon Sep 17 00:00:00 2001 From: flysha Date: Mon, 23 Jan 2017 21:49:13 +0800 Subject: [PATCH 06/40] [mpir] enable static build --- ports/mpir/CONTROL | 4 +- ports/mpir/portfile.cmake | 126 ++++++++++++++++++++++---------------- 2 files changed, 75 insertions(+), 55 deletions(-) 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 a3a704407..a57c53328 100644 --- a/ports/mpir/portfile.cmake +++ b/ports/mpir/portfile.cmake @@ -1,53 +1,73 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2) -vcpkg_download_distfile(ARCHIVE_FILE - URLS "http://mpir.org/mpir-2.7.2.tar.lz" - FILENAME "mpir-2.7.2.tar.lz" - SHA512 2635c167ddbba99364ec741373768e0675d34f94fad8912d5433b95e6fbfdb0510f5e94a707acc42048254bc658c52c6671bb0c0dac31267c4b82b00c3e74efa -) -vcpkg_extract_source_archive(${ARCHIVE_FILE}) - -vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj -) - -IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") - SET(BUILD_ARCH "Win32") -ELSE() - SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) -ENDIF() - -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/gmp.h - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/gmpxx.h - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.h - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpirxx.h - DESTINATION ${CURRENT_PACKAGES_DIR}/include -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.dll - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.dll - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/bin -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib -) - -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright) - -vcpkg_copy_pdbs() -message(STATUS "Installing done") +include(vcpkg_common_functions) +set(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") From bb639bfa9c0b21fd7fa5dac3531657a03fbb2b7b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 12:53:18 -0800 Subject: [PATCH 07/40] [VS2017] Add powershell script to enumerator VS2017 instances --- .../findVisualStudioInstallationInstances.ps1 | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 scripts/findVisualStudioInstallationInstances.ps1 diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 new file mode 100644 index 000000000..1cb78fa9e --- /dev/null +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -0,0 +1,41 @@ +[CmdletBinding()] +param( + +) + +Import-Module BitsTransfer + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition +$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root + +$downloadsDir = "$vcpkgRootDir\downloads" + +& $scriptsDir\fetchDependency.ps1 "nuget" +$nugetexe = "$downloadsDir\nuget.exe" +$nugetPackageDir = "$downloadsDir\nuget-packages" + +$SetupAPIVersion = "1.3.269-rc" +$url = "https://api.nuget.org/packages/microsoft.visualstudio.setup.configuration.native.$SetupAPIVersion.nupkg" +$downloadName = "microsoft.visualstudio.setup.configuration.native.$SetupAPIVersion.nupkg" +$downloadPath = "$downloadsDir\$downloadName" + +if (!(Test-Path $downloadPath)) +{ + Start-BitsTransfer -Source $url -Destination $downloadPath #-ErrorAction SilentlyContinue +} + +$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Pre -Source $downloadsDir -OutputDirectory $nugetPackageDir 2>&1 + +$SetupConsoleExe = "$nugetPackageDir\Microsoft.VisualStudio.Setup.Configuration.Native.$SetupAPIVersion\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Console.exe" + +if (!(Test-Path $SetupConsoleExe)) +{ + throw $nugetOutput +} + +$consoleOutput = & $SetupConsoleExe 2>&1 + +$key = "InstallationPath = " +$paths = $consoleOutput | Select-String -SimpleMatch $key +$paths = $paths -replace $key, "" +return $paths \ No newline at end of file From e6c127511e213a136cd01a40ced59a2b12015428 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 12:54:03 -0800 Subject: [PATCH 08/40] [VS2017] Add powershell script to find any MSBuild with C++ support --- .../findAnyMSBuildWithCppPlatformToolset.ps1 | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scripts/findAnyMSBuildWithCppPlatformToolset.ps1 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 From 58aeb684429f107715a1b60500f8e24ea5a95f3c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 12:54:33 -0800 Subject: [PATCH 09/40] [VS2017] Enable building vcpkg itself with VS2017 --- scripts/bootstrap.ps1 | 5 ++++- toolsrc/vcpkg/vcpkg.vcxproj | 5 +---- toolsrc/vcpkgcommon/vcpkgcommon.vcxproj | 5 +---- toolsrc/vcpkglib/vcpkglib.vcxproj | 5 +---- toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj | 5 +---- toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj | 5 +---- toolsrc/vcpkgtest/vcpkgtest.vcxproj | 5 +---- 7 files changed, 10 insertions(+), 25 deletions(-) diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index bcb570b39..a37ed99aa 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -23,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 Write-Verbose("Placing vcpkg.exe in the correct location") diff --git a/toolsrc/vcpkg/vcpkg.vcxproj b/toolsrc/vcpkg/vcpkg.vcxproj index bcec048f5..15673e048 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj +++ b/toolsrc/vcpkg/vcpkg.vcxproj @@ -22,31 +22,28 @@ {34671B80-54F9-46F5-8310-AC429C11D4FB} vcpkg 8.1 + v140 Application true - v140 MultiByte Application false - v140 true MultiByte Application true - v140 MultiByte Application false - v140 true MultiByte diff --git a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj index c0d108602..2504a0227 100644 --- a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj +++ b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj @@ -22,31 +22,28 @@ {7129F242-F20C-43E7-BBEC-4E15B71890B2} vcpkgcommon 8.1 + v140 StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 10cc32935..561b22477 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -22,31 +22,28 @@ {B98C92B7-2874-4537-9D46-D14E5C237F04} vcpkglib 8.1 + v140 StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte diff --git a/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj b/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj index 7b7fe89ed..66cf52232 100644 --- a/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj +++ b/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj @@ -22,31 +22,28 @@ {7226078C-1D2A-4123-9EF1-8DF2B722B8F1} vcpkgmetrics 8.1 + v140 StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj index 1e2a85087..dc666c19e 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj @@ -22,31 +22,28 @@ {7D6FDEEB-B299-4A23-85EE-F67C4DED47BE} vcpkgmetricsuploader 8.1 + v140 Application true - v140 MultiByte Application false - v140 true MultiByte Application true - v140 MultiByte Application false - v140 true MultiByte diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index d14f86745..a68d77b46 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -38,19 +38,18 @@ Win32Proj vcpkgtest 8.1 + v140 DynamicLibrary true - v140 Unicode false DynamicLibrary false - v140 true Unicode false @@ -58,14 +57,12 @@ DynamicLibrary true - v140 Unicode false DynamicLibrary false - v140 true Unicode false From 6d3ab4579d50f74cbe43373fa16ba875a97a8717 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:12:43 -0800 Subject: [PATCH 10/40] [vcpkg_paths] Add "scripts" entry --- toolsrc/include/vcpkg_paths.h | 1 + toolsrc/src/vcpkg_paths.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index a2932070d..ba6defb9f 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -24,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/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp index b7e716307..39e4c8986 100644 --- a/toolsrc/src/vcpkg_paths.cpp +++ b/toolsrc/src/vcpkg_paths.cpp @@ -31,8 +31,9 @@ namespace vcpkg paths.ports = paths.root / "ports"; paths.installed = paths.root / "installed"; paths.triplets = paths.root / "triplets"; + paths.scripts = paths.root / "scripts"; - paths.buildsystems = paths.root / "scripts" / "buildsystems"; + paths.buildsystems = paths.scripts / "buildsystems"; paths.buildsystems_msbuild_targets = paths.buildsystems / "msbuild" / "vcpkg.targets"; paths.vcpkg_dir = paths.installed / "vcpkg"; @@ -40,7 +41,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; } From 3a6571a0191df8ff000384937a6254f378ca23cf Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:13:12 -0800 Subject: [PATCH 11/40] Add Strings::split() function --- toolsrc/include/vcpkg_Strings.h | 2 ++ toolsrc/src/vcpkg_Strings.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 28853cb5d..cb5d2334c 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -75,4 +75,6 @@ namespace vcpkg::Strings std::string trimmed(const std::string& s); void trim_all_and_remove_whitespace_strings(std::vector* strings); + + std::vector split(const std::string& s, const std::string& delimiter); } diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index cf7d3b0ee..16477a45c 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -119,4 +119,25 @@ namespace vcpkg::Strings return s == ""; }), strings->end()); } + + std::vector split(const std::string& s, const std::string& delimiter) + { + std::vector output; + + size_t i = 0; + size_t pos = s.find(delimiter); + while (pos != std::string::npos) + { + output.push_back(s.substr(i, pos - i)); + i = ++pos; + pos = s.find(delimiter, pos); + + if (pos == std::string::npos) + { + output.push_back(s.substr(i, s.length())); + } + } + + return output; + } } From 79a00367390dd974170b3abb5ad357d3db8ff5e3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:15:26 -0800 Subject: [PATCH 12/40] [VS2017] Add function do get dumpbin.exe --- toolsrc/include/vcpkg_Environment.h | 2 ++ toolsrc/src/vcpkg_Environment.cpp | 50 +++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 1e8624d89..64b2315b9 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -14,4 +14,6 @@ namespace vcpkg::Environment ensure_cmake_on_path(paths); ensure_git_on_path(paths); } + + const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); } diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index c7eec3bd0..1cbd60341 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -4,6 +4,7 @@ #include "vcpkg_Commands.h" #include "metrics.h" #include "vcpkg_System.h" +#include "vcpkg_Strings.h" namespace vcpkg::Environment { @@ -83,4 +84,53 @@ namespace vcpkg::Environment // 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 std::vector 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 fs::path find_dumpbin_exe(const vcpkg_paths& paths) + { + const std::vector vs2017_installation_instances = get_VS2017_installation_instances(paths); + std::vector paths_examined; + + // VS2017 + for (const std::string& instance : vs2017_installation_instances) + { + const fs::path dumpbin_path = Strings::format(R"(%s\VC\Tools\MSVC\14.10.24911\bin\HostX86\x86\dumpbin.exe)", instance); + paths_examined.push_back(dumpbin_path); + if (fs::exists(dumpbin_path)) + { + return dumpbin_path; + } + } + + // VS2015 + const fs::path vs2015_cmntools = fs::path(System::wdupenv_str(L"VS140COMNTOOLS")).parent_path(); // TODO: Check why this requires parent_path() call + const fs::path vs2015_dumpbin_exe = vs2015_cmntools.parent_path().parent_path() / "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(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; + } } From 9194f36a6c3ac873ca13a4be11745968ae1e263e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:24:31 -0800 Subject: [PATCH 13/40] [VS2017] Use Environment::get_dumpbin_exe() --- toolsrc/src/post_build_lint.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp index 1fca3a2f6..af76b7963 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/post_build_lint.cpp @@ -3,6 +3,7 @@ #include "vcpkg_Files.h" #include #include "vcpkg_System.h" +#include "vcpkg_Environment.h" #include "coff_file_reader.h" #include "BuildInfo.h" #include @@ -15,8 +16,6 @@ namespace vcpkg::PostBuildLint ERROR_DETECTED = 1 }; - static const fs::path DUMPBIN_EXE = R"(%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe)"; - static lint_status check_for_files_in_include_directory(const fs::path& package_dir) { const fs::path include_dir = package_dir / "include"; @@ -185,12 +184,12 @@ namespace vcpkg::PostBuildLint return lint_status::SUCCESS; } - static lint_status check_exports_of_dlls(const std::vector& dlls) + static lint_status check_exports_of_dlls(const std::vector& dlls, const fs::path& dumpbin_exe) { std::vector dlls_with_no_exports; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /exports "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /exports "%s")", dumpbin_exe.native(), dll.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -211,7 +210,7 @@ namespace vcpkg::PostBuildLint return lint_status::SUCCESS; } - static lint_status check_uwp_bit_of_dlls(const std::string& expected_system_name, const std::vector& dlls) + static lint_status check_uwp_bit_of_dlls(const std::string& expected_system_name, const std::vector& dlls, const fs::path dumpbin_exe) { if (expected_system_name != "uwp") { @@ -221,7 +220,7 @@ namespace vcpkg::PostBuildLint std::vector dlls_with_improper_uwp_bit; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s")", dumpbin_exe.native(), dll.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -459,7 +458,7 @@ namespace vcpkg::PostBuildLint BuildType build_type; }; - static lint_status check_crt_linkage_of_libs(const BuildType& expected_build_type, const std::vector& libs) + static lint_status check_crt_linkage_of_libs(const BuildType& expected_build_type, const std::vector& libs, const fs::path dumpbin_exe) { std::vector 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()); @@ -468,7 +467,7 @@ namespace vcpkg::PostBuildLint for (const fs::path& lib : libs) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /directives "%s")", DUMPBIN_EXE.native(), lib.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /directives "%s")", dumpbin_exe.native(), lib.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -505,7 +504,7 @@ namespace vcpkg::PostBuildLint OutdatedDynamicCrt outdated_crt; }; - static lint_status check_outdated_crt_linkage_of_dlls(const std::vector& dlls) + static lint_status check_outdated_crt_linkage_of_dlls(const std::vector& dlls, const fs::path dumpbin_exe) { const std::vector& outdated_crts = OutdatedDynamicCrt::values(); @@ -513,7 +512,7 @@ namespace vcpkg::PostBuildLint for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /dependents "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /dependents "%s")", dumpbin_exe.native(), dll.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -575,6 +574,8 @@ namespace vcpkg::PostBuildLint void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) { + const fs::path dumpbin_exe = Environment::get_dumpbin_exe(paths); + System::println("-- Performing post-build validation"); BuildInfo build_info = read_build_info(paths.build_info_file_path(spec)); @@ -623,11 +624,11 @@ namespace vcpkg::PostBuildLint dlls.insert(dlls.cend(), debug_dlls.cbegin(), debug_dlls.cend()); dlls.insert(dlls.cend(), release_dlls.cbegin(), release_dlls.cend()); - error_count += check_exports_of_dlls(dlls); - error_count += check_uwp_bit_of_dlls(spec.target_triplet().system(), dlls); + error_count += check_exports_of_dlls(dlls, dumpbin_exe); + error_count += check_uwp_bit_of_dlls(spec.target_triplet().system(), dlls, dumpbin_exe); error_count += check_dll_architecture(spec.target_triplet().architecture(), dlls); - error_count += check_outdated_crt_linkage_of_dlls(dlls); + error_count += check_outdated_crt_linkage_of_dlls(dlls, dumpbin_exe); break; } case LinkageType::STATIC: @@ -638,8 +639,8 @@ namespace vcpkg::PostBuildLint error_count += check_bin_folders_are_not_present_in_static_build(package_dir); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, linkage_type_value_of(build_info.crt_linkage)), debug_libs); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, linkage_type_value_of(build_info.crt_linkage)), release_libs); + 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: From 50d5e12390636137fedc1472872a4ae777bf1b2c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:30:04 -0800 Subject: [PATCH 14/40] [VS2017] Extract function that detects the VS2015 instance, when no VS2017 is found --- toolsrc/src/vcpkg_Environment.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 1cbd60341..00f7206e3 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -94,6 +94,13 @@ namespace vcpkg::Environment 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(); // TODO: Check why this requires parent_path() call + 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 vs2017_installation_instances = get_VS2017_installation_instances(paths); @@ -111,8 +118,7 @@ namespace vcpkg::Environment } // VS2015 - const fs::path vs2015_cmntools = fs::path(System::wdupenv_str(L"VS140COMNTOOLS")).parent_path(); // TODO: Check why this requires parent_path() call - const fs::path vs2015_dumpbin_exe = vs2015_cmntools.parent_path().parent_path() / "VC" / "bin" / "dumpbin.exe"; + 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)) { From 691f337bb3e56487911615a14cd06c86c029eb4b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 15:48:54 -0800 Subject: [PATCH 15/40] [VS2017] Don't depend on a specific MSVC dir name --- toolsrc/src/vcpkg_Environment.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 00f7206e3..0f4d4b60a 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -5,6 +5,7 @@ #include "metrics.h" #include "vcpkg_System.h" #include "vcpkg_Strings.h" +#include "vcpkg_Files.h" namespace vcpkg::Environment { @@ -109,11 +110,29 @@ namespace vcpkg::Environment // VS2017 for (const std::string& instance : vs2017_installation_instances) { - const fs::path dumpbin_path = Strings::format(R"(%s\VC\Tools\MSVC\14.10.24911\bin\HostX86\x86\dumpbin.exe)", instance); - paths_examined.push_back(dumpbin_path); - if (fs::exists(dumpbin_path)) + const fs::path msvc_path = Strings::format(R"(%s\VC\Tools\MSVC)", instance); + std::vector msvc_subdirectories; + Files::non_recursive_find_matching_paths_in_dir(msvc_path, [&](const fs::path& current) { - return dumpbin_path; + return fs::is_directory(current); + }, &msvc_subdirectories); + + Checks::check_exit(!msvc_subdirectories.empty(), "No subdirectories were found in %s", msvc_path.generic_string()); + + // 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 = Strings::format(R"(%s\bin\HostX86\x86\dumpbin.exe)", subdir.generic_string()); + paths_examined.push_back(dumpbin_path); + if (fs::exists(dumpbin_path)) + { + return dumpbin_path; + } } } From c1aca5d4adfe0fedd4636ffb488c6f22bbb33f81 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:02:02 -0800 Subject: [PATCH 16/40] Build path throuh fs::path APIs instead of Strings::format() --- toolsrc/src/vcpkg_Environment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 0f4d4b60a..f6bcd3088 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -127,7 +127,7 @@ namespace vcpkg::Environment for (const fs::path& subdir : msvc_subdirectories) { - const fs::path dumpbin_path = Strings::format(R"(%s\bin\HostX86\x86\dumpbin.exe)", subdir.generic_string()); + const fs::path dumpbin_path = subdir / "bin" / "HostX86" / "x86" / "dumpbin.exe"; paths_examined.push_back(dumpbin_path); if (fs::exists(dumpbin_path)) { From a532b949073a14303cf3092d6b8d83a9e4ee8577 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:04:43 -0800 Subject: [PATCH 17/40] Formatting --- toolsrc/src/vcpkg_Environment.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index f6bcd3088..3efcfb872 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -113,17 +113,17 @@ namespace vcpkg::Environment const fs::path msvc_path = Strings::format(R"(%s\VC\Tools\MSVC)", instance); std::vector msvc_subdirectories; Files::non_recursive_find_matching_paths_in_dir(msvc_path, [&](const fs::path& current) - { - return fs::is_directory(current); - }, &msvc_subdirectories); + { + return fs::is_directory(current); + }, &msvc_subdirectories); Checks::check_exit(!msvc_subdirectories.empty(), "No subdirectories were found in %s", msvc_path.generic_string()); // 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(); - }); + { + return left.filename() > right.filename(); + }); for (const fs::path& subdir : msvc_subdirectories) { From e0e3f6ac21d074b0c043e9d6a2aff769930f07a7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:15:30 -0800 Subject: [PATCH 18/40] [VS2017] Add function to get vcvarsall.bat --- toolsrc/include/vcpkg_Environment.h | 2 ++ toolsrc/src/vcpkg_Environment.cpp | 39 +++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 64b2315b9..9161f7ce5 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -16,4 +16,6 @@ namespace vcpkg::Environment } const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); + + const fs::path& get_vcvarsall_bat(const vcpkg_paths& paths); } diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 3efcfb872..54541bd45 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -158,4 +158,43 @@ namespace vcpkg::Environment static const fs::path dumpbin_exe = find_dumpbin_exe(paths); return dumpbin_exe; } + + static fs::path find_vcvarsall_bat(const vcpkg_paths& paths) + { + const std::vector vs2017_installation_instances = get_VS2017_installation_instances(paths); + std::vector 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; + } + } + + // 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; + } + + 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(path.generic_string()); + } + exit(EXIT_FAILURE); + } + + const fs::path& get_vcvarsall_bat(const vcpkg_paths& paths) + { + static const fs::path vcvarsall_bat = find_vcvarsall_bat(paths); + return vcvarsall_bat; + } } From 127fbe20263302ee2d877dcfedcf853d0415ce2f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:16:19 -0800 Subject: [PATCH 19/40] [VS2017] Use Environment::get_vcvarsall_bat() --- toolsrc/src/commands_build.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 72ebb264b..af1b3dc24 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -30,7 +30,9 @@ namespace vcpkg::Commands::Build const triplet& target_triplet = spec.target_triplet(); const fs::path ports_cmake_script_path = paths.ports_cmake; - const std::wstring command = Strings::wformat(LR"("%%VS140COMNTOOLS%%..\..\VC\vcvarsall.bat" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", + const fs::path vcvarsall_bat = Environment::get_vcvarsall_bat(paths); + const std::wstring command = Strings::wformat(LR"("%s" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", + vcvarsall_bat.native(), Strings::utf8_to_utf16(target_triplet.architecture()), Strings::utf8_to_utf16(source_paragraph.name), Strings::utf8_to_utf16(target_triplet.canonical_name()), From 612d2041214e90d242a5cad9bcf8b2b52357685d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:37:03 -0800 Subject: [PATCH 20/40] Remove check for empty MSVC dir. --- toolsrc/src/vcpkg_Environment.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 54541bd45..de17158b4 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -117,8 +117,6 @@ namespace vcpkg::Environment return fs::is_directory(current); }, &msvc_subdirectories); - Checks::check_exit(!msvc_subdirectories.empty(), "No subdirectories were found in %s", msvc_path.generic_string()); - // Sort them so that latest comes first std::sort(msvc_subdirectories.begin(), msvc_subdirectories.end(), [&](const fs::path& left, const fs::path& right) { From a4b419dc7b6fd533904b5c702053c4a871f72629 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:39:05 -0800 Subject: [PATCH 21/40] Add comment about trailing backslash in VS140COMNTOOLS --- toolsrc/src/vcpkg_Environment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index de17158b4..709627878 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -97,7 +97,7 @@ namespace vcpkg::Environment static const fs::path& get_VS2015_installation_instance() { - static const fs::path vs2015_cmntools = fs::path(System::wdupenv_str(L"VS140COMNTOOLS")).parent_path(); // TODO: Check why this requires parent_path() call + 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; } From ac2f2cb478bba52c247ccdab13b9c5ad15cd4947 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:46:58 -0800 Subject: [PATCH 22/40] Strings::split() now handles trailing delimiters --- toolsrc/src/vcpkg_Strings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index 16477a45c..e53cfa1ef 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -132,7 +132,7 @@ namespace vcpkg::Strings i = ++pos; pos = s.find(delimiter, pos); - if (pos == std::string::npos) + if (pos == std::string::npos && i != s.length()) // The second check is so no items are added if there is nothing after the last delimiter { output.push_back(s.substr(i, s.length())); } From 5d603cbae259e492b8ff034a748573d3f680e7c7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 16:50:29 -0800 Subject: [PATCH 23/40] Improve Strings::split() --- toolsrc/src/vcpkg_Strings.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index e53cfa1ef..b974b0a06 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -125,17 +125,16 @@ namespace vcpkg::Strings std::vector output; size_t i = 0; - size_t pos = s.find(delimiter); - while (pos != std::string::npos) + 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; - pos = s.find(delimiter, pos); + } - if (pos == std::string::npos && i != s.length()) // The second check is so no items are added if there is nothing after the last delimiter - { - output.push_back(s.substr(i, s.length())); - } + // 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; From 522b393901638c3abfc89ff63085ec64367c7671 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 17:02:43 -0800 Subject: [PATCH 24/40] Bump version of required CMake to 3.7.2 --- scripts/fetchDependency.ps1 | 30 +++++++++++++++--------------- toolsrc/src/vcpkg_Environment.cpp | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 2f3d992ba..7e8e1d32c 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) { @@ -86,10 +86,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 +99,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,12 +120,12 @@ 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" + $downloadName = "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") @@ -146,7 +146,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $downloadName = "PortableGit-2.8.3-32-bit.7z.exe" $expectedDownloadedFileHash = "DE52D070219E9C4EC1DB179F2ADBF4B760686C3180608F0382A1F8C7031E72AD" # There is another copy of git.exe in PortableGit\bin. However, an installed version of git add the cmd dir to the PATH. - # Therefore, choosing the cmd dir here as well. + # Therefore, choosing the cmd dir here as well. $executableFromDownload = "$downloadsDir\PortableGit\cmd\git.exe" $extractionType = $ExtractionType_SELF_EXTRACTING_7Z } @@ -186,7 +186,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if (-not (Test-Path $executableFromDownload)) { Invoke-Command $downloadPath "-y" -waitForExit:$true - } + } } else { diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 709627878..e1eb22969 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -63,7 +63,7 @@ namespace vcpkg::Environment void ensure_cmake_on_path(const vcpkg_paths& paths) { - const fs::path downloaded_cmake = paths.downloads / "cmake-3.5.2-win32-x86" / "bin"; + const 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"), @@ -71,7 +71,7 @@ namespace vcpkg::Environment default_cmake_installation_dir_x86.native()); _wputenv_s(L"PATH", path_buf.c_str()); - static constexpr std::array cmake_version = {3,5,0}; + static constexpr std::array cmake_version = {3,7,2}; // 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"); } From 4e86b01a36cba7a1e1b883a8d62a6f68c2b6e030 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 17:24:34 -0800 Subject: [PATCH 25/40] [Environemnt] Don't depend on present working dir --- toolsrc/src/vcpkg_Environment.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index e1eb22969..22a9252b0 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -14,7 +14,7 @@ namespace vcpkg::Environment 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& version, const wchar_t* version_check_cmd, const wchar_t* install_cmd) + static void ensure_on_path(const std::array& 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) @@ -57,8 +57,11 @@ namespace vcpkg::Environment _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array git_version = {2,0,0}; + static const std::wstring version_check_cmd = L"git --version 2>&1"; + const fs::path script = paths.scripts / "fetchDependency.ps1"; // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(git_version, L"git --version 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency git"); + const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency git", script.native()); + ensure_on_path(git_version, version_check_cmd, install_cmd); } void ensure_cmake_on_path(const vcpkg_paths& paths) @@ -72,8 +75,11 @@ namespace vcpkg::Environment _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array cmake_version = {3,7,2}; + static const std::wstring version_check_cmd = L"cmake --version 2>&1"; + const fs::path script = paths.scripts / "fetchDependency.ps1"; // 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"); + const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency cmake", script.native()); + ensure_on_path(cmake_version, version_check_cmd, install_cmd); } void ensure_nuget_on_path(const vcpkg_paths& paths) @@ -82,8 +88,11 @@ namespace vcpkg::Environment _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array nuget_version = {1,0,0}; + static const std::wstring version_check_cmd = L"nuget 2>&1"; + const fs::path script = paths.scripts / "fetchDependency.ps1"; // 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"); + const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency nuget", script.native()); + ensure_on_path(nuget_version, version_check_cmd, install_cmd); } static std::vector get_VS2017_installation_instances(const vcpkg_paths& paths) From d9f770ad8d6010a09d6be2ec9a262fc6ce074267 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 17:28:20 -0800 Subject: [PATCH 26/40] Improve comment --- toolsrc/src/vcpkg_Environment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 22a9252b0..aaa6bb106 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -106,7 +106,7 @@ namespace vcpkg::Environment 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_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; } From 44810f267d095986f519d8b41592e83e913c2e56 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 23 Jan 2017 18:26:57 -0800 Subject: [PATCH 27/40] [vcpkg integrate] Lower verbosity of MSBuild messages. --- scripts/buildsystems/msbuild/vcpkg.targets | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index 912cf6b8e..26a524ca3 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -57,12 +57,14 @@ Lines="^$(OutputPath)$(TargetName).$(OutputType);" Encoding="Unicode"/> + ConsoleToMSBuild="true" + StandardOutputImportance="Normal"> + ConsoleToMSBuild="true" + StandardOutputImportance="Normal"> From 64bcc326fb98a7ae8249cc50b6305166e8f3ac89 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 17:49:41 -0800 Subject: [PATCH 28/40] Improve format of output error messages --- toolsrc/src/vcpkg_Environment.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index aaa6bb106..b6705cc47 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -155,7 +155,7 @@ namespace vcpkg::Environment System::println("The following paths were examined:"); for (const fs::path& path : paths_examined) { - System::println(path.generic_string()); + System::println(" %s", path.generic_string()); } exit(EXIT_FAILURE); } @@ -194,7 +194,7 @@ namespace vcpkg::Environment System::println("The following paths were examined:"); for (const fs::path& path : paths_examined) { - System::println(path.generic_string()); + System::println(" %s",path.generic_string()); } exit(EXIT_FAILURE); } From 2670075bf202529aa23b6c278b589e3c0541076e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 18:36:22 -0800 Subject: [PATCH 29/40] Extract method --- toolsrc/src/vcpkg_Environment.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index b6705cc47..76aa07fb6 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -46,6 +46,13 @@ namespace vcpkg::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"; @@ -58,9 +65,7 @@ namespace vcpkg::Environment static constexpr std::array git_version = {2,0,0}; static const std::wstring version_check_cmd = L"git --version 2>&1"; - const fs::path script = paths.scripts / "fetchDependency.ps1"; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency git", script.native()); + const std::wstring install_cmd = create_default_install_cmd(paths, L"git"); ensure_on_path(git_version, version_check_cmd, install_cmd); } @@ -76,9 +81,7 @@ namespace vcpkg::Environment static constexpr std::array cmake_version = {3,7,2}; static const std::wstring version_check_cmd = L"cmake --version 2>&1"; - const fs::path script = paths.scripts / "fetchDependency.ps1"; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency cmake", script.native()); + const std::wstring install_cmd = create_default_install_cmd(paths, L"cmake"); ensure_on_path(cmake_version, version_check_cmd, install_cmd); } @@ -89,9 +92,7 @@ namespace vcpkg::Environment static constexpr std::array nuget_version = {1,0,0}; static const std::wstring version_check_cmd = L"nuget 2>&1"; - const fs::path script = paths.scripts / "fetchDependency.ps1"; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency nuget", script.native()); + const std::wstring install_cmd = create_default_install_cmd(paths, L"nuget"); ensure_on_path(nuget_version, version_check_cmd, install_cmd); } From 868a7623addee16f19b17718163b7719c4d739e2 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 18:42:34 -0800 Subject: [PATCH 30/40] Bump nuget.exe version --- scripts/fetchDependency.ps1 | 8 ++++---- toolsrc/src/vcpkg_Environment.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 7e8e1d32c..eedfb15d1 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -130,11 +130,11 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) } 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" + $requiredVersion = "3.3.0" + $downloadVersion = "3.5.0" + $url = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe" $downloadName = "nuget.exe" - $expectedDownloadedFileHash = "3B1EA72943968D7AF6BACDB4F2F3A048A25AFD14564EF1D8B1C041FDB09EBB0A" + $expectedDownloadedFileHash = "399ec24c26ed54d6887cde61994bb3d1cada7956c1b19ff880f06f060c039918" $executableFromDownload = "$downloadsDir\nuget.exe" $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED } diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 76aa07fb6..1a50a604a 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -90,7 +90,7 @@ namespace vcpkg::Environment const std::wstring path_buf = Strings::wformat(L"%s;%s", paths.downloads.native(), System::wdupenv_str(L"PATH")); _wputenv_s(L"PATH", path_buf.c_str()); - static constexpr std::array nuget_version = {1,0,0}; + static constexpr std::array 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); From 7c9db95feccf6e9d01d2e1af6c7012685d8e46b6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 18:47:38 -0800 Subject: [PATCH 31/40] Bump downloaded git version --- scripts/fetchDependency.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index eedfb15d1..e1ef184ab 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -141,10 +141,10 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) 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 + $downloadName = "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. $executableFromDownload = "$downloadsDir\PortableGit\cmd\git.exe" From 93c3c0648a782b1fa75bae1f200beca6ba871f9a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 19:25:47 -0800 Subject: [PATCH 32/40] [VS2017] Enable building with v141 toolset --- scripts/cmake/vcpkg_configure_cmake.cmake | 27 +++++++++++++++++------ toolsrc/include/vcpkg_Environment.h | 8 ++++++- toolsrc/src/commands_build.cpp | 7 +++--- toolsrc/src/vcpkg_Environment.cpp | 10 ++++----- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 179703172..128782075 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -4,20 +4,33 @@ function(vcpkg_configure_cmake) if(_csc_GENERATOR) set(GENERATOR ${_csc_GENERATOR}) - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" 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(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 ARM") # elseif(NOT vcpkg_configure_cmake_NINJA MATCHES "NOTFOUND") # set(GENERATOR "Ninja") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") - set(GENERATOR "Visual Studio 14 2015 ARM") + set(GENERATOR "Visual Studio 14 2015 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 Win64") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 ARM") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 Win64") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") + set(GENERATOR "Visual Studio 15 2017 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") endif() file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) @@ -33,7 +46,7 @@ function(vcpkg_configure_cmake) elseif(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL static) list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=OFF) endif() - + list(APPEND _csc_OPTIONS "-DCMAKE_CXX_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc" diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 9161f7ce5..e4dd47472 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -17,5 +17,11 @@ namespace vcpkg::Environment const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); - const fs::path& get_vcvarsall_bat(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/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index af1b3dc24..d9d5d2107 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -30,12 +30,13 @@ namespace vcpkg::Commands::Build const triplet& target_triplet = spec.target_triplet(); const fs::path ports_cmake_script_path = paths.ports_cmake; - const fs::path vcvarsall_bat = Environment::get_vcvarsall_bat(paths); - const std::wstring command = Strings::wformat(LR"("%s" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", - vcvarsall_bat.native(), + const Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths); + const std::wstring command = Strings::wformat(LR"("%s" %s && 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()); diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 1a50a604a..c204bfaf4 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -167,7 +167,7 @@ namespace vcpkg::Environment return dumpbin_exe; } - static fs::path find_vcvarsall_bat(const vcpkg_paths& paths) + static vcvarsall_and_platform_toolset find_vcvarsall_bat(const vcpkg_paths& paths) { const std::vector vs2017_installation_instances = get_VS2017_installation_instances(paths); std::vector paths_examined; @@ -179,7 +179,7 @@ namespace vcpkg::Environment paths_examined.push_back(vcvarsall_bat); if (fs::exists(vcvarsall_bat)) { - return vcvarsall_bat; + return { vcvarsall_bat , L"v141"}; } } @@ -188,7 +188,7 @@ namespace vcpkg::Environment paths_examined.push_back(vs2015_vcvarsall_bat); if (fs::exists(vs2015_vcvarsall_bat)) { - return vs2015_vcvarsall_bat; + return { vs2015_vcvarsall_bat, L"v140" }; } System::println(System::color::error, "Could not detect vccarsall.bat."); @@ -200,9 +200,9 @@ namespace vcpkg::Environment exit(EXIT_FAILURE); } - const fs::path& get_vcvarsall_bat(const vcpkg_paths& paths) + const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths) { - static const fs::path vcvarsall_bat = find_vcvarsall_bat(paths); + static const vcvarsall_and_platform_toolset vcvarsall_bat = find_vcvarsall_bat(paths); return vcvarsall_bat; } } From ab33a7fd49904b5a4ff25af6f87d32ddf15fcd6c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 23 Jan 2017 19:56:07 -0800 Subject: [PATCH 33/40] Update CHANGELOG and bump version to v0.0.70 --- CHANGELOG.md | 21 +++++++++++++++++++++ toolsrc/VERSION.txt | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 103417bad..3380cd074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +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 MON, 23 Jan 2017 19:50:00 -0800 + + vcpkg (0.0.67) -------------- * Add ports: diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 8afb66b09..1759b863b 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.67" \ No newline at end of file +"0.0.70" \ No newline at end of file From ccda20a8584a9fcc89c4dd631e5ef8d4189f1131 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 24 Jan 2017 12:01:11 -0800 Subject: [PATCH 34/40] Remove $downloadName variable --- scripts/fetchDependency.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index e1ef184ab..9269dba8c 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -123,7 +123,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $requiredVersion = "3.7.2" $downloadVersion = "3.7.2" $url = "https://cmake.org/files/v3.7/cmake-3.7.2-win32-x86.zip" - $downloadName = "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 @@ -133,7 +133,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $requiredVersion = "3.3.0" $downloadVersion = "3.5.0" $url = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe" - $downloadName = "nuget.exe" + $downloadPath = "$downloadsDir\nuget.exe" $expectedDownloadedFileHash = "399ec24c26ed54d6887cde61994bb3d1cada7956c1b19ff880f06f060c039918" $executableFromDownload = "$downloadsDir\nuget.exe" $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED @@ -143,7 +143,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $requiredVersion = "2.0.0" $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 - $downloadName = "PortableGit-2.11.0.3-32-bit.7z.exe" + $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. @@ -155,7 +155,6 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) throw "Unknown program requested" } - $downloadPath = "$downloadsDir\$downloadName" performDownload $Dependency $url $downloadsDir $downloadPath $downloadVersion $requiredVersion #calculating the hash From d5e7a501e907f06ad1e8bb4ffdebce9a29179d2d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 24 Jan 2017 12:30:14 -0800 Subject: [PATCH 35/40] Download nuget.exe in a version-including subfolder in Downloads\ --- scripts/fetchDependency.ps1 | 10 ++++++++-- toolsrc/src/vcpkg_Environment.cpp | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 9269dba8c..d05d16bea 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -133,9 +133,9 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $requiredVersion = "3.3.0" $downloadVersion = "3.5.0" $url = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe" - $downloadPath = "$downloadsDir\nuget.exe" + $downloadPath = "$downloadsDir\nuget-3.5.0\nuget.exe" $expectedDownloadedFileHash = "399ec24c26ed54d6887cde61994bb3d1cada7956c1b19ff880f06f060c039918" - $executableFromDownload = "$downloadsDir\nuget.exe" + $executableFromDownload = $downloadPath $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED } elseif($Dependency -eq "git") @@ -155,6 +155,12 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) throw "Unknown program requested" } + $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 diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index c204bfaf4..66d33edeb 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -87,7 +87,8 @@ namespace vcpkg::Environment 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 nuget_version = {3,3,0}; From d96f56736e9696248584506f364ee31acf12ddc3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 24 Jan 2017 12:32:03 -0800 Subject: [PATCH 36/40] Fix path to nuget.exe --- scripts/findVisualStudioInstallationInstances.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index 1cb78fa9e..241b05bc1 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -11,7 +11,7 @@ $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root $downloadsDir = "$vcpkgRootDir\downloads" & $scriptsDir\fetchDependency.ps1 "nuget" -$nugetexe = "$downloadsDir\nuget.exe" +$nugetexe = "$downloadsDir\nuget-3.5.0\nuget.exe" $nugetPackageDir = "$downloadsDir\nuget-packages" $SetupAPIVersion = "1.3.269-rc" From f2ac7a32aaf9e0f374cf3025f6f86561780951eb Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 24 Jan 2017 12:36:46 -0800 Subject: [PATCH 37/40] FetchDependency.ps1 now returns the downloaded exe's path --- scripts/fetchDependency.ps1 | 2 ++ scripts/findVisualStudioInstallationInstances.ps1 | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index d05d16bea..b56bf1087 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -202,6 +202,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/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index 241b05bc1..d5faa57d3 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -10,8 +10,7 @@ $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root $downloadsDir = "$vcpkgRootDir\downloads" -& $scriptsDir\fetchDependency.ps1 "nuget" -$nugetexe = "$downloadsDir\nuget-3.5.0\nuget.exe" +$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" $nugetPackageDir = "$downloadsDir\nuget-packages" $SetupAPIVersion = "1.3.269-rc" From e3c3497dbc03607492f38e54122106bc8f00ca20 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 24 Jan 2017 14:12:27 -0800 Subject: [PATCH 38/40] Suppress VS2017's vcvarsall.bat output --- toolsrc/src/commands_build.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index d9d5d2107..e7e005100 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -31,7 +31,7 @@ namespace vcpkg::Commands::Build 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 && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s -DVCPKG_PLATFORM_TOOLSET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", + 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), From c09e6ff69ac353cee7538d073e9c35dfef392836 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 24 Jan 2017 14:55:07 -0800 Subject: [PATCH 39/40] [wt] Suppress reliance on boost autolinking Fixes #558 --- ports/wt/CONTROL | 2 +- .../add-disable-boost-autolink-option.patch | 26 +++++++++++++++++++ ports/wt/portfile.cmake | 10 +++++-- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 ports/wt/add-disable-boost-autolink-option.patch diff --git a/ports/wt/CONTROL b/ports/wt/CONTROL index fc71d9aaf..1a89dd378 100644 --- a/ports/wt/CONTROL +++ b/ports/wt/CONTROL @@ -1,4 +1,4 @@ Source: wt -Version: 3.3.6 +Version: 3.3.6-2 Description: Wt is a C++ library for developing web applications Build-Depends: boost, openssl diff --git a/ports/wt/add-disable-boost-autolink-option.patch b/ports/wt/add-disable-boost-autolink-option.patch new file mode 100644 index 000000000..57cb3ed99 --- /dev/null +++ b/ports/wt/add-disable-boost-autolink-option.patch @@ -0,0 +1,26 @@ +diff --git a/cmake/WtFindBoost-cmake.txt b/cmake/WtFindBoost-cmake.txt +index b66741f..377cede 100644 +--- a/cmake/WtFindBoost-cmake.txt ++++ b/cmake/WtFindBoost-cmake.txt +@@ -99,7 +99,7 @@ IF (Boost_FOUND) + SET(BOOST_WTHTTP_MT_FOUND TRUE) + SET(BOOST_WTHTTP_FOUND TRUE) + +- IF(MSVC) ++ IF(MSVC AND NOT DISABLE_BOOST_AUTOLINK) + # use autolink + SET(BOOST_WT_LIBRARIES "") + SET(BOOST_WTHTTP_LIBRARIES "") +diff --git a/src/wt/Dbo/CMakeLists.txt b/src/wt/Dbo/CMakeLists.txt +index 64d3af2..f9c31e0 100644 +--- a/src/wt/Dbo/CMakeLists.txt ++++ b/src/wt/Dbo/CMakeLists.txt +@@ -31,7 +31,7 @@ IF(ENABLE_LIBWTDBO) + StringStream.C + ) + +- IF(MSVC) ++ IF(MSVC AND NOT DISABLE_BOOST_AUTOLINK) + #win32 links automatically against boost libs; specifying too much causes + #trouble + IF(MULTI_THREADED_BUILD) diff --git a/ports/wt/portfile.cmake b/ports/wt/portfile.cmake index 66b1d5a33..f762eface 100644 --- a/ports/wt/portfile.cmake +++ b/ports/wt/portfile.cmake @@ -8,9 +8,13 @@ vcpkg_download_distfile(ARCHIVE_FILE ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) -file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-disable-boost-autolink-option.patch +) + vcpkg_configure_cmake( -SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DSHARED_LIBS=ON -DENABLE_SSL=ON @@ -20,6 +24,8 @@ SOURCE_PATH ${SOURCE_PATH} -DENABLE_MYSQL=OFF -DENABLE_QT4=OFF -DBOOST_DYNAMIC=ON + -DDISABLE_BOOST_AUTOLINK=ON + -DENABLE_LIBWTTEST=OFF ) vcpkg_install_cmake() From 33ce94a4565ce68cd02cacda221fccbd756d3949 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 24 Jan 2017 15:17:45 -0800 Subject: [PATCH 40/40] [vcpkg integrate] Exit silently if target cannot be found. --- scripts/buildsystems/msbuild/applocal.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1 index 46981fad5..55680c1f6 100644 --- a/scripts/buildsystems/msbuild/applocal.ps1 +++ b/scripts/buildsystems/msbuild/applocal.ps1 @@ -2,7 +2,14 @@ param([string]$targetBinary, [string]$installedDir, [string]$tlogFile) function resolve($targetBinary) { - $targetBinaryPath = Resolve-Path $targetBinary + try + { + $targetBinaryPath = Resolve-Path $targetBinary -erroraction stop + } + catch [System.Management.Automation.ItemNotFoundException] + { + return + } $targetBinaryDir = Split-Path $targetBinaryPath -parent $a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" })