opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: 12d2c5179cb8a57fafb298b013a245dcadf24696
Parent: d8a43db4fbfba5ab9c25e1303558c41546374658
Author: Randy Palamar
Date:   Tue,  4 Jun 2024 06:23:27 -0600

add transmission from oasis

Diffstat:
Mpkg/net/gen.lua | 1+
Apkg/net/transmission/.gitignore | 4++++
Apkg/net/transmission/README.md | 16++++++++++++++++
Apkg/net/transmission/config.h | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/net/transmission/gen.lua | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/net/transmission/patch/0001-Use-BearSSL-for-SHA1-and-DH-add-fallback-RC4.patch | 339+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/net/transmission/patch/0002-Choose-larger-pieces-for-larger-sizes.patch | 44++++++++++++++++++++++++++++++++++++++++++++
Apkg/net/transmission/sha256 | 1+
Apkg/net/transmission/url | 1+
Apkg/net/transmission/ver | 1+
Msets.lua | 1+
11 files changed, 646 insertions(+), 0 deletions(-)

diff --git a/pkg/net/gen.lua b/pkg/net/gen.lua @@ -2,3 +2,4 @@ subgen('curl') subgen('mblaze') subgen('msmtp') subgen('sfeed') +subgen('transmission') diff --git a/pkg/net/transmission/.gitignore b/pkg/net/transmission/.gitignore @@ -0,0 +1,4 @@ +/libminiupnp.ninja +/libnatpmp.ninja +/src +/transmission-3.00.tar.xz diff --git a/pkg/net/transmission/README.md b/pkg/net/transmission/README.md @@ -0,0 +1,16 @@ +# transmission + +## config.h + +Generated with + + ./configure \ + --disable-nls \ + --without-gtk \ + --without-systemd \ + LIBCURL_CFLAGS=-I/src/oasis/out/pkg/curl/include \ + LIBCURL_LIBS=/src/oasis/out/pkg/curl/libcurl.a \ + PKG_CONFIG=true + +transmission doesn't create `config.h` by default, so it was created from the +defines at the end of `config.log`. diff --git a/pkg/net/transmission/config.h b/pkg/net/transmission/config.h @@ -0,0 +1,82 @@ +#define PACKAGE_DATA_DIR "/share" +#define WITH_INOTIFY 1 + +/* #undef BUILD_MAC_CLIENT */ +/* #undef ENABLE_NLS */ +/* #undef GETTEXT_PACKAGE */ +#define HAVE_BASENAME 1 +/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */ +/* #undef HAVE_CANONICALIZE_FILE_NAME */ +#define HAVE_DAEMON 1 +/* #undef HAVE_DCGETTEXT */ +#define HAVE_DECL_POSIX_FADVISE 1 +#define HAVE_DIRNAME 1 +#define HAVE_DLFCN_H 1 +/* #undef HAVE_FALLOCATE64 */ +#define HAVE_GETMNTENT 1 +#define HAVE_GETPAGESIZE 1 +/* #undef HAVE_GETTEXT */ +/* #undef HAVE_HTONLL */ +#define HAVE_ICONV 1 +#define HAVE_INTTYPES_H 1 +/* #undef HAVE_LC_MESSAGES */ +/* #undef HAVE_LIBAPPINDICATOR */ +/* #undef HAVE_LIBINTL_H */ +/* #undef HAVE_LOCALE_H */ +#define HAVE_LOCALTIME_R 1 +#define HAVE_LRINTF 1 +#define HAVE_MEMMEM 1 +#define HAVE_MEMORY_H 1 +#define HAVE_MKDTEMP 1 +/* #undef HAVE_NTOHLL */ +#define HAVE_POSIX_FADVISE 1 +#define HAVE_POSIX_FALLOCATE 1 +#define HAVE_POSIX_MEMALIGN 1 +#define HAVE_PREAD 1 +#define HAVE_PTHREAD 1 +#define HAVE_PWRITE 1 +#define HAVE_STATVFS 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRCASESTR 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRSEP 1 +#define HAVE_STRTOLD 1 +#define HAVE_SYSLOG 1 +#define HAVE_SYS_STATVFS_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_USELOCALE 1 +#define HAVE_VALLOC 1 +/* #undef HAVE_XFS_XFS_H */ +/* #undef HAVE_XLOCALE_H */ +/* #undef HAVE__CONFIGTHREADLOCALE */ +#define LT_OBJDIR ".libs/" +/* #undef MINIUPNPC_API_VERSION */ +#define PACKAGE "transmission" +#define PACKAGE_BUGREPORT "https://github.com/transmission/transmission" +#define PACKAGE_NAME "transmission" +#define PACKAGE_STRING "transmission 3.00" +#define PACKAGE_TARNAME "transmission" +#define PACKAGE_URL "" +#define PACKAGE_VERSION "3.00" +/* #undef PTHREAD_CREATE_JOINABLE */ +#define STDC_HEADERS 1 +#define SYSTEM_MINIUPNP 1 +#define TIME_WITH_SYS_TIME 1 +/* #undef TR_LIGHTWEIGHT */ +/* #undef USE_SYSTEMD */ +#define VERSION "3.00" +#define WITH_UTP 1 +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif +/* #undef _FILE_OFFSET_BITS */ +/* #undef _LARGE_FILES */ +#ifndef __cplusplus +/* #undef inline */ +#endif diff --git a/pkg/net/transmission/gen.lua b/pkg/net/transmission/gen.lua @@ -0,0 +1,156 @@ +sub('libnatpmp.ninja', function() + cflags{'-D ENABLE_STRNATPMPERR'} + lib('libnatpmp.a', 'third-party/libnatpmp/(getgateway.c natpmp.c wingettimeofday.c)') +end) +sub('libminiupnp.ninja', function() + cflags{ + '-D _GNU_SOURCE', + '-I $outdir/miniupnpc', + '-isystem $outdir/pkg/sys/openbsd/include', + } + + build('sed', '$outdir/miniupnpc/miniupnpcstrings.h', '$srcdir/third-party/miniupnpc/miniupnpcstrings.h.in', { + expr='-e s,OS/version,Linux, -e s,version,,', + }) + + lib('libminiupnp.a', [[ + third-party/miniupnpc/( + connecthostport.c + igd_desc_parse.c + minisoap.c + minissdpc.c + miniupnpc.c + miniwget.c + minixml.c + portlistingparse.c + receivedata.c + upnpcommands.c + upnpdev.c + upnperrors.c + upnpreplyparse.c + ) + ]], {'$outdir/miniupnpc/miniupnpcstrings.h', 'pkg/sys/openbsd/headers'}) +end) + +cflags({ + '-D __TRANSMISSION__', + '-I $dir', + '-I $srcdir', + '-I $srcdir/third-party', + '-I $srcdir/third-party/libb64/include', + '-I $srcdir/third-party/libnatpmp', + '-isystem $builddir/pkg/libs/bearssl/include', + '-isystem $builddir/pkg/libs/libevent/include', + '-isystem $builddir/pkg/libs/libutp/include', + '-isystem $builddir/pkg/libs/zlib/include', + '-isystem $builddir/pkg/net/curl/include', + '-isystem $builddir/pkg/sys/openbsd/include', + '-include config.h', +}) + +pkg.deps = { + 'pkg/libs/bearssl/headers', + 'pkg/libs/libevent/headers', + 'pkg/libs/libutp/headers', + 'pkg/libs/zlib/headers', + 'pkg/net/curl/headers', + 'pkg/sys/openbsd/headers', +} + +lib('libtransmission.a', [[ + libtransmission/( + announcer.c + announcer-http.c + announcer-udp.c + bandwidth.c + bitfield.c + blocklist.c + cache.c + clients.c + completion.c + ConvertUTF.c + crypto.c + crypto-utils.c + crypto-utils-fallback.c + error.c + fdlimit.c + file.c + handshake.c + history.c + inout.c + list.c + log.c + magnet.c + makemeta.c + metainfo.c + natpmp.c + net.c + peer-io.c + peer-mgr.c + peer-msgs.c + platform.c + platform-quota.c + port-forwarding.c + ptrarray.c + quark.c + resume.c + rpcimpl.c + rpc-server.c + session.c + session-id.c + stats.c + torrent.c + torrent-ctor.c + torrent-magnet.c + tr-assert.c + tr-dht.c + tr-lpd.c + tr-udp.c + tr-utp.c + tr-getopt.c + trevent.c + upnp.c + utils.c + variant.c + variant-benc.c + variant-json.c + verify.c + watchdir.c + watchdir-generic.c + web.c + webseed.c + wildmat.c + + watchdir-inotify.c + file-posix.c + subprocess-posix.c + crypto-utils-bearssl.c + ) + libb64.a libdht.a libminiupnp.a libnatpmp.a + $builddir/pkg/( + libs/bearssl/libbearssl.a + libs/libevent/libevent.a + libs/libutp/libutp.a + libs/zlib/libz.a + net/curl/libcurl.a.d + ) +]]) + +lib('libb64.a', {'third-party/libb64/src/cdecode.c', 'third-party/libb64/src/cencode.c'}) +lib('libdht.a', {'third-party/dht/dht.c'}) + +exe('transmission-daemon', { + 'daemon/daemon.c', + 'daemon/daemon-posix.c', + 'libtransmission.a.d', +}) +file('bin/transmission-daemon', '755', '$outdir/transmission-daemon') +man({'daemon/transmission-daemon.1'}) + +for _, tool in ipairs({'create', 'edit', 'remote', 'show'}) do + exe('transmission-'..tool, {'utils/'..tool..'.c', 'libtransmission.a.d'}) + file('bin/transmission-'..tool, '755', '$outdir/transmission-'..tool) + man({'utils/transmission-'..tool..'.1'}) +end + +fetch('curl') diff --git a/pkg/net/transmission/patch/0001-Use-BearSSL-for-SHA1-and-DH-add-fallback-RC4.patch b/pkg/net/transmission/patch/0001-Use-BearSSL-for-SHA1-and-DH-add-fallback-RC4.patch @@ -0,0 +1,339 @@ +From eb8e399417b22099b5a52e5fb468979e44486e73 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 17 Nov 2019 01:27:04 -0800 +Subject: [PATCH] Use BearSSL for SHA1 and DH, add fallback RC4 + +--- + libtransmission/crypto-utils-bearssl.c | 234 ++++++++++++++++++++++++ + libtransmission/crypto-utils-fallback.c | 77 ++++++++ + 2 files changed, 311 insertions(+) + create mode 100644 libtransmission/crypto-utils-bearssl.c + +diff --git a/libtransmission/crypto-utils-bearssl.c b/libtransmission/crypto-utils-bearssl.c +new file mode 100644 +index 000000000..5672a48df +--- /dev/null ++++ b/libtransmission/crypto-utils-bearssl.c +@@ -0,0 +1,234 @@ ++#include <assert.h> ++#include <stdlib.h> ++ ++#include <bearssl.h> ++ ++#include "crypto-utils.h" ++ ++#define TR_CRYPTO_DH_SECRET_FALLBACK ++#define TR_CRYPTO_X509_FALLBACK ++#define TR_CRYPTO_RC4_FALLBACK ++#include "crypto-utils-fallback.c" ++ ++/*** ++**** ++***/ ++ ++#define MY_NAME "tr_crypto_utils" ++ ++tr_sha1_ctx_t tr_sha1_init(void) ++{ ++ br_sha1_context * ctx; ++ ++ ctx = tr_malloc(sizeof (*ctx)); ++ if (!ctx) ++ { ++ return NULL; ++ } ++ ++ br_sha1_init(ctx); ++ ++ return ctx; ++} ++ ++bool tr_sha1_update(tr_sha1_ctx_t handle, void const* data, size_t data_length) ++{ ++ TR_ASSERT(handle != NULL); ++ ++ if (data_length == 0) ++ { ++ return true; ++ } ++ ++ TR_ASSERT(data != NULL); ++ ++ br_sha1_update(handle, data, data_length); ++ ++ return true; ++} ++ ++bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash) ++{ ++ if (hash != NULL) ++ { ++ TR_ASSERT(handle != NULL); ++ br_sha1_out(handle, hash); ++ } ++ ++ tr_free(handle); ++ return true; ++} ++ ++/*** ++**** ++***/ ++ ++typedef struct { ++ uint8_t const* prime_num; ++ size_t prime_num_length; ++ uint8_t const* generator_num; ++ size_t generator_num_length; ++ uint8_t* private_key; ++ size_t private_key_length; ++} DH; ++ ++tr_dh_ctx_t tr_dh_new(uint8_t const* prime_num, size_t prime_num_length, uint8_t const* generator_num, ++ size_t generator_num_length) ++{ ++ DH* handle; ++ ++ TR_ASSERT(prime_num != NULL); ++ TR_ASSERT(generator_num != NULL); ++ TR_ASSERT(generator_num_length < prime_num_length); ++ ++ if (generator_num_length > prime_num_length) ++ { ++ return NULL; ++ } ++ ++ handle = tr_malloc(sizeof(*handle)); ++ if (handle == NULL) ++ { ++ return NULL; ++ } ++ ++ handle->prime_num = prime_num; ++ handle->prime_num_length = prime_num_length; ++ handle->generator_num = generator_num; ++ handle->generator_num_length = generator_num_length; ++ handle->private_key = NULL; ++ ++ return handle; ++} ++ ++void ++tr_dh_free (tr_dh_ctx_t raw_handle) ++{ ++ DH* handle = raw_handle; ++ ++ if (handle == NULL) ++ { ++ return; ++ } ++ ++ tr_free(handle->private_key); ++ tr_free(handle); ++} ++ ++bool tr_dh_make_key(tr_dh_ctx_t raw_handle, size_t private_key_length, uint8_t* public_key, size_t* public_key_length) ++{ ++ TR_ASSERT(raw_handle != NULL); ++ TR_ASSERT(public_key != NULL); ++ ++ DH* handle = raw_handle; ++ br_rsa_public modexp; ++ br_rsa_public_key key; ++ uint8_t* x; ++ size_t xlen; ++ ++ modexp = br_rsa_public_get_default(); ++ ++ handle->private_key = tr_malloc(private_key_length); ++ handle->private_key_length = private_key_length; ++ ++ if (!handle->private_key) ++ { ++ goto fail; ++ } ++ ++ if (!tr_rand_buffer(handle->private_key, handle->private_key_length)) ++ { ++ goto fail; ++ } ++ ++ memset(public_key, 0, handle->prime_num_length - handle->generator_num_length); ++ memcpy(public_key + handle->prime_num_length - handle->generator_num_length, handle->generator_num, handle->generator_num_length); ++ ++ key.n = (unsigned char*)handle->prime_num; ++ key.nlen = handle->prime_num_length; ++ key.e = handle->private_key; ++ key.elen = handle->private_key_length; ++ ++ if (!modexp(public_key, handle->prime_num_length, &key)) ++ { ++ goto fail; ++ } ++ ++ *public_key_length = handle->prime_num_length; ++ ++ return true; ++ ++fail: ++ tr_free(handle->private_key); ++ handle->private_key = NULL; ++ return false; ++} ++ ++tr_dh_secret_t tr_dh_agree(tr_dh_ctx_t raw_handle, uint8_t const* other_public_key, size_t other_public_key_length) ++{ ++ TR_ASSERT(raw_handle != NULL); ++ TR_ASSERT(other_public_key != NULL); ++ ++ DH* handle = raw_handle; ++ struct tr_dh_secret* ret; ++ br_rsa_public modexp; ++ br_rsa_public_key key; ++ uint8_t* x; ++ size_t xlen; ++ ++ if (other_public_key_length > handle->prime_num_length) ++ { ++ return NULL; ++ } ++ ++ ret = tr_dh_secret_new(handle->prime_num_length); ++ if (!ret) ++ { ++ return NULL; ++ } ++ ++ memset(ret->key, 0, ret->key_length - other_public_key_length); ++ memcpy(ret->key + ret->key_length - other_public_key_length, other_public_key, other_public_key_length); ++ ++ modexp = br_rsa_public_get_default(); ++ ++ key.n = (unsigned char*)handle->prime_num; ++ key.nlen = handle->prime_num_length; ++ key.e = handle->private_key; ++ key.elen = handle->private_key_length; ++ ++ if (!modexp(ret->key, ret->key_length, &key)) ++ { ++ tr_dh_secret_free (ret); ++ ret = NULL; ++ } ++ ++ return ret; ++} ++ ++/*** ++**** ++***/ ++ ++bool tr_rand_buffer(void* buffer, size_t length) ++{ ++ TR_ASSERT(buffer != NULL); ++ ++ static br_hmac_drbg_context ctx; ++ static bool init; ++ br_prng_seeder seeder; ++ ++ if (!init) ++ { ++ br_hmac_drbg_init(&ctx, &br_sha256_vtable, NULL, 0); ++ seeder = br_prng_seeder_system(NULL); ++ if (!seeder || !seeder(&ctx.vtable)) ++ { ++ return false; ++ } ++ init = true; ++ } ++ ++ br_hmac_drbg_generate(&ctx, buffer, length); ++ return true; ++} +diff --git a/libtransmission/crypto-utils-fallback.c b/libtransmission/crypto-utils-fallback.c +index c17b54e25..a521956a3 100644 +--- a/libtransmission/crypto-utils-fallback.c ++++ b/libtransmission/crypto-utils-fallback.c +@@ -92,3 +92,80 @@ void tr_x509_cert_free(tr_x509_cert_t handle) + } + + #endif /* TR_CRYPTO_X509_FALLBACK */ ++ ++#ifdef TR_CRYPTO_RC4_FALLBACK ++ ++struct tr_rc4 ++{ ++ uint32_t i, j, S[256]; ++}; ++ ++tr_rc4_ctx_t ++tr_rc4_new (void) ++{ ++ return tr_malloc (sizeof (struct tr_rc4)); ++} ++ ++void ++tr_rc4_free (tr_rc4_ctx_t handle) ++{ ++ tr_free (handle); ++} ++ ++void ++tr_rc4_set_key (tr_rc4_ctx_t raw_handle, ++ const uint8_t * key, ++ size_t key_length) ++{ ++ struct tr_rc4 * handle = raw_handle; ++ uint32_t tmp, * S; ++ size_t i, j; ++ ++ assert (handle != NULL); ++ assert (key != NULL); ++ ++ S = handle->S; ++ for (i = 0; i < 256; ++i) ++ S[i] = i; ++ ++ j = 0; ++ for (i = 0; i < 256; ++i) { ++ j = (j + S[i] + key[i % key_length]) & 0xff; ++ tmp = S[i]; ++ S[i] = S[j]; ++ S[j] = tmp; ++ } ++ handle->i = 0; ++ handle->j = 0; ++} ++ ++void ++tr_rc4_process (tr_rc4_ctx_t raw_handle, ++ const void * raw_input, ++ void * raw_output, ++ size_t length) ++{ ++ struct tr_rc4 * handle = raw_handle; ++ const uint8_t * input = raw_input; ++ uint8_t * output = raw_output; ++ uint32_t * S, i, j, tmp; ++ ++ assert (handle != NULL); ++ assert (handle != NULL); ++ ++ i = handle->i; ++ j = handle->j; ++ S = handle->S; ++ while (length--) { ++ i = (i + 1) & 0xff; ++ j = (j + S[i]) & 0xff; ++ tmp = S[i]; ++ S[i] = S[j]; ++ S[j] = tmp; ++ *output++ = S[(S[i] + S[j]) & 0xff] ^ *input++; ++ } ++ handle->i = i; ++ handle->j = j; ++} ++ ++#endif /* TR_CRYPTO_RC4_FALLBACK */ +-- +2.26.2 + diff --git a/pkg/net/transmission/patch/0002-Choose-larger-pieces-for-larger-sizes.patch b/pkg/net/transmission/patch/0002-Choose-larger-pieces-for-larger-sizes.patch @@ -0,0 +1,44 @@ +From ed525431bbe23d61c4c8dd4664c13bc19b4db889 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Mon, 24 Apr 2023 21:09:06 -0700 +Subject: [PATCH] Choose larger pieces for larger sizes + +--- + libtransmission/makemeta.c | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c +index 713f3e5cb..ae422395d 100644 +--- a/libtransmission/makemeta.c ++++ b/libtransmission/makemeta.c +@@ -88,9 +88,24 @@ static struct FileList* getFiles(char const* dir, char const* base, struct FileL + + static uint32_t bestPieceSize(uint64_t totalSize) + { +- uint32_t const KiB = 1024; +- uint32_t const MiB = 1048576; +- uint32_t const GiB = 1073741824; ++ uint64_t const KiB = 1024; ++ uint64_t const MiB = 1048576; ++ uint64_t const GiB = 1073741824; ++ ++ if (totalSize >= 16 * GiB) ++ { ++ return 16 * MiB; ++ } ++ ++ if (totalSize >= 8 * GiB) ++ { ++ return 8 * MiB; ++ } ++ ++ if (totalSize >= 4 * GiB) ++ { ++ return 4 * MiB; ++ } + + if (totalSize >= 2 * GiB) + { +-- +2.37.3 + diff --git a/pkg/net/transmission/sha256 b/pkg/net/transmission/sha256 @@ -0,0 +1 @@ +9144652fe742f7f7dd6657716e378da60b751aaeda8bef8344b3eefc4db255f2 transmission-3.00.tar.xz diff --git a/pkg/net/transmission/url b/pkg/net/transmission/url @@ -0,0 +1 @@ +url = "https://github.com/transmission/transmission-releases/raw/master/transmission-3.00.tar.xz" diff --git a/pkg/net/transmission/ver b/pkg/net/transmission/ver @@ -0,0 +1 @@ +3.00 r2 diff --git a/sets.lua b/sets.lua @@ -26,6 +26,7 @@ S.bin = { 'stagit', 'strace', 'the_silver_searcher', + 'transmission', 'vis', }