|
| 1 | +package("libtorrent-rasterbar") |
| 2 | + set_homepage("https://libtorrent.org") |
| 3 | + set_description("An efficient feature complete C++ bittorrent implementation") |
| 4 | + set_license("BSD-3-Clause") |
| 5 | + |
| 6 | + -- Use the release tarball instead of Git ref archive to include submodule dependencies |
| 7 | + add_urls("https://github.com/arvidn/libtorrent/releases/download/v$(version)/libtorrent-rasterbar-$(version).tar.gz") |
| 8 | + add_urls("https://github.com/arvidn/libtorrent.git", {alias = "git"}) |
| 9 | + |
| 10 | + add_versions("2.0.11", "f0db58580f4f29ade6cc40fa4ba80e2c9a70c90265cd77332d3cdec37ecf1e6d") |
| 11 | + add_versions("git:2.0.11", "v2.0.11") |
| 12 | + |
| 13 | + add_configs("gnutls", {description = "Build using GnuTLS instead of OpenSSL", default = false, type = "boolean", readonly = true}) |
| 14 | + |
| 15 | + if is_plat("mingw") and is_subhost("msys") then |
| 16 | + add_extsources("pacman::libtorrent-rasterbar") |
| 17 | + elseif is_plat("linux") then |
| 18 | + add_extsources("pacman::libtorrent-rasterbar", "apt::libtorrent-rasterbar-dev") |
| 19 | + elseif is_plat("macosx") then |
| 20 | + add_extsources("brew::libtorrent-rasterbar") |
| 21 | + end |
| 22 | + |
| 23 | + if is_plat("windows", "mingw") then |
| 24 | + add_syslinks("iphlpapi", "mswsock") |
| 25 | + end |
| 26 | + |
| 27 | + add_deps("cmake") |
| 28 | + add_deps("boost", {configs = {asio = true, multiprecision = true}}) |
| 29 | + |
| 30 | + on_load(function (package) |
| 31 | + if package:config("gnutls") then |
| 32 | + package:add("deps", "gnutls") |
| 33 | + else |
| 34 | + package:add("deps", "openssl3") |
| 35 | + end |
| 36 | + end) |
| 37 | + |
| 38 | + on_install("!wasm and !macosx and !iphoneos", function (package) |
| 39 | + local configs = {"-DCMAKE_CXX_STANDARD=17"} |
| 40 | + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) |
| 41 | + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
| 42 | + import("package.tools.cmake").install(package, configs) |
| 43 | + end) |
| 44 | + |
| 45 | + on_test(function (package) |
| 46 | + assert(package:check_cxxsnippets({test = [[ |
| 47 | + void test() { |
| 48 | + lt::session s; |
| 49 | + lt::add_torrent_params p; |
| 50 | + p.save_path = "."; |
| 51 | + s.add_torrent(p); |
| 52 | + } |
| 53 | + ]]}, {includes = "libtorrent/session.hpp"})) |
| 54 | + end) |
0 commit comments