forked from mirror/ledisdb
update build
This commit is contained in:
parent
98b8b5bdf1
commit
539b5df181
15
Makefile
15
Makefile
|
@ -1,5 +1,18 @@
|
|||
INSTALL_PATH ?= $(CURDIR)
|
||||
|
||||
$(shell ./bootstrap.sh)
|
||||
|
||||
$(shell ./build_tool/build_config.sh build_config.mk $INSTALL_PATH)
|
||||
|
||||
include build_config.mk
|
||||
|
||||
export CGO_CFLAGS
|
||||
export CGO_CXXFLAGS
|
||||
export CGO_LDFLAGS
|
||||
export LD_LIBRARY_PATH
|
||||
export DYLD_LIBRARY_PATH
|
||||
export GO_BUILD_TAGS
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
|
@ -9,4 +22,4 @@ clean:
|
|||
go clean -i ./...
|
||||
|
||||
test:
|
||||
go test -tags $(GO_BUILD_TAGS) ./...
|
||||
go test -tags '$(GO_BUILD_TAGS)' ./...
|
||||
|
|
13
README.md
13
README.md
|
@ -26,7 +26,8 @@ Create a workspace and checkout ledisdb source
|
|||
|
||||
cd src/github.com/siddontang/ledisdb
|
||||
|
||||
source dev.sh && make
|
||||
make
|
||||
make test
|
||||
|
||||
## LevelDB support
|
||||
|
||||
|
@ -34,7 +35,7 @@ Create a workspace and checkout ledisdb source
|
|||
|
||||
LedisDB supplies a simple script to install leveldb and snappy:
|
||||
|
||||
sh build_leveldb.sh
|
||||
sh build_tool/build_leveldb.sh
|
||||
|
||||
It will default install leveldb at /usr/local/leveldb and snappy at /usr/local/snappy.
|
||||
|
||||
|
@ -42,17 +43,17 @@ Create a workspace and checkout ledisdb source
|
|||
|
||||
+ Set LEVELDB_DIR and SNAPPY_DIR to the actual install path in dev.sh.
|
||||
|
||||
+ ```source dev.sh && make```
|
||||
+ ```make```
|
||||
|
||||
## RocksDB support
|
||||
|
||||
+ Install rocksdb and snappy first.
|
||||
+ Install rocksdb(shared_lib) and snappy first.
|
||||
|
||||
LedisDB has not supplied a simple script to install, maybe it will later.
|
||||
LedisDB has not supplied a simple script to install, maybe later.
|
||||
|
||||
+ Set ROCKSDB_DIR and SNAPPY_DIR to the actual install path in dev.sh.
|
||||
|
||||
+ ```source dev.sh && make```
|
||||
+ ```make```
|
||||
|
||||
## Choose store database
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
OUTPUT=$1
|
||||
PREFIX=$2
|
||||
if test -z "$OUTPUT" || test -z "$PREFIX"; then
|
||||
echo "usage: $0 <output-filename> <directory_prefix>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete existing output, if it exists
|
||||
rm -f $OUTPUT
|
||||
touch $OUTPUT
|
||||
|
||||
source ./dev.sh
|
||||
|
||||
echo "CGO_CFLAGS=$CGO_CFLAGS" >> $OUTPUT
|
||||
echo "CGO_CXXFLAGS=$CGO_CXXFLAGS" >> $OUTPUT
|
||||
echo "CGO_LDFLAGS=$CGO_LDFLAGS" >> $OUTPUT
|
||||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $OUTPUT
|
||||
echo "DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $OUTPUT
|
||||
echo "GO_BUILD_TAGS=$GO_BUILD_TAGS" >> $OUTPUT
|
8
dev.sh
8
dev.sh
|
@ -32,8 +32,10 @@ CGO_CFLAGS=
|
|||
CGO_CXXFLAGS=
|
||||
CGO_LDFLAGS=
|
||||
|
||||
# check dependent libray, now we only check simply, maybe later add proper checking way.
|
||||
|
||||
# check snappy
|
||||
if [ -f $SNAPPY_DIR/lib/libsnappy.a ]; then
|
||||
if [ -f $LEVELDB_DIR/include/snappy.h ]; then
|
||||
CGO_CFLAGS="$CGO_CFLAGS -I$SNAPPY_DIR/include"
|
||||
CGO_CXXFLAGS="$CGO_CXXFLAGS -I$SNAPPY_DIR/include"
|
||||
CGO_LDFLAGS="$CGO_LDFLAGS -L$SNAPPY_DIR/lib -lsnappy"
|
||||
|
@ -42,7 +44,7 @@ if [ -f $SNAPPY_DIR/lib/libsnappy.a ]; then
|
|||
fi
|
||||
|
||||
# check leveldb
|
||||
if [ -f $LEVELDB_DIR/lib/libleveldb.a ]; then
|
||||
if [ -f $LEVELDB_DIR/include/leveldb/c.h ]; then
|
||||
CGO_CFLAGS="$CGO_CFLAGS -I$LEVELDB_DIR/include"
|
||||
CGO_CXXFLAGS="$CGO_CXXFLAGS -I$LEVELDB_DIR/include"
|
||||
CGO_LDFLAGS="$CGO_LDFLAGS -L$LEVELDB_DIR/lib -lleveldb"
|
||||
|
@ -52,7 +54,7 @@ if [ -f $LEVELDB_DIR/lib/libleveldb.a ]; then
|
|||
fi
|
||||
|
||||
# check rocksdb
|
||||
if [ -f $ROCKSDB_DIR/lib/librocksdb.a ]; then
|
||||
if [ -f $ROCKSDB_DIR/include/rocksdb/c.h ]; then
|
||||
CGO_CFLAGS="$CGO_CFLAGS -I$ROCKSDB_DIR/include"
|
||||
CGO_CXXFLAGS="$CGO_CXXFLAGS -I$ROCKSDB_DIR/include"
|
||||
CGO_LDFLAGS="$CGO_LDFLAGS -L$ROCKSDB_DIR/lib -lrocksdb"
|
||||
|
|
Loading…
Reference in New Issue