From b554121e765a3495e23975112f269a8083950212 Mon Sep 17 00:00:00 2001
From: "A. Maitland Bottoms" <bottoms@debian.org>
Date: Tue, 27 Mar 2018 22:01:33 -0400
Subject: [PATCH 1/6] native armv7 build support

Debian, unlike other GNU Radio deployments, does not cross-compile
packages, but builds natively on a set of build machines, including
both arm and armhf.
---
 lib/CMakeLists.txt | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -250,6 +250,13 @@
 endif(NOT CPU_IS_x86)
 
 ########################################################################
+# if building Debian armel, eliminate neon
+########################################################################
+if(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "arm-linux-gnueabi")
+    OVERRULE_ARCH(neon "Architecture is not armhf")
+endif(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "arm-linux-gnueabi")
+
+########################################################################
 # implement overruling in the ORC case,
 # since ORC always passes flag detection
 ########################################################################
@@ -404,7 +411,7 @@
 # Handle ASM support
 #  on by default, but let users turn it off
 ########################################################################
-if(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
+if((${CMAKE_VERSION} VERSION_GREATER "2.8.9") AND NOT (${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "arm-linux-gnueabi"))
   set(ASM_ARCHS_AVAILABLE "neon")
 
   set(FULL_C_FLAGS "${CMAKE_C_FLAGS}" "${CMAKE_CXX_COMPILER_ARG1}")
@@ -414,7 +421,7 @@
   # set up the assembler flags and include the source files
   foreach(ARCH ${ASM_ARCHS_AVAILABLE})
       string(REGEX MATCH "${ARCH}" ASM_ARCH "${available_archs}")
-    if( ASM_ARCH STREQUAL "neon" )
+    if(( ASM_ARCH STREQUAL "neon" ) OR ( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7"))
       message(STATUS "---- Adding ASM files") # we always use ATT syntax
       message(STATUS "-- Detected neon architecture; enabling ASM")
       # setup architecture specific assembler flags
@@ -433,7 +440,7 @@
     message(STATUS "asm flags: ${CMAKE_ASM_FLAGS}")
   endforeach(ARCH)
 
-else(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
+else((${CMAKE_VERSION} VERSION_GREATER "2.8.9") AND NOT (${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "arm-linux-gnueabi"))
   message(STATUS "Not enabling ASM support. CMake >= 2.8.10 required.")
   foreach(machine_name ${available_machines})
     string(REGEX MATCH "neon" NEON_MACHINE ${machine_name})
@@ -441,7 +448,7 @@
       message(FATAL_ERROR "CMake >= 2.8.10 is required for ARM NEON support")
     endif()
   endforeach()
-endif(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
+endif((${CMAKE_VERSION} VERSION_GREATER "2.8.9") AND NOT (${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "arm-linux-gnueabi"))
 
 ########################################################################
 # Handle orc support
