Skip to contentSkip to conversation

Add package libhackrf

PATCH New Jason Pruitt 3 participants 6 messages Oct 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add package libhackrf

---
 package/Config.in                                  |  1 +
 .../0001-disabled_shared_library_in_build.patch    | 54 ++++++++++++++++++++++
 package/libhackrf/Config.in                        |  9 ++++
 package/libhackrf/libhackrf.mk                     | 21 +++++++++
 4 files changed, 85 insertions(+)
 create mode 100644 package/libhackrf/0001-disabled_shared_library_in_build.patch
 create mode 100644 package/libhackrf/Config.in
 create mode 100644 package/libhackrf/libhackrf.mk
package/Config.in +1 -0
index 1ceb7d6..0184e46 100644
@@ -866,6 +866,7 @@ menu "Hardware handling"
 	source "package/libftdi/Config.in"
 	source "package/libftdi1/Config.in"
 	source "package/libgudev/Config.in"
+	source "package/libhackrf/Config.in"
 	source "package/libhid/Config.in"
 	source "package/libiio/Config.in"
 	source "package/libinput/Config.in"
package/libhackrf/0001-disabled_shared_library_in_build.patch new file +54 -0

54 lines not on this page · raw message

package/libhackrf/Config.in new file +9 -0
new file mode 100644
index 0000000..2666a46
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBHACKRF
+	bool "libhackrf"
+	select BR2_PACKAGE_LIBUSB
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	help
+	  Library for accessing HackRF SDR boards.
+
+	  https://github.com/mossmann/hackrf/host/libhackrf
+
package/libhackrf/libhackrf.mk new file +21 -0
new file mode 100644
index 0000000..d7ed919
@@ -0,0 +1,21 @@
+################################################################################
+#
+# libhackrf 
+#
+################################################################################
+
+LIBHACKRF_VERSION = v2015.07.2
+LIBHACKRF_SITE = $(call github,mossmann,hackrf,$(LIBHACKRF_VERSION))
+LIBHACKRF_LICENSE = GPLv2+
+LIBHACKRF_LICENSE_FILES = COPYING
+LIBHACKRF_DEPENDENCIES = libusb
+LIBHACKRF_SUBDIR = host/libhackrf
+LIBHACKRF_INSTALL_STAGING = YES
+
+ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
+LIBHACKRF_CONF_OPTS += -DINSTALL_UDEV_RULES=ON
+else
+LIBHACKRF_CONF_OPTS += -DINSTALL_UDEV_RULES=OFF
+endif
+
+$(eval $(cmake-package))
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 Add package hackrf-tools

---
 package/Config.in                    |  1 +
 package/hackrf-tools/Config.in       |  8 ++++++++
 package/hackrf-tools/hackrf-tools.mk | 14 ++++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 package/hackrf-tools/Config.in
 create mode 100644 package/hackrf-tools/hackrf-tools.mk
package/Config.in +1 -0
index 0184e46..fe3f057 100644
@@ -352,6 +352,7 @@ endif
 	source "package/gpsd/Config.in"
 	source "package/gptfdisk/Config.in"
 	source "package/gvfs/Config.in"
+	source "package/hackrf-tools/Config.in
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/hdparm/Config.in"
 endif
package/hackrf-tools/Config.in new file +8 -0
new file mode 100644
index 0000000..71fced6
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HACKRF_TOOLS
+	bool "hackrf-tools"
+    depends on BR2_PACKAGE_LIBHACKRF && (BR2_SHARED_STATIC_LIBS || BR2_SHARED_LIBS)
+	help
+	  Tools for interacting with and updating HackRF boards.
+
+	  https://github.com/mossmann/hackrf/host/hackrf-tools
+
package/hackrf-tools/hackrf-tools.mk new file +14 -0
new file mode 100644
index 0000000..40bccae
@@ -0,0 +1,14 @@
+################################################################################
+#
+# hackrf-tools
+#
+################################################################################
+
+HACKRF_TOOLS_VERSION = v2015.07.2
+HACKRF_TOOLS_SITE = $(call github,mossmann,hackrf,$(HACKRF_TOOLS_VERSION))
+HACKRF_TOOLS_LICENSE = GPLv2+
+HACKRF_TOOLS_LICENSE_FILES = COPYING
+HACKRF_TOOLS_DEPENDENCIES = libhackrf
+HACKRF_TOOLS_SUBDIR = host/hackrf-tools
+
+$(eval $(cmake-package))
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 Add package hackrf-tools

