This commit is contained in:
Robert Schumacher 2016-09-27 15:51:16 -07:00
commit cc29d43f85
43 changed files with 139 additions and 88 deletions

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "http://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2"
URLS "http://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2"
FILENAME "boost_1_61_0.tar.bz2"
SHA512 a1c7338e2d2dbac8552ede7c554640d22cbb2fda7fbc325dc3cdcb51e769713626695426ffc158cbe0e1729dd9a7b5ad18af4800d74e24539e8d8564268c2b9d
)

View File

@ -1,11 +1,11 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "https://github.com/cocos2d/cocos2d-x/archive/cocos2d-x-3.10.tar.gz"
URLS "https://github.com/cocos2d/cocos2d-x/archive/cocos2d-x-3.10.tar.gz"
FILENAME "cocos2d-x-3.10.tar.gz"
MD5 7c67068675ad28374448e844b0e463ff
)
vcpkg_download_distfile(DEPS_ARCHIVE_FILE
URL "https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-79.zip"
URLS "https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-79.zip"
FILENAME "cocos2d-x-v3-deps-79.zip"
MD5 5d88ff867205080b9ee8da532437e891
)

3
ports/constexpr/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: constexpr
Version: 1.0
Description: Small MIT License Library of general stdlib functions written as C++11 constexpr functions.

View File

