mirror of
https://github.com/google/leveldb.git
synced 2024-12-12 21:08:59 +08:00
299ccedfec
- Added DB::CompactRange() method. Changed manual compaction code so it breaks up compactions of big ranges into smaller compactions. Changed the code that pushes the output of memtable compactions to higher levels to obey the grandparent constraint: i.e., we must never have a single file in level L that overlaps too much data in level L+1 (to avoid very expensive L-1 compactions). Added code to pretty-print internal keys. - Fixed bug where we would not detect overlap with files in level-0 because we were incorrectly using binary search on an array of files with overlapping ranges. Added "leveldb.sstables" property that can be used to dump all of the sstables and ranges that make up the db state. - Removing post_write_snapshot support. Email to leveldb mailing list brought up no users, just confusion from one person about what it meant. - Fixing static_cast char to unsigned on BIG_ENDIAN platforms. Fixes Issue 35 and Issue 36. - Comment clarification to address leveldb Issue 37. - Change license in posix_logger.h to match other files. - A build problem where uint32 was used instead of uint32_t. Sync with upstream @24408625
75 lines
2.2 KiB
Bash
75 lines
2.2 KiB
Bash
#!/bin/sh
|
|
|
|
# Detects OS we're compiling on and generates build_config.mk,
|
|
# which in turn gets read while processing Makefile.
|
|
|
|
# build_config.mk will set the following variables:
|
|
# - PORT_CFLAGS will either set:
|
|
# -DLEVELDB_PLATFORM_POSIX if cstatomic is present
|
|
# -DLEVELDB_PLATFORM_NOATOMIC if it is not
|
|
# - PLATFORM_CFLAGS with compiler flags for the platform
|
|
# - PLATFORM_LDFLAGS with linker flags for the platform
|
|
|
|
# Delete existing build_config.mk
|
|
rm -f build_config.mk
|
|
|
|
# Detect OS
|
|
case `uname -s` in
|
|
Darwin)
|
|
PLATFORM=OS_MACOSX
|
|
echo "PLATFORM_CFLAGS=-DOS_MACOSX" >> build_config.mk
|
|
echo "PLATFORM_LDFLAGS=" >> build_config.mk
|
|
;;
|
|
Linux)
|
|
PLATFORM=OS_LINUX
|
|
echo "PLATFORM_CFLAGS=-pthread -DOS_LINUX" >> build_config.mk
|
|
echo "PLATFORM_LDFLAGS=-lpthread" >> build_config.mk
|
|
;;
|
|
SunOS)
|
|
PLATFORM=OS_SOLARIS
|
|
echo "PLATFORM_CFLAGS=-D_REENTRANT -DOS_SOLARIS" >> build_config.mk
|
|
echo "PLATFORM_LDFLAGS=-lpthread -lrt" >> build_config.mk
|
|
;;
|
|
FreeBSD)
|
|
PLATFORM=OS_FREEBSD
|
|
echo "PLATFORM_CFLAGS=-D_REENTRANT -DOS_FREEBSD" >> build_config.mk
|
|
echo "PLATFORM_LDFLAGS=-lpthread" >> build_config.mk
|
|
;;
|
|
*)
|
|
echo "Unknown platform!"
|
|
exit 1
|
|
esac
|
|
|
|
echo "PLATFORM=$PLATFORM" >> build_config.mk
|
|
|
|
# On GCC, use libc's memcmp, not GCC's memcmp
|
|
PORT_CFLAGS="-fno-builtin-memcmp"
|
|
|
|
# Detect C++0x -- this determines whether we'll use port_noatomic.h
|
|
# or port_posix.h by:
|
|
# 1. Rrying to compile with -std=c++0x and including <cstdatomic>.
|
|
# 2. If g++ returns error code, we know to use port_posix.h
|
|
g++ $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
|
|
#include <cstdatomic>
|
|
int main() {}
|
|
EOF
|
|
if [ "$?" = 0 ]; then
|
|
PORT_CFLAGS="$PORT_CFLAGS -DLEVELDB_PLATFORM_POSIX -DLEVELDB_CSTDATOMIC_PRESENT -std=c++0x"
|
|
else
|
|
PORT_CFLAGS="$PORT_CFLAGS -DLEVELDB_PLATFORM_POSIX"
|
|
fi
|
|
|
|
# Test whether Snappy library is installed
|
|
# http://code.google.com/p/snappy/
|
|
g++ $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
|
|
#include <snappy.h>
|
|
int main() {}
|
|
EOF
|
|
if [ "$?" = 0 ]; then
|
|
echo "SNAPPY=1" >> build_config.mk
|
|
else
|
|
echo "SNAPPY=0" >> build_config.mk
|
|
fi
|
|
|
|
echo "PORT_CFLAGS=$PORT_CFLAGS" >> build_config.mk
|