File rhvoice.spec of Package rhvoice

%define realname rhvoice
%define srcext   tar.xz

%define so_ver       4
%define so_ver_audio 1
%define so_ver_core  2

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

# Common info
Name:          %{realname}
Version:       0
Release:       %{?extraver:0.}1%{?dist}
License:       GPL-3.0+ and LGPL-2.1+
Group:         Productivity/Multimedia/Other
URL:           https://github.com/Olga-Yakovleva/RHVoice
Summary:       Free and open source speech synthesizer for Russian language

# Install-time parameters
Provides:      libRHVoice2 libRHVoice_audio0 libRHVoice_core0
Provides:      librhvoice2 librhvoice_audio0 librhvoice_core0

# Build-time parameters
BuildRequires: cmake >= 3.9
BuildRequires: gcc-c++
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(giomm-2.4)
BuildRequires: pkgconfig(speech-dispatcher)
BuildRequires: pkgconfig(ao)
BuildRequires: pkgconfig(libpulse-simple)
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
Requires: speech-dispatcher
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}%{?extraver}.%{srcext}

%description
RHVoice is a free and open source speech synthesizer.

%package devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}

%description devel
Headers and libraries for development using %{name}.

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

%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack %{?gcc_lto}'
_CMAKE_ARGS=(
 -DCMAKE_INSTALL_PREFIX=%{_prefix}
 -DCMAKE_BUILD_TYPE=Release
 -DCMAKE_C_FLAGS_RELEASE="$_CFLAGS"
 -DCMAKE_CXX_FLAGS_RELEASE="$_CFLAGS"
 -DCMAKE_EXE_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_MODULE_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_VERBOSE_MAKEFILE=YES
)
%{__mkdir} build
cd build
cmake .. \
 "${_CMAKE_ARGS[@]}" \
 \
 -DRHVOICE_VERSION_FROM_GIT=%{version} \
 -DENABLE_SONIC=YES \
 -DHARDENING_SSE2=YES
%{__make} %{?_smp_mflags}

%install
%{__make} -C build install DESTDIR=%{buildroot}
### %{__install} -d -m755 %{buildroot}%{_libdir}/speech-dispatcher-modules
### %{__ln_s} -f %{_bindir}/sd_rhvoice %{buildroot}%{_libdir}/speech-dispatcher-modules/
%if 0%{?suse_version}
### %fdupes %{buildroot}%{_datadir}/RHVoice/
%endif

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

%files
%defattr(-,root,root)
%license LICENSE.md
%doc NEWS README.md
%{_bindir}/*
%{_libdir}/libRHVoice.so.%{so_ver}*
%{_libdir}/libRHVoice_audio.so.%{so_ver_audio}*
%{_libdir}/libRHVoice_core.so.%{so_ver_core}*
%dir %{_libdir}/speech-dispatcher-modules
%{_libdir}/speech-dispatcher-modules/sd_rhvoice
%dir %{_sysconfdir}/RHVoice/
%config(noreplace) %{_sysconfdir}/RHVoice/RHVoice.conf
%{_datadir}/RHVoice/

# Development files
%files devel
%defattr(-,root,root)
%{_includedir}/RHVoice.h
%{_includedir}/RHVoice_common.h
%{_libdir}/*.so

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

%changelog
openSUSE Build Service is sponsored by