[arch-commits] Commit in grace/trunk (PKGBUILD grace-fftw3.patch)

Antonio Rojas arojas at archlinux.org
Thu Nov 2 07:58:17 UTC 2017


    Date: Thursday, November 2, 2017 @ 07:58:17
  Author: arojas
Revision: 265083

libva 2.0.0 rebuild, fix build with fftw3

Added:
  grace/trunk/grace-fftw3.patch
Modified:
  grace/trunk/PKGBUILD

-------------------+
 PKGBUILD          |   19 ++-
 grace-fftw3.patch |  258 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 270 insertions(+), 7 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2017-11-02 07:58:03 UTC (rev 265082)
+++ PKGBUILD	2017-11-02 07:58:17 UTC (rev 265083)
@@ -5,21 +5,26 @@
 
 pkgname=grace
 pkgver=5.1.25
-pkgrel=5
+pkgrel=6
 pkgdesc="2D plotting tool"
 arch=(i686 x86_64)
 url="http://plasma-gate.weizmann.ac.il/Grace/"
-depends=('libjpeg' 'libpng' 'openmotif' 't1lib' 'netcdf')
-makedepends=('netcdf' 'fftw')
+depends=('libjpeg' 'libpng' 'openmotif' 't1lib' 'netcdf' 'fftw')
 license=('GPL')
 options=('staticlibs')
