%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Name:           jasper
Summary:        implementation of the JPEG-2000 standard, Part 1
Version:        2.0.32
Release:        1%{?_dist_release}
Group:          graphics
Vendor:         Project Vine
Distribution:   Vine Linux

License:        Modified BSD (see LICENSE)
URL:            https://www.ece.uvic.ca/~frodo/jasper/
Source:         https://github.com/mdadams/jasper/archive/version-%{version}.tar.gz#/%{name}-version-%{version}.tar.gz

# skip hard-coded prefix/lib rpath
Patch1:         jasper-2.0.14-rpath.patch

BuildRoot:   %{_tmppath}/%{name}-%{version}-root
BuildRequires:  autoconf automake libtool
BuildRequires:  freeglut-devel
BuildRequires:  libGLU-devel
BuildRequires:  libjpeg-devel
BuildRequires:  pkgconfig
BuildRequires:  cmake
BuildRequires:  git

Requires:       %{name}-libs = %{version}-%{release}

%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.


%package devel
Summary:     Include Files and Documentation for jasper
Group:       programming
Requires:    %{name}-libs = %{version}-%{release}
Requires:    libjpeg-devel

%description devel
This package contains libjasper, a library implementing the JPEG-2000
image compression standard Part 1.


%package libs
Summary: Runtime libraries for %{name}
Group:   system

%description libs
This package contains runtime libraries for JasPer.


# compat32
%package -n compat32-%{name}-devel
Summary:     Include Files and Documentation for jasper
Group:       programming
Requires:    %{name}-libs = %{version}-%{release}
Requires:    compat32-libjpeg-devel

%description -n compat32-%{name}-devel
This package contains libjasper, a library implementing the JPEG-2000
image compression standard Part 1.


%package -n compat32-%{name}-libs
Summary: Runtime libraries for %{name}
Group:   system

%description -n compat32-%{name}-libs
This package contains runtime libraries for JasPer.


%debug_package


%prep
%autosetup -S git -n %{name}-version-%{version}


%build
%cmake -DJAS_ENABLE_DOC:BOOL=OFF
%cmake_build


%install
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}
%cmake_install

# Unpackaged files
rm -f doc/README
rm -f %{buildroot}%{_libdir}/lib*.la
rm -rf %{buildroot}%{_docdir}/JasPer


%check
%ctest


%clean
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}


%files
%defattr(-,root,root)
%{!?_licensedir:%global license %%doc}
%{_bindir}/*
%{_mandir}/man1/*

%files libs
%license COPYRIGHT LICENSE
%doc INSTALL README doc/README doc/jasper.pdf doc/jpeg2000.pdf
%defattr(-,root,root)
%{_libdir}/libjasper*.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/jasper
%{_libdir}/libjasper*.so
%{_libdir}/pkgconfig/jasper.pc

# compat32
%if %{build_compat32}
%files -n compat32-%{name}-libs
%defattr(-,root,root)
%{_libdir}/libjasper*.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/libjasper*.so
%{_libdir}/pkgconfig/jasper.pc
%endif


%changelog
* Wed Jul 28 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.32-1
- new upstream release.

* Wed Mar 31 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.28-1
- new upstream release.
- dropped ldconfig scriptlets.

* Sat Feb 27 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.25-1
- new upstream release.
- dropped Patch1000: fixed in upstream.

* Thu Feb 04 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.24-1
- new upstream release.
- added Patch1000 to fix CVE-2021-3272.

* Wed Dec 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.23-1
- new upstream release.

* Fri Sep 04 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.19-1
- new upstream release.

* Sun Sep 08 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.16-1
- new upstream release.
- dropped Patch1: fixed in upstream.
- imported Patch1 from rawhide.

* Mon Mar 20 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.12-1
- new upstream release.
- dropped all patches.
- imported patch1 from rawhide.

* Tue Jul 19 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.900.1-11
- added Patch1000-1002 to fix CVE-2016-{1577,2089,2116}.

* Wed Dec 24 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.900.1-10
- imported all patches from RawHide.

* Tue Jul 15 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.900.1-9
- rebuild with libpng-1.6.12

* Thu Apr 14 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.900.1-8
- rebuilt with current VineSeed

* Sat May 02 2009 NAKAMURA Kenta <kenta@vinelinux.org> 1.900.1-7
- added compat32 subpackage for x86_64 arch support.

* Sat Sep 06 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.900.1-6
- splited out runtime library to sub package
- enable opengl again, add BuildRequires: freeglut-devel

* Wed Jun 25 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.900.1-5
- remove .la
- add --disable-static to configure option

* Sun Jun 24 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.900.1-0vl4
- added Patch0 from VinePlus/4.0
  * Thu Jun 21 2007 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.900.1-0vl2.1
  - add patch100 for fix CVE-2007-2721
  - add Vendor/Distributin Tag

* Fri May 25 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.900.1-0vl3
- remove BuildPrereq: freeglut-devel and Requires freeglut
- add --disable-opengl to configure option

* Fri Mar 16 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.900.1-0vl2
- add BuildPreReq: unzip (used in the %%pre section)

* Thu Mar 15 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.900.1-0vl1
- new upstream release

* Tue Jan 16 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.900.0-0vl1
- new upstream release
- changed Group to System Environment/Libraries
- added --mandir=%{_mandir}
- added %post and %postun section

* Thu Sep 07 2006 NAKAMURA Kenta <kenta@vinelinux.org> 1.701.0-0vl3
- added --libdir=%{_libdir} configure option

* Tue Sep  5 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.701.0-0vl2
- build with freeglut
- change BuildPrereq and Requires

* Tue Dec 14 2004 Satoshi MACHINO <machino@vinelinux.org> 1.701.0-0vl1
- new upstream version (jasper-1.701.0)

* Sat Nov 15 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.700.5-0vl2
- rebuild for VineSeedPlus

* Sat Nov 15 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.700.5-0vl1
- source upgrade
- change spec to build for VineLinux

* Fri Oct 25 2002 Alexander D. Karaivanov <adk@medical-insight.com>
- spec file created
