Blame cjdns.libuv.patch

85e430
diff -up ./dht/dhtcore/NodeStore.c.libuv ./dht/dhtcore/NodeStore.c
85e430
--- ./dht/dhtcore/NodeStore.c.libuv	2018-04-18 03:35:41.000000000 -0400
85e430
+++ ./dht/dhtcore/NodeStore.c	2019-04-24 23:37:26.625881889 -0400
85e430
@@ -28,7 +28,7 @@
85e430
 #include "util/Endian.h"
85e430
 #include "util/events/Time.h"
85e430
 
85e430
-#include <tree.h>
85e430
+#include "dependencies/uv_tree.h"
85e430
 
85e430
 /** A list of DHT nodes. */
85e430
 struct NodeStore_pvt
85e430
diff -up ./node_build/make.js.libuv ./node_build/make.js
85e430
--- ./node_build/make.js.libuv	2018-04-18 03:35:41.000000000 -0400
85e430
+++ ./node_build/make.js	2019-04-24 23:37:26.690882782 -0400
85e430
@@ -46,7 +46,7 @@ Builder.configure({
85e430
     crossCompiling: process.env['CROSS'] !== undefined,
85e430
     gcc:            GCC,
85e430
     tempDir:        process.env['CJDNS_BUILD_TMPDIR'] || '/tmp',
85e430
-    optimizeLevel:  '-O3',
85e430
+    optimizeLevel:  '-O',
85e430
     logLevel:       process.env['Log_LEVEL'] || 'DEBUG'
85e430
 }, function (builder, waitFor) {
85e430
 
85e430
@@ -101,7 +101,7 @@ Builder.configure({
85e430
 
85e430
     if (!builder.config.crossCompiling) {
85e430
         if (NO_MARCH_FLAG.indexOf(process.arch) == -1) {
85e430
-            builder.config.cflags.push('-march=native');
85e430
+            builder.config.cflags.push('-mtune=generic');
85e430
         }
85e430
     }
85e430
 
85e430
@@ -287,7 +287,7 @@ Builder.configure({
85e430
 
85e430
                 if (!builder.config.crossCompiling) {
85e430
                     if (NO_MARCH_FLAG.indexOf(process.arch) == -1) {
85e430
-                        args.unshift('-march=native');
85e430
+                        args.unshift('-mtune=generic');
85e430
                     }
85e430
                 }
85e430
 
85e430
@@ -301,7 +301,7 @@ Builder.configure({
85e430
 
85e430
     }).nThen(function (waitFor) {
85e430
 
85e430
-        builder.config.libs.push(libuvLib);
85e430
+        builder.config.libs.push('-luv');
85e430
         if (!android) {
85e430
             builder.config.libs.push('-lpthread');
85e430
         }
85e430
@@ -328,15 +328,13 @@ Builder.configure({
85e430
             );
85e430
         }
85e430
 
85e430
-        builder.config.includeDirs.push(dependencyDir + '/libuv/include/');
85e430
+        /* builder.config.includeDirs.push('/usr/include/uv/'); */
85e430
 
85e430
         var libuvBuilt;
85e430
         var python;
85e430
         nThen(function (waitFor) {
85e430
 
85e430
-            Fs.exists(libuvLib, waitFor(function (exists) {
85e430
-                if (exists) { libuvBuilt = true; }
85e430
-            }));
85e430
+            libuvBuilt = true;
85e430
 
85e430
         }).nThen(function (waitFor) {
85e430
 
85e430
diff -up ./test/Beacon_test.c.libuv ./test/Beacon_test.c
85e430
--- ./test/Beacon_test.c.libuv	2018-04-18 03:35:41.000000000 -0400
85e430
+++ ./test/Beacon_test.c	2019-04-24 23:44:04.535476759 -0400
85e430
@@ -256,7 +256,8 @@ int main()
85e430
     start(alloc, logger, base, rand, runTest);
85e430
 
85e430
     EventBase_beginLoop(base);
85e430
-    Allocator_free(alloc);
85e430
+    EventBase_endLoop(base);
85e430
+    /* Allocator_free(alloc); */
85e430
     return 0;
85e430
 }
85e430
 #endif
85e430
diff -up ./util/events/libuv/FileNo.c.libuv ./util/events/libuv/FileNo.c
85e430
--- ./util/events/libuv/FileNo.c.libuv	2018-04-18 03:35:41.000000000 -0400
85e430
+++ ./util/events/libuv/FileNo.c	2019-04-24 23:37:26.626881902 -0400
85e430
@@ -77,14 +77,14 @@ static void onClose(uv_handle_t* handle)
85e430
 #endif
85e430
 #define ALLOC(buff) (((struct Allocator**) &(buff[-(8 + (((uintptr_t)buff) % 8))]))[0])
85e430
 
85e430
-static void incoming(uv_pipe_t* stream,
85e430
+static void incoming(uv_stream_t* stream,
85e430
                      ssize_t nread,
85e430
-                     const uv_buf_t* buf,
85e430
-                     uv_handle_type pending)
85e430
+                     const uv_buf_t* buf)
85e430
 {
85e430
     // Grab out the allocator which was placed there by allocate()
85e430
     struct Allocator* alloc = buf->base ? ALLOC(buf->base) : NULL;
85e430
 
85e430
+    uv_handle_type pending = uv_pipe_pending_type((uv_pipe_t*) stream);
85e430
     Assert_true(pending == UV_UNKNOWN_HANDLE);
85e430
 
85e430
     if (nread < 0) {
85e430
@@ -134,8 +134,8 @@ static void connected(uv_connect_t* req,
85e430
                  fileno->pub.pipePath, uv_strerror(status) );
85e430
         uv_close((uv_handle_t*) &fileno->peer, onClose);
85e430
 
85e430
-    } else if ((ret = uv_read2_start((uv_stream_t*)&fileno->peer, allocate, incoming))) {
85e430
-        Log_info(fileno->pub.logger, "uv_read2_start() failed for pipe [%s] [%s]",
85e430
+    } else if ((ret = uv_read_start((uv_stream_t*)&fileno->peer, allocate, incoming))) {
85e430
+        Log_info(fileno->pub.logger, "uv_read_start() failed for pipe [%s] [%s]",
85e430
                  fileno->pub.pipePath, uv_strerror(ret));
85e430
         uv_close((uv_handle_t*) &fileno->peer, onClose);
85e430
 
85e430
diff -up ./util/events/libuv/Timeout.c.libuv ./util/events/libuv/Timeout.c
85e430
--- ./util/events/libuv/Timeout.c.libuv	2018-04-18 03:35:41.000000000 -0400
85e430
+++ ./util/events/libuv/Timeout.c	2019-04-24 23:37:26.626881902 -0400
85e430
@@ -38,7 +38,7 @@ struct Timeout
85e430
 /**
85e430
  * The callback to be called by libuv.
85e430
  */
85e430
-static void handleEvent(uv_timer_t* handle, int status)
85e430
+static void handleEvent(uv_timer_t* handle)
85e430
 {
85e430
     struct Timeout* timeout = Identity_check((struct Timeout*) handle);
85e430
     if (!timeout->isInterval) {