@ -0,0 +1,16 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/elbeno/constexpr/archive/a98b1db39c909e0130d21d3910d4faf97035a625.zip"
FILENAME "constexpr-a98b1db39c909e0130d21d3910d4faf97035a625.zip"
SHA512 847e09f9df30cb5fbd8aa280679ff359d73c9e9454ffe3090f66975a15665080629e9a664d057f039b17430d42b5e5f5f3f92831e73c15024060991090209c2e
)
vcpkg_extract_source_archive(${ARCHIVE})
# Put the licence file where vcpkg expects it
set(SOURCE_DIR ${CURRENT_BUILDTREES_DIR}/src/constexpr-a98b1db39c909e0130d21d3910d4faf97035a625)
file(COPY ${SOURCE_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/constexpr/LICENSE)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/constexpr/LICENSE ${CURRENT_PACKAGES_DIR}/share/constexpr/copyright)
# Copy the constexpr header files
file(GLOB HEADER_FILES ${SOURCE_DIR}/src/include/*.h)
file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "https://curl.haxx.se/download/curl-7.48.0.tar.bz2"
URLS "https://curl.haxx.se/download/curl-7.48.0.tar.bz2"
FILENAME "curl-7.48.0.tar.bz2"
SHA512 9bb554eaf4ccaced0fa9b38de4f381eab84b96c1aa07a45d83ddfd38a925044d0fe9fac517263f67f009d2294a31c33dedb2267defbab0cb14f96091bbed5f92
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/onqtam/doctest/archive/1.1.0.zip"
URLS "https://github.com/onqtam/doctest/archive/1.1.0.zip"
FILENAME "doctest-1.1.0.zip"
SHA512 3cbdbb82d2dceff5a34aaed45222832c5767f21b64b271c41c2da7bae1f9e364a60758a8b6ce64285999afc30dd76de980e287663fa3119d0bcc1d2b45514e0b
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2"
URLS "http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2"
FILENAME "eigen-3.2.9.tar.bz2"
SHA512 2734ce70e0b04dc5839715a3cc9b8f90e05b341cfca42a7d586df213a9a14fe5642c76ccf36c16d020ae167c0d6e4d5cc306f0b3bf1f519c58372b0736ca7e63
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "http://downloads.sourceforge.net/project/expat/expat/2.1.1/expat-2.1.1.tar.bz2"
URLS "http://downloads.sourceforge.net/project/expat/expat/2.1.1/expat-2.1.1.tar.bz2"
FILENAME "expat-2.1.1.tar.bz2"
SHA512 088e2ef3434f2affd4fc79fe46f0e9826b9b4c3931ddc780cd18892f1cd1e11365169c6807f45916a56bb6abcc627dcd17a23f970be0bf464f048f5be2713628
)

View File

@ -1,7 +1,7 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "https://github.com/fmtlib/fmt/archive/3.0.0.tar.gz"
URLS "https://github.com/fmtlib/fmt/archive/3.0.0.tar.gz"
FILENAME "fmt-3.0.0.tar.gz"
SHA512 20c9b1ffe8b46cb5d22015122fc698a75ad854709d3de1a1316b6040d86f54bada4e6d7263f2f1fd94cb13ac37ee9447c162c6aec3f3af650455e8a8a9804871
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "http://download.savannah.gnu.org/releases/freetype/freetype-2.6.3.tar.bz2"
URLS "http://download.savannah.gnu.org/releases/freetype/freetype-2.6.3.tar.bz2"
FILENAME "freetype-2.6.3.tar.bz2"
SHA512 e1f9018835fc88beeb4479537b59f866c52393ae18d24a1e0710a464cf948ab02b35c2c6043bc20c1db3a04871ee4eb0bb1d210550c0ea2780c8b1aea98fbf0d
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "http://downloads.sourceforge.net/project/glew/glew/1.13.0/glew-1.13.0.tgz"
URLS "http://downloads.sourceforge.net/project/glew/glew/1.13.0/glew-1.13.0.tgz"
FILENAME "glew-1.13.0.tgz"
SHA512 8fc8d7c0d2cd9235ea51db9972f492701827bff40642fdb3cc54c10b0737dba8e6d8d0dcd8c5aa5bfaaae39c6198ba3d4292cd1662fbe1977eb9a5d187ba635f
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/glfw/glfw/releases/download/3.1.2/glfw-3.1.2.zip"
URLS "https://github.com/glfw/glfw/releases/download/3.1.2/glfw-3.1.2.zip"
FILENAME "glfw-3.1.2.zip"
SHA512 c199137b32182182123869fe69ab991a296feb80dcf3db3cf5e070cdaef31ed958148d9b87e724c1937fa535960122bdceb92ea9dd38f7ef41e4e08e36210fe5
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/g-truc/glm/releases/download/0.9.8.0/glm-0.9.8.0.zip"
URLS "https://github.com/g-truc/glm/releases/download/0.9.8.0/glm-0.9.8.0.zip"
FILENAME "glm-0.9.8.0.zip"
SHA512 5fe9d1f582e7bbef37fd23c9d10fd9cf7696bb7c6f8086a250248e97f84b0205a89a195c8838a1ddc4c0a4cb4c69d1764f90db6513a9691a94877b7ec6b2befb
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/Microsoft/GSL/archive/fd5ad87bf25cb5e87104ee58106dee9bc809cd93.zip"
URLS "https://github.com/Microsoft/GSL/archive/fd5ad87bf25cb5e87104ee58106dee9bc809cd93.zip"
FILENAME "gsl-fd5ad87bf.zip"
SHA512 81887be57e12bfc4e67353713478e1638bf1bffb8f523cf7241acf5415c2e3fe82ea0c0128380dcb2008afb5f53ac0d4893660626a8cd1eb501da536e6af5692
)

View File

@ -2,7 +2,7 @@ include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libjpeg-turbo-1.4.90)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/1.4.90.zip"
URLS "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/1.4.90.zip"
FILENAME "libjpeg-turbo-1.4.90.zip"
SHA512 43c3d26c70a7356bb0832276fe82eead040c3f4aa17df118f91a38615bfacfdfb25fab41965f9ca2b69d18e0b937a1bb753e93fa2c114e01d5174fc1100010b4
)

View File

@ -2,7 +2,7 @@ include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libpng-1.6.24)
vcpkg_download_distfile(ARCHIVE
URL "http://download.sourceforge.net/libpng/libpng-1.6.24.tar.xz"
URLS "http://download.sourceforge.net/libpng/libpng-1.6.24.tar.xz"
FILENAME "libpng-1.6.24.tar.xz"
SHA512 7eccb90f530a9c728e280b2b1776304a808b5deea559632e7bcf4ea219c7cb5e453aa810215465304501127595000717d4b7c5b26a9f8e22e236ec04af53a90f
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/libuv/libuv/archive/v1.9.1.zip"
URLS "https://github.com/libuv/libuv/archive/v1.9.1.zip"
FILENAME "libuv-v1.9.1.zip"
SHA512 3eb8711e3612fb3f5a1ddeb4614b2bec29c022ac5c6c2590bc5239825d758a73be0819c52747956a029859ef4e416bf3fce16665bac2c6c4890f736b47c38226
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/warmcat/libwebsockets/archive/v2.0.0.zip"
URLS "https://github.com/warmcat/libwebsockets/archive/v2.0.0.zip"
FILENAME "libwebsockets-v2.0.0.zip"
SHA512 bf57a46f2c60095e7e6ec6656b185ffd2cf8f553bc22255ae8f6825d3613316d794f139cdefacbdf60ef997b0cd675fe356813d406c9b7c5a5ae838ce5326042
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "http://downloads.sourceforge.net/project/mpg123/mpg123/1.23.3/mpg123-1.23.3.tar.bz2"
URLS "http://downloads.sourceforge.net/project/mpg123/mpg123/1.23.3/mpg123-1.23.3.tar.bz2"
FILENAME "mpg123-1.23.3.tar.bz2"
SHA512 a5ebfb36223a3966386bc8e5769b8543861872d20f9de037d07857e857000f20e198e0b1db04bdc56b18b19d5b4027d8261a104af0216d6ea45274b21a18dda4
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "http://mpir.org/mpir-2.7.2.tar.lz"
URLS "http://mpir.org/mpir-2.7.2.tar.lz"
FILENAME "mpir-2.7.2.tar.lz"
SHA512 2635c167ddbba99364ec741373768e0675d34f94fad8912d5433b95e6fbfdb0510f5e94a707acc42048254bc658c52c6671bb0c0dac31267c4b82b00c3e74efa
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "http://openal-soft.org/openal-releases/openal-soft-1.17.2.tar.bz2"
URLS "http://openal-soft.org/openal-releases/openal-soft-1.17.2.tar.bz2"
FILENAME "openal-soft-1.17.2.tar.bz2"
MD5 1764e0d8fec499589b47ebc724e0913d
SHA512 50c20cd3ddada55d91643a79c2894d5a14315d5fc1ed8e870e3d8d3f410e8b7d8da29b838226e7fce37fbeca719ff919b51806f72e4cd529a18fbe8bd68860e3

View File

@ -6,7 +6,7 @@ get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}")
vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE
URL "https://www.openssl.org/source/openssl-1.0.2h.tar.gz"
URLS "https://www.openssl.org/source/openssl-1.0.2h.tar.gz"
FILENAME "openssl-1.0.2h.tar.gz"
SHA512 780601f6f3f32f42b6d7bbc4c593db39a3575f9db80294a10a68b2b0bb79448d9bd529ca700b9977354cbdfc65887c76af0aa7b90d3ee421f74ab53e6f15c303
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/Microsoft/Range-V3-VS2015/archive/ede9ad367fd5ec764fecb039c874614bd908e6b6.zip"
URLS "https://github.com/Microsoft/Range-V3-VS2015/archive/ede9ad367fd5ec764fecb039c874614bd908e6b6.zip"
FILENAME "range-v3-ede9ad367fd5ec764fecb039c874614bd908e6b6.zip"
SHA512 e978c7694471d8616c248647b77689f377b3e2517347abde8629b140e5994de8bf686565a24cdd7dd222f325d43b775f5e478c91220dce75313985499b134637
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/miloyip/rapidjson/archive/879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip"
URLS "https://github.com/miloyip/rapidjson/archive/879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip"
FILENAME "rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip"
SHA512 4d9ef7cce7d179344c33245c081a142ca5fcb2a0cc170ed39e3d0add008efab8e7389feec03e1ea83b30c5778cd0600865b08bc1c23592e5154dbe1f21f9547d
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://sourceforge.net/projects/rapidxml/files/rapidxml/rapidxml%201.13/rapidxml-1.13.zip/download"
URLS "https://sourceforge.net/projects/rapidxml/files/rapidxml/rapidxml%201.13/rapidxml-1.13.zip/download"
FILENAME "rapidxml-1.13.zip"
SHA512 6c10583e6631ccdb0217d0a5381172cb4c1046226de6ef1acf398d85e81d145228e14c3016aefcd7b70a1db8631505b048d8b4f5d4b0dbf1811d2482eefdd265
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "http://libsdl.org/release/SDL2-2.0.4.tar.gz"
URLS "http://libsdl.org/release/SDL2-2.0.4.tar.gz"
FILENAME "SDL2-2.0.4.tar.gz"
SHA512 dd0a95878639856c0f4b8a579ace8071379ab64519fa139b22d3ed857a0f0db87a75bc8480c7207e02fbffd1fdbd448e3c0b882c451675b0e2f1a945af02e1d6
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/Ninetainedo/Sery/archive/v1.0.zip"
URLS "https://github.com/Ninetainedo/Sery/archive/v1.0.zip"
FILENAME "sery-1.0.0.zip"
SHA512 15ef97bf094e8931049d8dd667a778e23847555f0f8d5b949b250e26edcc2541744fac5c34d935880d070546777fa787b1baf018d8ca2240fcd18a820aded04f
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "http://www.sqlite.org/2016/sqlite-amalgamation-3120200.zip"
URLS "http://www.sqlite.org/2016/sqlite-amalgamation-3120200.zip"
FILENAME "sqlite-amalgamation-3120200.zip"
SHA512 92e1cc09dc4d4e9dd4c189e4a5061664f11971eb3e14c4c59e1f489f201411b08a31dae9e6fc50fffd49bb72f88ac3d99b7c7cd5e334b3079c165ee1c4f5a16e
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/nothings/stb/archive/e713a69f1ea6ee1e0d55725ed0731520045a5993.zip"
URLS "https://github.com/nothings/stb/archive/e713a69f1ea6ee1e0d55725ed0731520045a5993.zip"
FILENAME "stb-e713a69f1ea6ee1e0d55725ed0731520045a5993.zip"
SHA512 28d73905e626bf286bc42e30bc50e8449912a9db5e421e09bfbd17790de1909fe9df19c96d6ad3125a6ae0947d45b11b83ee5965dab68d1eadd0c332e391400e
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "http://prdownloads.sourceforge.net/tcl/tcl8.6.5-src.tar.gz"
URLS "http://prdownloads.sourceforge.net/tcl/tcl8.6.5-src.tar.gz"
FILENAME "tcl8.6.5-src.tar.gz"
MD5 0e6426a4ca9401825fbc6ecf3d89a326
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "http://download.osgeo.org/libtiff/tiff-4.0.6.tar.gz"
URLS "http://download.osgeo.org/libtiff/tiff-4.0.6.tar.gz"
FILENAME "tiff-4.0.6.tar.gz"
SHA512 2c8dbaaaab9f82a7722bfe8cb6fcfcf67472beb692f1b7dafaf322759e7016dad1bc58457c0f03db50aa5bd088fef2b37358fcbc1524e20e9e14a9620373fdf8
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "https://github.com/leethomason/tinyxml2/archive/3.0.0.zip"
URLS "https://github.com/leethomason/tinyxml2/archive/3.0.0.zip"
FILENAME "tinyxml2-3.0.0.zip"
SHA512 3581e086e41ea01418fdf74e53b932c41cada9a45b73fb71c15424672182dc2a1e55110f030962ae44df6f5d9f060478c5b04373f886da843a78fcabae8b063c
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "http://prdownloads.sourceforge.net/tcl/tk8.6.5-src.tar.gz"
URLS "http://prdownloads.sourceforge.net/tcl/tk8.6.5-src.tar.gz"
FILENAME "tk8.6.5-src.tar.gz"
MD5 11dbbd425c3e0201f20d6a51482ce6c4
)

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE_FILE
URL "http://zlib.net/zlib128.zip"
URLS "http://zlib.net/zlib128.zip"
FILENAME "zlib128.zip"
SHA512 b0d7e71eca9032910c56fc1de6adbdc4f915bdeafd9a114591fc05701893004ef3363add8ad0e576c956b6be158f2fc339ab393f2dd40e8cc8c2885d641d807b
)

View File

@ -1,20 +1,52 @@
# Usage: vcpkg_download_distfile(<VAR> URL <http://...> FILENAME <output.zip> SHA512 <5981de...>)
# Usage: vcpkg_download_distfile(<VAR> URLS <http://mainUrl> <http://mirror1> <http://mirror2> FILENAME <output.zip> SHA512 <5981de...>)
function(vcpkg_download_distfile VAR)
set(oneValueArgs URL FILENAME SHA512)
cmake_parse_arguments(vcpkg_download_distfile "" "${oneValueArgs}" "" ${ARGN})
set(oneValueArgs FILENAME SHA512)
set(multipleValuesArgs URLS)
cmake_parse_arguments(vcpkg_download_distfile "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME})
if(EXISTS ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME})
message(STATUS "Using cached ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}")
file(SHA512 ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME} FILE_HASH)
if(NOT FILE_HASH STREQUAL "${vcpkg_download_distfile_SHA512}")
function(test_hash FILE_KIND CUSTOM_ERROR_ADVICE)
message(STATUS "Testing integrity of ${FILE_KIND}...")
file(SHA512 ${downloaded_file_path} FILE_HASH)
if(NOT "${FILE_HASH}" STREQUAL "${vcpkg_download_distfile_SHA512}")
message(FATAL_ERROR
"File does not have expected hash: ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}\n"
" '${FILE_HASH}' <> '${vcpkg_download_distfile_SHA512}'\n"
"Please delete the file and try again if this file should be downloaded again.")
"\nFile does not have expected hash:\n"
" File path: [ ${downloaded_file_path} ]\n"
" Expected hash: [ ${vcpkg_download_distfile_SHA512} ]\n"
" Actual hash: [ ${FILE_HASH} ]\n"
"${CUSTOM_ERROR_ADVICE}\n")
endif()
message(STATUS "Testing integrity of ${FILE_KIND}... OK")
endfunction()
if(EXISTS ${downloaded_file_path})
message(STATUS "Using cached ${downloaded_file_path}")
test_hash("cached file" "Please delete the file and retry if this file should be downloaded again.")
else()
message(STATUS "Downloading ${vcpkg_download_distfile_URL}")
file(DOWNLOAD ${vcpkg_download_distfile_URL} ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME} EXPECTED_HASH SHA512=${vcpkg_download_distfile_SHA512})
# Tries to download the file.
foreach(url IN LISTS vcpkg_download_distfile_URLS)
message(STATUS "Downloading ${url}...")
file(DOWNLOAD ${url} ${downloaded_file_path} STATUS download_status)
list(GET download_status 0 status_code)
if (NOT "${status_code}" STREQUAL "0")
message(STATUS "Downloading ${url}... Failed. Status: ${download_status}")
file(REMOVE ${downloaded_file_path})
set(download_success 0)
else()
message(STATUS "Downloading ${url}... OK")
set(download_success 1)
break()
endif()
endforeach(url)
if (NOT ${download_success})
message(FATAL_ERROR
"\n"
" Failed to download file.\n"
" Add mirrors or submit an issue at https://github.com/Microsoft/vcpkg/issues\n")
else()
test_hash("downloaded file" "The file may be corrupted.")
endif()
endif()
set(${VAR} ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME} PARENT_SCOPE)
set(${VAR} ${downloaded_file_path} PARENT_SCOPE)
endfunction()

View File

@ -1,6 +1,6 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URL "@URL@"
URLS "@URL@"
FILENAME "@FILENAME@"
SHA512 @SHA512@
)

View File

@ -20,7 +20,7 @@ namespace vcpkg
std::string system() const;
bool validate(const vcpkg_paths& paths);
bool validate(const vcpkg_paths& paths) const;
};
bool operator==(const triplet& left, const triplet& right);

View File

@ -4,9 +4,9 @@
namespace vcpkg {namespace details
{
void optional_field(const std::unordered_map<std::string, std::string>& fields, std::string& out, const std::string& fieldname);
std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname);
void required_field(const std::unordered_map<std::string, std::string>& fields, std::string& out, const std::string& fieldname);
std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname);
void parse_depends(const std::string& depends_string, std::vector<std::string>& out);
std::vector<std::string> parse_depends(const std::string& depends_string);
}}

View File

@ -8,25 +8,24 @@ namespace vcpkg
{
BinaryParagraph::BinaryParagraph() = default;
BinaryParagraph::BinaryParagraph(const std::unordered_map<std::string, std::string>& fields)
BinaryParagraph::BinaryParagraph(const std::unordered_map<std::string, std::string>& fields) :
name(required_field(fields, "Package")),
version(required_field(fields, "Version")),
description(optional_field(fields, "Description")),
maintainer(optional_field(fields, "Maintainer"))
{
details::required_field(fields, name, "Package");
required_field(fields, version, "Version");
required_field(fields, target_triplet.value, "Architecture");
target_triplet.value = required_field(fields, "Architecture");
{
std::string multi_arch;
required_field(fields, multi_arch, "Multi-Arch");
std::string multi_arch = required_field(fields, "Multi-Arch");
Checks::check_throw(multi_arch == "same", "Multi-Arch must be 'same' but was %s", multi_arch);
}
optional_field(fields, description, "Description");
std::string deps;
optional_field(fields, deps, "Depends");
std::string deps = optional_field(fields, "Depends");
if (!deps.empty())
{
depends.clear();
parse_depends(deps, depends);
this->depends.clear();
this->depends = parse_depends(deps);
}
optional_field(fields, maintainer, "Maintainer");
}
BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet)

View File

@ -5,17 +5,16 @@ using namespace vcpkg::details;
vcpkg::SourceParagraph::SourceParagraph() = default;
vcpkg::SourceParagraph::SourceParagraph(const std::unordered_map<std::string, std::string>& fields)
vcpkg::SourceParagraph::SourceParagraph(const std::unordered_map<std::string, std::string>& fields):
name(required_field(fields, "Source")),
version(required_field(fields, "Version")),
description(optional_field(fields, "Description")),
maintainer(optional_field(fields, "Maintainer"))
{
required_field(fields, name, "Source");
required_field(fields, version, "Version");
optional_field(fields, description, "Description");
std::string deps;
optional_field(fields, deps, "Build-Depends");
std::string deps = optional_field(fields, "Build-Depends");
if (!deps.empty())
{
depends.clear();
parse_depends(deps, depends);
}
optional_field(fields, maintainer, "Maintainer");
this->depends.clear();
this->depends = parse_depends(deps);
};
}

View File

@ -19,8 +19,7 @@ namespace vcpkg
StatusParagraph::StatusParagraph(const std::unordered_map<std::string, std::string>& fields)
: package(fields)
{
std::string status_field;
required_field(fields, status_field, "Status");
std::string status_field = required_field(fields, "Status");
auto b = status_field.begin();
auto mark = b;

View File

@ -58,13 +58,13 @@ namespace vcpkg
Checks::exit_with_message("Unknown system: %s", value);
}
bool triplet::validate(const vcpkg_paths & paths)
bool triplet::validate(const vcpkg_paths& paths) const
{
auto it = fs::directory_iterator(paths.triplets);
for(; it != fs::directory_iterator(); ++it)
for (; it != fs::directory_iterator(); ++it)
{
std::string triplet_file_name = it->path().stem().generic_u8string();
if(value == triplet_file_name) // TODO: fuzzy compare
if (value == triplet_file_name) // TODO: fuzzy compare
{
//value = triplet_file_name; // NOTE: uncomment when implementing fuzzy compare
return true;

View File

@ -4,29 +4,28 @@
namespace vcpkg {namespace details
{
void optional_field(const std::unordered_map<std::string, std::string>& fields, std::string& out, const std::string& fieldname)
std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname)
{
auto it = fields.find(fieldname);
if (it == fields.end())
{
out.clear();
return std::string();
}
else
{
out = it->second;
}
return it->second;
};
void required_field(const std::unordered_map<std::string, std::string>& fields, std::string& out, const std::string& fieldname)
std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname)
{
auto it = fields.find(fieldname);
vcpkg::Checks::check_throw(it != fields.end(), "Required field not present: %s", fieldname);
out = it->second;
return it->second;
};
void parse_depends(const std::string& depends_string, std::vector<std::string>& out)
std::vector<std::string> parse_depends(const std::string& depends_string)
{
std::vector<std::string> out;
size_t cur = 0;
do
{
@ -34,17 +33,21 @@ namespace vcpkg {namespace details
if (pos == std::string::npos)
{
out.push_back(depends_string.substr(cur));
return;
break;
}
out.push_back(depends_string.substr(cur, pos - cur));
// skip comma and space
++pos;
if (depends_string[pos] == ' ')
{
++pos;
}
cur = pos;
}
while (cur != std::string::npos);
return out;
}
}}