Browse Source

Merge pull request #90 from mstorchak/transmission

transmission: import from packages, update to latest
sbyx 10 years ago
parent
commit
3339a690a0

+ 122
- 0
net/transmission/Makefile View File

@@ -0,0 +1,122 @@
1
+#
2
+# Copyright (C) 2009-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=transmission
11
+PKG_VERSION:=2.84
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15
+PKG_SOURCE_URL:=http://download-origin.transmissionbt.com/files/ http://mirrors.m0k.org/transmission/files
16
+PKG_MD5SUM:=411aec1c418c14f6765710d89743ae42
17
+
18
+PKG_FIXUP:=autoreconf
19
+PKG_INSTALL:=1
20
+PKG_BUILD_PARALLEL:=1
21
+
22
+include $(INCLUDE_DIR)/package.mk
23
+
24
+define Package/transmission/template
25
+  SUBMENU:=BitTorrent
26
+  SECTION:=net
27
+  CATEGORY:=Network
28
+  TITLE:=A free, lightweight BitTorrent client
29
+  URL:=http://www.transmissionbt.com
30
+  MAINTAINER:=Cezary Jackiewicz <cezary@eko.one.pl>
31
+endef
32
+
33
+define Package/transmission-daemon
34
+  $(call Package/transmission/template)
35
+  DEPENDS:=+libcurl +libopenssl +libpthread +libevent2 +librt
36
+  MENU:=1
37
+endef
38
+
39
+define Package/transmission-cli
40
+  $(call Package/transmission/template)
41
+  DEPENDS:=transmission-daemon
42
+endef
43
+
44
+define Package/transmission-remote
45
+  $(call Package/transmission/template)
46
+  DEPENDS:=+libcurl +libopenssl +libpthread +libevent2 +librt
47
+endef
48
+
49
+define Package/transmission-web
50
+  $(call Package/transmission/template)
51
+  DEPENDS:=transmission-daemon
52
+endef
53
+
54
+
55
+define Package/transmission-daemon/description
56
+ Transmission is a simple BitTorrent client.
57
+ It features a very simple, intuitive interface
58
+ on top on an efficient, cross-platform back-end.
59
+ This package contains the daemon itself.
60
+endef
61
+
62
+define Package/transmission-cli/description
63
+ CLI utilities for transmission.
64
+endef
65
+
66
+define Package/transmission-remote/description
67
+ CLI remote interface for transmission.
68
+endef
69
+
70
+define Package/transmission-web/description
71
+ Webinterface resources for transmission.
72
+endef
73
+
74
+define Package/transmission-daemon/conffiles
75
+/etc/config/transmission
76
+endef
77
+
78
+CONFIGURE_VARS += \
79
+	LIBEVENT_LIBS="$(STAGING_DIR)/usr/lib/libevent-2.0.so.5"
80
+
81
+CONFIGURE_ARGS += \
82
+	--enable-daemon \
83
+	--enable-cli \
84
+	--without-gtk \
85
+	--enable-largefile \
86
+	--enable-lightweight
87
+
88
+MAKE_FLAGS += \
89
+	CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE"
90
+
91
+define Package/transmission-daemon/install
92
+	$(INSTALL_DIR) $(1)/usr/bin
93
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/transmission-daemon $(1)/usr/bin/
94
+	$(INSTALL_DIR) $(1)/etc/init.d/
95
+	$(INSTALL_BIN) files/transmission.init $(1)/etc/init.d/transmission
96
+	$(INSTALL_DIR) $(1)/etc/config
97
+	$(INSTALL_CONF) files/transmission.config $(1)/etc/config/transmission
98
+endef
99
+
100
+define Package/transmission-cli/install
101
+	$(INSTALL_DIR) $(1)/usr/bin
102
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/transmission-cli \
103
+			$(PKG_INSTALL_DIR)/usr/bin/transmission-create \
104
+			$(PKG_INSTALL_DIR)/usr/bin/transmission-edit \
105
+			$(PKG_INSTALL_DIR)/usr/bin/transmission-show \
106
+			$(1)/usr/bin/
107
+endef
108
+
109
+define Package/transmission-remote/install
110
+	$(INSTALL_DIR) $(1)/usr/bin
111
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/transmission-remote $(1)/usr/bin/
112
+endef
113
+
114
+define Package/transmission-web/install
115
+	$(INSTALL_DIR) $(1)/usr/share/transmission
116
+	$(CP) $(PKG_INSTALL_DIR)/usr/share/transmission/web $(1)/usr/share/transmission/
117
+endef
118
+
119
+$(eval $(call BuildPackage,transmission-daemon))
120
+$(eval $(call BuildPackage,transmission-cli))
121
+$(eval $(call BuildPackage,transmission-remote))
122
+$(eval $(call BuildPackage,transmission-web))

