<NME> libuv-1.2.0.patchset
<BEF> ADDFILE
<MSG> [WIP] libuv 1.2.0 - Build system fixed

<DFF> @@ -0,0 +1,433 @@
+From 376534d7dfdce7bf4e817bc20d12e3d91bfc4332 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Adri=C3=A1n=20Arroyo=20Calle?=
+ <adrian.arroyocalle@gmail.com>
+Date: Fri, 16 Jan 2015 19:19:54 +0000
+Subject: Haiku fixes first part
+
+
+diff --git a/include/pthread-fixes.h b/include/pthread-fixes.h
+index 88c6b66..dca8e2c 100644
+--- a/include/pthread-fixes.h
++++ b/include/pthread-fixes.h
+@@ -34,9 +34,8 @@
+ 
+ #include <pthread.h>
+ 
+-
+ /*Android doesn't provide pthread_barrier_t for now.*/
+-#ifndef PTHREAD_BARRIER_SERIAL_THREAD
++#if !defined(PTHREAD_BARRIER_SERIAL_THREAD) || (__HAIKU__)
+ 
+ /* Anything except 0 will do here.*/
+ #define PTHREAD_BARRIER_SERIAL_THREAD  0x12345
+diff --git a/include/uv-unix.h b/include/uv-unix.h
+index e724925..8583c40 100644
+--- a/include/uv-unix.h
++++ b/include/uv-unix.h
+@@ -36,12 +36,12 @@
+ #include <termios.h>
+ #include <pwd.h>
+ 
++#include <signal.h>
+ #include <semaphore.h>
+ #include <pthread.h>
+-#ifdef __ANDROID__
++#if defined (__ANDROID__) || defined(__HAIKU__)
+ #include "pthread-fixes.h"
+ #endif
+-#include <signal.h>
+ 
+ #include "uv-threadpool.h"
+ 
+diff --git a/src/unix/core.c b/src/unix/core.c
+index 6f284ff..9b9bfe3 100644
+--- a/src/unix/core.c
++++ b/src/unix/core.c
+@@ -43,6 +43,11 @@
+ # include <sys/ioctl.h>
+ #endif
+ 
++#ifdef __HAIKU__
++# include <sys/ioctl.h>
++# include <sys/wait.h>
++#endif
++
+ #ifdef __sun
+ # include <sys/types.h>
+ # include <sys/wait.h>
+@@ -876,7 +881,7 @@ int uv_getrusage(uv_rusage_t* rusage) {
+   rusage->ru_stime.tv_sec = usage.ru_stime.tv_sec;
+   rusage->ru_stime.tv_usec = usage.ru_stime.tv_usec;
+ 
+-  rusage->ru_maxrss = usage.ru_maxrss;
++  /*rusage->ru_maxrss = usage.ru_maxrss;
+   rusage->ru_ixrss = usage.ru_ixrss;
+   rusage->ru_idrss = usage.ru_idrss;
+   rusage->ru_isrss = usage.ru_isrss;
+@@ -889,7 +894,7 @@ int uv_getrusage(uv_rusage_t* rusage) {
+   rusage->ru_msgrcv = usage.ru_msgrcv;
+   rusage->ru_nsignals = usage.ru_nsignals;
+   rusage->ru_nvcsw = usage.ru_nvcsw;
+-  rusage->ru_nivcsw = usage.ru_nivcsw;
++  rusage->ru_nivcsw = usage.ru_nivcsw;*/
+ 
+   return 0;
+ }
+diff --git a/src/unix/haiku.c b/src/unix/haiku.c
+new file mode 100644
+index 0000000..357eb41
+--- /dev/null
++++ b/src/unix/haiku.c
+@@ -0,0 +1,115 @@
++#include "uv.h"
++#include "internal.h"
++
++#include <assert.h>
++#include <string.h>
++#include <errno.h>
++
++#include <sys/types.h>
++#include <sys/resource.h>
++#include <time.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++#undef NANOSEC
++#define NANOSEC ((uint64_t) 1e9)
++
++static char *process_title;
++
++int uv_platform_loop_init(uv_loop_t* loop, int default_loop) {
++	return 1;
++}
++
++void uv__platform_loop_delete(uv_loop_t* loop) {
++}
++
++uint64_t uv__hrtime(uv_clocktype_t type) {
++  struct timespec ts;
++  clock_gettime(CLOCK_MONOTONIC, &ts);
++  return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
++}
++
++int uv_exepath(char* buffer, size_t* size) {
++
++
++  return 0;
++}
++
++
++uint64_t uv_get_free_memory(void) {
++
++}
++
++
++uint64_t uv_get_total_memory(void) {
++	
++}
++
++
++void uv_loadavg(double avg[3]) {
++
++}
++
++
++char** uv_setup_args(int argc, char** argv) {
++  process_title = argc ? strdup(argv[0]) : NULL;
++  return argv;
++}
++
++
++int uv_set_process_title(const char* title) {
++
++  return 0;
++}
++
++
++int uv_get_process_title(char* buffer, size_t size) {
++
++  return 0;
++}
++
++
++int uv_resident_set_memory(size_t* rss) {
++
++  return 0;
++}
++
++
++int uv_uptime(double* uptime) {
++  return 0;
++}
++
++
++int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
++
++  return 0;
++}
++
++
++void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
++  int i;
++
++  for (i = 0; i < count; i++) {
++    free(cpu_infos[i].model);
++  }
++
++  free(cpu_infos);
++}
++
++
++int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
++
++  return 0;
++}
++
++
++void uv_free_interface_addresses(uv_interface_address_t* addresses,
++  int count) {
++  int i;
++
++  for (i = 0; i < count; i++) {
++    free(addresses[i].name);
++  }
++
++  free(addresses);
++}
+diff --git a/src/unix/pthread-fixes.c b/src/unix/pthread-fixes.c
+index dc54f35..3a71eb5 100644
+--- a/src/unix/pthread-fixes.c
++++ b/src/unix/pthread-fixes.c
+@@ -35,6 +35,7 @@
+  * */
+ #include <errno.h>
+ #include <pthread.h>
++#include <signal.h>
+ 
+ int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset) {
+   static int workaround;
+diff --git a/uv.gyp b/uv.gyp
+index 45af6a1..21390e0 100644
+--- a/uv.gyp
++++ b/uv.gyp
+@@ -10,7 +10,7 @@
+           ['OS=="solaris"', {
+             'cflags': [ '-pthreads' ],
+           }],
+-          ['OS not in "solaris android"', {
++          ['OS not in "solaris android haiku"', {
+             'cflags': [ '-pthread' ],
+           }],
+         ],
+@@ -152,13 +152,13 @@
+             'src/unix/udp.c',
+           ],
+           'link_settings': {
+-            'libraries': [ '-lm' ],
+             'conditions': [
+               ['OS=="solaris"', {
+                 'ldflags': [ '-pthreads' ],
+               }],
+-              ['OS != "solaris" and OS != "android"', {
++              ['OS != "solaris" and OS != "android" and OS != "haiku"', {
+                 'ldflags': [ '-pthread' ],
++                'libraries': [ '-lm' ],
+               }],
+             ],
+           },
+@@ -175,7 +175,7 @@
+             }],
+           ],
+         }],
+-        [ 'OS in "linux mac android"', {
++        [ 'OS in "linux mac android haiku"', {
+           'sources': [ 'src/unix/proctitle.c' ],
+         }],
+         [ 'OS=="mac"', {
+@@ -205,6 +205,15 @@
+             'libraries': [ '-ldl', '-lrt' ],
+           },
+         }],
++        [ 'OS=="haiku"', {
++          'sources': [
++        	'src/unix/haiku.c',
++        	'src/unix/pthread-fixes.c',
++          ],
++          'link_settings': {
++            'libraries': [ '-lroot', '-lnetwork' ],
++          },
++        }],
+         [ 'OS=="android"', {
+           'sources': [
+             'src/unix/linux-core.c',
+@@ -268,167 +277,6 @@
+         }],
+       ]
+     },
+-
+-    {
+-      'target_name': 'run-tests',
+-      'type': 'executable',
+-      'dependencies': [ 'libuv' ],
+-      'sources': [
+-        'test/blackhole-server.c',
+-        'test/echo-server.c',
+-        'test/run-tests.c',
+-        'test/runner.c',
+-        'test/runner.h',
+-        'test/test-get-loadavg.c',
+-        'test/task.h',
+-        'test/test-active.c',
+-        'test/test-async.c',
+-        'test/test-async-null-cb.c',
+-        'test/test-callback-stack.c',
+-        'test/test-callback-order.c',
+-        'test/test-close-fd.c',
+-        'test/test-close-order.c',
+-        'test/test-connection-fail.c',
+-        'test/test-cwd-and-chdir.c',
+-        'test/test-default-loop-close.c',
+-        'test/test-delayed-accept.c',
+-        'test/test-error.c',
+-        'test/test-embed.c',
+-        'test/test-emfile.c',
+-        'test/test-fail-always.c',
+-        'test/test-fs.c',
+-        'test/test-fs-event.c',
+-        'test/test-get-currentexe.c',
+-        'test/test-get-memory.c',
+-        'test/test-getaddrinfo.c',
+-        'test/test-getnameinfo.c',
+-        'test/test-getsockname.c',
+-        'test/test-handle-fileno.c',
+-        'test/test-hrtime.c',
+-        'test/test-idle.c',
+-        'test/test-ip6-addr.c',
+-        'test/test-ipc.c',
+-        'test/test-ipc-send-recv.c',
+-        'test/test-list.h',
+-        'test/test-loop-handles.c',
+-        'test/test-loop-alive.c',
+-        'test/test-loop-close.c',
+-        'test/test-loop-stop.c',
+-        'test/test-loop-time.c',
+-        'test/test-loop-configure.c',
+-        'test/test-walk-handles.c',
+-        'test/test-watcher-cross-stop.c',
+-        'test/test-multiple-listen.c',
+-        'test/test-osx-select.c',
+-        'test/test-pass-always.c',
+-        'test/test-ping-pong.c',
+-        'test/test-pipe-bind-error.c',
+-        'test/test-pipe-connect-error.c',
+-        'test/test-pipe-getsockname.c',
+-        'test/test-pipe-sendmsg.c',
+-        'test/test-pipe-server-close.c',
+-        'test/test-pipe-close-stdout-read-stdin.c',
+-        'test/test-platform-output.c',
+-        'test/test-poll.c',
+-        'test/test-poll-close.c',
+-        'test/test-poll-close-doesnt-corrupt-stack.c',
+-        'test/test-poll-closesocket.c',
+-        'test/test-process-title.c',
+-        'test/test-ref.c',
+-        'test/test-run-nowait.c',
+-        'test/test-run-once.c',
+-        'test/test-semaphore.c',
+-        'test/test-shutdown-close.c',
+-        'test/test-shutdown-eof.c',
+-        'test/test-shutdown-twice.c',
+-        'test/test-signal.c',
+-        'test/test-signal-multiple-loops.c',
+-        'test/test-socket-buffer-size.c',
+-        'test/test-spawn.c',
+-        'test/test-fs-poll.c',
+-        'test/test-stdio-over-pipes.c',
+-        'test/test-tcp-bind-error.c',
+-        'test/test-tcp-bind6-error.c',
+-        'test/test-tcp-close.c',
+-        'test/test-tcp-close-accept.c',
+-        'test/test-tcp-close-while-connecting.c',
+-        'test/test-tcp-connect-error-after-write.c',
+-        'test/test-tcp-shutdown-after-write.c',
+-        'test/test-tcp-flags.c',
+-        'test/test-tcp-connect-error.c',
+-        'test/test-tcp-connect-timeout.c',
+-        'test/test-tcp-connect6-error.c',
+-        'test/test-tcp-open.c',
+-        'test/test-tcp-write-to-half-open-connection.c',
+-        'test/test-tcp-write-after-connect.c',
+-        'test/test-tcp-writealot.c',
+-        'test/test-tcp-try-write.c',
+-        'test/test-tcp-unexpected-read.c',
+-        'test/test-tcp-read-stop.c',
+-        'test/test-tcp-write-queue-order.c',
+-        'test/test-threadpool.c',
+-        'test/test-threadpool-cancel.c',
+-        'test/test-thread-equal.c',
+-        'test/test-mutexes.c',
+-        'test/test-thread.c',
+-        'test/test-barrier.c',
+-        'test/test-condvar.c',
+-        'test/test-timer-again.c',
+-        'test/test-timer-from-check.c',
+-        'test/test-timer.c',
+-        'test/test-tty.c',
+-        'test/test-udp-bind.c',
+-        'test/test-udp-dgram-too-big.c',
+-        'test/test-udp-ipv6.c',
+-        'test/test-udp-open.c',
+-        'test/test-udp-options.c',
+-        'test/test-udp-send-and-recv.c',
+-        'test/test-udp-send-immediate.c',
+-        'test/test-udp-send-unreachable.c',
+-        'test/test-udp-multicast-join.c',
+-        'test/test-udp-multicast-join6.c',
+-        'test/test-dlerror.c',
+-        'test/test-udp-multicast-ttl.c',
+-        'test/test-ip4-addr.c',
+-        'test/test-ip6-addr.c',
+-        'test/test-udp-multicast-interface.c',
+-        'test/test-udp-multicast-interface6.c',
+-        'test/test-udp-try-send.c',
+-      ],
+-      'conditions': [
+-        [ 'OS=="win"', {
+-          'sources': [
+-            'test/runner-win.c',
+-            'test/runner-win.h'
+-          ],
+-          'libraries': [ '-lws2_32' ]
+-        }, { # POSIX
+-          'defines': [ '_GNU_SOURCE' ],
+-          'sources': [
+-            'test/runner-unix.c',
+-            'test/runner-unix.h',
+-          ],
+-        }],
+-        [ 'OS=="solaris"', { # make test-fs.c compile, needs _POSIX_C_SOURCE
+-          'defines': [
+-            '__EXTENSIONS__',
+-            '_XOPEN_SOURCE=500',
+-          ],
+-        }],
+-        [ 'OS=="aix"', {     # make test-fs.c compile, needs _POSIX_C_SOURCE
+-          'defines': [
+-            '_ALL_SOURCE',
+-            '_XOPEN_SOURCE=500',
+-          ],
+-        }],
+-      ],
+-      'msvs-settings': {
+-        'VCLinkerTool': {
+-          'SubSystem': 1, # /subsystem:console
+-        },
+-      },
+-    },
+-
+     {
+       'target_name': 'run-benchmarks',
+       'type': 'executable',
+-- 
+1.8.3.4
+

{'addition_count': 433, 'commit_subject': '[WIP] libuv 1.2.0 - Build system fixed', 'deletion_count': 0, 'file_extension': '.patchset', 'lang': '2', 'license': 'mit', 'repo_name': 'haikuports/haikuports'}