Files
calc/calc.spec
Michael Vetter 0a49d100a6 - Update to 2.16.0.0:
* Starting with calc version 2.16.0.0, the ability to perform arithmetic
    on addresses of values in calc objects has been greatly restricted.
  * Most arithmetic on of value addresses could easily cause calc to
    crash.  For example, prior to calc version 2.16.0.0, the following
    command was likely to crash calc: calc '*((&.)+1e9)'
  * Subtracting two value addresses is permitted, however there is NO
    guarantee that the address of a value will remain consistent across
    calc runs.  Addresses of values depend on the circumstances of when
    the calc values were formed.
  * The above restrictions and caveats apply to addresses of values.
    Such restrictions and caveats to NOT apply to the addresses of
    octets, NOR to the addresses within strings.  If isptr(x) == 2, then
    x is value-pointer and the above mentioned restrictions and caveats apply.
  * See "help address" for more information on value address arithmetic.
  * Added E_INVALID_DEREF (10610) error code to indicate the invalid
    dereferencing a non-variable.
  * Added E_INVALID_ADDR_OP (10611) error code to indicate an invalid
    arithmetic address operation.

OBS-URL: https://build.opensuse.org/package/show/utilities/calc?expand=0&rev=104
2025-08-18 07:46:15 +00:00

157 lines
5.0 KiB
RPMSpec

#
# spec file for package calc
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# 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 https://bugs.opensuse.org/
#
%define soname 2_16_0_0
%define libname libcalc%{soname}
Name: calc
Version: 2.16.0.0
Release: 0
Summary: C-style arbitrary precision calculator
License: LGPL-2.1-only
Group: Productivity/Scientific/Math
URL: http://www.isthe.com/chongo/tech/comp/calc/index.html
Source0: http://www.isthe.com/chongo/src/calc/%{name}-%{version}.tar.bz2
Source1: README.openSUSE
BuildRequires: fdupes
BuildRequires: man
BuildRequires: ncurses-devel >= 5.5
BuildRequires: readline-devel >= 5.1
Requires: %{libname} = %{version}-%{release}
Requires: less >= 358
%description
Calc is arbitrary precision C-like arithmetic system that is a
calculator, an algorithm prototype and mathematical research tool.
Calc comes with a rich set of builtin mathematical and programmatic
functions.
%package -n %{libname}
Summary: Arbitrary precision math library
Group: System/Libraries
%description -n %{libname}
Part of the calc release consists of an arbitrary precision math link
library. This link library is used by the calc program to perform its
own calculations. If you wish, you can ignore the calc program entirely
and call the arbitrary precision math routines from your own C programs.
%package devel
Summary: Development files for libcalc
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}-%{release}
%description devel
Part of the calc release consists of an arbitrary precision math link
library. This link library is used by the calc program to perform its
own calculations. If you wish, you can ignore the calc program entirely
and call the arbitrary precision math routines from your own C programs.
This package contains the files needed for building programs that use
this library.
%prep
%setup -q
cp "%{SOURCE1}" .
sed -i '/${CC} ${LIBCUSTCALC_SHLIB} ${CUSTCALC_OBJ}/a\
\tln -s $@ libcustcalc.so
' custom/Makefile
%define _NC_FLAGS %(ncursesw6-config --cflags)
%define _NC_LIBS %(ncursesw6-config --libs)
%define makevars \\\
BINDIR=%{_bindir} \\\
LIBDIR=%{_libdir} \\\
SCRIPTDIR=%{_datadir}/%{name}/cscript \\\
CALC_SHAREDIR=%{_datadir}/%{name} \\\
CALC_INCDIR=%{_includedir}/calc \\\
MANDIR=%{_mandir}/man1 \\\
HAVE_FPOS="-DHAVE_NO_FPOS" \\\
USE_READLINE="-DUSE_READLINE" \\\
READLINE_LIB="-lreadline -lhistory %{_NC_LIBS} -L./custom -lcustcalc" \\\
LD_SHARE="%{_NC_LIBS}" \\\
ARCH_CFLAGS= \\\
EXTRA_CFLAGS="%{optflags} -g -fno-strict-aliasing %{_NC_FLAGS}"
%build
make -e %{makevars}
%check
make -e %{makevars} chk
%install
make T=%{buildroot} %{makevars} install
rmdir %{buildroot}%{_includedir}/calc/custom
# dummy-install some docs etc. to create the symlinks
install -d -m 755 %{buildroot}%{_docdir}/%{name}
install -m 644 \
BUGS CHANGES HOWTO.INSTALL LIBRARY \
README.FIRST README.md README.openSUSE \
custom/CUSTOM_CAL custom/HOW_TO_ADD \
%{buildroot}%{_docdir}/%{name}/
# create symlinks to the help-dir for the help command, e.g. "help bugs"
ln -sf %{_docdir}/%{name}/BUGS \
%{buildroot}%{_datadir}/%{name}/help/bug
ln -sf %{_docdir}/%{name}/BUGS \
%{buildroot}%{_datadir}/%{name}/help/bugs
ln -sf %{_docdir}/%{name}/CHANGES \
%{buildroot}%{_datadir}/%{name}/help/changes
ln -sf %{_docdir}/%{name}/CHANGES \
%{buildroot}%{_datadir}/%{name}/help/change
ln -sf %{_docdir}/%{name}/CUSTOM_CAL \
%{buildroot}%{_datadir}/%{name}/help/custom_cal
ln -sf %{_docdir}/%{name}/HOW_TO_ADD \
%{buildroot}%{_datadir}/%{name}/help/new_custom
# add symlink to intro to docdir
ln -sf %{_datadir}/%{name}/help/intro \
%{buildroot}%{_docdir}/%{name}/what-is-calc.txt
%fdupes %{buildroot}
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files
%license COPYING COPYING-LGPL
%doc BUGS CHANGES HOWTO.INSTALL LIBRARY
%doc README.FIRST README.md README.openSUSE
%doc custom/CUSTOM_CAL custom/HOW_TO_ADD
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_mandir}/man1/%{name}.1%{?ext_man}
%doc %{_docdir}/%{name}/what-is-calc.txt
%files -n %{libname}
%attr(755, root, root) %{_libdir}/libcalc.so.*
%attr(755, root, root) %{_libdir}/libcustcalc.so.*
%files devel
%license COPYING COPYING-LGPL
%doc sample_many.c sample_rand.c sample.README README.md README.openSUSE
%doc %attr(644, root, root) BUGS LIBRARY
%{_includedir}/%{name}
%{_libdir}/libcalc.so
%{_libdir}/libcustcalc.so
%changelog