1+ #! /bin/bash
2+
3+ # Color definitions
4+ GREEN=" \033[0;32m"
5+ BLUE=" \033[0;34m"
6+ YELLOW=" \033[0;33m"
7+ RED=" \033[0;31m"
8+ NC=" \033[0m" # No Color
9+
10+ # Configuration
11+ REPO_ROOT=` pwd`
12+
13+ # Function to print section headers
14+ print_section () {
15+ echo -e " \n${BLUE} === $1 ===${NC} "
16+ }
17+
18+ # Function to print success messages
19+ print_success () {
20+ echo -e " ${GREEN} ✓ $1 ${NC} "
21+ }
22+
23+ # Function to print error messages and exit
24+ print_error () {
25+ echo -e " ${RED} ✗ ERROR: $1 ${NC} "
26+ exit 1
27+ }
28+
29+ # Function to check command success
30+ check_success () {
31+ if [ $? -ne 0 ]; then
32+ print_error " $1 "
33+ fi
34+ }
35+
36+ if [ $( id -u) -ne 0 ]; then
37+ print_error " Require root permission, try sudo ./dependencies.sh"
38+ fi
39+
40+
41+ # Install yalantinglibs
42+ print_section " Installing yalantinglibs"
43+
44+ # Check if thirdparties directory exists
45+ if [ ! -d " ${REPO_ROOT} /third_party/Mooncake/thirdparties" ]; then
46+ mkdir -p " ${REPO_ROOT} /third_party/Mooncake/thirdparties"
47+ check_success " Failed to create Mooncake/thirdparties directory"
48+ fi
49+
50+ # Change to thirdparties directory
51+ cd " ${REPO_ROOT} /third_party/Mooncake/thirdparties"
52+ check_success " Failed to change to Mooncake/thirdparties directory"
53+
54+ # Check if yalantinglibs is already installed
55+ if [ -d " yalantinglibs" ]; then
56+ echo -e " ${YELLOW} yalantinglibs directory already exists. Removing for fresh install...${NC} "
57+ rm -rf yalantinglibs
58+ check_success " Failed to remove existing yalantinglibs directory"
59+ fi
60+
61+ # Clone yalantinglibs
62+ echo " Cloning yalantinglibs from https://gitcode.com/gh_mirrors/ya/yalantinglibs.git"
63+ git clone https://gitcode.com/gh_mirrors/ya/yalantinglibs.git
64+ check_success " Failed to clone yalantinglibs"
65+
66+ # Build and install yalantinglibs
67+ cd yalantinglibs
68+ check_success " Failed to change to yalantinglibs directory"
69+
70+ # Checkout version 0.5.5
71+ echo " Checking out yalantinglibs version 0.5.5..."
72+ git checkout 0.5.5
73+ check_success " Failed to checkout yalantinglibs version 0.5.5"
74+
75+ mkdir -p build
76+ check_success " Failed to create build directory"
77+
78+ cd build
79+ check_success " Failed to change to build directory"
80+
81+ echo " Configuring yalantinglibs..."
82+ cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_BENCHMARK=OFF -DBUILD_UNIT_TESTS=OFF
83+ check_success " Failed to configure yalantinglibs"
84+
85+ echo " Building yalantinglibs (using $( nproc) cores)..."
86+ cmake --build . -j$( nproc)
87+ check_success " Failed to build yalantinglibs"
88+
89+ echo " Installing yalantinglibs..."
90+ cmake --install .
91+ check_success " Failed to install yalantinglibs"
92+
93+ sed -i ' 54s/target_link_libraries(${ylt_target_name} -libverbs)/target_link_libraries(${ylt_target_name} INTERFACE -libverbs)/' /usr/local/lib/cmake/yalantinglibs/config.cmake
94+
95+ print_success " yalantinglibs installed successfully"
0 commit comments