add libtorrent & rtorrent (thanks to belrpr in the forum)
[packages.git] / libs / libtorrent / Makefile
1
2 # Copyright (C) 2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=libtorrent
12 PKG_VERSION:=0.11.7
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://libtorrent.rakshasa.no/downloads/
17 PKG_MD5SUM:=86cdfca2d1c3cfb3b6b316d9beaa25e0
18
19 PKG_BUILD_DEPENDS:=libtool
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/libtorrent
24   SECTION:=libs
25   CATEGORY:=Libraries
26   TITLE:=Rakshasa's BitTorrent library
27   URL:=http://libtorrent.rakshasa.no/
28   DEPENDS:=+libsigcxx
29 endef
30
31 define Package/libtorrent/description
32  LibTorrent is a BitTorrent library written in C++ for *nix, with a focus 
33  on high performance and good code. The library differentiates itself from 
34  other implementations by transfering directly from file pages to the 
35  network stack. On high-bandwidth connections it is able to seed at 3 times 
36  the speed of the official client.
37 endef
38
39 CONFIGURE_ARGS+= \
40         --enable-shared \
41         --enable-static \
42         --enable-aligned \
43         --disable-debug \
44         --disable-openssl \
45
46 CONFIGURE_VARS += \
47         CXX="g++-uc+std" \
48         CXXFLAGS="$$$$CXXFLAGS -fno-rtti"  \
49
50 define Build/Configure
51         $(call Build/Configure/Default,)
52         $(call libtool_disable_rpath)
53         $(SED) 's|^sys_lib_dlsearch_path_spec=.*|sys_lib_dlsearch_path_spec="$(STAGING_DIR)/usr/lib"|g' \
54                 $(PKG_BUILD_DIR)/libtool
55         $(SED) 's|^postdeps=.*|postdeps=|g' $(PKG_BUILD_DIR)/libtool
56 endef
57
58 define Build/Compile
59         $(MAKE) -C $(PKG_BUILD_DIR) all
60         $(call libtool_fixup_libdir,$(PKG_INSTALL_DIR))
61         $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" install
62 endef
63
64 define Build/InstallDev
65         mkdir -p $(STAGING_DIR)/usr/include
66         $(CP) $(PKG_INSTALL_DIR)/usr/include/torrent $(STAGING_DIR)/usr/include/
67         mkdir -p $(STAGING_DIR)/usr/lib
68         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.{a,so*} $(STAGING_DIR)/usr/lib/
69         mkdir -p $(STAGING_DIR)/usr/lib/pkgconfig
70         $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtorrent.pc $(STAGING_DIR)/usr/lib/pkgconfig/
71         $(SED) 's,^includedir=.*,includedir=$(STAGING_DIR)/usr/include,g' $(STAGING_DIR)/usr/lib/pkgconfig/libtorrent.pc
72         $(SED) 's,^libdir=.*,libdir=$(STAGING_DIR)/usr/lib,g' $(STAGING_DIR)/usr/lib/pkgconfig/libtorrent.pc
73         $(SED) 's,$(TARGET_LDFLAGS),,g' $(STAGING_DIR)/usr/lib/pkgconfig/libtorrent.pc
74 endef
75
76 define Build/UninstallDev
77         rm -rf  $(STAGING_DIR)/usr/include/torrent \
78                 $(STAGING_DIR)/usr/lib/libtorrent.{a,so*} \
79                 $(STAGING_DIR)/usr/lib/pkgconfig/libtorrent.pc
80 endef
81
82 define Package/libtorrent/install
83         $(INSTALL_DIR) $(1)/usr/lib
84         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.so.* $(1)/usr/lib/
85 endef
86
87 $(eval $(call BuildPackage,libtorrent))
88