-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·112 lines (93 loc) · 2.69 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
set -x #echo on
# build setup script to be used with an curl command
#
OTGC_VERSION=3.1.0
#
# system update
#
#sudo apt-get -y update
#sudo apt-get -y upgrade
#sudo apt-get -y update
# make sure that git is there, because the scripts are using git.
# nano is just good to have,
sudo apt-get -y install git
sudo apt-get -y nano
sudo apt-get -y automake
sudo apt-get -y install make
sudo apt-get -y install make-guile
sudo apt-get -y install gcc
sudo apt-get -y install g++
# maven and swig are needed for building
sudo apt-get -y install maven
sudo apt-get -y install swig
#
# install dependend jdk/jfx packages
#
sudo apt-get -y install openjdk-8-jdk
# install java components, but later overwrite them with the downgraded versions if they exist on the system
#sudo apt-get -y install openjfx
#sudo apt-get -y install libopenjfx-jni
#sudo apt-get -y install libopenjfx-java
# install downgraded java components
sudo apt-get -y autoremove openjfx
sudo apt-get -y autoremove libopenjfx-java
sudo apt-get -y autoremove libopenjfx-jni
sudo apt-get -y install openjfx=8u161-b12-1ubuntu2 --allow-downgrades
sudo apt-get -y install libopenjfx-java=8u161-b12-1ubuntu2 --allow-downgrades
sudo apt-get -y install libopenjfx-jni=8u161-b12-1ubuntu2 --allow-downgrades
rm -rf otgc-linux
git clone https://github.com/iotivity/otgc-linux.git
cd otgc-linux
mkdir lib
cd lib
mkdir jni
cd ..
cd ..
#build the lib
rm -rf iotivity-lite
git clone https://github.com/iotivity/iotivity-lite.git
cd iotivity-lite
git checkout 6d4c08aa76f54d3587adcac38bcd423bded7353d
cd ./port/linux
make DEBUG=1 SECURE=1 IPV4=1 TCP=1 PKI=1 DYNAMIC=1 CLOUD=1 JAVA=1 IDD=1
cd ..
cd ..
cd ..
#
# copying the result of the build
#
pwd
cp ./iotivity-lite/swig/iotivity-lite-java/libs/*.so ./otgc-linux/lib/jni/.
cp ./iotivity-lite/swig/iotivity-lite-java/libs/*.jar ./otgc-linux/lib/.
#
# build otgc (in the otgc-linux folder)
#
cd otgc-linux
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
# install the create lib, so that maven can find it during the build
mvn install:install-file \
-Dfile=lib/iotivity-lite.jar \
-DgroupId=org.iotivity \
-DartifactId=iotivity-lite \
-Dversion=1.0 \
-Dpackaging=jar \
-DgeneratePom=true
# do the actual build
mvn jfx:jar
# build the debian package
cd ./build/debian
./otgc_native.sh ../../target/jfx/app amd64
cd ..
cd ..
cd ..
# back at the root level
#
# install the created debian package e.g. the otgc application
#
# remove the currently installed package
sudo dpkg -r otgc
# install the newly created package
sudo dpkg -i ./otgc-linux/build/debian/out/otgc-${OTGC_VERSION}.deb
#choose the correct Java version
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java