File Jinja2Cpp.spec of Package jinja2cpp

#
# spec file for package Jinja2Cpp
#
# 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 variant_vers 2.0.0
%define optional_vers 3.6.0
%define stringview_vers 1.8.0

Name:           Jinja2Cpp
Version:        1.3.2
Release:        0
Summary:        C++ implementation of the Jinja2 Python template engine
License:        MPL-2.0
URL:            https://github.com/jinja2cpp/Jinja2Cpp
Source0:        %{name}-%{version}.tar
Source1:        https://github.com/martinmoene/variant-lite/archive/v%{variant_vers}.tar.gz#/variant-%{variant_vers}.tar.gz
Source2:        https://github.com/martinmoene/optional-lite/archive/v%{optional_vers}.tar.gz#/optional-%{optional_vers}.tar.gz
Source3:        https://github.com/martinmoene/string-view-lite/archive/v%{stringview_vers}.tar.gz#/string-view-%{stringview_vers}.tar.gz
Patch0:         removed-unused-boost-libs.patch

BuildRequires:  boost-devel
BuildRequires:  cmake
BuildRequires:  expected-lite-devel
BuildRequires:  fmt-devel
BuildRequires:  gcc-c++
BuildRequires:  libboost_chrono-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_headers-devel
BuildRequires:  libboost_json1_86_0-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_system-devel
BuildRequires:  rapidjson-devel

%description
This library brings support of powerful Jinja2 template features into the C++
world, reports dynamic HTML pages and source code generation.

%package devel
Summary:        C++ implementation of the Jinja2 Python template engine
Requires:       %{name} = %{version}

%description devel
This library brings support of powerful Jinja2 template features into the C++
world, reports dynamic HTML pages and source code generation.

%package -n libjinja2cpp1
Summary:        C++ implementation of the Jinja2 Python template engine

%description -n libjinja2cpp1
This library brings support of powerful Jinja2 template features into the C++
world, reports dynamic HTML pages and source code generation.

%prep
cd %{_sourcedir}
# header only libraries
tar xzf %{S:1}
tar xzf %{S:2}
tar xzf %{S:3}
%autosetup -p1

%build
export CXXFLAGS="-fpermissive"
%cmake \
  -DJINJA2CPP_BUILD_TESTS=OFF \
  -DJINJA2CPP_DEPS_MODE=external \
  -DJINJA2CPP_WITH_JSON_BINDINGS=nlohmann \
  -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS \
  -Dvariant-lite_INCLUDE_DIR=%{_sourcedir}/variant-lite-%{variant_vers}/include \
  -Doptional-lite_INCLUDE_DIR=%{_sourcedir}/optional-lite-%{optional_vers}/include \
  -Dstring-view-lite_INCLUDE_DIR=%{_sourcedir}/string-view-lite-%{stringview_vers}/include \
  %{nil}
%cmake_build

%install
%cmake_install

mkdir -p %{buildroot}%{_libdir}/cmake %{buildroot}%{_libdir}/pkgconfig
mv %{buildroot}%{_libdir}/jinja2cpp %{buildroot}%{_libdir}/cmake
mv %{buildroot}%{_prefix}/share/pkgconfig/jinja2cpp.pc %{buildroot}%{_libdir}/pkgconfig

%post -n libjinja2cpp1 -p /sbin/ldconfig
%postun -n libjinja2cpp1 -p /sbin/ldconfig

%files
%license LICENSE
%doc README.md

%files devel
%{_includedir}/jinja2cpp
%{_libdir}/libjinja2cpp.so
%{_libdir}/cmake/jinja2cpp
%{_libdir}/pkgconfig/jinja2cpp.pc

%files -n libjinja2cpp1
%{_libdir}/libjinja2cpp.so.*

%changelog
openSUSE Build Service is sponsored by