From patchwork Mon May 18 05:22:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1292326 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49QS7h5yNRz9sT8 for ; Mon, 18 May 2020 15:22:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CC97786581; Mon, 18 May 2020 05:22:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NGdLoB0YR63X; Mon, 18 May 2020 05:22:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 31ED487726; Mon, 18 May 2020 05:22:16 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 7F68C1BF3DE for ; Mon, 18 May 2020 05:22:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 768ED86581 for ; Mon, 18 May 2020 05:22:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SxYPtsXeWGZZ for ; Mon, 18 May 2020 05:22:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5E77A8763C for ; Mon, 18 May 2020 05:22:13 +0000 (UTC) X-Originating-IP: 86.210.146.109 Received: from localhost (lfbn-tou-1-915-109.w86-210.abo.wanadoo.fr [86.210.146.109]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id E06F52000C; Mon, 18 May 2020 05:22:09 +0000 (UTC) From: Thomas Petazzoni To: buildroot@buildroot.org Date: Mon, 18 May 2020 07:22:01 +0200 Message-Id: <20200518052203.1667697-1-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/2] package/leveldb: turn snappy into an optional dependency X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maksis33@gmail.com, Steve James , Thomas Petazzoni Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" snappy is not a mandatory dependency to build leveldb. Back when it was introduced in Buildroot, as of version 1.18, the build logic already made snappy an optional dependency. Signed-off-by: Thomas Petazzoni --- package/leveldb/Config.in | 1 - package/leveldb/leveldb.mk | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package/leveldb/Config.in b/package/leveldb/Config.in index c767b88645..c4279fcb64 100644 --- a/package/leveldb/Config.in +++ b/package/leveldb/Config.in @@ -3,7 +3,6 @@ config BR2_PACKAGE_LEVELDB depends on BR2_INSTALL_LIBSTDCPP depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11 depends on BR2_TOOLCHAIN_HAS_THREADS - select BR2_PACKAGE_SNAPPY help LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string diff --git a/package/leveldb/leveldb.mk b/package/leveldb/leveldb.mk index cf3c096f5d..684b618679 100644 --- a/package/leveldb/leveldb.mk +++ b/package/leveldb/leveldb.mk @@ -9,9 +9,12 @@ LEVELDB_SITE = $(call github,google,leveldb,$(LEVELDB_VERSION)) LEVELDB_LICENSE = BSD-3-Clause LEVELDB_LICENSE_FILES = LICENSE LEVELDB_INSTALL_STAGING = YES -LEVELDB_DEPENDENCIES = snappy LEVELDB_CONF_OPTS = \ -DLEVELDB_BUILD_BENCHMARKS=OFF \ -DLEVELDB_BUILD_TESTS=OFF +ifeq ($(BR2_PACKAGE_SNAPPY),y) +LEVELDB_DEPENDENCIES += snappy +endif + $(eval $(cmake-package)) From patchwork Mon May 18 05:22:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1292327 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49QS7j5GxCz9sTK for ; Mon, 18 May 2020 15:22:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id EACCB87A33; Mon, 18 May 2020 05:22:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3kIOjX0GaZZv; Mon, 18 May 2020 05:22:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 3291B87A60; Mon, 18 May 2020 05:22:19 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 6597B1BF3DE for ; Mon, 18 May 2020 05:22:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 627C08763C for ; Mon, 18 May 2020 05:22:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i372aZRaftrs for ; Mon, 18 May 2020 05:22:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by whitealder.osuosl.org (Postfix) with ESMTPS id E507E86581 for ; Mon, 18 May 2020 05:22:14 +0000 (UTC) X-Originating-IP: 86.210.146.109 Received: from localhost (lfbn-tou-1-915-109.w86-210.abo.wanadoo.fr [86.210.146.109]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 49993C0008; Mon, 18 May 2020 05:22:11 +0000 (UTC) From: Thomas Petazzoni To: buildroot@buildroot.org Date: Mon, 18 May 2020 07:22:02 +0200 Message-Id: <20200518052203.1667697-2-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518052203.1667697-1-thomas.petazzoni@bootlin.com> References: <20200518052203.1667697-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/2] package/leveldb: fix detection of the snappy library X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maksis33@gmail.com, Steve James , Thomas Petazzoni Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Pull a patch pending in an upstream pull request to fix the detection of the snappy library when we are in static linking configurations. Fixes: https://bugs.busybox.net/show_bug.cgi?id=12671 Signed-off-by: Thomas Petazzoni --- ...make-Use-find_package-to-find-Snappy.patch | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 package/leveldb/0004-cmake-Use-find_package-to-find-Snappy.patch diff --git a/package/leveldb/0004-cmake-Use-find_package-to-find-Snappy.patch b/package/leveldb/0004-cmake-Use-find_package-to-find-Snappy.patch new file mode 100644 index 0000000000..2626e88652 --- /dev/null +++ b/package/leveldb/0004-cmake-Use-find_package-to-find-Snappy.patch @@ -0,0 +1,98 @@ +From 450c1d88b3e1af34614294830b4dc0612d198d26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pawe=C5=82=20Bylica?= +Date: Wed, 8 May 2019 10:42:03 +0200 +Subject: [PATCH] cmake: Use find_package() to find Snappy + +Upstream: https://github.com/google/leveldb/pull/686/commits/3e73a396a082efc76e065ae974fe18c3bb27219d +[Thomas: this commit allows to fix the detection of the snappy library +in static link configurations] +Signed-off-by: Thomas Petazzoni +--- + CMakeLists.txt | 12 ++++++++---- + cmake/FindSnappy.cmake | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 39 insertions(+), 4 deletions(-) + create mode 100644 cmake/FindSnappy.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 78fead6..2efccda 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,6 +6,9 @@ cmake_minimum_required(VERSION 3.9) + # Keep the version below in sync with the one in db.h + project(leveldb VERSION 1.22.0 LANGUAGES C CXX) + ++# Include local CMake modules. ++list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) ++ + # This project can use C11, but will gracefully decay down to C89. + set(CMAKE_C_STANDARD 11) + set(CMAKE_C_STANDARD_REQUIRED OFF) +@@ -31,13 +34,14 @@ option(LEVELDB_INSTALL "Install LevelDB's header and library" ON) + include(TestBigEndian) + test_big_endian(LEVELDB_IS_BIG_ENDIAN) + ++find_package(Snappy) ++ + include(CheckIncludeFile) + check_include_file("unistd.h" HAVE_UNISTD_H) + + include(CheckLibraryExists) + check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_ATOMIC) + check_library_exists(crc32c crc32c_value "" HAVE_CRC32C) +-check_library_exists(snappy snappy_compress "" HAVE_SNAPPY) + check_library_exists(tcmalloc malloc "" HAVE_TCMALLOC) + + include(CheckCXXSymbolExists) +@@ -276,9 +280,9 @@ endif(HAVE_ATOMIC) + if(HAVE_CRC32C) + target_link_libraries(leveldb crc32c) + endif(HAVE_CRC32C) +-if(HAVE_SNAPPY) +- target_link_libraries(leveldb snappy) +-endif(HAVE_SNAPPY) ++if(TARGET Snappy::snappy) ++ target_link_libraries(leveldb Snappy::snappy) ++endif() + if(HAVE_TCMALLOC) + target_link_libraries(leveldb tcmalloc) + endif(HAVE_TCMALLOC) +diff --git a/cmake/FindSnappy.cmake b/cmake/FindSnappy.cmake +new file mode 100644 +index 0000000..88c1de9 +--- /dev/null ++++ b/cmake/FindSnappy.cmake +@@ -0,0 +1,31 @@ ++# Copyright 2019 The LevelDB Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. See the AUTHORS file for names of contributors. ++ ++find_library(SNAPPY_LIBRARY ++ NAMES snappy ++ HINTS ${SNAPPY_ROOT_DIR}/lib ++) ++ ++find_path(SNAPPY_INCLUDE_DIR ++ NAMES snappy.h ++ HINTS ${SNAPPY_ROOT_DIR}/include ++) ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args(Snappy DEFAULT_MSG SNAPPY_LIBRARY SNAPPY_INCLUDE_DIR) ++ ++mark_as_advanced(SNAPPY_LIBRARY SNAPPY_INCLUDE_DIR) ++ ++if(SNAPPY_FOUND) ++ set(HAVE_SNAPPY TRUE) # For compatibity with generating port_config.h. ++ ++ # Add imported targets. ++ # Follow the package naming convetion 'Snappy::' from ++ # https://github.com/google/snappy/blob/master/CMakeLists.txt#L211. ++ add_library(Snappy::snappy UNKNOWN IMPORTED) ++ set_target_properties(Snappy::snappy PROPERTIES ++ IMPORTED_LOCATION ${SNAPPY_LIBRARY} ++ INTERFACE_INCLUDE_DIRECTORIES ${SNAPPY_INCLUDE_DIR} ++ ) ++endif() +-- +2.26.2 +