File perl-Prima.spec of Package perl-Prima

#
# spec file for package perl-Prima
#
# 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


Name:           perl-Prima
BuildRequires:  giflib-devel libpng-devel libtiff-devel perl xorg-x11 xorg-x11-devel
License:        BSD3c
Group:          Development/Libraries/Perl
AutoReqProv:    on
Requires:       xorg-x11
Version:        1.30
Release:        1
Summary:        A Perl toolkit for multi-platform GUI development
Url:            http://prima.eu.org
Source:         http://prima.eu.org/download/Prima-%{version}.tar.gz
Source1:        VB_classes-decent.gif
Source2:        http://prima.eu.org/download/Prima.pdf.bz2
Source3:        happy-gcc-during_make.diff
Patch:          VB-decent.diff
Patch2:         Prima-GenericEvent.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       perl-base = %perl_version

%description
Prima is an extensible Perl toolkit for multi-platform GUI development.
The toolkit contains a rich set of standard widgets and has emphasis on
2D image processing tasks. A Perl program using PRIMA looks and behaves
identically on X, Win32 and OS/2. The toolkit includes VB, a visual
builder and a graphic POD viewer.

%prep
%setup -q -n Prima-%{version}
cp %{S:1} Prima/VB/classes.gif
cp %{S:2} .
bunzip2 Prima.pdf.bz2
cp %{S:3} .
%patch -p1
%patch2
# patch creates a .orig file. Our Installer is so greedy ...
rm -f Prima/VB/VB.pl.orig
echo _bindir= %{_bindir}
echo _libdir= %{_libdir}
echo perl_vendorlib= %{perl_vendorlib}
echo perl_vendorarch= %{perl_vendorarch}

%build
## man1+man3 try to hide in perl_vendorarch if PREFIX is set. force them back.
M=$RPM_BUILD_ROOT/%{_mandir}
MAKEFILE_ARGS="PREFIX=$RPM_BUILD_ROOT/usr INSTALL_MAN1=$M/man1 INSTALL_MAN3=$M/man3"
if [ "%_lib" = "lib64" ]; then
  MAKEFILE_ARGS="$MAKEFILE_ARGS LIBPATH+=/usr/X11/lib64"
fi
perl Makefile.PL $MAKEFILE_ARGS
## site_perl is not allowed anymore in SuSE Linux.
perl -i -pe 's{/site_perl/}{/vendor_perl/}g' Makefile
make %{?_smp_mflags} OPTIMIZE="$RPM_OPT_FLAGS -Wall"
(ldd auto/Prima/Prima.so | grep -q libgif ) || echo "WARNING: gif codec required for VB"

%check
# giflib-4.1.3:EGifCompressLine is not 64bit save. 
make test
### only three basic tests work without a DISPLAY.
### ... or more powerful tests: 
## neededforbuild xorg-x11-Xnest xorg-x11-Xvfb xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-fonts-scalable xorg-x11-server
##
## Xvfb :95 -fp /usr/X11R6/lib/X11/fonts/misc &
## trap "kill $!" EXIT
## sleep 5
## DISPLAY=:95 make test
##

%install
make install
## oops, Prima/Config.PL must not contain BUILD_ROOT
perl -ne 'print qq{$1\n} if m{--updateconfig\s+(\S+)}' Makefile | xargs perl -i -pe "s{$RPM_BUILD_ROOT}"'{}g'
###
### should these go to a perl-Prima-devel ?
find $RPM_BUILD_ROOT/%{perl_vendorarch} -name \*.h | xargs -t rm
%perl_process_packlist

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc Copying README HISTORY Prima.pdf
%doc %{_mandir}/man?/*
%{_bindir}/*
%dir %{perl_vendorarch}/Prima
%{perl_vendorarch}/Prima.pm
%{perl_vendorarch}/Prima/*
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/gencls.pod

%changelog
openSUSE Build Service is sponsored by