File asterisk.spec of Package asterisk

#
# spec file for package asterisk
#
# 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:           asterisk
Version:        16.13.0
Release:        0
Summary:        A free and open source framework for building communications applications
License:        GPL-2.0
Group:          Productivity/Telephony/Servers
Url:            http://www.asterisk.org
Source0:        https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-%{version}.tar.gz
Source1:        asterisk.systemd
Source2:        asterisk.sysconfig
Patch0:         asterisk.disable_arch_native.patch
Patch1:         asterisk.enablechathtml.patch
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libjansson-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libsrtp-devel
BuildRequires:  libuuid-devel
BuildRequires:  libxml2-devel
BuildRequires:  ncurses-devel
BuildRequires:  openldap2-devel
BuildRequires:  sqlite-devel
BuildRequires:  wget
BuildRequires:  alsa-devel
BuildRequires:  pjproject-devel
BuildRequires:  unixODBC-devel
BuildRequires:  libtool
# for >= 16.0.0
BuildRequires:  libedit-devel
BuildRequires:  libjansson-devel >= 2.11
Requires:       libjansson4 >= 2.11
#
Requires:       ncurses
Requires:       sqlite
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%package devel
Summary:        Development package for asterisk
Group:          Development/Libraries/C and C++

%description
Asterisk is a free and open source framework for building communications applications and is sponsored by Digium.
Asterisk turns an ordinary computer into a communications server. Asterisk powers IP PBX systems, VoIP gateways, conference servers and is used by small businesses, large businesses, call centers, carriers and governments worldwide.

%description devel
Development package for asterisk. Asterisk is a free and open source framework.

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1

%build
%configure --with-ssl --without-pjproject-bundled
make all # %{?_smp_mflags}

%install
# %{?_smp_mflags}
make DESTDIR=%{buildroot} install # %{?_smp_mflags}
make samples DESTDIR=%{?buildroot}

install -D -m 644 %{SOURCE1} %{buildroot}%{_prefix}/lib/systemd/system/%{name}.service
%if 0%{?suse_version} < 1500
install -D -m 644 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
%else
install -D -m 644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.%{name}
%endif

ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}

%fdupes -s %{buildroot}

%files
%defattr(-,root,root)
%doc ChangeLog COPYING
%{_libdir}/*
%{_sbindir}/*
%{_mandir}/man8/*
%{_var}/lib/asterisk
%{_var}/spool/asterisk
%{_prefix}/lib/systemd/system/%{name}.service
%if 0%{?suse_version} < 1500
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
%else
%{_fillupdir}/sysconfig.%{name}
%endif
%config(noreplace) %{_sysconfdir}/%{name}
%dir %{_localstatedir}/log/asterisk

%files devel
%defattr(-,root,root)
%{_includedir}/*

%pre
%service_add_pre %{name}.service

%post
%{fillup_only asterisk}
%service_add_post %{name}.service
ldconfig

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service
ldconfig

%changelog