%define _lto_cflags %{nil}

Name: txr
Version: 289
Release: 0%{dist}.1sunshine
Summary: Programming language for text extraction and data munging
Source0: http://www.kylheku.com/cgit/%{name}/snapshot/%{name}-%{version}.tar.bz2
Patch0: txr-280-licenseinstall.patch
URL: http://www.nongnu.org/%{name}/
Group: Applications/Text
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: gcc
BuildRequires: make
# ffi_prep_cif_var() was added in 3.0.11:
BuildRequires: libffi-devel >= 3.0.11
License: BSD

%description
TXR is a pattern language for extracting and reporting text, with
a powerful Lisp dialect for advanced data munging.

%prep
%setup -q
%patch0 -p1 -b .license

# test 014 dgram relies on IPv6 support
if [ ! -f /proc/net/if_inet6 ]; then
  echo no IPv6 support, disabling test 014/dgram-stream
  mv tests/014/dgram-stream.tl{,.disabled}
fi

%build
# building in a separate dir breaks on yacc files
./configure --prefix=%{_prefix} --opt-flags="%{optflags}"
make %{?_smp_mflags} VERBOSE=1

%check
make tests

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} VERBOSE=1

%clean
rm -rf %{buildroot}

%files
%{!?_licensedir:%global license %%doc}
%doc ChangeLog-2009-2015 RELNOTES
%license METALICENSE LICENSE
%{_bindir}/%{name}*
%{_datadir}/%{name}
%{_mandir}/man1/%{name}.*

%changelog
* Wed Jul 05 2023 Moritz Barsnick <moritz+rpm@barsnick.net> 289-0.1sunshine
- update to 289

* Tue Apr 25 2023 Moritz Barsnick <moritz+rpm@barsnick.net> 285-0.1sunshine
- update to 285

* Mon Dec 19 2022 Moritz Barsnick <moritz+rpm@barsnick.net> 283-0.1sunshine
- update to 283

* Tue Aug 30 2022 Moritz Barsnick <moritz+rpm@barsnick.net> 280-0.1sunshine
- update to 280
- rebase the licenseinstall patch
- package new binary symlinks

* Fri Dec 31 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 273-0.1sunshine
- update to 273

* Wed Sep 01 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 270-0.1sunshine
- update to 270

* Mon Aug 30 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 269-0.1sunshine
- update to 269

* Tue Aug 10 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 268-0.1sunshine
- update to 268

* Tue Aug 03 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 267-0.1sunshine
- update to 267

* Thu Jul 22 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 266-0.1sunshine
- update to 266

* Sun Jun 27 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 264-0.1sunshine
- update to 264
- rebase the licenseinstall patch

* Mon Jun 21 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 263-0.1sunshine
- update to 263
- drop the mkstemps, patch, it's integrated upstream

* Fri Jun 04 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 261-0.2sunshine
- replace my mkstemps() patch with one from upstream

* Fri Jun 04 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 261-0.1sunshine
- update to 261
- add a patch for incorrectly used mkstemps()

* Thu May 27 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 260-0.1sunshine
- update to 260

* Sun May 16 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 259-0.1sunshine
- update to 259

* Mon May 03 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 258-0.1sunshine
- update to 258

* Mon Apr 26 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 257-0.1sunshine
- update to 257

* Sun Apr 11 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 256-0.1sunshine
- update to 256

* Sun Mar 28 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 255-0.1sunshine
- update to 255

* Fri Mar 12 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 254-0.1sunshine
- update to 254

* Mon Mar 08 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 253-0.1sunshine
- update to 253

* Tue Mar 02 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 252-0.1sunshine
- update to 252

* Tue Feb 23 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 251-0.3sunshine
- re-add the accidentally dropped BR: libffi-devel
- build verbosely

* Tue Feb 23 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 251-0.2sunshine
- build without LTO
- remove BR: flex, flex-devel, bison, as internal parsers are in place
  according to upstream.

* Tue Feb 09 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 251-0.1sunshine
- update to 251

* Tue Feb 02 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 250-0.1sunshine
- update to 250
- add BR: make

* Wed Jan 27 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 249-0.1sunshine
- update to 249

* Mon Jan 04 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 246-0.1sunshine
- update to 246

* Fri Oct 16 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 244-0.1sunshine
- update to 244

* Fri Sep 04 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 243-0.1sunshine
- update to 243

