################################################################################
#
# rocksdb
#
################################################################################

ROCKSDB_VERSION = 11.0.4
ROCKSDB_SITE = $(call github,facebook,rocksdb,v$(ROCKSDB_VERSION))
ROCKSDB_LICENSE = GPL-2.0 or Apache-2.0
ROCKSDB_LICENSE_FILES = COPYING LICENSE.Apache LICENSE.leveldb README.md
ROCKSDB_INSTALL_STAGING = YES
ROCKSDB_CONF_OPTS = \
	-DFAIL_ON_WARNINGS=OFF \
	-DPORTABLE=1 \
	-DWITH_TESTS=OFF

ifeq ($(BR2_PACKAGE_BZIP2),y)
ROCKSDB_DEPENDENCIES += bzip2
ROCKSDB_CONF_OPTS += -DWITH_BZ2=ON
else
ROCKSDB_CONF_OPTS += -DWITH_BZ2=OFF
endif

ifeq ($(BR2_PACKAGE_GFLAGS),y)
ROCKSDB_DEPENDENCIES += gflags
ROCKSDB_CONF_OPTS += -DWITH_GFLAGS=ON
else
ROCKSDB_CONF_OPTS += -DWITH_GFLAGS=OFF
endif

ifeq ($(BR2_PACKAGE_JEMALLOC),y)
ROCKSDB_DEPENDENCIES += jemalloc
ROCKSDB_CONF_OPTS += -DWITH_JEMALLOC=ON
else
ROCKSDB_CONF_OPTS += -DWITH_JEMALLOC=OFF
endif

ifeq ($(BR2_PACKAGE_LZ4),y)
ROCKSDB_DEPENDENCIES += lz4
ROCKSDB_CONF_OPTS += -DWITH_LZ4=ON
else
ROCKSDB_CONF_OPTS += -DWITH_LZ4=OFF
endif

ifeq ($(BR2_PACKAGE_SNAPPY),y)
ROCKSDB_DEPENDENCIES += snappy
ROCKSDB_CONF_OPTS += -DWITH_SNAPPY=ON
else
ROCKSDB_CONF_OPTS += -DWITH_SNAPPY=OFF
endif

ifeq ($(BR2_PACKAGE_ZLIB),y)
ROCKSDB_DEPENDENCIES += zlib
ROCKSDB_CONF_OPTS += -DWITH_ZLIB=ON
else
ROCKSDB_CONF_OPTS += -DWITH_ZLIB=OFF
endif

ifeq ($(BR2_PACKAGE_ZSTD),y)
ROCKSDB_DEPENDENCIES += zstd
ROCKSDB_CONF_OPTS += -DWITH_ZSTD=ON
else
ROCKSDB_CONF_OPTS += -DWITH_ZSTD=OFF
endif

$(eval $(cmake-package))
