diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-07-10 16:56:29 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-10 16:56:29 -0700 |
| commit | c9340bd6e018d0a78979533963e96d5a992757c1 (patch) | |
| tree | f007bdbd58d569354bdf2d9367375358b5873973 | |
| parent | 50d2edb060ff53902d4aa14a9c257e02d4738bcd (diff) | |
| parent | 20944ef885c1b300974e0b4893e003d342330f06 (diff) | |
| download | vcpkg-c9340bd6e018d0a78979533963e96d5a992757c1.tar.gz vcpkg-c9340bd6e018d0a78979533963e96d5a992757c1.zip | |
Merge pull request #1420 from vktr/f/libtorrent
Add port for Rasterbar-libtorrent
| -rw-r--r-- | ports/libtorrent/CONTROL | 4 | ||||
| -rw-r--r-- | ports/libtorrent/add-datetime-to-boost-libs.patch | 13 | ||||
| -rw-r--r-- | ports/libtorrent/add-dbghelp-to-win32-libs.patch | 13 | ||||
| -rw-r--r-- | ports/libtorrent/portfile.cmake | 65 | ||||
| -rw-r--r-- | ports/libtorrent/vcpkg-boost-madness.patch | 13 |
5 files changed, 108 insertions, 0 deletions
diff --git a/ports/libtorrent/CONTROL b/ports/libtorrent/CONTROL new file mode 100644 index 000000000..3e2294cee --- /dev/null +++ b/ports/libtorrent/CONTROL @@ -0,0 +1,4 @@ +Source: libtorrent +Version: 1.1.4 +Description: An efficient feature complete C++ BitTorrent implementation +Build-Depends: boost, openssl diff --git a/ports/libtorrent/add-datetime-to-boost-libs.patch b/ports/libtorrent/add-datetime-to-boost-libs.patch new file mode 100644 index 000000000..35d8de1cf --- /dev/null +++ b/ports/libtorrent/add-datetime-to-boost-libs.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 340e38f..1963d90 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -258,7 +258,7 @@ endif() + + # Boost + if(NOT DEFINED Boost_INCLUDE_DIR OR NOT DEFINED Boost_LIBRARIES) +- FIND_PACKAGE(Boost REQUIRED COMPONENTS system chrono random) ++ FIND_PACKAGE(Boost REQUIRED COMPONENTS system date_time chrono random) + endif() + include_directories(${Boost_INCLUDE_DIRS}) + target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/ports/libtorrent/add-dbghelp-to-win32-libs.patch b/ports/libtorrent/add-dbghelp-to-win32-libs.patch new file mode 100644 index 000000000..35df3bc2b --- /dev/null +++ b/ports/libtorrent/add-dbghelp-to-win32-libs.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1963d90..99698a2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -267,7 +267,7 @@ target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_I + #add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -D__USE_W32_SOCKETS -DWIN32_LEAN_AND_MEAN ) + + if (WIN32) +- target_link_libraries(torrent-rasterbar wsock32 ws2_32 Iphlpapi) ++ target_link_libraries(torrent-rasterbar wsock32 ws2_32 Iphlpapi dbghelp) + add_definitions(-D_WIN32_WINNT=0x0600) + # prevent winsock1 to be included + add_definitions(-DWIN32_LEAN_AND_MEAN) diff --git a/ports/libtorrent/portfile.cmake b/ports/libtorrent/portfile.cmake new file mode 100644 index 000000000..6eb49c0b4 --- /dev/null +++ b/ports/libtorrent/portfile.cmake @@ -0,0 +1,65 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libtorrent-libtorrent-1_1_4) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/arvidn/libtorrent/archive/libtorrent-1_1_4.zip" + FILENAME "libtorrent-1_1_4.zip" + SHA512 fd3b875c9626721db9b3e719ce50deeb6f39a030df1e23dd421d0b142aac9c3bb7bee3a61f0c18bb30f85d4dd6131fe90d6138c09ba598f09230824f8d5a3fb1 +) + +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-datetime-to-boost-libs.patch + PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-dbghelp-to-win32-libs.patch + PATCHES ${CMAKE_CURRENT_LIST_DIR}/vcpkg-boost-madness.patch +) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(LIBTORRENT_SHARED ON) +else() + set(LIBTORRENT_SHARED OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -Dshared=${LIBTORRENT_SHARED} + -Ddeprecated-functions=off +) + +vcpkg_install_cmake() + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + # Put shared libraries into the proper directory + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) + + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/torrent-rasterbar.dll ${CURRENT_PACKAGES_DIR}/bin/torrent-rasterbar.dll) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/torrent-rasterbar.dll ${CURRENT_PACKAGES_DIR}/debug/bin/torrent-rasterbar.dll) + + # Defines for shared lib + file(READ ${CURRENT_PACKAGES_DIR}/include/libtorrent/export.hpp EXPORT_H) + string(REPLACE "defined TORRENT_BUILDING_SHARED" "1" EXPORT_H "${EXPORT_H}") + file(WRITE ${CURRENT_PACKAGES_DIR}/include/libtorrent/export.hpp "${EXPORT_H}") +endif() + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libtorrent) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libtorrent/LICENSE ${CURRENT_PACKAGES_DIR}/share/libtorrent/copyright) + +# Do not duplicate include files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/libtorrent/vcpkg-boost-madness.patch b/ports/libtorrent/vcpkg-boost-madness.patch new file mode 100644 index 000000000..e9e498ee4 --- /dev/null +++ b/ports/libtorrent/vcpkg-boost-madness.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 99698a2..454bae6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -252,7 +252,7 @@ else() + + set(Boost_USE_STATIC_RUNTIME ON) + endif() +- set(Boost_USE_STATIC_LIBS ON) ++ set(Boost_USE_STATIC_LIBS OFF) + add_library(torrent-rasterbar STATIC ${sources2}) + endif() + |
