%bcond_with openmp

Summary: Library for reading RAW files obtained from digital photo cameras
Summary(ja): デジタルカメラから取り込んだ RAW ファイルを読むためのライブラリ
Name: LibRaw
Version: 0.20.2
Release: 1%{?_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

License: BSD and (CDDL or LGPLv2)
URL: https://www.libraw.org/
Source0: https://www.libraw.org/data/LibRaw-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: gcc libtool make
BuildRequires: lcms2-devel
BuildRequires: jasper-devel

%description
LibRaw is a library for reading RAW files obtained from digital photo
cameras (CRW/CR2, NEF, RAF, DNG, and others).

LibRaw is based on the source codes of the dcraw utility, where part of
drawbacks have already been eliminated and part will be fixed in future.


%package devel
Summary: LibRaw development libraries
Summary(ja): LibRaw の開発ライブラリ
Group: programming
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig

%description devel
LibRaw development libraries

This package contains static libraries that applications can use to build
against libraw. LibRaw does not provide dynamic libraries.


%package static
Summary: LibRaw static libraries
Summary(ja): LibRaw の静的ライブラリ
Group: programming

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

%description static
This package contains the static library for %{name}.


%debug_package


%prep
%setup -q


%build
autoreconf -if
%configure \
    --enable-examples=no \
    --enable-jasper \
    --enable-jpeg \
    --enable-lcms \
%if %{with openmp}
    --enable-openmp
%endif

sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

%make_build


%install
rm -rf %{buildroot}
cp -pr doc manual
chmod 644 LICENSE.CDDL LICENSE.LGPL COPYRIGHT Changelog.*
chmod 644 manual/*.html

# The Libraries
%make_install

rm -rfv samples/.deps
rm -fv samples/.dirstamp
rm -fv samples/*.o

rm -rf %{buildroot}%{_libdir}/*.la


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


%files
%defattr(-,root,root,-)
%license LICENSE.CDDL LICENSE.LGPL COPYRIGHT
%doc Changelog.txt
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,-)
%doc manual samples
%exclude %{_docdir}/libraw/
%dir %{_includedir}/libraw
%{_includedir}/libraw/*.h
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc

%files static
%defattr(-,root,root,-)
%{_libdir}/*.a


%changelog
* Wed Mar 03 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 0.20.2-1
- new upstream release.
- dropped Patch1000: fixed in upstream.

* Wed Sep 23 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 0.20.0-2
- imported Patch1000 from upstream to fix CVE-2020-24890.

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

* Sun Sep 08 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 0.19.5-1
- new upstream release.

* Wed Jun 29 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 0.17.2-1
- new upstream release.

* Sun Feb 09 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 0.16.0-1
- new upstream release

* Sat Jan 18 2014 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.15.4-1
- new upstream release

* Sun May 26 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.14.8-1
- new upstream release

* Fri Jun 29 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.14.7-1
- new upstream release

* Sat Apr 28 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 0.14.6-1
- new upstream release
- change BuildRequires: lcms2-devel instead of lcms-devel

* Sun Jan 15 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.14.5-1
- new upstream release

* Sat Dec 17 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.14.4-1
- new upstream release

* Fri Dec 09 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.14.3-1
- new upstream release
- added BuildRequires: jasper-devel
- fixed configure option
  - deleted --enable-shared=no, --enable-static=no
  - added --enable-jasper
- fixed %%files in -devel
- run ldconfig in %%post, %%postun

* Thu Jun 09 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.13.5-3
- added BuildRequires: lcms-devel
- added configure option --enable-lcms

* Sun Jun 05 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.13.5-2
- added BuildRequires: gcc libtool make
- fixed %%install
- deleted library archive
- fixed %%doc in -devel package

* Sat Jun 04 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.13.5-1
- new upstream release
- dropt Patch0
- fixed configure option
- fixed %%files
- splitted -static package

* Mon Dec 13 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.11.3-1
- new upstream release
- added License: LibRaw Software License
- dropt patch1,2
- replaced patch0 by Fedora development patch

* Tue Sep 28 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.10.0-1
- new upstream release

* Wed Jul 14 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.9.1-1
- initial build for VineSeed

* Fri Jun 04 2010 Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com> 0.9.1-1
- New package
