mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
Merge from bittboy/buildroot@db180c0
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
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
|
||||
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
|
||||
|
||||
Patch has been updated to work with 0.5.4 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]
|
||||
|
||||
Signed-off-by: Yuvaraj Patil <yuvaraj.patil@wipro.com>
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
src/CMakeLists.txt | 24 ++++++++++++++++--------
|
||||
1 file changed, 16 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 07d64ab..2b7cbae 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -47,16 +47,22 @@ ENDIF(MSVC)
|
||||
########################################################################
|
||||
# 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)
|
||||
+endif()
|
||||
|
||||
########################################################################
|
||||
# Setup static library variant
|
||||
########################################################################
|
||||
+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
|
||||
set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
|
||||
endif()
|
||||
+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)
|
||||
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)
|
||||
|
||||
-target_link_libraries(rtl_sdr rtlsdr_shared 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_lib} convenience_static
|
||||
${LIBUSB_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
-target_link_libraries(rtl_test rtlsdr_shared 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_lib} convenience_static
|
||||
${LIBUSB_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
-target_link_libraries(rtl_eeprom rtlsdr_shared 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_lib} convenience_static
|
||||
${LIBUSB_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
-target_link_libraries(rtl_power rtlsdr_shared convenience_static
|
||||
+target_link_libraries(rtl_power ${rtlsdr_lib} convenience_static
|
||||
${LIBUSB_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
--
|
||||
2.14.1
|
||||
|
||||
24
package/librtlsdr/Config.in
Normal file
24
package/librtlsdr/Config.in
Normal file
@@ -0,0 +1,24 @@
|
||||
config BR2_PACKAGE_LIBRTLSDR
|
||||
bool "librtlsdr"
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
select BR2_PACKAGE_LIBUSB
|
||||
help
|
||||
Library and command line programs for accessing
|
||||
RTL2832U SDR dongles.
|
||||
|
||||
http://sdr.osmocom.org/trac/wiki/rtl-sdr/
|
||||
|
||||
if BR2_PACKAGE_LIBRTLSDR
|
||||
|
||||
config BR2_PACKAGE_LIBRTLSDR_DETACH_DRIVER
|
||||
bool "Detach kernel driver"
|
||||
default y
|
||||
help
|
||||
Enable this option if you would like librtlsdr to
|
||||
automatically detach any kernel driver associated to the
|
||||
RTL2832U USB device on startup if one is loaded.
|
||||
|
||||
endif
|
||||
|
||||
comment "librtlsdr needs a toolchain w/ threads"
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS
|
||||
4
package/librtlsdr/librtlsdr.hash
Normal file
4
package/librtlsdr/librtlsdr.hash
Normal file
@@ -0,0 +1,4 @@
|
||||
# Locally calculated
|
||||
sha256 80a5155f3505bca8f1b808f8414d7dcd7c459b662a1cde84d3a2629a6e72ae55 librtlsdr-0.6.0.tar.gz
|
||||
# License file, locally calculated
|
||||
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING
|
||||
42
package/librtlsdr/librtlsdr.mk
Normal file
42
package/librtlsdr/librtlsdr.mk
Normal file
@@ -0,0 +1,42 @@
|
||||
################################################################################
|
||||
#
|
||||
# librtlsdr
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBRTLSDR_VERSION = 0.6.0
|
||||
LIBRTLSDR_SITE = $(call github,steve-m,librtlsdr,$(LIBRTLSDR_VERSION))
|
||||
LIBRTLSDR_LICENSE = GPL-2.0+
|
||||
LIBRTLSDR_LICENSE_FILES = COPYING
|
||||
LIBRTLSDR_INSTALL_STAGING = YES
|
||||
LIBRTLSDR_DEPENDENCIES = libusb
|
||||
|
||||
# BUILD_SHARED_LIBS is handled in pkg-cmake.mk as it is a generic cmake variable
|
||||
ifeq ($(BR2_STATIC_LIBS),y)
|
||||
LIBRTLSDR_CONF_OPTS += -DBUILD_STATIC_LIBS=ON
|
||||
else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
|
||||
LIBRTLSDR_CONF_OPTS += -DBUILD_STATIC_LIBS=ON
|
||||
else ifeq ($(BR2_SHARED_LIBS),y)
|
||||
LIBRTLSDR_CONF_OPTS += -DBUILD_STATIC_LIBS=OFF
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
|
||||
LIBRTLSDR_CONF_OPTS += -DINSTALL_UDEV_RULES=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBRTLSDR_DETACH_DRIVER),y)
|
||||
LIBRTLSDR_CONF_OPTS += -DDETACH_KERNEL_DRIVER=1
|
||||
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.
|
||||
# The 2 first link checks fail because of undefined symbols: __libc_setup_tls.
|
||||
# In the later check, CMake successfully compiles and links the test program,
|
||||
# but it also tries to run it, which is wrong when cross-compiling.
|
||||
#
|
||||
# The following CMake variable only disables the TRY_RUN call in the -pthread
|
||||
# test.
|
||||
LIBRTLSDR_CONF_OPTS += -DTHREADS_PTHREAD_ARG=OFF
|
||||
|
||||
$(eval $(cmake-package))
|
||||
Reference in New Issue
Block a user