diff options
| author | Viktor Elofsson <viktor@viktorelofsson.se> | 2017-07-07 16:32:34 +0200 |
|---|---|---|
| committer | Viktor Elofsson <viktor@viktorelofsson.se> | 2017-07-09 20:46:53 +0200 |
| commit | 26cf1a80e9e6855b521729a30d4cf6f530cc16c8 (patch) | |
| tree | a85879e2613354739eeda344730b059704c339e9 | |
| parent | 0afe1112c18b95e694706ed9d91a63cdb48174c3 (diff) | |
| download | vcpkg-26cf1a80e9e6855b521729a30d4cf6f530cc16c8.tar.gz vcpkg-26cf1a80e9e6855b521729a30d4cf6f530cc16c8.zip | |
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 | 58 |
4 files changed, 88 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..476d84221 --- /dev/null +++ b/ports/libtorrent/portfile.cmake @@ -0,0 +1,58 @@ +# 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 +) + +if (NOT VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(FATAL_ERROR "Only dynamic linking supported.") +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -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) +else() + +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) |
