From e58438abd659fbf4ee494d30240717f61646d49f Mon Sep 17 00:00:00 2001
From: Stijn Tintel <stijn@linux-ipv6.be>
Date: Thu, 31 Mar 2022 02:52:33 +0300
Subject: [PATCH] kea: bump to 2.0.2

Drop patches that no longer apply:
- net/kea/patches/001-fix-cross-compile.patch
- net/kea/patches/002-fix-host-compile.patch

Drop upstreamed patches:
- net/kea/patches/020-shared_ptr.patch
- net/kea/patches/030-gcc11.patch
- net/kea/patches/040-map.patch

Fixup patch net/kea/patches/003-no-test-compile.patch.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
---
 net/kea/Makefile                              |  4 ++--
 net/kea/patches/001-fix-cross-compile.patch   | 16 -------------
 net/kea/patches/002-fix-host-compile.patch    | 11 ---------
 net/kea/patches/003-no-test-compile.patch     | 16 ++++++-------
 .../patches/004-replace-rev-with-awk.patch    |  2 +-
 net/kea/patches/020-shared_ptr.patch          | 24 -------------------
 net/kea/patches/030-gcc11.patch               | 21 ----------------
 net/kea/patches/040-map.patch                 | 10 --------
 8 files changed, 11 insertions(+), 93 deletions(-)
 delete mode 100644 net/kea/patches/001-fix-cross-compile.patch
 delete mode 100644 net/kea/patches/002-fix-host-compile.patch
 delete mode 100644 net/kea/patches/020-shared_ptr.patch
 delete mode 100644 net/kea/patches/030-gcc11.patch
 delete mode 100644 net/kea/patches/040-map.patch

diff --git a/net/kea/Makefile b/net/kea/Makefile
index ba8e8b648c..f0f5c36a59 100644
--- a/net/kea/Makefile
+++ b/net/kea/Makefile
@@ -9,12 +9,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=kea
-PKG_VERSION:=1.8.2
+PKG_VERSION:=2.0.2
 PKG_RELEASE:=$(AUTORELEASE)
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://ftp.isc.org/isc/kea/$(PKG_VERSION)
-PKG_HASH:=486ca7abedb9d6fdf8e4344ad8688d1171f2ef0f5506d118988aadeae80a1d39
+PKG_HASH:=8d28213bdc8e2bb870a383b30ac1e53d54e1eba43d2f86e5151b08b66aa6cf32
 
 PKG_MAINTAINER:=BangLang Huang<banglang.huang@foxmail.com>, Rosy Song<rosysong@rosinson.com>
 PKG_LICENSE:=MPL-2.0
