Name:		libpsl
Version:	0.21.1
Release:	5
Summary:	C library to handle the Public Suffix List
License:	MIT
URL:		https://github.com/rockdaboot/libpsl
Source0:	https://github.com/rockdaboot/libpsl/releases/download/%{version}/libpsl-%{version}.tar.gz

BuildRequires:	gcc gtk-doc glib2-devel libxslt python3-devel
BuildRequires:	libicu-devel libidn2-devel publicsuffix-list libunistring-devel 
Requires:	publicsuffix-list

%description
Libpsl is a C library to handle the Public Suffix List. A Public Suffix List is a
collection of Top Level Domains (TLDs) suffixes. Some of the features are listed as
follows:

- has built-in PSL data for fast access;
- allows to load PSL data from files;
- checks if a given domain is a "public suffix";
- provides immediate cookie domain verification;
- finds the longest public part of a given domain;
- finds the shortest private part of a given domain;
- works with international domains (UTF-8 and IDNA2008 Punycode);
- is thread-safe;
- handles IDNA2008 UTS#46 (if libicu is available);

%package        devel
Summary:        Development files for %{name}
Requires:       %{name} = %{version}-%{release}
Requires:       publicsuffix-list
Provides:       %{name}-static = %{version}-%{release}
Obsoletes:      %{name}-static <= %{version}-%{release}

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

%package	help
Summary: 	Doc files for %{name}
Buildarch:	noarch
Requires:	man

%description 	help
The %{name}-help package contains doc files for %{name}.

%package -n     psl
Summary:        Commandline utility to explore the Public Suffix List

%description -n psl
This package contains a commandline utility to explore the Public Suffix List,
for example it checks if domains are public suffixes, checks if cookie-domain
is acceptable for domains and so on.

%package -n     psl-make-dafsa
Summary:        Compiles the Public Suffix List into DAFSA form

%description -n psl-make-dafsa
This script produces C/C++ code or an architecture-independent binary object
which represents a Deterministic Acyclic Finite State Automaton (DAFSA)
from a plain text Public Suffix List.

%prep
%autosetup -n %{name}-%{version} -p1
sed -i -e "1s|#!.*|#!%{__python3}|" src/psl-make-dafsa

%build
%configure --enable-man           \
	   --disable-rpath	 \
           --enable-gtk-doc       \
           --enable-builtin=libicu \
           --enable-runtime=libidn2 \
           --with-psl-distfile=%{_datadir}/publicsuffix/public_suffix_list.dafsa  \
           --with-psl-file=%{_datadir}/publicsuffix/effective_tld_names.dat       \
           --with-psl-testfile=%{_datadir}/publicsuffix/test_psl.txt
%make_build

%install
%make_install
install -m0755 src/psl-make-dafsa %{buildroot}/%{_bindir}
rm -f %{buildroot}/%{_libdir}/%{name}.la

%check
make check

%pre

%preun

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%license COPYING AUTHORS
%{_libdir}/%{name}.so.*

%files devel
%{_includedir}/%{name}.h
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/%{name}.so
%{_libdir}/%{name}.a

%files help
%doc NEWS
%{_mandir}/man*/*
%{_datadir}/gtk-doc/html/%{name}

%files -n psl
%doc AUTHORS NEWS
%license COPYING
%{_bindir}/psl

%files -n psl-make-dafsa
%license COPYING
%{_bindir}/psl-make-dafsa

%changelog
* Tue Oct 18 2022 gaoruoshu <gaoruoshu@huawei.com> - 0.21.1-5
- change release

* Thu Feb 17 2022 fushanqing <fushanqing@kylinos.cn> - 0.21.1-4
- add subpackage psl-make-dafsa and psl

* Mon Jul 26 2021 panxiaohe <panxiaohe@huawei.com> - 0.21.1-3
- Remove unnecessary BuildRequires:git

* Tue Jul 20 2021 fuanan <fuanan3@huawei.com> - 0.21.1-2
- Remove redundant gdb from BuildRequires

* Mon Jul 27 2020 zhangxingliang <zhangxingliang3@huawei.com> - 0.21.1-1
- Type:update
- ID: NA
- SUG: NA
- DESC:update to 0.21.1

* Mon Jun 22 2020 Liquor <lirui130@huawei.com> - 0.20.2-10
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: docs: don't include the type hierarchy 

* Wed Oct 10 2019 luhuaxin <luhuaxin@huawei.com> - 0.20.2-9
- Type: enhancement
- ID: NA
- SUG: NA
- DESC: move AUTHORS to license folder

* Mon Sep 30 2019 luhuaxin <luhuaxin@huawei.com> - 0.20.2-8
- Type: enhancement
- ID: NA
- SUG: NA
- DESC: package rebuild

* Tue Sep 24 2019 luhuaxin <luhuaxin@huawei.com> - 0.20.2-7
- Type: enhancement
- ID: NA
- SUG: NA
- DESC: update dependency name

* Mon Aug 19 2019 luhuaxin <luhuaxin@huawei.com> - 0.20.2-6
- Package init
