[113561] trunk/dports/science/gnuradio

michaelld at macports.org michaelld at macports.org
Tue Nov 19 13:07:33 PST 2013


Revision: 113561
          https://trac.macports.org/changeset/113561
Author:   michaelld at macports.org
Date:     2013-11-19 13:07:33 -0800 (Tue, 19 Nov 2013)
Log Message:
-----------
gnuradio:
+ update devel to d04a3d34 and next to 1ee761de, both 20131118;
+ fix legacy build on 10.9;
+ patch to check for AVX correctly: both xgetbv and cvtpi32_ps;
+ remove +full from prior installs when updating;
+ remove blacklisting, since all compilers now seem to work;
+ hopefully addresses ticket #41162.

Modified Paths:
--------------
    trunk/dports/science/gnuradio/Portfile
    trunk/dports/science/gnuradio/files/patch-path-order.diff

Added Paths:
-----------
    trunk/dports/science/gnuradio/files/patch-gnuradio-core_swig_include-std_string.i.diff
    trunk/dports/science/gnuradio/files/patch-gnuradio-core_swig_std_std_container.i.diff
    trunk/dports/science/gnuradio/files/patch-gnuradio-runtime_swig_include-std_string.i.diff
    trunk/dports/science/gnuradio/files/patch-volk_gen_archs.xml.legacy.diff
    trunk/dports/science/gnuradio/files/patch-volk_lib_CMakeLists.txt.diff
    trunk/dports/science/gnuradio/files/patch-volk_lib_CMakeLists.txt.legacy.diff

Removed Paths:
-------------
    trunk/dports/science/gnuradio/files/patch-swig-include-std_string.i.diff

Modified: trunk/dports/science/gnuradio/Portfile
===================================================================
--- trunk/dports/science/gnuradio/Portfile	2013-11-19 20:32:50 UTC (rev 113560)
+++ trunk/dports/science/gnuradio/Portfile	2013-11-19 21:07:33 UTC (rev 113561)
@@ -5,7 +5,6 @@
 PortGroup           cmake 1.0
 PortGroup           wxWidgets 1.0
 PortGroup           active_variants 1.1
-PortGroup           compiler_blacklist_versions 1.0
 
 wxWidgets.use       wxPython-3.0
 
@@ -38,11 +37,6 @@
         rmd160  544dce18b81824437ed9919b4f65d3a3f4f9dceb \
         sha256  b80b42eaa091cb77a168e15b029307856db249d460ff06dfdf292802c19a2669
 
-    # patch for fix swig build on 10.9; tested on 10.8
-    # and does not seem to hurt.
-
-    patchfiles-append patch-swig-include-std_string.i.diff
-
     livecheck.url   http://gnuradio.org/releases/gnuradio/?C=M&O=D
     livecheck.regex >LATEST-IS-(\[^<\]*)<
 
@@ -51,7 +45,7 @@
 subport gnuradio-legacy {
 
     version         3.6.5.1
-    revision        3
+    revision        4
 
     long_description    ${description}: \
         This port is for GNU Radio ${version}, reflecting the final release in the 3.6 API series.  It is for legacy purposes only\; please consider updating your code to the GNU Radio 3.7 API.
@@ -66,9 +60,22 @@
         rmd160  66bdc05826e9130cf65e7bee355c01f4474c861b \
         sha256  0875d2f0a7da0f3bcc1771b528b0f98f79d9ab69aa1ef953651bbbe1f57b4621
 
-    patchfiles      patch-path-order.diff
-    patch.pre_args  -p1
+    # fix INCLUDE_DIRECTORIES path order such that internal
+    # directories are searched before ${prefix}/include or system
+    # ones.
 
+    patchfiles-append patch-path-order.diff
+
+    # add checks for xgetbv instruction and cvtpi32_ps intrinsic
+
+    patchfiles-append patch-volk_lib_CMakeLists.txt.legacy.diff
+
+    # fix VOLK arch generators to include clang
+
+    patchfiles-append patch-volk_gen_archs.xml.legacy.diff
+
+    # 3.6.5.1 is the last of the 3.6 API development
+
     livecheck.type  none
 
 }
