summaryrefslogtreecommitdiff
path: root/databases/leveldb/Makefile
blob: 6716903c0facbb74979c57f7ce388c4014f26507 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Created by: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
# $FreeBSD$

PORTNAME=	leveldb
PORTVERSION=	1.22
CATEGORIES=	databases

MAINTAINER=	sunpoet@FreeBSD.org
COMMENT=	Fast and lightweight key/value database library by Google

LICENSE=	BSD3CLAUSE

OPTIONS_DEFINE=	GPERFTOOLS SNAPPY
OPTIONS_DEFAULT=SNAPPY

USES=		cmake compiler:c++11-lang localbase

CMAKE_OFF=	LEVELDB_BUILD_TESTS
CMAKE_ON=	BUILD_SHARED_LIBS LEVELDB_BUILD_BENCHMARKS LEVELDB_INSTALL
USE_CXXSTD=	c++11
USE_LDCONFIG=	yes

PLIST_SUB=	SHLIB_MAJOR=${SHLIB_MAJOR} \
		SHLIB_MINOR=${SHLIB_MINOR}

SHLIB_MAJOR=	${PORTVERSION:R}
SHLIB_MINOR=	${PORTVERSION:E}

GH_ACCOUNT=	google
USE_GITHUB=	yes

GPERFTOOLS_LIB_DEPENDS=	libtcmalloc.so:devel/google-perftools
SNAPPY_LIB_DEPENDS=	libsnappy.so:archivers/snappy
SNAPPY_VARS=		SNAPPY=1 SNAPPY_CFLAGS=-DSNAPPY
SNAPPY_VARS_OFF=	SNAPPY=0 SNAPPY_CFLAGS=

post-patch:
	@${REINPLACE_CMD} -e 's|%%SHLIB_MAJOR%%|${SHLIB_MAJOR}|; s|%%SHLIB_MINOR%%|${SHLIB_MINOR}|' ${WRKSRC}/CMakeLists.txt

post-install:
	${AR} cq ${STAGEDIR}${PREFIX}/lib/libleveldb.a ${BUILD_WRKSRC}/CMakeFiles/leveldb.dir/*/*.o
# backward compatibility (for databases/p5-Tie-LevelDB)
	${MKDIR} ${STAGEDIR}${DATADIR}/
	${ECHO_CMD} "PLATFORM_CFLAGS=-std=c++11 -D_REENTRANT -DOS_FREEBSD -DLEVELDB_PLATFORM_POSIX ${SNAPPY_CFLAGS}" > ${STAGEDIR}${DATADIR}/build_config.mk
	${ECHO_CMD} "PORT_CFLAGS=-std=c++11 -D_REENTRANT -DOS_FREEBSD -DLEVELDB_PLATFORM_POSIX ${SNAPPY_CFLAGS}" >> ${STAGEDIR}${DATADIR}/build_config.mk
	${ECHO_CMD} "SNAPPY=${SNAPPY}" >> ${STAGEDIR}${DATADIR}/build_config.mk

.include <bsd.port.mk>