LTESniffer: WIP

This commit is contained in:
Anton Bolshakov 2024-04-18 18:57:40 +08:00
parent 091e5fdd96
commit a9ecd06c83
No known key found for this signature in database
GPG key ID: 32BDCED870788F04
12 changed files with 825 additions and 0 deletions

View file

@ -0,0 +1,67 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake flag-o-matic
DESCRIPTION="software-defined analyzer for APCO P25 signals"
HOMEPAGE="http://osmocom.org/projects/op25/wiki"
SRC_URI="https://github.com/SysSec-KAIST/LTESniffer/archive/refs/tags/LTESniffer-v${PV}.tar.gz -> ${P}.gh.tar.gz"
LICENSE="GPL-3"
SLOT="0"
# WIP
#KEYWORDS="~amd64 ~x86"
S="${WORKDIR}/LTESniffer-LTESniffer-v${PV}"
RDEPEND="net-misc/lksctp-tools
dev-libs/libconfig
dev-libs/c-mnalib
net-wireless/srsran2"
DEPEND="${RDEPEND}"
#src_prepare() {
# -Werror=maybe-uninitialized
# srsRAN-src/lib/include/srsran/srslog/bundled/fmt/core.h <- #include <array>
# sed '/set(CMAKE_CXX_FLAGS/d' -i CMakeLists.txt
# sed -i "s|WORK_DIR|${WORKDIR}|g" srcRAN-src/lib || die "sed failed"
# cmake_src_prepare
#}
#no-maybe-uninitialized
src_configure() {
# append-cxxflags $(test-flags-CXX -Wno-uninitialized)
# append-cxxflags $(test-flags-CXX -Wno-uninitialized -Wno-maybe-uninitialized)
local mycmakeargs=(
# -Wno-dev -Wno-uninitialized -Wno-maybe-uninitialized
-DFORCE_SUBPROJECT_CMNALIB=OFF
-DFORCE_SUBPROJECT_SRSRAN=OFF
)
# option(DISABLE_SIMD "disable simd instructions" OFF)
# option(FORCE_SUBPROJECT_CMNALIB "Download and build CMNALIB" OFF)
# option(FORCE_SUBPROJECT_SRSRAN "Download and build SRSRAN" OFF)
# option(ENABLE_GUI "Enable GUI (using srsGUI)" ON)
# option(ENABLE_UHD "Enable UHD" ON)
# option(ENABLE_BLADERF "Enable BladeRF" ON)
# option(ENABLE_SOAPYSDR "Enable SoapySDR" ON)
# option(BUILD_STATIC "Attempt to statically link external deps" OFF)
# option(ENABLE_ASAN "Enable gcc/clang address sanitizer" OFF)
# option(ENABLE_MSAN "Enable clang memory sanitizer" OFF)
# option(ENABLE_TIDY "Enable clang tidy" OFF)
cmake_src_configure
}
#src_install() {
# cmake_src_install
# find "${ED}" -name "*.py[co]" -delete || die
# python_optimize
#this isn't right, but cmake is broken somehow
# dodir /usr/share/${PN}
# cp -r "${S}/op25/gr-op25_repeater/apps" "${ED}/usr/share/${PN}" || die
#}

View file

@ -0,0 +1 @@
DIST LTESniffer-2.1.0.gh.tar.gz 14345514 BLAKE2B df66f3e8a909fc38ecdc5f2b06c588282ff73e0a7b7e6b5c70b12e456b79d8debfb768593ff2ae356799d996a131f8a50c12600f017aff63e9c7e7eb1095c70d SHA512 0d7f9227e63e4472b6ed6a6358974133a253f5802a566830f6073cee88ff189ecfdea24533645adf330076d1d2ee8bdc332ecc9392ba6455b81b88c78d8dc419

View file

