File libwebp.spec of Package libwebp

%define realname libwebp
%define realver  1.3.2
%define srcext   tar.gz

%define webp_so_ver  7
%define dec_so_ver   3
%define demux_so_ver 2
%define mux_so_ver   3
%define yuv_so_ver   0

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}-tools
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       BSD-3-Clause
Group:         Productivity/Graphics/Convertors
URL:           https://developers.google.com/speed/webp/
Summary:       Tools to handle images in Webp format

# Build-time parameters
BuildRequires: cmake >= 3.7 ninja
BuildRequires: pkg-config
BuildRequires: zlib-devel
BuildRequires: libpng-devel
BuildRequires: libjpeg-devel
BuildRequires: libtiff-devel
BuildRequires: giflib-devel
BuildRequires: libglvnd-devel libglvnd-compat-devel
BuildRequires: freeglut-devel
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://storage.googleapis.com/downloads.webmproject.org/releases/webp/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
Tools to handle images in Webp format.

%package -n %{realname}%{?webp_so_ver}
Group:         System/Libraries
Summary:       Library to encode and decode images in WebP format

%description -n %{realname}%{?webp_so_ver}
WebP codec: library to encode and decode images in WebP format. This package
contains the library that can be used in other programs to add WebP support,
as well as the command line tools 'cwebp' and 'dwebp'.

%package -n %{realname}decoder%{?dec_so_ver}
Group:         System/Libraries
Summary:       Library for the WebP graphics format (decode only)

%description -n %{realname}decoder%{?dec_so_ver}
WebP codec: library to encode and decode images in WebP format.

This package provides library for the WebP graphics format (decode only).

%package -n %{realname}demux%{?demux_so_ver}
Group:         System/Libraries
Summary:       Library for parsing the WebP graphics format container

%description -n %{realname}demux%{?demux_so_ver}
WebP codec: library to encode and decode images in WebP format.

This package provides library for parsing the WebP graphics format container.

%package -n %{realname}mux%{?mux_so_ver}
Group:         System/Libraries
Summary:       Library for manipulating the WebP graphics format container

%description -n %{realname}mux%{?mux_so_ver}
WebP codec: library to encode and decode images in WebP format.

This package provides library for manipulating the WebP graphics
format container.

%package -n libsharpyuv%{?yuv_so_ver}
Group:         System/Libraries
Summary:       Library for sharp RGB to YUV conversion

%description -n libsharpyuv%{?yuv_so_ver}
WebP codec: library to encode and decode images in WebP format.

This package provides library for sharp RGB to YUV conversion.

%package -n %{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{realname}%{?webp_so_ver} = %{version}-%{release}
Requires:      %{realname}decoder%{?dec_so_ver} = %{version}-%{release}
Requires:      %{realname}demux%{?demux_so_ver} = %{version}-%{release}
Requires:      %{realname}mux%{?mux_so_ver} = %{version}-%{release}
Requires:      libsharpyuv%{?yuv_so_ver} = %{version}-%{release}
Provides:      webp-devel = %{version}-%{release}

%description -n %{realname}-devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

%build
_CFLAGS="%{optflags} %{?gcc_lto}"
_LDFLAGS="-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}"
cmake -S . -B build \
 -G Ninja \
 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_C_FLAGS_RELEASE="$_CFLAGS" \
 -DCMAKE_EXE_LINKER_FLAGS_RELEASE="$_LDFLAGS" \
 -DCMAKE_MODULE_LINKER_FLAGS_RELEASE="$_LDFLAGS" \
 -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$_LDFLAGS" \
 -DCMAKE_SKIP_RPATH=YES \
 -DCMAKE_VERBOSE_MAKEFILE=YES \
 \
 -DBUILD_SHARED_LIBS=YES
ninja -v -C build %{?_smp_mflags}

%install
DESTDIR=%{buildroot} ninja -v -C build install

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%license COPYING
%doc AUTHORS NEWS README*
%{_bindir}/*
%doc %{_mandir}/man1/*

# Libraries
%files -n %{realname}%{?webp_so_ver}
%defattr(-,root,root)
%license COPYING
%doc AUTHORS NEWS README*
%{_libdir}/%{realname}.so.%{?webp_so_ver}*

%files -n %{realname}decoder%{?dec_so_ver}
%defattr(-,root,root)
%license COPYING
%doc AUTHORS NEWS README*
%{_libdir}/%{realname}decoder.so.%{?dec_so_ver}*

%files -n %{realname}demux%{?demux_so_ver}
%defattr(-,root,root)
%license COPYING
%doc AUTHORS NEWS README*
%{_libdir}/%{realname}demux.so.%{?demux_so_ver}*

%files -n %{realname}mux%{?mux_so_ver}
%defattr(-,root,root)
%license COPYING
%doc AUTHORS NEWS README*
%{_libdir}/%{realname}mux.so.%{?mux_so_ver}*

%files -n libsharpyuv%{?yuv_so_ver}
%defattr(-,root,root)
%license COPYING
%doc AUTHORS NEWS README*
%{_libdir}/libsharpyuv.so.%{?yuv_so_ver}*

# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%dir %{_includedir}/webp/sharpyuv
%dir %{_includedir}/webp/
%{_includedir}/webp/sharpyuv/*.h
%{_includedir}/webp/*.h
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%dir %{_datadir}/WebP/cmake
%dir %{_datadir}/WebP
%{_datadir}/WebP/cmake/*.cmake

%post   -n %{realname}%{?webp_so_ver} -p /sbin/ldconfig
%postun -n %{realname}%{?webp_so_ver} -p /sbin/ldconfig

%post   -n %{realname}decoder%{?dec_so_ver} -p /sbin/ldconfig
%postun -n %{realname}decoder%{?dec_so_ver} -p /sbin/ldconfig

%post   -n %{realname}demux%{?demux_so_ver} -p /sbin/ldconfig
%postun -n %{realname}demux%{?demux_so_ver} -p /sbin/ldconfig

%post   -n %{realname}mux%{?mux_so_ver} -p /sbin/ldconfig
%postun -n %{realname}mux%{?mux_so_ver} -p /sbin/ldconfig

%post   -n libsharpyuv%{?yuv_so_ver} -p /sbin/ldconfig
%postun -n libsharpyuv%{?yuv_so_ver} -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by