11#! /usr/bin/etc/ bash
22
33set -e
4+ set -u
45
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.
711
8- # --- POSSIBLE LIBRARY FILES:
9- # ./build/src/bin/CMakeFiles/exec.dir/opensmt.C.o
10- # ./build/src/api/libopensmt2.so
1112
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/
1333
14- FILE=./stp/build/lib/libstp.so
1534
1635# echo $FILE
1736echo ---
18- if [! -f " $FILE " ]; then
37+ if [! -f " $STP_LIB " ]; then
1938 echo " I can' t find the STP library file. I am making a new one ..."
2039 sh clean_clone_build.sh
2140fi
2241
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-
3542cd ./stpJ
3643[ ! -f ./build ] && mkdir ./build || rm -rf ./build/* ||:
3744
5057
5158# copy API - jar and - so into javasmt
5259echo
53- echo " copying library files into JavaSMT (old files are overwritten) ... .... "
60+ echo "copying library files into JavaSMT (old files are overwritten) ... ..."
5461
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/
5764
58- echo " SUCCESS"
65+ cp ./stpJavaAPI.jar $JAR_LIB_DIR
66+ cp ./libstpJapi.so $SO_LIB_DIR
5967
68+ echo "SUCCESS"
0 commit comments