%define VER1 %(rpmquery --qf '%{VERSION}' fedora-release)

Summary:   JasPer
Name:      jasper
Version:   1.900.1.uuid
Release:   1.fc%{VER1}
License:   Modified BSD
URL:       http://www.ece.uvic.ca/~mdadams/jasper/
Source:    http://www.ece.uvic.ca/~mdadams/jasper/software/jasper-1.900.1.uuid.tar.bz2
Group:     Development/Libraries
Packager:  Brad Douglas <rez@touchofmadness.com>
BuildRoot: %{_tmppath}/%{name}-%{version}
Prereq:    /sbin/ldconfig
Requires:  libjpeg
Requires:  freeglut >= 2.4.0
BuildRequires: libjpeg-devel
BuildRequires: freeglut-devel >= 2.4.0

%description 
JasPer is a collection        
of software (i.e., a library and application programs) for the coding 
and manipulation of images.  This software can handle image data in a 
variety of formats.  One such format supported by JasPer is the JPEG-2000 
format defined in ISO/IEC 15444-1:2000.

%package devel
Summary: Development libraries and documentation for JasPer
Group: Development/Libraries
Requires: jasper = %{version}

%description devel
JasPer is a collection        
of software (i.e., a library and application programs) for the coding 
and manipulation of images.  This software can handle image data in a 
variety of formats.  One such format supported by JasPer is the JPEG-2000 
code stream format defined in ISO/IEC 15444-1:2000.

%prep
%setup -q

./configure \
        --prefix=%{_prefix}                         \
        --libdir=%{_libdir}							\
        --enable-shared --enable-static             \
        --with-glut-include-dir=%{_includedir}/GL	\
        --with-glut-lib-dir=%{_libdir}              \
        --with-x

%build
sed 's/libdir = \/usr\/lib64/libdir \= \${prefix}\/lib64/' < src/libjasper/Makefile > src/libjasper/Makefile1
mv -f src/libjasper/Makefile1 src/libjasper/Makefile

make

%install
rm -rf $RPM_BUILD_ROOT

#make LIBDIR=$RPM_BUILD_ROOT%{_libdir} prefix=$RPM_BUILD_ROOT%{_prefix} install
make prefix=$RPM_BUILD_ROOT%{_prefix} install


%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%defattr(-, root, root)
%{_bindir}/*
%{_libdir}/lib*.so.*

%doc README LICENSE ChangeLog
%doc %{_prefix}/man/man1/*


%files devel
%defattr(-, root, root)
%{_includedir}/jasper/*
%{_libdir}/lib*.so
%{_libdir}/lib*.a
%{_libdir}/lib*.la
%attr(0644,root,root) %{_includedir}/jasper/*


%changelog
* Tue Jul 24 2007 Brad Douglas <rez@touchofmadness.com>
 - specified --libdir so x86_64 picks up right path
* Fri Jul 20 2007 Brad Douglas <rez@touchofmadness.com>
 - used %configure instead of ./configure
 - build with freeglut
 - added dependencies for freeglut
* Tue Jul 17 2007 Brad Douglas <rez@touchofmadness.com>
 - adapted to fedora core 7
* Fri Oct 27 2006 Brad Douglas <rez@touchofmadness.com>
 - adapted to fedora core
* Fri Oct 25 2002 Alexander D. Karaivanov <adk@medical-insight.com>
 - spec file created
