|
|
@ -2,56 +2,59 @@ from __future__ import absolute_import |
|
|
|
from __future__ import division |
|
|
|
from __future__ import division |
|
|
|
from __future__ import print_function |
|
|
|
from __future__ import print_function |
|
|
|
from __future__ import unicode_literals |
|
|
|
from __future__ import unicode_literals |
|
|
|
rocksdb_target_header = """ |
|
|
|
rocksdb_target_header = """import os |
|
|
|
import os |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TARGETS_PATH = os.path.dirname(__file__) |
|
|
|
TARGETS_PATH = os.path.dirname(__file__) |
|
|
|
REPO_PATH = "rocksdb/src/" |
|
|
|
|
|
|
|
|
|
|
|
REPO_PATH = TARGETS_PATH[(TARGETS_PATH.find('fbcode/') + len('fbcode/')):] + "/" |
|
|
|
|
|
|
|
|
|
|
|
BUCK_BINS = "buck-out/gen/" + REPO_PATH |
|
|
|
BUCK_BINS = "buck-out/gen/" + REPO_PATH |
|
|
|
|
|
|
|
|
|
|
|
TEST_RUNNER = REPO_PATH + "buckifier/rocks_test_runner.sh" |
|
|
|
TEST_RUNNER = REPO_PATH + "buckifier/rocks_test_runner.sh" |
|
|
|
|
|
|
|
|
|
|
|
rocksdb_compiler_flags = [ |
|
|
|
rocksdb_compiler_flags = [ |
|
|
|
"-fno-builtin-memcmp", |
|
|
|
"-fno-builtin-memcmp", |
|
|
|
"-DROCKSDB_PLATFORM_POSIX", |
|
|
|
"-DROCKSDB_PLATFORM_POSIX", |
|
|
|
"-DROCKSDB_LIB_IO_POSIX", |
|
|
|
"-DROCKSDB_LIB_IO_POSIX", |
|
|
|
"-DROCKSDB_FALLOCATE_PRESENT", |
|
|
|
"-DROCKSDB_FALLOCATE_PRESENT", |
|
|
|
"-DROCKSDB_MALLOC_USABLE_SIZE", |
|
|
|
"-DROCKSDB_MALLOC_USABLE_SIZE", |
|
|
|
"-DROCKSDB_RANGESYNC_PRESENT", |
|
|
|
"-DROCKSDB_RANGESYNC_PRESENT", |
|
|
|
"-DROCKSDB_SCHED_GETCPU_PRESENT", |
|
|
|
"-DROCKSDB_SCHED_GETCPU_PRESENT", |
|
|
|
"-DROCKSDB_SUPPORT_THREAD_LOCAL", |
|
|
|
"-DROCKSDB_SUPPORT_THREAD_LOCAL", |
|
|
|
"-DOS_LINUX", |
|
|
|
"-DOS_LINUX", |
|
|
|
# Flags to enable libs we include |
|
|
|
# Flags to enable libs we include |
|
|
|
"-DSNAPPY", |
|
|
|
"-DSNAPPY", |
|
|
|
"-DZLIB", |
|
|
|
"-DZLIB", |
|
|
|
"-DBZIP2", |
|
|
|
"-DBZIP2", |
|
|
|
"-DLZ4", |
|
|
|
"-DLZ4", |
|
|
|
"-DZSTD", |
|
|
|
"-DZSTD", |
|
|
|
"-DGFLAGS=gflags", |
|
|
|
"-DGFLAGS=gflags", |
|
|
|
"-DNUMA", |
|
|
|
"-DNUMA", |
|
|
|
"-DTBB", |
|
|
|
"-DTBB", |
|
|
|
# Needed to compile in fbcode |
|
|
|
# Needed to compile in fbcode |
|
|
|
"-Wno-expansion-to-defined", |
|
|
|
"-Wno-expansion-to-defined", |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
rocksdb_external_deps = [ |
|
|
|
rocksdb_external_deps = [ |
|
|
|
('bzip2', None, 'bz2'), |
|
|
|
("bzip2", None, "bz2"), |
|
|
|
('snappy', None, "snappy"), |
|
|
|
("snappy", None, "snappy"), |
|
|
|
('zlib', None, 'z'), |
|
|
|
("zlib", None, "z"), |
|
|
|
('gflags', None, 'gflags'), |
|
|
|
("gflags", None, "gflags"), |
|
|
|
('lz4', None, 'lz4'), |
|
|
|
("lz4", None, "lz4"), |
|
|
|
('zstd', None), |
|
|
|
("zstd", None), |
|
|
|
('tbb', None), |
|
|
|
("tbb", None), |
|
|
|
("numa", None, "numa"), |
|
|
|
("numa", None, "numa"), |
|
|
|
("googletest", None, "gtest"), |
|
|
|
("googletest", None, "gtest"), |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
rocksdb_preprocessor_flags = [ |
|
|
|
rocksdb_preprocessor_flags = [ |
|
|
|
# Directories with files for #include |
|
|
|
# Directories with files for #include |
|
|
|
"-I" + REPO_PATH + "include/", |
|
|
|
"-I" + REPO_PATH + "include/", |
|
|
|
"-I" + REPO_PATH, |
|
|
|
"-I" + REPO_PATH, |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
rocksdb_arch_preprocessor_flags = { |
|
|
|
rocksdb_arch_preprocessor_flags = { |
|
|
|
"x86_64": ["-DHAVE_SSE42"], |
|
|
|
"x86_64": ["-DHAVE_SSE42"], |
|
|
|
} |
|
|
|
} |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
@ -59,32 +62,39 @@ rocksdb_arch_preprocessor_flags = { |
|
|
|
library_template = """ |
|
|
|
library_template = """ |
|
|
|
cpp_library( |
|
|
|
cpp_library( |
|
|
|
name = "%s", |
|
|
|
name = "%s", |
|
|
|
headers = %s, |
|
|
|
|
|
|
|
srcs = [%s], |
|
|
|
srcs = [%s], |
|
|
|
deps = [%s], |
|
|
|
headers = %s, |
|
|
|
preprocessor_flags = rocksdb_preprocessor_flags, |
|
|
|
|
|
|
|
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags, |
|
|
|
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags, |
|
|
|
compiler_flags = rocksdb_compiler_flags, |
|
|
|
compiler_flags = rocksdb_compiler_flags, |
|
|
|
|
|
|
|
preprocessor_flags = rocksdb_preprocessor_flags, |
|
|
|
|
|
|
|
deps = [%s], |
|
|
|
external_deps = rocksdb_external_deps, |
|
|
|
external_deps = rocksdb_external_deps, |
|
|
|
) |
|
|
|
) |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
binary_template = """ |
|
|
|
binary_template = """ |
|
|
|
cpp_binary( |
|
|
|
cpp_binary( |
|
|
|
name = "%s", |
|
|
|
name = "%s", |
|
|
|
srcs = [%s], |
|
|
|
srcs = [%s], |
|
|
|
deps = [%s], |
|
|
|
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags, |
|
|
|
preprocessor_flags = rocksdb_preprocessor_flags, |
|
|
|
compiler_flags = rocksdb_compiler_flags, |
|
|
|
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags, |
|
|
|
preprocessor_flags = rocksdb_preprocessor_flags, |
|
|
|
compiler_flags = rocksdb_compiler_flags, |
|
|
|
deps = [%s], |
|
|
|
external_deps = rocksdb_external_deps, |
|
|
|
external_deps = rocksdb_external_deps, |
|
|
|
) |
|
|
|
) |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_cfg_template = """ [ |
|
|
|
|
|
|
|
"%s", |
|
|
|
|
|
|
|
"%s", |
|
|
|
|
|
|
|
"%s", |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
unittests_template = """ |
|
|
|
unittests_template = """ |
|
|
|
# [test_name, test_src, test_type] |
|
|
|
# [test_name, test_src, test_type] |
|
|
|
ROCKS_TESTS = %s |
|
|
|
ROCKS_TESTS = [ |
|
|
|
|
|
|
|
%s] |
|
|
|
|
|
|
|
|
|
|
|
# Generate a test rule for each entry in ROCKS_TESTS |
|
|
|
# Generate a test rule for each entry in ROCKS_TESTS |
|
|
|
for test_cfg in ROCKS_TESTS: |
|
|
|
for test_cfg in ROCKS_TESTS: |
|
|
@ -112,13 +122,13 @@ for test_cfg in ROCKS_TESTS: |
|
|
|
|
|
|
|
|
|
|
|
custom_unittest( |
|
|
|
custom_unittest( |
|
|
|
name = "make_rocksdbjavastatic", |
|
|
|
name = "make_rocksdbjavastatic", |
|
|
|
type = "simple", |
|
|
|
|
|
|
|
command = ["internal_repo_rocksdb/make_rocksdbjavastatic.sh"], |
|
|
|
command = ["internal_repo_rocksdb/make_rocksdbjavastatic.sh"], |
|
|
|
|
|
|
|
type = "simple", |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
custom_unittest( |
|
|
|
custom_unittest( |
|
|
|
name = "make_rocksdb_lite_release", |
|
|
|
name = "make_rocksdb_lite_release", |
|
|
|
type = "simple", |
|
|
|
|
|
|
|
command = ["internal_repo_rocksdb/make_rocksdb_lite_release.sh"], |
|
|
|
command = ["internal_repo_rocksdb/make_rocksdb_lite_release.sh"], |
|
|
|
|
|
|
|
type = "simple", |
|
|
|
) |
|
|
|
) |
|
|
|
""" |
|
|
|
""" |
|
|
|