Hi Jason,

Quoted 27 lines · Jason Pruitt
---
 package/Config.in                    |  1 +
 package/hackrf-tools/Config.in       |  8 ++++++++
 package/hackrf-tools/hackrf-tools.mk | 14 ++++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 package/hackrf-tools/Config.in
 create mode 100644 package/hackrf-tools/hackrf-tools.mk
package/Config.in +1 -0
index 0184e46..fe3f057 100644
@@ -352,6 +352,7 @@ endif
        source "package/gpsd/Config.in"
        source "package/gptfdisk/Config.in"
        source "package/gvfs/Config.in"
+       source "package/hackrf-tools/Config.in
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
        source "package/hdparm/Config.in"
 endif
package/hackrf-tools/Config.in new file +0 -0
new file mode 100644
index 0000000..71fced6

package/hackrf-tools/Config.in line 7

Quoted 7 lines
package/hackrf-tools/Config.in new file +7 -0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HACKRF_TOOLS
+       bool "hackrf-tools"
+    depends on BR2_PACKAGE_LIBHACKRF && (BR2_SHARED_STATIC_LIBS || BR2_SHARED_LIBS)
+       help
+         Tools for interacting with and updating HackRF boards.
+
+         https://github.com/mossmann/hackrf/host/hackrf-tools

The right url seems to be:
https://github.com/mossmann/hackrf/tree/master/host/hackrf-tools

Quoted 24 lines
package/hackrf-tools/Config.in new file +1 -0
+
package/hackrf-tools/hackrf-tools.mk new file +14 -1
new file mode 100644
index 0000000..40bccae
@@ -0,0 +1,14 @@
+################################################################################
+#
+# hackrf-tools
+#
+################################################################################
+
+HACKRF_TOOLS_VERSION = v2015.07.2
+HACKRF_TOOLS_SITE = $(call github,mossmann,hackrf,$(HACKRF_TOOLS_VERSION))
+HACKRF_TOOLS_LICENSE = GPLv2+
+HACKRF_TOOLS_LICENSE_FILES = COPYING
+HACKRF_TOOLS_DEPENDENCIES = libhackrf
+HACKRF_TOOLS_SUBDIR = host/hackrf-tools
+
+$(eval $(cmake-package))
--

2.1.4

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Otherwise, it looks pretty good :)

Regards,

Signature · 1 line
Samuel
#3 lore raw

PATCH 2/2 Add package hackrf-tools

In reply to Jason Pruitt

Dear Jason Pruitt,

package/hackrf-tools/Config.in line 3

Quoted 9 lines · Jason Pruitt
package/hackrf-tools/Config.in new file +3 -0
new file mode 100644
index 0000000..71fced6
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HACKRF_TOOLS
+	bool "hackrf-tools"
+    depends on BR2_PACKAGE_LIBHACKRF && (BR2_SHARED_STATIC_LIBS || BR2_SHARED_LIBS)

Improper indentation. Besides that, if something doesn't build with pure static libraries, we normally do:

depends on !BR2_STATIC_LIBS

and add a comment:

comment "hackrf-tools needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS

Regarding the "depends on BR2_PACKAGE_LIBHACKRF", it should be a "select" instead:

select BR2_PACKAGE_LIBHACKRF

and then you need to propagate the reverse dependencies of libhackrf:

depends on BR2_TOOLCHAIN_HAS_THREADS