diff --git a/net/kea/patches/001-fix-cross-compile.patch b/net/kea/patches/001-fix-cross-compile.patch
deleted file mode 100644
index d687817732..0000000000
--- a/net/kea/patches/001-fix-cross-compile.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -580,10 +580,10 @@ AC_TRY_COMPILE([
- 
- usable_regex=
- AC_MSG_CHECKING(for usuable C++11 regex)
--AC_TRY_RUN([
-+AC_TRY_COMPILE([
- #include <regex>
--#include <iostream>
--int main() {
-+#include <iostream>],
-+[int main() {
-   const std::regex regex(".*");
-   const std::string string = "This should match!";
-   const auto result = std::regex_search(string, regex);
diff --git a/net/kea/patches/002-fix-host-compile.patch b/net/kea/patches/002-fix-host-compile.patch
deleted file mode 100644
index 9ab94a8870..0000000000
--- a/net/kea/patches/002-fix-host-compile.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/m4macros/ax_crypto.m4
-+++ b/m4macros/ax_crypto.m4
-@@ -330,7 +330,7 @@ EOF
-     dnl Check availability of SHA-2
-     AC_MSG_CHECKING([support of SHA-2])
-     LIBS_SAVED=${LIBS}
--    LIBS="$LIBS $CRYPTO_LIBS"
-+    LIBS="$LIBS $CRYPTO_LIBS -lpthread"
-     CPPFLAGS_SAVED=${CPPFLAGS}
-     CPPFLAGS="$CRYPTO_INCLUDES $CPPFLAGS"
-     AC_LINK_IFELSE(
diff --git a/net/kea/patches/003-no-test-compile.patch b/net/kea/patches/003-no-test-compile.patch
index a6c4a40e4c..132c942aa9 100644
--- a/net/kea/patches/003-no-test-compile.patch
+++ b/net/kea/patches/003-no-test-compile.patch
@@ -76,8 +76,8 @@
 -SUBDIRS = . tests
 +SUBDIRS = .
  
- pkgpython_PYTHON = kea_conn.py kea_connector2.py kea_connector3.py
- 
+ PYTHON_PREFIX=@prefix@
+ PYTHON_EXEC_PREFIX=@prefix@
 --- a/src/hooks/dhcp/high_availability/Makefile.am
 +++ b/src/hooks/dhcp/high_availability/Makefile.am
 @@ -1,4 +1,4 @@
@@ -85,7 +85,7 @@
 +SUBDIRS = . libloadtests
  
  AM_CPPFLAGS  = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
- AM_CPPFLAGS += $(BOOST_INCLUDES)
+ AM_CPPFLAGS += $(BOOST_INCLUDES) $(CRYPTO_CFLAGS) $(CRYPTO_INCLUDES)
 --- a/src/hooks/dhcp/lease_cmds/Makefile.am
 +++ b/src/hooks/dhcp/lease_cmds/Makefile.am
 @@ -1,4 +1,4 @@
@@ -125,7 +125,7 @@
 +SUBDIRS = .
  
  AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
- AM_CPPFLAGS += $(BOOST_INCLUDES)
+ AM_CPPFLAGS += $(BOOST_INCLUDES) $(CRYPTO_CFLAGS) $(CRYPTO_INCLUDES)
 --- a/src/lib/cc/Makefile.am
 +++ b/src/lib/cc/Makefile.am
 @@ -1,4 +1,4 @@
@@ -149,7 +149,7 @@
 +SUBDIRS = .
  
  AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
- AM_CPPFLAGS += $(BOOST_INCLUDES)
+ AM_CPPFLAGS += $(BOOST_INCLUDES) $(CRYPTO_CFLAGS) $(CRYPTO_INCLUDES)
 --- a/src/lib/config_backend/Makefile.am
 +++ b/src/lib/config_backend/Makefile.am
 @@ -1,4 +1,4 @@
@@ -249,7 +249,7 @@
 +SUBDIRS = .
  
  AM_CPPFLAGS  = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
- AM_CPPFLAGS += $(BOOST_INCLUDES)
+ AM_CPPFLAGS += $(BOOST_INCLUDES) $(CRYPTO_CFLAGS) $(CRYPTO_INCLUDES)
 --- a/src/lib/log/Makefile.am
 +++ b/src/lib/log/Makefile.am
 @@ -1,4 +1,4 @@
@@ -293,7 +293,7 @@
 --- a/src/lib/stats/Makefile.am
 +++ b/src/lib/stats/Makefile.am
 @@ -1,4 +1,4 @@
--SUBDIRS = . tests
+-SUBDIRS = . tests testutils
 +SUBDIRS = .
  
  AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
@@ -315,4 +315,4 @@
 +SUBDIRS = .
  
  AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
- AM_CPPFLAGS += $(BOOST_INCLUDES) $(SYSREPO_CPPFLAGS)
+ AM_CPPFLAGS += $(BOOST_INCLUDES)
diff --git a/net/kea/patches/004-replace-rev-with-awk.patch b/net/kea/patches/004-replace-rev-with-awk.patch
index 13d7991bf8..d22dcd4b00 100644
--- a/net/kea/patches/004-replace-rev-with-awk.patch
+++ b/net/kea/patches/004-replace-rev-with-awk.patch
@@ -1,6 +1,6 @@
 --- a/src/bin/keactrl/keactrl.in
 +++ b/src/bin/keactrl/keactrl.in
-@@ -98,7 +98,7 @@ get_pid_from_file() {
+@@ -117,7 +117,7 @@ get_pid_from_file() {
      # Extract the name portion (from last slash to last dot) of the config file name
      # File name and extension are documented in src/lib/util/filename.h
      local conf_name
diff --git a/net/kea/patches/020-shared_ptr.patch b/net/kea/patches/020-shared_ptr.patch
deleted file mode 100644
index 0231d2718f..0000000000
--- a/net/kea/patches/020-shared_ptr.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From d505f7a7d6fac1c00a4467dfcf1e84f2db508bc6 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 26 Feb 2021 23:14:20 -0800
-Subject: [PATCH] ax_cpp11.m4: Include <memory> header
-
-This is needed for std::shared_ptr
-GCC-11 throws errors if header is not included
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- m4macros/ax_cpp11.m4 | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/m4macros/ax_cpp11.m4
-+++ b/m4macros/ax_cpp11.m4
-@@ -182,6 +182,7 @@ for retry in "none" "--std=c++11" "--std
- 	AC_COMPILE_IFELSE(
- 		[AC_LANG_PROGRAM(
- 			[#include <thread>
-+			 #include <memory>
- 			 std::shared_ptr<std::thread> th;],
- 			[th.reset(new std::thread([[]]() { return; }));
- 			 th->join();])],
diff --git a/net/kea/patches/030-gcc11.patch b/net/kea/patches/030-gcc11.patch
deleted file mode 100644
index 51108154c7..0000000000
--- a/net/kea/patches/030-gcc11.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/src/lib/database/backend_selector.cc
-+++ b/src/lib/database/backend_selector.cc
-@@ -6,7 +6,7 @@
- 
- #include <database/backend_selector.h>
- #include <exceptions/exceptions.h>
--#include <climits>
-+#include <limits>
- #include <sstream>
- 
- using namespace isc::data;
---- a/src/lib/dhcpsrv/subnet_id.h
-+++ b/src/lib/dhcpsrv/subnet_id.h
-@@ -10,6 +10,7 @@
- #include <exceptions/exceptions.h>
- #include <stdint.h>
- #include <typeinfo>
-+#include <limits>
- 
- namespace isc {
- namespace dhcp {
diff --git a/net/kea/patches/040-map.patch b/net/kea/patches/040-map.patch
deleted file mode 100644
index 692642a199..0000000000
--- a/net/kea/patches/040-map.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/src/lib/dhcpsrv/timer_mgr.cc
-+++ b/src/lib/dhcpsrv/timer_mgr.cc
-@@ -12,6 +12,7 @@
- #include <exceptions/exceptions.h>
- 
- #include <functional>
-+#include <map>
- #include <utility>
- 
- using namespace isc;
-- 
2.30.2