This commit is contained in:
TriForceX
2021-03-13 22:13:38 -03:00
parent c77595adbd
commit b3ecc6e32d
7043 changed files with 119377 additions and 73694 deletions

View File

@@ -1,44 +1,47 @@
From d47e3aed12414be59bf77177c93853ec4b24d705 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 2 Jun 2018 16:53:36 +0200
From 9a1c2587d4ef18e2026811deabd024eb7577d9ce Mon Sep 17 00:00:00 2001
From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
Date: Fri, 15 May 2020 16:14:48 +0200
Subject: [PATCH] disable shared library target in build
Disable shared library target if BUILD_SHARED_LIBS if OFF.
Patch retrieved from
https://git.buildroot.net/buildroot/tree/package/librtlsdr/0001-disable_shared_library_target_in_build.patch?h=2018.05
https://git.buildroot.net/buildroot/tree/package/librtlsdr/0001-disable_shared_library_target_in_build.patch?h=2020.02.x
Patch has been updated to work with 0.5.4 and to be able to keep current
Patch has been updated to work with master and to be able to keep current
behavior of building shared and static version of library if
BUILD_SHARED_LIBS and BUILD_STATIC_LIBS are both set.
Moreover, if BUILD_STATIC_LIBS is OFF, only shared version of library
will be install.
[Upstream status: https://github.com/steve-m/librtlsdr/pull/46]
[Upstream status: http://lists.osmocom.org/pipermail/osmocom-sdr/2020-May/002075.html]
Signed-off-by: Yuvaraj Patil <yuvaraj.patil@wipro.com>
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
---
src/CMakeLists.txt | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
src/CMakeLists.txt | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 07d64ab..2b7cbae 100644
index de93044..13b7b1a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,16 +47,22 @@ ENDIF(MSVC)
@@ -18,6 +18,8 @@
########################################################################
# Setup shared library variant
########################################################################
+option(BUILD_SHARED_LIBS "Build shared library" ON)
+if(BUILD_SHARED_LIBS)
add_library(rtlsdr_shared SHARED ${rtlsdr_srcs})
target_link_libraries(rtlsdr_shared ${LIBUSB_LIBRARIES})
set_target_properties(rtlsdr_shared PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS")
set_target_properties(rtlsdr_shared PROPERTIES OUTPUT_NAME rtlsdr)
set_target_properties(rtlsdr_shared PROPERTIES SOVERSION ${MAJOR_VERSION})
set_target_properties(rtlsdr_shared PROPERTIES VERSION ${LIBVER})
+list(APPEND rtlsdr_lib rtlsdr_shared)
add_library(rtlsdr SHARED librtlsdr.c
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
target_link_libraries(rtlsdr PkgConfig::LIBUSB)
@@ -30,10 +32,14 @@ set_target_properties(rtlsdr PROPERTIES OUTPUT_NAME rtlsdr)
set_target_properties(rtlsdr PROPERTIES SOVERSION ${MAJOR_VERSION})
set_target_properties(rtlsdr PROPERTIES VERSION ${LIBVER})
generate_export_header(rtlsdr)
+list(APPEND rtlsdr_lib rtlsdr)
+endif()
########################################################################
@@ -46,60 +49,82 @@ index 07d64ab..2b7cbae 100644
########################################################################
+option(BUILD_STATIC_LIBS "Build static library" ON)
+if(BUILD_STATIC_LIBS)
add_library(rtlsdr_static STATIC ${rtlsdr_srcs})
target_link_libraries(rtlsdr_static ${LIBUSB_LIBRARIES})
set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
@@ -64,6 +70,8 @@ if(NOT WIN32)
# Force same library filename for static and shared variants of the library
add_library(rtlsdr_static STATIC librtlsdr.c
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
target_link_libraries(rtlsdr_static PkgConfig::LIBUSB)
@@ -47,6 +53,8 @@ if(NOT WIN32)
set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
endif()
generate_export_header(rtlsdr_static)
+list(APPEND rtlsdr_lib rtlsdr_static)
+endif()
########################################################################
# Setup libraries used in executables
@@ -91,33 +99,33 @@ add_executable(rtl_fm rtl_fm.c)
add_executable(rtl_eeprom rtl_eeprom.c)
# Set up Windows DLL resource files
@@ -90,37 +98,37 @@ add_executable(rtl_eeprom rtl_eeprom.c)
add_executable(rtl_adsb rtl_adsb.c)
add_executable(rtl_power rtl_power.c)
-set(INSTALL_TARGETS rtlsdr_shared rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power)
+set(INSTALL_TARGETS ${rtlsdr_lib} rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power)
add_executable(rtl_biast rtl_biast.c)
-set(INSTALL_TARGETS rtlsdr rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast)
+set(INSTALL_TARGETS ${rtlsdr_lib} rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast)
-target_link_libraries(rtl_sdr rtlsdr_shared convenience_static
-target_link_libraries(rtl_sdr rtlsdr convenience_static
+target_link_libraries(rtl_sdr ${rtlsdr_lib} convenience_static
${LIBUSB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
-target_link_libraries(rtl_tcp rtlsdr_shared convenience_static
-target_link_libraries(rtl_tcp rtlsdr convenience_static
+target_link_libraries(rtl_tcp ${rtlsdr_lib} convenience_static
${LIBUSB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
-target_link_libraries(rtl_test rtlsdr_shared convenience_static
-target_link_libraries(rtl_test rtlsdr convenience_static
+target_link_libraries(rtl_test ${rtlsdr_lib} convenience_static
${LIBUSB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
-target_link_libraries(rtl_fm rtlsdr_shared convenience_static
-target_link_libraries(rtl_fm rtlsdr convenience_static
+target_link_libraries(rtl_fm ${rtlsdr_lib} convenience_static
${LIBUSB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
-target_link_libraries(rtl_eeprom rtlsdr_shared convenience_static
-target_link_libraries(rtl_eeprom rtlsdr convenience_static
+target_link_libraries(rtl_eeprom ${rtlsdr_lib} convenience_static
${LIBUSB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
-target_link_libraries(rtl_adsb rtlsdr_shared convenience_static
-target_link_libraries(rtl_adsb rtlsdr convenience_static
+target_link_libraries(rtl_adsb ${rtlsdr_lib} convenience_static
${LIBUSB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
-target_link_libraries(rtl_power rtlsdr_shared convenience_static
-target_link_libraries(rtl_power rtlsdr convenience_static
+target_link_libraries(rtl_power ${rtlsdr_lib} convenience_static
${LIBUSB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
-target_link_libraries(rtl_biast rtlsdr convenience_static
+target_link_libraries(rtl_biast ${rtlsdr_lib} convenience_static
${LIBUSB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
@@ -156,12 +164,16 @@ endif()
########################################################################
# Install built library files & utilities
########################################################################
+if(BUILD_SHARED_LIBS)
install(TARGETS rtlsdr EXPORT RTLSDR-export
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file
)
+endif()
+if(BUILD_STATIC_LIBS)
install(TARGETS rtlsdr_static EXPORT RTLSDR-export
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file
)
+endif()
install(TARGETS rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast
DESTINATION ${CMAKE_INSTALL_BINDIR}
)
--
2.14.1
2.25.3

View File

@@ -0,0 +1,47 @@
From feb5d9c6b7bcec788f9b01781c205e31fff260e7 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Tue, 11 Aug 2020 23:07:08 +0200
Subject: [PATCH] cmake/Modules/Version.cmake: don't use Git version if not in
a Git repo
If the librtlsdr code comes from a tarball, it doesn't have any .git/
metadata, and therefore even if Git (as a tool) is found, the logic in
cmake/Modules/Version.cmake fails finding a version through Git:
-- Extracting version information from git describe...
fatal: Not a git repository (or any of the parent directories): .git
As a consequence, the VERSION variable is empty, which later causes
cmake to bail out with:
CMake Error at /home/test/autobuild/run/instance-1/output-1/host/share/cmake-3.15/Modules/WriteBasicConfigVersionFile.cmake:43 (message):
No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()
Call Stack (most recent call first):
/home/test/autobuild/run/instance-1/output-1/host/share/cmake-3.15/Modules/CMakePackageConfigHelpers.cmake:225 (write_basic_config_version_file)
CMakeLists.txt:173 (write_basic_package_version_file)
To avoid this, we only use Git to determine the version if the cmake
project top-level source directory has a .git/ folder.
Upstream: https://github.com/librtlsdr/librtlsdr/pull/75
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
cmake/Modules/Version.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/Modules/Version.cmake b/cmake/Modules/Version.cmake
index 2d4e76d..6f67fa4 100644
--- a/cmake/Modules/Version.cmake
+++ b/cmake/Modules/Version.cmake
@@ -32,7 +32,7 @@ set(PATCH_VERSION ${VERSION_INFO_PATCH_VERSION})
########################################################################
find_package(Git QUIET)
-if(GIT_FOUND)
+if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
message(STATUS "Extracting version information from git describe...")
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=4 --long
--
2.26.2

View File

@@ -18,6 +18,14 @@ config BR2_PACKAGE_LIBRTLSDR_DETACH_DRIVER
automatically detach any kernel driver associated to the
RTL2832U USB device on startup if one is loaded.
config BR2_PACKAGE_LIBRTLSDR_ZEROCOPY
bool "Enable usbfs zero-copy support"
default y
help
This option allows to use kernel usbfs mmap instead
of buffers in userspace. If you experiment crash with
kernel < 5.6, disable this option.
endif
comment "librtlsdr needs a toolchain w/ threads"

View File

@@ -1,4 +1,4 @@
# Locally calculated
sha256 80a5155f3505bca8f1b808f8414d7dcd7c459b662a1cde84d3a2629a6e72ae55 librtlsdr-0.6.0.tar.gz
sha256 f09ff5ba2fa1780071321ba22885b9d1a16ac9d4b944a97e39b6921960439301 librtlsdr-ed0317e6a58c098874ac58b769cf2e609c18d9a5.tar.gz
# License file, locally calculated
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING

View File

@@ -4,7 +4,7 @@
#
################################################################################
LIBRTLSDR_VERSION = 0.6.0
LIBRTLSDR_VERSION = ed0317e6a58c098874ac58b769cf2e609c18d9a5
LIBRTLSDR_SITE = $(call github,steve-m,librtlsdr,$(LIBRTLSDR_VERSION))
LIBRTLSDR_LICENSE = GPL-2.0+
LIBRTLSDR_LICENSE_FILES = COPYING
@@ -28,6 +28,12 @@ ifeq ($(BR2_PACKAGE_LIBRTLSDR_DETACH_DRIVER),y)
LIBRTLSDR_CONF_OPTS += -DDETACH_KERNEL_DRIVER=1
endif
ifeq ($(BR2_PACKAGE_LIBRTLSDR_ZEROCOPY),y)
LIBRTLSDR_CONF_OPTS += -DENABLE_ZEROCOPY=ON
else
LIBRTLSDR_CONF_OPTS += -DENABLE_ZEROCOPY=OFF
endif
# In case of static-lib-only builds, CMake's FindThreads.cmake code tries to
# get the right flags, checking first for -lpthreads, then -lpthread, and lastly
# for -pthread.