@@ -78,13 +85,13 @@
     long_description    ${description}: \
         This port is kept up with the GNU Radio GIT 'master' branch, which is typically updated daily to weekly.  This version of GNU Radio generally contains fixes to, and its API is compatible with, the current GNU Radio release, and will be incorporated in an upcoming release.  This port may or not compile or function correctly, as it represents a work in progress.  If it does not work, check back in a few days.  Or try deactivating the currently active gnuradio port, cleaning any current builds, and trying again.
 
-    version             3.7.3_20131114
+    version             3.7.3_20131118
 
     conflicts           gnuradio-legacy gnuradio gnuradio-next
 
     fetch.type          git
     git.url             http://git.gnuradio.org/git/gnuradio.git
-    git.branch          3b27cc47e134e0ea33c1856d1afd6e87931607c9
+    git.branch          d04a3d340145ed14a64cf1e0e0615cab806ab357
 
     livecheck.url       http://gnuradio.org/cgit/gnuradio.git/log/?h=master
     livecheck.version   ${git.branch}
@@ -97,13 +104,13 @@
     long_description    ${description}: \
         This port is kept up with the GNU Radio GIT 'next' branch, which is typically updated daily to weekly.  This version of GNU Radio represents the next major release of GNU Radio, and hence its API is likely to be different than that provided by either gnuradio or gnuradio-devel.  This port may or not compile or function correctly, as it represents a work in progress.  If it does not work, check back in a few days.  Or try deactivating the currently active gnuradio port, cleaning any current builds, and trying again.
 
-    version             3.8.0_20131114
+    version             3.8.0_20131118
 
     conflicts           gnuradio-legacy gnuradio gnuradio-devel
 
     fetch.type          git
     git.url             http://git.gnuradio.org/git/gnuradio.git
-    git.branch          54d3961bdaaa708152e33264b95759bab4d94c87
+    git.branch          1ee761deea4b8b6ce2c503e080243ab20e90a80d
 
     livecheck.url       http://gnuradio.org/cgit/gnuradio.git/log/?h=next
     livecheck.version   ${git.branch}
@@ -131,34 +138,12 @@
 
     }
 
-    # GNU Radio 3.7.1+ works with Apple GCC, some Apple clang >=
-    # 500.2.79, and MacPorts clang 3.4 or newer; blacklist other
-    # compilers.
+    # add check for cvtpi32_ps intrinsic
 
-    if {${os.major} == 13} {
-        # works with Apple's clang 500.2.79 on 10.9, but not 10.8.
-        compiler.blacklist-append { clang < 500.2.79 }
-    } else {
-        compiler.blacklist-append clang
-    }
+    patchfiles-append patch-volk_lib_CMakeLists.txt.diff
 
-    compiler.blacklist-append \
-        macports-clang-2.9 macports-clang-3.1 \
-        macports-clang-3.2 macports-clang-3.3
-
-
-} else {
-
-    # legacy works with Apple GCC only, because the cmake build script
-    # does not robustly check for the xgetbv instruction; a fix for
-    # this issue is in release 3.7.1 and newer.
-
-    compiler.blacklist-append *clang* macports*
-
 }
 
-compiler.blacklist-append dragonegg*
-
 use_parallel_build  yes
 
 depends_lib-append  \
