File perl-DBD-ODBC.spec of Package perl-DBD-ODBC

#
# spec file for package perl-DBD-ODBC
#
# 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/
#


%bcond_with test

Name:           perl-DBD-ODBC
Version:        1.48
Release:        0
%define cpan_name DBD-ODBC
Summary:        ODBC Driver for DBI
License:        GPL-1.0+ or Artistic-1.0
Group:          Development/Libraries/Perl
Url:            http://search.cpan.org/dist/DBD-ODBC/
Source:         http://www.cpan.org/authors/id/M/MJ/MJEVANS/%{cpan_name}-%{version}.tar.gz
Patch0:         %{name}-1.29-Makefile.diff
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  unixODBC-devel
BuildRequires:  perl(DBI) >= 1.609
BuildRequires:  perl(Test::Simple) >= 0.90
Requires:       unixODBC
Requires:       perl(DBI) >= 1.609
%{perl_requires}

%description
This module is needed to access ODBC databases from within Perl. The
module uses the unixODBC manager to connect to the database.

%prep
%setup -q -n %{cpan_name}-%{version}
%patch0
find . -type f -print0 | xargs -0 chmod 644

#rpmlint: wrong-file-end-of-line-encoding
for file in README.af README.unicode; do
  perl -p -i -e "s|\r\n|\n|" "$file"
done

pushd examples
#rpmlint: wrong-file-end-of-line-encoding
find -type f -exec perl -p -i -e "s|\r\n|\n|" {} \;
#rpmlint: wrong-script-interpreter
for ex in $(ls -1); do
  sed -i -e 's,#[!|#]perl\(.*\),#!perl\1,' "$ex"
  sed -i -e 's,perl.exe -w,perl -w,' "$ex"
done
popd

%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
make %{?_smp_mflags}

%check
make test

%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist

%clean
rm -rf %{buildroot}

%files -f %{name}.files
%defattr(-,root,root,-)
%doc Changes FAQ if_you_are_taking_over_this_code.txt
%doc README README.adabas README.af README.informix README.sqlserver README.unicode
%doc test_results.txt examples

%changelog
openSUSE Build Service is sponsored by