Name: cdecl
Summary: Translator for C gibberish

# The original cdecl has been released in May 1988, into the public domain.
# The fork used in this package re-licenses the code under GPLv3.
# It also includes some code taken from Gnulib, licensed under the LGPL.
#
# Check the discussion on the legal mailing list regarding suitability for Fedora:
# https://lists.fedoraproject.org/archives/list/legal@lists.fedoraproject.org/thread/QBYRCIMQDXAD2ZKUWKKYSTDB6T6GW2SO/
License: GPL-3.0-or-later AND LGPL-2.1-or-later AND LicenseRef-Fedora-PublicDomain

Version: 16.2.2
Release: 1%{?dist}

URL: https://github.com/paul-j-lucas/cdecl/
Source0: %{URL}releases/download/cdecl-%{version}/cdecl-%{version}.tar.gz

BuildRequires: diffutils
BuildRequires: gcc
BuildRequires: make
BuildRequires: ncurses
BuildRequires: readline-devel


%description
Cdecl is a program which will turn English-like phrases such as "declare
foo as array 5 of pointer to function returning int" into C declarations
such as "int (*foo[5])()". It can also do the opposite, translating C
into the pseudo-English. And it handles typecasts, too. Plus C++.
This version also has command line editing and history.


%prep
# Extract the source archive into two copies: build/ and check/
%autosetup -c
mv "%{name}-%{version}" "build"
cp -a "build" "check"


%build
# Build the program normally. This is what we'll install.
pushd build/
%configure
%make_build
popd

# Build the program with the "terminal size" feature disabled.
# We'll need this in order to run the tests,
# as they break spectacularly when said feature is enabled.
pushd check/
%configure --enable-term-size=no
%make_build
popd


%install
pushd build/
%make_install


%check
pushd check/
make -C test/ check


%files
%doc build/README.md build/README-2.5.txt
%doc build/AUTHORS
%license build/COPYING
%{_bindir}/cdecl
%{_bindir}/c++decl
%{_mandir}/man1/cdecl.1*
%{_mandir}/man1/c++decl.1*


%changelog
* Sat Mar 02 2024 Artur Frenszek-Iwicki <fedora@svgames.pl> - 16.2.2-1
- Update to v16.2.2

* Tue Feb 20 2024 Artur Frenszek-Iwicki <fedora@svgames.pl> - 16.2.1-1
- Update to v16.2.1

* Tue Jan 30 2024 Artur Frenszek-Iwicki <fedora@svgames.pl> - 16.2-1
- Update to v16.2

* Mon Jan 15 2024 Artur Frenszek-Iwicki <fedora@svgames.pl> - 16.1-1
- Update to v16.1

* Fri Jan 05 2024 Artur Frenszek-Iwicki <fedora@svgames.pl> - 16.0-1
- Update to v16.0
- Add a note regarding licensing and suitability for Fedora

* Mon Oct 02 2023 Artur Frenszek-Iwicki <fedora@svgames.pl> - 15.0-1
- Update to v15.0

* Sat Sep 16 2023 Artur Frenszek-Iwicki <fedora@svgames.pl> - 14.4-1
- Update to v14.4

* Thu Aug 31 2023 Artur Frenszek-Iwicki <fedora@svgames.pl> - 14.3-1
- Update to v14.3
- Extract sources into two copies to further separate the "install" and "test" builds

* Fri Jul 28 2023 Artur Frenszek-Iwicki <fedora@svgames.pl> - 14.2-1
- Build from a different fork - jump to v14.2

* Thu Jul 20 2023 Artur Frenszek-Iwicki <fedora@svgames.pl> - 2.5-1
- Initial packaging