Skip to content

Commit

Permalink
add registry for brpc
Browse files Browse the repository at this point in the history
  • Loading branch information
oathdruid committed Jun 21, 2024
1 parent 1c73ae4 commit a0e5cbb
Show file tree
Hide file tree
Showing 15 changed files with 597 additions and 0 deletions.
9 changes: 9 additions & 0 deletions registry/modules/leveldb/1.23/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module(
name = 'leveldb',
version = '1.23',
compatibility_level = 1,
)

bazel_dep(name = 'rules_foreign_cc', version = '0.8.0')
bazel_dep(name = 'crc32c', version = '1.1.0')
bazel_dep(name = 'snappy', version = '1.1.8')
62 changes: 62 additions & 0 deletions registry/modules/leveldb/1.23/patches/add-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..a91a213
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,41 @@
+package(
+ default_visibility = ['//:__pkg__'],
+)
+
+load('@rules_foreign_cc//foreign_cc:defs.bzl', 'cmake')
+
+filegroup(
+ name = 'all_srcs',
+ srcs = glob(['**'], exclude = ['bazel-*/**']),
+)
+
+SYMLINK2REAL_SCRIPT = """bash -c '
+set -ex
+shopt -s globstar
+for file in $INSTALLDIR/** ; do
+ if [ -L $file ]; then
+ target=`readlink -f $file`
+ echo $file $target
+ rm $file
+ cp $target $file
+ fi
+done
+'"""
+
+cmake(
+ name = 'leveldb',
+ lib_source = ':all_srcs',
+ cache_entries = {
+ 'LEVELDB_BUILD_TESTS': 'OFF',
+ 'LEVELDB_BUILD_BENCHMARKS': 'OFF',
+ 'CMAKE_CXX_FLAGS': '-I$$EXT_BUILD_DEPS$$/include',
+ 'CMAKE_EXE_LINKER_FLAGS': '-L$$EXT_BUILD_DEPS$$/lib',
+ },
+ postfix_script = SYMLINK2REAL_SCRIPT,
+ lib_name = 'libleveldb',
+ visibility = ['//visibility:public'],
+ deps = [
+ '@crc32c',
+ '@snappy',
+ ],
+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8285b8..1bf7b99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,8 +38,9 @@ include(CheckIncludeFile)
check_include_file("unistd.h" HAVE_UNISTD_H)

include(CheckLibraryExists)
+include(CheckIncludeFileCXX)
check_library_exists(crc32c crc32c_value "" HAVE_CRC32C)
-check_library_exists(snappy snappy_compress "" HAVE_SNAPPY)
+check_include_file_cxx("snappy.h" HAVE_SNAPPY)
check_library_exists(tcmalloc malloc "" HAVE_TCMALLOC)

include(CheckCXXSymbolExists)
9 changes: 9 additions & 0 deletions registry/modules/leveldb/1.23/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"url": "https://github.com/google/leveldb/archive/refs/tags/1.23.tar.gz",
"strip_prefix": "leveldb-1.23",
"integrity": "sha256-mjf4phdPCb1iK8cjtViB3FQc1QdHy9CIMcKoLWIPbXY=",
"patch_strip": 1,
"patches": {
"add-build.patch": "sha256-gwN67RMJVwmzg1C3gOI+kJqFCrWpi2bAgxsSXin1MpI="
}
}
8 changes: 8 additions & 0 deletions registry/modules/libevent/2.1.12/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module(
name = 'libevent',
version = '2.1.12',
compatibility_level = 1,
)

bazel_dep(name = 'rules_foreign_cc', version = '0.8.0')
bazel_dep(name = 'openssl', version = '3.3.1')
67 changes: 67 additions & 0 deletions registry/modules/libevent/2.1.12/patches/add-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
diff --git a/BUILD b/BUILD
new file mode 100644
index 00000000..40efde99
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,48 @@
+package(
+ default_visibility = ['//:__pkg__'],
+)
+
+load('@rules_foreign_cc//foreign_cc:defs.bzl', 'cmake')
+
+filegroup(
+ name = 'all_srcs',
+ srcs = glob(['**'], exclude = ['bazel-*/**']),
+)
+
+SYMLINK2REAL_SCRIPT = """bash -c '
+set -ex
+shopt -s globstar
+for file in $INSTALLDIR/** ; do
+ if [ -L $file ]; then
+ target=`readlink -f $file`
+ echo $file $target
+ rm $file
+ cp $target $file
+ fi
+done
+'"""
+
+cmake(
+ name = 'event',
+ lib_source = ':all_srcs',
+ cache_entries = {
+ 'EVENT__DISABLE_BENCHMARK': 'ON',
+ 'EVENT__DISABLE_TESTS': 'ON',
+ 'EVENT__DISABLE_SAMPLES': 'ON',
+ 'EVENT__LIBRARY_TYPE': 'STATIC',
+ 'OPENSSL_ROOT_DIR': '$$EXT_BUILD_DEPS$$/openssl',
+ },
+ postfix_script = SYMLINK2REAL_SCRIPT,
+ out_static_libs = [
+ 'libevent.a',
+ 'libevent_core.a',
+ 'libevent_extra.a',
+ 'libevent_openssl.a',
+ 'libevent_pthreads.a',
+ ],
+ visibility = ['//visibility:public'],
+ deps = [
+ '@openssl//:crypto',
+ '@openssl//:ssl',
+ ],
+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 676727f1..ef5645d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -955,7 +955,7 @@ add_event_library(event_extra
if (NOT EVENT__DISABLE_OPENSSL)
add_event_library(event_openssl
INNER_LIBRARIES event_core
- OUTER_INCLUDES ${OPENSSL_INCLUDE_DIR}
+ OUTER_INCLUDES $<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>
LIBRARIES ${OPENSSL_LIBRARIES}
SOURCES ${SRC_OPENSSL})
endif()
9 changes: 9 additions & 0 deletions registry/modules/libevent/2.1.12/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"url": "https://github.com/libevent/libevent/archive/refs/tags/release-2.1.12-stable.tar.gz",
"strip_prefix": "libevent-release-2.1.12-stable",
"integrity": "sha256-cYCpeaqnAA4SZNpIT3EtQD/Pdnmx6SEsTj0J9ck+/CQ=",
"patch_strip": 1,
"patches": {
"add-build.patch": "sha256-b1y8kMCSqA8kCHXbyTCsQS976Xr7IgicI8GVomCattw="
}
}
8 changes: 8 additions & 0 deletions registry/modules/openssl/3.3.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module(
name = 'openssl',
version = '3.3.1',
compatibility_level = 1,
)

bazel_dep(name = 'rules_foreign_cc', version = '0.8.0')
bazel_dep(name = 'zlib', version = '1.2.13')
Loading

0 comments on commit a0e5cbb

Please sign in to comment.