File perl-PDL.spec of Package perl-PDL

# spec file for package perl-PDL
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           perl-PDL
%define cpan_name PDL
Version:        2.4.11
Release:        0
Summary:        PDL - perlDL module extension for perl
License:        BSD-3-Clause and (GPL-1.0+ or Artistic-1.0)
Group:          Development/Libraries/Perl
Patch0:         PDL-2.4.7.diff
Patch1:         PDL-2.4.7-return.diff
Patch2:         PDL-2.4.7-pdldoc.db.diff
Patch3:         PDL-2.4.7-makefile.diff
Patch4:         PDL-2.4.7-qsortvec.diff
Patch5:         PDL-2.4.7-ppdef.diff
Patch6:         PDL-2.4.7-strncat.diff
Patch7:         PDL-2.4.11-implicit.diff
Patch8:         PDL-2.4.11-hashcmp.diff
BuildRequires:  f2c
BuildRequires:  fftw3-devel
BuildRequires:  freeglut-devel
BuildRequires:  gcc-fortran
BuildRequires:  gsl-devel
BuildRequires:  ncurses-devel
BuildRequires:  perl
BuildRequires:  perl-Curses
BuildRequires:  perl-ExtUtils-F77
BuildRequires:  perl-Inline
BuildRequires:  perl-macros
BuildRequires:  xorg-x11
BuildRequires:  xorg-x11-Xvfb
Provides:       PDL
Provides:       perl_pdl
Obsoletes:      perl_pdl
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

The perlDL project aims to turn perl into an efficient numerical
language for scientific computing. The PDL module gives standard perl
the ability to compactly store and speedily manipulate the large
N-dimensional data sets.

%setup -n PDL-%{version} -q

perl Makefile.PL
make -j1 CCCDLFLAGS="-fPIC -fno-aggressive-loop-optimizations -DPERL_REENTR_API=1" #to make the tests of srand pass

Xvfb :95 &
trap "kill $! || true" EXIT
sleep 5
# the following tests are disabled for the reason specified
mv t/flexraw.t t/ # gfortran format not compatible to g77
%ifarch sparc s390x s390 x86_64
  mv t/slatec.t t/     # a bug somewhere in chid() function
mv t/opengl.t t/ # does not work with Xvfb server
mv t/xvals.t t/ #mysterioously fails, see upstream #1744014
DISPLAY=:95 make test

make DESTDIR=%{buildroot} install_vendor
mv %{buildroot}%{_prefix}/lib/perl5/%{perl_version} %{buildroot}%{_prefix}/lib/perl5/%{perl_version}.tmp
cp -R /usr/lib/perl5/%{perl_version} %{buildroot}%{_prefix}/lib/perl5
perl -I blib/lib -I blib/arch Doc/ %{buildroot}%{perl_vendorarch}
rm -rf %{buildroot}%{_prefix}/lib/perl5/%{perl_version}
mv %{buildroot}%{_prefix}/lib/perl5/%{perl_version}.tmp %{buildroot}%{_prefix}/lib/perl5/%{perl_version}
for i in `find %{buildroot}/%{perl_vendorarch}/PDL/HtmlDocs/PDL/ -type f`; do
	sed s:%{buildroot}::g < $i > $i.tmp
	mv $i.tmp $i
rm -rf %{buildroot}%{_localstatedir}/adm/perl-modules/perl-PDL

rm -rf %{buildroot}

%doc %{_mandir}/man?/*