File gnugk.spec of Package gnugk

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


Name:           gnugk
Version:        4.2
Release:        0
Summary:        OpenH323 Gatekeeper--The GNU Gatekeeper
License:        GPL-2.0+
Group:          Productivity/Telephony/H323/Servers
Url:            http://www.gnugk.org
Source0:        http://prdownloads.sourceforge.net/openh323gk/%{name}-%{version}-2.tar.gz
Source2:        %{name}.service
BuildRequires:  SDL-devel
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gcc-c++
BuildRequires:  h323plus-devel
BuildRequires:  krb5
BuildRequires:  libdv
BuildRequires:  libpt-devel
BuildRequires:  libtool
BuildRequires:  openldap2-devel
BuildRequires:  openssl-devel
BuildRequires:  pkg-config
BuildRequires:  sgml-skel
BuildRequires:  sgmltool
BuildRequires:  speex-devel
BuildRequires:  systemd-rpm-macros
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(libsasl2)
Requires(pre):  diffutils
Requires(pre):  grep
Recommends:     logrotate
%{?systemd_requires}

%description
The gatekeeper controls H.323 compatible clients (like ohphone) and can
be used to set up a complete Internet telephony system.

%prep
%setup -q

%build
%configure \
	--disable-mysql \
	--disable-pgsql \
    OPENH323DIR=%{_prefix}
make RPM_OPT_FLAGS="%{optflags}" opt %{?_smp_mflags}
make RPM_OPT_FLAGS="%{optflags}" doc %{?_smp_mflags}

%install
export M=`uname -m`
# only ix86 have problematic unames.
case $M in
  ??86) M=x86
  ;;
  armv7l) M=armv7hl
  ;;
esac
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_localstatedir}/log/gk
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
install -m 755 obj_linux_"$M"/gnugk %{buildroot}%{_sbindir}
#install -m 755 obj_linux_"$M"/addpasswd %{buildroot}%{_sbindir}/gkaddpasswd
install -m 644 etc/complete.ini %{buildroot}%{_sysconfdir}/gnugk.ini
mkdir -p %{buildroot}/%{_mandir}/man1
install -m 644 docs/gnugk.1 %{buildroot}/%{_mandir}/man1/gnugk.1
# Create symbolic run level links during installation
cat << EOF > %{buildroot}%{_sysconfdir}/logrotate.d/gnugk
%{_localstatedir}/log/gk/gk.log {
    rotate 30
    size=100M
    notifempty
    missingok
    postrotate
        systemctl try-restart %{name}.service
    endscript
}
EOF
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}

rm -f CMakeLists.txt

%pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%files
%defattr(-,root,root)
%doc *.txt
%{_mandir}/man1/gnugk.1.gz
%doc docs/manual/*.html
%doc etc/*
%config %{_sysconfdir}/gnugk.ini
%{_sbindir}/gnugk
%{_sbindir}/rcgnugk
%{_sysconfdir}/logrotate.d/gnugk
%{_localstatedir}/log/gk
%{_unitdir}/%{name}.service

%changelog
openSUSE Build Service is sponsored by