File libbpg.spec of Package libbpg

#
# spec file for package libbpg
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define  soname 0_9
%define   _ver  %(printf %{version} | cut -f1,2 -d .)
Name:           libbpg
Version:        0.9.8
Release:        0
Summary:        Library and tools for manipulating BPG image format files
License:        LGPL-2.1-only AND BSD-3-Clause
Group:          Productivity/Graphics/Convertors
URL:            https://bellard.org/bpg
Source0:        https://bellard.org/bpg/%{name}-%{version}.tar.gz
Source1:        %{name}.rpmlintrc
Patch0:         jctvc_TLibCommon_TComPicYuv.cpp.patch
Patch1:         Makefile.patch
# PATCH-FIX-OPENSUSE Dont_build_x265.patch
Patch2:         Dont_build_x265.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libSDL-devel
BuildRequires:  libSDL_image-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  yasm
ExclusiveArch:  aarch64 ppc64 ppc64le x86_64

%description
BPG (Better Portable Graphics) is a image format whose purpose is to
replace the JPEG image format when quality or file size is an issue. Its
main advantages are:
* High compression ratio. Files are much smaller than JPEG for similar quality.
* Supported by most Web browsers with a small Javascript decoder.
* Based on a subset of the HEVC open video compression standard.
* Supports the same chroma formats as JPEG (grayscale, YCbCr 4:2:0, 4:2:2,
4:4:4) to reduce the losses during the conversion. An alpha channel is
supported. The RGB, YCgCo and CMYK color spaces are also supported.
* Native support of 8 to 14 bits per channel for a higher dynamic range.
* Lossless compression is supported.
* Various metadata (such as EXIF, ICC profile, XMP) can be included.

%package -n     %{name}%{soname}
Summary:        Libraries for %{name}
Group:          System/Libraries

%description -n %{name}%{soname}
libbpg libraries for development

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

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package -n     bpg-tools
Summary:        The BPG command line encoder and decoder
Group:          Productivity/Graphics/Convertors

%description -n bpg-tools
This package contains BPG command line encoder, decoder and image
viewer.

%prep
%autosetup -p1
# Remove the forbidden x265
rm -rf x265

%build
export CFLAGS="%{optflags} -fPIC"
%make_build

%install
%make_install PREFIX=%{_prefix}
install -Dm 644 bpgenc.h libbpg.h -t %{buildroot}%{_includedir}
install -Dm 644 %{name}.a -t %{buildroot}%{_libdir}
install -Dm 755 %{name}.so %{buildroot}%{_libdir}/%{name}.so.%{_ver}
ln -sf %{name}.so.%{_ver} %{buildroot}%{_libdir}/%{name}.so.0
ln -sf %{name}.so.%{_ver} %{buildroot}%{_libdir}/%{name}.so

%ldconfig_scriptlets -n %{name}%{soname}

%files -n bpg-tools
%doc README doc html post.js
%{_bindir}/bpgdec
%{_bindir}/bpgenc
%{_bindir}/bpgview

%files -n %{name}%{soname}
%{_libdir}/%{name}.so.*

%files devel
%{_includedir}/*
%{_libdir}/%{name}.a
%{_libdir}/%{name}.so

%changelog
openSUSE Build Service is sponsored by