From fa17cdcdc8f737fbcf986f96d657ca37e07fb1be Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 12 May 2013 14:48:58 +0200 Subject: [PATCH] build: set soname in shared library --- config-unix.mk | 5 +++++ src/version.c | 4 +++- uv.gyp | 9 ++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config-unix.mk b/config-unix.mk index ae510a332d127e03bd03f6f424e7b2e0c9973053..ea4a0ad4f715ad0ccd834228724b97aa3feed3ae 100644 --- a/config-unix.mk +++ b/config-unix.mk @@ -153,6 +153,11 @@ CPPFLAGS += -Isrc/unix CFLAGS += -DHAVE_DTRACE endif +ifneq (darwin,$(PLATFORM)) +# Must correspond with UV_VERSION_MAJOR and UV_VERSION_MINOR in src/version.c +LDFLAGS += -Wl,-soname,libuv.so.0.10 +endif + libuv.a: $(OBJS) $(AR) rcs $@ $^ diff --git a/src/version.c b/src/version.c index 3291d47eebb10532638c58b2e5ffa348064f7564..9e9bf003e4ced453e28dfeb383b6474eb69271ff 100644 --- a/src/version.c +++ b/src/version.c @@ -24,7 +24,9 @@ /* * Versions with an even minor version (e.g. 0.6.1 or 1.0.4) are API and ABI * stable. When the minor version is odd, the API can change between patch - * releases. + * releases. Make sure you update the -soname directives in config-unix.mk + * and uv.gyp whenever you bump UV_VERSION_MAJOR or UV_VERSION_MINOR (but + * not UV_VERSION_PATCH.) */ #undef UV_VERSION_MAJOR /* TODO(bnoordhuis) Remove in v0.11. */ diff --git a/uv.gyp b/uv.gyp index 7824819a9bd4a889b566cefa45873d24822a689e..407da4bb3483a5eb4ff1f23fa90596013e721655 100644 --- a/uv.gyp +++ b/uv.gyp @@ -164,9 +164,16 @@ ], }, 'conditions': [ - ['"<(library)" == "shared_library"', { + ['library=="shared_library"', { 'cflags': [ '-fPIC' ], }], + ['library=="shared_library" and OS!="mac"', { + 'link_settings': { + # Must correspond with UV_VERSION_MAJOR and UV_VERSION_MINOR + # in src/version.c + 'libraries': [ '-Wl,-soname,libuv.so.0.10' ], + }, + }], ], }], [ 'OS=="linux" or OS=="mac"', { -- 1.8.2.1