Merge pull request #14189 from glassez/libtorrent-1.2.12

Raise minimum libtorrent version to 1.2.12 (2.0.2)
This commit is contained in:
Vladimir Golovnev 2021-03-01 20:43:28 +03:00 committed by GitHub
commit a2b0531d5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 151 additions and 49 deletions

View file

@ -11,12 +11,10 @@ on:
branches: [ master ]
env:
# Qt: 5.15.1
# libtorrent: RC_1_2 HEAD, 1.2.11
VCPKG_COMMIT: 133051b793486ef14e67e9d1f48c9cfe64dc127e
VCPKG_COMMIT: e4ce66eecfd3e5cca5eac06c971921bf8e37cf88
VCPKG_DEST_MACOS: /Users/runner/qbt_tools/vcpkg
VCPKG_DEST_WIN: C:\qbt_tools\vcpkg
LIBTORRENT_VERSION_TAG: v1.2.11
LIBTORRENT_VERSION_TAG: v1.2.12
jobs:
@ -124,10 +122,15 @@ jobs:
"qt5-svg:x64-windows-static-release",
"qt5-tools:x64-windows-static-release",
"qt5-winextras:x64-windows-static-release"
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe upgrade `
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
--overlay-ports=${{ github.workspace }}/vcpkg `
--no-dry-run
foreach($package in $packages)
{
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe install $package `
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
--overlay-ports=${{ github.workspace }}/vcpkg `
--clean-after-build
}
@ -198,13 +201,6 @@ jobs:
Add-Content ${{ github.workspace }}/triplets_overlay/x64-osx-release.cmake `
-Value "set(VCPKG_BUILD_TYPE release)","set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15)"
# NOTE: Avoids a libtorrent ABI issue. See https://github.com/arvidn/libtorrent/issues/4965
- name: force AppleClang to compile libtorrent with C++17
run: |
(Get-Content -path ${{ env.RUNVCPKG_VCPKG_ROOT }}/ports/libtorrent/portfile.cmake).Replace( `
'${FEATURE_OPTIONS}', '${FEATURE_OPTIONS} -DCMAKE_CXX_STANDARD=17') `
| Set-Content -Path ${{ env.RUNVCPKG_VCPKG_ROOT }}/ports/libtorrent/portfile.cmake
- name: install dependencies via vcpkg
run: |
$packages = `
@ -214,10 +210,15 @@ jobs:
"qt5-svg:x64-osx-release",
"qt5-tools:x64-osx-release",
"qt5-macextras:x64-osx-release"
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg upgrade `
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
--overlay-ports=${{ github.workspace }}/vcpkg `
--no-dry-run
foreach($package in $packages)
{
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg install $package `
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
--overlay-ports=${{ github.workspace }}/vcpkg `
--clean-after-build
}

View file

@ -125,7 +125,7 @@ install:
pushd "$HOME"
git clone --single-branch --branch RC_1_2 https://github.com/arvidn/libtorrent.git
cd libtorrent
git checkout tags/v1.2.11
git checkout tags/v1.2.12
cmake \
-DCMAKE_BUILD_TYPE=Release \
@ -140,7 +140,7 @@ install:
pushd "$HOME"
git clone --single-branch --branch RC_2_0 https://github.com/arvidn/libtorrent.git
cd libtorrent
git checkout tags/v2.0.1
git checkout tags/v2.0.2
git submodule update --init --recursive
cmake \

View file

@ -14,7 +14,7 @@ set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
set(minBoostVersion 1.65)
set(minQtVersion 5.9.5)
set(minOpenSSLVersion 1.1.1)
set(minLibtorrentVersion 1.2.11)
set(minLibtorrentVersion 1.2.12)
set(minZlibVersion 1.2.11)
# features (some are platform-specific)

View file

@ -5,7 +5,7 @@ qBittorrent - A BitTorrent client in C++ / Qt
- Boost >= 1.65
- libtorrent-rasterbar >= 1.2.11 (by Arvid Norberg)
- libtorrent-rasterbar >= 1.2.12 (by Arvid Norberg)
* https://www.libtorrent.org/
* Be careful: another library (the one used by rTorrent) uses a similar name

18
configure vendored
View file

