From 7dfc4025ea9aba3d6b1be38cd2e5596d8f739ef4 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Tue, 30 Jun 2015 21:43:04 +0000 Subject: [PATCH] Properly version libjsoncpp.so. Fix the problem described in bug 200969: currently, libjsoncpp.so is not properly versioned by SCons; in other words, there's no SONAME in the library's ELF header, which confuses the linker when creating binaries that link against it. Solve it by using InstallVersionedLib(), available since SCons 2.3.0: this call is able to properly version the shared library the way we need it. Since there is no support for actually installing the files outside the build directory, we have to recreate the required symlinks ourselves in the Makefile. Another related change is that we now create the libraries with the proper names instead of doing that in the Makefile. I'm (ab)using the maintainer's approval given to bug 200939, as swills's latest patch includes this change as well. PR: 200969 PR: 201057 Approved by: johan@stromnet.se (maintainer) --- devel/jsoncpp/Makefile | 15 +++---- devel/jsoncpp/files/patch-SConstruct | 43 ++++++++++++++++++- .../files/patch-src_lib__json_sconscript | 8 ++++ devel/jsoncpp/pkg-plist | 1 + 4 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 devel/jsoncpp/files/patch-src_lib__json_sconscript diff --git a/devel/jsoncpp/Makefile b/devel/jsoncpp/Makefile index 5bed55cb7099..12c30be3a60a 100644 --- a/devel/jsoncpp/Makefile +++ b/devel/jsoncpp/Makefile @@ -3,7 +3,7 @@ PORTNAME= jsoncpp DISTVERSION= 0.6.0-rc2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel MASTER_SITES= SF/${PORTNAME}/jsoncpp/${DISTVERSION} DISTNAME= jsoncpp-src-${DISTVERSION} @@ -21,12 +21,11 @@ MAKE_ARGS= platform=linux-gcc do-install: @${MKDIR} ${STAGEDIR}${PREFIX}/include/jsoncpp (cd ${WRKSRC}/include/ && ${COPYTREE_SHARE} json/ ${STAGEDIR}${PREFIX}/include/jsoncpp/) - (cd ${WRKSRC}/libs/linux-gcc-FreeBSD/ && \ - ${INSTALL_DATA} libjson_linux-gcc-FreeBSD_libmt.a \ - ${STAGEDIR}${PREFIX}/lib/libjsoncpp.a) - (cd ${WRKSRC}/libs/linux-gcc-FreeBSD/ && \ - ${INSTALL_LIB} libjson_linux-gcc-FreeBSD_libmt.so \ - ${STAGEDIR}${PREFIX}/lib/libjsoncpp.so.0) - (cd ${STAGEDIR}${PREFIX}/lib/ && ${LN} -sf libjsoncpp.so.0 libjsoncpp.so ) + ${INSTALL_DATA} ${WRKSRC}/libs/linux-gcc-FreeBSD/libjsoncpp.a \ + ${STAGEDIR}${PREFIX}/lib + ${INSTALL_LIB} ${WRKSRC}/libs/linux-gcc-FreeBSD/libjsoncpp.so.0.6.0 \ + ${STAGEDIR}${PREFIX}/lib + ${LN} -s libjsoncpp.so.0.6.0 ${STAGEDIR}${PREFIX}/lib/libjsoncpp.so.0 + ${LN} -s libjsoncpp.so.0.6.0 ${STAGEDIR}${PREFIX}/lib/libjsoncpp.so .include diff --git a/devel/jsoncpp/files/patch-SConstruct b/devel/jsoncpp/files/patch-SConstruct index c888328d5857..9870df3113f5 100644 --- a/devel/jsoncpp/files/patch-SConstruct +++ b/devel/jsoncpp/files/patch-SConstruct @@ -1,5 +1,5 @@ ---- SConstruct.orig 2014-12-02 06:28:17.000000000 +0300 -+++ SConstruct 2014-12-02 06:28:31.000000000 +0300 +--- SConstruct ++++ SConstruct @@ -26,7 +26,7 @@ if platform == 'linux-gcc': CXX = 'g++' # not quite right, but env is not yet available. @@ -26,3 +26,42 @@ else: print "UNSUPPORTED PLATFORM." env.Exit(1) +@@ -147,6 +148,11 @@ + env['BUILD_DIR'] = env.Dir(build_dir) + env['ROOTBUILD_DIR'] = env.Dir(rootbuild_dir) + env['DIST_DIR'] = DIST_DIR ++ ++# Set SHLIBVERSION for env.InstallVersionedLib(). We use the version number ++# without the "-rcXX" part. ++env['SHLIBVERSION'] = JSONCPP_VERSION.partition('-')[0] ++ + if 'TarGz' in env['BUILDERS']: + class SrcDistAdder: + def __init__( self, env ): +@@ -164,7 +170,7 @@ + env['SRCDIST_TARGET'] = os.path.join( DIST_DIR, 'jsoncpp-src-%s.tar.gz' % env['JSONCPP_VERSION'] ) + + env_testing = env.Clone( ) +-env_testing.Append( LIBS = ['json_${LIB_NAME_SUFFIX}'] ) ++env_testing.Append( LIBS = ['jsoncpp'] ) + + def buildJSONExample( env, target_sources, target_name ): + env = env.Clone() +@@ -187,14 +193,14 @@ + env.AlwaysBuild( check_alias_target ) + + def buildLibrary( env, target_sources, target_name ): +- static_lib = env.StaticLibrary( target=target_name + '_${LIB_NAME_SUFFIX}', ++ static_lib = env.StaticLibrary( target=target_name, + source=target_sources ) + global lib_dir + env.Install( lib_dir, static_lib ) + if env['SHARED_LIB_ENABLED']: +- shared_lib = env.SharedLibrary( target=target_name + '_${LIB_NAME_SUFFIX}', ++ shared_lib = env.SharedLibrary( target=target_name, + source=target_sources ) +- env.Install( lib_dir, shared_lib ) ++ env.InstallVersionedLib( lib_dir, shared_lib ) + env['SRCDIST_ADD']( source=[target_sources] ) + + Export( 'env env_testing buildJSONExample buildLibrary buildJSONTests buildUnitTests' ) diff --git a/devel/jsoncpp/files/patch-src_lib__json_sconscript b/devel/jsoncpp/files/patch-src_lib__json_sconscript new file mode 100644 index 000000000000..e30f8f9c7aaa --- /dev/null +++ b/devel/jsoncpp/files/patch-src_lib__json_sconscript @@ -0,0 +1,8 @@ +--- src/lib_json/sconscript.orig 2015-06-22 20:34:03 UTC ++++ src/lib_json/sconscript +@@ -5,4 +5,4 @@ buildLibrary( env, Split( """ + json_value.cpp + json_writer.cpp + """ ), +- 'json' ) ++ 'jsoncpp' ) diff --git a/devel/jsoncpp/pkg-plist b/devel/jsoncpp/pkg-plist index 953633fe0245..0dfb576f5f80 100644 --- a/devel/jsoncpp/pkg-plist +++ b/devel/jsoncpp/pkg-plist @@ -1,3 +1,4 @@ +lib/libjsoncpp.so.0.6.0 lib/libjsoncpp.so.0 lib/libjsoncpp.so lib/libjsoncpp.a