## START: Set by rpmautospec
## (rpmautospec version 0.6.1)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global forgeurl https://github.com/adah1972/libunibreak

Name:           libunibreak
Version:        6.1
Release:        %autorelease
Summary:        A Unicode line-breaking library
# Upstream uses tags of the form `libunibreak_X_Y`
%global tag %{name}_%{lua: v = string.gsub(rpm.expand('%{version}'), '%.', '_'); print(v) }
%forgemeta
# SPDX identifier
License:        Zlib
URL:            %forgeurl
Source0:        %forgesource
# test files from Unicode, see `download_sources_for_offline_build.sh`
# License: Unicode-3.0
Source1:        libunibreak-test-data.tar.gz

# don't download test data
Patch0:          offline_files.patch
# remove unused var and other build fixes
Patch1:          remove_unused_var.patch

# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch:    %{ix86}

BuildRequires:  gcc
BuildRequires:  make
BuildRequires:  automake, autoconf, libtool

%description
Libunibreak is an implementation of the line breaking and word
breaking algorithms as described in Unicode Standard Annex 14 and
Unicode Standard Annex 29. It is designed to be used in a generic text
renderer.


%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%forgeautosetup -p1

# Install test data files
tar xzf %{SOURCE1}

# Fix shebang and permissions of Python scripts
sed -r -i 's|^(#!/usr/bin/)env (python)|\1\23|' src/*.py
chmod a+x src/*.py


%build
./autogen.sh
%configure --disable-static
%make_build


%install
%make_install
find %{buildroot} -name '*.la' -exec rm -f {} ';'


%check
%make_build check

%ldconfig_scriptlets


%files
%doc AUTHORS NEWS README.md
%license LICENCE
%{_libdir}/*.so.*

%files devel
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc


%changelog
## START: Generated by rpmautospec
* Sun Mar 03 2024 Sandro <devel@penguinpee.nl> - 6.1-1
- Update to 6.1 (RHBZ#2266204)
- Update script for downloading test data
- Store test data in side cache (instead of dist-git)
- Rebase patches and drop no longer required patch
- Use glob in .gitignore

* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Nov 09 2023 Sandro <devel@penguinpee.nl> - 5.1-7
- Fix Release:

* Wed Nov 01 2023 Sandro <devel@penguinpee.nl> - 5.1-6
- Stop building for i686

* Wed Nov 01 2023 Sandro <devel@penguinpee.nl> - 5.1-5
- Drop `liblinebreak` Provides: and Obsoletes:

* Wed Nov 01 2023 Sandro <devel@penguinpee.nl> - 5.1-4
- Drop changes for regenerating src/*data.c

* Tue Oct 31 2023 Sandro <devel@penguinpee.nl> - 5.1-3
- Migrate to SPDX license

* Tue Oct 31 2023 Sandro <devel@penguinpee.nl> - 5.1-2
- Rename patches and stop enumeration
- Update patches as required
- Add script for updating external sources
- Add BRs for running `autogen.sh`

* Mon Oct 30 2023 Sandro <devel@penguinpee.nl> - 5.1-1
- Update to 5.1

* Mon Oct 30 2023 Sandro <devel@penguinpee.nl> - 4.0-17
- Add missing dependencies for `autogen.sh`
- Update patch

* Mon Oct 30 2023 Sandro <devel@penguinpee.nl> - 4.0-16
- Use forge macros
- Mangle the version (upstream uses lubunibreak_X_Y tags)

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sun Aug 15 2021 Andy Mender <andymenderunix@@fedoraproject.org> - 4.0-9
- Switch URL to GitHub
- Add patch to remove unused var in tests.c

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Tue Aug 28 2018 Michel Alexandre Salim <salimma@fedoraproject.org> - 4.0-2
- Properly disable broken tests, run the rest

* Thu Aug 23 2018 Michel Alexandre Salim <salimma@fedoraproject.org> - 4.0-1
- Update to 4.0

* Sat Jun  4 2016 Michel Alexandre Salim <salimma@fedoraproject.org> - 3.0-1
- Initial package

## END: Generated by rpmautospec
