diff options
| author | Francisco Pombal <FranciscoPombal@users.noreply.github.com> | 2020-05-12 04:12:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-11 20:12:34 -0700 |
| commit | 3834f961702cde4aa799e6a7b48c283363763bee (patch) | |
| tree | 0693705fba358f6a0bf92aaa507c9a8fc2800272 | |
| parent | 4acff1659313d8794d678c35a147cb3db35d219a (diff) | |
| download | vcpkg-3834f961702cde4aa799e6a7b48c283363763bee.tar.gz vcpkg-3834f961702cde4aa799e6a7b48c283363763bee.zip | |
[libtorrent] add iconv feature on windows and clean up portfile (#11257)
| -rw-r--r-- | ports/libtorrent/CONTROL | 6 | ||||
| -rw-r--r-- | ports/libtorrent/fix_find_iconv.patch | 35 | ||||
| -rw-r--r-- | ports/libtorrent/no_use_iconv.patch | 31 | ||||
| -rw-r--r-- | ports/libtorrent/portfile.cmake | 29 |
4 files changed, 85 insertions, 16 deletions
diff --git a/ports/libtorrent/CONTROL b/ports/libtorrent/CONTROL index 645b8f84b..943708ee5 100644 --- a/ports/libtorrent/CONTROL +++ b/ports/libtorrent/CONTROL @@ -1,5 +1,5 @@ Source: libtorrent -Version: 1.2.6 +Version: 1.2.6-1 Homepage: https://github.com/arvidn/libtorrent Description: An efficient feature complete C++ BitTorrent implementation Build-Depends: openssl, boost-system, boost-date-time, boost-chrono, boost-random, boost-asio, boost-crc, boost-config, boost-iterator, boost-scope-exit, boost-multiprecision @@ -11,6 +11,10 @@ Description: build with deprecated functions enabled Feature: examples Description: build the examples in the examples directory +Feature: iconv +Build-Depends: libiconv (windows) +Description: build with libiconv on Windows + Feature: python Build-Depends: boost-python, libtorrent[deprfun] Description: build the python bindings in bindings/python directory diff --git a/ports/libtorrent/fix_find_iconv.patch b/ports/libtorrent/fix_find_iconv.patch new file mode 100644 index 000000000..cf30ef18f --- /dev/null +++ b/ports/libtorrent/fix_find_iconv.patch @@ -0,0 +1,35 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 303f905e4..6bdbc5ac4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -603,24 +603,19 @@ target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME mutabl + target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME streaming DEFAULT ON + DESCRIPTION "Enables support for piece deadline" DISABLED TORRENT_DISABLE_STREAMING) + +-find_public_dependency(Iconv) +-if(MSVC) +- set(iconv_package_type OPTIONAL) +-else() +- set(iconv_package_type RECOMMENDED) +-endif() ++find_public_dependency(unofficial-iconv REQUIRED) + +-set_package_properties(Iconv ++set_package_properties(unofficial-iconv + PROPERTIES + URL "https://www.gnu.org/software/libiconv/" +- DESCRIPTION "GNU encoding conversion library" +- TYPE ${iconv_package_type} ++ DESCRIPTION "GNU encoding conversion library (unofficial vcpkg CMake port)" ++ TYPE REQUIRED + PURPOSE "Convert strings between various encodings" + ) + +-if(Iconv_FOUND) ++if(unofficial-iconv_FOUND) + target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_ICONV) +- target_link_libraries(torrent-rasterbar PRIVATE Iconv::Iconv) ++ target_link_libraries(torrent-rasterbar PRIVATE unofficial::iconv::libiconv unofficial::iconv::libcharset) + endif() + + find_public_dependency(OpenSSL) diff --git a/ports/libtorrent/no_use_iconv.patch b/ports/libtorrent/no_use_iconv.patch new file mode 100644 index 000000000..8e62a950c --- /dev/null +++ b/ports/libtorrent/no_use_iconv.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 303f905e4..1810c23c6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -603,26 +603,6 @@ target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME mutabl + target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME streaming DEFAULT ON + DESCRIPTION "Enables support for piece deadline" DISABLED TORRENT_DISABLE_STREAMING) + +-find_public_dependency(Iconv) +-if(MSVC) +- set(iconv_package_type OPTIONAL) +-else() +- set(iconv_package_type RECOMMENDED) +-endif() +- +-set_package_properties(Iconv +- PROPERTIES +- URL "https://www.gnu.org/software/libiconv/" +- DESCRIPTION "GNU encoding conversion library" +- TYPE ${iconv_package_type} +- PURPOSE "Convert strings between various encodings" +-) +- +-if(Iconv_FOUND) +- target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_ICONV) +- target_link_libraries(torrent-rasterbar PRIVATE Iconv::Iconv) +-endif() +- + find_public_dependency(OpenSSL) + set_package_properties(OpenSSL + PROPERTIES diff --git a/ports/libtorrent/portfile.cmake b/ports/libtorrent/portfile.cmake index 0b0cfc8e8..6fc6d263a 100644 --- a/ports/libtorrent/portfile.cmake +++ b/ports/libtorrent/portfile.cmake @@ -6,12 +6,19 @@ if(VCPKG_TARGET_IS_WINDOWS) message(FATAL_ERROR "The python feature is currently broken on Windows") endif() - # Ensure OPENSSL_USE_STATIC_LIBS is set to ON + if("iconv" IN_LIST FEATURES) + set(ICONV_PATCH "fix_find_iconv.patch") + else() + # prevent picking up libiconv if it happens to already be installed + set(ICONV_PATCH "no_use_iconv.patch") + endif() + + # Ensure "OPENSSL_USE_STATIC_LIBS" is set to ON # when statically linking against OpenSSL on Windows. # Also ensure "static_runtime" will be used when statically linking against the runtime. # Prevents OpenSSL crypt32.lib linking errors. if(VCPKG_CRT_LINKAGE STREQUAL "static") - set(LIBTORRENT_STATIC_RUNTIME ON) + set(_static_runtime ON) elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static") set(_OPENSSL_USE_STATIC_LIBS ON) endif() @@ -32,7 +39,7 @@ if("python" IN_LIST FEATURES) vcpkg_add_to_path(${PYTHON3_PATH}) file(GLOB BOOST_PYTHON_LIB "${CURRENT_INSTALLED_DIR}/lib/*boost_python*") - string(REGEX REPLACE ".*(python)([0-9])([0-9]+).*" "\\1\\2\\3" BOOST_PYTHON_MODULE "${BOOST_PYTHON_LIB}") + string(REGEX REPLACE ".*(python)([0-9])([0-9]+).*" "\\1\\2\\3" _boost-python-module-name "${BOOST_PYTHON_LIB}") endif() vcpkg_from_github( @@ -44,6 +51,7 @@ vcpkg_from_github( PATCHES add-datetime-to-boost-libs.patch fix_python_cmake.patch + ${ICONV_PATCH} ) vcpkg_configure_cmake( @@ -51,24 +59,15 @@ vcpkg_configure_cmake( PREFER_NINJA # Disable this option if project cannot be built with Ninja OPTIONS ${FEATURE_OPTIONS} - -Dboost-python-module-name=${BOOST_PYTHON_MODULE} - -Dstatic_runtime=${LIBTORRENT_STATIC_RUNTIME} + -Dboost-python-module-name=${_boost-python-module-name} + -Dstatic_runtime=${_static_runtime} -DOPENSSL_USE_STATIC_LIBS=${_OPENSSL_USE_STATIC_LIBS} -DPython3_USE_STATIC_LIBS=ON ) vcpkg_install_cmake() -file(READ ${CURRENT_PACKAGES_DIR}/include/libtorrent/aux_/export.hpp EXPORT_H) -string(REPLACE "defined TORRENT_BUILDING_SHARED" "0" EXPORT_H "${EXPORT_H}") -if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - string(REPLACE "defined TORRENT_LINKING_SHARED" "1" EXPORT_H "${EXPORT_H}") -else() - string(REPLACE "defined TORRENT_LINKING_SHARED" "0" EXPORT_H "${EXPORT_H}") -endif() -file(WRITE ${CURRENT_PACKAGES_DIR}/include/libtorrent/aux_/export.hpp "${EXPORT_H}") - -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/LibtorrentRasterbar TARGET_PATH share/libtorrentrasterbar) +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/LibtorrentRasterbar TARGET_PATH share/LibtorrentRasterbar) # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) |