* Mon Aug 31 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 242-0.1sunshine
- update to 242

* Mon Jun 08 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 240-0.1sunshine
- update to 240

* Wed May 27 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 238-0.1sunshine
- update to 238

* Mon Apr 27 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 237-0.1sunshine
- update to 237

* Mon Apr 20 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 236-0.1sunshine
- update to 236

* Tue Apr 14 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 235-0.1sunshine
- update to 235

* Mon Apr 06 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 234-0.1sunshine
- update to 234

* Tue Mar 10 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 233-0.1sunshine
- update to 233

* Tue Feb 11 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 232-0.1sunshine
- update to 232

* Wed Jan 15 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 231-0.1sunshine
- update to 231

* Tue Jan 07 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 230-0.1sunshine
- update to 230
- reenable tests/007/except-1.txr and tests/007/except-2.txr on x86, the
  issue should be fixed according to
  http://www.kylheku.com/lurker/message/20191219.055941.3a8b8595.en.html

* Tue Dec 03 2019 Moritz Barsnick <moritz+rpm@barsnick.net> 228-0.2sunshine
- disable tests/007/except-1.txr and tests/007/except-2.txr again on x86,
  they still segfault

* Tue Dec 03 2019 Moritz Barsnick <moritz+rpm@barsnick.net> 228-0.1sunshine
- update to 228
- add versioned BR libffi-devel (optional for build, but required by
  tests/017/glob-carray.tl)
- remove workarounds for failing tests (again)

* Tue Jan 29 2019 Moritz Barsnick <moritz+rpm@barsnick.net> 208-0.1sunshine
- update to 208
- rebase the license patch
- this build never succeeded

* Wed Nov 28 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 202-0.1sunshine
- update to 202

* Sat Nov 10 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 201-0.1sunshine
- update to 201

* Wed Nov 07 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 200-0.2sunshine
- disable test 007 on ix86, Fedora >=23 again

* Wed Nov 07 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 200-0.1sunshine
- update to 200
- try to run test 007 again (disabled in 188-0.2sunshine)

* Tue Jul 17 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 198-0.1sunshine
- update to 198
- add BR: gcc
- drop use of old unsupported macros

* Wed May 02 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 194-0.1sunshine
- update to 194

* Sat Dec 30 2017 Moritz Barsnick <moritz+rpm@barsnick.net> 188-0.2sunshine
- disable test 007 on ix86, Fedora >=23

* Sat Dec 30 2017 Moritz Barsnick <moritz+rpm@barsnick.net> 188-0.1sunshine
- update to 188

* Sun Jul 30 2017 Moritz Barsnick <moritz+rpm@barsnick.net> 183-0.1sunshine
- update to 183
- disable test 017, it fails on various platforms

* Thu Jan 19 2017 Moritz Barsnick <moritz+rpm@barsnick.net> 165-0.1sunshine
- update to 165

* Wed Jan 06 2016 Moritz Barsnick <moritz+rpm@barsnick.net> 130-0.1sunshine
- update to 130
- use %%license macro, and provide a fallback

* Sat Jan 02 2016 Moritz Barsnick <moritz+rpm@barsnick.net> 129-0.1sunshine
- update to 129

* Wed Dec 30 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 128-0.1sunshine
- update to 128

* Mon Oct 05 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 118-0.1sunshine
- update to 118

* Fri Aug 21 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 113-0.1sunshine
- update to 113
- ChangeLog was renamed (and retired)

* Tue Aug 11 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 111-0.1sunshine
- update to 111

* Thu Aug 06 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 110-0.1sunshine
- update to 110
- rebase the license patch
- use %%license tag on newer Fedoras

* Thu May 21 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 107-0.1sunshine
- update to 107
- drop separate build dir, its use is broken

* Thu Jan 15 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 102-0.1sunshine
- update to 102
- use separate build dir

* Tue Jan 13 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 101-0.1sunshine
- update to 101
- rebase the license patch

* Thu Oct 16 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 99-0.1sunshine
- update to 99

* Mon Sep 01 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 97-0.4sunshine
- add patch to not let licenses be installed in %%{_datadir}

* Mon Sep 01 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 97-0.3sunshine
- actually BR both flex and flex-devel

* Mon Sep 01 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 97-0.2sunshine
- BR flex-devel (for -lfl) on newer platforms

* Mon Sep 01 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 97-0.1sunshine
- initial RPM