One soversion per library

This commit is contained in:
Manuel Pégourié-Gonnard 2015-06-25 11:54:52 +02:00
parent ace35999b0
commit 752c501126
3 changed files with 59 additions and 25 deletions

View File

@ -144,11 +144,11 @@ endif()
if(USE_SHARED_MBEDTLS_LIBRARY) if(USE_SHARED_MBEDTLS_LIBRARY)
add_library(mbedcrypto SHARED ${src_crypto}) 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}) target_link_libraries(mbedcrypto ${libs})
add_library(mbedx509 SHARED ${src_x509}) 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) target_link_libraries(mbedx509 ${libs} mbedcrypto)
add_library(mbedtls SHARED ${src_tls}) add_library(mbedtls SHARED ${src_tls})

View File

@ -31,7 +31,9 @@ LOCAL_CFLAGS += -fPIC -fpic
endif endif
endif endif
SOEXT=so.8 SOEXT_TLS=so.8
SOEXT_X509=so.0
SOEXT_CRYPTO=so.0
DLEXT=so DLEXT=so
# OSX shared library extension: # OSX shared library extension:
@ -93,13 +95,13 @@ libmbedtls.a: $(OBJS_TLS)
echo " RL $@" echo " RL $@"
$(AR) s $@ $(AR) s $@
libmbedtls.$(SOEXT): $(OBJS_TLS) libmbedtls.$(SOEXT_TLS): $(OBJS_TLS)
echo " LD $@" echo " LD $@"
$(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_TLS) $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_TLS)
libmbedtls.so: libmbedtls.$(SOEXT) libmbedtls.so: libmbedtls.$(SOEXT_TLS)
echo " LN $@ -> libmbedtls.$(SOEXT)" echo " LN $@ -> $<"
ln -sf libmbedtls.$(SOEXT) $@ ln -sf $< $@
libmbedtls.dylib: $(OBJS_TLS) libmbedtls.dylib: $(OBJS_TLS)
echo " LD $@" echo " LD $@"
@ -116,13 +118,13 @@ libmbedx509.a: $(OBJS_X509)
echo " RL $@" echo " RL $@"
$(AR) s $@ $(AR) s $@
libmbedx509.$(SOEXT): $(OBJS_X509) libmbedx509.$(SOEXT_X509): $(OBJS_X509)
echo " LD $@" echo " LD $@"
$(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_X509) $(CC) -shared -Wl,-soname,$@ $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS_X509)
libmbedx509.so: libmbedx509.$(SOEXT) libmbedx509.so: libmbedx509.$(SOEXT_X509)
echo " LN $@ -> libmbedx509.$(SOEXT)" echo " LN $@ -> $<"
ln -sf libmbedx509.$(SOEXT) $@ ln -sf $< $@
libmbedx509.dylib: $(OBJS_X509) libmbedx509.dylib: $(OBJS_X509)
echo " LD $@" echo " LD $@"
@ -139,13 +141,13 @@ libmbedcrypto.a: $(OBJS_CRYPTO)
echo " RL $@" echo " RL $@"
$(AR) s $@ $(AR) s $@
libmbedcrypto.$(SOEXT): $(OBJS_CRYPTO) libmbedcrypto.$(SOEXT_CRYPTO): $(OBJS_CRYPTO)
echo " LD $@" 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) libmbedcrypto.so: libmbedcrypto.$(SOEXT_CRYPTO)
echo " LN $@ -> libmbedcrypto.$(SOEXT)" echo " LN $@ -> $<"
ln -sf libmbedcrypto.$(SOEXT) $@ ln -sf $< $@
libmbedcrypto.dylib: $(OBJS_CRYPTO) libmbedcrypto.dylib: $(OBJS_CRYPTO)
echo " LD $@" echo " LD $@"

View File

@ -13,9 +13,17 @@ do
shift shift
VERSION=$1 VERSION=$1
;; ;;
--soversion) --so-crypto)
shift shift
SOVERSION=$1 SO_CRYPTO=$1
;;
--so-x509)
shift
SO_X509=$1
;;
--so-tls)
shift
SO_TLS=$1
;; ;;
-v|--verbose) -v|--verbose)
# Be verbose # Be verbose
@ -24,9 +32,11 @@ do
-h|--help) -h|--help)
# print help # print help
echo "Usage: $0" echo "Usage: $0"
echo -e " -h|--help\t\t\tPrint this help." echo -e " -h|--help\t\tPrint this help."
echo -e " --version <version>\tVersion to bump to." echo -e " --version <version>\tVersion to bump to."
echo -e " --soversion <version>\tSO version to bump to." echo -e " --so-crypto <version>\tSO version to bump libmbedcrypto to."
echo -e " --so-x509 <version>\tSO version to bump libmbedx509 to."
echo -e " --so-tls <version>\tSO version to bump libmbedtls to."
echo -e " -v|--verbose\t\tVerbose." echo -e " -v|--verbose\t\tVerbose."
exit 1 exit 1
;; ;;
@ -49,14 +59,36 @@ fi
sed -e "s/ VERSION [0-9.]\{1,\}/ VERSION $VERSION/g" < library/CMakeLists.txt > tmp sed -e "s/ VERSION [0-9.]\{1,\}/ VERSION $VERSION/g" < library/CMakeLists.txt > tmp
mv tmp library/CMakeLists.txt mv tmp library/CMakeLists.txt
if [ "X" != "X$SOVERSION" ]; if [ "X" != "X$SO_CRYPTO" ];
then then
[ $VERBOSE ] && echo "Bumping SOVERSION in library/CMakeLists.txt" [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/CMakeLists.txt"
sed -e "s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SOVERSION/g" < library/CMakeLists.txt > tmp sed -e "/mbedcrypto/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_CRYPTO/g" < library/CMakeLists.txt > tmp
mv tmp library/CMakeLists.txt mv tmp library/CMakeLists.txt
[ $VERBOSE ] && echo "Bumping SOVERSION in library/Makefile" [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/Makefile"
sed -e "s/SOEXT=so.[0-9]\{1,\}/SOEXT=so.$SOVERSION/g" < library/Makefile > tmp 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 mv tmp library/Makefile
fi fi