diff options
| author | Phil Christensen <philc@microsoft.com> | 2018-12-12 11:28:42 -0800 |
|---|---|---|
| committer | Phil Christensen <philc@microsoft.com> | 2018-12-12 11:28:42 -0800 |
| commit | af2a3b54aa520b778562eb3a347ec1cf027c0859 (patch) | |
| tree | ed97819282b8d479154b315a9885b9843c9b0332 | |
| parent | 666cc9cee23c11ade0471a59a52afc3f7f8754c0 (diff) | |
| parent | 1d5e22919fcfeba3fe513248e73395c42ac18ae4 (diff) | |
| download | vcpkg-af2a3b54aa520b778562eb3a347ec1cf027c0859.tar.gz vcpkg-af2a3b54aa520b778562eb3a347ec1cf027c0859.zip | |
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/philc/4958
| -rw-r--r-- | docs/users/config-environment.md | 42 | ||||
| -rw-r--r-- | ports/libiconv/CMakeLists.txt | 59 | ||||
| -rw-r--r-- | ports/libiconv/CONTROL | 2 | ||||
| -rw-r--r-- | ports/libiconv/portfile.cmake | 25 | ||||
| -rw-r--r-- | scripts/bootstrap.sh | 37 | ||||
| -rw-r--r-- | scripts/toolchains/linux.cmake | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/tools.cpp | 10 |
8 files changed, 142 insertions, 41 deletions
diff --git a/docs/users/config-environment.md b/docs/users/config-environment.md new file mode 100644 index 000000000..103c1c547 --- /dev/null +++ b/docs/users/config-environment.md @@ -0,0 +1,42 @@ +## Environment and Configuration
+
+### Environment Variables
+
+#### VCPKG_DOWNLOADS
+
+This environment variable can be set to an existing directory to use for storing downloads instead of the internal
+`downloads/` directory. It should always be set to an absolute path.
+
+#### VCPKG_FEATURE_FLAGS
+
+This environment variable can be set to a comma-separated list of off-by-default features in vcpkg. These features are
+subject to change without notice and should be considered highly unstable.
+
+Non-exhaustive list of off-by-default features:
+
+- `binarycaching`
+
+#### EDITOR
+
+This environment variable can be set to the full path of an executable to be used for `vcpkg edit`. Please see
+`vcpkg help edit` for command-specific help.
+
+#### VCPKG_ROOT
+
+This environment variable can be set to a directory to use as the root of the vcpkg instance. Note that mixing vcpkg
+repo versions and executable versions can cause issues.
+
+#### VCPKG_DEFAULT_VS_PATH
+
+This environment variable can be set to the full path to a Visual Studio instance on the machine. This Visual Studio instance
+will be used if the triplet does not override it via the [`VCPKG_VISUAL_STUDIO_PATH` triplet setting](triplets.md#VCPKG_VISUAL_STUDIO_PATH).
+
+Example: `D:\2017`
+
+#### VCPKG_DEFAULT_TRIPLET
+
+This environment variable can be set to a triplet name which will be used for unqualified triplet references in command lines.
+
+#### VCPKG_FORCE_SYSTEM_BINARIES
+
+This environment variable, if set, suppresses the downloading of CMake and Ninja and forces the use of the system binaries.
diff --git a/ports/libiconv/CMakeLists.txt b/ports/libiconv/CMakeLists.txt index 95071be9d..3c2a6125c 100644 --- a/ports/libiconv/CMakeLists.txt +++ b/ports/libiconv/CMakeLists.txt @@ -6,24 +6,47 @@ if(BUILD_SHARED_LIBS) else() set(LIBICONV_DYNAMIC "0 /*LIBICONV_DYNAMIC*/") endif() -set(HAVE_WCHAR_T "1 /*HAVE_WCHAR_T*/") -set(USE_MBSTATE_T "0 /*USE_MBSTATE_T*/") -set(BROKEN_WCHAR_H "0 /*BROKEN_WCHAR_H*/") -set(HAVE_VISIBILITY "0 /*HAVE_VISIBILITY*/") - -configure_file(config.h.in config.h) -file(READ "${CMAKE_CURRENT_BINARY_DIR}/config.h" _contents) -string(REPLACE "#undef HAVE_WORKING_O_NOFOLLOW" "#define HAVE_WORKING_O_NOFOLLOW 0" _contents "${_contents}") -string(REPLACE "#undef HAVE_MBRTOWC" "#define HAVE_MBRTOWC 1" _contents "${_contents}") -string(REPLACE "#undef HAVE_MBSINIT" "#define HAVE_MBSINIT 1" _contents "${_contents}") -string(REPLACE "#undef HAVE_WCRTOMB" "#define HAVE_WCRTOMB 1" _contents "${_contents}") -string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" _contents "${_contents}") -string(REPLACE "#undef EILSEQ" "" _contents "${_contents}") -string(REPLACE "#undef WORDS_LITTLEENDIAN" "#define WORDS_LITTLEENDIAN 1" _contents "${_contents}") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "${_contents}") - -configure_file(libcharset/include/localcharset.h.build.in localcharset.h) -configure_file(include/iconv.h.build.in iconv.h) + +set(CMAKE_STATIC_LIBRARY_PREFIX) +set(CMAKE_SHARED_LIBRARY_PREFIX) + +if(WIN32) + set(HAVE_WCHAR_T "1 /*HAVE_WCHAR_T*/") + set(USE_MBSTATE_T "0 /*USE_MBSTATE_T*/") + set(BROKEN_WCHAR_H "0 /*BROKEN_WCHAR_H*/") + set(HAVE_VISIBILITY "0 /*HAVE_VISIBILITY*/") + + configure_file(config.h.in config.h) + file(READ "${CMAKE_CURRENT_BINARY_DIR}/config.h" _contents) + string(REPLACE "#undef HAVE_WORKING_O_NOFOLLOW" "#define HAVE_WORKING_O_NOFOLLOW 0" _contents "${_contents}") + string(REPLACE "#undef HAVE_MBRTOWC" "#define HAVE_MBRTOWC 1" _contents "${_contents}") + string(REPLACE "#undef HAVE_MBSINIT" "#define HAVE_MBSINIT 1" _contents "${_contents}") + string(REPLACE "#undef HAVE_WCRTOMB" "#define HAVE_WCRTOMB 1" _contents "${_contents}") + string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" _contents "${_contents}") + string(REPLACE "#undef EILSEQ" "" _contents "${_contents}") + string(REPLACE "#undef WORDS_LITTLEENDIAN" "#define WORDS_LITTLEENDIAN 1" _contents "${_contents}") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.h" "${_contents}") + + configure_file(libcharset/include/localcharset.h.build.in localcharset.h) + configure_file(include/iconv.h.build.in iconv.h) +else() + if(BUILD_SHARED_LIBS) + set(STATIC_SHARED --enable-shared --disable-static) + else() + set(STATIC_SHARED --disable-shared --enable-static) + endif() + + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/autoconf) + + execute_process( + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure --enable-relocatable ${STATIC_SHARED} --without-libiconv-prefix --without-libintl-prefix + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/autoconf + ) + + configure_file(${CMAKE_CURRENT_BINARY_DIR}/autoconf/config.h config.h @ONLY) + configure_file(${CMAKE_CURRENT_BINARY_DIR}/autoconf/include/iconv.h iconv.h @ONLY) + configure_file(${CMAKE_CURRENT_BINARY_DIR}/autoconf/libcharset/include/localcharset.h localcharset.h @ONLY) +endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/ports/libiconv/CONTROL b/ports/libiconv/CONTROL index 852156dc6..a5e4d0cc4 100644 --- a/ports/libiconv/CONTROL +++ b/ports/libiconv/CONTROL @@ -1,3 +1,3 @@ Source: libiconv -Version: 1.15-4 +Version: 1.15-5 Description: GNU Unicode text conversion diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake index 3ccd85c53..7de4cac0e 100644 --- a/ports/libiconv/portfile.cmake +++ b/ports/libiconv/portfile.cmake @@ -6,24 +6,27 @@ if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStor endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libiconv-1.15) + +set(LIBICONV_VERSION 1.15) + vcpkg_download_distfile(ARCHIVE - URLS "https://ftp.gnu.org/gnu/libiconv/libiconv-1.15.tar.gz" - FILENAME "libiconv-1.15.tar.gz" + URLS "https://ftp.gnu.org/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz" + FILENAME "libiconv-${LIBICONV_VERSION}.tar.gz" SHA512 1233fe3ca09341b53354fd4bfe342a7589181145a1232c9919583a8c9979636855839049f3406f253a9d9829908816bb71fd6d34dd544ba290d6f04251376b1a ) -vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + REF ${LIBICONV_VERSION} + PATCHES + 0001-Add-export-definitions.patch + 0002-Config-for-MSVC.patch + 0003-Fix-uwp.patch +) #Since libiconv uses automake, make and configure, we use a custom CMake file file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Add-export-definitions.patch - ${CMAKE_CURRENT_LIST_DIR}/0002-Config-for-MSVC.patch - ${CMAKE_CURRENT_LIST_DIR}/0003-Fix-uwp.patch -) - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 5de0998c1..4bb428668 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -1,12 +1,23 @@ #!/bin/sh vcpkgDisableMetrics="OFF" +vcpkgUseSystem=false for var in "$@" do - if [ "$var" = "-disableMetrics" ]; then + if [ "$var" = "-disableMetrics" -o "$var" = "--disableMetrics" ]; then vcpkgDisableMetrics="ON" + elif [ "$var" = "-useSystemBinaries" -o "$var" = "--useSystemBinaries" ]; then + vcpkgUseSystem=true + elif [ "$var" = "-help" -o "$var" = "--help" ]; then + echo "Usage: ./bootstrap-vcpkg.sh [options]" + echo + echo "Options:" + echo " -help Display usage help" + echo " -disableMetrics Do not build metrics reporting into the executable" + echo " -useSystemBinaries Force use of the system utilities for building vcpkg" + exit 1 else - echo "Unknown argument $var" + echo "Unknown argument $var. Use '-help' for help." exit 1 fi done @@ -191,13 +202,13 @@ selectCXX() if [ "$gccversion" -lt "6" ]; then echo "CXX ($CXX) is too old; please install a newer compiler such as g++-7." echo "On Ubuntu try the following:" - echo "sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y" - echo "sudo apt-get update -y" - echo "sudo apt-get install g++-7 -y" + echo " sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y" + echo " sudo apt-get update -y" + echo " sudo apt-get install g++-7 -y" echo "On CentOS try the following:" - echo "sudo yum install centos-release-scl" - echo "sudo yum install devtoolset-7" - echo "scl enable devtoolset-7 bash" + echo " sudo yum install centos-release-scl" + echo " sudo yum install devtoolset-7" + echo " scl enable devtoolset-7 bash" return 1 fi @@ -206,8 +217,14 @@ selectCXX() # Preparation UNAME="$(uname)" -fetchTool "cmake" "$UNAME" cmakeExe || exit 1 -fetchTool "ninja" "$UNAME" ninjaExe || exit 1 + +if $vcpkgUseSystem; then + cmakeExe="cmake" + ninjaExe="ninja" +else + fetchTool "cmake" "$UNAME" cmakeExe || exit 1 + fetchTool "ninja" "$UNAME" ninjaExe || exit 1 +fi selectCXX CXX || exit 1 # Do the build diff --git a/scripts/toolchains/linux.cmake b/scripts/toolchains/linux.cmake index 6bfb57621..b9cbc0ff3 100644 --- a/scripts/toolchains/linux.cmake +++ b/scripts/toolchains/linux.cmake @@ -16,5 +16,9 @@ if(NOT _CMAKE_IN_TRY_COMPILE) string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+ if(VCPKG_CRT_LINKAGE STREQUAL "static")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT "-static ")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-static ")
+ endif()
endif()
endif()
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 3589881a7..fc7283599 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -171,8 +171,10 @@ static void inner(const VcpkgCmdArguments& args) default_triplet = Triplet::from_canonical_name("x64-osx"); #elif defined(__FreeBSD__) default_triplet = Triplet::from_canonical_name("x64-freebsd"); -#else +#elif defined(__GLIBC__) default_triplet = Triplet::from_canonical_name("x64-linux"); +#else + default_triplet = Triplet::from_canonical_name("x64-linux-musl"); #endif } } diff --git a/toolsrc/src/vcpkg/tools.cpp b/toolsrc/src/vcpkg/tools.cpp index f4ee2d653..c623d816d 100644 --- a/toolsrc/src/vcpkg/tools.cpp +++ b/toolsrc/src/vcpkg/tools.cpp @@ -253,6 +253,11 @@ namespace vcpkg static PathAndVersion get_path(const VcpkgPaths& paths) { + if (System::get_environment_variable("VCPKG_FORCE_SYSTEM_BINARIES").has_value()) + { + return {"cmake", "0"}; + } + std::vector<fs::path> candidate_paths; #if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "cmake"); @@ -317,6 +322,11 @@ namespace vcpkg static PathAndVersion get_path(const VcpkgPaths& paths) { + if (System::get_environment_variable("VCPKG_FORCE_SYSTEM_BINARIES").has_value()) + { + return {"ninja", "0"}; + } + static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "ninja"); std::vector<fs::path> candidate_paths; |