@ -6354,12 +6354,12 @@ if test -n "$libtorrent_CFLAGS"; then
pkg_cv_libtorrent_CFLAGS="$libtorrent_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.2.11\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.2.11") 2>&5
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.2.12\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.2.12") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_libtorrent_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar >= 1.2.11" 2>/dev/null`
pkg_cv_libtorrent_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar >= 1.2.12" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -6371,12 +6371,12 @@ if test -n "$libtorrent_LIBS"; then
pkg_cv_libtorrent_LIBS="$libtorrent_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.2.11\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.2.11") 2>&5
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.2.12\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.2.12") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_libtorrent_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar >= 1.2.11" 2>/dev/null`
pkg_cv_libtorrent_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar >= 1.2.12" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -6397,14 +6397,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 1.2.11" 2>&1`
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 1.2.12" 2>&1`
else
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 1.2.11" 2>&1`
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 1.2.12" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$libtorrent_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libtorrent-rasterbar >= 1.2.11) were not met:
as_fn_error $? "Package requirements (libtorrent-rasterbar >= 1.2.12) were not met:
$libtorrent_PKG_ERRORS

View file

@ -180,7 +180,7 @@ AC_MSG_NOTICE([Boost.System LIB: "$BOOST_SYSTEM_LIB"])
LIBS="$BOOST_SYSTEM_LIB $LIBS"
PKG_CHECK_MODULES(libtorrent,
[libtorrent-rasterbar >= 1.2.11],
[libtorrent-rasterbar >= 1.2.12],
[CXXFLAGS="$libtorrent_CFLAGS $CXXFLAGS"
LIBS="$libtorrent_LIBS $LIBS"])

View file

@ -1387,15 +1387,11 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
break;
}
#ifdef HAS_IDN_SUPPORT
settingsPack.set_bool(lt::settings_pack::allow_idna, isIDNSupportEnabled());
#endif
settingsPack.set_bool(lt::settings_pack::allow_multiple_connections_per_ip, multiConnectionsPerIpEnabled());
#ifdef HAS_HTTPS_TRACKER_VALIDATION
settingsPack.set_bool(lt::settings_pack::validate_https_trackers, validateHTTPSTrackerCertificate());
#endif
settingsPack.set_bool(lt::settings_pack::no_connect_privileged_ports, blockPeersOnPrivilegedPorts());

View file

@ -51,14 +51,6 @@
#include "sessionstatus.h"
#include "torrentinfo.h"
#if !defined(Q_OS_WIN) || (LIBTORRENT_VERSION_NUM >= 10212)
#define HAS_HTTPS_TRACKER_VALIDATION
#endif
#if ((LIBTORRENT_VERSION_NUM >= 10212) && (LIBTORRENT_VERSION_NUM < 20000)) || (LIBTORRENT_VERSION_NUM >= 20002)
#define HAS_IDN_SUPPORT
#endif
class QFile;
class QNetworkConfiguration;
class QNetworkConfigurationManager;

View file