+ 71
- 0
net/transmission/files/transmission.config View File

@@ -0,0 +1,71 @@
1
+config transmission
2
+	option enabled 0
3
+	option config_dir '/tmp/transmission'
4
+	#option user 'nobody'
5
+	option alt_speed_down 50
6
+	option alt_speed_enabled false
7
+	option alt_speed_time_begin  540
8
+	option alt_speed_time_day 127
9
+	option alt_speed_time_enabled false
10
+	option alt_speed_time_end 1020
11
+	option alt_speed_up 50
12
+	option bind_address_ipv4 '0.0.0.0'
13
+	option bind_address_ipv6 '::'
14
+	option blocklist_enabled false
15
+	option blocklist_url ''
16
+	option cache_size_mb 2
17
+	option dht_enabled true
18
+	option download_dir '/tmp/transmission/done'
19
+	option download_queue_enabled true
20
+	option download_queue_size 4
21
+	option encryption 1
22
+	option idle_seeding_limit 30
23
+	option idle_seeding_limit_enabled false
24
+	option incomplete_dir '/tmp/transmission/incomplete'
25
+	option incomplete_dir_enabled false
26
+	option lazy_bitfield_enabled true
27
+	option lpd_enabled false
28
+	option message_level 1
29
+	option peer_congestion_algorithm ''
30
+	option peer_limit_global 240
31
+	option peer_limit_per_torrent 60
32
+	option peer_port 51413
33
+	option peer_port_random_high 65535
34
+	option peer_port_random_low 49152
35
+	option peer_port_random_on_start false
36
+	option peer_socket_tos 'default'
37
+	option pex_enabled true
38
+	option port_forwarding_enabled true
39
+	option preallocation 1
40
+	option prefetch_enabled true
41
+	option queue_stalled_enabled true
42
+	option queue_stalled_minutes 30
43
+	option ratio_limit 2.0000
44
+	option ratio_limit_enabled false
45
+	option rename_partial_files true
46
+	option rpc_authentication_required false
47
+	option rpc_bind_address '0.0.0.0'
48
+	option rpc_enabled true
49
+	option rpc_password ''
50
+	option rpc_port 9091
51
+	option rpc_url '/transmission/'
52
+	option rpc_username ''
53
+	option rpc_whitelist '127.0.0.1,192.168.1.*'
54
+	option rpc_whitelist_enabled true
55
+	option scrape_paused_torrents_enabled true
56
+	option script_torrent_done_enabled false
57
+	option script_torrent_done_filename ''
58
+	option seed_queue_enabled false
59
+	option seed_queue_size 10
60
+	option speed_limit_down 100
61
+	option speed_limit_down_enabled false
62
+	option speed_limit_up 20
63
+	option speed_limit_up_enabled false
64
+	option start_added_torrents true
65
+	option trash_original_torrent_files false
66
+	option umask 18
67
+	option upload_slots_per_torrent 14
68
+	option utp_enabled true
69
+	option scrape_paused_torrents true
70
+	option watch_dir_enabled false
71
+	option watch_dir ''

+ 111
- 0
net/transmission/files/transmission.init View File

