File perl-Tk.spec of Package perl-Tk

#
# spec file for package perl-Tk
#
# Copyright (c) 2013 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-Tk
BuildRequires:  libpng-devel
BuildRequires:  xkeyboard-config
BuildRequires:  xorg-x11
BuildRequires:  xorg-x11-Xnest
BuildRequires:  xorg-x11-Xvfb
BuildRequires:  xorg-x11-devel
BuildRequires:  xorg-x11-fonts
BuildRequires:  xorg-x11-fonts-100dpi
BuildRequires:  xorg-x11-fonts-scalable
%ifnarch s390 s390x
BuildRequires:  xorg-x11-server
%endif
Version:        804.031
Release:        0
Summary:        Perl Tk
License:        (GPL-1.0+ or Artistic-1.0) and Zlib
Group:          Development/Libraries/Perl
Url:            http://cpan.org/modules/by-module/Tk/
Source:         Tk-%{version}.tar.gz
Patch0:         Tk-804.029-lib64.diff
Patch1:         Tk-804.029-macro.diff
Patch2:         Tk-804.029-null.diff
Patch3:         Tk-804.029-refcnt.diff
Patch4:         Tk-804.029-event.diff
# PATCH-FIX-UPSTREAM compile with recent Xorg versions too - coolo@novell.com
Patch5:         Tk-804.029-xorg.diff
# PATCH-FIX-UPSTREAM Tk-804.030-libpng16.diff fix t/photo.t while building against libpng16: move setting gamma before png_read_update_info() -- pgajdos@suse.com
# Slaven is notified, but didn't reply sofar. See correspondence in the patch preamble.
Patch6:         Tk-804.030-libpng16.diff
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{perl_requires}

%description
Perl Tk is an enhancement for Perl. It combines the well structured
graphical library Tk with the powerful scripting language Perl.

%package devel
Summary:        Perl Tk
Group:          Development/Libraries/Perl
Requires:       %{name} = %{version}
Provides:       perl-Tk:/usr/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Tk/pTk/Lang.h

%description devel
Perl Tk is an enhancement for Perl. It combines the well structured
graphical library Tk with the powerful scripting language Perl.

%prep
%setup -q -n Tk-%{version}
if test "%{_lib}" = "lib64" ; then
%patch0
fi
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6

%build
find -name "*.orig" -exec rm {} \;
for file in `find -type f` ; do
  grep "/usr/local/bin/perl" $file && \
    cat $file | \
      sed -e "s@/usr/local/bin/perl@/usr/bin/perl@g" > tmpfile && \
        mv tmpfile $file
  grep "/usr/local/bin/nperl" $file && \
    cat $file | \
      sed -e "s@/usr/local/bin/nperl@/usr/bin/nperl@g" > tmpfile && \
        mv tmpfile $file
  grep "#!\s*/bin/perl" $file && \
    cat $file | \
      sed -e "s@/bin/perl@/usr/bin/perl@g" > tmpfile && \
        mv tmpfile $file
  grep "#!\s*/tools/local/perl" $file && \
    cat $file | \
      sed -e "s@/tools/local/perl@/usr/bin/perl@g" > tmpfile && \
        mv tmpfile $file
  grep "/usr/local/bin/new/perl" $file && \
    cat $file | \
      sed -e "s@/usr/local/bin/new/perl@/usr/bin/perl@g" > tmpfile && \
        mv tmpfile $file
done
#disable test that require Test
mv t/browseentry-grabtest.t t/browseentry-grabtest.tt
mv t/browseentry2.t t/browseentry2.tt
mv t/entry.t t/entry.tt
mv t/listbox.t t/listbox.tt
# disable test that seems to fail at random
mv t/fileevent2.t t/fileevent2.tt
perl Makefile.PL XFT=1
make %{?_smp_mflags} CFLAGS="%{optflags} -Wall -fpic"

%check
Xvfb :95 -screen 0 1280x1024x24 & #430569
trap "kill $!" EXIT
sleep 5
DISPLAY=:95 make test

%install
make DESTDIR=%{buildroot} install_vendor
%perl_process_packlist
rm -f %{buildroot}/%{perl_vendorarch}/fix_4_os2.pl

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING Change.log Changes Funcs.doc INSTALL PPM-HowTo README* ToDo VERSIONS
%doc %{_mandir}/man?/*
%{_bindir}/*
%{perl_vendorarch}/Tie
%{perl_vendorarch}/Tk
%{perl_vendorarch}/Tk.*
%{perl_vendorarch}/auto/Tk
%exclude %{perl_vendorarch}/Tk/pTk
%exclude %{perl_vendorarch}/Tk/*.h

%files devel
%defattr(-,root,root)
%{perl_vendorarch}/Tk/pTk
%{perl_vendorarch}/Tk/*.h

%changelog
openSUSE Build Service is sponsored by