File gdbuspp.spec of Package gdbuspp
%define realname gdbuspp
%define realver 3
%define srcext tar.gz
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: lib%{realname}%{realver}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: AGPL-3.0
Group: System/Libraies
URL: https://github.com/OpenVPN/gdbuspp
Summary: GDBus++ :: glib2 D-Bus C++ interface
# Build-time parameters
BuildRequires: gcc-c++
BuildRequires: meson >= 0.58 ninja
BuildRequires: pkg-config
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(gthread-2.0)
Source0: https://codeload.github.com/OpenVPN/%{realname}/%{srcext}/refs/tags/v%{realver}#/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
This library provides a simpler C++ based interface to implement D-Bus into
applications in a more C++ approach, based on the C++17 standard.
%package -n %{realname}-devel
Group: Development/Languages/C and C++
Summary: Development files for GDBus++ :: glib2 D-Bus C++ interface
Requires: %{name} = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
Provides: lib%{realname}-devel = %{version}-%{release}
%description -n %{realname}-devel
This package provides development files for a simpler C++ based interface to
implement D-Bus into applications in a more C++ approach.
# 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}'
meson setup build \
--buildtype=release \
--optimization=2 \
--strip \
\
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--default-library=shared \
\
-Db_lto=true \
-Db_ndebug=if-release \
-Dc_args="$_CFLAGS" \
-Dc_link_args="$_LDFLAGS"
ninja -v -C build %{?_smp_mflags}
%install
DESTDIR=%{buildroot} ninja -v -C build install
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/doc
%files
%defattr(-,root,root)
%license LICENSES/AGPL-3.0-only.txt
%doc README.md
%{_libdir}/lib%{realname}.so.%{version}*
%files -n %{realname}-devel
%defattr(-,root,root)
%license LICENSES/AGPL-3.0-only.txt
%{_libdir}/pkgconfig/%{realname}.pc
%{_includedir}/gdbuspp/
%{_libdir}/lib%{realname}.so
%exclude %{_libdir}/lib%{realname}.a
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog