Skip to content

Commit

Permalink
fftw3 - add support for Apple silicon and fix preprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
PovlAbrahamsen committed Jul 16, 2023
1 parent 54cae4a commit 9d96a15
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
20 changes: 14 additions & 6 deletions 10.9-libcxx/stable/main/finkinfo/sci/fftw3.info
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
Info2: <<
Package: fftw3
Version: 3.3.10
Revision: 2
Revision: 3
Maintainer: None <[email protected]>

Type: gcc (11)

Source: https://www.fftw.org/fftw-%v.tar.gz
Source-Checksum: SHA256(56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467)
PatchFile: %n.patch
PatchFile-MD5: aa44173ecfe7a85cbc78c76ddcff971c
BuildDepends: gcc%type_raw[gcc]-compiler
Depends: %N-shlibs (= %v-%r)
BuildDependsOnly: True
Expand All @@ -18,23 +20,25 @@ ConfigureParams: <<
--enable-threads \
--disable-mpi \
--enable-fortran \
--enable-sse2 \
--enable-avx \
--enable-avx2 \
( "%m" != "arm64" ) --enable-sse2 \
( "%m" != "arm64" ) --enable-avx \
( "%m" != "arm64" ) --enable-avx2 \
( "%m" = "arm64" ) --enable-armv8-cntvct-el0 \
--mandir='${prefix}/share/man' \
--infodir='${prefix}/share/info'
<<
GCC: 4.0
InfoTest: TestScript: touch %b/INSTALL_MAKE_CHECK; make check || exit 2
PatchScript: <<
%{default_script}
# Patch configure to not link like Puma on Yosemite
perl -pi.bak -e 's|10\.\[012\]\*|10.[012][,.]*|g' configure
<<
CompileScript: <<
#!/bin/sh -ev
gcclib=`%p/bin/gfortran-fsf-%type_raw[gcc] --print-lib`
FLIBDIR=`dirname $gcclib`
CPP=`which cpp` CC=%p/bin/gcc-fsf-%type_raw[gcc] CFLAGS="-I`xcrun --sdk macosx --show-sdk-path`/usr/include" F77=%p/bin/gfortran-fsf-%type_raw[gcc] FLIBS="-L${FLIBDIR}" ./configure %c
CPP="%p/bin/gcc-fsf-%type_raw[gcc] -E" CC=%p/bin/gcc-fsf-%type_raw[gcc] CPPFLAGS="-I`xcrun --sdk macosx --show-sdk-path`/usr/include" F77=%p/bin/gfortran-fsf-%type_raw[gcc] FLIBS="-L${FLIBDIR}" ./configure %c
make
<<
InstallScript: <<
Expand All @@ -46,7 +50,11 @@ InstallScript: <<
make clean
gcclib=`%p/bin/gfortran-fsf-%type_raw[gcc] --print-lib`
FLIBDIR=`dirname $gcclib`
CPP=`which cpp` CC=%p/bin/gcc-fsf-%type_raw[gcc] CFLAGS="-I`xcrun --sdk macosx --show-sdk-path`/usr/include" F77=%p/bin/gfortran-fsf-%type_raw[gcc] FLIBS="-L${FLIBDIR}" ./configure %c --enable-float --enable-sse
if [ "%m" = "arm64" ]; then
CPP="%p/bin/gcc-fsf-%type_raw[gcc] -E" CC=%p/bin/gcc-fsf-%type_raw[gcc] CPPFLAGS="-I`xcrun --sdk macosx --show-sdk-path`/usr/include" F77=%p/bin/gfortran-fsf-%type_raw[gcc] FLIBS="-L${FLIBDIR}" ./configure %c --enable-float
else
CPP="%p/bin/gcc-fsf-%type_raw[gcc] -E" CC=%p/bin/gcc-fsf-%type_raw[gcc] CPPFLAGS="-I`xcrun --sdk macosx --show-sdk-path`/usr/include" F77=%p/bin/gfortran-fsf-%type_raw[gcc] FLIBS="-L${FLIBDIR}" ./configure %c --enable-float --enable-sse
fi
make
if [ -f %b/INSTALL_MAKE_CHECK ]; then
make check
Expand Down
12 changes: 12 additions & 0 deletions 10.9-libcxx/stable/main/finkinfo/sci/fftw3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -Nurd fftw-3.3.10.orig/kernel/cycle.h fftw-3.3.10/kernel/cycle.h
--- fftw-3.3.10.orig/kernel/cycle.h 2023-07-16 16:02:45
+++ fftw-3.3.10/kernel/cycle.h 2023-07-16 16:04:25
@@ -539,7 +539,7 @@
#define HAVE_TICK_COUNTER
#endif

-#if defined(__aarch64__) && defined(HAVE_ARMV8_CNTVCT_EL0) && !defined(HAVE_ARMV8_PMCCNTR_EL0)
+#if defined(__aarch64__) && (defined(__APPLE__) || defined(HAVE_ARMV8_CNTVCT_EL0)) && !defined(HAVE_ARMV8_PMCCNTR_EL0)
typedef uint64_t ticks;
static inline ticks getticks(void)
{

0 comments on commit 9d96a15

Please sign in to comment.