Fix build for linux

This commit is contained in:
Joey Yakimowich-Payne 2020-01-23 17:16:43 -07:00
commit 4babda7bc0

View file

@ -18,9 +18,10 @@ src/win/*
src/unix/* src/unix/*
""", checkout = "v1.34.2") """, checkout = "v1.34.2")
when not defined(windows):
const const
hunix = buildDir/"include/uv/unix.h" hunix {.used.} = buildDir/"include/uv/unix.h"
huv {.used.} = "/Users/jyakimowich-payne/JoeyProjects/nim-libuv/build/libuv/include/uv.h" huv {.used.} = buildDir/"include/uv.h"
cOverride: cOverride:
# Standard Nim code to wrap types, consts, procs, etc. # Standard Nim code to wrap types, consts, procs, etc.
@ -71,6 +72,7 @@ cOverride:
stdio_container_t* {.importc: "uv_stdio_container_t", header: huv.} = object stdio_container_t* {.importc: "uv_stdio_container_t", header: huv.} = object
req_type* {.importc: "uv_req_type", header: huv.} = object req_type* {.importc: "uv_req_type", header: huv.} = object
handle_type* {.importc: "uv_handle_type", header: huv.} = object handle_type* {.importc: "uv_handle_type", header: huv.} = object
barrier_t* {.importc: "uv_barrier_t", header: huv.} = object
sockaddr_in* {.importc: "sockaddr_in".} = object sockaddr_in* {.importc: "sockaddr_in".} = object
sockaddr_in6* {.importc: "sockaddr_in6".} = object sockaddr_in6* {.importc: "sockaddr_in6".} = object
@ -78,14 +80,10 @@ cOverride:
cIncludeDir(buildDir/"include") cIncludeDir(buildDir/"include")
cIncludeDir(buildDir/"src") cIncludeDir(buildDir/"src")
when not defined(windows):
cIncludeDir(buildDir/"src/unix") cIncludeDir(buildDir/"src/unix")
else:
#cDefine("SYMBOL", "value") cIncludeDir(buildDir/"src/win")
{.passC: "-pthreads -D_DARWIN_USE_64_BIT_INODE=1 -D_DARWIN_UNLIMITED_SELECT=1".}
#{.passL: "flags".}
cCompile(buildDir/"src/fs-poll.c") cCompile(buildDir/"src/fs-poll.c")
@ -99,6 +97,7 @@ cCompile(buildDir/"src/timer.c")
cCompile(buildDir/"src/uv-common.c") cCompile(buildDir/"src/uv-common.c")
cCompile(buildDir/"src/version.c") cCompile(buildDir/"src/version.c")
when not defined(windows):
cCompile(buildDir/"src/unix/async.c") cCompile(buildDir/"src/unix/async.c")
cCompile(buildDir/"src/unix/core.c") cCompile(buildDir/"src/unix/core.c")
cCompile(buildDir/"src/unix/dl.c") cCompile(buildDir/"src/unix/dl.c")
@ -118,6 +117,8 @@ cCompile(buildDir/"src/unix/thread.c")
cCompile(buildDir/"src/unix/tty.c") cCompile(buildDir/"src/unix/tty.c")
cCompile(buildDir/"src/unix/udp.c") cCompile(buildDir/"src/unix/udp.c")
when defined(macosx):
{.passC: "-pthreads -D_DARWIN_USE_64_BIT_INODE=1 -D_DARWIN_UNLIMITED_SELECT=1".}
cCompile(buildDir/"src/unix/bsd-ifaddrs.c") cCompile(buildDir/"src/unix/bsd-ifaddrs.c")
cCompile(buildDir/"src/unix/darwin.c") cCompile(buildDir/"src/unix/darwin.c")
cCompile(buildDir/"src/unix/darwin-proctitle.c") cCompile(buildDir/"src/unix/darwin-proctitle.c")
@ -126,6 +127,19 @@ cCompile(buildDir/"src/unix/kqueue.c")
cCompile(buildDir/"src/unix/proctitle.c") cCompile(buildDir/"src/unix/proctitle.c")
cCompile(buildDir/"src/unix/random-getentropy.c") cCompile(buildDir/"src/unix/random-getentropy.c")
when defined(linux):
{.passC: "-D_GNU_SOURCE".}
{.passL: "-lutil -lpthread".}
cCompile(buildDir/"src/unix/linux-core.c")
cCompile(buildDir/"src/unix/linux-inotify.c")
cCompile(buildDir/"src/unix/linux-syscalls.c")
cCompile(buildDir/"src/unix/procfs-exepath.c")
cCompile(buildDir/"src/unix/proctitle.c")
cCompile(buildDir/"src/unix/random-getrandom.c")
cCompile(buildDir/"src/unix/random-sysctl-linux.c")
cCompile(buildDir/"src/unix/sysinfo-loadavg.c")
cPlugin: cPlugin:
import strutils import strutils
@ -134,6 +148,7 @@ cPlugin:
sym.name = sym.name.replace("uv__", "") sym.name = sym.name.replace("uv__", "")
sym.name = sym.name.replace("uv_", "") sym.name = sym.name.replace("uv_", "")
sym.name = sym.name.replace("UV__", "")
cImport(buildDir/"include/uv.h", recurse = true) cImport(buildDir/"include/uv.h", recurse = true)