and of course keep a comment about this thread dependency. So the comment above should in fact be:

comment "hackrf-tools needs a toolchain w/ threads, dynamic library"

	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS

However, this is all moot if you merge both packages into one, as suggested in my review of the libhackrf package.

package/hackrf-tools/Config.in line 8

Quoted 5 lines
package/hackrf-tools/Config.in new file +5 -0
+	help
+	  Tools for interacting with and updating HackRF boards.
+
+	  https://github.com/mossmann/hackrf/host/hackrf-tools
+

Unneeded empty new line.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/2 Add package libhackrf

In reply to Jason Pruitt

Hi Jason,

Quoted 73 lines · Jason Pruitt
---
 package/Config.in                                  |  1 +
 .../0001-disabled_shared_library_in_build.patch    | 54 ++++++++++++++++++++++
 package/libhackrf/Config.in                        |  9 ++++
 package/libhackrf/libhackrf.mk                     | 21 +++++++++
 4 files changed, 85 insertions(+)
 create mode 100644 package/libhackrf/0001-disabled_shared_library_in_build.patch
 create mode 100644 package/libhackrf/Config.in
 create mode 100644 package/libhackrf/libhackrf.mk
package/Config.in +1 -0
index 1ceb7d6..0184e46 100644
@@ -866,6 +866,7 @@ menu "Hardware handling"
        source "package/libftdi/Config.in"
        source "package/libftdi1/Config.in"
        source "package/libgudev/Config.in"
+       source "package/libhackrf/Config.in"
        source "package/libhid/Config.in"
        source "package/libiio/Config.in"
        source "package/libinput/Config.in"
package/libhackrf/0001-disabled_shared_library_in_build.patch new file +44 -0
new file mode 100644
index 0000000..98a2af8
@@ -0,0 +1,54 @@
+diff -rupN hackrf/host/libhackrf/src/CMakeLists.txt libhackrf-v2015.07.2/host/libhackrf/src/CMakeLists.txt
+--- hackrf/host/libhackrf/src/CMakeLists.txt   2015-10-10 13:31:57.754026872 -0700
++++ libhackrf-v2015.07.2/host/libhackrf/src/CMakeLists.txt     2015-10-10 13:30:52.162026628 -0700
+@@ -27,8 +27,10 @@ set(c_sources ${CMAKE_CURRENT_SOURCE_DIR
+ 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

package/libhackrf/0001-disabled_shared_library_in_build.patch line 54

Quoted 10 lines
package/libhackrf/0001-disabled_shared_library_in_build.patch new file +10 -0
+-           )
++   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

So, static libs are always built... Don't know if this is an issue (some other packages may do the same).

Quoted 6 lines
package/libhackrf/Config.in new file +0 -0
new file mode 100644
index 0000000..2666a46

package/libhackrf/Config.in line 8

Quoted 8 lines
package/libhackrf/Config.in new file +8 -0
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBHACKRF
+       bool "libhackrf"
+       select BR2_PACKAGE_LIBUSB
+       depends on BR2_TOOLCHAIN_HAS_THREADS
+       help
+         Library for accessing HackRF SDR boards.
+
+         https://github.com/mossmann/hackrf/host/libhackrf

The right url seems to be:
https://github.com/mossmann/hackrf/tree/master/host/libhackrf

Quoted 31 lines
package/libhackrf/Config.in new file +1 -0
+
package/libhackrf/libhackrf.mk new file +21 -1
new file mode 100644
index 0000000..d7ed919
@@ -0,0 +1,21 @@
+################################################################################
+#
+# libhackrf
+#
+################################################################################
+
+LIBHACKRF_VERSION = v2015.07.2
+LIBHACKRF_SITE = $(call github,mossmann,hackrf,$(LIBHACKRF_VERSION))
+LIBHACKRF_LICENSE = GPLv2+
+LIBHACKRF_LICENSE_FILES = COPYING
+LIBHACKRF_DEPENDENCIES = libusb
+LIBHACKRF_SUBDIR = host/libhackrf
+LIBHACKRF_INSTALL_STAGING = YES
+
+ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
+LIBHACKRF_CONF_OPTS += -DINSTALL_UDEV_RULES=ON
+else
+LIBHACKRF_CONF_OPTS += -DINSTALL_UDEV_RULES=OFF
+endif
+
+$(eval $(cmake-package))
--

2.1.4

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Otherwise it looks pretty good :)

