asterisk/asterisk.spec

672 lines
20 KiB
RPMSpec

#
# spec file for package asterisk
#
# Copyright (c) 2019 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2017-2020 LISA GmbH, Bingen, 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/
#
%ifarch ppc ppc64 ppc64le
%bcond_with dahdi
%else
%bcond_without dahdi
%endif
Name: asterisk
Version: 18.12.1
Release: 0
URL: http://asterisk.org/
Summary: The Asterisk Open Source PBX
License: BSD-2-Clause and BSD-4-Clause or GPL-2.0
Group: Productivity/Telephony/Servers
#DL-URL: http://downloads.asterisk.org/pub/telephony/asterisk/
Source: https://downloads.asterisk.org/pub/telephony/asterisk/releases/%name-%version.tar.gz
Source2: https://downloads.asterisk.org/pub/telephony/asterisk/releases/%name-%version.tar.gz.asc
Source3: %name.keyring
Source4: asterisk.service
Source5: asterisk.init
Source6: https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.12/pjproject-2.12.tar.bz2
Source8: https://raw.githubusercontent.com/asterisk/third-party/master/jansson/2.14/jansson-2.14.tar.bz2
Patch1: asterisk-init.diff
Patch2: asterisk-configure-paths.diff
Patch3: asterisk-cflags.diff
Patch4: asterisk-rundir.diff
BuildRequires: autoconf >= 2.60
BuildRequires: automake >= 1.9
BuildRequires: wget
BuildRequires: bison
%if %{with dahdi}
BuildRequires: dahdi-linux-devel
BuildRequires: libtonezone-devel
%endif
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: freetds-devel
BuildRequires: gcc-c++
BuildRequires: graphviz
BuildRequires: imap-devel
BuildRequires: libedit-devel
BuildRequires: libgsm-devel
BuildRequires: libmysqlclient-devel
BuildRequires: libpri-devel
BuildRequires: libsrtp-devel
BuildRequires: libss7-devel
BuildRequires: libtool
BuildRequires: mISDNuser-devel
BuildRequires: ncurses-devel
BuildRequires: net-snmp-devel
BuildRequires: openldap2-devel
BuildRequires: openr2-devel
# It seems to also want the CLI interface of openssl
BuildRequires: openssl
BuildRequires: osp-toolkit-devel
BuildRequires: pkgconfig
BuildRequires: popt-devel
BuildRequires: postgresql-devel
%if (0%{?sle_version} >= 150200 && 0%{?is_opensuse}) || 0%{?suse_version} > 1500
BuildRequires: postgresql-server-devel
%endif
BuildRequires: libv4l-devel
BuildRequires: rubber
BuildRequires: termcap
BuildRequires: texlive
BuildRequires: xz
BuildRequires: pkgconfig(liburiparser)
%define with_corosync 1
BuildRequires: pkgconfig(SDL_image)
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(bluez)
BuildRequires: pkgconfig(gmime-3.0)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(iksemel)
BuildRequires: pkgconfig(jack)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libcfg)
BuildRequires: pkgconfig(libcpg)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libical)
BuildRequires: pkgconfig(libiodbc)
BuildRequires: pkgconfig(libnewt)
BuildRequires: pkgconfig(libusb)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libxslt)
BuildRequires: pkgconfig(lua)
BuildRequires: pkgconfig(neon)
BuildRequires: pkgconfig(ogg)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(portaudio-2.0)
BuildRequires: pkgconfig(sdl)
BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(spandsp)
BuildRequires: pkgconfig(speex)
BuildRequires: pkgconfig(speexdsp)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(zlib)
BuildRequires: systemd-rpm-macros
Requires: asterisk-sounds-base
Requires(pre): pwdutils
Provides: bundled(libjansson) = 2.14
Provides: bundled(pjproject) = 2.10
Provides: bundled(pjsip) = 2.10
# addons are included in main package since 1.8.x
Provides: asterisk-addons = %version-%release
Suggests: asterisk-doc = %version
%define scdperm %%attr(0751,root,asterisk) %%verify(not mode)
%define scfperm %%attr(0640,root,asterisk) %%verify(not mode) %%config(noreplace)
%description
Asterisk is a complete PBX in software. It provides all of the
features you would expect from a PBX and more. Asterisk does voice
over IP in three protocols and can interoperate with almost all
standards-based telephony equipment using relatively inexpensive
hardware.
Asterisk provides voicemail services with directory, call
conferencing, interactive voice response, and call queuing. It has
support for three-way calling, caller ID services, ADSI, SIP, and
H.323 (as both client and gateway).
Documentation is available on the Asterisk home page
(http://asterisk.org) and on the Asterisk wiki
(http://voip-info.org/wiki-Asterisk).
%package -n libasteriskssl1
Summary: Asterisk SSL initialization wrapper
Group: System/Libraries
%description -n libasteriskssl1
This Asterisk library is used to wrap various initialization and
shutdown functions from the libssl and libcrypto libraries provided
by OpenSSL. This is done so that Asterisk can ensure that these
functions do *not* get called by any modules that are loaded into
Asterisk, since they should only be called once in any single
process.
%package -n libasteriskpj2
Summary: Asterisk PJSIP library
Group: System/Libraries
%description -n libasteriskpj2
Asterisk-bundled version of the PJSIP library
%package doc
Summary: Asterisk Open Source PBX documentation
Group: Productivity/Telephony/Servers
%description doc
The Asterisk Open Source PBX documentation.
%package alsa
Summary: Soundcard module for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description alsa
This package allows Asterisk to use a soundcard supported by ALSA as
a telephone.
%package calendar
Summary: Calendar resource modules for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description calendar
The Asterisk Calendaring API aims to be a generic interface for
integrating Asterisk with various calendaring technologies. The goal
is to be able to support reading and writing of calendar events as
well as allowing notification of pending events through the Asterisk
dialplan.
There are three calendaring modules that ship with Asterisk that
provide support for iCalendar, CalDAV, and Microsoft Exchange Server
calendars. All three modules support event notification. Both CalDAV
and Exchange support reading and writing calendars, while iCalendar
is a read-only format.
%package console
Summary: Console channel module for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description console
The Asterisk Command Line Interface.
In addition to being the console for Asterisk, the CLI also sports
several features that make it very helpful to use for obtaining
information and affecting system configuration.
%package corosync
Summary: Corosync module for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description corosync
Corosync is an open source group messaging system typically used in
clusters, cloud computing, and other high availability environments.
Using Corosync together with res_corosync allows events to be shared
amongst a local cluster of Asterisk servers. Specifically, the types
of events that may be shared include:
* Device state
* Message Waiting Indication, or MWI (to allow voicemail to live on a
server that is different from where the phones are registered)
%package dahdi
Summary: Telephony Hardware Module for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description dahdi
This module allows Asterisk to use telephony hardware that is
supported by the dahdi kernel drivers. Supported hardware ranges from
FXO and FXS cards over ISDN BRI cards to T1, and E1 cards with up to
four interfaces.
See the dahdi package for details.
%package devel
Summary: Development files for Asterisk
Group: Development/Libraries/C and C++
Requires: asterisk = %version
Requires: libasteriskssl1 = %version
%description devel
This package contains the header files and libraries necessary for
developing applications which use asterisk.
Install asterisk-devel if you want to develop applications which
depend on asterisk.
%package freetds
Summary: FreeTDS Call Detail Recording and Call Event Logging for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description freetds
This package allows Asterisk to use a FreeTDS database for CDR and
CEL.
%package mobile
Summary: Mobile (BlueTooth) channel for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description mobile
Mobile (BlueTooth) channel for Asterisk.
%package moh-base
Summary: MOH audio files for Asterisk
Group: Productivity/Telephony/Servers
BuildArch: noarch
%description moh-base
MusicOnHold: Plays hold music specified by class. If omitted, the
default music source for the channel will be used.
%package odbc
Summary: Database Module for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description odbc
This package allows Asterisk to use read configuration data from, and
write call logs to ODBC databases.
%package pgsql
Summary: Database Module for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description pgsql
This package allows Asterisk to use read configuration data from, and
write call logs to PostgreSQL databases.
%package mysql
Summary: Mysql Database Module for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description mysql
This package allows Asterisk to use read configuration data from, and
write call logs to MySQL databases.
%package radius
Summary: Radius modules for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description radius
The RADIUS CEL Backend. It needs:
* FreeRADIUS server
* Radiusclient-ng library
* Asterisk PBX
For more information, see the wiki at
https://wiki.asterisk.org/wiki/display/AST/RADIUS+CEL+Backend
%package snmp
Summary: SNMP resource module for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description snmp
Rudimentary support for SNMP access to Asterisk is available.
%package sounds-base
Summary: Sound files for Asterisk
License: CC-BY-SA-3.0
Group: Productivity/Telephony/Servers
BuildArch: noarch
%description sounds-base
The set of core Asterisk sounds.
%package spandsp
Summary: SpanDSP plugin for Asterisk
Group: Productivity/Telephony/Servers
Requires: asterisk = %version
%description spandsp
Spandsp is a library for Digital Signal Processing (DSP). DSP is used
to turn images into audio and back. In Asterisk, spandsp, is required
for sending and receiving faxes.
%prep
%autosetup -p1
%build
# activate privilege separation
# activate languageprefix (needed by sounds package)
# the sad story about perl: -p doesn't consider missing files as failures
perl -i -pe '
s{^;\s*runuser\s*=\s*\S+}{runuser = asterisk};
s{^;\s*rungroup\s*=\s*\S+}{rungroup = asterisk};
s{^;\s*languageprefix\s*=\s*\S+}{languageprefix = yes};
' configs/samples/asterisk.conf.sample 2>&1 | grep -i 'no such file' && false
./bootstrap.sh
#
# NB:
# [ 27s] checking for -march=native support... user CFLAGS present
# This is exactly what we want.
#
%configure \
--with-pjproject-bundled=yes \
--with-jansson-bundled=yes \
NOISY_BUILD=yes \
EXTERNALS_CACHE_DIR="%_sourcedir"
make menuselect.makeopts
menuselect/menuselect \
--enable app_macro \
--enable app_meetme \
--enable app_mysql \
--enable res_config_mysql \
--enable cdr_mysql \
--enable smsq \
--enable chan_mobile
make NOISY_BUILD=1 # %{?_smp_mflags}
%install
b="%buildroot"
%make_install DOWNLOAD="/bin/true"
make install-headers DESTDIR="$b"
make samples DESTDIR="$b"
# F!@#$d up DESTDIR support. Do proper symlink.
rm -f "$b/%_libdir/libasteriskssl.so"
ln -s libasteriskssl.so.1 "$b/%_libdir/libasteriskssl.so"
mkdir -p "$b/%_includedir"
install -pm0644 include/asterisk.h "$b/%_includedir/"
cp -rp include/asterisk "$b/%_includedir/"
rm "$b/%_includedir/asterisk/.gitignore"
rm "$b/%_includedir/asterisk/autoconfig.h.in"
rm -f "$b/%_includedir/asterisk/autoconfig.h.in~"
# service
mkdir -p "$b/%_sbindir"
mkdir -p "$b/%_unitdir"
install -pm0644 "%{S:4}" "$b/%_unitdir/"
ln -sf /sbin/service "$b/%_sbindir/rcasterisk"
mkdir -p "$b/%_datadir/%name"
cp -a configs "$b/%_datadir/%name/"
fl_asterisk="$PWD/asterisk.files"
>"$fl_asterisk"
pushd "$b/%_sysconfdir/%name/"
for i in *; do
case "$i" in
(ais.conf|alsa.conf|calendar.conf|console.conf) :;;
(*_corosync.conf|*_dahdi.conf) :;;
(*_odbc.conf|*_pgsql.conf|*_mysql.conf|*_snmp.conf) :;;
(*_tds.conf) :;;
(*) echo "%%scfperm %%_sysconfdir/%%name/$i" >>"$fl_asterisk";;
esac
done
popd
pushd "$b/%_libdir/%name/modules/"
for i in *; do
case "$i" in
(*_ais.so|*_alsa.so|*_calendar*.so|*_console.so) :;;
(*_corosync.so|*_dahdi*.so) :;;
(*_odbc.so|*_pgsql.so|*_mysql.so|*_radius.so|*_snmp.so) :;;
(*_spandsp.so|*_tds.so) :;;
(*) echo "%_libdir/%name/modules/$i" >>"$fl_asterisk";;
esac
done
popd
pushd "$b/%_datadir/%name/configs/"
for i in *; do
j="${i%.sample}"
case "$j" in
(ais.conf|alsa.conf|calendar.conf|console.conf) :;;
(*_corosync.conf|*_dahdi.conf) :;;
(*_odbc.conf|*_pgsql.conf|*_mysql.conf|*_snmp.conf) :;;
(*_tds.conf) :;;
(*) echo "%_datadir/%name/configs/$i" >>"$fl_asterisk";;
esac
done
popd
%fdupes %buildroot/%_prefix
# don't package man files twice
rm doc/*.8
# avoid stray dahdi config
%if ! %{with dahdi}
rm %buildroot/%_sysconfdir/%name/chan_dahdi.conf
%endif
%pre
%_bindir/getent group asterisk >/dev/null || \
%_sbindir/groupadd -r asterisk || :
%_bindir/getent passwd asterisk >/dev/null || \
%_sbindir/useradd -r -s /sbin/false -d /var/lib/asterisk \
-M -c "Asterisk PBX" -g asterisk asterisk || :
%service_add_pre asterisk.service
%post
%service_add_post asterisk.service
%preun
%service_del_preun asterisk.service
%postun
%service_del_postun asterisk.service
%post -n libasteriskssl1 -p /sbin/ldconfig
%postun -n libasteriskssl1 -p /sbin/ldconfig
%post -n libasteriskpj2 -p /sbin/ldconfig
%postun -n libasteriskpj2 -p /sbin/ldconfig
%files -f asterisk.files
%license COPYING LICENSE
%doc BUGS CHANGES ChangeLog README.md sample.call *.txt doc/README.txt
%scdperm %dir %_sysconfdir/asterisk
%_unitdir/asterisk.service
%_sbindir/astcanary
%_sbindir/astdb2bdb
%_sbindir/astdb2sqlite3
%_sbindir/asterisk
%_sbindir/astgenkey
%_sbindir/astversion
%_sbindir/autosupport
%_sbindir/rasterisk
%_sbindir/rcasterisk
%_sbindir/safe_asterisk
%_sbindir/smsq
%dir %_libdir/asterisk
%dir %_libdir/asterisk/modules
%dir %_datadir/%name
%dir %_datadir/%name/configs
%dir %_datadir/%name/keys
%_datadir/%name/documentation
%_datadir/%name/firmware
%_datadir/%name/images
%_datadir/%name/phoneprov/
%_datadir/%name/rest-api/
%_datadir/%name/scripts/
%_datadir/%name/static-http
%exclude %_datadir/%name/configs/samples/alsa.conf.sample
%exclude %_datadir/%name/configs/samples/calendar.conf.sample
%exclude %_datadir/%name/configs/samples/console.conf.sample
%exclude %_datadir/%name/configs/samples/res_corosync.conf.sample
%exclude %_datadir/%name/configs/samples/chan_dahdi.conf.sample
%exclude %_datadir/%name/configs/samples/*_tds.conf.sample
%exclude %_datadir/%name/configs/samples/*_odbc.conf.sample
%exclude %_datadir/%name/configs/samples/*_pgsql.conf.sample
%exclude %_datadir/%name/configs/samples/*_mysql.conf.sample
%exclude %_datadir/%name/configs/samples/*_snmp.conf.sample
%exclude %{_sysconfdir}/asterisk/chan_mobile.conf
%exclude %{_libdir}/asterisk/modules/*_mobile.so
%attr(0750,asterisk,asterisk) %_localstatedir/lib/%name
%attr(0750,asterisk,asterisk) %_localstatedir/spool/%name
%attr(0750,asterisk,asterisk) %dir %_localstatedir/log/asterisk
%attr(0750,asterisk,asterisk) %dir %_localstatedir/log/asterisk/cdr-csv
%attr(0750,asterisk,asterisk) %dir %_localstatedir/log/asterisk/cdr-custom
%attr(0750,asterisk,asterisk) %dir %_localstatedir/log/asterisk/cel-custom
%_mandir/man8/*
%files doc
%doc doc/* *.txt *.html
%files -n libasteriskssl1
%_libdir/libasteriskssl.so.*
%files -n libasteriskpj2
%_libdir/libasteriskpj.so.*
%files alsa
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/alsa.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_alsa.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/alsa.conf.sample
%files calendar
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/calendar.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_calendar*.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/calendar.conf.sample
%files console
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/console.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_console.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/console.conf.sample
%if 0%{?with_corosync}
%files corosync
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/res_corosync.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
#_libdir/name/modules/res_corosync.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/res_corosync.conf.sample
%endif
%if %{with dahdi}
%files dahdi
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/chan_dahdi.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_dahdi*
%dir %_datadir/dahdi
%dir %_datadir/dahdi/span_config.d
%_datadir/dahdi/span_config.d/40-asterisk
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/chan_dahdi.conf.sample
%endif
%files devel
%_includedir/%{name}.h
%dir %_includedir/%{name}
%_includedir/%{name}/*.h
%dir %_includedir/%{name}/doxygen
%_includedir/%{name}/doxygen/*.h
%_libdir/libasteriskssl.so
%_libdir/libasteriskpj.so
%files freetds
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/*_tds.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_tds.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/*_tds.conf.sample
%files mobile
%attr(0640,asterisk,asterisk) %config(noreplace) %_sysconfdir/asterisk/chan_mobile.conf
%_libdir/asterisk/modules/*_mobile.so
%files moh-base
%dir %_datadir/%name
%_datadir/%name/moh
%files odbc
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/*_odbc.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_odbc.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/*_odbc.conf.sample
%files pgsql
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/*_pgsql.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_pgsql.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/*_pgsql.conf.sample
%files mysql
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/*_mysql.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_mysql.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/*_mysql.conf.sample
%files sounds-base
%dir %_datadir/%name
%_datadir/%name/sounds
%files snmp
%scdperm %dir %_sysconfdir/%name
%scfperm %_sysconfdir/%name/*_snmp.conf
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_snmp.so
%dir %_datadir/%name
%dir %_datadir/%name/configs/samples
%_datadir/%name/configs/samples/*_snmp.conf.sample
%files spandsp
%dir %_libdir/%name
%dir %_libdir/%name/modules
%_libdir/%name/modules/*_spandsp.so
%changelog