From d56434a21d9e972df1303495440f3bc4f0476da2 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 6 Nov 2012 16:24:49 -0500 Subject: [PATCH] build: support building a .so You can now select to build a shared object at configure time: $ ./gyp_uv -Dcomponent=shared_library -Dlibrary=shared_library And build it with: $ make -C out BUILDTYPE=Debug # or BUILDTYPE=Release Or, if you use ninja: $ ninja -C out/Debug --- gyp_uv | 7 ++++--- include/uv.h | 8 +++++--- uv.gyp | 7 ++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gyp_uv b/gyp_uv index bdbf495d1..81cce5d52 100755 --- a/gyp_uv +++ b/gyp_uv @@ -72,13 +72,14 @@ if __name__ == '__main__': args.append('-Dgcc_version=%d' % (10 * major + minor)) args.append('-Dclang=%d' % int(is_clang)) - if not any(a.startswith('-Dtarget_arch') for a in args): + if not any(a.startswith('-Dtarget_arch=') for a in args): args.append('-Dtarget_arch=ia32') - if not any(a.startswith('-Dlibrary') for a in args): + if not any(a.startswith('-Dlibrary=') for a in args): args.append('-Dlibrary=static_library') - args.append('-Dcomponent=static_library') + if not any(a.startswith('-Dcomponent=') for a in args): + args.append('-Dcomponent=static_library') gyp_args = list(args) print gyp_args diff --git a/include/uv.h b/include/uv.h index 1acea6ffc..9d80d9a18 100644 --- a/include/uv.h +++ b/include/uv.h @@ -1639,9 +1639,11 @@ struct uv_signal_s { }; /* These functions are no-ops on Windows. */ -int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle); -int uv_signal_start(uv_signal_t* handle, uv_signal_cb signal_cb, int signum); -int uv_signal_stop(uv_signal_t* handle); +UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle); +UV_EXTERN int uv_signal_start(uv_signal_t* handle, + uv_signal_cb signal_cb, + int signum); +UV_EXTERN int uv_signal_stop(uv_signal_t* handle); /* diff --git a/uv.gyp b/uv.gyp index 4c1a3a21e..27d9b25a5 100644 --- a/uv.gyp +++ b/uv.gyp @@ -144,7 +144,12 @@ 'src/unix/udp.c', ], 'include_dirs': [ 'src/unix/ev', ], - 'libraries': [ '-lm' ] + 'libraries': [ '-lm' ], + 'conditions': [ + ['"<(library)" == "shared_library"', { + 'cflags': [ '-fPIC' ], + }], + ], }], [ 'OS=="mac"', { 'sources': [ 'src/unix/darwin.c', 'src/unix/fsevents.c' ],