aboutsummaryrefslogtreecommitdiff
path: root/net-p2p/mktorrent
diff options
context:
space:
mode:
authorAlexey Dokuchaev <danfe@FreeBSD.org>2017-03-12 13:35:29 +0000
committerAlexey Dokuchaev <danfe@FreeBSD.org>2017-03-12 13:35:29 +0000
commit7e20f336e56aa20bac843c094edeb4595f5f3fb9 (patch)
tree908855d238e690a16552c6bb1d7f38f790bedafb /net-p2p/mktorrent
parentb07727defd03d542dc3d2214bb05ea9dc275a717 (diff)
downloadports-7e20f336e56aa20bac843c094edeb4595f5f3fb9.tar.gz
ports-7e20f336e56aa20bac843c094edeb4595f5f3fb9.zip
net-p2p/mktorrent: increase max piece size and make tracker optional
Optimal piece count is ~1500. mktorrent allows up to 2^28 currently, thus providing ability to create torrents for 375 GiB of data with optimal piece count. Increase maximum piece size to 2^30 thus allowing torrents for 1.5 TiB of data (again, with optimal piece count). mktorrent currently can't create torrents without announce URL. Since DHT works perfectly well nowadays, this limitation doesn't make much sense. Change to require tracker only when creating private torrent (i.e. DHT, PEX, etc. disabled). While here: define LICENSE (GPLv2+), make options actually work, remove redundant THREADS_DESC, and clean up Makefile a bit. PR: 210374 Submitted by: Anton Sayetsky Approved by: maintainer timeout
Notes
Notes: svn path=/head/; revision=435987
Diffstat (limited to 'net-p2p/mktorrent')
-rw-r--r--net-p2p/mktorrent/Makefile28
-rw-r--r--net-p2p/mktorrent/files/patch-init.c112
-rw-r--r--net-p2p/mktorrent/files/patch-output.c32
3 files changed, 153 insertions, 19 deletions
diff --git a/net-p2p/mktorrent/Makefile b/net-p2p/mktorrent/Makefile
index 995a3cb4580c..08397e1a706f 100644
--- a/net-p2p/mktorrent/Makefile
+++ b/net-p2p/mktorrent/Makefile
@@ -3,24 +3,24 @@
PORTNAME= mktorrent
PORTVERSION= 1.0
+PORTREVISION= 1
CATEGORIES= net-p2p
MASTER_SITES= SF
MAINTAINER= dgerow@afflictions.org
COMMENT= Command-line utility for creating BitTorrent metainfo files
-.if defined(.PARSEDIR)
-USES= gmake
-.else
+LICENSE= GPLv2+
+LICENSE_FILE= ${WRKSRC}/COPYING
+
MAKEFILE= BSDmakefile
-.endif
-MAKE_FLAGS= USE_LONG_OPTIONS=1
+MAKE_ARGS= USE_LONG_OPTIONS=1
PLIST_FILES= bin/mktorrent
OPTIONS_DEFINE= THREADS OPENSSL HASHCHECK
OPTIONS_DEFAULT= THREADS OPENSSL HASHCHECK
-THREADS_DESC= Enable support for pthreads
+
OPENSSL_DESC= Use OpenSSL for hashing
HASHCHECK_DESC= Verify file hashes
@@ -28,19 +28,9 @@ OPENSSL_USES= ssl
OPENSSL_CFLAGS= -I${OPENSSLINC}
OPENSSL_LDFLAGS= -L${OPENSSLLIB}
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MTHREADS}
-MAKE_FLAGS+= USE_PTHREADS=1
-.endif
-
-.if ${PORT_OPTIONS:MOPENSSL}
-MAKE_FLAGS+= USE_OPENSSL=1
-.endif
-
-.if ! ${PORT_OPTIONS:MHASHCHECK}
-MAKE_FLAGS+= NO_HASH_CHECK=1
-.endif
+THREADS_MAKE_ARGS= USE_PTHREADS=1
+OPENSSL_MAKE_ARGS= USE_OPENSSL=1
+HASHCHECK_MAKE_ARGS= NO_HASH_CHECK=1
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
diff --git a/net-p2p/mktorrent/files/patch-init.c b/net-p2p/mktorrent/files/patch-init.c
new file mode 100644
index 000000000000..1ab23cf6e8cc
--- /dev/null
+++ b/net-p2p/mktorrent/files/patch-init.c
@@ -0,0 +1,112 @@
+--- init.c.orig 2009-08-25 18:53:22 UTC
++++ init.c
+@@ -277,7 +277,7 @@ static void print_help()
+ "Options:\n"
+ #ifdef USE_LONG_OPTIONS
+ "-a, --announce=<url>[,<url>]* : specify the full announce URLs\n"
+- " at least one is required\n"
++ " at least one is required on private torrent\n"
+ " additional -a adds backup trackers\n"
+ "-c, --comment=<comment> : add a comment to the metainfo\n"
+ "-d, --no-date : don't write the creation date\n"
+@@ -298,7 +298,7 @@ static void print_help()
+ " additional -w adds more URLs\n"
+ #else
+ "-a <url>[,<url>]* : specify the full announce URLs\n"
+- " at least one is required\n"
++ " at least one is required on private torrent\n"
+ " additional -a adds backup trackers\n"
+ "-c <comment> : add a comment to the metainfo\n"
+ "-d : don't write the creation date\n"
+@@ -343,7 +343,7 @@ static void print_announce_list(llist_t
+ */
+ static void print_web_seed_list(slist_t *list)
+ {
+- printf(" Web Seed URL: ");
++ printf(" Web Seed URLs: ");
+
+ if (list == NULL) {
+ printf("none\n");
+@@ -361,17 +361,20 @@ static void print_web_seed_list(slist_t
+ static void dump_options(metafile_t *m)
+ {
+ printf("Options:\n"
+- " Announce URLs:\n");
++ " Announce URLs:");
+
+- print_announce_list(m->announce_list);
++ if (m->announce_list) {
++ printf("\n");
++ print_announce_list(m->announce_list);
++ } else
++ printf(" none\n");
+
+- printf(" Torrent name: %s\n"
+- " Metafile: %s\n"
+- " Piece length: %u\n"
+- " Be verbose: yes\n",
++ printf(" Torrent name: %s\n"
++ " Metafile: %s\n"
++ " Piece length: %u\n",
+ m->torrent_name, m->metainfo_file_path, m->piece_length);
+
+- printf(" Write date: ");
++ printf(" Write date: ");
+ if (m->no_creation_date)
+ printf("no\n");
+ else
+@@ -379,11 +382,17 @@ static void dump_options(metafile_t *m)
+
+ print_web_seed_list(m->web_seed_list);
+
+- printf(" Comment: ");
++ printf(" Comment: ");
+ if (m->comment == NULL)
+- printf("none\n\n");
++ printf("none\n");
+ else
+- printf("\"%s\"\n\n", m->comment);
++ printf("\"%s\"\n", m->comment);
++
++ printf(" Private: ");
++ if (m->private)
++ printf("yes\n\n");
++ else
++ printf("no\n\n");
+ }
+
+ /*
+@@ -495,22 +504,25 @@ EXPORT void init(metafile_t *m, int argc
+
+ /* set the correct piece length.
+ default is 2^18 = 256kb. */
+- if (m->piece_length < 15 || m->piece_length > 28) {
++ if (m->piece_length < 15 || m->piece_length > 30) {
+ fprintf(stderr,
+ "The piece length must be a number between "
+- "15 and 28.\n");
++ "15 and 30.\n");
+ exit(EXIT_FAILURE);
+ }
+ m->piece_length = 1 << m->piece_length;
+
+- /* user must specify at least one announce URL as it wouldn't make
+- * any sense to have a default for this */
++ /* user must specify at least one announce URL when private flag set
++ as it wouldn't make any sense to have a default for this */
+ if (m->announce_list == NULL) {
+- fprintf(stderr, "Must specify an announce URL. "
+- "Use -h for help.\n");
+- exit(EXIT_FAILURE);
++ if (m->private == 1) {
++ fprintf(stderr, "Must specify an announce URL. "
++ "Use -h for help.\n");
++ exit(EXIT_FAILURE);
++ }
++ } else {
++ announce_last->next = NULL;
+ }
+- announce_last->next = NULL;
+
+ /* ..and a file or directory from which to create the torrent */
+ if (optind >= argc) {
diff --git a/net-p2p/mktorrent/files/patch-output.c b/net-p2p/mktorrent/files/patch-output.c
new file mode 100644
index 000000000000..d9ca4ee8babb
--- /dev/null
+++ b/net-p2p/mktorrent/files/patch-output.c
@@ -0,0 +1,32 @@
+--- output.c.orig 2009-08-25 18:53:22 UTC
++++ output.c
+@@ -119,15 +119,20 @@ EXPORT void write_metainfo(FILE *f, meta
+ printf("Writing metainfo file... ");
+ fflush(stdout);
+
+- /* every metainfo file is one big dictonary
+- and the first entry is the announce URL */
+- fprintf(f, "d8:announce%lu:%s",
+- (unsigned long)strlen(m->announce_list->l->s),
+- m->announce_list->l->s);
+- /* write the announce-list entry if we have
+- more than one announce URL */
+- if (m->announce_list->next || m->announce_list->l->next)
+- write_announce_list(f, m->announce_list);
++ /* every metainfo file is one big dictonary */
++ fprintf(f, "d");
++
++ /* first entry is the announce URL (optional) */
++ if (m->announce_list != NULL) {
++ fprintf(f, "8:announce%lu:%s",
++ (unsigned long)strlen(m->announce_list->l->s),
++ m->announce_list->l->s);
++ /* write the announce-list entry if we have
++ more than one announce URL */
++ if (m->announce_list->next || m->announce_list->l->next)
++ write_announce_list(f, m->announce_list);
++ }
++
+ /* add the comment if one is specified */
+ if (m->comment != NULL)
+ fprintf(f, "7:comment%lu:%s",