@ -0,0 +1,404 @@
cmake_minimum_required (VERSION 2.8.11)
#######################################################################
# INSTALL TARGET for make install
#######################################################################
#SET(CMAKE_INSTALL_PREFIX /usr/local)
#message("CIP = ${CMAKE_INSTALL_PREFIX} (should be /usr/local")
project (DL_Sniffer)
#set (CMAKE_INSTALL_PREFIX /usr/local)
#message("CIP = ${CMAKE_INSTALL_PREFIX} (should be /usr/local")
#######################################################################
# OPTIONS:
#######################################################################
#option(ENABLE_SRSUE "Build srsUE application" ON)
#option(ENABLE_SRSENB "Build srsENB application" ON)
#option(ENABLE_SRSEPC "Build srsEPC application" ON)
option(DISABLE_SIMD "disable simd instructions" OFF)
option(FORCE_SUBPROJECT_CMNALIB "Download and build CMNALIB" OFF)
option(FORCE_SUBPROJECT_SRSRAN "Download and build SRSRAN" OFF)
option(ENABLE_GUI "Enable GUI (using srsGUI)" ON)
option(ENABLE_UHD "Enable UHD" ON)
option(ENABLE_BLADERF "Enable BladeRF" ON)
option(ENABLE_SOAPYSDR "Enable SoapySDR" ON)
#option(ENABLE_HARDSIM "Enable support for SIM cards" ON)
option(BUILD_STATIC "Attempt to statically link external deps" OFF)
#option(RPATH "Enable RPATH" OFF)
option(ENABLE_ASAN "Enable gcc/clang address sanitizer" OFF)
option(ENABLE_MSAN "Enable clang memory sanitizer" OFF)
option(ENABLE_TIDY "Enable clang tidy" OFF)
#option(USE_LTE_RATES "Use standard LTE sampling rates" OFF)
set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.")
###########################################################################
########################################################################
# Extra options
########################################################################
if(NOT DEFINED MAX_RECURSION_DEPTH)
set(MAX_RECURSION_DEPTH 99)
endif()
#add_definitions(-DMAX_RECURSION_DEPTH=${MAX_RECURSION_DEPTH})
########################################################################
if(NOT CMAKE_BUILD_TYPE)
# set(CMAKE_BUILD_TYPE Release)
#_cmake_modify_IGNORE set(CMAKE_BUILD_TYPE RelWithDebInfo)
message(STATUS "Build type not specified: defaulting to ${CMAKE_BUILD_TYPE}.")
endif(NOT CMAKE_BUILD_TYPE)
#_cmake_modify_IGNORE set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
########################################################################
# Dependencies
########################################################################
# Check for CMNAlib in system.
find_package(CMNALIB)
if(CMNALIB_FOUND AND NOT FORCE_SUBPROJECT_CMNALIB)
include_directories(${CMNALIB_INCLUDE_DIRS})
link_directories(${CMNALIB_LIBRARY_DIRS})
else(CMNALIB_FOUND AND NOT FORCE_SUBPROJECT_CMNALIB)
message("Download CMNALIB as a subproject and build it.")
# Download and unpack cmnalib at configure time
configure_file(external/cmake/cmnalib.CMakeLists.txt.in cmnalib-download/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/cmnalib-download" )
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/cmnalib-download" )
include_directories("${CMAKE_BINARY_DIR}/cmnalib-src/src/cmnalib/include")
# Add cmnalib directly to our build.
add_subdirectory("${CMAKE_BINARY_DIR}/cmnalib-src"
"${CMAKE_BINARY_DIR}/cmnalib-build")
set(CMNALIB_LIBRARY cmnalib)
set(CMNALIB_LIBRARIES ${CMNALIB_LIBRARY})
endif(CMNALIB_FOUND AND NOT FORCE_SUBPROJECT_CMNALIB)
message("CMNALIB_LIBRARY: " ${CMNALIB_LIBRARY})
message("CMNALIB_LIBRARIES: " ${CMNALIB_LIBRARIES})
# cmnalib also needs glib:
INCLUDE(FindPkgConfig)
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})
#link_directories(${GLIB2_LIBRARY_DIRS})
############################################
############################################
# Threads
find_package(Threads REQUIRED)
#FFT
find_package(MKL)
if(MKL_FOUND)
include_directories(${MKL_INCLUDE_DIRS})
link_directories(${MKL_LIBRARY_DIRS})
set(FFT_LIBRARIES "${MKL_STATIC_LIBRARIES}") # Static by default
else(MKL_FOUND)
find_package(FFTW3F REQUIRED)
if(FFTW3F_FOUND)
include_directories(${FFTW3F_INCLUDE_DIRS})
link_directories(${FFTW3F_LIBRARY_DIRS})
if(BUILD_STATIC)
set(FFT_LIBRARIES "${FFTW3F_STATIC_LIBRARIES}")
else(BUILD_STATIC)
set(FFT_LIBRARIES "${FFTW3F_LIBRARIES}")
endif(BUILD_STATIC)
message(STATUS "FFT_LIBRARIES: " ${FFT_LIBRARIES})
endif(FFTW3F_FOUND)
endif(MKL_FOUND)
# UHD
if(ENABLE_UHD)
find_package(UHD)
if(UHD_FOUND)
include_directories(${UHD_INCLUDE_DIRS})
link_directories(${UHD_LIBRARY_DIRS})
endif(UHD_FOUND)
endif(ENABLE_UHD)
# BladeRF
if(ENABLE_BLADERF)
find_package(bladeRF)
if(BLADERF_FOUND)
include_directories(${BLADERF_INCLUDE_DIRS})
link_directories(${BLADERF_LIBRARY_DIRS})
endif(BLADERF_FOUND)
endif(ENABLE_BLADERF)
# Soapy
if(ENABLE_SOAPYSDR)
find_package(SoapySDR)
if(SOAPYSDR_FOUND)
include_directories(${SOAPYSDR_INCLUDE_DIRS})
link_directories(${SOAPYSDR_LIBRARY_DIRS})
endif(SOAPYSDR_FOUND)
endif(ENABLE_SOAPYSDR)
if(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND)
set(RF_FOUND TRUE CACHE INTERNAL "RF frontend found")
else(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND)
set(RF_FOUND FALSE CACHE INTERNAL "RF frontend found")
add_definitions(-DDISABLE_RF)
endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND)
#####################################################
find_package(SRSRAN)
if(SRSRAN_FOUND AND NOT FORCE_SUBPROJECT_SRSRAN)
include_directories(${SRSRAN_INCLUDE_DIRS})
link_directories(${SRSRAN_LIBRARY_DIRS})
else(SRSRAN_FOUND AND NOT FORCE_SUBPROJECT_SRSRAN)
message("Download SRSRAN as a subproject and build it.")
# Download and unpack srsRAN at configure time
configure_file(external/cmake/srsRAN.CMakeLists.txt.in srsRAN-download/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/srsRAN-download" )
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/srsRAN-download" )
include_directories("${CMAKE_BINARY_DIR}/srsRAN-build/lib/include")
include_directories("${CMAKE_BINARY_DIR}/srsRAN-src/lib/include")
include_directories("${CMAKE_BINARY_DIR}/srsRAN-src/")
# let the compiler find included files from subdirectories
include_directories(".")
# Add srsRAN directly to our build.
add_subdirectory("${CMAKE_BINARY_DIR}/srsRAN-src"
"${CMAKE_BINARY_DIR}/srsRAN-build")
set(SRSRAN_LIBRARY_RF srsran_rf)
set(SRSRAN_LIBRARY srsran_common)
set(SRSRAN_LIBRARY_PHY srsran_phy)
set(SRSRAN_LIBRARY_RADIO srsran_radio)
set(SRSRAN_LIBRARY_ASN1 srsran_asn1)
set(SRSRAN_LIBRARY_GTPU srsran_gtpu)
set(SRSRAN_LIBRARY_MAC srsran_mac)
set(SRSRAN_LIBRARY_PDCP srsran_pdcp)
set(SRSRAN_LIBRARY_RLC srsran_rlc)
# set(SRSRAN_LIBRARY_SRSLOG srsran_srslog)
# set(SRSRAN_LIBRARY_SUPPORT srsran_support)
# set(SRSRAN_LIBRARY_SYSTEM srsran_system)
# ${SRSRAN_LIBRARY_RF}
# ${SRSRAN_LIBRARY_RF_UTILS}
# ${SRSRAN_LIBRARY_RADIO}
set(SRSRAN_LIBRARIES
${SRSRAN_LIBRARY}
${SRSRAN_LIBRARY_PHY}
${SRSRAN_LIBRARY_ASN1}
${SRSRAN_LIBRARY_GTPU}
${SRSRAN_LIBRARY_MAC}
${SRSRAN_LIBRARY_PDCP}
${SRSRAN_LIBRARY_RLC}
# ${SRSRAN_LIBRARY_SRSLOG}
# ${SRSRAN_LIBRARY_SUPPORT}
# ${SRSRAN_LIBRARY_SYSTEM}
)
if(RF_FOUND)
list(APPEND SRSRAN_LIBRARIES ${SRSRAN_LIBRARY_RF} ${SRSRAN_LIBRARY_RADIO})
endif(RF_FOUND)
endif(SRSRAN_FOUND AND NOT FORCE_SUBPROJECT_SRSRAN)
message("SRSRAN_LIBRARIES: " ${SRSRAN_LIBRARIES})
#####################################################
# Boost
#if(ENABLE_SRSUE OR ENABLE_SRSENB OR ENABLE_SRSEPC)
if(BUILD_STATIC)
set(Boost_USE_STATIC_LIBS ON)
endif(BUILD_STATIC)
set(BOOST_REQUIRED_COMPONENTS
program_options
system
thread
)
if(UNIX AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
endif(UNIX AND EXISTS "/usr/lib64")
set(Boost_ADDITIONAL_VERSIONS
"1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
"1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
"1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
"1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
"1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
"1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
)
find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
#endif(ENABLE_SRSUE OR ENABLE_SRSENB OR ENABLE_SRSEPC)
########################################################################
# Compiler specific setup
########################################################################
macro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(${flag} ${have})
if(${have})
add_definitions(${flag})
endif(${have})
endmacro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
#ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-Werror=incompatible-pointer-types" HAVE_ERROR_INCOMPATIBLE)
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
message("MARCH - FLAGS: ${GCC_ARCH}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-write-strings -Winline -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -D_GNU_SOURCE")
find_package(SSE) # evaluation comes later
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG")
else(${CMAKE_BUILD_TYPE} STREQUAL "Debug2")
if(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -DBUILD_TYPE_RELWITHDEBINFO")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -DBUILD_TYPE_RELWITHDEBINFO")
else(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fno-trapping-math -fno-math-errno -DBUILD_TYPE_RELEASE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fno-trapping-math -fno-math-errno -DBUILD_TYPE_RELEASE")
endif(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
if (USE_LTE_RATES)
message(STATUS "Using standard LTE sampling rates")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFORCE_STANDARD_RATE")
endif (USE_LTE_RATES)
#find_package(SSE) # moved upwards before BUILD_TYPE-specific flags. -> AVX512 detection/test code gets subject of O3 optimization -> reports availability even if not present
if (HAVE_AVX2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
else (HAVE_AVX2)
if(HAVE_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
elseif(HAVE_SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
endif(HAVE_AVX)
endif (HAVE_AVX2)
if (HAVE_FMA)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma -DLV_HAVE_FMA")
endif (HAVE_FMA)
if (HAVE_AVX512)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f -mavx512cd -DLV_HAVE_AVX512")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mavx512cd -DLV_HAVE_AVX512")
endif(HAVE_AVX512)
if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
if(HAVE_SSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Ofast -funroll-loops")
endif(HAVE_SSE)
endif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -march=native -DIS_ARM -DHAVE_NEON")
message(STATUS "have ARM")
set(HAVE_NEON "True")
else(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
set(HAVE_NEON "False")
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
set(CMAKE_REQUIRED_FLAGS ${CMAKE_C_FLAGS})
if(NOT HAVE_SSE AND NOT HAVE_NEON AND NOT DISABLE_SIMD)
message(FATAL_ERROR "no SIMD instructions found")
endif(NOT HAVE_SSE AND NOT HAVE_NEON AND NOT DISABLE_SIMD)
if(NOT WIN32)
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
endif(NOT WIN32)
if (ENABLE_ASAN AND ENABLE_MSAN)
message(FATAL_ERROR "ASAN and MSAN cannot be enabled at the same time.")
endif (ENABLE_ASAN AND ENABLE_MSAN)
if (ENABLE_ASAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
endif (ENABLE_ASAN)
if (ENABLE_MSAN AND CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory -fno-omit-frame-pointer -fPIE -pie")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory -fno-omit-frame-pointer -fPIE -pie")
endif (ENABLE_MSAN AND CMAKE_C_COMPILER_ID MATCHES "Clang")
endif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# The following is needed for weak linking to work under OS X
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS "CMAKE_C_FLAGS is ${CMAKE_C_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS is ${CMAKE_CXX_FLAGS}")
########################################################################
# Add -fPIC property to all targets
########################################################################
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
########################################################################
# Install Dirs
########################################################################
if (NOT CMAKE_INSTALL_LIBDIR)
include(GNUInstallDirs)
endif (NOT CMAKE_INSTALL_LIBDIR)
set(RUNTIME_PATH bin) # PATH to usr/local/bin for install
set(INCLUDE_DIR include) # PATH to usr/local/include for install
########################################################################
# Add general includes and dependencies
########################################################################
include_directories(${PROJECT_BINARY_DIR}/lib/include)
include_directories(${PROJECT_SOURCE_DIR}/lib/include)
include_directories(${PROJECT_SOURCE_DIR}/src) # for cross includes of top-level applications
include_directories(${PROJECT_SOURCE_DIR}/lib)
########################################################################
# Add the subdirectories
########################################################################
# Remove _GNU_SOURCE definition for the next targets due to issues with clang code model in Qt Creator
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_GNU_SOURCE")
add_subdirectory(lib)
add_subdirectory(src)
message(STATUS "<<< Gentoo configuration >>>
Build type ${CMAKE_BUILD_TYPE}
Install path ${CMAKE_INSTALL_PREFIX}
Compiler flags:
C ${CMAKE_C_FLAGS}
C++ ${CMAKE_CXX_FLAGS}
Linker flags:
Executable ${CMAKE_EXE_LINKER_FLAGS}
Module ${CMAKE_MODULE_LINKER_FLAGS}
Shared ${CMAKE_SHARED_LINKER_FLAGS}\n")

View file

@ -0,0 +1,174 @@
# - Try to find srsran
#
# Once done this will define
# SRSRAN_FOUND - System has srsran
# SRSRAN_INCLUDE_DIRS - The srsran include directories
# SRSRAN_LIBRARIES - The srsran libraries
#
# The following variables are used:
# SRSRAN_DIR - Environment variable giving srsran install directory
# SRSRAN_SRCDIR - Directory containing srsran sources
# SRSRAN_BUILDDIR - Directory containing srsran build
# /usr/lib64/libasn1_utils.a
# /usr/lib64/libsrsran_mac.a
# /usr/lib64/libnas_5g_msg.a
# /usr/lib64/libsrsran_common.a
# /usr/lib64/librrc_nr_asn1.a
# /usr/lib64/libngap_nr_asn1.a
# /usr/lib64/libs1ap_asn1.a
# /usr/lib64/librrc_asn1.a
# /usr/lib64/libsrsran_rlc.a
# /usr/lib64/libsrsran_phy.a
# /usr/lib64/libsrsran_pdcp.a
# /usr/lib64/libsrsran_gtpu.a
# /usr/lib64/libsrslog.a
find_package(PkgConfig)
pkg_check_modules(PC_SRSRAN QUIET srsran)
set(SRSRAN_DEFINITIONS ${PC_SRSRAN_CFLAGS_OTHER})
FIND_PATH(
SRSRAN_INCLUDE_DIRS
NAMES srsran/srsran.h
HINTS $ENV{SRSRAN_DIR}/include
${SRSRAN_SRCDIR}/srsran/include
${PC_SRSRAN_INCLUDEDIR}
${CMAKE_INSTALL_PREFIX}/include
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
SRSRAN_LIBRARY
NAMES srsran_common
HINTS $ENV{SRSRAN_DIR}/lib
${SRSRAN_BUILDDIR}/srsran/lib
${PC_SRSRAN_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
FIND_LIBRARY(
SRSRAN_LIBRARY_RADIO
NAMES srsran_radio
HINTS $ENV{SRSRAN_DIR}/lib
${SRSRAN_BUILDDIR}/srsran/lib
${PC_SRSRAN_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
#FIND_LIBRARY(
# SRSRAN_LIBRARY_UPPER
# NAMES srsran_upper
# HINTS $ENV{SRSRAN_DIR}/lib
# ${SRSRAN_BUILDDIR}/srsran/lib
# ${PC_SRSRAN_LIBDIR}
# ${CMAKE_INSTALL_PREFIX}/lib
# ${CMAKE_INSTALL_PREFIX}/lib64
# PATHS /usr/local/lib
# /usr/local/lib64
# /usr/lib
# /usr/lib64
#)
FIND_LIBRARY(
SRSRAN_LIBRARY_ASN1
NAMES rrc_asn1
HINTS $ENV{SRSRAN_DIR}/lib
${SRSRAN_BUILDDIR}/srsran/lib
${PC_SRSRAN_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
FIND_LIBRARY(
SRSRAN_LIBRARY_PHY
NAMES srsran_phy
HINTS $ENV{SRSRAN_DIR}/lib
${SRSRAN_BUILDDIR}/srsran/lib
${PC_SRSRAN_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
FIND_LIBRARY(
SRSRAN_LIBRARY_RF
NAMES srsran_rf
HINTS $ENV{SRSRAN_DIR}/lib
${SRSRAN_BUILDDIR}/srsran/lib
${PC_SRSRAN_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
#FIND_LIBRARY(
# SRSRAN_LIBRARY_RF_UTILS
# NAMES srsran_rf_utils
# HINTS $ENV{SRSRAN_DIR}/lib
# ${SRSRAN_BUILDDIR}/srsran/lib
# ${PC_SRSRAN_LIBDIR}
# ${CMAKE_INSTALL_PREFIX}/lib
# ${CMAKE_INSTALL_PREFIX}/lib64
# PATHS /usr/local/lib
# /usr/local/lib64
# /usr/lib
# /usr/lib64
#)
IF(DEFINED SRSRAN_SRCDIR)
set(SRSRAN_INCLUDE_DIRS ${SRSRAN_SRCDIR}/srsran
${SRSRAN_SRCDIR}/cuhd
${SRSRAN_SRCDIR}/common
${SRSRAN_SRCDIR}/radio
${SRSRAN_SRCDIR}/upper
${SRSRAN_SRCDIR}/phy
${SRSRAN_SRCDIR}/asn1)
ENDIF(DEFINED SRSRAN_SRCDIR)
# ${SRSRAN_LIBRARY_RF}
# ${SRSRAN_LIBRARY_RADIO}
set(SRSRAN_LIBRARIES ${SRSRAN_LIBRARY}
${SRSRAN_LIBRARY_RF_UTILS}
${SRSRAN_LIBRARY_PHY}
# ${SRSRAN_LIBRARY_UPPER}
${SRSRAN_LIBRARY_ASN1}
)
if(SRSRAN_LIBRARY_RF)
list(APPEND SRSRAN_LIBRARIES ${SRSRAN_LIBRARY_RF})
endif(SRSRAN_LIBRARY_RF)
if(SRSRAN_LIBRARY_RADIO)
list(APPEND SRSRAN_LIBRARIES ${SRSRAN_LIBRARY_RADIO})
endif(SRSRAN_LIBRARY_RADIO)
message(STATUS "SRSRAN LIBRARIES are: " ${SRSRAN_LIBRARIES})
message(STATUS "SRSRAN INCLUDE DIRS: " ${SRSRAN_INCLUDE_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SRSRAN DEFAULT_MSG SRSRAN_LIBRARIES SRSRAN_INCLUDE_DIRS)
MARK_AS_ADVANCED(SRSRAN_LIBRARIES SRSRAN_INCLUDE_DIRS)

View file

@ -0,0 +1,21 @@
add_subdirectory(falcon_rf)
add_subdirectory(falcon_ue)
add_subdirectory(falcon_phch)
set(falcon_objs
$<TARGET_OBJECTS:falcon_ue>
$<TARGET_OBJECTS:falcon_phch>
)
add_library(falcon_phy STATIC ${falcon_objs})
target_link_libraries(falcon_phy
${SRSRAN_LIBRARIES}
${FFT_LIBRARIES}
pthread
${Boost_LIBRARIES})
install(
TARGETS falcon_phy
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>unknown@pentoo.ch</email>
<name>Author Unknown</name>
</maintainer>
<upstream>
<remote-id type="github">SysSec-KAIST/LTESniffer</remote-id>
</upstream>
</pkgmetadata>

View file

@ -0,0 +1 @@
DIST srsran2-20231020.gh.tar.gz 14603567 BLAKE2B 6bd42dcf2dc1db6de60f9e0ae17fc6109a93c91acfea734aa8e697f167d47ac2a7845b58a694a92fe49c65c67710b0716317711b6c69842e6f1a69f9ffbc4600 SHA512 ecbdc0bf34a5406a52f1d1cd10a965f6f6a0470d19e1b86a62958802e1efeea38b36f00e732062a6e1aae993c81f60795784012dfd28222e6d385bb28cbc4f48

View file

@ -0,0 +1,10 @@
--- a/lib/include/srsran/srslog/bundled/fmt/core.orig 2024-04-16 23:06:12.274398114 +0800
+++ b/lib/include/srsran/srslog/bundled/fmt/core.h 2024-04-16 23:06:21.692398308 +0800
@@ -16,6 +16,7 @@
#include <string>
#include <type_traits>
#include <vector>
+#include <array>
// The fmt library version in the form major * 10000 + minor * 100 + patch.
#define FMT_VERSION 70003

View file

@ -0,0 +1,11 @@
--- a/lib/src/asn1/CMakeLists.txt.orig 2024-04-17 00:41:47.811516417 +0800
+++ b/lib/src/asn1/CMakeLists.txt 2024-04-17 00:43:25.597518434 +0800
@@ -24,6 +24,8 @@
liblte_mme.cc
gtpc.cc
)
+target_link_libraries(srsran_asn1 asn1_utils srsran_common srslog)
+INSTALL(TARGETS srsran_asn1 DESTINATION ${LIBRARY_DIR})
# ASN1 utils
add_library(asn1_utils STATIC asn1_utils.cc)

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<use>
<flag name="uhd">support Ettus Research hardware</flag>
<flag name="bladerf">support Nuand BladeRF hardware</flag>
<flag name="soapysdr">use soapysdr to support various hardware</flag>
<flag name="simcard">support hardware sim cards</flag>
<flag name="zeromq">enable zeromq message passing</flag>
</use>
<upstream>
<remote-id type="github">srsRAN/srsRAN</remote-id>
</upstream>
</pkgmetadata>

View file

@ -0,0 +1,110 @@
# Copyright 2019-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake flag-o-matic
DESCRIPTION="Open source SDR 4G software suite from Software Radio Systems"
HOMEPAGE="https://github.com/hdtuanss/srsRAN2"
# Possible issues to look into
#https://bugs.gentoo.org/713684
#https://bugs.gentoo.org/731720
#https://bugs.gentoo.org/733662
#https://bugs.gentoo.org/832618
KEYWORDS="~amd64 ~x86"
HASH_COMMIT="4809688a2d645d5b506343c424d8ae39a01d3e3a"
SRC_URI="https://github.com/hdtuanss/srsRAN2/archive/${HASH_COMMIT}.tar.gz -> ${P}.gh.tar.gz"
RESTRICT="!test? ( test )"
LICENSE="GPL-3"
SLOT="0"
IUSE="bladerf cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_avx512f cpu_flags_x86_fma3 cpu_flags_x86_sse simcard soapysdr test uhd zeromq"
#Add cpu_flags_x86_avx2= after fixing whatever build failure
DEPEND="
dev-libs/boost:=
dev-libs/elfutils
dev-libs/libconfig:=[cxx]
net-misc/lksctp-tools
net-libs/mbedtls:=
sci-libs/fftw:3.0=[cpu_flags_x86_avx=,cpu_flags_x86_fma3=,cpu_flags_x86_sse=]
bladerf? ( net-wireless/bladerf:= )
simcard? ( sys-apps/pcsc-lite )
soapysdr? ( net-wireless/soapysdr:= )
uhd? ( net-wireless/uhd:= )
zeromq? ( net-libs/zeromq:= )
"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"
S="${WORKDIR}/srsRAN2-${HASH_COMMIT}"
src_prepare() {
eapply "${FILESDIR}"/srsran2_array.patch
eapply "${FILESDIR}"/srsran2_asn1_lib.patch
sed -i '/ -Werror"/d' CMakeLists.txt || die
#break upstream hijacking of cflags
sed -i \
-e 's/"GNU"/"NERF"/g' \
-e 's/"Clang"/"NERF"/g' \
-e 's/Ninja/NERF/g' \
-e 's/GNUCXX/NERF/g' \
-e 's/set(CMAKE_C_FLAGS/set(CMAKE_C_FLAGS_NERF/g' \
CMakeLists.txt
cmake_src_prepare
}
src_configure() {
#This may be a bad idea, and it is a bad idea for sure when other tests are failing
#-DENABLE_ALL_TEST="$(usex test)"
#-DENABLE_TTCN3="$(usex test)"
#Maybe make this one depend on zmq instead?
#-DENABLE_ZMQ_TEST="$(usex test)"
# Add missing srsGUI
#-DENABLE_GUI="$(usex gui)"
mycmakeargs=(
-DENABLE_UHD="$(usex uhd)"
-DENABLE_BLADERF="$(usex bladerf)"
-DENABLE_SOAPYSDR="$(usex soapysdr)"
-DENABLE_ZEROMQ="$(usex zeromq)"
-DENABLE_HARDSIM="$(usex simcard)"
-DCMAKE_C_FLAGS_RELWITHDEBINFO="${CFLAGS}"
)
# readd nerfed cflags that are required
append-cflags "-std=c99 -fno-strict-aliasing -D_GNU_SOURCE"
append-cxxflags "-std=c++14 -fno-strict-aliasing -D_GNU_SOURCE"
# "fix" "auto-detection" from use flags, this is probably horrible
if use cpu_flags_x86_sse; then
append-cflags "-DLV_HAVE_SSE -mfpmath=sse -msse4.1"
append-cxxflags "-DLV_HAVE_SSE -mfpmath=sse -msse4.1"
fi
if use cpu_flags_x86_avx; then
append-cflags "-DLV_HAVE_AVX -mavx"
append-cxxflags "-DLV_HAVE_AVX -mavx"
fi
#if use cpu_flags_x86_avx2; then
# append-cflags "-DLV_HAVE_AVX2 -mavx2"
# append-cxxflags "-DLV_HAVE_AVX2 -mavx2"
#fi
#https://github.com/pentoo/pentoo-overlay/issues/1491
#if use cpu_flags_x86_avx512f; then
# append-cflags "-DLV_HAVE_AVX512 -mavx512f"
# append-cxxflags "-DLV_HAVE_AVX512 -mavx512f"
#fi
if use cpu_flags_x86_fma3; then
append-cflags "-DLV_HAVE_FMA -mfma"
append-cxxflags "-DLV_HAVE_FMA -mfma"
fi
cmake_src_configure
}
#FIXME:
# also, install the following include files:
#/usr/include/srsenb
#/usr/include/srsue

View file

@ -91,6 +91,7 @@ net-wireless/kismetmobiledashboard
net-wireless/multimode
net-wireless/srsran
net-wireless/srsran2
#below here likely needs cleanup
#### Gentoo (to be cleaned)