%global realname fribidi
%global _prefix /opt/rx

Summary: Library implementing the Unicode Bidirectional Algorithm
Name: rx-fribidi
Version: 1.0.14
Release: 1%{?dist}
URL: https://github.com/fribidi/fribidi/
Source: https://github.com/%{realname}/%{realname}/releases/download/v%{version}/%{realname}-%{version}.tar.xz
License: LGPL-2.1-or-later AND Unicode-DFS-2016
BuildRequires: gcc
BuildRequires: meson
BuildRequires: make
Patch0: fribidi-drop-bundled-gnulib.patch

%description
A library to handle bidirectional scripts (for example Hebrew, Arabic),
so that the display is done in the proper way; while the text data itself
is always written in logical order.

%package devel
Summary: Libraries and include files for FriBidi
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
Include files and libraries needed for developing applications which use
FriBidi.

%prep
%autosetup -p1 -n %{realname}-%{version}

%build
export PKG_CONFIG_PATH=%{_libdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
export LDFLAGS="-L%{_libdir} -Wl,-rpath=%{_libdir} $LDFLAGS"

%meson -Ddocs=false
%meson_build

%check
%meson_test


%install
%meson_install

rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%ldconfig_scriptlets

%files
%doc README AUTHORS ChangeLog THANKS NEWS TODO
%license COPYING
%{_bindir}/fribidi
%{_libdir}/libfribidi.so.0*

%files devel
%{_includedir}/fribidi
%{_libdir}/libfribidi.so
%{_libdir}/pkgconfig/*.pc
#%%{_mandir}/man3/*.gz