From 770eaae74f20d17729a345994a34cc224676f23f Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Tue, 6 Oct 2020 19:45:08 +0200
Subject: [PATCH 23/23] add freeradius-utils package (freeradius-server in
 disguise)

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 package/Config.in                                      |    1 +
 package/freeradius-utils/0001-ssl-version-is-ok.patch  |   15 +++++++++++++++
 .../freeradius-utils/0002-do-not-include-host.patch    |   11 +++++++++++
 .../0003-obey-destdir-in-make-install.patch            |   12 ++++++++++++
 package/freeradius-utils/Config.in                     |    8 ++++++++
 package/freeradius-utils/freeradius-utils.hash         |    2 ++
 package/freeradius-utils/freeradius-utils.mk           |   16 ++++++++++++++++
 7 files changed, 65 insertions(+)
 create mode 100644 package/freeradius-utils/0001-ssl-version-is-ok.patch
 create mode 100644 package/freeradius-utils/0002-do-not-include-host.patch
 create mode 100644 package/freeradius-utils/0003-obey-destdir-in-make-install.patch
 create mode 100644 package/freeradius-utils/Config.in
 create mode 100644 package/freeradius-utils/freeradius-utils.hash
 create mode 100644 package/freeradius-utils/freeradius-utils.mk

diff --git a/package/Config.in b/package/Config.in
index 8b43b7c..0654062 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1066,6 +1066,7 @@ menu "Networking"
 	source "package/flickcurl/Config.in"
 	source "package/fmlib/Config.in"
 	source "package/freeradius-client/Config.in"
+	source "package/freeradius-utils/Config.in"
 	source "package/geoip/Config.in"
 	source "package/glib-networking/Config.in"
 	source "package/gssdp/Config.in"
diff --git a/package/freeradius-utils/0001-ssl-version-is-ok.patch b/package/freeradius-utils/0001-ssl-version-is-ok.patch
new file mode 100644
index 0000000..e49769b
--- /dev/null
+++ b/package/freeradius-utils/0001-ssl-version-is-ok.patch
@@ -0,0 +1,15 @@
+--- ./configure.orig	2020-10-06 18:07:16.000000000 +0200
++++ ./configure	2020-10-06 18:08:04.000000000 +0200
+@@ -21467,10 +21467,8 @@
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL library and header version consistency" >&5
+ $as_echo_n "checking OpenSSL library and header version consistency... " >&6; }
+   if test "$cross_compiling" = yes; then :
+-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+-as_fn_error $? "cannot run test program while cross compiling
+-See \`config.log' for more details" "$LINENO" 5; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/package/freeradius-utils/0002-do-not-include-host.patch b/package/freeradius-utils/0002-do-not-include-host.patch
new file mode 100644
index 0000000..b67f2bf
--- /dev/null
+++ b/package/freeradius-utils/0002-do-not-include-host.patch
@@ -0,0 +1,11 @@
+--- ./src/modules/rlm_krb5/Makefile.in.orig	2020-10-06 18:14:47.000000000 +0200
++++ ./src/modules/rlm_krb5/Makefile.in	2020-10-06 18:14:59.000000000 +0200
+@@ -6,7 +6,7 @@
+ SRCS       = rlm_krb5.c
+ HEADERS    =
+ RLM_LIBS   = @krb5_ldflags@
+-RLM_CFLAGS = @krb5_cflags@ -I/usr/include/et -DKRB5_DEPRECATED
++RLM_CFLAGS = @krb5_cflags@ -DKRB5_DEPRECATED
+ 
+ include ../rules.mak
+ 
diff --git a/package/freeradius-utils/0003-obey-destdir-in-make-install.patch b/package/freeradius-utils/0003-obey-destdir-in-make-install.patch
new file mode 100644
index 0000000..5445e99
--- /dev/null
+++ b/package/freeradius-utils/0003-obey-destdir-in-make-install.patch
@@ -0,0 +1,12 @@
+--- ./Makefile.orig	2020-10-06 19:38:47.000000000 +0200
++++ ./Makefile	2020-10-06 19:39:31.000000000 +0200
+@@ -43,7 +43,8 @@
+ # For compatibility with typical GNU packages (e.g. as seen in libltdl),
+ # we make sure DESTDIR is defined.
+ #
+-export DESTDIR := $(R)
++export DESTDIR
++export R = $(DESTDIR)
+ install:
+ 	$(INSTALL) -d -m 755	$(R)$(sbindir)
+ 	$(INSTALL) -d -m 755	$(R)$(bindir)
diff --git a/package/freeradius-utils/Config.in b/package/freeradius-utils/Config.in
new file mode 100644
index 0000000..58fec22
--- /dev/null
+++ b/package/freeradius-utils/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_FREERADIUS_UTILS
+	bool "freeradius-utils"
+	help
+	  A selection of client tools from freeradius-server, the
+	  most important being radclient (and the radtest script)
+
+	  https://wiki.freeradius.org/config/Radclient
+
diff --git a/package/freeradius-utils/freeradius-utils.hash b/package/freeradius-utils/freeradius-utils.hash
new file mode 100644
index 0000000..efd3351
--- /dev/null
+++ b/package/freeradius-utils/freeradius-utils.hash
@@ -0,0 +1,2 @@
+# Locally computed
+sha256  a46b45cd23eefab0dddd75116203d28a866b49ea0d9200725f2a597ecbc4d4c8  freeradius-server-2.2.10.tar.bz2
diff --git a/package/freeradius-utils/freeradius-utils.mk b/package/freeradius-utils/freeradius-utils.mk
new file mode 100644
index 0000000..e36e2f7
--- /dev/null
+++ b/package/freeradius-utils/freeradius-utils.mk
@@ -0,0 +1,16 @@
+################################################################################
+#
+# freeradius-client
+#
+################################################################################
+
+FREERADIUS_UTILS_VERSION = 2.2.10
+FREERADIUS_UTILS_SOURCE = freeradius-server-$(FREERADIUS_UTILS_VERSION).tar.bz2
+FREERADIUS_UTILS_SITE = ftp://ftp.freeradius.org/pub/freeradius
+FREERADIUS_UTILS_LICENSE = GPLv2+
+FREERADIUS_UTILS_LICENSE_FILES = COPYRIGHT
+FREERADIUS_UTILS_INSTALL_STAGING = YES
+
+FREERADIUS_UTILS_DEPENDENCIES = openssl host-pkgconf
+
+$(eval $(autotools-package))
-- 
1.7.10.4

