File talk.spec of Package talk

#
# spec file for package talk (Version 0.17)
#
# Copyright (c) 2009 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/
#

# norootforbuild


Name:           talk
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
License:        BSD3c
Group:          Productivity/Networking/Talk/Clients
BuildRequires:  ncurses-devel
Provides:       nkitb:/usr/bin/talk
AutoReqProv:    on
Version:        0.17
Release:        699
Summary:        Talk Client for Chatting with Another User
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/
Source:         netkit-ntalk-%{version}.tar.bz2
Source1:        talk.xinetd
Source2:        ntalk.xinetd
Source3:        talkd.fw
Patch:          netkit-ntalk-%{version}.dif
Patch1:         netkit-ntalk-multibyte.diff
Patch2:         netkit-ntalk-%{version}-alt-talkd.patch
Patch3:         netkit-ntalk-%{version}-strip.diff
Patch4:         netkit-ntalk-%{version}-dont-resolve.patch
Patch5:         netkit-n%{name}-0.17-dots_in_usernames.patch
# PATCH-FIX-UPSTREAM netkit-ntalk-0.17-close_file_on_failure.patch
Patch6:         netkit-ntalk-0.17-close_file_on_failure.patch
%global         ncursesw_config %(set -- %{_bindir}/ncursesw*-config; echo ${1})

%description
This package contains the talk client, which allows you to chat with
another user on a different system. Talk is a communication program
which copies lines from one terminal to that of another user.



%package server
License:        BSD3c
Version:        0.17
Release:        699
Summary:        Talk Daemon to Chat with Another User
Group:          Productivity/Networking/Talk/Servers
Requires:       net-tools netcfg
Provides:       nkitserv:/usr/sbin/in.talkd
AutoReqProv:    on

%description server
This package contains the talk daemon, which allows you to chat with
another user on a different system. Talk is a communication program
which copies lines from one terminal to the terminal of another user.



%prep
%setup -n netkit-ntalk-%{version}
%patch
%patch1 -p1 -b .mb
%patch2 -p1
%patch3
%patch4
%patch5
%patch6

%build
CFLAGS="$RPM_OPT_FLAGS" ./configure
cat <<-EOF >> MCONFIG
	LIBCURSES=$(%{ncursesw_config} --libs)
	CFLAGS += -D_GNU_SOURCE -fPIE  $(%{ncursesw_config} --cflags)
	LDFLAGS += -pie
EOF
make

%install
install -d -m 755 $RPM_BUILD_ROOT/etc/xinetd.d
install -d -m 755 $RPM_BUILD_ROOT/usr/{bin,sbin}
install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man{1,8}
make install INSTALLROOT=$RPM_BUILD_ROOT
install -m 644 %{S:1} $RPM_BUILD_ROOT/etc/xinetd.d/talk 
install -m 644 %{S:2} $RPM_BUILD_ROOT/etc/xinetd.d/ntalk
#install firewall definitions format is described here:
#/usr/share/SuSEfirewall2/services/TEMPLATE
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 755 %{S:3} $RPM_BUILD_ROOT/%{_fwdefdir}/talkd

%clean
[ -d %{buildroot} -a "%{buildroot}" != "" ] && rm -rf  %{buildroot}

%files
%defattr(-,root,root)
%doc BUGS ChangeLog
/usr/bin/talk
%doc %{_mandir}/man1/*

%files server
%defattr(-,root,root)
%doc BUGS ChangeLog
%doc %{_mandir}/man8/*
/usr/sbin/in.ntalkd
/usr/sbin/in.talkd
%config(noreplace) /etc/xinetd.d/talk
%config(noreplace) /etc/xinetd.d/ntalk
%{_fwdefdir}/talkd

%changelog