File pksh.spec of Package pksh
# norootforbuild
Name:				pksh
Version:			0.2.1
%define tcsh_version 6.15.00
Release:			0
Summary:			Shell with an embedded pcap-based Network Sniffer
Source:			http://pksh.tecsiel.it/Download/pksh-%{version}.tar.gz
Source1:			ftp://ftp.funet.fi/pub/unix/shells/tcsh/tcsh-%{tcsh_version}.tar.gz
%if 0%opensuse_bs
Source2:			oui.txt.gz
%else
Source2:			http://standards.ieee.org/regauth/oui/oui.txt
%endif
Patch0:        tcsh-6.15.00.dif
Patch1:        tcsh-6.15.00-spelling.dif
Patch2:        tcsh-6.15.00-utf8.dif
Patch3:        tcsh-6.15.00-pipe.dif
Patch4:        tcsh-6.15.00-longjmp.dif
Patch5:        tcsh-6.15.00-norm-cmd.dif
Patch6:        tcsh-6.15.00-history.dif
Patch7:			tcsh-6.15.00-remove_strip.patch
URL:				http://pksh.tecsiel.it/
Group:			Productivity/Networking/Diagnostic
License:			GNU General Public License v3
BuildRoot:		%{_tmppath}/build-%{name}-%{version}
BuildRequires:	gawk textutils ncurses-devel
%if 0%{?suse_version:1}
%if %suse_version >= 1030
BuildRequires:	libpcap-devel
%else
BuildRequires:	libpcap
%endif
%else  # suse
%if 0%{?fedora_version:1}
BuildRequires:	libpcap-devel
%else  # !suse/fedora
BuildRequires:	libpcap-devel
%endif # !suse/fedora
%endif # suse
BuildRequires:	gcc make glibc-devel
BuildRequires:	autoconf automake libtool
%description
'pksh' is a hack of the popular 'tcsh' for packets, bytes hosts, and protocols
counts. It is a shell, a network sniffer, a query language for network
monitoring, and finally a rendering engine to display in a form readable
for humans and network administrators all traffic on LAN segments. It aims
to give on character-based terminals the same level of information 'ntop'
already provides via its embedded Web interface. It does not continuously fill
the terminal with packet/byte/protocol information, but allows the user to
perform his daily job at the shell level and take a look at network only via
a set of commands implemented as extensions to native tcsh built-ins. Output
can be filtered/sorted/paged/mailed/etc. using native Unix commands.
Authors:
--------
    Rocco Carbone <rocco@ntop.org>
%debug_package
%prep
%setup -q
if [ "$(%__grep '^TCSHVERSION=' configure|cut -f2 -d=)" != "%{tcsh_version}" ]; then
	echo "ERROR: tcsh version mismatch" >&2
	exit 1
fi
%__install -d pub
%__install -m0644 "%{SOURCE1}" pub/
%if 0%opensuse_bs
%__gzip -dc "%{SOURCE2}" > src/oui.txt
%__chmod 0644 src/oui.txt
%else
%__install -m0644 "%{SOURCE2}" src/oui.txt
%endif
%build
CC=%__cc
CFLAGS="%{optflags} -D_GNU_SOURCE -pipe"
export CC CFLAGS
%ifarch %ix86
CPU=i586
%else
CPU=${RPM_ARCH}
%endif
TCSH_CONFIGURE_COMMAND="CPU=$CPU ./configure --build=${CPU}-suse-linux \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--sysconfdir=%{_sysconfdir} \
--localstatedir=%{_var} \
--sharedstatedir=%{_datadir} \
--infodir=%{_infodir} \
--mandir=%{_mandir} \
--libexecdir=%{_libdir}/%{name} \
--disable-rpath \
--with-gnu-ld"
export TCSH_CONFIGURE_COMMAND
TCSH_PATCHES="%{PATCH0} %{PATCH1} %{PATCH2} %{PATCH3} %{PATCH4} %{PATCH5} %{PATCH6} %{PATCH7}"
export TCSH_PATCHES
./configure
BUILD_DIR="$(cat docs/PACKAGE)-tcsh-%{tcsh_version}"
pushd "$BUILD_DIR"
%__make %{?jobs:-j%{jobs}}
popd #BUILD_DIR
%install
BUILD_DIR="$(cat docs/PACKAGE)-tcsh-%{tcsh_version}"
STRIPPROG=touch \
%makeinstall -C "$BUILD_DIR"
%__install -D docs/pksh.1 "%{buildroot}%{_mandir}/man1/pksh.1"
%__rm docs/{VERSION,PACKAGE,pksh.1}
%clean
%__rm -rf "%{buildroot}"
%files
%defattr(-,root,root)
%doc docs/*
%{_bindir}/pksh
%doc %{_mandir}/man1/pksh.1*
%changelog
* Thu Jul 24 2008 Pascal Bleser <guru@unixtech.be> 0.2.1
- new upstream version:
  * adds support for passive OS fingerprints using the database available from the 'ettercap' project
* Sun Jul 13 2008 Pascal Bleser <guru@unixtech.be> 0.2.0
- new upstream version:
  * support for a lot of new counters for bytes, packets, and protocols
  * data-link and IP decoding/counting were enhanced to include the most popular protocols
  * adds a new built-in extension was added ("protocols")
  * the "pkfinger" command now shows network usage per host in terms of {bytes,packets,protocols} distribution
* Sat Jul  5 2008 Pascal Bleser <guru@unixtech.be> 0.1.0
- new package
# Local Variables:
# mode: rpm-spec
# tab-width: 3
# End: