Add Dockerfile and build script for source stack image creation

This commit is contained in:
Guofang committed 2026-09-21 09:58:46 +08:00
1 parent 1170f8f353
commit d00a3b9544
4 files changed
+184

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
FROM docker.io/library/rockylinux:9
RUN dnf install --assumeyes --enablerepo=crb \
autoconf \
automake \
bzip2 \
ca-certificates \
cmake \
curl-minimal \
gcc \
gcc-c++ \
gcc-toolset-15-gcc-c++ \
libasan \
git \
libtool \
make \
ninja-build \
patch \
perl-core \
pkgconf-pkg-config \
rpm-build \
tar \
xz \
which \
epel-release \
&& sed \
-e 's!^metalink=!#metalink=!g' \
-e 's!^#baseurl=!baseurl=!g' \
-e 's!https\?://download\.example/pub/epel!https://mirrors.ustc.edu.cn/epel!g' \
-i /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing.repo \
&& dnf install --assumeyes \
makeself \
&& dnf clean all \
&& rm -rf /var/cache/dnf
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
set -eu
IMAGE_NAME="${IMAGE_NAME:-test-source-stack}"
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
if ! command -v podman >/dev/null 2>&1; then
echo "Error: Podman is required." >&2
exit 1
fi
echo "Building image $IMAGE_NAME with podman ..."
exec podman build --network host --tag "$IMAGE_NAME" "$SCRIPT_DIR"
+77
View File
@@ -0,0 +1,77 @@
diff --git a/cachelib/CMakeLists.txt b/cachelib/CMakeLists.txt
index 9442838..2a22ba8 100644
--- a/cachelib/CMakeLists.txt
+++ b/cachelib/CMakeLists.txt
@@ -43,6 +43,8 @@ set(PACKAGE_BUGREPORT "https://github.com/facebook/TBD")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(BUILD_TESTS "If enabled, compile the tests." ON)
+option(BUILD_CACHELIB_INTERFACE
+ "Build the coroutine CacheComponent interface and cachebench." ON)
set(BIN_INSTALL_DIR bin CACHE STRING
@@ -316,11 +318,15 @@ add_subdirectory (common)
add_subdirectory (shm)
add_subdirectory (navy)
add_subdirectory (allocator)
-add_subdirectory (interface)
add_subdirectory (datatype)
add_subdirectory (compact_cache)
add_subdirectory (benchmarks)
-add_subdirectory (cachebench)
+if (BUILD_CACHELIB_INTERFACE)
+ add_subdirectory (interface)
+ add_subdirectory (cachebench)
+else ()
+ message(STATUS "Skipping cachelib_interface and cachebench")
+endif ()
# Install the source header files
install(
@@ -379,13 +385,18 @@ install(
)
add_library(cachelib INTERFACE)
-target_link_libraries(cachelib INTERFACE
+set(CACHELIB_LINK_LIBRARIES
cachelib_common
cachelib_shm
cachelib_navy
cachelib_allocator
- cachelib_interface
)
+if (BUILD_CACHELIB_INTERFACE)
+ list(APPEND CACHELIB_LINK_LIBRARIES cachelib_interface)
+endif ()
+target_link_libraries(cachelib INTERFACE
+ ${CACHELIB_LINK_LIBRARIES}
+ )
target_include_directories(
cachelib
INTERFACE
@@ -405,15 +416,20 @@ install(EXPORT cachelib-exports
DESTINATION ${CMAKE_INSTALL_DIR})
if (BUILD_SHARED_LIBS)
- set_target_properties(
+ set(CACHELIB_VERSIONED_TARGETS
cachelib_allocator
- cachelib_cachebench
cachelib_common
cachelib_datatype
- cachelib_interface
cachelib_navy
cachelib_shm
- PROPERTIES
+ )
+ if (BUILD_CACHELIB_INTERFACE)
+ list(APPEND CACHELIB_VERSIONED_TARGETS
+ cachelib_cachebench
+ cachelib_interface)
+ endif ()
+ set_target_properties(
+ ${CACHELIB_VERSIONED_TARGETS} PROPERTIES
SOVERSION ${CACHELIB_MAJOR_VERSION}
VERSION ${PACKAGE_VERSION}
)
+59
View File
@@ -0,0 +1,59 @@
diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake
--- a/cmake/AddEventLibrary.cmake 2026-09-17 14:40:01.091049579 +0800
+++ b/cmake/AddEventLibrary.cmake 2026-09-17 14:40:01.103049846 +0800
@@ -31,7 +31,7 @@
configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${LIB_NAME}.pc"
- DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig"
)
endmacro()
@@ -40,9 +40,9 @@
macro(export_install_target TYPE LIB_NAME OUTER_INCLUDES)
if("${LIB_NAME}" STREQUAL "event")
install(TARGETS "${LIB_NAME}_${TYPE}"
- LIBRARY DESTINATION "lib" COMPONENT lib
- ARCHIVE DESTINATION "lib" COMPONENT lib
- RUNTIME DESTINATION "lib" COMPONENT lib
+ LIBRARY DESTINATION "lib64" COMPONENT lib
+ ARCHIVE DESTINATION "lib64" COMPONENT lib
+ RUNTIME DESTINATION "lib64" COMPONENT lib
COMPONENT dev
)
else()
@@ -67,9 +67,9 @@
)
install(TARGETS "${LIB_NAME}_${TYPE}"
EXPORT LibeventTargets-${TYPE}
- LIBRARY DESTINATION "lib" COMPONENT lib
- ARCHIVE DESTINATION "lib" COMPONENT lib
- RUNTIME DESTINATION "lib" COMPONENT lib
+ LIBRARY DESTINATION "lib64" COMPONENT lib
+ ARCHIVE DESTINATION "lib64" COMPONENT lib
+ RUNTIME DESTINATION "lib64" COMPONENT lib
COMPONENT dev
)
endif()
@@ -181,7 +181,7 @@
if (NOT WIN32)
install(FILES
"$<TARGET_FILE_DIR:${LIB_NAME}_shared>/${LIB_LINK_NAME}"
- DESTINATION "lib"
+ DESTINATION "lib64"
COMPONENT lib)
endif()
endif()
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2026-09-17 14:40:01.091049579 +0800
+++ b/CMakeLists.txt 2026-09-17 14:40:01.103049846 +0800
@@ -1453,7 +1453,7 @@
#
set(EVENT_INSTALL_CMAKE_DIR
- "${CMAKE_INSTALL_PREFIX}/lib/cmake/libevent")
+ "${CMAKE_INSTALL_PREFIX}/lib64/cmake/libevent")
export(PACKAGE libevent)