From e6360310e65228d1b7ec3c42f572b2eea312e340 Mon Sep 17 00:00:00 2001
From: Christopher Meng <i@cicku.me>
Date: Fri, 13 Feb 2015 18:18:12 +0800
Subject: [PATCH] Update to 0.7.0

---
 .gitignore  |  1 +
 libpsl.spec | 32 ++++++++++++++++++++++++--------
 sources     |  2 +-
 3 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index 45d6c92..a0c1818 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /libpsl-0.5.0.tar.gz
 /libpsl-0.5.1.tar.gz
 /libpsl-0.6.2.tar.gz
+/libpsl-0.7.0.tar.gz
diff --git a/libpsl.spec b/libpsl.spec
index 0fe071f..bdba459 100644
--- a/libpsl.spec
+++ b/libpsl.spec
@@ -1,6 +1,6 @@
 Name:           libpsl
-Version:        0.6.2
-Release:        2%{?dist}
+Version:        0.7.0
+Release:        1%{?dist}
 Summary:        C library for the Publix Suffix List
 License:        MIT
 URL:            https://rockdaboot.github.io/libpsl
@@ -13,6 +13,8 @@ BuildRequires:  gtk-doc
 BuildRequires:  libicu-devel
 BuildRequires:  libtool
 BuildRequires:  libxslt
+BuildRequires:  publicsuffix-list
+Requires:       publicsuffix-list
 
 %description
 libpsl is a C library to handle the Public Suffix List. A "public suffix" is a
@@ -55,20 +57,30 @@ is acceptable for domains and so on.
 
 %prep
 %setup -q
+rm -frv data/effective_tld_names.dat
+sed -i 's|effective_tld_names.dat|$(PSL_FILE)|g' data/Makefile.am
 
 %build
-./autogen.sh
+# Tarballs from github have 2 versions, one is raw files from repo, and
+# the other one from CDN contains pre-generated autotools files.
+#[ -f configure ] || autoreconf -fiv
+# But makefile hack is not upstreamed yet so we continue reconfiguring these.
+autoreconf -fiv
 %configure --disable-silent-rules \
            --disable-static       \
            --enable-man           \
-           --enable-gtk-doc
-
+           --enable-gtk-doc       \
+           --with-psl-file=%{_datadir}/publicsuffix/effective_tld_names.dat
 %make_build
 
 %install
 %make_install
 
 find %{buildroot} -name '*.la' -delete -print
+# We need to unbundle the list completely, since the list is not small
+# in contrast with normal text files. Thus a symlink is the best choice.
+rm -fv %{buildroot}%{_datadir}/libpsl/effective_tld_names.dat
+ln -s %{_datadir}/publicsuffix/effective_tld_names.dat %{buildroot}%{_datadir}/libpsl/effective_tld_names.dat
 
 %check
 make check
@@ -78,11 +90,11 @@ make check
 %postun -p /sbin/ldconfig
 
 %files
-%doc COPYING
+%license COPYING
 %{_libdir}/libpsl.so.*
 
 %files devel
-%doc AUTHORS NEWS README.md
+%doc AUTHORS NEWS
 %{_datadir}/gtk-doc/html/libpsl/
 %{_datadir}/libpsl/
 %exclude %{_datadir}/libpsl/test_psl.txt
@@ -92,10 +104,14 @@ make check
 %{_mandir}/man3/libpsl.3*
 
 %files -n psl
-%doc AUTHORS COPYING NEWS README.md
+%doc AUTHORS NEWS
+%license COPYING
 %{_bindir}/psl
 
 %changelog
+* Mon Feb 02 2015 Christopher Meng <rpm@cicku.me> - 0.7.0-1
+- Update to 0.7.0
+
 * Mon Jan 26 2015 David Tardon <dtardon@redhat.com> - 0.6.2-2
 - rebuild for ICU 54.1
 
diff --git a/sources b/sources
index dc0ac87..f9229ef 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-635982e26375a4d2737771fe985b056f  libpsl-0.6.2.tar.gz
+18e0b5481c68ede3aba71e7de4d6a4a8  libpsl-0.7.0.tar.gz