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

#
# spec file for package perl-DBD-ODBC
#
# Copyright (c) 2011 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/
#

# norootforbuild

%bcond_with test

Name:           perl-DBD-ODBC
%define cpan_name DBD-ODBC
Summary:        ODBC Driver for DBI
Version:        1.31
Release:        4
License:        GPL+ or Artistic
Group:          Development/Libraries/Perl
Url:            http://search.cpan.org/dist/DBD-ODBC/
Source:         http://www.cpan.org/modules/by-module/DBD/DBD-ODBC-%{version}.tar.gz
Patch0:         %{name}-1.29-Makefile.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
BuildRequires:  perl-macros
%if 0%{?suse_version} >= 1120
BuildRequires:  perl(Test::Simple) >= 0.88
%endif
%if %{with test}
BuildRequires:  perl(Test::Pod::Coverage) >= 1.04
%endif
BuildRequires:  perl(DBI) >= 1.609
BuildRequires:  unixODBC-devel
Requires:       perl(DBI) >= 1.609
Requires:       unixODBC
%{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="$RPM_OPT_FLAGS"
%{__make} %{?_smp_mflags}

%check
%{__make} test

%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%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