diff --git a/cjdns.genconf.patch b/cjdns.genconf.patch index b189db5..d2eed0f 100644 --- a/cjdns.genconf.patch +++ b/cjdns.genconf.patch @@ -1,7 +1,7 @@ diff -up ./client/cjdroute2.c.genconf ./client/cjdroute2.c ---- ./client/cjdroute2.c.genconf 2016-01-19 15:19:10.084151612 -0500 -+++ ./client/cjdroute2.c 2016-01-19 15:21:18.035546520 -0500 -@@ -323,7 +323,7 @@ static int genconf(struct Random* rand, +--- ./client/cjdroute2.c.genconf 2018-04-18 03:35:41.000000000 -0400 ++++ ./client/cjdroute2.c 2019-05-03 10:45:23.397556542 -0400 +@@ -334,7 +334,7 @@ static int genconf(struct Random* rand, " // and ETHInterface will be unable to hot-add new interfaces\n" " // Use { \"setuser\": 0 } to disable.\n" " // Default: enabled with keepNetAdmin\n" @@ -10,7 +10,7 @@ diff -up ./client/cjdroute2.c.genconf ./client/cjdroute2.c "\n" " // Chroot changes the filesystem root directory which cjdns sees, blocking it\n" " // from accessing files outside of the chroot sandbox, if the user does not\n" -@@ -335,7 +335,7 @@ static int genconf(struct Random* rand, +@@ -346,7 +346,7 @@ static int genconf(struct Random* rand, } else { printf(" // Default: enabled (using \"/var/run\")\n" @@ -19,3 +19,12 @@ diff -up ./client/cjdroute2.c.genconf ./client/cjdroute2.c } printf("\n" " // Nofiles is a deprecated security feature which prevents cjdns from opening\n" +@@ -651,7 +651,7 @@ int main(int argc, char** argv) + pipePath = String_CONST(Pipe_PATH); + } + if (!Defined(win32) && access(pipePath->bytes, W_OK)) { +- Except_throw(eh, "Can't have writable permission to pipe directory."); ++ Except_throw(eh, "Pipe directory not writable: [%s]",pipePath->bytes); + } + Assert_ifParanoid(EventBase_eventCount(eventBase) == 0); + struct Pipe* corePipe = Pipe_named(pipePath->bytes, corePipeName, eventBase, diff --git a/cjdns.libuv.patch b/cjdns.libuv.patch new file mode 100644 index 0000000..a29be39 --- /dev/null +++ b/cjdns.libuv.patch @@ -0,0 +1,126 @@ +diff -up ./dht/dhtcore/NodeStore.c.libuv ./dht/dhtcore/NodeStore.c +--- ./dht/dhtcore/NodeStore.c.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./dht/dhtcore/NodeStore.c 2019-04-24 23:37:26.625881889 -0400 +@@ -28,7 +28,7 @@ + #include "util/Endian.h" + #include "util/events/Time.h" + +-#include ++#include "dependencies/uv_tree.h" + + /** A list of DHT nodes. */ + struct NodeStore_pvt +diff -up ./node_build/make.js.libuv ./node_build/make.js +--- ./node_build/make.js.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./node_build/make.js 2019-04-24 23:37:26.690882782 -0400 +@@ -46,7 +46,7 @@ Builder.configure({ + crossCompiling: process.env['CROSS'] !== undefined, + gcc: GCC, + tempDir: process.env['CJDNS_BUILD_TMPDIR'] || '/tmp', +- optimizeLevel: '-O3', ++ optimizeLevel: '-O', + logLevel: process.env['Log_LEVEL'] || 'DEBUG' + }, function (builder, waitFor) { + +@@ -101,7 +101,7 @@ Builder.configure({ + + if (!builder.config.crossCompiling) { + if (NO_MARCH_FLAG.indexOf(process.arch) == -1) { +- builder.config.cflags.push('-march=native'); ++ builder.config.cflags.push('-mtune=generic'); + } + } + +@@ -287,7 +287,7 @@ Builder.configure({ + + if (!builder.config.crossCompiling) { + if (NO_MARCH_FLAG.indexOf(process.arch) == -1) { +- args.unshift('-march=native'); ++ args.unshift('-mtune=generic'); + } + } + +@@ -301,7 +301,7 @@ Builder.configure({ + + }).nThen(function (waitFor) { + +- builder.config.libs.push(libuvLib); ++ builder.config.libs.push('-luv'); + if (!android) { + builder.config.libs.push('-lpthread'); + } +@@ -328,15 +328,13 @@ Builder.configure({ + ); + } + +- builder.config.includeDirs.push(dependencyDir + '/libuv/include/'); ++ /* builder.config.includeDirs.push('/usr/include/uv/'); */ + + var libuvBuilt; + var python; + nThen(function (waitFor) { + +- Fs.exists(libuvLib, waitFor(function (exists) { +- if (exists) { libuvBuilt = true; } +- })); ++ libuvBuilt = true; + + }).nThen(function (waitFor) { + +diff -up ./test/Beacon_test.c.libuv ./test/Beacon_test.c +--- ./test/Beacon_test.c.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./test/Beacon_test.c 2019-04-24 23:44:04.535476759 -0400 +@@ -256,7 +256,8 @@ int main() + start(alloc, logger, base, rand, runTest); + + EventBase_beginLoop(base); +- Allocator_free(alloc); ++ EventBase_endLoop(base); ++ /* Allocator_free(alloc); */ + return 0; + } + #endif +diff -up ./util/events/libuv/FileNo.c.libuv ./util/events/libuv/FileNo.c +--- ./util/events/libuv/FileNo.c.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./util/events/libuv/FileNo.c 2019-04-24 23:37:26.626881902 -0400 +@@ -77,14 +77,14 @@ static void onClose(uv_handle_t* handle) + #endif + #define ALLOC(buff) (((struct Allocator**) &(buff[-(8 + (((uintptr_t)buff) % 8))]))[0]) + +-static void incoming(uv_pipe_t* stream, ++static void incoming(uv_stream_t* stream, + ssize_t nread, +- const uv_buf_t* buf, +- uv_handle_type pending) ++ const uv_buf_t* buf) + { + // Grab out the allocator which was placed there by allocate() + struct Allocator* alloc = buf->base ? ALLOC(buf->base) : NULL; + ++ uv_handle_type pending = uv_pipe_pending_type((uv_pipe_t*) stream); + Assert_true(pending == UV_UNKNOWN_HANDLE); + + if (nread < 0) { +@@ -134,8 +134,8 @@ static void connected(uv_connect_t* req, + fileno->pub.pipePath, uv_strerror(status) ); + uv_close((uv_handle_t*) &fileno->peer, onClose); + +- } else if ((ret = uv_read2_start((uv_stream_t*)&fileno->peer, allocate, incoming))) { +- Log_info(fileno->pub.logger, "uv_read2_start() failed for pipe [%s] [%s]", ++ } else if ((ret = uv_read_start((uv_stream_t*)&fileno->peer, allocate, incoming))) { ++ Log_info(fileno->pub.logger, "uv_read_start() failed for pipe [%s] [%s]", + fileno->pub.pipePath, uv_strerror(ret)); + uv_close((uv_handle_t*) &fileno->peer, onClose); + +diff -up ./util/events/libuv/Timeout.c.libuv ./util/events/libuv/Timeout.c +--- ./util/events/libuv/Timeout.c.libuv 2018-04-18 03:35:41.000000000 -0400 ++++ ./util/events/libuv/Timeout.c 2019-04-24 23:37:26.626881902 -0400 +@@ -38,7 +38,7 @@ struct Timeout + /** + * The callback to be called by libuv. + */ +-static void handleEvent(uv_timer_t* handle, int status) ++static void handleEvent(uv_timer_t* handle) + { + struct Timeout* timeout = Identity_check((struct Timeout*) handle); + if (!timeout->isInterval) { diff --git a/cjdns.spec b/cjdns.spec index b289653..5016587 100644 --- a/cjdns.spec +++ b/cjdns.spec @@ -15,7 +15,8 @@ # Option to disable SECCOMP: confusing backward logic # Needed to run on openvz and other container systems %bcond_without seccomp - +# Option to use embedded libuv-0.11.19 +%bcond_without libuv %if %{with embedded} %global use_embedded 1 @@ -23,6 +24,12 @@ %global use_embedded 0 %endif +%if %{with libuv} +%global use_libuv 1 +%else +%global use_libuv 0 +%endif + %if %{with generic} %global generic_build 1 %else @@ -65,7 +72,7 @@ Name: cjdns # major version is cjdns protocol version: Version: 20.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: The privacy-friendly network without borders # cjdns is all GPLv3 except libuv which is MIT and BSD and ISC # cnacl is unused except when use_embedded is true @@ -124,6 +131,8 @@ Patch12: cjdns.sign.patch Patch16: cjdns.python3.patch # s390x support for embedded cnacl library from Dan HorĂ¡k Patch17: cjdns.s390x.patch +# patch build to use system libuv +Patch18: cjdns.libuv.patch BuildRequires: nodejs, nodejs-ronn, python2 @@ -143,7 +152,11 @@ Requires(preun): systemd Requires(postun): systemd %endif Requires(pre): shadow-utils +%if 0%{use_libuv} +BuildRequires: libuv-devel +%else Provides: bundled(libuv) = 0.11.19 +%endif %if 0%{use_embedded} Provides: bundled(nacl) = 20110221 %endif @@ -259,6 +272,12 @@ fi %if 0%{use_embedded} %patch17 -p1 -b .s390x %endif +%if 0%{use_libuv} +%patch18 -p1 -b .libuv +mkdir dependencies +cp node_build/dependencies/libuv/include/tree.h dependencies/uv_tree.h +rm -rf node_build/dependencies/libuv +%endif cp %{SOURCE1} README_Fedora.md @@ -332,7 +351,7 @@ export SUBNODE=1 CJDNS_RELEASE_VERSION="%{name}-%{version}-%{release}" ./do # FIXME: use system libuv on compatible systems -# bundled libuv is 0.11.4 with changes: +# bundled libuv is 0.11.19 with changes: # https://github.com/cjdelisle/cjdns/commits/master/node_build/dependencies/libuv %check @@ -587,6 +606,9 @@ fi %{_bindir}/graphStats %changelog +* Wed Apr 24 2019 Stuart Gathman - 20.2-7 +- Use system libuv + * Thu Jan 31 2019 Fedora Release Engineering - 20.2-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild