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

Name:           lcms2
Summary:        Color Management Engine
Summary(ja):    カラーマネージメントエンジン
Version:        2.12
Release:        1%{?_dist_release}
Group:          system
Vendor:         Project Vine
Distribution:   Vine Linux

License:        MIT
URL:            http://www.littlecms.com/
Source0:        https://github.com/mm2/Little-CMS/archive/lcms%{version}.tar.gz#/%{name}-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  libjpeg-devel
BuildRequires:  libtiff-devel
BuildRequires:  zlib-devel

%description
LittleCMS intends to be a small-footprint, speed optimized color management
engine in open source form. LCMS2 is the current version of LCMS, and can be
parallel installed with the original (deprecated) lcms.


%package        utils
Summary:        Utility applications for %{name}
Group:          graphics

%description    utils
The %{name}-utils package contains utility applications for %{name}.


%package        devel
Summary:        Development files for LittleCMS
Summary(ja):    LittleCMS の開発用ファイル
Group:          programming
Requires:       %{name} = %{version}-%{release}
Provides:       littlecms-devel = %{version}-%{release}

%description    devel
Development files for LittleCMS.


# compat32
%package -n 	compat32-%{name}
Summary:	Color Management Engine
Summary(ja):    カラーマネージメントエンジン
Group:		system
Requires:	%{name} = %{version}-%{release}


%description -n	compat32-%{name}
LittleCMS intends to be a small-footprint, speed optimized color management
engine in open source form. LCMS2 is the current version of LCMS, and can be
parallel installed with the original (deprecated) lcms.

%package -n	compat32-%{name}-devel
Summary:        Development files for LittleCMS
Summary(ja):    LittleCMS の開発用ファイル
Group:          programming
Requires:       compat32-%{name} = %{version}-%{release}
Requires:       %{name}-devel = %{version}-%{release}

%description -n	compat32-%{name}-devel
Development files for LittleCMS.


%debug_package


%prep
%setup -q -n Little-CMS-lcms%{version}


%build
%configure --disable-static --program-suffix=2

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

make %{?_smp_mflags}


%install
rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=${RPM_BUILD_ROOT} INSTALL="install -p"
find ${RPM_BUILD_ROOT} -type f -name "*.la" -exec rm -f {} ';'
install -D -m 644 include/lcms2.h $RPM_BUILD_ROOT/usr/include/lcms2.h
install -D -m 644 include/lcms2_plugin.h $RPM_BUILD_ROOT/usr/include/lcms2_plugin.h


%clean
rm -rf ${RPM_BUILD_ROOT}


%ldconfig_scriptlets


%files
%defattr(-,root,root,-)
%license COPYING
%doc AUTHORS
%{_libdir}/*.so.*

%files utils
%defattr(-,root,root,-)
%{_bindir}/*
%{_mandir}/man1/*

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

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

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


%changelog
* Tue Mar 02 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 2.12-1
- new upstream release.

* Mon May 04 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 2.9-2
- rebuilt with current environment.

* Fri Dec 15 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 2.9-1
- new upstream release.

* Sun Apr 05 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.7-1
- new upstream release

* Sun Oct 26 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.6-1
- new upstream release

* Sat Jan 04 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.5-1
- new upstream release

* Sat Sep 29 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.4-1
- new upstream release

* Sat Mar 10 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.3-1
- new upstream release
- create compat32 sub packages

* Tue Aug 16 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 2.2-1
- new upstream release

* Sat Mar 19 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 2.1-3
- Initial build for Vine Linux

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Dec 01 2010 Richard Hughes <richard@hughsie.com> 2.1-1
- Update to new upstream version.

* Fri Jun 18 2010 Richard Hughes <richard@hughsie.com> 2.0a-3
- Address some more review comments.
- Resolves #590387

* Fri Jun 18 2010 Richard Hughes <richard@hughsie.com> 2.0a-2
- Address some review comments.
- Resolves #590387

* Fri Jun 18 2010 Richard Hughes <richard@hughsie.com> 2.0a-1
- Initial package for Fedora review
