sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 1 | #!/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 | |
| 21 | echo "---> install-git-RESTful.sh" |
| 22 | |
| 23 | # stop on error or unbound var, and be chatty |
| 24 | set -eux |
| 25 | echo "---> 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 |
| 31 | sudo apt-get install -y libcpprest-dev |
| 32 | |
| 33 | sudo 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 | |
| 35 | sudo git clone https://github.com/Microsoft/cpprestsdk.git casablanca && \ |
| 36 | cd casablanca && \ |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 37 | sudo mkdir build && \ |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 38 | cd build && \ |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 39 | 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 |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 45 | |
| 46 | cd ../../ |
| 47 | |
| 48 | |
| 49 | |
| 50 | #installing all dependicies for pistache |
| 51 | sudo apt-get update && sudo apt-get -y install ninja-build python python3-pip libcurl4-openssl-dev libssl-dev pkg-config |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 52 | sudo python3 -m pip install meson |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 53 | |
| 54 | |
| 55 | git clone https://github.com/Tencent/rapidjson && \ |
| 56 | cd rapidjson && \ |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 57 | sudo mkdir build && \ |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 58 | cd build && \ |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 59 | sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \ |
| 60 | sudo make install |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 61 | |
| 62 | cd ../../ |
| 63 | |
| 64 | |
| 65 | #building and installing pistache |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 66 | sudo git clone https://github.com/pistacheio/pistache.git |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 67 | |
| 68 | cd pistache && \ |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 69 | sudo meson setup build \ |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 70 | --buildtype=release \ |
| 71 | -DPISTACHE_USE_SSL=true \ |
| 72 | -DPISTACHE_BUILD_EXAMPLES=true \ |
| 73 | -DPISTACHE_BUILD_TESTS=true \ |
| 74 | -DPISTACHE_BUILD_DOCS=false \ |
| 75 | --prefix="/usr/local" |
| 76 | |
| 77 | cd build && \ |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 78 | sudo ninja && \ |
| 79 | sudo ninja install |
| 80 | sudo cp /usr/local/lib/x86_64-linux-gnu/libpistache* /usr/local/lib/ |
| 81 | sudo cp /usr/local/lib/x86_64-linux-gnu/pkgconfig/libpistache.pc /usr/local/lib/pkgconfig |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 82 | cd ../../ |
| 83 | |
| 84 | |
| 85 | #install nlohmann json |
sandeepindia | 7ede5a0 | 2022-12-10 18:49:03 +0000 | [diff] [blame] | 86 | sudo git clone https://github.com/nlohmann/json.git && cd json && sudo cmake . && sudo make install |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 87 | cd ../ |
| 88 | #install json-schema-validator |
czichy | d94d0dc | 2023-06-14 16:40:03 +0300 | [diff] [blame] | 89 | sudo 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 |
sandeepindia | f606d95 | 2022-12-05 23:48:36 +0530 | [diff] [blame] | 90 | cd ../ |
| 91 | |
| 92 | |
| 93 | export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib |
| 94 | export C_INCLUDE_PATH=/usr/local/include |
| 95 | |
| 96 | echo "---> install-git-RESTful.sh ends" |
| 97 | |