blob: a91fb0bb24605760047ed513cbf3174a6eff0426 [file] [log] [blame]
sandeepindiaf606d952022-12-05 23:48:36 +05301#!/bin/bash
2
3# O-RAN-SC
4#
5# Copyright (C) 2020 AT&T Intellectual Property and Nokia
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18
19# Installs Debian package 'pistache' to support building RPMs
20
21echo "---> install-git-RESTful.sh"
22
23# stop on error or unbound var, and be chatty
24set -eux
25echo "---> install RESTful API dependencies..."
26
27#export PATH=$PATH:~/.local/bin
28#export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
29
30#building and installing cpprestsdk
31sudo apt-get install -y libcpprest-dev
32
33sudo apt-get install -y g++ git libboost-atomic-dev libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-regex-dev libboost-filesystem-dev libboost-random-dev libboost-chrono-dev libboost-serialization-dev libwebsocketpp-dev openssl libssl-dev ninja-build zlib1g-dev
34
35sudo git clone https://github.com/Microsoft/cpprestsdk.git casablanca && \
36 cd casablanca && \
sandeepindia7ede5a02022-12-10 18:49:03 +000037 sudo mkdir build && \
sandeepindiaf606d952022-12-05 23:48:36 +053038 cd build && \
sandeepindia7ede5a02022-12-10 18:49:03 +000039 sudo cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
40 sudo ninja && \
41 sudo ninja install && \
42 sudo cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
43 sudo ninja && \
44 sudo ninja install
sandeepindiaf606d952022-12-05 23:48:36 +053045
46cd ../../
47
48
49
50#installing all dependicies for pistache
51sudo apt-get update && sudo apt-get -y install ninja-build python python3-pip libcurl4-openssl-dev libssl-dev pkg-config
sandeepindia7ede5a02022-12-10 18:49:03 +000052sudo python3 -m pip install meson
sandeepindiaf606d952022-12-05 23:48:36 +053053
54
55git clone https://github.com/Tencent/rapidjson && \
56 cd rapidjson && \
sandeepindia7ede5a02022-12-10 18:49:03 +000057 sudo mkdir build && \
sandeepindiaf606d952022-12-05 23:48:36 +053058 cd build && \
sandeepindia7ede5a02022-12-10 18:49:03 +000059 sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
60 sudo make install
sandeepindiaf606d952022-12-05 23:48:36 +053061
62cd ../../
63
64
65#building and installing pistache
sandeepindia7ede5a02022-12-10 18:49:03 +000066sudo git clone https://github.com/pistacheio/pistache.git
sandeepindiaf606d952022-12-05 23:48:36 +053067
68cd pistache && \
czichy124b69e2023-12-13 19:17:36 +020069 sudo git checkout 363629b8804177a1e743cecfb880eed552922729 && \
sandeepindia7ede5a02022-12-10 18:49:03 +000070 sudo meson setup build \
sandeepindiaf606d952022-12-05 23:48:36 +053071 --buildtype=release \
72 -DPISTACHE_USE_SSL=true \
73 -DPISTACHE_BUILD_EXAMPLES=true \
74 -DPISTACHE_BUILD_TESTS=true \
75 -DPISTACHE_BUILD_DOCS=false \
76 --prefix="/usr/local"
77
78cd build && \
sandeepindia7ede5a02022-12-10 18:49:03 +000079 sudo ninja && \
80 sudo ninja install
81sudo cp /usr/local/lib/x86_64-linux-gnu/libpistache* /usr/local/lib/
82sudo cp /usr/local/lib/x86_64-linux-gnu/pkgconfig/libpistache.pc /usr/local/lib/pkgconfig
sandeepindiaf606d952022-12-05 23:48:36 +053083cd ../../
84
85
86#install nlohmann json
sandeepindia7ede5a02022-12-10 18:49:03 +000087sudo git clone https://github.com/nlohmann/json.git && cd json && sudo cmake . && sudo make install
sandeepindiaf606d952022-12-05 23:48:36 +053088cd ../
89#install json-schema-validator
czichyd94d0dc2023-06-14 16:40:03 +030090sudo git clone https://github.com/pboettch/json-schema-validator.git && cd json-schema-validator && sudo git checkout cae6fad80001510077a7f40e68477a31ec443add &&sudo mkdir build &&cd build && sudo cmake .. && sudo make install
sandeepindiaf606d952022-12-05 23:48:36 +053091cd ../
92
93
94export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
95export C_INCLUDE_PATH=/usr/local/include
96
97echo "---> install-git-RESTful.sh ends"
98