File FLIF.spec of Package FLIF

#
# spec file for package FLIF
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define _encver 0
Name:           FLIF
Version:        0.3
Release:        0
Summary:        Free Lossless Image Format
License:        LGPL-3.0+ and CC0-1.0
Group:          Productivity/Graphics/Convertors
Url:            http://flif.info/
Source0:        https://github.com/FLIF-hub/FLIF/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source99:       %{name}-rpmlintrc
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl2)
Requires:       libflif%{_encver} = %{version}
Recommends:     exiv2

%description
FLIF is a lossless image format which outperforms PNG, lossless WebP,
lossless BPG and lossless JPEG2000 in terms of compression ratio.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       libflif%{_encver} = %{version}

%description    devel
These development headers are required if you plan on coding against %{name}.

%package        -n libflif%{_encver}
Summary:        Free Lossless Image Format encoder/decoder library
License:        LGPL-3.0+ and Apache-2.0
Group:          System/Libraries

%description    -n libflif%{_encver}
FLIF is a lossless image format which outperforms PNG, lossless WebP,
lossless BPG and lossless JPEG2000 in terms of compression ratio.

%prep
%setup -q
sed -e 's|/usr/local|%{_prefix}|g' \
    -e 's|\$(PREFIX)/lib|\$(PREFIX)/%{_lib}|g' \
    -e 's|CXXFLAGS\ :=\ |CXXFLAGS :=\ %{optflags}\ |' \
    -e 's|-g0||g' -e 's|-ggdb3||g' \
    -e '/magic/d' \
    -e 's/libflif\.so\.\*/libflif\.so\*/' \
    -e '/^flif:/cflif: libflif\$(LIBEXT) flif.cpp' \
    -e 's/-Wall \$(FILES_CPP) flif.cpp/-Wall -Ilibrary\/ flif.cpp -L. -lflif/' \
    -e 's/-o viewflif/%{optflags} -o viewflif/' \
    -i src/Makefile
sed -e 's|\./src/||g' -e 's|\./||g' -i raw-tools/raw2flif -i raw-tools/raw2rggb

%build
make %{?_smp_mflags}
make -C src %{?_smp_mflags} viewflif

%install
export DESTDIR=%{buildroot}
make %{?_smp_mflags} install
make %{?_smp_mflags} install-dev
make -C src %{?_smp_mflags} install-viewflif
install -m 0755 raw-tools/raw2flif raw-tools/raw2rggb -t %{buildroot}%{_bindir}

%post -n libflif%{_encver} -p /sbin/ldconfig

%postun -n libflif%{_encver} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc LICENSE LICENSE_Apache2 LICENSE_LGPL README.md
%{_bindir}/flif
%{_bindir}/apng2flif
%{_bindir}/gif2flif
%{_bindir}/raw2flif
%{_bindir}/raw2rggb
%{_bindir}/viewflif
%{_mandir}/man1/flif.1.gz

%files devel
%defattr(-,root,root)
%{_includedir}/flif.h
%{_includedir}/flif_common.h
%{_includedir}/flif_dec.h
%{_includedir}/flif_enc.h
%{_libdir}/libflif.so

%files -n libflif%{_encver}
%defattr(-,root,root)
%{_libdir}/libflif.so.%{_encver}

%changelog
openSUSE Build Service is sponsored by