From 752c50112603188cfbfe97f4d1b36b4837463ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 25 Jun 2015 11:54:52 +0200 Subject: [PATCH] One soversion per library --- library/CMakeLists.txt | 4 ++-- library/Makefile | 30 +++++++++++++------------ scripts/bump_version.sh | 50 +++++++++++++++++++++++++++++++++-------- 3 files changed, 59 insertions(+), 25 deletions(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 5632d3b60..60b3f8b55 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -144,11 +144,11 @@ endif() if(USE_SHARED_MBEDTLS_LIBRARY) add_library(mbedcrypto SHARED ${src_crypto}) - set_target_properties(mbedcrypto PROPERTIES VERSION 1.4.0 SOVERSION 8) + set_target_properties(mbedcrypto PROPERTIES VERSION 1.4.0 SOVERSION 0) target_link_libraries(mbedcrypto ${libs}) add_library(mbedx509 SHARED ${src_x509}) - set_target_properties(mbedx509 PROPERTIES VERSION 1.4.0 SOVERSION 8) + set_target_properties(mbedx509 PROPERTIES VERSION 1.4.0 SOVERSION 0) target_link_libraries(mbedx509 ${libs} mbedcrypto) add_library(mbedtls SHARED ${src_tls}) diff --git a/library/Makefile b/library/Makefile index 9fd7f8110..4147bbe11 100644 --- a/library/Makefile +++ b/library/Makefile @@ -31,7 +31,9 @@ LOCAL_CFLAGS += -fPIC -fpic endif endif -SOEXT=so.8 +SOEXT_TLS=so.8 +SOEXT_X509=so.0 +SOEXT_CRYPTO=so.0 DLEXT=so # OSX shared library extension: @@ -93,13 +95,13 @@ libmbedtls.a: $(OBJS_TLS) echo " RL $@" $(AR) s $@ -libmbedtls.$(SOEXT): $(OBJS_TLS) +libmbedtls.$(SOEXT_TLS): $(OBJS_TLS) echo " LD $@" $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_TLS) -libmbedtls.so: libmbedtls.$(SOEXT) - echo " LN $@ -> libmbedtls.$(SOEXT)" - ln -sf libmbedtls.$(SOEXT) $@ +libmbedtls.so: libmbedtls.$(SOEXT_TLS) + echo " LN $@ -> $<" + ln -sf $< $@ libmbedtls.dylib: $(OBJS_TLS) echo " LD $@" @@ -116,13 +118,13 @@ libmbedx509.a: $(OBJS_X509) echo " RL $@" $(AR) s $@ -libmbedx509.$(SOEXT): $(OBJS_X509) +libmbedx509.$(SOEXT_X509): $(OBJS_X509) echo " LD $@" $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_X509) -libmbedx509.so: libmbedx509.$(SOEXT) - echo " LN $@ -> libmbedx509.$(SOEXT)" - ln -sf libmbedx509.$(SOEXT) $@ +libmbedx509.so: libmbedx509.$(SOEXT_X509) + echo " LN $@ -> $<" + ln -sf $< $@ libmbedx509.dylib: $(OBJS_X509) echo " LD $@" @@ -139,13 +141,13 @@ libmbedcrypto.a: $(OBJS_CRYPTO) echo " RL $@" $(AR) s $@ -libmbedcrypto.$(SOEXT): $(OBJS_CRYPTO) +libmbedcrypto.$(SOEXT_CRYPTO): $(OBJS_CRYPTO) echo " LD $@" - $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_CRYPTO) + $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_CRYPTO_CRYPTO) -libmbedcrypto.so: libmbedcrypto.$(SOEXT) - echo " LN $@ -> libmbedcrypto.$(SOEXT)" - ln -sf libmbedcrypto.$(SOEXT) $@ +libmbedcrypto.so: libmbedcrypto.$(SOEXT_CRYPTO) + echo " LN $@ -> $<" + ln -sf $< $@ libmbedcrypto.dylib: $(OBJS_CRYPTO) echo " LD $@" diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh index 2b7c19ca7..8e7710533 100755 --- a/scripts/bump_version.sh +++ b/scripts/bump_version.sh @@ -13,9 +13,17 @@ do shift VERSION=$1 ;; - --soversion) + --so-crypto) shift - SOVERSION=$1 + SO_CRYPTO=$1 + ;; + --so-x509) + shift + SO_X509=$1 + ;; + --so-tls) + shift + SO_TLS=$1 ;; -v|--verbose) # Be verbose @@ -24,9 +32,11 @@ do -h|--help) # print help echo "Usage: $0" - echo -e " -h|--help\t\t\tPrint this help." + echo -e " -h|--help\t\tPrint this help." echo -e " --version \tVersion to bump to." - echo -e " --soversion \tSO version to bump to." + echo -e " --so-crypto \tSO version to bump libmbedcrypto to." + echo -e " --so-x509 \tSO version to bump libmbedx509 to." + echo -e " --so-tls \tSO version to bump libmbedtls to." echo -e " -v|--verbose\t\tVerbose." exit 1 ;; @@ -49,14 +59,36 @@ fi sed -e "s/ VERSION [0-9.]\{1,\}/ VERSION $VERSION/g" < library/CMakeLists.txt > tmp mv tmp library/CMakeLists.txt -if [ "X" != "X$SOVERSION" ]; +if [ "X" != "X$SO_CRYPTO" ]; then - [ $VERBOSE ] && echo "Bumping SOVERSION in library/CMakeLists.txt" - sed -e "s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SOVERSION/g" < library/CMakeLists.txt > tmp + [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/CMakeLists.txt" + sed -e "/mbedcrypto/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_CRYPTO/g" < library/CMakeLists.txt > tmp mv tmp library/CMakeLists.txt - [ $VERBOSE ] && echo "Bumping SOVERSION in library/Makefile" - sed -e "s/SOEXT=so.[0-9]\{1,\}/SOEXT=so.$SOVERSION/g" < library/Makefile > tmp + [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/Makefile" + sed -e "s/SOEXT_CRYPTO=so.[0-9]\{1,\}/SOEXT_CRYPTO=so.$SO_CRYPTO/g" < library/Makefile > tmp + mv tmp library/Makefile +fi + +if [ "X" != "X$SO_X509" ]; +then + [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedx509 in library/CMakeLists.txt" + sed -e "/mbedx509/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_X509/g" < library/CMakeLists.txt > tmp + mv tmp library/CMakeLists.txt + + [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedx509 in library/Makefile" + sed -e "s/SOEXT_X509=so.[0-9]\{1,\}/SOEXT_X509=so.$SO_X509/g" < library/Makefile > tmp + mv tmp library/Makefile +fi + +if [ "X" != "X$SO_TLS" ]; +then + [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedtls in library/CMakeLists.txt" + sed -e "/mbedtls/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_TLS/g" < library/CMakeLists.txt > tmp + mv tmp library/CMakeLists.txt + + [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedtls in library/Makefile" + sed -e "s/SOEXT_TLS=so.[0-9]\{1,\}/SOEXT_TLS=so.$SO_TLS/g" < library/Makefile > tmp mv tmp library/Makefile fi