File dahdi-tools.spec of Package dahdi-tools

#
# spec file for package dahdi-tools
#
# Copyright (c) 2020 SUSE LLC
#
# 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
Version:        3.1.0
Release:        1
Summary:        Tools for the Digium Asterisk Hardware Device Interface driver
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.xz
Source2:        http://downloads.asterisk.org/pub/telephony/dahdi-tools/%name-%version.tar.xz.asc
Source3:        %name.keyring
Source4:        %name-rpmlintrc
Source5:        dahdi.init
Source6:        dahdi.sysconfig
Patch1:         dahdi-gcc47.diff
Patch2:         xpp-makefile.patch
Patch3:         dahdi-tools-fix-members.diff
Patch4:         dahdi-tools-fix-lto.patch
BuildRoot:      %_tmppath/%name-%version-build
BuildRequires:  autoconf >= 2.59
BuildRequires:  automake
BuildRequires:  bash-completion
BuildRequires:  dahdi-linux-devel >= %version
BuildRequires:  libusb-devel
BuildRequires:  libtool
BuildRequires:  newt-devel
BuildRequires:  perl
BuildRequires:  pkg-config
BuildRequires:  wget
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(libxml-2.0)
Requires(pre):  %insserv_prereq %fillup_prereq
Requires:       perl = %perl_version
Requires:       udev
Recommends:     sethdlc

%if !0%{?_fillupdir:1}
%define _fillupdir /var/adm/fillup-templates
%endif

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

See %_datadir/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
%autosetup -p1

%build
autoreconf -fi
for i in %_datadir/automake*/install-sh; do
	cp "$i" .
done
%configure --disable-static --with-perllib="%perl_vendorlib"
%make_build

%install
b="%buildroot"
perl -pi -e "s/sitelib/vendorlib/g" xpp/Makefile
%make_install
make config DESTDIR="$b"
make install-config DESTDIR="$b"
rm -f "$b/%_libdir"/*.la

# 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/%_fillupdir/sysconfig.dahdi"
touch "$b/%_sysconfdir/dahdi/modules"
install -D -m0644 "system.conf.sample" "$b/%_sysconfdir/dahdi/system.conf"

# 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/%_sysconfdir/udev" "$b/%_prefix/lib/"

mkdir -p "$b/%_datadir/bash-completion/"
mv "$b/etc/bash_completion.d" "$b/%_datadir/bash-completion/completions"

# Drop outdated bundled version of sethdlc
rm %buildroot/%_sbindir/sethdlc

%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
%license LICENSE*
%doc 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
%_initddir/dahdi
%_fillupdir/sysconfig.dahdi
%perl_vendorlib/*
%_sbindir/*
%_mandir/man8/*
%_datadir/dahdi/
%_datadir/bash-completion/completions/
%_prefix/lib/dracut/
%_prefix/lib/udev/

%files -n libtonezone2_0
%_libdir/libtonezone.so.2.0*

%files -n libtonezone-devel
%_includedir/dahdi/tonezone.h
%_libdir/libtonezone.so

%changelog
openSUSE Build Service is sponsored by