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,11 +18,12 @@ src/win/*
src/unix/* src/unix/*
""", checkout = "v1.34.2") """, checkout = "v1.34.2")
const when not defined(windows):
hunix = buildDir/"include/uv/unix.h" const
huv {.used.} = "/Users/jyakimowich-payne/JoeyProjects/nim-libuv/build/libuv/include/uv.h" hunix {.used.} = buildDir/"include/uv/unix.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.
type type
loop_s = object loop_s = object
@ -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")
cIncludeDir(buildDir/"src/unix") when not defined(windows):
cIncludeDir(buildDir/"src/unix")
#cDefine("SYMBOL", "value") else:
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,32 +97,48 @@ 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")
cCompile(buildDir/"src/unix/async.c") when not defined(windows):
cCompile(buildDir/"src/unix/core.c") cCompile(buildDir/"src/unix/async.c")
cCompile(buildDir/"src/unix/dl.c") cCompile(buildDir/"src/unix/core.c")
cCompile(buildDir/"src/unix/fs.c") cCompile(buildDir/"src/unix/dl.c")
cCompile(buildDir/"src/unix/getaddrinfo.c") cCompile(buildDir/"src/unix/fs.c")
cCompile(buildDir/"src/unix/getnameinfo.c") cCompile(buildDir/"src/unix/getaddrinfo.c")
cCompile(buildDir/"src/unix/loop-watcher.c") cCompile(buildDir/"src/unix/getnameinfo.c")
cCompile(buildDir/"src/unix/loop.c") cCompile(buildDir/"src/unix/loop-watcher.c")
cCompile(buildDir/"src/unix/pipe.c") cCompile(buildDir/"src/unix/loop.c")
cCompile(buildDir/"src/unix/poll.c") cCompile(buildDir/"src/unix/pipe.c")
cCompile(buildDir/"src/unix/process.c") cCompile(buildDir/"src/unix/poll.c")
cCompile(buildDir/"src/unix/random-devurandom.c") cCompile(buildDir/"src/unix/process.c")
cCompile(buildDir/"src/unix/signal.c") cCompile(buildDir/"src/unix/random-devurandom.c")
cCompile(buildDir/"src/unix/stream.c") cCompile(buildDir/"src/unix/signal.c")
cCompile(buildDir/"src/unix/tcp.c") cCompile(buildDir/"src/unix/stream.c")
cCompile(buildDir/"src/unix/thread.c") cCompile(buildDir/"src/unix/tcp.c")
cCompile(buildDir/"src/unix/tty.c") cCompile(buildDir/"src/unix/thread.c")
cCompile(buildDir/"src/unix/udp.c") cCompile(buildDir/"src/unix/tty.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/darwin.c")
cCompile(buildDir/"src/unix/darwin-proctitle.c")
cCompile(buildDir/"src/unix/fsevents.c")
cCompile(buildDir/"src/unix/kqueue.c")
cCompile(buildDir/"src/unix/proctitle.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")
cCompile(buildDir/"src/unix/bsd-ifaddrs.c")
cCompile(buildDir/"src/unix/darwin.c")
cCompile(buildDir/"src/unix/darwin-proctitle.c")
cCompile(buildDir/"src/unix/fsevents.c")
cCompile(buildDir/"src/unix/kqueue.c")
cCompile(buildDir/"src/unix/proctitle.c")
cCompile(buildDir/"src/unix/random-getentropy.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)