@@ -22,33 +22,72 @@ set -eux -o pipefail
22
22
TMPDIR=$( mktemp -d)
23
23
pushd " ${TMPDIR} "
24
24
25
+ arch=" $( uname -m) "
26
+
25
27
# install cmake
28
+ cmake_ver=" 3.24.1"
26
29
if ! command -v cmake & > /dev/null
27
30
then
28
- wget https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1-Linux-x86_64.sh -O cmake.sh
31
+ wget https://github.com/Kitware/CMake/releases/download/v" ${cmake_ver} " /cmake-" ${cmake_ver} " -Linux-" ${arch} " .sh -O cmake.sh
32
+ wget https://github.com/Kitware/CMake/releases/download/v" ${cmake_ver} " /cmake-" ${cmake_ver} " -SHA-256.txt -O shasums.txt
33
+
34
+ # Verify integrity
35
+
36
+ # The sha256sum will come in the format like the following:
37
+ # sha256hash filename
38
+ # Since we rename the script for convenience purposes,
39
+ # we only want to compare hashes to verify file integrity.
40
+ cmake_expected_shasum=" $( grep " ${arch} " .sh < shasums.txt | awk ' {print $1}' ) "
41
+ cmake_actual_shasum=" $( sha256sum cmake.sh | awk ' {print $1}' ) "
42
+ if [ " ${cmake_expected_shasum} " != " ${cmake_actual_shasum} " ]
43
+ then
44
+ echo " error: cmake sha256sum did not match"
45
+ exit 1
46
+ fi
47
+
29
48
sh cmake.sh --prefix=/usr/local/ --exclude-subdir
30
49
rm -rf cmake.sh
31
50
else
32
51
echo " cmake is installed, skip..."
33
52
fi
34
53
35
54
# install flatc
55
+ flatc_ver=" 2.0.8"
56
+ flatc_expected_shasum=" f97965a727d26386afaefff950badef2db3ab6af9afe23ed6d94bfb65f95f37e"
36
57
if ! command -v flatc & > /dev/null
37
58
then
38
- wget https://github.com/google/flatbuffers/archive/refs/tags/v2.0.8.tar.gz -O flatbuffers.tar.gz
59
+ wget https://github.com/google/flatbuffers/archive/refs/tags/v" ${flatc_ver} " .tar.gz -O flatbuffers.tar.gz
60
+
61
+ flatc_actual_shasum=" $( sha256sum flatbuffers.tar.gz | awk ' {print $1}' ) "
62
+ if [ " ${flatc_expected_shasum} " != " ${flatc_actual_shasum} " ]
63
+ then
64
+ echo " error: flatc sha256sum did not match"
65
+ exit 1
66
+ fi
67
+
39
68
tar xzvf flatbuffers.tar.gz
40
- cd flatbuffers-2.0.8 && cmake -G " Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && make && sudo make install && cd ..
69
+ cd flatbuffers-" ${flatc_ver} " && cmake -G " Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && make && sudo make install && cd ..
41
70
rm -f flatbuffers.tar.gz
42
- rm -rf flatbuffers-2.0.8
71
+ rm -rf flatbuffers-" ${flatc_ver} "
43
72
else
44
73
echo " flatc is installed, skip..."
45
74
fi
46
75
47
76
# 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
77
+ zlib_ver=" 1.2.12"
78
+ zlib_expected_shasum=" 91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9"
79
+
80
+ wget https://zlib.net/fossils/zlib-" ${zlib_ver} " .tar.gz -O zlib.tar.gz
81
+ zmake_actual_shasum=" $( sha256sum zlib.tar.gz | awk ' {print $1}' ) "
82
+ if [ " ${zlib_expected_shasum} " != " ${zmake_actual_shasum} " ]
83
+ then
84
+ echo " error: zmake sha256sum did not match"
85
+ exit 1
86
+ fi
87
+
88
+ tar xzvf zlib.tar.gz
89
+ cd zlib-" ${zlib_ver} " && ./configure && sudo make install && cd ..
90
+ rm -rf zlib-" ${zlib_ver} "
91
+ rm -f zlib.tar.gz
53
92
54
93
popd
0 commit comments