File rawspeed.spec of Package rawspeed

#
# spec file for package rawspeed
#
# Copyright (c) 2017 SUSE LINUX Products 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/
#

%global _lto_cflags %{nil}
%global flavor @BUILD_FLAVOR@%{nil}

%global with_openmp 1

%if "%{flavor}" == "clang"
%ifarch armv6l armv6hl armv7l armv7hl s390x riscv64
%global with_openmp 0
%endif
%endif

%if "%{flavor}" == "gcc"
%ifnarch riscv64
%global LINKER gold
%else
%global LINKER bfd
%endif
%elif "%{flavor}" == "clang"
%ifnarch s390x
%global LINKER lld
%else
%global LINKER gold
%endif
%endif

%global pkg_name rawspeed
Name:           %{pkg_name}-%{flavor}
Provides:       %{pkg_name}
Conflicts:      %{pkg_name}

Version:        0
Release:        0
License:        LGPL-2.1
Summary:        Fast raw decoding library
Url:            https://github.com/darktable-org/rawspeed
Group:          System/Libraries
Source:         %{pkg_name}-%{version}.tar.xz
BuildRequires:  cmake >= 3.18
BuildRequires:  ninja

%if "%{flavor}" == "gcc"
BuildRequires:  gcc-c++ >= 12
%elif "%{flavor}" == "clang"
BuildRequires:  clang >= 14
BuildRequires:  libstdc++-devel >= 12
%if %{with_openmp}
BuildRequires:  libomp-devel >= 14
%endif
%else
ExclusiveArch:  do_not_build
%endif

%if "%{LINKER}" == "lld"
BuildRequires:  lld
%elif "%{LINKER}" == "gold"
BuildRequires:  binutils-gold
%endif

%if 0%{?suse_version}
BuildRequires:  libxml2-tools
%else
BuildRequires:  libxml2
%endif
BuildRequires:  pkgconfig
BuildRequires:  pugixml-devel >= 1.8
BuildRequires:  libjpeg-devel
BuildRequires:  zlib-devel >= 1.2.11
BuildRequires:  googletest-source
BuildRequires:  googlebenchmark-source
BuildRoot:      %{_tmppath}/%{pkg_name}-%{version}-build

%description
RawSpeed…

- is capable of decoding various images in RAW file format.
- is intended to provide the fastest decoding speed possible.
- supports the most common DSLR and similar class brands.
- supplies unmodified RAW data, optionally scaled to 16 bit, or normalized to 0->1 float point data.
- supplies CFA layout for all known cameras.
- provides automatic black level calculation for cameras having such information.
- optionally crops off  “junk” areas of images, containing no valid image information.
- can add support for new cameras by adding definitions to an xml file.
- ~~is extensively crash-tested on broken files~~.
- decodes images from memory, not a file stream. You can use a memory mapped file, but it is rarely faster.
- open source under the LGPL v2 license.

%prep
%autosetup -n %{pkg_name}-%{version}

%build
%if "%{flavor}" == "gcc"
export CC="gcc"
export CXX="g++"
%elif "%{flavor}" == "clang"
export CC="clang"
export CXX="clang++"
%endif

export LD="ld.%{LINKER}"
export CFLAGS="${CFLAGS} -fuse-ld=%{LINKER}"
export CXXFLAGS="${CXXFLAGS} -fuse-ld=%{LINKER}"

%define __builder ninja
%cmake -GNinja -DWITH_OPENMP:BOOL=%{with_openmp} -DGOOGLETEST_PATH:PATH=%{_datadir}/googletest-source/ -DGOOGLEBENCHMARK_PATH:PATH=%{_datadir}/googlebenchmark-source/ -DCMAKE_BUILD_TYPE=ReleaseWithAsserts -DBUILD_SHARED_LIBS:BOOL=OFF
ninja %{?_smp_mflags}

%check
%ctest

%install
%define __builder ninja
%cmake_install

%files
%defattr(-,root,root)
%{_bindir}/rs-identify
%dir %{_datadir}/rawspeed/
%{_datadir}/rawspeed/cameras.xml
%{_datadir}/rawspeed/showcameras.xsl
openSUSE Build Service is sponsored by