1
1
#! /bin/bash -e
2
2
3
- . /etc/os-release
4
-
5
3
print_usage () {
6
4
echo " $0 --profile release"
7
5
echo " --profile specify profile"
@@ -20,8 +18,8 @@ while [[ $# -gt 0 ]]; do
20
18
esac
21
19
done
22
20
23
- TARGET=" $PROFILE "
24
- case " $PROFILE " in
21
+ TARGET=" ${ PROFILE} "
22
+ case " ${ PROFILE} " in
25
23
" dev" )
26
24
TARGET=" debug"
27
25
;;
@@ -37,12 +35,29 @@ VERSION_MINOR=$(sed -n -e 's/^#define CASS_VERSION_MINOR \(.*\)/\1/p' ../include
37
35
VERSION_PATCH=$( sed -n -e ' s/^#define CASS_VERSION_PATCH \(.*\)/\1/p' ../include/cassandra.h)
38
36
VERSION=" ${VERSION_MAJOR} .${VERSION_MINOR} .${VERSION_PATCH} "
39
37
40
- # library name should be "libscylla-cpp-driver", but since Cargo doesn't allow this library name we have to rename it here
41
- cp --remove-destination -v target/" ${TARGET} " /libscylla_cpp_driver.so target/" ${TARGET} " /libscylla-cpp-driver.so
42
- cp --remove-destination -v target/" ${TARGET} " /libscylla_cpp_driver.a target/" ${TARGET} " /libscylla-cpp-driver_static.a
43
- rm -fv target/" ${TARGET} " /libscylla_cpp_driver.{so,a}
38
+ UNAME=" $( uname) "
39
+ # On macOS
40
+ if [[ " ${UNAME} " = " Darwin" ]]; then
41
+ # library name should be "libscylla-cpp-driver", but since Cargo doesn't allow this library name we have to rename it here
42
+ rm -f target/" ${TARGET} " /{libscylla-cpp-driver.dylib,libscylla-cpp-driver_static.a}
43
+ cp -v target/" ${TARGET} " /libscylla_cpp_driver.dylib target/" ${TARGET} " /libscylla-cpp-driver.dylib
44
+ cp -v target/" ${TARGET} " /libscylla_cpp_driver.a target/" ${TARGET} " /libscylla-cpp-driver_static.a
45
+ rm -fv target/" ${TARGET} " /libscylla_cpp_driver.{dylib,a}
46
+
47
+ # make .so "versioned" style using symlinks
48
+ rm -f target/" ${TARGET} " /libscylla-cpp-driver." ${VERSION} " .dylib
49
+ cp -v target/" ${TARGET} " /libscylla-cpp-driver.dylib target/" ${TARGET} " /libscylla-cpp-driver." ${VERSION} " .dylib
50
+ ln -vsf libscylla-cpp-driver." ${VERSION} " .dylib target/" ${TARGET} " /libscylla-cpp-driver." ${VERSION_MAJOR} " .dylib
51
+ ln -vsf libscylla-cpp-driver." ${VERSION} " .dylib target/" ${TARGET} " /libscylla-cpp-driver.dylib
52
+ # Linux and other
53
+ else
54
+ # library name should be "libscylla-cpp-driver", but since Cargo doesn't allow this library name we have to rename it here
55
+ cp --remove-destination -v target/" ${TARGET} " /libscylla_cpp_driver.so target/" ${TARGET} " /libscylla-cpp-driver.so
56
+ cp --remove-destination -v target/" ${TARGET} " /libscylla_cpp_driver.a target/" ${TARGET} " /libscylla-cpp-driver_static.a
57
+ rm -fv target/" ${TARGET} " /libscylla_cpp_driver.{so,a}
44
58
45
- # make .so "versioned" style using symlinks
46
- cp --remove-destination -v target/" ${TARGET} " /libscylla-cpp-driver.so target/" ${TARGET} " /libscylla-cpp-driver.so." ${VERSION} "
47
- ln -vsf libscylla-cpp-driver.so." ${VERSION} " target/" ${TARGET} " /libscylla-cpp-driver.so." ${VERSION_MAJOR} "
48
- ln -vsf libscylla-cpp-driver.so." ${VERSION} " target/" ${TARGET} " /libscylla-cpp-driver.so
59
+ # make .so "versioned" style using symlinks
60
+ cp --remove-destination -v target/" ${TARGET} " /libscylla-cpp-driver.so target/" ${TARGET} " /libscylla-cpp-driver.so." ${VERSION} "
61
+ ln -vsf libscylla-cpp-driver.so." ${VERSION} " target/" ${TARGET} " /libscylla-cpp-driver.so." ${VERSION_MAJOR} "
62
+ ln -vsf libscylla-cpp-driver.so." ${VERSION} " target/" ${TARGET} " /libscylla-cpp-driver.so
63
+ fi
0 commit comments