Skip to content

Commit 5f9025f

Browse files
Documentation and a few re-factoring
1 parent d2bfe1d commit 5f9025f

File tree

8 files changed

+131
-885
lines changed

8 files changed

+131
-885
lines changed
Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,44 @@
11
#!/usr/bin/etc/ bash
22

33
set -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
1736
echo ---
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
2140
fi
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-
3542
cd ./stpJ
3643
[ ! -f ./build ] && mkdir ./build || rm -rf ./build/* ||:
3744
@@ -50,10 +57,12 @@ ls
5057
5158
# copy API - jar and - so into javasmt
5259
echo
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"
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#/usr/bin/env/ bash
2+
3+
# This removes any existing STP repositories and build files
4+
# and clones a new repo and build STP
5+
#
26
set -e
37

48
[ -d "./stp" ] && rm -rf ./stp ||:
5-
# [ -d "./build" ] && rm -rf ./build ||:
9+
[ -d "./build" ] && rm -rf ./build ||:
610

711
echo "Build files removed and STP repo deleted."
812
echo "Now cloning stp ..."
@@ -15,18 +19,13 @@ mkdir ./build;cd ./build
1519
echo
1620
echo "Now building STP ... "
1721

18-
# cmake .. -DCMAKE_BUILD_TYPE=Debug
19-
# cmake -DSHAREDCOMPILE=ON ..
20-
# cmake -DSTATICCOMPILE=ON ..
21-
2222
cmake ..
2323
make
24-
sudo make install
25-
#sudo ldconfig
24+
# sudo make install
25+
# sudo ldconfig
2626

2727
echo "... ... STP BUILD SUCCESSFULL"
2828
ls
2929
echo
30-
echo "https://github.com/stp/stp/tree/master/examples/simple"
3130

3231
# cd ../../

native-library-files/stp_project/clean_up.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#/usr/bin/env/ bash
2+
3+
# Clean up the build files for StpJavaApi
4+
# cryptominisat repo is also removed
5+
26
set -e
37

48
# remove STP repo

native-library-files/stp_project/dependencies/install_depends.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/etc/ bash
22

33
set -e
4-
4+
# prerequisite for building STP
55
# boost, flex, bison and minisat
66
sudo apt-get install cmake bison flex libboost-all-dev python perl minisat
77

native-library-files/stp_project/install_prereq.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/etc/ bash
22

3+
# installs dependencies for building the STP library
34
set -e
45

56
cd ./dependencies

0 commit comments

Comments
 (0)