Sunpoet Po-Chuan Hsieh 2012-06-16 20:21:57 +00:00
parent bbd044af5d
commit 541c36a3e9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=299425
5 changed files with 43 additions and 57 deletions

View file

@ -6,9 +6,9 @@
#
PORTNAME= leveldb
PORTVERSION= 1.2.20120315
PORTVERSION= 1.5.0
CATEGORIES= databases
MASTER_SITES= LOCAL/sunpoet
MASTER_SITES= GOOGLE_CODE
MAINTAINER= sunpoet@FreeBSD.org
COMMENT= A fast and lightweight key/value database library by Google
@ -16,11 +16,18 @@ COMMENT= A fast and lightweight key/value database library by Google
OPTIONS= PERFTOOLS "Build with Google perftools" off \
SNAPPY "Build with snappy" on
CFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
USE_GMAKE= yes
USE_LDCONFIG= yes
USE_XZ= yes
PLIST_SUB= SHLIB_MAJOR=${SHLIB_MAJOR} \
SHLIB_MINOR=${SHLIB_MINOR}
NOT_FOR_ARCHS= powerpc
NOT_FOR_ARCHS_REASON= not yet ported to this platform
SHLIB_MAJOR= ${PORTVERSION:R:R}
SHLIB_MINOR= ${PORTVERSION:R:E}
.include <bsd.port.options.mk>
@ -30,25 +37,31 @@ LIB_DEPENDS+= tcmalloc:${PORTSDIR}/devel/google-perftools
.if !defined(WITHOUT_SNAPPY)
LIB_DEPENDS+= snappy:${PORTSDIR}/archivers/snappy
SNAPPY= 1
.else
SNAPPY= 0
.endif
NOT_FOR_ARCHS= powerpc
NOT_FOR_ARCHS_REASON= not yet ported to this platform
post-patch:
@${REINPLACE_CMD} -e 's|-lpthread|${PTHREAD_LIBS}|' ${WRKSRC}/build_detect_platform
.if !defined(WITH_PERFTOOLS)
@${REINPLACE_CMD} -e '/^GOOGLE_PERFTOOLS_LDFLAGS=/ s|=.*|=|' ${WRKSRC}/Makefile
@${REINPLACE_CMD} -e 's| -ltcmalloc||' ${WRKSRC}/build_detect_platform
.endif
.if defined(WITHOUT_SNAPPY)
@${REINPLACE_CMD} -e '/^SNAPPY_LDFLAGS=/ s|=.*|=|' ${WRKSRC}/Makefile
@${REINPLACE_CMD} -e 's| -DSNAPPY||; s| -lsnappy||' ${WRKSRC}/build_detect_platform
.endif
do-install:
${MKDIR} ${PREFIX}/include/leveldb/ ${DATADIR}/
${INSTALL_DATA} ${WRKSRC}/include/leveldb/* ${PREFIX}/include/leveldb/
${INSTALL_LIB} ${WRKSRC}/libleveldb.* ${PREFIX}/lib/
${INSTALL_LIB} ${WRKSRC}/libleveldb.a ${PREFIX}/lib/
${INSTALL_LIB} ${WRKSRC}/libleveldb.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${PREFIX}/lib/
# backward compatibility
${ECHO} "SNAPPY=${SNAPPY}" >> ${WRKSRC}/build_config.mk
${GREP} '^PLATFORM_CXXFLAGS=' ${WRKSRC}/build_config.mk | ${SED} 's|PLATFORM_CXXFLAGS|PORT_CFLAGS|' >> ${WRKSRC}/build_config.mk
${GREP} '^PLATFORM_CXXFLAGS=' ${WRKSRC}/build_config.mk | ${SED} 's|PLATFORM_CXXFLAGS|PLATFORM_CFLAGS|' >> ${WRKSRC}/build_config.mk
${INSTALL_DATA} ${WRKSRC}/build_config.mk ${DATADIR}/
${LN} -s libleveldb.so.0 ${PREFIX}/lib/libleveldb.so
${LN} -s libleveldb.so.${SHLIB_MAJOR} ${PREFIX}/lib/libleveldb.so
${LN} -s libleveldb.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${PREFIX}/lib/libleveldb.so.${SHLIB_MAJOR}
.include <bsd.port.mk>

View file

@ -1,2 +1,2 @@
SHA256 (leveldb-1.2.20120315.tar.xz) = 2f2c3fbcb8616450dbf2938b7f2dc2b3040e420094f9b43708ed429c1e30f142
SIZE (leveldb-1.2.20120315.tar.xz) = 144688
SHA256 (leveldb-1.5.0.tar.gz) = cb73489af84d9d97d3e7d234a2f5e3a0c89ffadb657e7dd9e9047227778e57ba
SIZE (leveldb-1.5.0.tar.gz) = 199231

View file

@ -1,43 +0,0 @@
--- Makefile.orig 2011-12-07 20:27:41.000000000 +0800
+++ Makefile 2011-12-07 20:53:25.265313302 +0800
@@ -37,7 +37,7 @@
GOOGLE_PERFTOOLS_LDFLAGS=
endif
-CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
+CFLAGS += -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS) -fPIC
LDFLAGS += $(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
@@ -104,15 +104,18 @@
BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
LIBRARY = libleveldb.a
+SHARED_LIBRARY = libleveldb.so
+SHARED_LIBRARY_VER = 0
MEMENVLIBRARY = libmemenv.a
-all: $(LIBRARY)
+SHARED_LIBOBJECTS = $(LIBOBJECTS:.o=.so)
+all: $(LIBRARY) $(SHARED_LIBRARY)
check: $(PROGRAMS) $(TESTS)
for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
clean:
- -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
+ -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED_LIBRARY) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
-rm -rf ios-x86/* ios-arm/*
-rm build_config.mk
@@ -120,6 +123,10 @@
rm -f $@
$(AR) -rs $@ $(LIBOBJECTS)
+$(SHARED_LIBRARY): $(LIBOBJECTS)
+ rm -f $@
+ $(CXX) -shared -Wl,-soname,$@.$(SHARED_LIBRARY_VER) -o $@.$(SHARED_LIBRARY_VER) $(LDFLAGS) $(LIBOBJECTS)
+
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
$(CXX) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@

View file

@ -0,0 +1,14 @@
--- port/port_posix.h.orig 2012-05-31 00:56:59.000000000 +0800
+++ port/port_posix.h 2012-06-15 15:07:41.274868153 +0800
@@ -25,6 +25,11 @@
defined(OS_DRAGONFLYBSD) || defined(OS_ANDROID)
#include <sys/types.h>
#include <sys/endian.h>
+ #ifdef _LITTLE_ENDIAN
+ #define PLATFORM_IS_LITTLE_ENDIAN true
+ #else
+ #define PLATFORM_IS_LITTLE_ENDIAN false
+ #endif
#else
#include <endian.h>
#endif

View file

@ -3,6 +3,7 @@ include/leveldb/cache.h
include/leveldb/comparator.h
include/leveldb/db.h
include/leveldb/env.h
include/leveldb/filter_policy.h
include/leveldb/iterator.h
include/leveldb/options.h
include/leveldb/slice.h
@ -12,7 +13,8 @@ include/leveldb/table_builder.h
include/leveldb/write_batch.h
lib/libleveldb.a
lib/libleveldb.so
lib/libleveldb.so.0
lib/libleveldb.so.%%SHLIB_MAJOR%%
lib/libleveldb.so.%%SHLIB_MAJOR%%.%%SHLIB_MINOR%%
%%DATADIR%%/build_config.mk
@dirrm %%DATADIR%%
@dirrm include/leveldb