From b0625f151f0bd0c0a605ee1e63fa0a82ef1caea2 Mon Sep 17 00:00:00 2001 From: ThatBen Date: Thu, 9 May 2024 14:58:31 +0200 Subject: [PATCH] updates build for new vendor folder --- build.sh | 30 +++++----- build/include/port/port_config.h | 5 ++ prelude.nim | 4 +- src/leveldb/raw.nim | 95 ++++++++++++++++---------------- 4 files changed, 71 insertions(+), 63 deletions(-) diff --git a/build.sh b/build.sh index 4278e35..f7c21f3 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,8 @@ #!/bin/bash root=$(dirname "$0") +sourceDir="${root}/src/vendor" +buildDir="${root}/build" output="${root}/src/leveldb/raw.nim" # install nimterop, if not already installed @@ -11,12 +13,12 @@ fi git submodule deinit -f "${root}" git submodule update --init --recursive --checkout "${root}" -cmake -S "${root}/sources" -B "${root}/build" +cmake -S "${sourceDir}" -B "${buildDir}" # Remove testing, benchmarking, third-party libraries. -rm -Rf "${root}/sources/third_party" -rm -Rf "${root}/sources/benchmarks" -rm "${root}/sources/util/testutil.cc" +rm -Rf "${sourceDir}/third_party" +rm -Rf "${sourceDir}/benchmarks" +rm "${sourceDir}/util/testutil.cc" # Prelude: cat "${root}/prelude.nim" > "${output}" @@ -25,7 +27,7 @@ echo >> "${output}" # assemble files to be compiled: extensions="c cc cpp" for ext in ${extensions}; do - for file in `find "${root}/sources" -type f -name "*.${ext}" \ + for file in `find "${sourceDir}" -type f -name "*.${ext}" \ | grep -v "_test" \ | grep -v "env_windows.cc" \ | grep -v "env_posix.cc" \ @@ -40,12 +42,14 @@ toast \ --pnim \ --preprocess \ --noHeader \ - --includeDirs="${root}/sources" \ - --includeDirs="${root}/sources/helpers" \ - --includeDirs="${root}/sources/helpers/memenv" \ - --includeDirs="${root}/sources/port" \ - --includeDirs="${root}/sources/include" \ - --includeDirs="${root}/build/include" \ - --includeDirs="${root}/build/include/port" \ - "${root}/sources/include/leveldb/c.h" >> "${output}" + --includeDirs="${sourceDir}" \ + --includeDirs="${sourceDir}/helpers" \ + --includeDirs="${sourceDir}/helpers/memenv" \ + --includeDirs="${sourceDir}/port" \ + --includeDirs="${sourceDir}/include" \ + --includeDirs="${buildDir}/include" \ + "${sourceDir}/include/leveldb/c.h" >> "${output}" + +# --includeDirs="${buildDir}/include/port" \ + diff --git a/build/include/port/port_config.h b/build/include/port/port_config.h index 5c12e38..0e80eda 100644 --- a/build/include/port/port_config.h +++ b/build/include/port/port_config.h @@ -30,4 +30,9 @@ #define HAVE_SNAPPY 0 #endif // !defined(HAVE_SNAPPY) +// Define to 1 if you have Zstd. +#if !defined(HAVE_Zstd) +#define HAVE_ZSTD 0 +#endif // !defined(HAVE_ZSTD) + #endif // STORAGE_LEVELDB_PORT_PORT_CONFIG_H_ diff --git a/prelude.nim b/prelude.nim index 8c3394a..21eb4a1 100644 --- a/prelude.nim +++ b/prelude.nim @@ -1,7 +1,7 @@ when defined(windows): - {.compile: "./sources/util/env_windows.cc".} + {.compile: "./src/vendor/util/env_windows.cc".} {.passc: "-DLEVELDB_PLATFORM_POSIX".} when defined(posix): - {.compile: "./sources/util/env_posix.cc".} + {.compile: "./src/vendor/util/env_posix.cc".} {.passc: "-DLEVELDB_PLATFORM_WINDOWS".} diff --git a/src/leveldb/raw.nim b/src/leveldb/raw.nim index 9b1b554..4a1d04b 100644 --- a/src/leveldb/raw.nim +++ b/src/leveldb/raw.nim @@ -1,14 +1,14 @@ when defined(windows): - {.compile: "./sources/util/env_windows.cc".} + {.compile: "./src/vendor/util/env_windows.cc".} {.passc: "-DLEVELDB_PLATFORM_POSIX".} when defined(posix): - {.compile: "./sources/util/env_posix.cc".} + {.compile: "./src/vendor/util/env_posix.cc".} {.passc: "-DLEVELDB_PLATFORM_WINDOWS".} -# Generated @ 2024-05-09T14:13:25+02:00 +# Generated @ 2024-05-09T14:57:19+02:00 # Command line: -# /home/ben/.nimble/pkgs/nimterop-0.6.13/nimterop/toast --compile=./sources/helpers/memenv/memenv.cc --compile=./sources/table/table.cc --compile=./sources/table/iterator.cc --compile=./sources/table/merger.cc --compile=./sources/table/block.cc --compile=./sources/table/table_builder.cc --compile=./sources/table/format.cc --compile=./sources/table/two_level_iterator.cc --compile=./sources/table/filter_block.cc --compile=./sources/table/block_builder.cc --compile=./sources/db/write_batch.cc --compile=./sources/db/version_edit.cc --compile=./sources/db/dbformat.cc --compile=./sources/db/builder.cc --compile=./sources/db/repair.cc --compile=./sources/db/db_impl.cc --compile=./sources/db/dumpfile.cc --compile=./sources/db/filename.cc --compile=./sources/db/log_reader.cc --compile=./sources/db/memtable.cc --compile=./sources/db/table_cache.cc --compile=./sources/db/c.cc --compile=./sources/db/log_writer.cc --compile=./sources/db/version_set.cc --compile=./sources/db/db_iter.cc --compile=./sources/util/hash.cc --compile=./sources/util/options.cc --compile=./sources/util/comparator.cc --compile=./sources/util/coding.cc --compile=./sources/util/histogram.cc --compile=./sources/util/logging.cc --compile=./sources/util/cache.cc --compile=./sources/util/env.cc --compile=./sources/util/filter_policy.cc --compile=./sources/util/arena.cc --compile=./sources/util/bloom.cc --compile=./sources/util/crc32c.cc --compile=./sources/util/status.cc --pnim --preprocess --noHeader --includeDirs=./sources --includeDirs=./sources/helpers --includeDirs=./sources/helpers/memenv --includeDirs=./sources/port --includeDirs=./sources/include --includeDirs=./build/include --includeDirs=./build/include/port ./sources/include/leveldb/c.h +# /home/ben/.nimble/pkgs/nimterop-0.6.13/nimterop/toast --compile=./src/vendor/helpers/memenv/memenv.cc --compile=./src/vendor/table/table.cc --compile=./src/vendor/table/iterator.cc --compile=./src/vendor/table/merger.cc --compile=./src/vendor/table/block.cc --compile=./src/vendor/table/table_builder.cc --compile=./src/vendor/table/format.cc --compile=./src/vendor/table/two_level_iterator.cc --compile=./src/vendor/table/filter_block.cc --compile=./src/vendor/table/block_builder.cc --compile=./src/vendor/db/write_batch.cc --compile=./src/vendor/db/version_edit.cc --compile=./src/vendor/db/dbformat.cc --compile=./src/vendor/db/builder.cc --compile=./src/vendor/db/repair.cc --compile=./src/vendor/db/db_impl.cc --compile=./src/vendor/db/dumpfile.cc --compile=./src/vendor/db/filename.cc --compile=./src/vendor/db/log_reader.cc --compile=./src/vendor/db/memtable.cc --compile=./src/vendor/db/table_cache.cc --compile=./src/vendor/db/c.cc --compile=./src/vendor/db/log_writer.cc --compile=./src/vendor/db/version_set.cc --compile=./src/vendor/db/db_iter.cc --compile=./src/vendor/util/hash.cc --compile=./src/vendor/util/options.cc --compile=./src/vendor/util/comparator.cc --compile=./src/vendor/util/coding.cc --compile=./src/vendor/util/histogram.cc --compile=./src/vendor/util/logging.cc --compile=./src/vendor/util/cache.cc --compile=./src/vendor/util/env.cc --compile=./src/vendor/util/filter_policy.cc --compile=./src/vendor/util/arena.cc --compile=./src/vendor/util/bloom.cc --compile=./src/vendor/util/crc32c.cc --compile=./src/vendor/util/status.cc --pnim --preprocess --noHeader --includeDirs=./src/vendor --includeDirs=./src/vendor/helpers --includeDirs=./src/vendor/helpers/memenv --includeDirs=./src/vendor/port --includeDirs=./src/vendor/include --includeDirs=./build/include ./src/vendor/include/leveldb/c.h {.push hint[ConvFromXtoItselfNotNeeded]: off.} import macros @@ -56,51 +56,50 @@ macro defineEnum(typ: untyped): untyped = {.experimental: "codeReordering".} -{.passC: "-I./sources".} -{.passC: "-I./sources/helpers".} -{.passC: "-I./sources/helpers/memenv".} -{.passC: "-I./sources/port".} -{.passC: "-I./sources/include".} +{.passC: "-I./src/vendor".} +{.passC: "-I./src/vendor/helpers".} +{.passC: "-I./src/vendor/helpers/memenv".} +{.passC: "-I./src/vendor/port".} +{.passC: "-I./src/vendor/include".} {.passC: "-I./build/include".} -{.passC: "-I./build/include/port".} -{.compile: "./sources/helpers/memenv/memenv.cc".} -{.compile: "./sources/table/table.cc".} -{.compile: "./sources/table/iterator.cc".} -{.compile: "./sources/table/merger.cc".} -{.compile: "./sources/table/block.cc".} -{.compile: "./sources/table/table_builder.cc".} -{.compile: "./sources/table/format.cc".} -{.compile: "./sources/table/two_level_iterator.cc".} -{.compile: "./sources/table/filter_block.cc".} -{.compile: "./sources/table/block_builder.cc".} -{.compile: "./sources/db/write_batch.cc".} -{.compile: "./sources/db/version_edit.cc".} -{.compile: "./sources/db/dbformat.cc".} -{.compile: "./sources/db/builder.cc".} -{.compile: "./sources/db/repair.cc".} -{.compile: "./sources/db/db_impl.cc".} -{.compile: "./sources/db/dumpfile.cc".} -{.compile: "./sources/db/filename.cc".} -{.compile: "./sources/db/log_reader.cc".} -{.compile: "./sources/db/memtable.cc".} -{.compile: "./sources/db/table_cache.cc".} -{.compile: "./sources/db/c.cc".} -{.compile: "./sources/db/log_writer.cc".} -{.compile: "./sources/db/version_set.cc".} -{.compile: "./sources/db/db_iter.cc".} -{.compile: "./sources/util/hash.cc".} -{.compile: "./sources/util/options.cc".} -{.compile: "./sources/util/comparator.cc".} -{.compile: "./sources/util/coding.cc".} -{.compile: "./sources/util/histogram.cc".} -{.compile: "./sources/util/logging.cc".} -{.compile: "./sources/util/cache.cc".} -{.compile: "./sources/util/env.cc".} -{.compile: "./sources/util/filter_policy.cc".} -{.compile: "./sources/util/arena.cc".} -{.compile: "./sources/util/bloom.cc".} -{.compile: "./sources/util/crc32c.cc".} -{.compile: "./sources/util/status.cc".} +{.compile: "./src/vendor/helpers/memenv/memenv.cc".} +{.compile: "./src/vendor/table/table.cc".} +{.compile: "./src/vendor/table/iterator.cc".} +{.compile: "./src/vendor/table/merger.cc".} +{.compile: "./src/vendor/table/block.cc".} +{.compile: "./src/vendor/table/table_builder.cc".} +{.compile: "./src/vendor/table/format.cc".} +{.compile: "./src/vendor/table/two_level_iterator.cc".} +{.compile: "./src/vendor/table/filter_block.cc".} +{.compile: "./src/vendor/table/block_builder.cc".} +{.compile: "./src/vendor/db/write_batch.cc".} +{.compile: "./src/vendor/db/version_edit.cc".} +{.compile: "./src/vendor/db/dbformat.cc".} +{.compile: "./src/vendor/db/builder.cc".} +{.compile: "./src/vendor/db/repair.cc".} +{.compile: "./src/vendor/db/db_impl.cc".} +{.compile: "./src/vendor/db/dumpfile.cc".} +{.compile: "./src/vendor/db/filename.cc".} +{.compile: "./src/vendor/db/log_reader.cc".} +{.compile: "./src/vendor/db/memtable.cc".} +{.compile: "./src/vendor/db/table_cache.cc".} +{.compile: "./src/vendor/db/c.cc".} +{.compile: "./src/vendor/db/log_writer.cc".} +{.compile: "./src/vendor/db/version_set.cc".} +{.compile: "./src/vendor/db/db_iter.cc".} +{.compile: "./src/vendor/util/hash.cc".} +{.compile: "./src/vendor/util/options.cc".} +{.compile: "./src/vendor/util/comparator.cc".} +{.compile: "./src/vendor/util/coding.cc".} +{.compile: "./src/vendor/util/histogram.cc".} +{.compile: "./src/vendor/util/logging.cc".} +{.compile: "./src/vendor/util/cache.cc".} +{.compile: "./src/vendor/util/env.cc".} +{.compile: "./src/vendor/util/filter_policy.cc".} +{.compile: "./src/vendor/util/arena.cc".} +{.compile: "./src/vendor/util/bloom.cc".} +{.compile: "./src/vendor/util/crc32c.cc".} +{.compile: "./src/vendor/util/status.cc".} defineEnum(Enum_ch1) const leveldb_no_compression* = (0).cint