-source=(ftp://plasma-gate.weizmann.ac.il/pub/grace/src/grace5/$pkgname-$pkgver.tar.gz)
-md5sums=('c0482b1f18b113192946a96f5ff35a4d')
+source=(ftp://plasma-gate.weizmann.ac.il/pub/grace/src/grace5/$pkgname-$pkgver.tar.gz grace-fftw3.patch)
+md5sums=('c0482b1f18b113192946a96f5ff35a4d'
+         '0c61460189e4d19713e59a84c28f23c2')
 
+prepare() {
+  cd $pkgname-$pkgver
+  sed -i '1,1i#include <zlib.h>' src/rstdrv.c
+  sed -i 's|png_ptr->jmpbuf|png_jmpbuf(png_ptr)|g' src/rstdrv.c
+  patch -p1 -i ../grace-fftw3.patch # port to FFTW3 (Debian)
+}
+
 build() {
   cd "$srcdir"/$pkgname-$pkgver
-  sed -i '1,1i#include <zlib.h>' src/rstdrv.c
-  sed -i 's|png_ptr->jmpbuf|png_jmpbuf(png_ptr)|g' src/rstdrv.c
   ./configure   --prefix=/usr --exec-prefix=/usr \
 		--enable-grace-home=/usr/share/grace \
 		--includedir=/usr/include --libdir=/usr/lib \

Added: grace-fftw3.patch
===================================================================
--- grace-fftw3.patch	                        (rev 0)
+++ grace-fftw3.patch	2017-11-02 07:58:17 UTC (rev 265083)
@@ -0,0 +1,258 @@
+Description: Switch dependency from FFTW2 to FFTW3
+Author: Ionut Georgescu
+Bug: http://bugs.debian.org/264201
+Index: grace-5.1.24-patch/src/fourier.c
+===================================================================
+--- grace-5.1.24-patch.orig/src/fourier.c
++++ grace-5.1.24-patch/src/fourier.c
+@@ -230,7 +230,8 @@ static int bit_swap(int i, int nu)
+ #else
+ /* Start of new FFTW-based transforms by Marcus H. Mendenhall */
+ 
+-#include <fftw.h>
++#include <complex.h>
++#include <fftw3.h>
+ #include <string.h>
+ 
+ static char  *wisdom_file=0;
+@@ -258,7 +259,7 @@ void dft(double *jr, double *ji, int n,
+   fftw_plan plan;
+   int i;
+   double ninv;
+-  FFTW_COMPLEX *cbuf;
++  fftw_complex *cbuf;
+   static int wisdom_inited=0;
+   char *ram_cache_wisdom;
+   int plan_flags;
+@@ -274,7 +275,7 @@ void dft(double *jr, double *ji, int n,
+     if(wisdom_file && wisdom_file[0] ) {
+       /* if a file was specified in GRACE_FFTW_WISDOM_FILE, try to read it */
+       FILE *wf;
+-      fftw_status fstat;
++      int fstat;
+       wf=fopen(wisdom_file,"r");
+       if(wf) {
+ 	fstat=fftw_import_wisdom_from_file(wf);
+@@ -286,30 +287,35 @@ void dft(double *jr, double *ji, int n,
+     }
+   }
+ 
+-  plan_flags=using_wisdom? (FFTW_USE_WISDOM | FFTW_MEASURE) : FFTW_ESTIMATE;
+-
+-  plan=fftw_create_plan(n, iflag?FFTW_BACKWARD:FFTW_FORWARD,
+-		   plan_flags | FFTW_IN_PLACE);
+-  cbuf=xcalloc(n, sizeof(*cbuf));
++  /* fftw_malloc behaves like malloc except that it properly aligns the array
++   * when SIMD instructions (such as SSE and Altivec) are available.
++   */
++  cbuf=(fftw_complex *)fftw_malloc(n*sizeof(fftw_complex));
+   if(!cbuf) return;
++
+   for(i=0; i<n; i++) {
+-    cbuf[i].re=jr[i]; cbuf[i].im=ji[i];
++    cbuf[i] = jr[i] + I * ji[i];
+   }
+-  fftw(plan, 1, cbuf, 1, 1, 0, 1, 1);
++
++  plan_flags=using_wisdom? (FFTW_MEASURE) : FFTW_ESTIMATE;
++  plan=fftw_plan_dft_1d(n, cbuf, cbuf, iflag?FFTW_BACKWARD:FFTW_FORWARD,
++		   plan_flags);
++
++  fftw_execute(plan);
+   fftw_destroy_plan(plan);
+ 
+   if(!iflag) {
+     ninv=1.0/n;
+     for(i=0; i<n; i++) {
+-    jr[i]=cbuf[i].re*ninv; ji[i]=cbuf[i].im*ninv;
++    jr[i]=creal(cbuf[i])*ninv; ji[i]=cimag(cbuf[i])*ninv;
+     }
+   } else {
+     for(i=0; i<n; i++) {
+-      jr[i]=cbuf[i].re; ji[i]=cbuf[i].im;
++      jr[i]=creal(cbuf[i]); ji[i]=cimag(cbuf[i]);
+     }
+   }
+ 
+-  XCFREE(cbuf);
++  fftw_free(cbuf);
+   
+ }
+ 
+Index: grace-5.1.24-patch/ac-tools/configure.in
+===================================================================
+--- grace-5.1.24-patch.orig/ac-tools/configure.in
++++ grace-5.1.24-patch/ac-tools/configure.in
+@@ -554,8 +554,17 @@ fi
+ 
+ if test $fftw = true
+ then
+-  ACX_CHECK_FFTW(2.1.3, AC_DEFINE(HAVE_FFTW),
+-                 AC_MSG_RESULT(--> using legacy unoptimized FFT code))
++  AC_CHECK_HEADERS(fftw3.h,
++  [
++	AC_CHECK_LIB(fftw3, fftw_execute,
++	[
++		FFTW_LIB="-lfftw3"
++		AC_DEFINE(HAVE_FFTW)
++	],
++	[AC_MSG_RESULT([--> using legacy unoptimized FFT code])]
++	)
++  ],
++  [AC_MSG_RESULT([--> using legacy unoptimized FFT code])])
+ fi
+ 
+ dnl **** check for libz - needed for PDF and PNG drivers and XmHTML
+Index: grace-5.1.24-patch/configure
+===================================================================
+--- grace-5.1.24-patch.orig/configure
++++ grace-5.1.24-patch/configure
+@@ -748,7 +748,6 @@ with_printcmd
+ enable_debug
+ enable_maintainer
+ with_netcdf_libraries
+-with_fftw_library
+ with_zlib_library
+ with_jpeg_library
+ with_png_library
+@@ -1412,7 +1411,6 @@ Optional Packages:
+   --with-helpviewer=COMMAND    define help viewer command ["mozilla %s"]
+   --with-printcmd=PROG         use PROG for printing
+   --with-netcdf-libraries=OBJ  use OBJ as netCDF libraries [-lnetcdf]
+-  --with-fftw-library=OBJ      use OBJ as FFTW library [-lfftw]
+   --with-zlib-library=OBJ      use OBJ as ZLIB library [-lz]
+   --with-jpeg-library=OBJ      use OBJ as JPEG library [-ljpeg]
+   --with-png-library=OBJ       use OBJ as PNG library [-lpng]
+@@ -8225,84 +8223,69 @@ fi
+ 
+ if test $fftw = true
+ then
++  for ac_header in fftw3.h
++do :
++  ac_fn_c_check_header_mongrel "$LINENO" "fftw3.h" "ac_cv_header_fftw3_h" "$ac_includes_default"
++if test "x$ac_cv_header_fftw3_h" = xyes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_FFTW3_H 1
++_ACEOF
+ 
+-
+-# Check whether --with-fftw_library was given.
+-if test "${with_fftw_library+set}" = set; then :
+-  withval=$with_fftw_library; fftw_library="$withval"
+-fi
+-
+-  if test "x$fftw_library" = "x"
+-  then
+-    fftw_library=-lfftw
+-  fi
+-
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FFTW library >= 2.1.3" >&5
+-$as_echo_n "checking for FFTW library >= 2.1.3... " >&6; }
+-if ${acx_cv_fftw+:} false; then :
++	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftw_execute in -lfftw3" >&5
++$as_echo_n "checking for fftw_execute in -lfftw3... " >&6; }
++if ${ac_cv_lib_fftw3_fftw_execute+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+-  if ${acx_cv_fftw_library+:} false; then :
+-  $as_echo_n "(cached) " >&6
+-else
+-  acx_cv_fftw_library=$fftw_library
+-fi
+-
+-
+-    save_CFLAGS=$CFLAGS
+-    save_CPPFLAGS=$CPPFLAGS
+-    save_LDFLAGS=$LDFLAGS
+-    save_LIBS=$LIBS
+-
+-    LIBS="$acx_cv_fftw_library $LIBS"
+-    if test "$cross_compiling" = yes; then :
+-  acx_cv_fftw="no"
+-
+-else
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-lfftw3  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
+-#include <fftw.h>
+-#include <string.h>
+-      int main(void) {
+-        char *vlib = (char *) fftw_version;
+-        if (strcmp(vlib, "2.1.3") < 0) {
+-          exit(1);
+-        }
+-        exit(0);
+-      }
+-
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char fftw_execute ();
++int
++main ()
++{
++return fftw_execute ();
++  ;
++  return 0;
++}
+ _ACEOF
+-if ac_fn_c_try_run "$LINENO"; then :
+-  acx_cv_fftw="yes"
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_lib_fftw3_fftw_execute=yes
+ else
+-  acx_cv_fftw="no"
++  ac_cv_lib_fftw3_fftw_execute=no
+ fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+-  conftest.$ac_objext conftest.beam conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
+ fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fftw3_fftw_execute" >&5
++$as_echo "$ac_cv_lib_fftw3_fftw_execute" >&6; }
++if test "x$ac_cv_lib_fftw3_fftw_execute" = xyes; then :
+ 
++		FFTW_LIB="-lfftw3"
++		$as_echo "#define HAVE_FFTW 1" >>confdefs.h
+ 
+ 
+-    CFLAGS=$save_CFLAGS
+-    CPPFLAGS=$save_CPPFLAGS
+-    LDFLAGS=$save_LDFLAGS
+-    LIBS=$save_LIBS
+-
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: --> using legacy unoptimized FFT code" >&5
++$as_echo "--> using legacy unoptimized FFT code" >&6; }
+ 
+ fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_fftw" >&5
+-$as_echo "$acx_cv_fftw" >&6; }
+-  if test "$acx_cv_fftw" = "yes"
+-  then
+-    FFTW_LIB="$acx_cv_fftw_library"
+-    $as_echo "#define HAVE_FFTW 1" >>confdefs.h
+ 
+-  else
+-    FFTW_LIB=
+-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: --> using legacy unoptimized FFT code" >&5
++
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: --> using legacy unoptimized FFT code" >&5
+ $as_echo "--> using legacy unoptimized FFT code" >&6; }
+-  fi
++fi
++
++done
+ 
+ fi
+ 
+



More information about the arch-commits mailing list