One soversion per library

parent ace35999
......@@ -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})
......
......@@ -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 $@"
......
......@@ -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 <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."
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 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 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 in library/CMakeLists.txt"
sed -e "s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SOVERSION/g" < library/CMakeLists.txt > tmp
[ $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 in library/Makefile"
sed -e "s/SOEXT=so.[0-9]\{1,\}/SOEXT=so.$SOVERSION/g" < library/Makefile > tmp
[ $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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment