1
1
#! /usr/bin/etc/ bash
2
2
3
3
set -e
4
+ set -u
4
5
5
- # get or locate the project
6
- # build it as a shared library
6
+ # Gets the normal STP library, if not found it is cloned and built.
7
+ # Afterwards, using SWIG we define a new API and generate its JNI bindings
8
+ # The new API is rebuild as a shared library and the JNI Java classes generated
9
+ # The resulting .so library and the binding classes (compile to a .jar)
10
+ # are copied into appropriate folder in java-smt.
7
11
8
- # --- POSSIBLE LIBRARY FILES:
9
- # ./build/src/bin/CMakeFiles/exec.dir/opensmt.C.o
10
- # ./build/src/api/libopensmt2.so
11
12
12
- # FILE="$(pwd)"/opensmt/build/src/api/libopensmt2.so
13
+ STP_LIB=./stp/build/lib/libstp.so
14
+
15
+
16
+ PRJ_DIR=" ${PWD%/*/* } "
17
+ PRJ_NAME=$( basename " $PRJ_DIR " )
18
+
19
+
20
+ # confirm expected directory structure
21
+ # MUST BE like java-smt/../../this_script.sh
22
+ if [[ " $PRJ_NAME " != " java-smt" ]]
23
+ then
24
+ echo " this script is not place in the proper directory" >&2
25
+ echo " this script expects to reside in somewhere like\
26
+ .../java-smt/dir_1/dir_2/build_raw_to_java_api.sh" >&2
27
+ exit 1
28
+ fi
29
+
30
+ # set destination directory for final libraries
31
+ JAR_LIB_DIR=" ${PRJ_DIR} /lib/"
32
+ SO_LIB_DIR=" ${JAR_LIB_DIR} /native/x86_64-linux/
13
33
14
- FILE=./stp/build/lib/libstp.so
15
34
16
35
# echo $FILE
17
36
echo ---
18
- if [! -f " $FILE " ]; then
37
+ if [! -f " $STP_LIB " ]; then
19
38
echo " I can' t find the STP library file. I am making a new one ..."
20
39
sh clean_clone_build.sh
21
40
fi
22
41
23
- # --- copying is no more needed CMAKE should find the library
24
-
25
- # [ ! -f ./stpJ/lib/ ] && mkdir ./stpJ/lib/
26
- # cp $FILE ./stpJ/lib/
27
- # echo "STP shared library file now copied to ./stpJ/lib/ for convinience"
28
-
29
- # create or locate the SWIG interface to this project
30
- # cmake build a new API linking :
31
- # - SWIG interface
32
- # - project .so
33
- # - source file referenced in the SWIG interface (if any)
34
-
35
42
cd ./stpJ
36
43
[ ! -f ./build ] && mkdir ./build || rm -rf ./build/* ||:
37
44
50
57
51
58
# copy API - jar and - so into javasmt
52
59
echo
53
- echo " copying library files into JavaSMT (old files are overwritten) ... .... "
60
+ echo "copying library files into JavaSMT (old files are overwritten) ... ..."
54
61
55
- cp ./stpJavaAPI.jar /home/lubuntu/SAHEED/gsoc/CODE/java-smt/lib/
56
- cp ./libstpJapi.so /home/lubuntu/SAHEED/gsoc/CODE/java-smt/lib/native/x86_64-linux/
62
+ # cp ./stpJavaAPI.jar /home/lubuntu/SAHEED/gsoc/CODE/java-smt/lib/
63
+ # cp ./libstpJapi.so /home/lubuntu/SAHEED/gsoc/CODE/java-smt/lib/native/x86_64-linux/
57
64
58
- echo " SUCCESS"
65
+ cp ./stpJavaAPI.jar $JAR_LIB_DIR
66
+ cp ./libstpJapi.so $SO_LIB_DIR
59
67
68
+ echo "SUCCESS"
0 commit comments