Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 652a6b6

Browse files
committedAug 19, 2022
Simplify configure script to remove deps cache
1 parent 88f3fcb commit 652a6b6

File tree

1 file changed

+39
-49
lines changed

1 file changed

+39
-49
lines changed
 

‎scripts/configure.sh

+39-49
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
2626
CPUS=$(sysctl -n hw.ncpu)
2727
# ensure development environment is set correctly for clang
2828
$SUDO xcode-select -switch /Library/Developer/CommandLineTools
29-
brew install leveldb llvm@14 googletest lcov make wget cmake
29+
brew install llvm@14 googletest lcov make wget cmake
3030
CLANG_TIDY=/usr/local/bin/clang-tidy
3131
if [ ! -L "$CLANG_TIDY" ]; then
3232
$SUDO ln -s $(brew --prefix)/opt/llvm@14/bin/clang-tidy /usr/local/bin/clang-tidy
@@ -41,63 +41,53 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
4141
apt update
4242
apt install -y build-essential wget cmake libgtest-dev lcov git software-properties-common rsync
4343

44-
# GitHub Actions in .github/workflows/validation.yml will attempt to cache and reuse leveldb built in this block.
45-
# If a folder called leveldb-1.22 exists, skip the build step and go straight to install.
46-
# See https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
47-
if [ ! -d "leveldb-1.22-${CMAKE_BUILD_TYPE}" ]; then
48-
echo -e "${green}Building LevelDB from sources...${end}"
49-
wget https://github.com/google/leveldb/archive/1.22.tar.gz
50-
tar xzvf 1.22.tar.gz
51-
rm -rf 1.22.tar.gz
52-
mv leveldb-1.22 "leveldb-1.22-${CMAKE_BUILD_TYPE}"
53-
cd "leveldb-1.22-${CMAKE_BUILD_TYPE}"
54-
eval "cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DLEVELDB_BUILD_TESTS=0 -DLEVELDB_BUILD_BENCHMARKS=0 -DBUILD_SHARED_LIBS=0 ."
55-
make -j$CPUS
56-
else
57-
echo -e "${green}Installing LevelDB from cache...${end}"
58-
cd "leveldb-1.22-${CMAKE_BUILD_TYPE}"
59-
fi
60-
make install
61-
cd ..
62-
63-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
64-
add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main"
65-
apt install -y clang-format-14 clang-tidy-14
66-
ln -s -f $(which clang-format-14) /usr/local/bin/clang-format
67-
ln -s -f $(which clang-tidy-14) /usr/local/bin/clang-tidy
44+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | $SUDO apt-key add -
45+
$SUDO add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main"
46+
$SUDO apt install -y clang-format-14 clang-tidy-14
47+
$SUDO ln -s -f $(which clang-format-14) /usr/local/bin/clang-format
48+
$SUDO ln -s -f $(which clang-tidy-14) /usr/local/bin/clang-tidy
6849
fi
6950

51+
LEVELDB_VERSION="1.23"
52+
echo -e "${green}Building LevelDB from sources...${end}"
53+
wget https://github.com/google/leveldb/archive/${LEVELDB_VERSION}.tar.gz
54+
rm -rf "leveldb-${LEVELDB_VERSION}-${CMAKE_BUILD_TYPE}"
55+
tar xzvf ${LEVELDB_VERSION}.tar.gz
56+
rm -rf ${LEVELDB_VERSION}.tar.gz
57+
mv leveldb-${LEVELDB_VERSION} "leveldb-${LEVELDB_VERSION}-${CMAKE_BUILD_TYPE}"
58+
cd "leveldb-${LEVELDB_VERSION}-${CMAKE_BUILD_TYPE}"
59+
eval "cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DLEVELDB_BUILD_TESTS=0 -DLEVELDB_BUILD_BENCHMARKS=0 -DBUILD_SHARED_LIBS=0 ."
60+
make -j$CPUS
61+
$SUDO make install
62+
cd ..
63+
7064
NURAFT_VERSION="1.3.0"
71-
if [ ! -d "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}" ]; then
72-
echo -e "${green}Building NuRaft from sources...${end}"
73-
wget https://github.com/eBay/NuRaft/archive/v${NURAFT_VERSION}.tar.gz
74-
tar xzvf v${NURAFT_VERSION}.tar.gz
75-
rm v${NURAFT_VERSION}.tar.gz
76-
mv NuRaft-${NURAFT_VERSION} "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}"
77-
cd "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}"
78-
./prepare.sh
79-
if [[ "$BUILD_RELEASE" == "1" ]]; then
80-
# If we're doing a release build, remove the examples and tests
81-
rm -rf examples tests
82-
mkdir examples
83-
mkdir tests
84-
touch examples/CMakeLists.txt
85-
touch tests/CMakeLists.txt
86-
fi
87-
mkdir -p build
88-
cd build
89-
eval "cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DDISABLE_SSL=1 .."
90-
eval "make -j$CPUS static_lib"
91-
else
92-
echo -e "${green}Installing NuRaft from cache...${end}"
93-
cd "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}/build"
65+
echo -e "${green}Building NuRaft from sources...${end}"
66+
wget https://github.com/eBay/NuRaft/archive/v${NURAFT_VERSION}.tar.gz
67+
rm -rf "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}"
68+
tar xzvf v${NURAFT_VERSION}.tar.gz
69+
rm v${NURAFT_VERSION}.tar.gz
70+
mv NuRaft-${NURAFT_VERSION} "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}"
71+
cd "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}"
72+
./prepare.sh
73+
if [[ "$BUILD_RELEASE" == "1" ]]; then
74+
# If we're doing a release build, remove the examples and tests
75+
rm -rf examples tests
76+
mkdir examples
77+
mkdir tests
78+
touch examples/CMakeLists.txt
79+
touch tests/CMakeLists.txt
9480
fi
81+
mkdir -p build
82+
cd build
83+
eval "cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DDISABLE_SSL=1 .."
84+
eval "make -j$CPUS static_lib"
9585

9686
echo -e "${green}Copying nuraft to /usr/local"
9787
$SUDO cp libnuraft.a /usr/local/lib
9888
$SUDO cp -r ../include/libnuraft /usr/local/include
9989

100-
cd ..
90+
cd ../..
10191

10292
PYTHON_TIDY=/usr/local/bin/run-clang-tidy.py
10393
if [ ! -f "${PYTHON_TIDY}" ]; then

0 commit comments

Comments
 (0)
Please sign in to comment.