@@ -0,0 +1,111 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2010-2012 OpenWrt.org
3
+
4
+START=99
5
+
6
+LIST_SEP="
7
+"
8
+
9
+append_params() {
10
+	local p; local v; local s="$1"; shift
11
+	for p in $*; do
12
+		config_get v "$s" "$p"
13
+		IFS="$LIST_SEP"
14
+		for v in $v; do
15
+			[ -n "$v" ] && (
16
+				echo "\""$p"\": "$v"," | sed -e 's|_|-|g' >> $config_file
17
+			)
18
+		done
19
+		unset IFS
20
+	done
21
+}
22
+
23
+append_params_quotes() {
24
+	local p; local v; local s="$1"; shift
25
+	for p in $*; do
26
+		config_get v "$s" "$p"
27
+		IFS="$LIST_SEP"
28
+		for v in $v; do
29
+			[ -n "$v" ] && (
30
+				echo -n "\""$p | sed -e 's|/|\\/|g;s|_|-|g' >> $config_file; \
31
+				echo "\": \""$v"\"," >> $config_file
32
+			)
33
+		done
34
+		unset IFS
35
+	done
36
+}
37
+
38
+section_enabled() {
39
+	config_get_bool enabled "$1" 'enabled' 0
40
+	[ $enabled -gt 0 ]
41
+}
42
+
43
+start_instance() {
44
+	local s="$1"
45
+	local user
46
+
47
+	section_enabled "$section" || return 1
48
+
49
+	config_get config_dir "$s" 'config_dir' '/var/etc/transmission'
50
+	config_get user "$s" 'user'
51
+
52
+	config_file="$config_dir/settings.json"
53
+	[ -d $config_dir ] || {
54
+		mkdir -m 0755 -p "$config_dir"
55
+		touch $config_file
56
+		[ -z "$user" ] || chown -R $user $config_dir
57
+	}
58
+
59
+	echo "{" > $config_file
60
+
61
+	append_params "$s" \
62
+		alt_speed_down alt_speed_enabled alt_speed_time_begin alt_speed_time_day \
63
+		alt_speed_time_enabled alt_speed_time_end alt_speed_up blocklist_enabled \
64
+		cache_size_mb download_queue_enabled download_queue_size \
65
+		dht_enabled encryption idle_seeding_limit idle_seeding_limit_enabled \
66
+		incomplete_dir_enabled lazy_bitfield_enabled lpd_enabled message_level \
67
+		peer_limit_global peer_limit_per_torrent peer_port \
68
+		peer_port_random_high peer_port_random_low peer_port_random_on_start \
69
+		pex_enabled port_forwarding_enabled preallocation prefetch_enabled \
70
+		ratio_limit ratio_limit_enabled rename_partial_files rpc_authentication_required \
71
+		rpc_enabled rpc_port rpc_whitelist_enabled queue_stalled_enabled \
72
+		queue_stalled_minutes scrape_paused_torrents_enabled script_torrent_done_enabled \
73
+		seed_queue_enabled seed_queue_size \
74
+		speed_limit_down speed_limit_down_enabled speed_limit_up \
75
+		speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
76
+		umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \
77
+		watch_dir_enabled
78
+
79
+	append_params_quotes "$s" \
80
+		blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
81
+		peer_congestion_algorithm peer_socket_tos rpc_bind_address rpc_password rpc_url \
82
+		rpc_username rpc_whitelist script_torrent_done_filename watch_dir
83
+
84
+	echo "\""invalid-key"\": false" >> $config_file
85
+	echo "}" >> $config_file
86
+
87
+	SERVICE_UID="$user" \
88
+	service_start /usr/bin/transmission-daemon -g $config_dir
89
+}
90
+
91
+stop_instance() {
92
+	local s="$1"
93
+	local user
94
+
95
+	section_enabled "$section" || return 1
96
+
97
+	config_get user "$s" 'user'
98
+
99
+	SERVICE_UID="$user" \
100
+	service_stop /usr/bin/transmission-daemon
101
+}
102
+
103
+start() {
104
+	config_load 'transmission'
105
+	config_foreach start_instance 'transmission'
106
+}
107
+
108
+stop() {
109
+	config_load 'transmission'
110
+	config_foreach stop_instance 'transmission'
111
+}

+ 12
- 0
net/transmission/patches/010_libtransmission_fallocate64_eglibc.patch View File

@@ -0,0 +1,12 @@
1
+--- a/libtransmission/fdlimit.c	2014-07-01 20:08:59.000000000 +0300
2
++++ b/libtransmission/fdlimit.c	2014-07-13 13:30:17.000000000 +0300
3
+@@ -22,7 +22,8 @@
4
+  #include <fcntl.h>
5
+ #endif
6
+ 
7
+-#ifdef HAVE_FALLOCATE64
8
++/* no need to define fallocate64 in glibc/eglibc case */
9
++#if defined(__UCLIBC__) && (HAVE_FALLOCATE64)
10
+   /* FIXME can't find the right #include voodoo to pick up the declaration.. */
11
+   extern int fallocate64 (int fd, int mode, uint64_t offset, uint64_t len);
12
+ #endif

+ 11
- 0
net/transmission/patches/020-use-internal-miniupnp.patch View File

@@ -0,0 +1,11 @@
1
+--- a/configure.ac
2
++++ b/configure.ac
3
+@@ -251,7 +251,7 @@
4
+ AC_LINK_IFELSE(
5
+   [AC_LANG_PROGRAM([#include <miniupnpc/miniupnpc.h>],
6
+                    [struct UPNPDev dev;])],
7
+-  [upnp_version="unknown"],
8
++  [upnp_version="none"],
9
+   [upnp_version="none"]
10
+ )
11
+