From patchwork Thu Oct 22 03:51:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Pruitt X-Patchwork-Id: 534185 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id E9B67141318 for ; Thu, 22 Oct 2015 14:51:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nbOixXeO; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3981AA39D8; Thu, 22 Oct 2015 03:51:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bQtkyjXC0Gqd; Thu, 22 Oct 2015 03:51:51 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 42C88A2FD1; Thu, 22 Oct 2015 03:51:51 +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 13CB31C1F19 for ; Thu, 22 Oct 2015 03:51:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0D86A8B562 for ; Thu, 22 Oct 2015 03:51:50 +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 R8-ccxi1qMtY for ; Thu, 22 Oct 2015 03:51:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by whitealder.osuosl.org (Postfix) with ESMTPS id 448F98B4F2 for ; Thu, 22 Oct 2015 03:51:49 +0000 (UTC) Received: by pabrc13 with SMTP id rc13so74210784pab.0 for ; Wed, 21 Oct 2015 20:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=X3XnSq9wxkPPgsaDwi7QQOSIl3WY7R8t1/rYNv8pHxE=; b=nbOixXeONQvLdvi1UuMMYotKaUAZm58Yip9/ceTTTvo6KR9IyUk/gFO/w9UfxScucd lwJ/xN/g2s85E5I0EVbnnFKukh34jy4ExBeG+qgdi4f9WcBwMb26ch4C/73CuNr3DwzY orR3WzGwABIBXiddmAm4Bsaku76bjCbCZbAlMaW9rlgTq5emoF33cY21zZXO8O5DG5xx wfd8v1kFUUmyOy7TLPqmISigBMJtvPgAmaep2oWookAUDc1cYmJhvVLaPzpe2X2gueB0 MDDxJTjO7vVXW1vk967ISlc0KvnVTb7PkwtJFLr2GVKExRfGiqVhee2eq/qvyKi2QW5x eNyg== X-Received: by 10.66.219.162 with SMTP id pp2mr14723452pac.59.1445485909009; Wed, 21 Oct 2015 20:51:49 -0700 (PDT) Received: from buildbox64.jasonpruitt.com (c-73-225-126-253.hsd1.wa.comcast.net. [73.225.126.253]) by smtp.gmail.com with ESMTPSA id qy7sm11749211pab.37.2015.10.21.20.51.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Oct 2015 20:51:48 -0700 (PDT) From: Jason Pruitt To: buildroot@busybox.net Date: Wed, 21 Oct 2015 20:51:42 -0700 Message-Id: <1445485902-1256-1-git-send-email-jrspruitt@gmail.com> X-Mailer: git-send-email 2.1.4 Subject: [Buildroot] [PATCH 1/1] hackrf-host: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds hackrf/host tools and lib for the HackRF SDR. Signed-off-by: Jason Pruitt --- package/Config.in | 1 + .../0001-make_hackrf-tools_optional.patch | 21 ++++++++ .../0002-disabled_shared_library_in_build.patch | 61 ++++++++++++++++++++++ package/hackrf-host/Config.in | 33 ++++++++++++ package/hackrf-host/hackrf-host.mk | 27 ++++++++++ 5 files changed, 143 insertions(+) create mode 100644 package/hackrf-host/0001-make_hackrf-tools_optional.patch create mode 100644 package/hackrf-host/0002-disabled_shared_library_in_build.patch create mode 100644 package/hackrf-host/Config.in create mode 100644 package/hackrf-host/hackrf-host.mk diff --git a/package/Config.in b/package/Config.in index 9994bcd..2e264e4 100644 --- a/package/Config.in +++ b/package/Config.in @@ -862,6 +862,7 @@ menu "Hardware handling" source "package/ccid/Config.in" source "package/dtc/Config.in" source "package/gnu-efi/Config.in" + source "package/hackrf-host/Config.in" source "package/lcdapi/Config.in" source "package/libaio/Config.in" source "package/libatasmart/Config.in" diff --git a/package/hackrf-host/0001-make_hackrf-tools_optional.patch b/package/hackrf-host/0001-make_hackrf-tools_optional.patch new file mode 100644 index 0000000..85e199f --- /dev/null +++ b/package/hackrf-host/0001-make_hackrf-tools_optional.patch @@ -0,0 +1,21 @@ +hackrf-host: Make hackrf-tools optional. + +Enables hackrf-tools to be a compile time option for build. + +signed-off-by Jason Pruitt +--- +diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt +index 874163f..b14896e 100644 +--- a/host/CMakeLists.txt ++++ b/host/CMakeLists.txt +@@ -4,7 +4,10 @@ cmake_minimum_required(VERSION 2.8) + project (hackrf_all) + + add_subdirectory(libhackrf) ++ ++if(BR2_PACKAGE_HACKRF_TOOLS) + add_subdirectory(hackrf-tools) ++endif() + + ######################################################################## + # Create uninstall target diff --git a/package/hackrf-host/0002-disabled_shared_library_in_build.patch b/package/hackrf-host/0002-disabled_shared_library_in_build.patch new file mode 100644 index 0000000..d9e1b38 --- /dev/null +++ b/package/hackrf-host/0002-disabled_shared_library_in_build.patch @@ -0,0 +1,61 @@ +hackrf-host: disable shared library target in build for libhackrf + +Disable libhackrf shared library target if BUILD_SHARED_LIBS if OFF. + +signed-off-by Jason Pruitt +--- +diff --git a/host/libhackrf/src/CMakeLists.txt b/host/libhackrf/src/CMakeLists.txt +index 9d54a8c..13d6906 100644 +--- a/host/libhackrf/src/CMakeLists.txt ++++ b/host/libhackrf/src/CMakeLists.txt +@@ -27,8 +27,10 @@ set(c_sources ${CMAKE_CURRENT_SOURCE_DIR}/hackrf.c CACHE INTERNAL "List of C sou + set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/hackrf.h CACHE INTERNAL "List of C headers") + + # Dynamic library +-add_library(hackrf SHARED ${c_sources}) +-set_target_properties(hackrf PROPERTIES VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.0 SOVERSION 0) ++if(BUILD_SHARED_LIBS) ++ add_library(hackrf SHARED ${c_sources}) ++ set_target_properties(hackrf PROPERTIES VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.0 SOVERSION 0) ++endif() + + # Static library + add_library(hackrf-static STATIC ${c_sources}) +@@ -38,12 +40,17 @@ else() + set_target_properties(hackrf-static PROPERTIES OUTPUT_NAME "hackrf") + endif() + +-set_target_properties(hackrf PROPERTIES CLEAN_DIRECT_OUTPUT 1) ++if(BUILD_SHARED_LIBS) ++ set_target_properties(hackrf PROPERTIES CLEAN_DIRECT_OUTPUT 1) ++endif() + set_target_properties(hackrf-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) + ++ + # Dependencies +-target_link_libraries(hackrf ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +- ++if(BUILD_SHARED_LIBS) ++ target_link_libraries(hackrf ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) ++endif() ++ + # For cygwin just force UNIX OFF and WIN32 ON + if( ${CYGWIN} ) + SET(UNIX OFF) +@@ -51,10 +58,12 @@ if( ${CYGWIN} ) + endif( ${CYGWIN} ) + + if( ${UNIX} ) +- install(TARGETS hackrf +- LIBRARY DESTINATION lib${LIB_SUFFIX} +- COMPONENT sharedlibs +- ) ++ if(BUILD_SHARED_LIBS) ++ install(TARGETS hackrf ++ LIBRARY DESTINATION lib${LIB_SUFFIX} ++ COMPONENT sharedlibs ++ ) ++ endif() + install(TARGETS hackrf-static + ARCHIVE DESTINATION lib${LIB_SUFFIX} + COMPONENT staticlibs diff --git a/package/hackrf-host/Config.in b/package/hackrf-host/Config.in new file mode 100644 index 0000000..eabc4b2 --- /dev/null +++ b/package/hackrf-host/Config.in @@ -0,0 +1,33 @@ +comment "hackrf-host needs a toolchain w/ threads" + depends on !BR2_TOOLCHAIN_HAS_THREADS + +menuconfig BR2_PACKAGE_HACKRF_HOST + bool "hackrf-host" + depends on BR2_TOOLCHAIN_HAS_THREADS + help + Library and tools for accessing HackRF SDR boards. + + https://github.com/mossmann/hackrf/tree/master/host + +if BR2_PACKAGE_HACKRF_HOST + +config BR2_PACKAGE_LIBHACKRF + bool "libhackrf" + select BR2_PACKAGE_LIBUSB + help + Library for HackRF SDR boards. + +if BR2_PACKAGE_LIBHACKRF + +config BR2_PACKAGE_HACKRF_TOOLS + bool "hackrf-tools" + depends on !BR2_STATIC_LIBS && BR2_PACKAGE_HACKRF_HOST + help + Tools for accessing and updating HackRF SDR boards. + +comment "hackrf-tools needs a toolchain w/ dynamic libs" + depends on BR2_STATIC_LIBS + +endif + +endif diff --git a/package/hackrf-host/hackrf-host.mk b/package/hackrf-host/hackrf-host.mk new file mode 100644 index 0000000..1eb6424 --- /dev/null +++ b/package/hackrf-host/hackrf-host.mk @@ -0,0 +1,27 @@ +################################################################################ +# +# HACKRF_HOST +# +################################################################################ + +HACKRF_HOST_VERSION = v2015.07.2 +HACKRF_HOST_SITE = $(call github,mossmann,hackrf,$(HACKRF_HOST_VERSION)) +HACKRF_HOST_LICENSE = GPLv2 GPLv2+ BSD-3c +HACKRF_HOST_LICENSE_FILES = COPYING +HACKRF_HOST_DEPENDENCIES = libusb +HACKRF_HOST_SUBDIR = host +HACKRF_HOST_INSTALL_STAGING = YES + +ifeq ($(BR2_PACKAGE_HAS_UDEV),y) +HACKRF_HOST_CONF_OPTS += -DINSTALL_UDEV_RULES=ON +else +HACKRF_HOST_CONF_OPTS += -DINSTALL_UDEV_RULES=OFF +endif + +ifeq ($(BR2_PACKAGE_HACKRF_TOOLS),y) +HACKRF_HOST_CONF_OPTS += -DBUILD_HACKRF_TOOLS=ON +else +HACKRF_HOST_CONF_OPTS += -DBUILD_HACKRF_TOOLS=OFF +endif + +$(eval $(cmake-package))