File iaxmodem.spec of Package iaxmodem

#
# spec file for package iaxmodem
#
# Copyright (c) 2022 SUSE LLC
# Michael Kromer (mkromer) <michael.kromer@millenux.com>
# (c) 2010 Mi||enux
#
# 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/
#

%bcond_without bundledlibs


Name:           iaxmodem
Version:        1.3.3
Release:        0
Summary:        Software modem for interfacing Asterisk and Hylafax via IAX2
License:        GPL-2.0+
Group:          Productivity/Telephony/Servers
URL:            http://sf.net/projects/iaxmodem/

Source:         http://downloads.sf.net/%name/%name-%version.tar.gz
Source2:        iaxmodem.logrotate.d
Source3:        iaxmodem.service
Source4:        README.SUSE
Patch1:         iaxmodem-config.patch
%if %{with bundledlibs}
Patch2:         iaxmodem-handle-international-dialstring-prefix.patch
%else
Patch2:         iaxmodem-unbundle-spandsp-libiax.patch
%endif
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  pkgconfig
%if !%{with bundledlibs}
BuildRequires:  libiax-devel
BuildRequires:  pkgconfig(spandsp)
%endif
BuildRequires:  systemd-rpm-macros
Requires:       asterisk
Requires:       hylafax
%if 0%{?suse_version} >= 1500
Requires(pre):  group(uucp)
Requires(pre):  user(uucp)
%else
Requires(pre):  aaa_base
%endif

%description
IAXmodem is a software modem written in C that uses an IAX channel
(commonly provided by an Asterisk PBX system) instead of a
traditional phone line and uses a DSP library instead of DSP hardware
chipsets.

To accomplish this, then, IAXmodem interfaces an IAX library known as
libiax2 with a DSP library known as spandsp, and then IAXmodem
interfaces the DSP library with a tty device node for interfacing
with modem applications.

%prep
%autosetup -p1
mv config.ttyIAX config.ttyIAX0
mv iaxmodem-cfg.ttyIAX iaxmodem-cfg.ttyIAX0
cp %_sourcedir/README.SUSE .

%build
%configure
%make_build

%install
b="%buildroot"
install -Dpm0644 %SOURCE2 "$b/%_sysconfdir/logrotate.d/iaxmodem"
install -Dpm0755 iaxmodem "$b/%_sbindir/iaxmodem"
install -Dpm0644 iaxmodem.1 "$b/%_mandir/man1/iaxmodem.1"
install -Dpm0644 %SOURCE3 "$b/%_unitdir/iaxmodem.service"
ln -sf "%_unitdir/iaxmodem.service" "$b/%_sbindir/rciaxmodem"
mkdir -p "$b/%_sysconfdir/iaxmodem" "$b/%_localstatedir/log/iaxmodem"

%pre
%service_add_pre iaxmodem.service 

%post
%service_add_post iaxmodem.service 

%preun
%service_del_preun iaxmodem.service 

%postun
%service_del_postun iaxmodem.service 

%files
%doc CHANGES FAQ README README.SUSE TODO config.ttyIAX0 iaxmodem-cfg.ttyIAX0
%_sysconfdir/iaxmodem
%_sbindir/iaxmodem
%_sbindir/rciaxmodem
%_mandir/man1/iaxmodem.1.gz
%config %_sysconfdir/logrotate.d/iaxmodem
%attr(-,uucp,root) %_localstatedir/log/iaxmodem
%_unitdir/iaxmodem.service

%changelog
openSUSE Build Service is sponsored by