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 http://bugs.opensuse.org/
#


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
Url:            http://cpan.org/modules/by-module/PDL/
Source:         http://www.cpan.org/authors/id/C/CH/CHM/%{cpan_name}-%{version}.tar.gz
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

%description
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.

%prep
%setup -n PDL-%{version} -q
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8

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

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

%install
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/scantree.pl %{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}
%perl_process_packlist
for i in `find %{buildroot}/%{perl_vendorarch}/PDL/HtmlDocs/PDL/ -type f`; do
	sed s:%{buildroot}::g < $i > $i.tmp
	mv $i.tmp $i
done
rm -rf %{buildroot}%{_localstatedir}/adm/perl-modules/perl-PDL

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc Known_problems TODO README COPYING DEVELOPMENT Changes Release_Notes BUGS DEPENDENCIES MANIFEST Example
%doc %{_mandir}/man?/*
%{perl_vendorarch}/auto/PDL
%{perl_vendorarch}/PDL
%{perl_vendorarch}/Inline
%{perl_vendorarch}/PDL.pm
%{_bindir}/*

%changelog