File bc.spec of Package bc

#
# spec file for package bc
#
# 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:           bc
BuildRequires:  bison
BuildRequires:  ed
BuildRequires:  flex
%if 0%{?suse_version} > 1220
BuildRequires:  makeinfo
%endif
BuildRequires:  readline-devel
Url:            ftp://ftp.gnu.org/pub/gnu/bc
PreReq:         %{install_info_prereq}
Version:        1.06.95
Release:        0
Summary:        GNU Command Line Calculator
License:        GPL-2.0+
Group:          Productivity/Scientific/Math
Source:         ftp://alpha.gnu.org/pub/gnu/bc/bc-%{version}.tar.bz2
Patch1:         bc-1.06-dc_ibase.patch
Patch2:         bc-1.06.95-memleak.patch
Patch3:         bc-1.06.95-matlib.patch
Patch4:         bc-1.06.95-sigintmasking.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
bc is an interpreter that supports numbers of arbitrary precision and
the interactive execution of statements. The syntax has some
similarities to the C programming language. A standard math library is
available through command line options. When used, the math library is
read in before any other input files. bc then reads in all other files
from the command line, evaluating their contents. Then bc reads from
standard input (usually the keyboard).

The dc program is also included. dc is a calculator that supports
reverse-polish notation and allows unlimited precision arithmetic.
Macros can also be defined. Normally, dc reads from standard input but
can also read in files specified on the command line. A calculator with
reverse-polish notation saves numbers to a stack. Arguments to
mathematical operations (operands) are "pushed" onto the stack until
the next operator is read in, which "pops" its arguments off the stack
and "pushes" its results back onto the stack.

%prep
%setup -q
%patch1 -p1 -b .dc_ibase
%patch2 -p1 -b .memleak
%patch3 -p1 -b .matlib
%patch4 -p1 -b .sigintmask

%build
./configure CFLAGS="$RPM_OPT_FLAGS" \
            --with-readline \
            --prefix=/usr \
	    --infodir=%{_infodir} \
            --mandir=%{_mandir} \
            --build=%{_target_cpu}-suse-linux
rm bc/libmath.h
make

%install
make install DESTDIR=$RPM_BUILD_ROOT

%post
%install_info --info-dir=%{_infodir} %{_infodir}/bc.info.gz
%install_info --info-dir=%{_infodir} %{_infodir}/dc.info.gz

%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/bc.info.gz
%install_info_delete --info-dir=%{_infodir} %{_infodir}/dc.info.gz

%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog NEWS README COPYING.LIB FAQ
/usr/bin/bc
/usr/bin/dc
%{_infodir}/*.info*
%{_mandir}/man1/*

%changelog