From ad758ba286dd19e2004afb065e905461e4868e4a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 9 Sep 2019 14:58:53 -0700 Subject: [PATCH 1/3] libsigcxx: Remove It's no longer needed with libtorrent. No other package depends on it. Signed-off-by: Rosen Penev --- libs/libsigc++/Makefile | 65 ----------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 libs/libsigc++/Makefile diff --git a/libs/libsigc++/Makefile b/libs/libsigc++/Makefile deleted file mode 100644 index c71771400..000000000 --- a/libs/libsigc++/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright (C) 2006-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=libsigc++ -PKG_VERSION:=2.10.2 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@GNOME/libsigc++/2.10 -PKG_HASH:=b1ca0253379596f9c19f070c83d362b12dfd39c0a3ea1dd813e8e21c1a097a98 - -PKG_MAINTAINER:=Rosen Penev -PKG_LICENSE:=LGPL-3.0-or-later -PKG_LICENSE_FILES:=COPYING - -PKG_INSTALL:=1 -PKG_BUILD_PARALLEL:=1 - -include $(INCLUDE_DIR)/package.mk - -define Package/libsigcxx - SECTION:=libs - CATEGORY:=Libraries - TITLE:=typesafe callback system for standard C++ - URL:=https://libsigcplusplus.github.io/libsigcplusplus/ - DEPENDS:=+libstdcpp -endef - -define Package/libsigcxx/description - It allows you to define signals and to connect those signals to any - callback function, either global or a member function, regardless of - whether it is static or virtual. -endef - -CONFIGURE_ARGS += \ - --enable-shared \ - --enable-static \ - --disable-benchmark \ - --disable-documentation \ - --disable-deprecated-api \ - --disable-warnings \ - --without-boost - -define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/sigc++-2.0 $(1)/usr/include/ - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsigc-2.0.{a,so*} $(1)/usr/lib/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/sigc++-2.0 $(1)/usr/lib/ - $(INSTALL_DIR) $(1)/usr/lib/pkgconfig - $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/sigc++-2.0.pc $(1)/usr/lib/pkgconfig/ -endef - -define Package/libsigcxx/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsigc-2.0.so.* $(1)/usr/lib/ -endef - -$(eval $(call BuildPackage,libsigcxx)) From e56fada5a860c12815af7235ed8500c7f446cac4 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 9 Sep 2019 15:00:42 -0700 Subject: [PATCH 2/3] libtorrent: Switch to static library. libtorrent is only used by rtorrent. Switch to a static library to save space. Removed libsigc++ dependency. It seems it's not needed. Signed-off-by: Rosen Penev --- libs/libtorrent/Makefile | 12 ++---- libs/libtorrent/patches/010-usleep.patch | 54 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 libs/libtorrent/patches/010-usleep.patch diff --git a/libs/libtorrent/Makefile b/libs/libtorrent/Makefile index 86d6f7dbf..15b018d70 100644 --- a/libs/libtorrent/Makefile +++ b/libs/libtorrent/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libtorrent PKG_VERSION:=0.13.8 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/rakshasa/libtorrent/tar.gz/v$(PKG_VERSION)? @@ -22,7 +22,6 @@ PKG_LICENSE_FILES:=COPYING PKG_FIXUP:=autoreconf PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 -PKG_REMOVE_FILES:=autogen.sh include $(INCLUDE_DIR)/package.mk @@ -31,7 +30,7 @@ define Package/libtorrent CATEGORY:=Libraries TITLE:=Rakshasa's BitTorrent library URL:=https://rakshasa.github.io/rtorrent/ - DEPENDS:=+libopenssl +libsigcxx +zlib + DEPENDS:=+libopenssl +libstdcpp +zlib endef define Package/libtorrent/description @@ -59,14 +58,9 @@ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/torrent $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.{a,so*} $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.a $(1)/usr/lib/ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtorrent.pc $(1)/usr/lib/pkgconfig/ endef -define Package/libtorrent/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.so.* $(1)/usr/lib/ -endef - $(eval $(call BuildPackage,libtorrent)) diff --git a/libs/libtorrent/patches/010-usleep.patch b/libs/libtorrent/patches/010-usleep.patch new file mode 100644 index 000000000..6539fad1f --- /dev/null +++ b/libs/libtorrent/patches/010-usleep.patch @@ -0,0 +1,54 @@ +--- a/src/data/hash_queue.cc ++++ b/src/data/hash_queue.cc +@@ -38,9 +38,10 @@ + + #define __STDC_FORMAT_MACROS + ++#include ++#include + #include + #include +-#include + + #include "torrent/exceptions.h" + #include "torrent/data/download_data.h" +@@ -137,7 +138,7 @@ HashQueue::remove(HashQueueNode::id_type id) { + + while ((done_itr = m_done_chunks.find(hash_chunk)) == m_done_chunks.end()) { + pthread_mutex_unlock(&m_done_chunks_lock); +- usleep(100); ++ std::this_thread::sleep_for(std::chrono::microseconds(100)); + pthread_mutex_lock(&m_done_chunks_lock); + } + +--- a/src/torrent/utils/thread_base.cc ++++ b/src/torrent/utils/thread_base.cc +@@ -37,8 +37,9 @@ + #include "config.h" + + #include ++#include ++#include + #include +-#include + + #include "exceptions.h" + #include "poll.h" +@@ -97,7 +98,7 @@ thread_base::stop_thread_wait() { + release_global_lock(); + + while (!is_inactive()) { +- usleep(1000); ++ std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + + acquire_global_lock(); +@@ -161,7 +162,7 @@ thread_base::event_loop(thread_base* thread) { + } + + // Add the sleep call when testing interrupts, etc. +- // usleep(50); ++ // std::this_thread::sleep_for(std::chrono::microseconds(50)); + + int poll_flags = 0; + From 358495f1184d005624f7e15fc9990bde1bb7552e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 9 Sep 2019 15:16:08 -0700 Subject: [PATCH 3/3] rtorrent: Switch to using static libtorrent rtorrent is the only user of libtorrent. Statically link to save space. Added usleep patch. Signed-off-by: Rosen Penev --- net/rtorrent/Makefile | 12 +++++----- net/rtorrent/patches/130-usleep.patch | 33 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 net/rtorrent/patches/130-usleep.patch diff --git a/net/rtorrent/Makefile b/net/rtorrent/Makefile index 1b23c5ba8..77a2cea19 100644 --- a/net/rtorrent/Makefile +++ b/net/rtorrent/Makefile @@ -9,12 +9,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rtorrent PKG_VERSION:=0.9.8 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/rakshasa/rtorrent/tar.gz/v$(PKG_VERSION)? PKG_HASH:=bc889ce1dde475ec56aa72ae996912ff58723226a4f4256fef4f1f8636d991d4 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) PKG_MAINTAINER:=Rosen Penev PKG_LICENSE:=GPL-2.0-or-later @@ -23,7 +22,7 @@ PKG_LICENSE_FILES:=COPYING PKG_FIXUP:=autoreconf PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 -PKG_REMOVE_FILES:=autogen.sh +PKG_BUILD_DEPENDS:=libtorrent include $(INCLUDE_DIR)/package.mk @@ -33,7 +32,7 @@ define Package/rtorrent/Default CATEGORY:=Network TITLE:=BitTorrent client for ncurses URL:=https://github.com/rakshasa/rtorrent - DEPENDS:=+libcurl +libtorrent +libncurses +libpthread + DEPENDS:=+libcurl +libncurses +libpthread +libopenssl +libstdcpp +zlib endef define Package/rtorrent/Default/description @@ -66,8 +65,8 @@ $(call Package/rtorrent/Default/description) endef CONFIGURE_ARGS += \ - --enable-shared \ - --disable-static \ + --enable-static \ + --disable-shared \ --disable-debug \ --with-libcurl="$(STAGING_DIR)/usr" \ --with-ncurses \ @@ -78,6 +77,7 @@ CONFIGURE_ARGS += --with-xmlrpc-c endif TARGET_CXXFLAGS += -faligned-new +TARGET_LDFLAGS += -lcrypto -lz define Package/rtorrent/install $(INSTALL_DIR) $(1)/usr/bin diff --git a/net/rtorrent/patches/130-usleep.patch b/net/rtorrent/patches/130-usleep.patch new file mode 100644 index 000000000..c3463e4be --- /dev/null +++ b/net/rtorrent/patches/130-usleep.patch @@ -0,0 +1,33 @@ +From b3d75a642177f21f00d18f0e46bca4a9f363d08e Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 23 Aug 2019 13:35:28 -0700 +Subject: [PATCH] Replace usleep with C++11 sleep_for + +usleep was deprecated with POSIX 2008 and optionally unavailable with +uClibc-ng. +--- + src/thread_base.cc | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/thread_base.cc b/src/thread_base.cc +index 081791d4..275015ab 100644 +--- a/src/thread_base.cc ++++ b/src/thread_base.cc +@@ -42,6 +42,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -66,7 +68,7 @@ class lt_cacheline_aligned thread_queue_hack { + + thread_queue_hack() { std::memset(this, 0, sizeof(thread_queue_hack)); } + +- void lock() { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) usleep(0); } ++ void lock() { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) std::this_thread::sleep_for(std::chrono::microseconds(0)); } + void unlock() { __sync_bool_compare_and_swap(&m_lock, 1, 0); } + + iterator begin() { return m_queue; }