# This Jamfile requires boost-build v2 to build. # The version shipped with boost 1.34.0 import modules ; import path ; import os ; import errors ; import feature : feature ; import package ; import virtual-target ; import cast ; # we need version numbers in the form X.Y.Z in order to trigger the built-in # support for generating symlinks to the installed library VERSION = 2.0.8 ; BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; CXXFLAGS = [ modules.peek : CXXFLAGS ] ; LDFLAGS = [ modules.peek : LDFLAGS ] ; ECHO "CXXFLAGS =" $(CXXFLAGS) ; ECHO "LDFLAGS =" $(LDFLAGS) ; ECHO "OS =" [ os.name ] ; jam-version = [ modules.peek : JAM_VERSION ] ; if $(BOOST_ROOT) { ECHO "building boost from source directory: " $(BOOST_ROOT) ; use-project /boost : $(BOOST_ROOT) ; alias boost_system : /boost/system//boost_system : : : $(BOOST_ROOT) ; } else { local boost-lib-search-path = /usr/local/opt/boost/lib /opt/homebrew/lib ; local boost-include-path = /usr/local/opt/boost/include /opt/homebrew/include ; # the names are decorated in MacPorts. lib boost_system : : darwin boost_system-mt $(boost-lib-search-path) : : $(boost-include-path) ; lib boost_system : : boost_system ; } use-project /try_signal : ./deps/try_signal ; rule linking ( properties * ) { local result ; if on in $(properties) { result += /libsimulator//simulator ; } if windows in $(properties) && ( on in $(properties) || production in $(properties) || on in $(properties) ) { result += dbghelp ; } # gcrypt libraries, if enabled if gcrypt in $(properties) { result += gcrypt ; } else if openssl in $(properties) { result += ssl ; result += crypto ; if linux in $(properties) { result += dl ; } } else if gnutls in $(properties) { result += ./deps/asio-gnutls//asio-gnutls ; result += gnutls/shared ; } else if libcrypto in $(properties) { result += crypto ; if linux in $(properties) { result += dl ; } } else if wolfssl in $(properties) { result += wolfssl ; } if windows in $(properties) || cygwin in $(properties) { # socket functions on windows require winsock libraries result += ws2_32 wsock32 iphlpapi WIN32_LEAN_AND_MEAN __USE_W32_SOCKETS WIN32 _WIN32 ; # when DHT is enabled, we need ed25519 which in turn # needs entropy if ! off in $(properties) { result += advapi32 ; } # windows xp has no CNG if ! xp in $(properties) { result += bcrypt ; } } if android in $(properties) { result += dl ; } if beos in $(properties) { result += netkit gcc ; } if haiku in $(properties) { result += libnetwork gcc ; } if solaris in $(properties) { result += libsocket libnsl ; } if darwin in $(properties) || iphone in $(properties) { # for ip_notifier result += CoreFoundation SystemConfiguration ; } if gcc in $(properties) && linux in $(properties) && ( on in $(properties) || production in $(properties) || on in $(properties) ) { # for backtraces in assertion failures # which only works on ELF targets with gcc result += -Wl,--export-dynamic -rdynamic ; } else if [ version.version-less $(jam-version) : 1990 0 ] { # the visibility feature was introduced in boost-1.69. This was close to # when the verisoning scheme changed from year to (low) version numbers. # in boost-1.70 result += hidden ; } if static in $(properties) { if shared in $(properties) { # if libtorrent is being built as a shared library # but we're linking against boost statically, we still # need to make boost think it's being built as a shared # library, so that it properly exports its symbols result += BOOST_ALL_DYN_LINK ; result += boost_system/static/BOOST_ALL_DYN_LINK ; } else { result += boost_system/static ; } if gcc in $(properties) && ! windows in $(properties) && shared in $(properties) { result += on ; } } else if shared in $(properties) { result += boost_system/shared ; } else { result += boost_system ; } result += BOOST_ALL_NO_LIB BOOST_MULTI_INDEX_DISABLE_SERIALIZATION BOOST_SYSTEM_NO_DEPRECATED ; if shared in $(properties) { result += /try_signal//try_signal/static/on ; } else { result += /try_signal//try_signal/static ; } return $(result) ; } rule warnings ( properties * ) { local result ; if off in $(properties) { return $(result) ; } if clang in $(properties) || darwin in $(properties) { result += -Weverything ; result += -Wno-documentation ; result += -Wno-c++98-compat-pedantic ; result += -Wno-c++11-compat-pedantic ; result += -Wno-padded ; result += -Wno-alloca ; result += -Wno-global-constructors ; result += -Wno-poison-system-directories ; # this warns on any global static object, which are used for error_category # objects result += -Wno-exit-time-destructors ; # enable these warnings again, once the other ones are dealt with result += -Wno-weak-vtables ; result += -Wno-return-std-move-in-c++11 ; result += -Wno-unknown-warning-option ; # libtorrent uses alloca() carefully result += -Wno-alloca ; } if gcc in $(properties) { result += -Wall ; result += -Wextra ; result += -Wpedantic ; result += -Wvla ; result += -Wno-format-zero-length ; result += -Wno-noexcept-type ; } if msvc in $(properties) { # on msvc this resolves to /W4 result += all ; # enable these warnings again, once the other ones are dealt with # disable warning C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' result += /wd4251 ; # disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' result += /wd4275 ; # disable warning C4373: virtual function overrides, previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers result += /wd4373 ; # C4268: 'identifier' : 'const' static/global data initialized # with compiler generated default constructor fills the object with zeros result += /wd4268 ; # C4503: 'identifier': decorated name length exceeded, name was truncated result += /wd4503 ; } return $(result) ; } # rule for adding the right source files # depending on target-os and features rule building ( properties * ) { local result ; if ( off in $(properties) && ! off in $(properties) ) { ECHO "'invariant-check' requires enabled 'asserts' mode. (e.g. specify build params: invariant-check=on asserts=on)" ; result += no ; } local CXXVER = [ feature.get-values : $(properties) ] ; if ! $(CXXVER) || $(CXXVER) < 14 { ECHO "libtorrent requires at least C++14. Specify cxxstd=14 or higher" ; result += no ; } if msvc in $(properties) || intel-win in $(properties) { # allow larger .obj files (with more sections) result += /bigobj ; # https://docs.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170 result += /utf-8 ; } if gcc in $(properties) && windows in $(properties) { # allow larger .obj files (with more sections) result += -Wa,-mbig-obj ; } if ( production in $(properties) || on in $(properties) ) { result += src/assert.cpp ; } if on in $(properties) { result += src/pe_crypto.cpp ; } if ( darwin in $(properties) || gcc in $(properties) || clang in $(properties) || clang-darwin in $(properties) ) # on GCC, enabling debugging in libstdc++ # breaks the ABI and its ability to appear # in shared object interfaces, so when it's # enabled, just export everything (since we're) # probably not a production build anyway && ! on in $(properties) { if ( gcc in $(properties) ) { result += -Wl,-Bsymbolic ; } } return $(result) ; } rule tag ( name : type ? : property-set ) { # we only care about the names of our output static- or shared library, not # other targets like object files if $(type) != SHARED_LIB && $(type) != STATIC_LIB { return [ virtual-target.add-prefix-and-suffix $(name) : $(type) : $(property-set) ] ; } # static libraries are not versioned if $(type) = STATIC_LIB { return [ virtual-target.add-prefix-and-suffix $(name)-rasterbar : $(type) : $(property-set) ] ; } # shared libraries have the version number before the filename extension on # windows if [ $(property-set).get ] in windows cygwin { # TODO: add version on windows too # return [ virtual-target.add-prefix-and-suffix $(name)-rasterbar-$(VERSION) : $(type) : $(property-set) ] ; return [ virtual-target.add-prefix-and-suffix $(name)-rasterbar : $(type) : $(property-set) ] ; } else { local name = [ virtual-target.add-prefix-and-suffix $(name)-rasterbar : $(type) : $(property-set) ] ; return $(name).$(VERSION) ; } } # the search path to pick up the openssl libraries from. This is the # property of those libraries rule openssl-lib-path ( properties * ) { local OPENSSL_LIB = [ feature.get-values : $(properties) ] ; if darwin in $(properties) && $(OPENSSL_LIB) = "" { # on macOS, default to pick up openssl from the homebrew installation # brew install openssl # homebrew on M1 Macs install to /opt/homebrew OPENSSL_LIB = /opt/homebrew/opt/openssl/lib /usr/local/opt/openssl/lib ; } else if windows in $(properties) && $(OPENSSL_LIB) = "" { # the de-facto windows installer is https://slproweb.com/products/Win32OpenSSL.html, which installs to c:\Program Files\OpenSSL-Win{32,64}. # chocolatey appears to use this installer. local address_model = [ feature.get-values : $(properties) ] ; OPENSSL_LIB += "C:/Program Files/OpenSSL-Win$(address_model)/lib" ; OPENSSL_LIB += "C:/Program Files (x86)/OpenSSL-Win$(address_model)/lib" ; } local result ; result += $(OPENSSL_LIB) ; return $(result) ; } # the include path to pick up openssl headers from. This is the # usage-requirement for the openssl-related libraries rule openssl-include-path ( properties * ) { local OPENSSL_INCLUDE = [ feature.get-values : $(properties) ] ; if darwin in $(properties) && $(OPENSSL_INCLUDE) = "" { # on macOS, default to pick up openssl from the homebrew installation # brew install openssl # homebrew on M1 Macs install to /opt/homebrew OPENSSL_INCLUDE = /opt/homebrew/opt/openssl/include /usr/local/opt/openssl/include ; } else if windows in $(properties) && $(OPENSSL_INCLUDE) = "" { # the de-facto windows installer is https://slproweb.com/products/Win32OpenSSL.html, which installs to c:\Program Files\OpenSSL-Win{32,64}. # chocolatey appears to use this installer. local address_model = [ feature.get-values : $(properties) ] ; OPENSSL_INCLUDE += "C:/Program Files/OpenSSL-Win$(address_model)/include" ; OPENSSL_INCLUDE += "C:/Program Files (x86)/OpenSSL-Win$(address_model)/include" ; } local result ; result += $(OPENSSL_INCLUDE) ; return $(result) ; } # the search path to pick up the gnutls libraries from. This is the # property of those libraries rule gnutls-lib-path ( properties * ) { local GNUTLS_LIB = [ feature.get-values : $(properties) ] ; if darwin in $(properties) && $(GNUTLS_LIB) = "" { # on macOS, default to pick up openssl from the homebrew installation # brew install openssl # homebrew on M1 Macs install to /opt/homebrew GNUTLS_LIB = /opt/homebrew/opt/gnutls/lib /usr/local/opt/gnutls/lib ; } local result ; result += $(GNUTLS_LIB) ; return $(result) ; } # the include path to pick up gnutls headers from. This is the # usage-requirement for the gnutls-related libraries rule gnutls-include-path ( properties * ) { local GNUTLS_INCLUDE = [ feature.get-values : $(properties) ] ; if darwin in $(properties) && $(GNUTLS_INCLUDE) = "" { # on macOS, default to pick up openssl from the homebrew installation # brew install openssl # homebrew on M1 Macs install to /opt/homebrew GNUTLS_INCLUDE = /opt/homebrew/opt/gnutls/include /usr/local/opt/gnutls/include ; } local result ; result += $(GNUTLS_INCLUDE) ; return $(result) ; } # the search path to pick up the wolfssl libraries from. This is the # property of those libraries rule wolfssl-lib-path ( properties * ) { local WOLFSSL_LIB = [ feature.get-values : $(properties) ] ; if linux in $(properties) && $(WOLFSSL_LIB) = "" { # on linux, default ./configure install path WOLFSSL_LIB = /usr/local/lib ; } local result ; result += $(WOLFSSL_LIB) ; return $(result) ; } # the include path to pick up wolfssl headers from. This is the # usage-requirement for the wolfssl-related libraries rule wolfssl-include-path ( properties * ) { local WOLFSSL_INCLUDE = [ feature.get-values : $(properties) ] ; if linux in $(properties) && $(WOLFSSL_INCLUDE) = "" { # on linux, default ./configure install path WOLFSSL_INCLUDE = /usr/local/include ; } local result ; result += $(WOLFSSL_INCLUDE) ; result += $(WOLFSSL_INCLUDE)/wolfssl ; return $(result) ; } path-constant blacklist-file : tools/sanitizer-blacklist.txt ; feature openssl-lib : : free path ; feature openssl-include : : free path ; feature gnutls-lib : : free path ; feature gnutls-include : : free path ; feature wolfssl-lib : : free path ; feature wolfssl-include : : free path ; feature test-coverage : off on : composite propagated link-incompatible ; feature.compose on : --coverage --coverage ; feature predictive-pieces : on off : composite propagated ; feature.compose off : TORRENT_DISABLE_PREDICTIVE_PIECES ; feature share-mode : on off : composite propagated ; feature.compose off : TORRENT_DISABLE_SHARE_MODE ; feature streaming : on off : composite propagated ; feature.compose off : TORRENT_DISABLE_STREAMING ; feature super-seeding : on off : composite propagated ; feature.compose off : TORRENT_DISABLE_SUPERSEEDING ; feature i2p : on off : composite propagated ; feature.compose on : TORRENT_USE_I2P=1 ; feature.compose off : TORRENT_USE_I2P=0 ; feature asserts : off on production system : composite propagated ; feature.compose on : TORRENT_USE_ASSERTS=1 ; feature.compose production : TORRENT_USE_ASSERTS=1 TORRENT_PRODUCTION_ASSERTS=1 ; feature.compose system : TORRENT_USE_ASSERTS=1 TORRENT_USE_SYSTEM_ASSERTS=1 ; feature windows-version : win7 win10 vista xp : composite propagated ; feature.compose vista : _WIN32_WINNT=0x0600 ; feature.compose win7 : _WIN32_WINNT=0x0601 ; feature.compose win10 : _WIN32_WINNT=0x0A00 ; feature.compose xp : _WIN32_WINNT=0x0501 ; feature extensions : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_EXTENSIONS ; feature asio-debugging : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_ASIO_DEBUGGING ; feature picker-debugging : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_DEBUG_REFCOUNTS ; feature mmap-disk-io : on off : composite propagated ; feature.compose off : TORRENT_HAVE_MMAP=0 TORRENT_HAVE_MAP_VIEW_OF_FILE=0 ; feature simulator : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_BUILD_SIMULATOR ; feature invariant-checks : off on full : composite propagated link-incompatible ; feature.compose on : TORRENT_USE_INVARIANT_CHECKS=1 ; feature.compose full : TORRENT_USE_INVARIANT_CHECKS=1 TORRENT_EXPENSIVE_INVARIANT_CHECKS ; feature utp-log : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_UTP_LOG_ENABLE ; feature simulate-slow-read : off on : composite propagated ; feature.compose on : TORRENT_SIMULATE_SLOW_READ ; feature simulate-slow-write : off on : composite propagated ; feature.compose on : TORRENT_SIMULATE_SLOW_WRITE ; feature logging : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_LOGGING ; feature alert-msg : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_ALERT_MSG ; feature dht : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_DHT ; feature encryption : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_ENCRYPTION ; feature mutable-torrents : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_DISABLE_MUTABLE_TORRENTS ; feature crypto : openssl built-in wolfssl gnutls libcrypto gcrypt : composite propagated ; feature.compose openssl : TORRENT_USE_LIBCRYPTO TORRENT_USE_OPENSSL TORRENT_SSL_PEERS OPENSSL_NO_SSL2 ; feature.compose wolfssl : TORRENT_USE_WOLFSSL TORRENT_USE_LIBCRYPTO TORRENT_USE_OPENSSL OPENSSL_NO_SSL2 BOOST_ASIO_USE_WOLFSSL OPENSSL_ALL WOLFSSL_SHA512 WOLFSSL_NGINX WC_NO_HARDEN ; feature.compose gnutls : TORRENT_USE_GNUTLS TORRENT_SSL_PEERS ; feature.compose libcrypto : TORRENT_USE_LIBCRYPTO ; feature.compose gcrypt : TORRENT_USE_LIBGCRYPT ; feature openssl-version : 1.1 pre1.1 : composite propagated ; feature deprecated-functions : on off : composite propagated link-incompatible ; feature.compose off : TORRENT_NO_DEPRECATE ; feature boost-link : default static shared : propagated composite ; # msvc enables debug iterators by default in debug builds whereas GCC and # clang do not, that's why "default" is there. msvc has incorrect noexcept # constructors on some containers when enabling debug iterators, so it's # possible to turn them off feature debug-iterators : default off on : composite propagated link-incompatible ; feature.compose on : _GLIBCXX_DEBUG _GLIBCXX_DEBUG_PEDANTIC ; feature.compose off : _ITERATOR_DEBUG_LEVEL=0 ; feature fpic : off on : composite propagated link-incompatible ; feature.compose on : -fPIC ; feature profile-calls : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_PROFILE_CALLS=1 ; # controls whether or not to export some internal # libtorrent functions. Used for unit testing feature export-extra : off on : composite propagated ; # export some internal libtorrent functions # in order to me able to unit test them. # this is off by default to keep the export # symbol table reasonably small feature.compose on : TORRENT_EXPORT_EXTRA ; lib advapi32 : : advapi32 ; lib user32 : : user32 ; lib shell32 : : shell32 ; lib gdi32 : : gdi32 ; lib bcrypt : : bcrypt ; lib crypt32 : : crypt32 ; lib z : : shared z ; # openssl libraries on windows # technically, crypt32 is not an OpenSSL dependency, but libtorrent needs it on # windows to access the system certificate store, for authenticating trackers alias ssl-deps : advapi32 user32 shell32 gdi32 crypt32 ; # pre OpenSSL 1.1 windows lib crypto : ssl-deps : windows pre1.1 libeay32 @openssl-lib-path : : @openssl-include-path ; lib ssl : ssl-deps : windows pre1.1 ssleay32 crypto @openssl-lib-path : : @openssl-include-path ; # OpenSSL 1.1+ windows lib crypto : ssl-deps : windows 1.1 libcrypto @openssl-lib-path : : @openssl-include-path ; lib ssl : ssl-deps : windows 1.1 libssl crypto @openssl-lib-path : : @openssl-include-path ; # generic OpenSSL lib crypto : : crypto z @openssl-lib-path : : @openssl-include-path ; lib ssl : : ssl crypto @openssl-lib-path : : @openssl-include-path ; lib gnutls : : gnutls @gnutls-lib-path : : @gnutls-include-path ; lib wolfssl : : wolfssl @wolfssl-lib-path : : @wolfssl-include-path ; lib dbghelp : : dbghelp ; # required for networking on beos lib netkit : : net /boot/system/lib shared ; lib gcc : : gcc static ; # gcrypt on linux/bsd etc. lib gcrypt : : gcrypt shared /opt/local/lib ; lib dl : : shared dl ; lib libsocket : : libnsl socket shared /usr/sfw/lib shared ; lib libnsl : : nsl shared /usr/sfw/lib shared ; lib libnetwork : : network shared ; # socket libraries on windows lib wsock32 : : wsock32 shared ; lib ws2_32 : : ws2_32 shared ; lib iphlpapi : : iphlpapi shared ; SOURCES = alert alert_manager announce_entry assert bandwidth_limit bandwidth_manager bandwidth_queue_entry bdecode bitfield bloom_filter chained_buffer choker close_reason copy_file cpuid crc32c create_torrent directory disk_buffer_holder disk_buffer_pool disk_interface disk_io_thread_pool disabled_disk_io disk_job_fence disk_job_pool drive_info entry error_code file_storage escape_string string_util file path fingerprint gzip hasher hash_picker hex http_connection http_parser identify_client ip_filter ip_helpers ip_notifier ip_voter listen_socket_handle merkle merkle_tree peer_connection platform_util bt_peer_connection web_connection_base web_peer_connection http_seed_connection peer_connection_handle i2p_stream instantiate_connection natpmp packet_buffer piece_picker peer_list proxy_base puff random read_resume_data write_resume_data receive_buffer resolve_links session session_params session_handle session_impl session_call settings_pack sha1 sha1_hash sha256 socket_io socket_type socks5_stream stat storage_utils torrent torrent_handle torrent_info torrent_peer torrent_peer_allocator torrent_status time tracker_manager http_tracker_connection udp_tracker_connection timestamp_history udp_socket upnp utf8 utp_socket_manager utp_stream file_view_pool lsd enum_net magnet_uri parse_url xml_parse version peer_class peer_class_set part_file stat_cache request_blocks session_stats performance_counters resolver session_settings proxy_settings file_progress ffs add_torrent_params peer_info stack_allocator generate_peer_id mmap mmap_disk_io mmap_disk_job mmap_storage posix_disk_io posix_part_file posix_storage ssl truncate load_torrent # -- extensions -- ut_pex ut_metadata smart_ban ; KADEMLIA_SOURCES = dht_state dht_storage dht_tracker msg node node_entry refresh rpc_manager find_data node_id routing_table traversal_algorithm dos_blocker get_peers item get_item put_data ed25519 sample_infohashes dht_settings ; ED25519_SOURCES = add_scalar fe ge key_exchange keypair sc sign verify hasher512 sha512 ; local usage-requirements = ./include ./include/libtorrent release:NDEBUG _FILE_OFFSET_BITS=64 # enable cancel support in asio BOOST_ASIO_ENABLE_CANCELIO # make sure asio uses std::chrono BOOST_ASIO_HAS_STD_CHRONO BOOST_ASIO_NO_DEPRECATED @linking # msvc optimizations msvc,release:"/OPT:ICF=5" msvc,release:"/OPT:REF" # disable bogus deprecation warnings on msvc8 windows:_SCL_SECURE_NO_DEPRECATE windows:_CRT_SECURE_NO_DEPRECATE "$(CXXFLAGS:J= )" ; project torrent ; lib torrent : # sources src/$(SOURCES).cpp : # requirements multi TORRENT_BUILDING_LIBRARY shared:TORRENT_BUILDING_SHARED BOOST_NO_DEPRECATED shared:BOOST_SYSTEM_SOURCE on:src/kademlia/$(KADEMLIA_SOURCES).cpp on:src/ed25519/$(ED25519_SOURCES).cpp @building @warnings @tag $(usage-requirements) "$(LDFLAGS:J= )" : # default build multi 14 512 : # usage requirements $(usage-requirements) shared:TORRENT_LINKING_SHARED ; # install rules # return libdir and includedir rule install-paths ( properties * ) { import version ; # package.paths was introduced in boost-1.70 (2018.02) # however, boost build's versioning scheme changed in boost-1.71 to version # 4.0 # so, if versions are 4.0+ we want to use package.paths, but if it's a year, # say 2018, that means it's old and we use the fallback below. Any version < # 1990 is considered the 4.0 and later numbering scheme. if [ version.version-less 1990 0 : $(jam-version) ] { import option ; import property ; local prefix = [ option.get prefix : [ property.select : $(properties) ] ] ; prefix = $(prefix:G=) ; # Or some likely defaults if neither is given. if ! $(prefix) { if [ modules.peek : NT ] { prefix = C:\\$(package-name) ; } else if [ modules.peek : UNIX ] { prefix = /usr/local ; } } return $(prefix)/lib $(prefix)/include ; } else { local p = [ package.paths libtorrent : $(properties) ] ; return [ $(p).libdir ] [ $(p).includedir ] ; } } rule generate-pkg-config ( properties * ) { import property-set ; import project ; local l = [ project.target [ project.module-name "." ] ] ; # this is the libtorrent library target local t = [ $(l).find torrent : . ] ; # these are the properties we're using to build it with local props = [ $(t).generate [ property-set.create $(properties) ] ] ; local libname = [ $(props[2]).name ] ; props = $(props[1]) ; p = [ install-paths $(properties) ] ; local libdir = $(p[1]) ; local includes = $(p[2]) ; local defines ; local shared_deps ; local private_deps ; for d in [ feature.expand $(properties) ] [ $(props).raw ] { switch $(d) { case \TORRENT_* : { d = [ SPLIT_BY_CHARACTERS $(d) : ">" ] ; defines += $(d[2]) ; } case \BOOST_* : { d = [ SPLIT_BY_CHARACTERS $(d) : ">" ] ; defines += $(d[2]) ; } case \* : { d = [ SPLIT_BY_CHARACTERS $(d) : ">" ] ; d = $(d[2]) ; if ( [ path.is-rooted $(d) ] ) { includes += $(d) ; } } case \* : { d = [ SPLIT_BY_CHARACTERS $(d) : ">" ] ; # this is the target local t = $(d[2]) ; if [ $(t).type ] = SHARED_LIB { local path = [ $(t).path ] ; if $(path) != "" { libdir += $(path) ; } shared_deps += [ $(t).name ] ; } else if [ $(t).type ] = SEARCHED_LIB { local path = [ $(t).search ] ; if $(path) != "" { libdir += $(path) ; } shared_deps += [ $(t).name ] ; } else if ( [ $(t).type ] = STATIC_LIB ) { private_deps += [ $(t).name ] ; } } } } # TODO: use $(libname) in future versions local config = "Name: libtorrent-rasterbar" "\nDescription: libtorrent is an open source C++ library implementing the BitTorrent protocol" "\nURL: https://libtorrent.org" "\nVersion: $(VERSION)" "\nLibs:" " -L\"$(libdir)\"" " -ltorrent-rasterbar" " -l$(shared_deps)" "\nLibs.private:" " -L\"$(libdir)\"" " -l$(private_deps)" "\nCflags:" " -D$(defines)" " -I\"$(includes)\"" "\n" ; local dummy = @("libtorrent-rasterbar.pc":E=$(config)) ; } rule install-pkg-config ( target-name : data * : requirements * ) { import stage ; local p = [ install-paths $(requirements) ] ; local libdir = $(p[0]) ; stage.install $(target-name) : $(data) : $(requirements) $(libdir)/pkgconfig ; import project ; local c = [ project.current ] ; local project-module = [ $(c).project-module ] ; module $(project-module) { explicit $(1) ; } } headers = [ path.glob-tree include/libtorrent : *.hpp ] ; package.install install-torrent-lib : libtorrent : : torrent : $(headers) ; package.install-data install-cmake-module : cmake/Modules : examples/cmake/FindLibtorrentRasterbar.cmake ; install-pkg-config pkg-config-target : libtorrent-rasterbar.pc : @generate-pkg-config ; alias install : install-torrent-lib install-cmake-module pkg-config-target ; explicit install ; # testing headers targets local header_targets ; for local target in $(headers) { if ! [ path.basename $(target) ] in storage.hpp windows.hpp win_util.hpp win_crypto_provider.hpp torrent_impl.hpp io_service.hpp { # this cast tells boost build that the header files really *are* cpp files # otherwise the object rule doesn't know which language to interpret them as obj header-build/$(target).o : [ cast.cast _ cpp : $(target) ] : torrent -fsyntax-only : 14 ; explicit header-build/$(target).o ; header_targets += $(target) ; } } alias check-headers : header-build/$(header_targets).o ; explicit check-headers ;