@@ -180,13 +165,33 @@
 
 platform darwin 13 {
     pre-patch {
-        set std_dest_dir ${worksrcpath}/gnuradio-runtime/swig/std
-        if {[file exists ${std_dest_dir}]} {
-            delete ${std_dest_dir}
+        if {${subport} eq "gnuradio-legacy"} {
+            # legacy has a different directory structure
+            set std_dest_dir ${worksrcpath}/gnuradio-core/src/lib/swig/std
+            if {[file exists ${std_dest_dir}]} {
+                delete ${std_dest_dir}
+            }
+            copy [glob ${prefix}/share/swig/*/std] ${std_dest_dir}
+            patchfiles-append \
+                patch-gnuradio-core_swig_std_std_container.i.diff \
+                patch-gnuradio-core_swig_include-std_string.i.diff
+        } else {
+            set std_dest_dir ${worksrcpath}/gnuradio-runtime/swig/std
+            if {[file exists ${std_dest_dir}]} {
+                delete ${std_dest_dir}
+            }
+            copy [glob ${prefix}/share/swig/*/std] ${std_dest_dir}
+            patchfiles-append \
+                patch-gnuradio-runtime_swig_std_std_container.i.diff
+            if {${subport} eq "gnuradio"} {
+                # patch for fix swig build on 10.9; tested on 10.8
+                # and does not seem to hurt.  This patch is already
+                # integrated upstream.
+                patchfiles-append \
+                    patch-gnuradio-runtime_swig_std_std_container.i.diff
+            }
         }
-        copy [glob ${prefix}/share/swig/*/std] ${std_dest_dir}
     }
-    patchfiles-append patch-gnuradio-runtime_swig_std_std_container.i.diff
 }
 
 # remove top-level include path, such that internal headers are used
@@ -234,6 +239,7 @@
 # shortcut to installing all variants except Python
 
 variant full description {Deprecated legacy variant} {}
+default_variants -full
 
 # per user concensus: enable all variants except +debug and +universal
 # (and, for next, except +ctrlport);

Added: trunk/dports/science/gnuradio/files/patch-gnuradio-core_swig_include-std_string.i.diff
===================================================================
--- trunk/dports/science/gnuradio/files/patch-gnuradio-core_swig_include-std_string.i.diff	                        (rev 0)
+++ trunk/dports/science/gnuradio/files/patch-gnuradio-core_swig_include-std_string.i.diff	2013-11-19 21:07:33 UTC (rev 113561)
@@ -0,0 +1,10 @@
+--- gnuradio-core/src/lib/swig/gnuradio.i.orig	2013-05-26 16:07:07.000000000 -0400
++++ gnuradio-core/src/lib/swig/gnuradio.i	2013-11-18 10:17:07.000000000 -0500
+@@ -28,6 +28,7 @@
+ // SWIG interface definition
+ ////////////////////////////////////////////////////////////////////////
+ 
++%include "std_string.i"
+ %include <gruel_common.i>
+ 
+ ////////////////////////////////////////////////////////////////////////

Added: trunk/dports/science/gnuradio/files/patch-gnuradio-core_swig_std_std_container.i.diff
===================================================================
--- trunk/dports/science/gnuradio/files/patch-gnuradio-core_swig_std_std_container.i.diff	                        (rev 0)
+++ trunk/dports/science/gnuradio/files/patch-gnuradio-core_swig_std_std_container.i.diff	2013-11-19 21:07:33 UTC (rev 113561)
@@ -0,0 +1,24 @@
+--- gnuradio-core/src/lib/swig/std/std_container.i.orig	2013-09-16 11:55:57.000000000 -0400
++++ gnuradio-core/src/lib/swig/std/std_container.i	2013-11-13 15:55:21.000000000 -0500
+@@ -46,8 +46,8 @@
+   void resize(size_type new_size);
+   
+   #ifdef SWIG_EXPORT_ITERATOR_METHODS
+-  iterator erase(iterator pos);
+-  iterator erase(iterator first, iterator last);
++  iterator erase(const_iterator pos);
++  iterator erase(const_iterator first, const_iterator last);
+   #endif
+   
+ %enddef
+@@ -68,8 +68,8 @@
+   void resize(size_type new_size, const value_type& x);
+   
+   #ifdef SWIG_EXPORT_ITERATOR_METHODS
+-  iterator insert(iterator pos, const value_type& x);
+-  void insert(iterator pos, size_type n, const value_type& x);
++  iterator insert(const_iterator pos, const value_type& x);
++  void insert(const_iterator pos, size_type n, const value_type& x);
+   #endif
+   
+ %enddef

Copied: trunk/dports/science/gnuradio/files/patch-gnuradio-runtime_swig_include-std_string.i.diff (from rev 113537, trunk/dports/science/gnuradio/files/patch-swig-include-std_string.i.diff)
===================================================================
--- trunk/dports/science/gnuradio/files/patch-gnuradio-runtime_swig_include-std_string.i.diff	                        (rev 0)
+++ trunk/dports/science/gnuradio/files/patch-gnuradio-runtime_swig_include-std_string.i.diff	2013-11-19 21:07:33 UTC (rev 113561)
@@ -0,0 +1,20 @@
+--- gnuradio-runtime/swig/gnuradio.i
++++ gnuradio-runtime/swig/gnuradio.i
+@@ -28,6 +28,7 @@
+ // SWIG interface definition
+ ////////////////////////////////////////////////////////////////////////
+ 
++%include "std_string.i"
+ %include <gr_extras.i>
+ 
+ #ifdef SW_RUNTIME
+--- gnuradio-runtime/swig/gr_types.i
++++ gnuradio-runtime/swig/gr_types.i
+@@ -23,7 +23,6 @@
+ #ifndef SWIG_GR_TYPES_I
+ #define SWIG_GR_TYPES_I
+ 
+-%include "std_string.i"
+ %include "stdint.i"
+ 
+ %{

Modified: trunk/dports/science/gnuradio/files/patch-path-order.diff
===================================================================
--- trunk/dports/science/gnuradio/files/patch-path-order.diff	2013-11-19 20:32:50 UTC (rev 113560)
+++ trunk/dports/science/gnuradio/files/patch-path-order.diff	2013-11-19 21:07:33 UTC (rev 113561)
@@ -1,7 +1,5 @@
-diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
-index b9bf0bb..eb2dce3 100644
---- a/cmake/Modules/GrSwig.cmake
-+++ b/cmake/Modules/GrSwig.cmake
+--- cmake/Modules/GrSwig.cmake.orig
++++ cmake/Modules/GrSwig.cmake
 @@ -118,8 +118,8 @@ macro(GR_SWIG_MAKE name)
      find_package(PythonLibs)
      list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
@@ -13,10 +11,8 @@
  
      #determine include dependencies for swig file
      execute_process(
-diff --git a/gr-audio/lib/CMakeLists.txt b/gr-audio/lib/CMakeLists.txt
-index c9e2806..48f4445 100644
---- a/gr-audio/lib/CMakeLists.txt
-+++ b/gr-audio/lib/CMakeLists.txt
+--- gr-audio/lib/CMakeLists.txt.orig
++++ gr-audio/lib/CMakeLists.txt
 @@ -20,18 +20,6 @@
  ########################################################################
  # Setup the include and linker paths
@@ -124,10 +120,8 @@
  add_library(gnuradio-audio SHARED ${gr_audio_sources})
  target_link_libraries(gnuradio-audio ${gr_audio_libs})
  GR_LIBRARY_FOO(gnuradio-audio RUNTIME_COMPONENT "audio_runtime" DEVEL_COMPONENT "audio_devel")
-diff --git a/gruel/CMakeLists.txt b/gruel/CMakeLists.txt
-index 3e8c516..627135a 100644
---- a/gruel/CMakeLists.txt
-+++ b/gruel/CMakeLists.txt
+--- gruel/CMakeLists.txt.orig
++++ gruel/CMakeLists.txt
 @@ -37,7 +37,6 @@ include(GrMiscUtils)
  GR_SET_GLOBAL(GRUEL_INCLUDE_DIRS
      ${CMAKE_CURRENT_SOURCE_DIR}/src/include

Deleted: trunk/dports/science/gnuradio/files/patch-swig-include-std_string.i.diff
===================================================================
--- trunk/dports/science/gnuradio/files/patch-swig-include-std_string.i.diff	2013-11-19 20:32:50 UTC (rev 113560)
+++ trunk/dports/science/gnuradio/files/patch-swig-include-std_string.i.diff	2013-11-19 21:07:33 UTC (rev 113561)
@@ -1,20 +0,0 @@
---- gnuradio-runtime/swig/gnuradio.i
-+++ gnuradio-runtime/swig/gnuradio.i
-@@ -28,6 +28,7 @@
- // SWIG interface definition
- ////////////////////////////////////////////////////////////////////////
- 
-+%include "std_string.i"
- %include <gr_extras.i>
- 
- #ifdef SW_RUNTIME
---- gnuradio-runtime/swig/gr_types.i
-+++ gnuradio-runtime/swig/gr_types.i
-@@ -23,7 +23,6 @@
- #ifndef SWIG_GR_TYPES_I
- #define SWIG_GR_TYPES_I
- 
--%include "std_string.i"
- %include "stdint.i"
- 
- %{

Added: trunk/dports/science/gnuradio/files/patch-volk_gen_archs.xml.legacy.diff
===================================================================
--- trunk/dports/science/gnuradio/files/patch-volk_gen_archs.xml.legacy.diff	                        (rev 0)
+++ trunk/dports/science/gnuradio/files/patch-volk_gen_archs.xml.legacy.diff	2013-11-19 21:07:33 UTC (rev 113561)
@@ -0,0 +1,106 @@
+--- volk/gen/archs.xml.orig
++++ volk/gen/archs.xml
+@@ -33,6 +33,7 @@
+       <param>29</param>         <!-- bit shift -->
+   </check>
+   <flag compiler="gnu">-m64</flag>
++  <flag compiler="clang">-m64</flag>
+ </arch>
+ 
+ <arch name="3dnow">
+@@ -42,6 +43,7 @@
+       <param>31</param>
+   </check>
+   <flag compiler="gnu">-m3dnow</flag>
++  <flag compiler="clang">-m3dnow</flag>
+   <alignment>8</alignment>
+ </arch>
+ 
+@@ -52,6 +54,7 @@
+       <param>5</param>
+   </check>
+   <flag compiler="gnu">-msse4.2</flag>
++  <flag compiler="clang">-msse4.2</flag>  
+   <alignment>16</alignment>
+ </arch>
+ 
+@@ -62,6 +65,7 @@
+       <param>23</param>
+   </check>
+   <flag compiler="gnu">-mpopcnt</flag>
++  <flag compiler="clang">-mpopcnt</flag>
+   <flag compiler="msvc">/arch:AVX</flag>
+ </arch>
+ 
+@@ -72,6 +76,7 @@
+       <param>23</param>
+   </check>
+   <flag compiler="gnu">-mmmx</flag>
++  <flag compiler="clang">-mmmx</flag>
+   <flag compiler="msvc">/arch:SSE</flag>
+   <alignment>8</alignment>
+ </arch>
+@@ -83,6 +88,7 @@
+       <param>25</param>
+   </check>
+   <flag compiler="gnu">-msse</flag>
++  <flag compiler="clang">-msse</flag>
+   <flag compiler="msvc">/arch:SSE</flag>
+   <environment>_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);</environment>
+   <include>xmmintrin.h</include>
+@@ -96,6 +102,7 @@
+       <param>26</param>
+   </check>
+   <flag compiler="gnu">-msse2</flag>
++  <flag compiler="clang">-msse2</flag>
+   <flag compiler="msvc">/arch:SSE2</flag>
+   <alignment>16</alignment>
+ </arch>
+@@ -114,6 +121,7 @@
+       <param>0</param>
+   </check>
+   <flag compiler="gnu">-msse3</flag>
++  <flag compiler="clang">-msse3</flag>
+   <flag compiler="msvc">/arch:AVX</flag>
+   <environment>_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);</environment>
+   <include>pmmintrin.h</include>
+@@ -127,6 +135,7 @@
+       <param>9</param>
+   </check>
+   <flag compiler="gnu">-mssse3</flag>
++  <flag compiler="clang">-mssse3</flag>
+   <flag compiler="msvc">/arch:AVX</flag>
+   <alignment>16</alignment>
+ </arch>
+@@ -138,6 +147,7 @@
+       <param>6</param>
+   </check>
+   <flag compiler="gnu">-msse4a</flag>
++  <flag compiler="clang">-msse4a</flag>
+   <alignment>16</alignment>
+ </arch>
+ 
+@@ -148,6 +158,7 @@
+       <param>19</param>
+   </check>
+   <flag compiler="gnu">-msse4.1</flag>
++  <flag compiler="clang">-msse4.1</flag>
+   <flag compiler="msvc">/arch:AVX</flag>
+   <alignment>16</alignment>
+ </arch>
+@@ -159,6 +170,7 @@
+       <param>20</param>
+   </check>
+   <flag compiler="gnu">-msse4.2</flag>
++  <flag compiler="clang">-msse4.2</flag>
+   <flag compiler="msvc">/arch:AVX</flag>
+   <alignment>16</alignment>
+ </arch>
+@@ -178,6 +190,7 @@
+   <!-- check to see that the OS has enabled AVX -->
+   <check name="get_avx_enabled"></check>
+   <flag compiler="gnu">-mavx</flag>
++  <flag compiler="clang">-mavx</flag>
+   <flag compiler="msvc">/arch:AVX</flag>
+   <alignment>32</alignment>
+ </arch>

Added: trunk/dports/science/gnuradio/files/patch-volk_lib_CMakeLists.txt.diff
===================================================================
--- trunk/dports/science/gnuradio/files/patch-volk_lib_CMakeLists.txt.diff	                        (rev 0)
+++ trunk/dports/science/gnuradio/files/patch-volk_lib_CMakeLists.txt.diff	2013-11-19 21:07:33 UTC (rev 113561)
@@ -0,0 +1,54 @@
+--- volk/lib/CMakeLists.txt.orig
++++ volk/lib/CMakeLists.txt
+@@ -122,6 +122,7 @@ endmacro(OVERRULE_ARCH)
+ # the xgetbv instruction, or {if not cross-compiling and the xgetbv
+ # executable does not function correctly}.
+ ########################################################################
++set(HAVE_XGETBV 0)
+ if(CPU_IS_x86)
+     # check to see if the compiler/linker works with xgetb instruction
+     file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "unsigned long long _xgetbv(unsigned int index) { unsigned int eax, edx; __asm__ __volatile__(\"xgetbv\" : \"=a\"(eax), \"=d\"(edx) : \"c\"(index)); return ((unsigned long long)edx << 32) | eax; } int main (void) { (void) _xgetbv(0); return (0); }")
+@@ -139,17 +140,41 @@ if(CPU_IS_x86)
+         if(NOT ${avx_exe_result} EQUAL 0)
+             OVERRULE_ARCH(avx "CPU missing xgetbv.")
+         else()
+-            add_definitions(-DHAVE_XGETBV)
++            set(HAVE_XGETBV 1)
+         endif()
+     else()
+         # cross compiling and compiler/linker seems to work; assume working
+-        add_definitions(-DHAVE_XGETBV)
++        set(HAVE_XGETBV 1)
+     endif()
+     file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
+         ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c)
+ endif()
+ 
+ ########################################################################
++# eliminate AVX if cvtpi32_ps intrinsic fails on Apple
++########################################################################
++
++if(${HAVE_XGETBV} AND APPLE)
++    # check to see if the compiler/linker works with cvtpi32_ps instrinsic
++    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }")
++    execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o
++        ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
++        ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c
++        OUTPUT_QUIET ERROR_QUIET
++        RESULT_VARIABLE avx_compile_result)
++   if(NOT ${avx_compile_result} EQUAL 0)
++        OVERRULE_ARCH(avx "Compiler missing cvtpi32_ps instrinsic")
++	set(HAVE_XGETBV 0)
++    endif()
++    file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
++        ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c)
++endif()
++
++if(${HAVE_XGETBV})
++    add_definitions(-DHAVE_XGETBV)
++endif()
++
++########################################################################
+ # implement overruling in the ORC case,
+ # since ORC always passes flag detection
+ ########################################################################

Added: trunk/dports/science/gnuradio/files/patch-volk_lib_CMakeLists.txt.legacy.diff
===================================================================
--- trunk/dports/science/gnuradio/files/patch-volk_lib_CMakeLists.txt.legacy.diff	                        (rev 0)
+++ trunk/dports/science/gnuradio/files/patch-volk_lib_CMakeLists.txt.legacy.diff	2013-11-19 21:07:33 UTC (rev 113561)
@@ -0,0 +1,70 @@
+--- volk/lib/CMakeLists.txt.orig	2013-11-19 13:41:47.000000000 -0500
++++ volk/lib/CMakeLists.txt	2013-11-19 13:42:28.000000000 -0500
+@@ -118,15 +118,60 @@
+ endmacro(OVERRULE_ARCH)
+ 
+ ########################################################################
+-# eliminate AVX on GCC < 4.4
+-# even though it accepts -mavx, as won't assemble xgetbv, which we need
++# eliminate AVX on if not on x86, or if the compiler does not accept
++# the xgetbv instruction, or {if not cross-compiling and the xgetbv
++# executable does not function correctly}.
++########################################################################
++set(HAVE_XGETBV 0)
++if(CPU_IS_x86)
++    # check to see if the compiler/linker works with xgetb instruction
++    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c "unsigned long long _xgetbv(unsigned int index) { unsigned int eax, edx; __asm__ __volatile__(\"xgetbv\" : \"=a\"(eax), \"=d\"(edx) : \"c\"(index)); return ((unsigned long long)edx << 32) | eax; } int main (void) { (void) _xgetbv(0); return (0); }")
++    execute_process(COMMAND ${CMAKE_C_COMPILER} -o
++        ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
++        ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c
++        OUTPUT_QUIET ERROR_QUIET
++        RESULT_VARIABLE avx_compile_result)
++    if(NOT ${avx_compile_result} EQUAL 0)
++        OVERRULE_ARCH(avx "Compiler or linker missing xgetbv instruction")
++    elseif(NOT CROSSCOMPILE_MULTILIB)
++        execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
++            OUTPUT_QUIET ERROR_QUIET
++            RESULT_VARIABLE avx_exe_result)
++        if(NOT ${avx_exe_result} EQUAL 0)
++            OVERRULE_ARCH(avx "CPU missing xgetbv.")
++        else()
++            set(HAVE_XGETBV 1)
++        endif()
++    else()
++        # cross compiling and compiler/linker seems to work; assume working
++        set(HAVE_XGETBV 1)
++    endif()
++    file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv
++        ${CMAKE_CURRENT_BINARY_DIR}/test_xgetbv.c)
++endif()
++
+ ########################################################################
+-if(CPU_IS_x86 AND COMPILER_NAME MATCHES "GNU")
+-    execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
+-        OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+-    if(GCC_VERSION VERSION_LESS "4.4")
+-        OVERRULE_ARCH(avx "GCC missing xgetbv")
++# eliminate AVX if cvtpi32_ps intrinsic fails on Apple
++########################################################################
++
++if(${HAVE_XGETBV} AND APPLE)
++    # check to see if the compiler/linker works with cvtpi32_ps instrinsic
++    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }")
++    execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o
++        ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
++        ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c
++        OUTPUT_QUIET ERROR_QUIET
++        RESULT_VARIABLE avx_compile_result)
++   if(NOT ${avx_compile_result} EQUAL 0)
++        OVERRULE_ARCH(avx "Compiler missing cvtpi32_ps instrinsic")
++	set(HAVE_XGETBV 0)
+     endif()
++    file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
++        ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c)
++endif()
++
++if(${HAVE_XGETBV})
++    add_definitions(-DHAVE_XGETBV)
+ endif()
+ 
+ ########################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131119/8c7ff316/attachment-0001.html>


More information about the macports-changes mailing list