Commit d46c1b9f authored by Javier Guerra Melgares's avatar Javier Guerra Melgares

Merge branch 'develop' of https://gitlab.iotivity.org/otgc/otgc-linux into develop

parents 216f944c a767cbed
......@@ -133,12 +133,18 @@ To uninstall the aplication, use the next command:
sudo dpkg -r otgc
## script to build and install
the following command executes all steps indicated above for building and installing on Linux (ubuntu 16)
## Script to build and install
The following command executes all steps indicated above for building and installing on Linux (ubuntu 18)
curl https://openconnectivity.github.io/otgc-linux/setup.sh | bash
note: __when the executable does start, please reinstall jfx manually__ by entering on the commandline:
sudo apt-get install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2
and start otgc on the command line: /usr/bin/otgc.sh
For rasbian (stretch) use:
......
#!/bin/bash
#
# Constants
#
OTGC_VERSION=2.0.0
UBUNTU_VERSION=16
ARCHITECTURE=amd64
#
# Functions
#
usage() {
echo "This script allows to build, install and execute the OTGC application"
echo -e "Usage:\n ./otgc-cli.sh [options]"
echo -e "Option:"
echo -e "\t--build\t\t\t -> Install all dependecies and build the OTGC application for Ubuntu"
echo -e "\t--build-pi\t\t -> Install all dependencies and build the OTGC application for Raspberry Pi"
echo -e "\t--install <version>\t -> Install the OTGC application"
echo -e "\t--run\t\t\t -> Execute the OTGC application"
echo -e "\t--help\t\t\t -> Show information"
echo -e "Examples:"
echo -e "\t./otgc-cli.sh --build"
echo -e "\t./otgc-cli.sh --build --install 2.9.0"
echo -e "\t./otgc-cli.sh --build-pi"
echo -e "\t./otgc-cli.sh --install 2.9.0"
echo -e "\t./otgc-cli.sh --run"
}
downgrade_javafx() {
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
}
build() {
echo "Building OTGC"
# 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
# maven and swig are needed for building
sudo apt-get -y install maven
sudo apt-get -y install swig
if [ ${UBUNTU_VERSION:0:2} -gt 16 ]
then
downgrade_javafx
else
# install java components
sudo apt-get -y install openjfx
sudo apt-get -y install libopenjfx-jni
sudo apt-get -y install libopenjfx-java
fi
# clone OTGC Linux project with submodules
rm -rf otgc-linux
git clone --recurse-submodules https://github.com/openconnectivity/otgc-linux.git
# create structure for IoTivity-lite library
cd otgc-linux
mkdir -p lib/jni
# build the IoTivity-lite library
cd ./extlibs/iotivity-lite
# apply all patches in the patch folder for IoTivity-lite
git apply --ignore-whitespace ../patchs/*.patch
# compile the library for Linux
cd ./port/linux
make DEBUG=1 SECURE=1 IPV4=1 TCP=0 PKI=1 DYNAMIC=1 CLOUD=0 JAVA=1 IDD=1
cd ../../../.. # back at the root folder
# copy the result of the build
cp ./extlibs/iotivity-lite/swig/iotivity-lite-java/libs/*.so ./lib/jni/.
cp ./extlibs/iotivity-lite/swig/iotivity-lite-java/libs/*.jar ./lib/.
# build OTGC
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
#install the created library, so 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 $ARCHITECTURE
cd ../../../
}
install() {
echo "Installing OTGC v$OTGC_VERSION"
#
# install the created debian package e.g. the otgc application
#
# remove the currently installed package
sudo dpkg -r otgc
# install the newly created package
pwd
sudo dpkg -i ./otgc-linux/build/debian/out/otgc-${OTGC_VERSION}.deb
}
run() {
echo "Running OTGC"
# downgrade JavaFX library if necessary
if [ ${UBUNTU_VERSION:0:2} -gt 16 ]
then
downgrade_javafx
fi
# run the application
/usr/bin/otgc.sh
}
#
# Main
#
# check version of ubuntu
UBUNTU_VERSION=$(lsb_release -sr)
echo "Ubuntu version $UBUNTU_VERSION"
# Loop until all parameters are used up
if [ $# -ge 1 ]
then
while [ "$1" != "" ]; do
case $1 in
--build ) build
;;
--build-pi ) ARCHITECTURE=armhf
build
;;
--install ) shift
OTGC_VERSION=$1
install
;;
--run ) run
;;
--help ) usage
exit
;;
* ) usage
exit 1
esac
# Shift all the parameters down by one
shift
done
else
usage
fi
......@@ -28,9 +28,9 @@ 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 install openjfx=8u161-b12-1ubuntu2
sudo apt-get -y install libopenjfx-java=8u161-b12-1ubuntu2
sudo apt-get -y install libopenjfx-jni=8u161-b12-1ubuntu2
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/openconnectivity/otgc-linux.git
......
......@@ -2,14 +2,14 @@
set -x #echo on
# build setup script to be used with an curl command
#
OTGC_VERSION=2.2.0
OTGC_VERSION=2.10.0
#
# system update
#
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y 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,
......@@ -29,17 +29,21 @@ sudo apt-get -y install swig
#
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
#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 install openjfx=8u161-b12-1ubuntu2
sudo apt-get -y install libopenjfx-java=8u161-b12-1ubuntu2
sudo apt-get -y install libopenjfx-jni=8u161-b12-1ubuntu2
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/openconnectivity/otgc-linux.git
cd otgc-linux
git checkout maintenance/v2.10.0
mkdir lib
......@@ -52,8 +56,9 @@ cd ..
rm -rf iotivity-lite
git clone https://github.com/iotivity/iotivity-lite.git
cd iotivity-lite
git checkout swig
git checkout otgc_220
#git checkout swig
#git checkout otgc_220
git checkout 2.1.1-RC1
git apply --stat ../otgc-linux/extlibs/patchs/remove_cred_by_credid.patch
......@@ -81,6 +86,8 @@ cp ./iotivity-lite/swig/iotivity-lite-java/libs/*.jar ./otgc-linux/lib/.
#
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 \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment