#
# Conditional build:
%bcond_without openh323 # without OpenH323 support
+%bcond_with rxfax # with rx (also tx :-D) fax
+
+%define _spandsp_version 0.0.2-pre25
#
Summary: Asterisk PBX
Summary(pl): Centralka (PBX) Asterisk
Name: asterisk
-Version: 1.0.2
-Release: 2
+Version: 1.2.4
+Release: 1
License: GPL v2
Group: Applications/System
-Source0: ftp://ftp.digium.com/pub/%{name}/%{name}-%{version}.tar.gz
-# Source0-md5: 58b2c912b4e7c1f0438f06eb26c4b369
+Source0: ftp://ftp.digium.com/pub/asterisk/%{name}-%{version}.tar.gz
+# Source0-md5: 14721abdc85fc3381db275b61dffce2d
Source1: %{name}.init
Source2: %{name}.sysconfig
-Patch0: %{name}-openh323-makefile.patch
+#Patch0: %{name}-openh323-makefile.patch
Patch1: %{name}-Makefile_fix_gcc33.patch
-# It's included, but these sources are broken by me :)
+Patch2: %{name}-no_k6_on_sparc.patch
+Patch3: %{name}-lib.patch
+#Patch4: %{name}-openh323-formats.patch
+#Patch5: %{name}-openh323-rtti.patch
+#Patch6: %{name}-freetds.patch
+#Patch7: %{name}-t30.patch
+Patch8: %{name}-awk.patch
+#Patch9: %{name}-noarch.patch
+# It's included, but these sources are broken by me:)
# will fit on clean cvs source
-#Patch1: %{name}-DESTDIR.patch
-#Patch2: %{name}-Makefile2.patch
+#Patch1: %{name}-DESTDIR.patch
+#Patch2: %{name}-Makefile2.patch
+Source10: http://soft-switch.org/downloads/spandsp/spandsp-%{_spandsp_version}/asterisk-1.2.x/app_txfax.c
+Source11: http://soft-switch.org/downloads/spandsp/spandsp-%{_spandsp_version}/asterisk-1.2.x/app_rxfax.c
+Patch10: http://soft-switch.org/downloads/spandsp/spandsp-%{_spandsp_version}/asterisk-1.2.x/apps_Makefile.patch
URL: http://www.asterisk.org/
BuildRequires: bison
+BuildRequires: freetds >= 0.63
BuildRequires: gawk
#BuildRequires: glib-devel
#BuildRequires: gtk+-devel
-BuildRequires: libpri-devel
+BuildRequires: libpri-devel >= 1.2.0
+#BuildRequires: mpg123
BuildRequires: mysql-devel
BuildRequires: ncurses-devel
BuildRequires: openssl-devel >= 0.9.7d
+BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: sed >= 4.0
+BuildRequires: spandsp-devel < 1:0.0.3
+BuildRequires: spandsp-devel >= 1:0.0.2-0.pre20.1
+%{?with_rxfax:BuildRequires: spandsp-devel-%{_spandsp_version}}
BuildRequires: speex-devel
+BuildRequires: unixODBC-devel
BuildRequires: zaptel-devel
BuildRequires: zlib-devel
# These libraries are crazy...
# With openh323 1.11.7 and pwlib 1.4.11 i had sig11
#BuildRequires: openh323-devel = 1.10.4
+%{?with_openh323:BuildRequires: openh323-devel}
#BuildRequires: pwlib-devel = 1.4.4
-%{?with_h323:BuildRequires: openh323-devel}
-%{?with_h323:BuildRequires: pwlib-devel}
-PreReq: rc-scripts
+%{?with_openh323:BuildRequires: pwlib-devel}
Requires(post,preun): /sbin/chkconfig
-%{?with_h323:%requires_eq openh323}
-%{?with_h323:%requires_eq pwlib}
+Requires: rc-scripts
+%{?with_openh323:%requires_eq openh323}
+%{?with_openh323:%requires_eq pwlib}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
%prep
%setup -q
-%patch1 -p0
#%patch0 -p1
-#%patch1 -p1
-#%patch2 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+#%patch4 -p1
+#%patch5 -p1
+#%patch6 -p1
+#%patch7 -p1
+%patch8 -p1
+#%patch9 -p1
+
+%if %{with rxfax}
+cd apps
+%patch10 -p1
+cp %{SOURCE10} .
+cp %{SOURCE11} .
+%endif
sed -i -e "s#/usr/lib/#/usr/%{_lib}/#g#" Makefile
%build
rm -f pbx/.depend
-%{__make} \
+%{__make} -j1 \
CC="%{__cc}" \
OPTIMIZE="%{rpmcflags}"
-%if %{with h323}
+%if %{with openh323}
# H323 plugin:
-cd channels/h323/
-%{__make} \
+%{__make} -j1 -C channels/h323 \
PWLIBDIR="%{_prefix}" \
- OPENH323DIR="%{_prefix}" \
+ OPENH323DIR="%{_datadir}/openh323" \
CC="%{__cc}" \
- OPTIMIZE="%{rpmcflags}"
-cd ../../
+ CFLAGS="%{rpmcflags} -I/usr/include/openh323 -fPIC -I../../include"
+
%endif
# it requires doxygen - I don't know if we should do this...
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{/var/{log/asterisk/cdr-csv,spool/asterisk/monitor},/etc/{rc.d/init.d,sysconfig}}
-%{__make} install \
- DESTDIR=$RPM_BUILD_ROOT
-%{__make} samples \
+%{__make} -j1 install \
+ DESTDIR=$RPM_BUILD_ROOT
+%{__make} -j1 samples \
DESTDIR=$RPM_BUILD_ROOT
install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+%if %{with openh323}
+install channels/h323/h323.conf.sample $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/h323.conf
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%post
/sbin/chkconfig --add asterisk
-if [ -f /var/lock/subsys/asterisk ]; then
- /etc/rc.d/init.d/asterisk restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/asterisk start\" to start Asterisk daemon."
-fi
+%service asterisk restart "Asterisk daemon"
%preun
if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/asterisk ]; then
- /etc/rc.d/init.d/asterisk stop 1>&2
- fi
+ %service asterisk stop
/sbin/chkconfig --del asterisk
fi
%doc BUGS ChangeLog CREDITS HARDWARE README* SECURITY configs doc/{*.txt,linkedlists.README}
%attr(755,root,root) %{_sbindir}/*
%dir %{_sysconfdir}/asterisk
-%attr(754,root,root) %{_sysconfdir}/rc.d/init.d/%{name}
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/sysconfig/%{name}
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/asterisk/*.conf
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/asterisk/*.adsi
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/asterisk/*.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/asterisk/*.adsi
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/asterisk/extensions.ael
%dir %{_libdir}/asterisk
%dir %{_libdir}/asterisk/modules
%attr(755,root,root) %{_libdir}/asterisk/modules/*.so
/var/lib/asterisk/mohmp3/fpm-world-mix.mp3
%dir /var/lib/asterisk/sounds
%dir /var/lib/asterisk/sounds/digits
+%dir /var/lib/asterisk/sounds/dictate
%dir /var/lib/asterisk/sounds/letters
%dir /var/lib/asterisk/sounds/phonetic
/var/lib/asterisk/images/*.jpg
/var/lib/asterisk/keys/*.pub
/var/lib/asterisk/sounds/*.gsm
/var/lib/asterisk/sounds/digits/*.gsm
+/var/lib/asterisk/sounds/dictate/*.gsm
/var/lib/asterisk/sounds/letters/*.gsm
/var/lib/asterisk/sounds/phonetic/*.gsm
%dir /var/spool/asterisk
%dir /var/spool/asterisk/monitor
-%dir /var/spool/asterisk/vm
+#%%dir /var/spool/asterisk/vm
%dir /var/spool/asterisk/voicemail
%dir /var/spool/asterisk/voicemail/default
%dir /var/log/asterisk
%dir /var/log/asterisk/cdr-csv
-%{_mandir}/man8/asterisk.8.gz
+%{_mandir}/man8/asterisk.8*
+%{_mandir}/man8/astgenkey.8*
+%{_mandir}/man8/autosupport.8*
+%{_mandir}/man8/safe_asterisk.8*
%dir /var/lib/asterisk/firmware
%dir /var/lib/asterisk/firmware/iax
/var/lib/asterisk/firmware/iax/iaxy.bin
/var/spool/asterisk/voicemail/default/1234/busy.gsm
/var/spool/asterisk/voicemail/default/1234/unavail.gsm
-# RedHat specific init script file
-#%attr(754,root,root) /etc/rc.d/init.d/asterisk
#%dir /var/lib/asterisk/agi-bin/*
%files devel