| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright The containerd Authors. |
| 4 | |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | echo "Install soci dependencies" |
| 18 | set -eux -o pipefail |
| 19 | |
| 20 | # the installation shouldn't assume the script is executed in a specific directory. |
| 21 | # move to tmp in case there is leftover while installing dependencies. |
| 22 | TMPDIR=$(mktemp -d) |
| 23 | pushd ${TMPDIR} |
| 24 | |
| 25 | # install cmake |
| 26 | if ! command -v cmake &> /dev/null |
| 27 | then |
| 28 | wget https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1-Linux-x86_64.sh -O cmake.sh |
| 29 | sh cmake.sh --prefix=/usr/local/ --exclude-subdir |
| 30 | rm -rf cmake.sh |
| 31 | else |
| 32 | echo "cmake is installed, skip..." |
| 33 | fi |
| 34 | |
| 35 | # install flatc |
| 36 | if ! command -v flatc &> /dev/null |
| 37 | then |
| 38 | wget https://github.com/google/flatbuffers/archive/refs/tags/v2.0.8.tar.gz -O flatbuffers.tar.gz |
| 39 | tar xzvf flatbuffers.tar.gz |
| 40 | cd flatbuffers-2.0.8 && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && make && sudo make install && cd .. |
| 41 | rm -f flatbuffers.tar.gz |
| 42 | rm -rf flatbuffers-2.0.8 |
| 43 | else |
| 44 | echo "flatc is installed, skip..." |
| 45 | fi |
| 46 | |
| 47 | # install-zlib |
| 48 | wget https://zlib.net/fossils/zlib-1.2.12.tar.gz |
| 49 | tar xzvf zlib-1.2.12.tar.gz |
| 50 | cd zlib-1.2.12 && ./configure && sudo make install && cd .. |
| 51 | rm -rf zlib-1.2.12 |
| 52 | rm -f zlib-1.2.12.tar.gz |
| 53 | |
| 54 | popd |