Regards,

Signature · 1 line
Samuel
#5 lore raw

PATCH 1/2 Add package libhackrf

In reply to Jason Pruitt

Dear Jason Pruitt,

Thanks for your contribution!

By convention, the title of the commits for new packages should be:

<package>: new package

i.e in this case:

libhackrf: new package

See some other comments below.

package/libhackrf/0001-disabled_shared_library_in_build.patch line 3

Quoted 9 lines · Jason Pruitt
package/libhackrf/0001-disabled_shared_library_in_build.patch new file +3 -0
new file mode 100644
index 0000000..98a2af8
@@ -0,0 +1,54 @@
+diff -rupN hackrf/host/libhackrf/src/CMakeLists.txt libhackrf-v2015.07.2/host/libhackrf/src/CMakeLists.txt
+--- hackrf/host/libhackrf/src/CMakeLists.txt	2015-10-10 13:31:57.754026872 -0700
++++ libhackrf-v2015.07.2/host/libhackrf/src/CMakeLists.txt	2015-10-10 13:30:52.162026628 -0700

All patches should have a description + Signed-off-by. Also, since the upstream project is using Git, it would be preferable to have a patch generated with Git. In addition, if you can submit to the upstream project this change, it would be useful.

package/libhackrf/Config.in line 4

Quoted 10 lines
package/libhackrf/Config.in new file +4 -0
new file mode 100644
index 0000000..2666a46
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBHACKRF
+	bool "libhackrf"
+	select BR2_PACKAGE_LIBUSB
+	depends on BR2_TOOLCHAIN_HAS_THREADS

Since you depend on thread support, you need to add a Config.in "comment", like:

comment "libhackrf needs a toolchain w/ threads"
depends on !BR2_TOOLCHAIN_HAS_THREADS

package/libhackrf/Config.in line 9

Quoted 5 lines
package/libhackrf/Config.in new file +5 -0
+	help
+	  Library for accessing HackRF SDR boards.
+
+	  https://github.com/mossmann/hackrf/host/libhackrf
+

This last empty new line is not needed.

Quoted 6 lines
package/libhackrf/libhackrf.mk new file +0 -0
new file mode 100644
index 0000000..d7ed919

package/libhackrf/libhackrf.mk line 10

Quoted 10 lines
package/libhackrf/libhackrf.mk new file +10 -0
@@ -0,0 +1,21 @@
+################################################################################
+#
+# libhackrf 
+#
+################################################################################
+
+LIBHACKRF_VERSION = v2015.07.2
+LIBHACKRF_SITE = $(call github,mossmann,hackrf,$(LIBHACKRF_VERSION))
+LIBHACKRF_LICENSE = GPLv2+
+LIBHACKRF_LICENSE_FILES = COPYING

Indeed, the COPYING file says GPLv2, but the library source file itself
(https://github.com/mossmann/hackrf/blob/master/host/libhackrf/src/hackrf.c)
advertise a BSD-3c license.

package/libhackrf/libhackrf.mk line 12

Quoted 2 lines
package/libhackrf/libhackrf.mk new file +2 -0
+LIBHACKRF_DEPENDENCIES = libusb
+LIBHACKRF_SUBDIR = host/libhackrf

Why do you have two packages for libhackrf and hackrf-tools if they are part of the same upstream repository? There should be a single Buildroot package for both, possibly with sub-options to select only the library, or the library + the tools. Especially since there is a host/CMakeLists.txt file that allows to build both.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com