Name:          LibRaw
Version:       0.19.0
Release:       8
Summary:       Library for reading RAW files obtained from digital photo cameras
License:       BSD and (CDDL or LGPLv2)
URL:           http://www.libraw.org
Source0:       http://www.libraw.org/data/%{name}-%{version}.tar.gz
Patch0002:     LibRaw-0.17.1-CVE-2015-8366-8367.patch
Patch6000:     LibRaw-0.19.2-CVE-2018-5817,5818,5819.patch

BuildRequires: gcc-c++ pkgconfig(lcms2) pkgconfig(jasper) pkgconfig(libjpeg)
Provides:      bundled(dcraw) = 9.25
%description
LibRaw is a library for reading RAW files from digital photo cameras (CRW/CR2, NEF,
RAF, etc, virtually all RAW formats are supported).It pays special attention to
correct retrieval of data required for subsequent RAW conversion.The library is
intended for embedding in RAW converters, data analyzers, and other programs using
RAW files as the initial data.

%package devel
Summary:      LibRaw development libraries
Requires:     %{name} = %{version}-%{release}

Provides:      LibRaw-static = %{version}-%{release} LibRaw-samples = %{version}-%{release}
Obsoletes:     LibRaw-static < %{version}-%{release} LibRaw-samples < %{version}-%{release}

%description devel
The LibRaw-devel package contains development and header files.

%prep
%autosetup -n %{name}-%{version} -p1

%build
%configure --enable-examples=yes --enable-jasper --enable-jpeg \
           --enable-lcms --enable-openmp

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
cp -pr doc manual
chmod 644 LICENSE.CDDL LICENSE.LGPL COPYRIGHT Changelog.txt manual/*.html
%make_install

rm -rfv samples/.deps samples/.dirstamp samples/*.o
%delete_la

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%doc Changelog.txt
%license LICENSE.CDDL LICENSE.LGPL COPYRIGHT
%{_libdir}/{libraw,libraw_r}.so.19*

%files devel
%doc manual samples
%{_bindir}/*
%{_includedir}/libraw/
%{_libdir}/{libraw,libraw_r}.a
%{_libdir}/{libraw,libraw_r}.so
%{_libdir}/pkgconfig/{libraw,libraw_r}.pc
%exclude %{_docdir}/libraw/*

%changelog
* Fri Oct 25 2019 yanzhihua<yanzhihua4@huawei.com> - 0.19.0-7
- Package init