@ -116,13 +116,9 @@ namespace
OUTGOING_PORT_MAX,
UPNP_LEASE_DURATION,
UTP_MIX_MODE,
#ifdef HAS_IDN_SUPPORT
IDN_SUPPORT,
#endif
MULTI_CONNECTIONS_PER_IP,
#ifdef HAS_HTTPS_TRACKER_VALIDATION
VALIDATE_HTTPS_TRACKER_CERTIFICATE,
#endif
BLOCK_PEERS_ON_PRIVILEGED_PORTS,
// seeding
CHOKING_ALGORITHM,
@ -229,16 +225,12 @@ void AdvancedSettings::saveAdvancedSettings()
session->setUPnPLeaseDuration(m_spinBoxUPnPLeaseDuration.value());
// uTP-TCP mixed mode
session->setUtpMixedMode(static_cast<BitTorrent::MixedModeAlgorithm>(m_comboBoxUtpMixedMode.currentIndex()));
#ifdef HAS_IDN_SUPPORT
// Support internationalized domain name (IDN)
session->setIDNSupportEnabled(m_checkBoxIDNSupport.isChecked());
#endif
// multiple connections per IP
session->setMultiConnectionsPerIpEnabled(m_checkBoxMultiConnectionsPerIp.isChecked());
#ifdef HAS_HTTPS_TRACKER_VALIDATION
// Validate HTTPS tracker certificate
session->setValidateHTTPSTrackerCertificate(m_checkBoxValidateHTTPSTrackerCertificate.isChecked());
#endif
// Disallow connection to peers on privileged ports
session->setBlockPeersOnPrivilegedPorts(m_checkBoxBlockPeersOnPrivilegedPorts.isChecked());
// Recheck torrents on completion
@ -556,25 +548,21 @@ void AdvancedSettings::loadAdvancedSettings()
addRow(UTP_MIX_MODE, (tr("%1-TCP mixed mode algorithm", "uTP-TCP mixed mode algorithm").arg(C_UTP)
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#mixed_mode_algorithm", "(?)"))
, &m_comboBoxUtpMixedMode);
#ifdef HAS_IDN_SUPPORT
// Support internationalized domain name (IDN)
m_checkBoxIDNSupport.setChecked(session->isIDNSupportEnabled());
addRow(IDN_SUPPORT, (tr("Support internationalized domain name (IDN)")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#allow_idna", "(?)"))
, &m_checkBoxIDNSupport);
#endif
// multiple connections per IP
m_checkBoxMultiConnectionsPerIp.setChecked(session->multiConnectionsPerIpEnabled());
addRow(MULTI_CONNECTIONS_PER_IP, (tr("Allow multiple connections from the same IP address")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#allow_multiple_connections_per_ip", "(?)"))
, &m_checkBoxMultiConnectionsPerIp);
#ifdef HAS_HTTPS_TRACKER_VALIDATION
// Validate HTTPS tracker certificate
m_checkBoxValidateHTTPSTrackerCertificate.setChecked(session->validateHTTPSTrackerCertificate());
addRow(VALIDATE_HTTPS_TRACKER_CERTIFICATE, (tr("Validate HTTPS tracker certificates")
+ ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#validate_https_trackers", "(?)"))
, &m_checkBoxValidateHTTPSTrackerCertificate);
#endif
// Disallow connection to peers on privileged ports
m_checkBoxBlockPeersOnPrivilegedPorts.setChecked(session->blockPeersOnPrivilegedPorts());
addRow(BLOCK_PEERS_ON_PRIVILEGED_PORTS, (tr("Disallow connection to peers on privileged ports") + ' ' + makeLink("https://libtorrent.org/single-page-ref.html#no_connect_privileged_ports", "(?)")), &m_checkBoxBlockPeersOnPrivilegedPorts);

26
vcpkg/libtorrent/CONTROL Normal file
View file

@ -0,0 +1,26 @@
Source: libtorrent
Version: 1.2.12
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, boost-pool, boost-variant
Supports: !uwp&!(windows&arm)
Feature: deprfun
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
Description: build the python bindings in bindings/python directory
Feature: test
Description: build the libtorrent tests
Feature: tools
Description: build the tools in the tools directory

View file

@ -0,0 +1,31 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9efd451fb..05066be82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -643,26 +643,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

View file

@ -0,0 +1,66 @@
vcpkg_fail_port_install(ON_TARGET "uwp")
if(VCPKG_TARGET_IS_WINDOWS)
# Building python bindings is currently broken on Windows
if("python" IN_LIST FEATURES)
message(FATAL_ERROR "The python feature is currently broken on Windows")
endif()
if(NOT "iconv" IN_LIST FEATURES)
# prevent picking up libiconv if it happens to already be installed
set(ICONV_PATCH "no_use_iconv.patch")
endif()
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(_static_runtime ON)
endif()
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
deprfun deprecated-functions
examples build_examples
python python-bindings
test build_tests
tools build_tools
)
# Note: the python feature currently requires `python3-dev` and `python3-setuptools` installed on the system
if("python" IN_LIST FEATURES)
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_PATH ${PYTHON3} DIRECTORY)
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-name "${BOOST_PYTHON_LIB}")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO arvidn/libtorrent
REF v1.2.12
SHA512 78be4c12e12f593154eda0960aaf9583fe27310e0223dbb21220400c5339744c9b2b11afa880fea30f77b4c0d07345937ff8a20d58d2d4ed7dcda84601380e20
HEAD_REF RC_1_2
PATCHES
${ICONV_PATCH}
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
${FEATURE_OPTIONS}
-DCMAKE_CXX_STANDARD=17
-Dboost-python-module-name=${_boost-python-module-name}
-Dstatic_runtime=${_static_runtime}
-DPython3_USE_STATIC_LIBS=ON
)
vcpkg_install_cmake()
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)
# Do not duplicate include files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/share/cmake)

View file

@ -0,0 +1,2 @@
Files are taken from upstream repository: https://github.com/microsoft/vcpkg/tree/master/ports/libtorrent
This port is for satisfying CI needs, NOT recommended for general use.