File dahdi-tools.spec of Package dahdi-tools

#
# spec file for package dahdi-tools
#
# Copyright (c) 2012 SUSE LINUX Products 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:           dahdi-tools
Summary:        Tools for the Digium Asterisk Hardware Device Interface driver
Version:        2.9.1
Release:        0
License:        GPL-2.0
Group:          Productivity/Telephony/Utilities
Url:            http://asterisk.org/

#DL-URL:	http://downloads.asterisk.org/pub/telephony/dahdi-tools/
Source:         http://downloads.asterisk.org/pub/telephony/dahdi-tools/%name-%version.tar.gz
Source2:        http://downloads.asterisk.org/pub/telephony/dahdi-tools/%name-%version.tar.gz.asc
Source3:        %name.keyring
Source4:        %name-rpmlintrc
Source5:        dahdi.init
Source6:        dahdi.sysconfig
Patch1:		dahdi-gcc47.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %insserv_prereq %fillup_prereq
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  dahdi-linux-devel
BuildRequires:  libusb-devel
BuildRequires:  newt-devel
BuildRequires:  perl
BuildRequires:  wget
%if 0%{?suse_version} >= 1130 || 0%{?fedora_version}
BuildRequires:  pkgconfig(libxml-2.0)
%else
BuildRequires:  libxml2-devel
%endif
Requires:       perl = %perl_version

%description
This package contains configuration files, header files, and setup
tools needed for the zapata telephony interface drivers.

See /usr/share/doc/packages/dahdi/README for a list of supported
hardware.

%package -n libtonezone2_0
Summary:        Tone zone database for the Tormenta ISA card
License:        LGPL-2.1
Group:          Development/Libraries/Other

%description -n libtonezone2_0
This package contains the shared libraries (.so)

%package -n libtonezone-devel
Summary:        Development files for libtonezone
License:        LGPL-2.1
Group:          Development/Libraries/C and C++
Requires:       libtonezone2_0 = %version
Provides:       dahdi-tools-devel

%description -n libtonezone-devel
This package contains the header files and libraries necessary for
developing applications which use zpatel.

%prep
%{?gpg_verify: %gpg_verify %{S:2}}
%setup -q
%patch -P 1 -p1

%build
./bootstrap.sh
%configure
make %{?_smp_mflags};

%install
b="%buildroot";
perl -pi -e "s/sitelib/vendorlib/g" xpp/Makefile
make install DESTDIR="$b"
make config DESTDIR="$b"

# Install the init script and sysconfig file  
install -D -m0755 "%{S:5}" "$b/%_initrddir/dahdi"
ln -sf "%_sysconfdir/init.d/dahdi" "$b/%_sbindir/rcdahdi"
install -D -m0644 "%{S:6}" "$b/%_localstatedir/adm/fillup-templates/sysconfig.dahdi"

# remove deprecated files
rm -Rf "$b/%_sysconfdir/hotplug"

# The explanation in dahdi-tools/Makefile seems to contradict itself,
# so just go with the fact that libtonezone1 is provided by zaptel/dahdi.
rm -f "$b/%_libdir"/libtonezone.so.1*;

# No shared library has this SONAME, so delete this stray symlink.
rm -f "$b/%_libdir/libtonezone.so.2";

# Nothing in this file. If user wants options, he should define his own
# file that is not tracked by rpm.
rm -f "$b/%_sysconfdir/modprobe.d/dahdi.conf";

mkdir -p "$b/%_prefix/lib"
mv "$b/etc/udev" "$b/%_prefix/lib/"

%preun
%{stop_on_removal dahdi}

%post 
%{fillup_and_insserv dahdi}

%postun
%restart_on_update dahdi
%insserv_cleanup

%post -n libtonezone2_0 -p /sbin/ldconfig

%postun -n libtonezone2_0 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc LICENSE* README
%dir %_sysconfdir/dahdi
%config %_sysconfdir/dahdi/*.sample
%config %_sysconfdir/dahdi/init.conf
%config %_sysconfdir/dahdi/genconf_parameters
%config %_sysconfdir/dahdi/modules
%config %_sysconfdir/dahdi/system.conf
#config %_sysconfdir/hotplug/usb/xpp_fxloader
#config %_sysconfdir/hotplug/usb/xpp_fxloader.usermap
%dir %_sysconfdir/modprobe.d
%config %_sysconfdir/modprobe.d/dahdi.blacklist.conf
/etc/init.d/dahdi
/var/adm/fillup-templates/sysconfig.dahdi
%perl_vendorlib/*
%_sbindir/*
%_mandir/man8/*
%_datadir/dahdi/
%_prefix/lib/udev/
%_sysconfdir/bash_completion.d/dahdi

%files -n libtonezone2_0
%defattr(-,root,root,-)
%_libdir/libtonezone.so.2.0*

%files -n libtonezone-devel
%defattr(-,root,root)
%_includedir/dahdi/tonezone.h
%attr(0644,root,root) %_libdir/libtonezone.a
%_libdir/libtonezone.so

%changelog
openSUSE Build Service is sponsored by