forked from taco-project/FlexKV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·78 lines (64 loc) · 2.04 KB
/
build.sh
File metadata and controls
executable file
·78 lines (64 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
set -e
PROJECT_ROOT=$(pwd)
BUILD_TYPE="debug" # Default to debug build
# Parse command line arguments
for arg in "$@"; do
case $arg in
--debug)
BUILD_TYPE="debug"
shift
;;
--release)
BUILD_TYPE="release"
shift
;;
*)
# Unknown option
;;
esac
done
echo "=== Building in ${BUILD_TYPE} mode ==="
# Install submodules
git submodule update --init --recursive
mkdir -p build
cd build
echo "=== Running CMake configuration ==="
# Respect FLEXKV_ENABLE_METRICS=0 to disable Prometheus (avoids needing third_party/prometheus-cpp)
CMAKE_EXTRA=""
if [ -n "$FLEXKV_ENABLE_METRICS" ] && [ "$FLEXKV_ENABLE_METRICS" = "0" ]; then
CMAKE_EXTRA="-DFLEXKV_ENABLE_MONITORING=OFF"
echo "FLEXKV_ENABLE_METRICS=0: building without Prometheus monitoring"
fi
cmake .. $CMAKE_EXTRA
echo "=== Building third-party libraries ==="
cmake --build .
BUILD_LIB_PATH=$(pwd)/lib
echo "=== Setting BUILD_LIB_PATH to $BUILD_LIB_PATH ==="
cd ..
# Set LD_LIBRARY_PATH for immediate use
export LD_LIBRARY_PATH=$BUILD_LIB_PATH:$LD_LIBRARY_PATH
echo "Added $BUILD_LIB_PATH to LD_LIBRARY_PATH for current session"
# Copy shared libraries to package directory for permanent access
echo "=== Copying shared libraries to package directory ==="
PACKAGE_LIB_DIR="flexkv/lib"
mkdir -p $PACKAGE_LIB_DIR
if [ -d "$BUILD_LIB_PATH" ]; then
for lib_file in $BUILD_LIB_PATH/*.so*; do
if [ -f "$lib_file" ]; then
cp "$lib_file" "$PACKAGE_LIB_DIR/"
echo "Copied $(basename $lib_file) to $PACKAGE_LIB_DIR/"
fi
done
else
echo "Warning: Build lib directory $BUILD_LIB_PATH not found"
fi
echo "=== Build and installation completed successfully in ${BUILD_TYPE} mode ==="
echo "You can now run tests directly without setting LD_LIBRARY_PATH manually"
if [ "$BUILD_TYPE" = "debug" ]; then
FLEXKV_DEBUG=1 pip install -v --no-build-isolation -e .
elif [ "$BUILD_TYPE" = "release" ]; then
FLEXKV_DEBUG=0 python3 setup.py bdist_wheel -v
else
FLEXKV_DEBUG=0 pip install -v --no-build-isolation -e .
fi