All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/libtalloc: new package
@ 2020-10-13 14:37 David GOUARIN
  2020-10-13 14:37 ` [Buildroot] [PATCH 2/2] package/freeradius-server: " David GOUARIN
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: David GOUARIN @ 2020-10-13 14:37 UTC (permalink / raw)
  To: buildroot

talloc is a hierarchical, reference counted memory pool system with destructors.
It is the core memory allocator used in Samba.

Signed-off-by: David GOUARIN <dgouarin@gmail.com>
---
 DEVELOPERS                            |  1 +
 package/Config.in                     |  1 +
 package/libtalloc/Config.in           |  9 +++++
 package/libtalloc/libtalloc-cache.txt | 42 ++++++++++++++++++++
 package/libtalloc/libtalloc.hash      |  3 ++
 package/libtalloc/libtalloc.mk        | 55 +++++++++++++++++++++++++++
 6 files changed, 111 insertions(+)
 create mode 100644 package/libtalloc/Config.in
 create mode 100644 package/libtalloc/libtalloc-cache.txt
 create mode 100644 package/libtalloc/libtalloc.hash
 create mode 100644 package/libtalloc/libtalloc.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 79a9eaa563..c856d7ad45 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -712,6 +712,7 @@ F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
 F:	package/librelp/
+F:	package/libtalloc/
 
 N:	David Lechner <david@lechnology.com>
 F:	board/lego/ev3/
diff --git a/package/Config.in b/package/Config.in
index 09a332e3b9..a4d6fe02ae 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1894,6 +1894,7 @@ menu "Other"
 	source "package/libsigc/Config.in"
 	source "package/libsigsegv/Config.in"
 	source "package/libspatialindex/Config.in"
+	source "package/libtalloc/Config.in"
 	source "package/libtasn1/Config.in"
 	source "package/libtommath/Config.in"
 	source "package/libtpl/Config.in"
diff --git a/package/libtalloc/Config.in b/package/libtalloc/Config.in
new file mode 100644
index 0000000000..45733a2144
--- /dev/null
+++ b/package/libtalloc/Config.in
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBTALLOC
+	bool "libtalloc"
+	depends on BR2_TOOLCHAIN_USES_GLIBC && !BR2_COMPILER_PARANOID_UNSAFE_PATH ||?!BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  talloc is a hierarchical, reference counted memory pool system with
+	  destructors. It is the core memory allocator used in Samba.
+
+	  https://talloc.samba.org/talloc/doc/html/index.html
+
diff --git a/package/libtalloc/libtalloc-cache.txt b/package/libtalloc/libtalloc-cache.txt
new file mode 100644
index 0000000000..a2b44857da
--- /dev/null
+++ b/package/libtalloc/libtalloc-cache.txt
@@ -0,0 +1,42 @@
+Checking simple C program: OK
+rpath library support: OK
+-Wl,--version-script support: OK
+Checking getconf LFS_CFLAGS: NO
+Checking for large file support without additional flags: OK
+Checking for -D_LARGE_FILES: OK
+Checking correct behavior of strtoll: NO
+Checking for working strptime: OK
+Checking for C99 vsnprintf: OK
+Checking for HAVE_SHARED_MMAP: OK
+Checking for HAVE_MREMAP: OK
+Checking for HAVE_INCOHERENT_MMAP: NO
+Checking for HAVE_SECURE_MKSTEMP: OK
+Checking for HAVE_IFACE_GETIFADDRS: OK
+Checking for kernel change notify support: OK
+Checking for Linux kernel oplocks: OK
+Checking for kernel share modes: OK
+Checking if can we convert from CP850 to UCS-2LE: OK
+Checking if can we convert from UTF-8 to UCS-2LE: OK
+Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
+Checking whether we can use Linux thread-specific credentials: OK
+Checking whether setreuid is available: OK
+Checking whether setresuid is available: OK
+Checking whether seteuid is available: OK
+Checking whether fcntl locking is available: OK
+Checking whether fcntl lock supports open file description locks: OK
+Checking for the maximum value of the 'time_t' type: OK
+Checking whether the realpath function allows a NULL argument: OK
+Checking whether POSIX capabilities are available: OK
+Checking for ftruncate extend: OK
+vfs_fileid checking for statfs() and struct statfs.f_fsid: OK
+getcwd takes a NULL argument: OK
+Checking uname sysname type: "Linux"
+Checking uname release type: "5.4.0"
+Checking uname version type: "#1 Tue Oct 1 00:00:00 UTC 2020"
+Checking value of NSIG: "65"
+Checking value of _NSIG: "65"
+Checking value of SIGRTMAX: "64"
+Checking value of SIGRTMIN: "34"
+Checking errno of iconv for illegal multibyte sequence: "0"
+checking for clnt_create(): OK
+Checking for a 64-bit host to support lmdb: NO
diff --git a/package/libtalloc/libtalloc.hash b/package/libtalloc/libtalloc.hash
new file mode 100644
index 0000000000..20211210d2
--- /dev/null
+++ b/package/libtalloc/libtalloc.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  ef4822d2fdafd2be8e0cabc3ec3c806ae29b8268e932c5e9a4cd5585f37f9f77  talloc-2.3.1.tar.gz
+
diff --git a/package/libtalloc/libtalloc.mk b/package/libtalloc/libtalloc.mk
new file mode 100644
index 0000000000..abc58f638b
--- /dev/null
+++ b/package/libtalloc/libtalloc.mk
@@ -0,0 +1,55 @@
+################################################################################
+#
+# libtalloc
+#
+################################################################################
+
+LIBTALLOC_VERSION = 2.3.1
+LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
+LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
+LIBTALLOC_LICENSE = LGPL-3.0
+LIBTALLOC_LICENSE_FILES = 
+LIBTALLOC_INSTALL_STAGING = YES
+
+LIBTALLOC_CONF_OPTS += --disable-python
+LIBTALLOC_NEEDS_EXTERNAL_WAF = YES
+
+define LIBTALLOC_CONFIGURE_CMDS
+	$(INSTALL) -m 0644 package/libtalloc/libtalloc-cache.txt $(@D)/cache.txt;
+	echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt;
+	cd $(@D) && $(TARGET_CONFIGURE_OPTS) $(LIBTALLOC_CONF_ENV) \
+	$(HOST_DIR)/bin/python3 buildtools/bin/waf configure \
+		--prefix=/usr \
+		--libdir=/usr/lib \
+		--cross-compile \
+		--cross-answers=$(@D)/cache.txt \
+		--hostcc=gcc \
+		$(LIBTALLOC_CONF_OPTS) \
+		$(LIBTALLOC_WAF_OPTS)
+endef
+
+define LIBTALLOC_BUILD_CMDS
+	cd $(@D) && \
+	$(TARGET_MAKE_ENV) $(HOST_DIR)/bin/python3 buildtools/bin/waf \
+		build -j $(PARALLEL_JOBS) $(LIBTALLOC_BUILD_OPTS) \
+		$(LIBTALLOC_WAF_OPTS)
+endef
+
+define LIBTALLOC_INSTALL_STAGING_CMDS
+	cd $(@D) && \
+	$(TARGET_MAKE_ENV) $(HOST_DIR)/bin/python3 buildtools/bin/waf \
+		install --destdir=$(STAGING_DIR) \
+		$(LIBTALLOC_INSTALL_STAGING_OPTS) \
+		$(LIBTALLOC_WAF_OPTS)
+endef
+
+define LIBTALLOC_INSTALL_TARGET_CMDS
+	cd $(@D) && \
+	$(TARGET_MAKE_ENV) $(HOST_DIR)/bin/python3 buildtools/bin/waf \
+		install --destdir=$(TARGET_DIR) \
+		$(LIBTALLOC_INSTALL_TARGET_OPTS) \
+		$(LIBTALLOC_WAF_OPTS)
+endef
+
+$(eval $(waf-package))
+
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH 2/2] package/freeradius-server: new package
  2020-10-13 14:37 [Buildroot] [PATCH 1/2] package/libtalloc: new package David GOUARIN
@ 2020-10-13 14:37 ` David GOUARIN
  2020-10-13 19:51   ` [Buildroot] [PATCH v2 3/3] " David GOUARIN
  2020-10-13 14:50 ` [Buildroot] [PATCH 1/2] package/libtalloc: " Matthew Weber
  2020-10-13 19:50 ` [Buildroot] [PATCH v2 2/3] " David GOUARIN
  2 siblings, 1 reply; 15+ messages in thread
From: David GOUARIN @ 2020-10-13 14:37 UTC (permalink / raw)
  To: buildroot

FreeRADIUS is an open source server which implements
a protocol for remote user Authorization, Authentication
and Accounting.

Signed-off-by: David GOUARIN <dgouarin@gmail.com>
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 .../0001-host-jlibtool.patch                  | 17 +++++++++
 ...thread-support-while-cross-compiling.patch | 15 ++++++++
 package/freeradius-server/Config.in           | 20 ++++++++++
 .../freeradius-server-config.cache            |  4 ++
 .../freeradius-server/freeradius-server.hash  |  3 ++
 .../freeradius-server/freeradius-server.mk    | 37 +++++++++++++++++++
 8 files changed, 98 insertions(+)
 create mode 100644 package/freeradius-server/0001-host-jlibtool.patch
 create mode 100644 package/freeradius-server/0002-thread-support-while-cross-compiling.patch
 create mode 100644 package/freeradius-server/Config.in
 create mode 100644 package/freeradius-server/freeradius-server-config.cache
 create mode 100644 package/freeradius-server/freeradius-server.hash
 create mode 100644 package/freeradius-server/freeradius-server.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index c856d7ad45..ae688a85c4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -711,6 +711,7 @@ N:	David du Colombier <0intro@gmail.com>
 F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
+F:	package/freeradius-server/
 F:	package/librelp/
 F:	package/libtalloc/
 
diff --git a/package/Config.in b/package/Config.in
index a4d6fe02ae..8e3ce4fe20 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2079,6 +2079,7 @@ menu "Networking applications"
 	source "package/flannel/Config.in"
 	source "package/fmc/Config.in"
 	source "package/fping/Config.in"
+	source "package/freeradius-server/Config.in"
 	source "package/freeswitch/Config.in"
 	source "package/freeswitch-mod-bcg729/Config.in"
 	source "package/frr/Config.in"
diff --git a/package/freeradius-server/0001-host-jlibtool.patch b/package/freeradius-server/0001-host-jlibtool.patch
new file mode 100644
index 0000000000..18cebcb4e5
--- /dev/null
+++ b/package/freeradius-server/0001-host-jlibtool.patch
@@ -0,0 +1,17 @@
+jlibtool.c: while cross compiling, use host CC instead of target CC to build jlibtool
+
+Signed-off-by: David Gouarin <dgouarin@gmail.com>
+
+--- a/scripts/libtool.mk 2018-10-08 09:22:59.032031858 -0600
++++ b/scripts/libtool.mk 2018-10-08 15:04:18.406661484 -0600
+@@ -43,8 +43,8 @@ ifeq "${LIBTOOL}" "JLIBTOOL"
+    # binary!
+	${JLIBTOOL}: ${top_makedir}/jlibtool.c
+	$(Q)mkdir -p $(dir $@)
+-	$(Q)echo CC jlibtool.c
+-	$(Q)${CC} $< -o $@
++	$(Q)echo HOSTCC jlibtool.c
++	$(Q)${HOSTCC} $< -o $@
+
+    clean: jlibtool_clean
+
diff --git a/package/freeradius-server/0002-thread-support-while-cross-compiling.patch b/package/freeradius-server/0002-thread-support-while-cross-compiling.patch
new file mode 100644
index 0000000000..464bcf9aa6
--- /dev/null
+++ b/package/freeradius-server/0002-thread-support-while-cross-compiling.patch
@@ -0,0 +1,15 @@
+configure: enable __thread attribute compiler support by default when cross compiling to avoid a bug in some freeradius macros
+
+Signed-off-by: David Gouarin <dgouarin@gmail.com>
+
+--- a/configure
++++ b/configure
+@@ -11309,7 +11309,7 @@ fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread support in compiler" >&5
+ $as_echo_n "checking for __thread support in compiler... " >&6; }
+   if test "$cross_compiling" = yes; then :
+-  have_tls=no
++  have_tls=yes
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/package/freeradius-server/Config.in b/package/freeradius-server/Config.in
new file mode 100644
index 0000000000..3c2d9af5da
--- /dev/null
+++ b/package/freeradius-server/Config.in
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_FREERADIUS_SERVER
+	bool "freeradius-server"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on !BR2_COMPILER_PARANOID_UNSAFE_PATH
+	select BR2_PACKAGE_LIBTALLOC
+	select BR2_PACKAGE_PCRE
+	help
+	  FreeRADIUS is an open source server which implements
+	  a protocol for remote user Authorization, Authentication
+	  and Accounting.
+
+	  http://wiki.freeradius.org/
+
+comment "freeradius-server needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "freeradius-server needs a glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC ||?BR2_COMPILER_PARANOID_UNSAFE_PATH
+
diff --git a/package/freeradius-server/freeradius-server-config.cache b/package/freeradius-server/freeradius-server-config.cache
new file mode 100644
index 0000000000..b0e582afc9
--- /dev/null
+++ b/package/freeradius-server/freeradius-server-config.cache
@@ -0,0 +1,4 @@
+ax_cv_cc_bounded_attribute=no
+ax_cv_cc_builtin_bswap64=yes
+ax_cv_cc_builtin_choose_expr=yes
+ax_cv_cc_builtin_types_compatible_p=yes
diff --git a/package/freeradius-server/freeradius-server.hash b/package/freeradius-server/freeradius-server.hash
new file mode 100644
index 0000000000..ba338d8b7f
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  2bf914d471d4409fd72e708e308fa32ca8d01d698c518497a1d4b867d50132ae  freeradius-server-3.0.21.tar.gz
+sha256  8b9cc1e5d41938be45a368f126a6d1fda03d60a3d622dc75e776be4e90c2d2c6  COPYRIGHT
diff --git a/package/freeradius-server/freeradius-server.mk b/package/freeradius-server/freeradius-server.mk
new file mode 100644
index 0000000000..d04f453c60
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.mk
@@ -0,0 +1,37 @@
+################################################################################
+#
+# freeradius-server
+#
+################################################################################
+
+FREERADIUS_SERVER_VERSION = 3.0.21
+FREERADIUS_SERVER_SITE = ftp://ftp.freeradius.org/pub/freeradius
+FREERADIUS_SERVER_LICENSE = GPL-2.0
+FREERADIUS_SERVER_LICENSE_FILES = COPYRIGHT
+FREERADIUS_SERVER_INSTALL_HOST = NO
+
+FREERADIUS_SERVER_DEPENDENCIES = libtalloc pcre
+
+ifeq ($(BR2_PACKAGE_HAS_OPENSSL),y)
+FREERADIUS_SERVER_DEPENDENCIES += openssl
+FREERADIUS_SERVER_CONF_OPTS += --with-openssl
+else
+FREERADIUS_CONF_OPTS += --without-openssl
+endif
+
+define FREERADIUS_SERVER_CACHE_FOR_CROSS_COMPILE
+	$(INSTALL) -m 0644 package/freeradius-server/freeradius-server-config.cache $(@D)/freeradius-server-config.cache
+endef
+FREERADIUS_SERVER_PRE_CONFIGURE_HOOKS += FREERADIUS_SERVER_CACHE_FOR_CROSS_COMPILE
+
+# --cache-file= : some compiler checks are not supported while cross compiling.
+#   instead of removing those checks, we use a config.cache file
+FREERADIUS_SERVER_CONF_OPTS += \
+	--cache-file=freeradius-server-config.cache
+
+FREERADIUS_SERVER_MAKE_ENV = R=$(TARGET_DIR) TARGET_DIR=""
+ 
+# make install does not support parallel build
+FREERADIUS_SERVER_MAKE = $(MAKE1)
+
+$(eval $(autotools-package))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH 1/2] package/libtalloc: new package
  2020-10-13 14:37 [Buildroot] [PATCH 1/2] package/libtalloc: new package David GOUARIN
  2020-10-13 14:37 ` [Buildroot] [PATCH 2/2] package/freeradius-server: " David GOUARIN
@ 2020-10-13 14:50 ` Matthew Weber
  2020-10-13 19:50 ` [Buildroot] [PATCH v2 2/3] " David GOUARIN
  2 siblings, 0 replies; 15+ messages in thread
From: Matthew Weber @ 2020-10-13 14:50 UTC (permalink / raw)
  To: buildroot

David,


On Tue, Oct 13, 2020 at 9:38 AM David GOUARIN <dgouarin@gmail.com> wrote:
>
> talloc is a hierarchical, reference counted memory pool system with destructors.
> It is the core memory allocator used in Samba.
>

Thanks for sending this David, for reference there is a pending
libtalloc patch that might be worth comparing to yours.

http://patchwork.ozlabs.org/project/buildroot/patch/20200327150225.15277-1-jared.bents at rockwellcollins.com/

Best Regards,
Matt

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v2 2/3] package/libtalloc: new package
  2020-10-13 14:37 [Buildroot] [PATCH 1/2] package/libtalloc: new package David GOUARIN
  2020-10-13 14:37 ` [Buildroot] [PATCH 2/2] package/freeradius-server: " David GOUARIN
  2020-10-13 14:50 ` [Buildroot] [PATCH 1/2] package/libtalloc: " Matthew Weber
@ 2020-10-13 19:50 ` David GOUARIN
  2020-10-14 19:18   ` Thomas Petazzoni
  2 siblings, 1 reply; 15+ messages in thread
From: David GOUARIN @ 2020-10-13 19:50 UTC (permalink / raw)
  To: buildroot

talloc is a hierarchical, reference counted memory pool system with destructors.
It is the core memory allocator used in Samba.

Change v1 -> v2:
  - merge with work from jared.bents at rockwellcollins.com, as sujested by Matthew Weber
    http://patchwork.ozlabs.org/project/buildroot/patch/20200327150225.15277-1-jared.bents at rockwellcollins.com

Signed-off-by: David GOUARIN <dgouarin@gmail.com>
---
 DEVELOPERS                            |  1 +
 package/Config.in                     |  1 +
 package/libtalloc/Config.in           | 10 ++++++
 package/libtalloc/libtalloc-cache.txt | 42 +++++++++++++++++++++++
 package/libtalloc/libtalloc.hash      |  3 ++
 package/libtalloc/libtalloc.mk        | 48 +++++++++++++++++++++++++++
 6 files changed, 105 insertions(+)
 create mode 100644 package/libtalloc/Config.in
 create mode 100644 package/libtalloc/libtalloc-cache.txt
 create mode 100644 package/libtalloc/libtalloc.hash
 create mode 100644 package/libtalloc/libtalloc.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 79a9eaa563..c856d7ad45 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -712,6 +712,7 @@ F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
 F:	package/librelp/
+F:	package/libtalloc/
 
 N:	David Lechner <david@lechnology.com>
 F:	board/lego/ev3/
diff --git a/package/Config.in b/package/Config.in
index 09a332e3b9..a4d6fe02ae 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1894,6 +1894,7 @@ menu "Other"
 	source "package/libsigc/Config.in"
 	source "package/libsigsegv/Config.in"
 	source "package/libspatialindex/Config.in"
+	source "package/libtalloc/Config.in"
 	source "package/libtasn1/Config.in"
 	source "package/libtommath/Config.in"
 	source "package/libtpl/Config.in"
diff --git a/package/libtalloc/Config.in b/package/libtalloc/Config.in
new file mode 100644
index 0000000000..3e6a97bb6e
--- /dev/null
+++ b/package/libtalloc/Config.in
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_LIBTALLOC
+	bool "libtalloc"
+	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_USES_GLIBC && !BR2_COMPILER_PARANOID_UNSAFE_PATH || !BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  talloc is a hierarchical, reference counted memory pool system with
+	  destructors. It is the core memory allocator used in Samba.
+
+	  https://talloc.samba.org/talloc/doc/html/index.html
+
diff --git a/package/libtalloc/libtalloc-cache.txt b/package/libtalloc/libtalloc-cache.txt
new file mode 100644
index 0000000000..a2b44857da
--- /dev/null
+++ b/package/libtalloc/libtalloc-cache.txt
@@ -0,0 +1,42 @@
+Checking simple C program: OK
+rpath library support: OK
+-Wl,--version-script support: OK
+Checking getconf LFS_CFLAGS: NO
+Checking for large file support without additional flags: OK
+Checking for -D_LARGE_FILES: OK
+Checking correct behavior of strtoll: NO
+Checking for working strptime: OK
+Checking for C99 vsnprintf: OK
+Checking for HAVE_SHARED_MMAP: OK
+Checking for HAVE_MREMAP: OK
+Checking for HAVE_INCOHERENT_MMAP: NO
+Checking for HAVE_SECURE_MKSTEMP: OK
+Checking for HAVE_IFACE_GETIFADDRS: OK
+Checking for kernel change notify support: OK
+Checking for Linux kernel oplocks: OK
+Checking for kernel share modes: OK
+Checking if can we convert from CP850 to UCS-2LE: OK
+Checking if can we convert from UTF-8 to UCS-2LE: OK
+Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
+Checking whether we can use Linux thread-specific credentials: OK
+Checking whether setreuid is available: OK
+Checking whether setresuid is available: OK
+Checking whether seteuid is available: OK
+Checking whether fcntl locking is available: OK
+Checking whether fcntl lock supports open file description locks: OK
+Checking for the maximum value of the 'time_t' type: OK
+Checking whether the realpath function allows a NULL argument: OK
+Checking whether POSIX capabilities are available: OK
+Checking for ftruncate extend: OK
+vfs_fileid checking for statfs() and struct statfs.f_fsid: OK
+getcwd takes a NULL argument: OK
+Checking uname sysname type: "Linux"
+Checking uname release type: "5.4.0"
+Checking uname version type: "#1 Tue Oct 1 00:00:00 UTC 2020"
+Checking value of NSIG: "65"
+Checking value of _NSIG: "65"
+Checking value of SIGRTMAX: "64"
+Checking value of SIGRTMIN: "34"
+Checking errno of iconv for illegal multibyte sequence: "0"
+checking for clnt_create(): OK
+Checking for a 64-bit host to support lmdb: NO
diff --git a/package/libtalloc/libtalloc.hash b/package/libtalloc/libtalloc.hash
new file mode 100644
index 0000000000..20211210d2
--- /dev/null
+++ b/package/libtalloc/libtalloc.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  ef4822d2fdafd2be8e0cabc3ec3c806ae29b8268e932c5e9a4cd5585f37f9f77  talloc-2.3.1.tar.gz
+
diff --git a/package/libtalloc/libtalloc.mk b/package/libtalloc/libtalloc.mk
new file mode 100644
index 0000000000..7a42da8145
--- /dev/null
+++ b/package/libtalloc/libtalloc.mk
@@ -0,0 +1,48 @@
+################################################################################
+#
+# libtalloc
+#
+################################################################################
+
+LIBTALLOC_VERSION = 2.3.1
+LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
+LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
+LIBTALLOC_LICENSE = LGPL-3.0, GPL-3.0+
+LIBTALLOC_LICENSE_FILES = talloc.h pytalloc.h
+LIBTALLOC_INSTALL_STAGING = YES
+
+LIBTALLOC_CONF_OPTS += --prefix=/usr \
+		--libdir=/usr/lib \
+		--cross-compile \
+		--cross-answers=$(@D)/cache.txt \
+		--hostcc=gcc
+
+ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
+LIBTALLOC_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
+LIBTALLOC_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
+LIBTALLOC_DEPENDENCIES += libtirpc host-pkgconf
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+LIBTALLOC_PYTHON = \
+	PYTHON="$(HOST_DIR)/bin/python3" \
+	PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
+LIBTALLOC_DEPENDENCIES += host-python3 python3
+LIBTALLOC_CONF_ENV += \
+	$(LIBTALLOC_PYTHON)
+# There is not a --enable-python configuration option
+else
+LIBTALLOC_CONF_OPTS += --disable-python
+endif
+
+LIBTALLOC_WAF = ./buildtools/bin/waf
+
+define LIBTALLOC_POPULATE_WAF_CACHE
+	$(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt
+	echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt
+endef
+
+LIBTALLOC_PRE_CONFIGURE_HOOKS += LIBTALLOC_POPULATE_WAF_CACHE
+
+$(eval $(waf-package))
+
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v2 3/3] package/freeradius-server: new package
  2020-10-13 14:37 ` [Buildroot] [PATCH 2/2] package/freeradius-server: " David GOUARIN
@ 2020-10-13 19:51   ` David GOUARIN
  2020-10-14 17:02     ` [Buildroot] [PATCH v3] " David GOUARIN
  0 siblings, 1 reply; 15+ messages in thread
From: David GOUARIN @ 2020-10-13 19:51 UTC (permalink / raw)
  To: buildroot

FreeRADIUS is an open source server which implements
a protocol for remote user Authorization, Authentication
and Accounting.

Changes v1 -> v2:
  fix invalid characters in Config.in

Signed-off-by: David GOUARIN <dgouarin@gmail.com>
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 .../0001-host-jlibtool.patch                  | 17 +++++++++
 ...thread-support-while-cross-compiling.patch | 15 ++++++++
 package/freeradius-server/Config.in           | 20 ++++++++++
 .../freeradius-server-config.cache            |  4 ++
 .../freeradius-server/freeradius-server.hash  |  3 ++
 .../freeradius-server/freeradius-server.mk    | 37 +++++++++++++++++++
 8 files changed, 98 insertions(+)
 create mode 100644 package/freeradius-server/0001-host-jlibtool.patch
 create mode 100644 package/freeradius-server/0002-thread-support-while-cross-compiling.patch
 create mode 100644 package/freeradius-server/Config.in
 create mode 100644 package/freeradius-server/freeradius-server-config.cache
 create mode 100644 package/freeradius-server/freeradius-server.hash
 create mode 100644 package/freeradius-server/freeradius-server.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index c856d7ad45..ae688a85c4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -711,6 +711,7 @@ N:	David du Colombier <0intro@gmail.com>
 F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
+F:	package/freeradius-server/
 F:	package/librelp/
 F:	package/libtalloc/
 
diff --git a/package/Config.in b/package/Config.in
index a4d6fe02ae..8e3ce4fe20 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2079,6 +2079,7 @@ menu "Networking applications"
 	source "package/flannel/Config.in"
 	source "package/fmc/Config.in"
 	source "package/fping/Config.in"
+	source "package/freeradius-server/Config.in"
 	source "package/freeswitch/Config.in"
 	source "package/freeswitch-mod-bcg729/Config.in"
 	source "package/frr/Config.in"
diff --git a/package/freeradius-server/0001-host-jlibtool.patch b/package/freeradius-server/0001-host-jlibtool.patch
new file mode 100644
index 0000000000..18cebcb4e5
--- /dev/null
+++ b/package/freeradius-server/0001-host-jlibtool.patch
@@ -0,0 +1,17 @@
+jlibtool.c: while cross compiling, use host CC instead of target CC to build jlibtool
+
+Signed-off-by: David Gouarin <dgouarin@gmail.com>
+
+--- a/scripts/libtool.mk 2018-10-08 09:22:59.032031858 -0600
++++ b/scripts/libtool.mk 2018-10-08 15:04:18.406661484 -0600
+@@ -43,8 +43,8 @@ ifeq "${LIBTOOL}" "JLIBTOOL"
+    # binary!
+	${JLIBTOOL}: ${top_makedir}/jlibtool.c
+	$(Q)mkdir -p $(dir $@)
+-	$(Q)echo CC jlibtool.c
+-	$(Q)${CC} $< -o $@
++	$(Q)echo HOSTCC jlibtool.c
++	$(Q)${HOSTCC} $< -o $@
+
+    clean: jlibtool_clean
+
diff --git a/package/freeradius-server/0002-thread-support-while-cross-compiling.patch b/package/freeradius-server/0002-thread-support-while-cross-compiling.patch
new file mode 100644
index 0000000000..464bcf9aa6
--- /dev/null
+++ b/package/freeradius-server/0002-thread-support-while-cross-compiling.patch
@@ -0,0 +1,15 @@
+configure: enable __thread attribute compiler support by default when cross compiling to avoid a bug in some freeradius macros
+
+Signed-off-by: David Gouarin <dgouarin@gmail.com>
+
+--- a/configure
++++ b/configure
+@@ -11309,7 +11309,7 @@ fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread support in compiler" >&5
+ $as_echo_n "checking for __thread support in compiler... " >&6; }
+   if test "$cross_compiling" = yes; then :
+-  have_tls=no
++  have_tls=yes
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/package/freeradius-server/Config.in b/package/freeradius-server/Config.in
new file mode 100644
index 0000000000..0aa0722970
--- /dev/null
+++ b/package/freeradius-server/Config.in
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_FREERADIUS_SERVER
+	bool "freeradius-server"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on !BR2_COMPILER_PARANOID_UNSAFE_PATH
+	select BR2_PACKAGE_LIBTALLOC
+	select BR2_PACKAGE_PCRE
+	help
+	  FreeRADIUS is an open source server which implements
+	  a protocol for remote user Authorization, Authentication
+	  and Accounting.
+
+	  http://wiki.freeradius.org/
+
+comment "freeradius-server needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "freeradius-server needs a glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_COMPILER_PARANOID_UNSAFE_PATH
+
diff --git a/package/freeradius-server/freeradius-server-config.cache b/package/freeradius-server/freeradius-server-config.cache
new file mode 100644
index 0000000000..b0e582afc9
--- /dev/null
+++ b/package/freeradius-server/freeradius-server-config.cache
@@ -0,0 +1,4 @@
+ax_cv_cc_bounded_attribute=no
+ax_cv_cc_builtin_bswap64=yes
+ax_cv_cc_builtin_choose_expr=yes
+ax_cv_cc_builtin_types_compatible_p=yes
diff --git a/package/freeradius-server/freeradius-server.hash b/package/freeradius-server/freeradius-server.hash
new file mode 100644
index 0000000000..ba338d8b7f
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  2bf914d471d4409fd72e708e308fa32ca8d01d698c518497a1d4b867d50132ae  freeradius-server-3.0.21.tar.gz
+sha256  8b9cc1e5d41938be45a368f126a6d1fda03d60a3d622dc75e776be4e90c2d2c6  COPYRIGHT
diff --git a/package/freeradius-server/freeradius-server.mk b/package/freeradius-server/freeradius-server.mk
new file mode 100644
index 0000000000..d04f453c60
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.mk
@@ -0,0 +1,37 @@
+################################################################################
+#
+# freeradius-server
+#
+################################################################################
+
+FREERADIUS_SERVER_VERSION = 3.0.21
+FREERADIUS_SERVER_SITE = ftp://ftp.freeradius.org/pub/freeradius
+FREERADIUS_SERVER_LICENSE = GPL-2.0
+FREERADIUS_SERVER_LICENSE_FILES = COPYRIGHT
+FREERADIUS_SERVER_INSTALL_HOST = NO
+
+FREERADIUS_SERVER_DEPENDENCIES = libtalloc pcre
+
+ifeq ($(BR2_PACKAGE_HAS_OPENSSL),y)
+FREERADIUS_SERVER_DEPENDENCIES += openssl
+FREERADIUS_SERVER_CONF_OPTS += --with-openssl
+else
+FREERADIUS_CONF_OPTS += --without-openssl
+endif
+
+define FREERADIUS_SERVER_CACHE_FOR_CROSS_COMPILE
+	$(INSTALL) -m 0644 package/freeradius-server/freeradius-server-config.cache $(@D)/freeradius-server-config.cache
+endef
+FREERADIUS_SERVER_PRE_CONFIGURE_HOOKS += FREERADIUS_SERVER_CACHE_FOR_CROSS_COMPILE
+
+# --cache-file= : some compiler checks are not supported while cross compiling.
+#   instead of removing those checks, we use a config.cache file
+FREERADIUS_SERVER_CONF_OPTS += \
+	--cache-file=freeradius-server-config.cache
+
+FREERADIUS_SERVER_MAKE_ENV = R=$(TARGET_DIR) TARGET_DIR=""
+ 
+# make install does not support parallel build
+FREERADIUS_SERVER_MAKE = $(MAKE1)
+
+$(eval $(autotools-package))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v3] package/freeradius-server: new package
  2020-10-13 19:51   ` [Buildroot] [PATCH v2 3/3] " David GOUARIN
@ 2020-10-14 17:02     ` David GOUARIN
  2020-10-14 19:26       ` Thomas Petazzoni
  2020-10-15 20:06       ` [Buildroot] [PATCH v4] package/libtalloc: " David GOUARIN
  0 siblings, 2 replies; 15+ messages in thread
From: David GOUARIN @ 2020-10-14 17:02 UTC (permalink / raw)
  To: buildroot

FreeRADIUS is an open source server which implements
a protocol for remote user Authorization, Authentication
and Accounting.

Changes v1 -> v2:
  fix invalid characters in Config.in

Changes v2 -> v3:
  As suggested by Matt, merge with pending upstream patch. Included most of it,
  including patches based on Yocto work :
  http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
  Didn't kept all the --without directive, as they do not seem useful, nor
  the custom INSTALL_TARGET_CMDS.

Signed-off-by: David GOUARIN <david.gouarin@thalesgroup.com>
Signed-off-by: David GOUARIN <dgouarin@gmail.com>
---
 DEVELOPERS                                    |   1 +
 package/Config.in                             |   1 +
 .../0001-host-jlibtool.patch                  |  17 +++
 package/freeradius-server/Config.in           |  19 +++
 .../freeradius-server-config.cache            |   4 +
 .../freeradius-server/freeradius-server.hash  |   8 ++
 .../freeradius-server/freeradius-server.mk    | 126 ++++++++++++++++++
 7 files changed, 176 insertions(+)
 create mode 100644 package/freeradius-server/0001-host-jlibtool.patch
 create mode 100644 package/freeradius-server/Config.in
 create mode 100644 package/freeradius-server/freeradius-server-config.cache
 create mode 100644 package/freeradius-server/freeradius-server.hash
 create mode 100644 package/freeradius-server/freeradius-server.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index c856d7ad45..ae688a85c4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -711,6 +711,7 @@ N:	David du Colombier <0intro@gmail.com>
 F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
+F:	package/freeradius-server/
 F:	package/librelp/
 F:	package/libtalloc/
 
diff --git a/package/Config.in b/package/Config.in
index a4d6fe02ae..8e3ce4fe20 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2079,6 +2079,7 @@ menu "Networking applications"
 	source "package/flannel/Config.in"
 	source "package/fmc/Config.in"
 	source "package/fping/Config.in"
+	source "package/freeradius-server/Config.in"
 	source "package/freeswitch/Config.in"
 	source "package/freeswitch-mod-bcg729/Config.in"
 	source "package/frr/Config.in"
diff --git a/package/freeradius-server/0001-host-jlibtool.patch b/package/freeradius-server/0001-host-jlibtool.patch
new file mode 100644
index 0000000000..18cebcb4e5
--- /dev/null
+++ b/package/freeradius-server/0001-host-jlibtool.patch
@@ -0,0 +1,17 @@
+jlibtool.c: while cross compiling, use host CC instead of target CC to build jlibtool
+
+Signed-off-by: David Gouarin <dgouarin@gmail.com>
+
+--- a/scripts/libtool.mk 2018-10-08 09:22:59.032031858 -0600
++++ b/scripts/libtool.mk 2018-10-08 15:04:18.406661484 -0600
+@@ -43,8 +43,8 @@ ifeq "${LIBTOOL}" "JLIBTOOL"
+    # binary!
+	${JLIBTOOL}: ${top_makedir}/jlibtool.c
+	$(Q)mkdir -p $(dir $@)
+-	$(Q)echo CC jlibtool.c
+-	$(Q)${CC} $< -o $@
++	$(Q)echo HOSTCC jlibtool.c
++	$(Q)${HOSTCC} $< -o $@
+
+    clean: jlibtool_clean
+
diff --git a/package/freeradius-server/Config.in b/package/freeradius-server/Config.in
new file mode 100644
index 0000000000..456e05a5a9
--- /dev/null
+++ b/package/freeradius-server/Config.in
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_FREERADIUS_SERVER
+	bool "freeradius-server"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on !BR2_COMPILER_PARANOID_UNSAFE_PATH
+	select BR2_PACKAGE_LIBTALLOC
+	help
+	  FreeRADIUS is an open source server which implements
+	  a protocol for remote user Authorization, Authentication
+	  and Accounting.
+
+	  http://wiki.freeradius.org/
+
+comment "freeradius-server needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "freeradius-server needs a glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC || BR2_COMPILER_PARANOID_UNSAFE_PATH
+
diff --git a/package/freeradius-server/freeradius-server-config.cache b/package/freeradius-server/freeradius-server-config.cache
new file mode 100644
index 0000000000..d554b9a9aa
--- /dev/null
+++ b/package/freeradius-server/freeradius-server-config.cache
@@ -0,0 +1,4 @@
+ax_cv_cc_bounded_attribute=no
+ax_cv_cc_builtin_bswap64=no
+ax_cv_cc_builtin_choose_expr=no
+ax_cv_cc_builtin_types_compatible_p=no
diff --git a/package/freeradius-server/freeradius-server.hash b/package/freeradius-server/freeradius-server.hash
new file mode 100644
index 0000000000..a1678b6809
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.hash
@@ -0,0 +1,8 @@
+# Locally computed
+sha256  2bf914d471d4409fd72e708e308fa32ca8d01d698c518497a1d4b867d50132ae  freeradius-server-3.0.21.tar.gz
+sha256  8b9cc1e5d41938be45a368f126a6d1fda03d60a3d622dc75e776be4e90c2d2c6  COPYRIGHT
+sha256  bf25b952f9f92d0fd0e9da3b61fd60e2bbbe4d5971650238151c8d7420780931  freeradius-avoid-searching-host-dirs.patch
+sha256  11441c8016fac480b16d160098c25caec6f5031ebc1310b6e523f90b6e27deb5  freeradius-configure.ac-add-option-for-libcap.patch
+sha256  fe429bf21a1b2f2b6648281ec30599ce1cee6b65aa5089e2cea0dfa89f63f64d  freeradius-configure.ac-allow-cross-compilation.patch
+sha256  9c19e94062b5dd8150b374a9698230db7fce1132c3c1d801f0370c578107159f  freeradius-fix-error-for-expansion-of-macro.patch
+
diff --git a/package/freeradius-server/freeradius-server.mk b/package/freeradius-server/freeradius-server.mk
new file mode 100644
index 0000000000..a7ec9443ef
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.mk
@@ -0,0 +1,126 @@
+################################################################################
+#
+# freeradius-server
+#
+################################################################################
+
+FREERADIUS_SERVER_VERSION = 3.0.21
+FREERADIUS_SERVER_SITE = ftp://ftp.freeradius.org/pub/freeradius
+FREERADIUS_SERVER_LICENSE = GPL-2.0
+FREERADIUS_SERVER_LICENSE_FILES = COPYRIGHT
+
+FREERADIUS_SERVER_PATCH = \
+	http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/freeradius/files/freeradius-avoid-searching-host-dirs.patch \
+	http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/freeradius/files/freeradius-configure.ac-add-option-for-libcap.patch \
+	http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/freeradius/files/freeradius-configure.ac-allow-cross-compilation.patch \
+	http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/freeradius/files/freeradius-fix-error-for-expansion-of-macro.patch
+
+FREERADIUS_SERVER_DEPENDENCIES = libtalloc
+
+# --cache-file= : some compiler checks are not supported while cross compiling.
+#   instead of removing those checks, we use a config.cache file
+FREERADIUS_SERVER_CONF_OPTS += \
+	--cache-file=freeradius-server-config.cache
+
+ifeq ($(BR2_PACKAGE_LIBCAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-libcap
+FREERADIUS_SERVER_DEPENDENCIES += libcap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-libcap
+endif
+
+ifeq ($(BR2_PACKAGE_LIBKRB5),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_krb5
+FREERADIUS_SERVER_DEPENDENCIES += libkrb5
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_krb5
+endif
+
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_pam
+FREERADIUS_SERVER_DEPENDENCIES += linux-pam
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_pam
+endif
+
+ifeq ($(BR2_PACKAGE_OPENLDAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_ldap
+FREERADIUS_SERVER_DEPENDENCIES += openldap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_ldap
+endif
+
+ifeq ($(BR2_PACKAGE_MYSQL),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_mysql
+FREERADIUS_SERVER_DEPENDENCIES += mysql
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_mysql
+endif
+
+ifeq ($(BR2_PACKAGE_SQLITE),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_sqlite
+FREERADIUS_SERVER_DEPENDENCIES += sqlite
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_sqlite
+endif
+
+ifeq ($(BR2_PACKAGE_UNIXODBC),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_unixodbc
+FREERADIUS_SERVER_DEPENDENCIES += unixodbc
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_unixodbc
+endif
+
+ifeq ($(BR2_PACKAGE_POSTGRESQL),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_postgresql
+FREERADIUS_SERVER_DEPENDENCIES += postgresql
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_postgresql
+endif
+
+ifeq ($(BR2_PACKAGE_HAS_OPENSSL),y)
+FREERADIUS_SERVER_DEPENDENCIES += openssl
+FREERADIUS_SERVER_CONF_OPTS += --with-openssl
+else
+FREERADIUS_CONF_OPTS += --without-openssl
+endif
+
+ifeq ($(BR2_PACKAGE_PCRE),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-pcre
+FREERADIUS_SERVER_DEPENDENCIES += pcre
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-pcre
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_python --with-rlm-python-bin=$(HOST_DIR)/bin/python --with-rlm-python-include-dir=$(STAGING_INCDIR)/usr/lib/$(PYTHON_PYQT5_PYTHON_DIR) --with-rlm_perl
+FREERADIUS_SERVER_DEPENDENCIES += python3
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_python
+endif
+
+ifeq ($(BR2_PACKAGE_RUBY),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_ruby
+FREERADIUS_SERVER_DEPENDENCIES += ruby
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_ruby
+endif
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-systemd
+FREERADIUS_SERVER_DEPENDENCIES += systemd
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-systemd
+endif
+
+define FREERADIUS_SERVER_CACHE_FOR_CROSS_COMPILE
+	$(INSTALL) -m 0644 package/freeradius-server/freeradius-server-config.cache $(@D)/freeradius-server-config.cache
+endef
+FREERADIUS_SERVER_PRE_CONFIGURE_HOOKS += FREERADIUS_SERVER_CACHE_FOR_CROSS_COMPILE
+
+FREERADIUS_SERVER_MAKE_ENV = R=$(TARGET_DIR) TARGET_DIR=""
+ 
+# make install does not support parallel build
+FREERADIUS_SERVER_MAKE = $(MAKE1)
+
+$(eval $(autotools-package))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v2 2/3] package/libtalloc: new package
  2020-10-13 19:50 ` [Buildroot] [PATCH v2 2/3] " David GOUARIN
@ 2020-10-14 19:18   ` Thomas Petazzoni
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2020-10-14 19:18 UTC (permalink / raw)
  To: buildroot

On Tue, 13 Oct 2020 21:50:44 +0200
David GOUARIN <dgouarin@gmail.com> wrote:

> talloc is a hierarchical, reference counted memory pool system with destructors.
> It is the core memory allocator used in Samba.
> 
> Change v1 -> v2:
>   - merge with work from jared.bents at rockwellcollins.com, as sujested by Matthew Weber
>     http://patchwork.ozlabs.org/project/buildroot/patch/20200327150225.15277-1-jared.bents at rockwellcollins.com

Changes should go below the --- sign...

> 
> Signed-off-by: David GOUARIN <dgouarin@gmail.com>
> ---

... here.

> diff --git a/package/libtalloc/Config.in b/package/libtalloc/Config.in
> new file mode 100644
> index 0000000000..3e6a97bb6e
> --- /dev/null
> +++ b/package/libtalloc/Config.in
> @@ -0,0 +1,10 @@
> +config BR2_PACKAGE_LIBTALLOC
> +	bool "libtalloc"
> +	depends on BR2_USE_MMU
> +	depends on BR2_TOOLCHAIN_USES_GLIBC && !BR2_COMPILER_PARANOID_UNSAFE_PATH || !BR2_TOOLCHAIN_USES_GLIBC

What is the problem with BR2_COMPILER_PARANOID_UNSAFE_PATH ? It
shouldn't matter. If it does, you have a different problem.


> diff --git a/package/libtalloc/libtalloc.hash b/package/libtalloc/libtalloc.hash
> new file mode 100644
> index 0000000000..20211210d2
> --- /dev/null
> +++ b/package/libtalloc/libtalloc.hash
> @@ -0,0 +1,3 @@
> +# Locally calculated
> +sha256  ef4822d2fdafd2be8e0cabc3ec3c806ae29b8268e932c5e9a4cd5585f37f9f77  talloc-2.3.1.tar.gz
> +

We want the hashes of the license files here.

> diff --git a/package/libtalloc/libtalloc.mk b/package/libtalloc/libtalloc.mk
> new file mode 100644
> index 0000000000..7a42da8145
> --- /dev/null
> +++ b/package/libtalloc/libtalloc.mk
> @@ -0,0 +1,48 @@
> +################################################################################
> +#
> +# libtalloc
> +#
> +################################################################################
> +
> +LIBTALLOC_VERSION = 2.3.1
> +LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
> +LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
> +LIBTALLOC_LICENSE = LGPL-3.0, GPL-3.0+

Are there some specific parts under LGPL-3.0 and others under GPL-3.0+
? If so, it would be good to indicate it, like this for example:

	LGPL-3.0 (library), GPL-3.0+ (tests)

Of course, adjust depending on what is under what license.

> +LIBTALLOC_LICENSE_FILES = talloc.h pytalloc.h
> +LIBTALLOC_INSTALL_STAGING = YES
> +
> +LIBTALLOC_CONF_OPTS += --prefix=/usr \
> +		--libdir=/usr/lib \

prefix and libdir are already passed by the waf-package infrastructure,
so passing them again here is not necessary.

Otherwise, it looks good to me.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v3] package/freeradius-server: new package
  2020-10-14 17:02     ` [Buildroot] [PATCH v3] " David GOUARIN
@ 2020-10-14 19:26       ` Thomas Petazzoni
  2020-10-15 20:06       ` [Buildroot] [PATCH v4] package/libtalloc: " David GOUARIN
  1 sibling, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2020-10-14 19:26 UTC (permalink / raw)
  To: buildroot

Hello David,

On Wed, 14 Oct 2020 19:02:54 +0200
David GOUARIN <dgouarin@gmail.com> wrote:

> FreeRADIUS is an open source server which implements
> a protocol for remote user Authorization, Authentication
> and Accounting.

Thanks for this contribution. First of all, it would be good to not
send a v3 of freeradius-server alone: always send the entire series.
Otherwise, we can't keep track of the fact that this patch requires
libtalloc.

> Changes v1 -> v2:
>   fix invalid characters in Config.in
> 
> Changes v2 -> v3:
>   As suggested by Matt, merge with pending upstream patch. Included most of it,
>   including patches based on Yocto work :
>   http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
>   Didn't kept all the --without directive, as they do not seem useful, nor
>   the custom INSTALL_TARGET_CMDS.

Changes should go...

> 
> Signed-off-by: David GOUARIN <david.gouarin@thalesgroup.com>
> Signed-off-by: David GOUARIN <dgouarin@gmail.com>
> ---

... here.


> diff --git a/package/freeradius-server/0001-host-jlibtool.patch b/package/freeradius-server/0001-host-jlibtool.patch
> new file mode 100644
> index 0000000000..18cebcb4e5
> --- /dev/null
> +++ b/package/freeradius-server/0001-host-jlibtool.patch
> @@ -0,0 +1,17 @@
> +jlibtool.c: while cross compiling, use host CC instead of target CC to build jlibtool
> +
> +Signed-off-by: David Gouarin <dgouarin@gmail.com>

This the upstream project is hosted in Git, we want patches to be
formatted using "git format-patch -N".

> diff --git a/package/freeradius-server/Config.in b/package/freeradius-server/Config.in
> new file mode 100644
> index 0000000000..456e05a5a9
> --- /dev/null
> +++ b/package/freeradius-server/Config.in
> @@ -0,0 +1,19 @@
> +config BR2_PACKAGE_FREERADIUS_SERVER
> +	bool "freeradius-server"
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	depends on BR2_TOOLCHAIN_USES_GLIBC
> +	depends on !BR2_COMPILER_PARANOID_UNSAFE_PATH

Why? We cannot merge packages that don't work with
BR2_COMPILER_PARANOID_UNSAFE_PATH.

> diff --git a/package/freeradius-server/freeradius-server-config.cache b/package/freeradius-server/freeradius-server-config.cache
> new file mode 100644
> index 0000000000..d554b9a9aa
> --- /dev/null
> +++ b/package/freeradius-server/freeradius-server-config.cache
> @@ -0,0 +1,4 @@
> +ax_cv_cc_bounded_attribute=no
> +ax_cv_cc_builtin_bswap64=no
> +ax_cv_cc_builtin_choose_expr=no
> +ax_cv_cc_builtin_types_compatible_p=no

You should not use a cache file, but instead pass those variables in
FREERADIUS_SERVER_CONF_ENV.

> diff --git a/package/freeradius-server/freeradius-server.hash b/package/freeradius-server/freeradius-server.hash
> new file mode 100644
> index 0000000000..a1678b6809
> --- /dev/null
> +++ b/package/freeradius-server/freeradius-server.hash
> @@ -0,0 +1,8 @@
> +# Locally computed
> +sha256  2bf914d471d4409fd72e708e308fa32ca8d01d698c518497a1d4b867d50132ae  freeradius-server-3.0.21.tar.gz
> +sha256  8b9cc1e5d41938be45a368f126a6d1fda03d60a3d622dc75e776be4e90c2d2c6  COPYRIGHT
> +sha256  bf25b952f9f92d0fd0e9da3b61fd60e2bbbe4d5971650238151c8d7420780931  freeradius-avoid-searching-host-dirs.patch
> +sha256  11441c8016fac480b16d160098c25caec6f5031ebc1310b6e523f90b6e27deb5  freeradius-configure.ac-add-option-for-libcap.patch
> +sha256  fe429bf21a1b2f2b6648281ec30599ce1cee6b65aa5089e2cea0dfa89f63f64d  freeradius-configure.ac-allow-cross-compilation.patch
> +sha256  9c19e94062b5dd8150b374a9698230db7fce1132c3c1d801f0370c578107159f  freeradius-fix-error-for-expansion-of-macro.patch
> +

Empty new line at end of file.


> +FREERADIUS_SERVER_VERSION = 3.0.21
> +FREERADIUS_SERVER_SITE = ftp://ftp.freeradius.org/pub/freeradius
> +FREERADIUS_SERVER_LICENSE = GPL-2.0
> +FREERADIUS_SERVER_LICENSE_FILES = COPYRIGHT
> +
> +FREERADIUS_SERVER_PATCH = \
> +	http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/freeradius/files/freeradius-avoid-searching-host-dirs.patch \
> +	http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/freeradius/files/freeradius-configure.ac-add-option-for-libcap.patch \
> +	http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/freeradius/files/freeradius-configure.ac-allow-cross-compilation.patch \
> +	http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/freeradius/files/freeradius-fix-error-for-expansion-of-macro.patch

I am not sure it's a good idea to download those patches: there is
nothing in these URLs that indicate that they will be stable. So I
would prefer if those patches were imported in
package/freeradius-server/. When you do so, please make sure to add
your own Signed-off-by in each of the patch, below the existing
Signed-off-by.

> +
> +FREERADIUS_SERVER_DEPENDENCIES = libtalloc
> +
> +# --cache-file= : some compiler checks are not supported while cross compiling.
> +#   instead of removing those checks, we use a config.cache file
> +FREERADIUS_SERVER_CONF_OPTS += \
> +	--cache-file=freeradius-server-config.cache

As said above: use <pkg>_CONF_ENV.


> +ifeq ($(BR2_PACKAGE_PYTHON3),y)
> +FREERADIUS_SERVER_CONF_OPTS += --with-rlm_python --with-rlm-python-bin=$(HOST_DIR)/bin/python --with-rlm-python-include-dir=$(STAGING_INCDIR)/usr/lib/$(PYTHON_PYQT5_PYTHON_DIR) --with-rlm_perl

STAGING_INCDIR doesn't exist in Buildroot.

And PYTHON_PYQT5_PYTHON_DIR is completely unrelated, it shouldn't be
used here. Also, pointing an "include dir" option to a library folder
seems dubious.

Finally, having --with-rlm_perl in an option enabling Python support
looks weird.

Note: if you're not using all those optional features, don't support
them: keep an unconditional --without-<foo>, that's perfectly
acceptable.

> +define FREERADIUS_SERVER_CACHE_FOR_CROSS_COMPILE
> +	$(INSTALL) -m 0644 package/freeradius-server/freeradius-server-config.cache $(@D)/freeradius-server-config.cache
> +endef
> +FREERADIUS_SERVER_PRE_CONFIGURE_HOOKS += FREERADIUS_SERVER_CACHE_FOR_CROSS_COMPILE
> +
> +FREERADIUS_SERVER_MAKE_ENV = R=$(TARGET_DIR) TARGET_DIR=""

What is this doing?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v4] package/libtalloc: new package
  2020-10-14 17:02     ` [Buildroot] [PATCH v3] " David GOUARIN
  2020-10-14 19:26       ` Thomas Petazzoni
@ 2020-10-15 20:06       ` David GOUARIN
  2020-10-15 20:06         ` [Buildroot] [PATCH v4] package/freeradius-server: " David GOUARIN
  2020-10-15 20:16         ` [Buildroot] [PATCH v4] package/libtalloc: " Thomas Petazzoni
  1 sibling, 2 replies; 15+ messages in thread
From: David GOUARIN @ 2020-10-15 20:06 UTC (permalink / raw)
  To: buildroot

talloc is a hierarchical, reference counted memory pool system with destructors.
It is the core memory allocator used in Samba.

Signed-off-by: David GOUARIN <dgouarin@thalesgroup.com>

Change v1 -> v2:
  - merge with work from jared.bents at rockwellcollins.com, as sujested by Matthew Weber
    http://patchwork.ozlabs.org/project/buildroot/patch/20200327150225.15277-1-jared.bents at rockwellcollins.com

Change v2 -> v4: (no v3, resubmitting the whole patch series)
  - fix build with BR2_PARANOID_UNSAFE_PATH (Thomas review)
  - add hashes of license files (Thomas)
  - license is GPL-3.0+ for both talloc and pytalloc (Thomas)
  - remove useless --prefix and --libdir (Thomas)

---
 DEVELOPERS                            |  1 +
 package/Config.in                     |  1 +
 package/libtalloc/Config.in           |  9 +++++
 package/libtalloc/libtalloc-cache.txt | 42 ++++++++++++++++++++++++
 package/libtalloc/libtalloc.hash      |  4 +++
 package/libtalloc/libtalloc.mk        | 47 +++++++++++++++++++++++++++
 6 files changed, 104 insertions(+)
 create mode 100644 package/libtalloc/Config.in
 create mode 100644 package/libtalloc/libtalloc-cache.txt
 create mode 100644 package/libtalloc/libtalloc.hash
 create mode 100644 package/libtalloc/libtalloc.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 79a9eaa563..c856d7ad45 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -712,6 +712,7 @@ F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
 F:	package/librelp/
+F:	package/libtalloc/
 
 N:	David Lechner <david@lechnology.com>
 F:	board/lego/ev3/
diff --git a/package/Config.in b/package/Config.in
index 09a332e3b9..a4d6fe02ae 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1894,6 +1894,7 @@ menu "Other"
 	source "package/libsigc/Config.in"
 	source "package/libsigsegv/Config.in"
 	source "package/libspatialindex/Config.in"
+	source "package/libtalloc/Config.in"
 	source "package/libtasn1/Config.in"
 	source "package/libtommath/Config.in"
 	source "package/libtpl/Config.in"
diff --git a/package/libtalloc/Config.in b/package/libtalloc/Config.in
new file mode 100644
index 0000000000..df972f2288
--- /dev/null
+++ b/package/libtalloc/Config.in
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBTALLOC
+	bool "libtalloc"
+	depends on BR2_USE_MMU
+	help
+	  talloc is a hierarchical, reference counted memory pool system with
+	  destructors. It is the core memory allocator used in Samba.
+
+	  https://talloc.samba.org/talloc/doc/html/index.html
+
diff --git a/package/libtalloc/libtalloc-cache.txt b/package/libtalloc/libtalloc-cache.txt
new file mode 100644
index 0000000000..a2b44857da
--- /dev/null
+++ b/package/libtalloc/libtalloc-cache.txt
@@ -0,0 +1,42 @@
+Checking simple C program: OK
+rpath library support: OK
+-Wl,--version-script support: OK
+Checking getconf LFS_CFLAGS: NO
+Checking for large file support without additional flags: OK
+Checking for -D_LARGE_FILES: OK
+Checking correct behavior of strtoll: NO
+Checking for working strptime: OK
+Checking for C99 vsnprintf: OK
+Checking for HAVE_SHARED_MMAP: OK
+Checking for HAVE_MREMAP: OK
+Checking for HAVE_INCOHERENT_MMAP: NO
+Checking for HAVE_SECURE_MKSTEMP: OK
+Checking for HAVE_IFACE_GETIFADDRS: OK
+Checking for kernel change notify support: OK
+Checking for Linux kernel oplocks: OK
+Checking for kernel share modes: OK
+Checking if can we convert from CP850 to UCS-2LE: OK
+Checking if can we convert from UTF-8 to UCS-2LE: OK
+Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
+Checking whether we can use Linux thread-specific credentials: OK
+Checking whether setreuid is available: OK
+Checking whether setresuid is available: OK
+Checking whether seteuid is available: OK
+Checking whether fcntl locking is available: OK
+Checking whether fcntl lock supports open file description locks: OK
+Checking for the maximum value of the 'time_t' type: OK
+Checking whether the realpath function allows a NULL argument: OK
+Checking whether POSIX capabilities are available: OK
+Checking for ftruncate extend: OK
+vfs_fileid checking for statfs() and struct statfs.f_fsid: OK
+getcwd takes a NULL argument: OK
+Checking uname sysname type: "Linux"
+Checking uname release type: "5.4.0"
+Checking uname version type: "#1 Tue Oct 1 00:00:00 UTC 2020"
+Checking value of NSIG: "65"
+Checking value of _NSIG: "65"
+Checking value of SIGRTMAX: "64"
+Checking value of SIGRTMIN: "34"
+Checking errno of iconv for illegal multibyte sequence: "0"
+checking for clnt_create(): OK
+Checking for a 64-bit host to support lmdb: NO
diff --git a/package/libtalloc/libtalloc.hash b/package/libtalloc/libtalloc.hash
new file mode 100644
index 0000000000..9d48a965d0
--- /dev/null
+++ b/package/libtalloc/libtalloc.hash
@@ -0,0 +1,4 @@
+# Locally calculated
+sha256  ef4822d2fdafd2be8e0cabc3ec3c806ae29b8268e932c5e9a4cd5585f37f9f77  talloc-2.3.1.tar.gz
+sha256  15c2767545d1e43dc35832736253bde5be956f8ffec0474a6d0f70349b646ed3  talloc.h
+sha256  8742f2dad3aaf885c7b4b699c20bfa0e9edeab380689f91a88aa90af03e6947b  pytalloc.h
diff --git a/package/libtalloc/libtalloc.mk b/package/libtalloc/libtalloc.mk
new file mode 100644
index 0000000000..f3c80dc862
--- /dev/null
+++ b/package/libtalloc/libtalloc.mk
@@ -0,0 +1,47 @@
+################################################################################
+#
+# libtalloc
+#
+################################################################################
+
+LIBTALLOC_VERSION = 2.3.1
+LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
+LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
+LIBTALLOC_LICENSE = GPL-3.0+
+LIBTALLOC_LICENSE_FILES = talloc.h pytalloc.h
+LIBTALLOC_INSTALL_STAGING = YES
+
+LIBTALLOC_CONF_OPTS += --cross-compile \
+		--cross-answers=$(@D)/cache.txt \
+		--hostcc=gcc \
+		--with-libiconv=$(HOST_DIR)/usr # waf will search by default in /usr/local with causes an error at configure step when BR2_COMPILER_PARANOID_UNSAFE_PATH is set
+
+ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
+LIBTALLOC_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
+LIBTALLOC_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
+LIBTALLOC_DEPENDENCIES += libtirpc host-pkgconf
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+LIBTALLOC_PYTHON = \
+	PYTHON="$(HOST_DIR)/bin/python3" \
+	PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
+LIBTALLOC_DEPENDENCIES += host-python3 python3
+LIBTALLOC_CONF_ENV += \
+	$(LIBTALLOC_PYTHON)
+# There is not a --enable-python configuration option
+else
+LIBTALLOC_CONF_OPTS += --disable-python
+endif
+
+LIBTALLOC_WAF = ./buildtools/bin/waf
+
+define LIBTALLOC_POPULATE_WAF_CACHE
+	$(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt
+	echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt
+endef
+
+LIBTALLOC_PRE_CONFIGURE_HOOKS += LIBTALLOC_POPULATE_WAF_CACHE
+
+$(eval $(waf-package))
+
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v4] package/freeradius-server: new package
  2020-10-15 20:06       ` [Buildroot] [PATCH v4] package/libtalloc: " David GOUARIN
@ 2020-10-15 20:06         ` David GOUARIN
  2020-10-15 20:16         ` [Buildroot] [PATCH v4] package/libtalloc: " Thomas Petazzoni
  1 sibling, 0 replies; 15+ messages in thread
From: David GOUARIN @ 2020-10-15 20:06 UTC (permalink / raw)
  To: buildroot

FreeRADIUS is an open source server which implements
a protocol for remote user Authorization, Authentication
and Accounting.

Signed-off-by: David GOUARIN <david.gouarin@thalesgroup.com>

Changes v1 -> v2:
  fix invalid characters in Config.in

Changes v2 -> v3:
  As suggested by Matt, merge with pending upstream patch. Included most of it,
  including patches based on Yocto work :
  http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
  Didn't kept all the --without directive, as they do not seem useful, nor
  the custom INSTALL_TARGET_CMDS.

Changes v3 -> v4:
  Taken in account Thomas review
  - fix build with BR2_COMPILER_PARANOID_UNSAFE_PATH
  - import patches inside package directory instead of downloading them
  - remove config.cache file, pass the answers on the command line instead
  - add comments for weird TARGET_DIR and R directives
  - remove broken python optional feature. Managed to get it to build
with python 2.7, not 3.0 and it still fails basic testing

---
 DEVELOPERS                                    |   1 +
 package/Config.in                             |   1 +
 .../0001-host-jlibtool.patch                  |  17 ++
 package/freeradius-server/Config.in           |  18 ++
 ...freeradius-avoid-searching-host-dirs.patch | 198 ++++++++++++++++++
 ...s-configure.ac-add-option-for-libcap.patch |  71 +++++++
 ...configure.ac-allow-cross-compilation.patch |  38 ++++
 ...ius-fix-error-for-expansion-of-macro.patch |  62 ++++++
 .../freeradius-server/freeradius-server.hash  |   3 +
 .../freeradius-server/freeradius-server.mk    | 112 ++++++++++
 10 files changed, 521 insertions(+)
 create mode 100644 package/freeradius-server/0001-host-jlibtool.patch
 create mode 100644 package/freeradius-server/Config.in
 create mode 100644 package/freeradius-server/freeradius-avoid-searching-host-dirs.patch
 create mode 100644 package/freeradius-server/freeradius-configure.ac-add-option-for-libcap.patch
 create mode 100644 package/freeradius-server/freeradius-configure.ac-allow-cross-compilation.patch
 create mode 100644 package/freeradius-server/freeradius-fix-error-for-expansion-of-macro.patch
 create mode 100644 package/freeradius-server/freeradius-server.hash
 create mode 100644 package/freeradius-server/freeradius-server.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index c856d7ad45..ae688a85c4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -711,6 +711,7 @@ N:	David du Colombier <0intro@gmail.com>
 F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
+F:	package/freeradius-server/
 F:	package/librelp/
 F:	package/libtalloc/
 
diff --git a/package/Config.in b/package/Config.in
index a4d6fe02ae..8e3ce4fe20 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2079,6 +2079,7 @@ menu "Networking applications"
 	source "package/flannel/Config.in"
 	source "package/fmc/Config.in"
 	source "package/fping/Config.in"
+	source "package/freeradius-server/Config.in"
 	source "package/freeswitch/Config.in"
 	source "package/freeswitch-mod-bcg729/Config.in"
 	source "package/frr/Config.in"
diff --git a/package/freeradius-server/0001-host-jlibtool.patch b/package/freeradius-server/0001-host-jlibtool.patch
new file mode 100644
index 0000000000..18cebcb4e5
--- /dev/null
+++ b/package/freeradius-server/0001-host-jlibtool.patch
@@ -0,0 +1,17 @@
+jlibtool.c: while cross compiling, use host CC instead of target CC to build jlibtool
+
+Signed-off-by: David Gouarin <dgouarin@gmail.com>
+
+--- a/scripts/libtool.mk 2018-10-08 09:22:59.032031858 -0600
++++ b/scripts/libtool.mk 2018-10-08 15:04:18.406661484 -0600
+@@ -43,8 +43,8 @@ ifeq "${LIBTOOL}" "JLIBTOOL"
+    # binary!
+	${JLIBTOOL}: ${top_makedir}/jlibtool.c
+	$(Q)mkdir -p $(dir $@)
+-	$(Q)echo CC jlibtool.c
+-	$(Q)${CC} $< -o $@
++	$(Q)echo HOSTCC jlibtool.c
++	$(Q)${HOSTCC} $< -o $@
+
+    clean: jlibtool_clean
+
diff --git a/package/freeradius-server/Config.in b/package/freeradius-server/Config.in
new file mode 100644
index 0000000000..fad8bfeb80
--- /dev/null
+++ b/package/freeradius-server/Config.in
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_FREERADIUS_SERVER
+	bool "freeradius-server"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	select BR2_PACKAGE_LIBTALLOC
+	help
+	  FreeRADIUS is an open source server which implements
+	  a protocol for remote user Authorization, Authentication
+	  and Accounting.
+
+	  http://wiki.freeradius.org/
+
+comment "freeradius-server needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "freeradius-server needs a glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC
+
diff --git a/package/freeradius-server/freeradius-avoid-searching-host-dirs.patch b/package/freeradius-server/freeradius-avoid-searching-host-dirs.patch
new file mode 100644
index 0000000000..9d02726256
--- /dev/null
+++ b/package/freeradius-server/freeradius-avoid-searching-host-dirs.patch
@@ -0,0 +1,198 @@
+From dc41591d5ceb18900ec85894f8f7b7bb44bb3bd9 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Mon, 4 Jan 2016 01:44:04 -0500
+Subject: [PATCH] avoid searching host dirs
+
+Don't search the hardcoded host dirs to avoid
+host contamination.
+
+Upstream-Status: Inappropriate [cross-compile specific]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+---
+ acinclude.m4                                                | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac        | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac   | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac      | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac      | 6 +++---
+ src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac     | 2 +-
+ src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac   | 4 ++--
+ 8 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index da48acc..b513ae1 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -178,7 +178,7 @@ if test "x$smart_lib" = "x"; then
+   FR_LOCATE_DIR(smart_lib_dir,[lib$1${libltdl_cv_shlibext}])
+   FR_LOCATE_DIR(smart_lib_dir,[lib$1.a])
+ 
+-  for try in $smart_lib_dir /usr/local/lib /opt/lib; do
++  for try in $smart_lib_dir; do
+     AC_MSG_CHECKING([for $2 in -l$1 in $try])
+     LIBS="-l$1 $old_LIBS"
+     CPPFLAGS="-L$try -Wl,-rpath,$try $old_CPPFLAGS"
+@@ -218,7 +218,7 @@ ac_safe=`echo "$1" | sed 'y%./+-%__pm%'`
+ old_CPPFLAGS="$CPPFLAGS"
+ smart_include=
+ dnl #  The default directories we search in (in addition to the compilers search path)
+-smart_include_dir="/usr/local/include /opt/include"
++smart_include_dir=
+ 
+ dnl #  Our local versions
+ _smart_try_dir=
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
+index 75c851a..a262d71 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
+@@ -57,14 +57,14 @@ if test x$with_[]modname != xno; then
+ 		esac])
+ 
+ 	dnl Check for SQLConnect in -ldb2
+-	smart_try_dir="$ibmdb2_lib_dir /usr/local/db2/lib /usr/IBMdb2/V7.1/lib"
++	smart_try_dir="$ibmdb2_lib_dir"
+ 	FR_SMART_CHECK_LIB(db2, SQLConnect)
+ 	if test "x$ac_cv_lib_db2_SQLConnect" != xyes; then
+ 		fail="$fail libdb2"
+ 	fi
+ 
+ 	dnl Check for sqlcli.h
+-	smart_try_dir="$ibmdb2_include_dir /usr/local/db2/include /usr/IBMdb2/V7.1/include"
++	smart_try_dir="$ibmdb2_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(sqlcli.h)
+ 	if test "x$ac_cv_header_sqlcli_h" != xyes; then
+ 		fail="$fail sqlcli.h"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
+index 4da57b3..752b043 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
+@@ -56,14 +56,14 @@ if test x$with_[]modname != xno; then
+ 		esac])
+ 
+ 	dnl Check for isc_attach_database in -lfbclient
+-	smart_try_dir="$firebird_lib_dir /usr/lib/firebird2/lib /usr/local/firebird/lib"
++	smart_try_dir="$firebird_lib_dir"
+ 	FR_SMART_CHECK_LIB(fbclient, isc_attach_database)
+ 	if test "x$ac_cv_lib_fbclient_isc_attach_database" != xyes; then
+ 		fail="$fail libfbclient"
+ 	fi
+ 
+ 	dnl Check for ibase.h
+-	smart_try_dir="$firebird_include_dir /usr/lib/firebird2/include /usr/local/firebird/include"
++	smart_try_dir="$firebird_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(ibase.h)
+ 	if test "x$ac_cv_header_ibase_h" != xyes; then
+ 		fail="$fail ibase.h"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
+index ba6304f..3393557 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
+@@ -57,14 +57,14 @@ if test x$with_[]modname != xno; then
+ 		esac])
+ 
+ 	dnl Check for SQLConnect in -liodbc
+-	smart_try_dir="$iodbc_lib_dir /usr/lib /usr/lib/iodbc /usr/local/lib/iodbc /usr/local/iodbc/lib/iodbc"
++	smart_try_dir="$iodbc_lib_dir"
+ 	FR_SMART_CHECK_LIB(iodbc, SQLConnect)
+ 	if test "x$ac_cv_lib_iodbc_SQLConnect" != xyes; then
+ 		fail="$fail libiodbc"
+ 	fi
+ 
+ 	dnl Check for isql.h
+-	smart_try_dir="$iodbc_include_dir /usr/include /usr/include/iodbc /usr/local/iodbc/include"
++	smart_try_dir="$iodbc_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(isql.h)
+ 	if test "x$ac_cv_header_isql_h" != xyes; then
+ 		fail="$fail isql.h"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
+index 1401677..2e7db44 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
+@@ -136,7 +136,7 @@ if test x$with_[]modname != xno; then
+ 
+ 	dnl # Check for libmysqlclient_r
+ 	if test "x$have_a_libmysqlclient" != "xyes"; then
+-	    smart_try_dir="$mysql_lib_dir /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/mysql/lib/mysql"
++	    smart_try_dir="$mysql_lib_dir"
+ 	    FR_SMART_CHECK_LIB(mysqlclient_r, mysql_init)
+ 	    if test "x$ac_cv_lib_mysqlclient_r_mysql_init" = "xyes"; then
+ 			have_a_libmysqlclient='yes'
+@@ -145,7 +145,7 @@ if test x$with_[]modname != xno; then
+ 
+ 	dnl # Check for libmysqlclient
+ 	if test "x$have_a_libmysqlclient" != "xyes"; then
+-	    smart_try_dir="$mysql_lib_dir /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/mysql/lib/mysql"
++	    smart_try_dir="$mysql_lib_dir"
+ 	    FR_SMART_CHECK_LIB(mysqlclient, mysql_init)
+ 	    if test "x$ac_cv_lib_mysqlclient_mysql_init" = "xyes"; then
+ 			have_a_libmysqlclient='yes'
+@@ -189,7 +189,7 @@ if test x$with_[]modname != xno; then
+     fi
+ 
+     if test "x$have_mysql_h" != "xyes"; then
+-		smart_try_dir="$mysql_include_dir /usr/local/include /usr/local/mysql/include"
++		smart_try_dir="$mysql_include_dir"
+ 		FR_SMART_CHECK_INCLUDE(mysql/mysql.h)
+ 		if test "x$ac_cv_header_mysql_mysql_h" = "xyes"; then
+ 	    	AC_DEFINE(HAVE_MYSQL_MYSQL_H, [], [Define if you have <mysql/mysql.h>])
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
+index 3178462..5cbc8c2 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
+@@ -63,7 +63,7 @@ if test x$with_[]modname != xno; then
+     dnl # Check for header files
+     dnl ############################################################
+ 
+-    smart_try_dir="$oracle_include_dir /usr/local/instaclient/include"
++    smart_try_dir="$oracle_include_dir"
+ 
+     if test "x$ORACLE_HOME" != "x"; then
+ 	smart_try_dir="${smart_try_dir} ${ORACLE_HOME}/include"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
+index 4f9a890..e1cf811 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
+@@ -41,7 +41,7 @@ if test x$with_[]modname != xno; then
+ 	  esac ]
+ 	)
+ 
+-	smart_try_dir="$rlm_sql_postgresql_include_dir /usr/include/postgresql /usr/local/pgsql/include /usr/include/pgsql"
++	smart_try_dir="$rlm_sql_postgresql_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(libpq-fe.h)
+ 	if test "x$ac_cv_header_libpqmfe_h" != "xyes"; then
+ 		fail="$fail libpq-fe.h"
+@@ -76,7 +76,7 @@ if test x$with_[]modname != xno; then
+ 		  ])
+ 	fi
+ 
+-	smart_try_dir="$rlm_sql_postgresql_lib_dir /usr/lib /usr/local/pgsql/lib"
++	smart_try_dir="$rlm_sql_postgresql_lib_dir"
+ 	FR_SMART_CHECK_LIB(pq, PQconnectdb)
+ 	if test "x$ac_cv_lib_pq_PQconnectdb" != "xyes"; then
+ 		fail="$fail libpq"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
+index 3545387..c543ed4 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
+@@ -57,14 +57,14 @@ if test x$with_[]modname != xno; then
+ 		esac])
+ 
+ 	dnl Check for SQLConnect in -lodbc
+-	smart_try_dir="$unixodbc_lib_dir /usr/local/unixodbc/lib"
++	smart_try_dir="$unixodbc_lib_dir"
+ 	FR_SMART_CHECK_LIB(odbc, SQLConnect)
+ 	if test "x$ac_cv_lib_odbc_SQLConnect" != xyes; then
+ 		fail="$fail libodbc"
+ 	fi
+ 
+ 	dnl Check for sql.h
+-	smart_try_dir="$unixodbc_include_dir /usr/local/unixodbc/include"
++	smart_try_dir="$unixodbc_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(sql.h)
+ 	if test "x$ac_cv_header_sql_h" != xyes; then
+ 		fail="$fail sql.h"
+-- 
+1.9.1
+
diff --git a/package/freeradius-server/freeradius-configure.ac-add-option-for-libcap.patch b/package/freeradius-server/freeradius-configure.ac-add-option-for-libcap.patch
new file mode 100644
index 0000000000..6e3321d9bd
--- /dev/null
+++ b/package/freeradius-server/freeradius-configure.ac-add-option-for-libcap.patch
@@ -0,0 +1,71 @@
+From 98a9eff357959d1113e33a615c2178751d5b2054 Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Thu, 22 Aug 2019 10:50:21 +0800
+Subject: [PATCH 2/2] configure.ac: add option for libcap
+
+Upstream-Status: Pending
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+---
+ configure.ac | 36 +++++++++++++++++++++++++++---------
+ 1 file changed, 27 insertions(+), 9 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 65db61e..6486aac 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -977,6 +977,22 @@ fi
+ dnl Set by FR_SMART_CHECKLIB
+ LIBS="${old_LIBS}"
+ 
++dnl #
++dnl #  extra argument: --with-libcap
++dnl #
++WITH_LIBCAP=yes
++AC_ARG_WITH(libcap,
++[  --with-licap          use licap for debugger checks. (default=yes)],
++[ case "$withval" in
++  no)
++    WITH_LIBCAP=no
++    ;;
++  *)
++    WITH_LIBCAP=yes
++    ;;
++  esac ]
++)
++
+ dnl Check for cap
+ dnl extra argument: --with-cap-lib-dir=DIR
+ cap_lib_dir=
+@@ -1010,15 +1026,17 @@ AC_ARG_WITH(cap-include-dir,
+       ;;
+   esac])
+ 
+-smart_try_dir="$cap_lib_dir"
+-FR_SMART_CHECK_LIB(cap, cap_get_proc)
+-if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
+-  AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
+-else
+-  AC_DEFINE(HAVE_LIBCAP, 1,
+-    [Define to 1 if you have the `cap' library (-lcap).]
+-  )
+-  HAVE_LIBCAP=1
++if test "x$WITH_LIBCAP" = xyes; then
++  smart_try_dir="$cap_lib_dir"
++  FR_SMART_CHECK_LIB(cap, cap_get_proc)
++  if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
++    AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
++  else
++    AC_DEFINE(HAVE_LIBCAP, 1,
++      [Define to 1 if you have the `cap' library (-lcap).]
++    )
++    HAVE_LIBCAP=1
++  fi
+ fi
+ 
+ dnl #
+-- 
+2.7.4
+
diff --git a/package/freeradius-server/freeradius-configure.ac-allow-cross-compilation.patch b/package/freeradius-server/freeradius-configure.ac-allow-cross-compilation.patch
new file mode 100644
index 0000000000..936ad015e4
--- /dev/null
+++ b/package/freeradius-server/freeradius-configure.ac-allow-cross-compilation.patch
@@ -0,0 +1,38 @@
+From 0780b7053fb0d33d721aa70ab2ecd75299e5ba31 Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Tue, 24 Jul 2018 15:03:39 +0800
+Subject: [PATCH] configure.ac: allow cross-compilation
+
+The checking OpenSSL library and header version consistency will
+always fail in cross compiling, skip the check and give a warning
+instead for cross compiling.
+
+Upstream-Status: Inappropriate[embedded specific]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+
+update to new version 3.0.17 to fix patch warning
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+---
+ src/modules/rlm_krb5/configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/modules/rlm_krb5/configure.ac b/src/modules/rlm_krb5/configure.ac
+index efc9f29..98a97e4 100644
+--- a/src/modules/rlm_krb5/configure.ac
++++ b/src/modules/rlm_krb5/configure.ac
+@@ -137,7 +137,8 @@ if test x$with_[]modname != xno; then
+ 		FR_SMART_CHECK_LIB(krb5, krb5_is_thread_safe)
+ 		if test "x$ac_cv_lib_krb5_krb5_is_thread_safe" = xyes; then
+ 			AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[return krb5_is_thread_safe() ? 0 : 1]])],
+-				[krb5threadsafe="-DKRB5_IS_THREAD_SAFE"], [AC_MSG_WARN([[libkrb5 is not threadsafe]])])
++				[krb5threadsafe="-DKRB5_IS_THREAD_SAFE"], [AC_MSG_WARN([[libkrb5 is not threadsafe]])],
++				[AC_MSG_WARN(cross compiling: not checking)])
+ 		fi
+ 	else
+ 		krb5threadsafe=""
+-- 
+2.7.4
+
diff --git a/package/freeradius-server/freeradius-fix-error-for-expansion-of-macro.patch b/package/freeradius-server/freeradius-fix-error-for-expansion-of-macro.patch
new file mode 100644
index 0000000000..d9ff44d209
--- /dev/null
+++ b/package/freeradius-server/freeradius-fix-error-for-expansion-of-macro.patch
@@ -0,0 +1,62 @@
+From 5b6d8b14f2696fcf1dca119212f9d0a0fa04defd Mon Sep 17 00:00:00 2001
+From: Yi Zhao <yi.zhao@windriver.com>
+Date: Wed, 18 Jan 2017 14:59:39 +0800
+Subject: [PATCH] fix error for expansion of macro in thread.h
+
+The parameter declaration is missing in expansion of macro
+which cause the build error:
+| In file included from src/freeradius-devel/libradius.h:80:0,
+|                  from src/lib/log.c:26:
+| src/lib/log.c: In function '__fr_thread_local_destroy_fr_strerror_buffer':
+| src/lib/log.c:37:31: error: 'fr_strerror_buffer' undeclared (first use in this function)
+|  fr_thread_local_setup(char *, fr_strerror_buffer) /* macro */
+|                                ^
+
+Add the missing declaration in macro.
+
+Upstream-Status: Pending
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+---
+ src/include/threads.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/include/threads.h b/src/include/threads.h
+index e36d81d..2bcb6aa 100644
+--- a/src/include/threads.h
++++ b/src/include/threads.h
+@@ -89,7 +89,7 @@ static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
+ #  define fr_thread_local_get(_n) _n
+ #elif defined(HAVE_PTHREAD_H)
+ #  include <pthread.h>
+-#  define fr_thread_local_setup(_t, _n) \
++#  define fr_thread_local_setup(_t, _n) static __thread _t _n;\
+ static pthread_key_t __fr_thread_local_key_##_n;\
+ static pthread_once_t __fr_thread_local_once_##_n = PTHREAD_ONCE_INIT;\
+ static pthread_destructor_t __fr_thread_local_destructor_##_n = NULL;\
+@@ -100,17 +100,17 @@ static void __fr_thread_local_destroy_##_n(UNUSED void *unused)\
+ static void __fr_thread_local_key_init_##_n(void)\
+ {\
+ 	(void) pthread_key_create(&__fr_thread_local_key_##_n, __fr_thread_local_destroy_##_n);\
+-	(void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
+ }\
+ static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
+ {\
+ 	__fr_thread_local_destructor_##_n = func;\
+ 	if (_n) return _n; \
+ 	(void) pthread_once(&__fr_thread_local_once_##_n, __fr_thread_local_key_init_##_n);\
++	(void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
+ 	return _n;\
+ }
+-#  define fr_thread_local_init(_n, _f)			__fr_thread_local_init_##_n(_f)
+-#  define fr_thread_local_set(_n, _v)			__fr_thread_local_set_##_n(_v)
+-#  define fr_thread_local_get(_n)			__fr_thread_local_get_##_n()
++#  define fr_thread_local_init(_n, _f)	__fr_thread_local_init_##_n(_f)
++#  define fr_thread_local_set(_n, _v) ((int)!((_n = _v) || 1))
++#  define fr_thread_local_get(_n) _n
+ #endif
+ #endif
+-- 
+2.10.2
+
diff --git a/package/freeradius-server/freeradius-server.hash b/package/freeradius-server/freeradius-server.hash
new file mode 100644
index 0000000000..ba338d8b7f
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  2bf914d471d4409fd72e708e308fa32ca8d01d698c518497a1d4b867d50132ae  freeradius-server-3.0.21.tar.gz
+sha256  8b9cc1e5d41938be45a368f126a6d1fda03d60a3d622dc75e776be4e90c2d2c6  COPYRIGHT
diff --git a/package/freeradius-server/freeradius-server.mk b/package/freeradius-server/freeradius-server.mk
new file mode 100644
index 0000000000..9a0934126f
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.mk
@@ -0,0 +1,112 @@
+################################################################################
+#
+# freeradius-server
+#
+################################################################################
+
+FREERADIUS_SERVER_VERSION = 3.0.21
+FREERADIUS_SERVER_SITE = ftp://ftp.freeradius.org/pub/freeradius
+FREERADIUS_SERVER_LICENSE = GPL-2.0
+FREERADIUS_SERVER_LICENSE_FILES = COPYRIGHT
+FREERADIUS_SERVER_DEPENDENCIES = libtalloc
+
+# some compiler checks are not supported while cross compiling.
+# instead of removing those checks, we cache the answers
+FREERADIUS_SERVER_CONF_OPTS += \
+	ax_cv_cc_bounded_attribute=no \
+	ax_cv_cc_builtin_bswap64=no \
+	ax_cv_cc_builtin_choose_expr=no \
+	ax_cv_cc_builtin_types_compatible_p=no
+
+ifeq ($(BR2_PACKAGE_LIBCAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-libcap
+FREERADIUS_SERVER_DEPENDENCIES += libcap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-libcap
+endif
+
+ifeq ($(BR2_PACKAGE_LIBKRB5),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_krb5
+FREERADIUS_SERVER_DEPENDENCIES += libkrb5
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_krb5
+endif
+
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_pam
+FREERADIUS_SERVER_DEPENDENCIES += linux-pam
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_pam
+endif
+
+ifeq ($(BR2_PACKAGE_OPENLDAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_ldap
+FREERADIUS_SERVER_DEPENDENCIES += openldap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_ldap
+endif
+
+ifeq ($(BR2_PACKAGE_MYSQL),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_mysql
+FREERADIUS_SERVER_DEPENDENCIES += mysql
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_mysql
+endif
+
+ifeq ($(BR2_PACKAGE_SQLITE),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_sqlite
+FREERADIUS_SERVER_DEPENDENCIES += sqlite
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_sqlite
+endif
+
+ifeq ($(BR2_PACKAGE_UNIXODBC),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_unixodbc
+FREERADIUS_SERVER_DEPENDENCIES += unixodbc
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_unixodbc
+endif
+
+ifeq ($(BR2_PACKAGE_POSTGRESQL),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_postgresql
+FREERADIUS_SERVER_DEPENDENCIES += postgresql
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_postgresql
+endif
+
+ifeq ($(BR2_PACKAGE_HAS_OPENSSL),y)
+FREERADIUS_SERVER_DEPENDENCIES += openssl
+FREERADIUS_SERVER_CONF_OPTS += --with-openssl
+else
+FREERADIUS_CONF_OPTS += --without-openssl
+endif
+
+ifeq ($(BR2_PACKAGE_PCRE),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-pcre
+FREERADIUS_SERVER_DEPENDENCIES += pcre
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-pcre
+endif
+
+ifeq ($(BR2_PACKAGE_RUBY),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_ruby
+FREERADIUS_SERVER_DEPENDENCIES += ruby
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_ruby
+endif
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-systemd
+FREERADIUS_SERVER_DEPENDENCIES += systemd
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-systemd
+endif
+
+# TARGET_DIR is set to empty to avoid creation of symlinks in hardcoded host directories
+# freeradius Makefile does not support an alternate DESTDIR, instead it uses the magic $(R) variable
+FREERADIUS_SERVER_MAKE_ENV = R=$(TARGET_DIR) TARGET_DIR=""
+
+# use MAKE1 because make install does not support parallel build
+FREERADIUS_SERVER_MAKE = $(MAKE1)
+
+$(eval $(autotools-package))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v4] package/libtalloc: new package
  2020-10-15 20:06       ` [Buildroot] [PATCH v4] package/libtalloc: " David GOUARIN
  2020-10-15 20:06         ` [Buildroot] [PATCH v4] package/freeradius-server: " David GOUARIN
@ 2020-10-15 20:16         ` Thomas Petazzoni
  2020-10-16  6:25           ` david gouarin
  2020-10-19 20:00           ` [Buildroot] [PATCH v5 1/2] " David GOUARIN
  1 sibling, 2 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2020-10-15 20:16 UTC (permalink / raw)
  To: buildroot

Hello David,

Thanks for this new iteration!

On Thu, 15 Oct 2020 22:06:08 +0200
David GOUARIN <dgouarin@gmail.com> wrote:

> talloc is a hierarchical, reference counted memory pool system with destructors.
> It is the core memory allocator used in Samba.
> 
> Signed-off-by: David GOUARIN <dgouarin@thalesgroup.com>
> 
> Change v1 -> v2:
>   - merge with work from jared.bents at rockwellcollins.com, as sujested by Matthew Weber
>     http://patchwork.ozlabs.org/project/buildroot/patch/20200327150225.15277-1-jared.bents at rockwellcollins.com
> 
> Change v2 -> v4: (no v3, resubmitting the whole patch series)
>   - fix build with BR2_PARANOID_UNSAFE_PATH (Thomas review)
>   - add hashes of license files (Thomas)
>   - license is GPL-3.0+ for both talloc and pytalloc (Thomas)
>   - remove useless --prefix and --libdir (Thomas)

Your changelog should be below the --- sign...

> 
> ---

... here.


> +LIBTALLOC_VERSION = 2.3.1
> +LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
> +LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
> +LIBTALLOC_LICENSE = GPL-3.0+
> +LIBTALLOC_LICENSE_FILES = talloc.h pytalloc.h
> +LIBTALLOC_INSTALL_STAGING = YES
> +
> +LIBTALLOC_CONF_OPTS += --cross-compile \
> +		--cross-answers=$(@D)/cache.txt \
> +		--hostcc=gcc \
> +		--with-libiconv=$(HOST_DIR)/usr # waf will search by default in /usr/local with causes an error at configure step when BR2_COMPILER_PARANOID_UNSAFE_PATH is set

This is almost certainly not correct: HOST_DIR/usr contains libraries
compiled for the host... but you're building libtalloc for the target.

So unless libiconv is only used by libtalloc to build host binaries,
this looks wrong. If it's using the target libiconv, you should use
--with-libiconv=$(STAGING_DIR)/usr. However, keep in mind that libiconv
is not provided by all C libraries: with the uClibc C library built
without locale support, you would have to enable the
BR2_PACKAGE_LIBICONV option, and depend on libiconv. See for example
the package/acsccid package.

Other than this issue, the rest looks good.

However, please send libtalloc and freeradius-server as a series: the
latter depends on the former.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v4] package/libtalloc: new package
  2020-10-15 20:16         ` [Buildroot] [PATCH v4] package/libtalloc: " Thomas Petazzoni
@ 2020-10-16  6:25           ` david gouarin
  2020-10-16 10:03             ` Thomas Petazzoni
  2020-10-19 20:00           ` [Buildroot] [PATCH v5 1/2] " David GOUARIN
  1 sibling, 1 reply; 15+ messages in thread
From: david gouarin @ 2020-10-16  6:25 UTC (permalink / raw)
  To: buildroot

Thank you Thomas,
I agree, HOST_DIR is completely wrong here, I totally missed that, and I
admit I still have difficulties formatting my patches, mainly because I
have to work in an isolated network :)
I have however sent a new revision for both freeradius and libtalloc as a
series using git send-email as described in the documentation,  I don't
understand what is wrong ?


Le jeu. 15 oct. 2020 ? 22:16, Thomas Petazzoni <thomas.petazzoni@bootlin.com>
a ?crit :

> Hello David,
>
> Thanks for this new iteration!
>
> On Thu, 15 Oct 2020 22:06:08 +0200
> David GOUARIN <dgouarin@gmail.com> wrote:
>
> > talloc is a hierarchical, reference counted memory pool system with
> destructors.
> > It is the core memory allocator used in Samba.
> >
> > Signed-off-by: David GOUARIN <dgouarin@thalesgroup.com>
> >
> > Change v1 -> v2:
> >   - merge with work from jared.bents at rockwellcollins.com, as sujested
> by Matthew Weber
> >
> http://patchwork.ozlabs.org/project/buildroot/patch/20200327150225.15277-1-jared.bents at rockwellcollins.com
> >
> > Change v2 -> v4: (no v3, resubmitting the whole patch series)
> >   - fix build with BR2_PARANOID_UNSAFE_PATH (Thomas review)
> >   - add hashes of license files (Thomas)
> >   - license is GPL-3.0+ for both talloc and pytalloc (Thomas)
> >   - remove useless --prefix and --libdir (Thomas)
>
> Your changelog should be below the --- sign...
>
> >
> > ---
>
> ... here.
>
>
> > +LIBTALLOC_VERSION = 2.3.1
> > +LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
> > +LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
> > +LIBTALLOC_LICENSE = GPL-3.0+
> > +LIBTALLOC_LICENSE_FILES = talloc.h pytalloc.h
> > +LIBTALLOC_INSTALL_STAGING = YES
> > +
> > +LIBTALLOC_CONF_OPTS += --cross-compile \
> > +             --cross-answers=$(@D)/cache.txt \
> > +             --hostcc=gcc \
> > +             --with-libiconv=$(HOST_DIR)/usr # waf will search by
> default in /usr/local with causes an error at configure step when
> BR2_COMPILER_PARANOID_UNSAFE_PATH is set
>
> This is almost certainly not correct: HOST_DIR/usr contains libraries
> compiled for the host... but you're building libtalloc for the target.
>
> So unless libiconv is only used by libtalloc to build host binaries,
> this looks wrong. If it's using the target libiconv, you should use
> --with-libiconv=$(STAGING_DIR)/usr. However, keep in mind that libiconv
> is not provided by all C libraries: with the uClibc C library built
> without locale support, you would have to enable the
> BR2_PACKAGE_LIBICONV option, and depend on libiconv. See for example
> the package/acsccid package.
>
> Other than this issue, the rest looks good.
>
> However, please send libtalloc and freeradius-server as a series: the
> latter depends on the former.
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20201016/1897d4a0/attachment.html>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v4] package/libtalloc: new package
  2020-10-16  6:25           ` david gouarin
@ 2020-10-16 10:03             ` Thomas Petazzoni
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2020-10-16 10:03 UTC (permalink / raw)
  To: buildroot

Hello David,

On Fri, 16 Oct 2020 08:25:26 +0200
david gouarin <dgouarin@gmail.com> wrote:

> I agree, HOST_DIR is completely wrong here, I totally missed that, and I
> admit I still have difficulties formatting my patches, mainly because I
> have to work in an isolated network :)

Ah, indeed, that may be not the most efficient way of working :/

> I have however sent a new revision for both freeradius and libtalloc as a
> series using git send-email as described in the documentation,  I don't
> understand what is wrong ?

They are not numbered: you probably used "git format-patch -N", but you
shouldn't use the -N option in this case.

For patches sent to Buildroot, we want them numbered, so they clearly
appear as a series and we understand that they depend on each other.

For patches to Buildroot packages (i.e patches in package/foo/*.patch),
we want them *NOT* numbered, as otherwise the 2/3 or 5/6 numbering very
quickly gets out of date when adding/removing patches, and this
numbering is already sufficiently explicit by the name of the patches
(0001-something.patch, 0002-something-else.patch).

Perhaps this is what caused the confusion ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v5 1/2] package/libtalloc: new package
  2020-10-15 20:16         ` [Buildroot] [PATCH v4] package/libtalloc: " Thomas Petazzoni
  2020-10-16  6:25           ` david gouarin
@ 2020-10-19 20:00           ` David GOUARIN
  2020-10-19 20:00             ` [Buildroot] [PATCH v5 2/2] package/freeradius-server: " David GOUARIN
  1 sibling, 1 reply; 15+ messages in thread
From: David GOUARIN @ 2020-10-19 20:00 UTC (permalink / raw)
  To: buildroot

talloc is a hierarchical, reference counted memory pool system with destructors.
It is the core memory allocator used in Samba.

Signed-off-by: David GOUARIN <dgouarin@gmail.com>

---
Change v1 -> v2:
  - merge with work from jared.bents at rockwellcollins.com, as sujested by Matthew Weber
    http://patchwork.ozlabs.org/project/buildroot/patch/20200327150225.15277-1-jared.bents at rockwellcollins.com

Change v2 -> v4: (no v3, resubmitting the whole patch series)
  - fix build with BR2_PARANOID_UNSAFE_PATH (Thomas review)
  - add hashes of license files (Thomas)
  - license is GPL-3.0+ for both talloc and pytalloc (Thomas)
  - remove useless --prefix and --libdir (Thomas)

Change v4 -> v5:
  - search for iconv in STAGING_DIR instead of HOST_DIR

 DEVELOPERS                            |  1 +
 package/Config.in                     |  1 +
 package/libtalloc/Config.in           |  9 +++++
 package/libtalloc/libtalloc-cache.txt | 42 +++++++++++++++++++++
 package/libtalloc/libtalloc.hash      |  4 ++
 package/libtalloc/libtalloc.mk        | 53 +++++++++++++++++++++++++++
 6 files changed, 110 insertions(+)
 create mode 100644 package/libtalloc/Config.in
 create mode 100644 package/libtalloc/libtalloc-cache.txt
 create mode 100644 package/libtalloc/libtalloc.hash
 create mode 100644 package/libtalloc/libtalloc.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 79a9eaa563..c856d7ad45 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -712,6 +712,7 @@ F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
 F:	package/librelp/
+F:	package/libtalloc/
 
 N:	David Lechner <david@lechnology.com>
 F:	board/lego/ev3/
diff --git a/package/Config.in b/package/Config.in
index 09a332e3b9..a4d6fe02ae 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1894,6 +1894,7 @@ menu "Other"
 	source "package/libsigc/Config.in"
 	source "package/libsigsegv/Config.in"
 	source "package/libspatialindex/Config.in"
+	source "package/libtalloc/Config.in"
 	source "package/libtasn1/Config.in"
 	source "package/libtommath/Config.in"
 	source "package/libtpl/Config.in"
diff --git a/package/libtalloc/Config.in b/package/libtalloc/Config.in
new file mode 100644
index 0000000000..df972f2288
--- /dev/null
+++ b/package/libtalloc/Config.in
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBTALLOC
+	bool "libtalloc"
+	depends on BR2_USE_MMU
+	help
+	  talloc is a hierarchical, reference counted memory pool system with
+	  destructors. It is the core memory allocator used in Samba.
+
+	  https://talloc.samba.org/talloc/doc/html/index.html
+
diff --git a/package/libtalloc/libtalloc-cache.txt b/package/libtalloc/libtalloc-cache.txt
new file mode 100644
index 0000000000..a2b44857da
--- /dev/null
+++ b/package/libtalloc/libtalloc-cache.txt
@@ -0,0 +1,42 @@
+Checking simple C program: OK
+rpath library support: OK
+-Wl,--version-script support: OK
+Checking getconf LFS_CFLAGS: NO
+Checking for large file support without additional flags: OK
+Checking for -D_LARGE_FILES: OK
+Checking correct behavior of strtoll: NO
+Checking for working strptime: OK
+Checking for C99 vsnprintf: OK
+Checking for HAVE_SHARED_MMAP: OK
+Checking for HAVE_MREMAP: OK
+Checking for HAVE_INCOHERENT_MMAP: NO
+Checking for HAVE_SECURE_MKSTEMP: OK
+Checking for HAVE_IFACE_GETIFADDRS: OK
+Checking for kernel change notify support: OK
+Checking for Linux kernel oplocks: OK
+Checking for kernel share modes: OK
+Checking if can we convert from CP850 to UCS-2LE: OK
+Checking if can we convert from UTF-8 to UCS-2LE: OK
+Checking whether we can use Linux thread-specific credentials with 32-bit system calls: OK
+Checking whether we can use Linux thread-specific credentials: OK
+Checking whether setreuid is available: OK
+Checking whether setresuid is available: OK
+Checking whether seteuid is available: OK
+Checking whether fcntl locking is available: OK
+Checking whether fcntl lock supports open file description locks: OK
+Checking for the maximum value of the 'time_t' type: OK
+Checking whether the realpath function allows a NULL argument: OK
+Checking whether POSIX capabilities are available: OK
+Checking for ftruncate extend: OK
+vfs_fileid checking for statfs() and struct statfs.f_fsid: OK
+getcwd takes a NULL argument: OK
+Checking uname sysname type: "Linux"
+Checking uname release type: "5.4.0"
+Checking uname version type: "#1 Tue Oct 1 00:00:00 UTC 2020"
+Checking value of NSIG: "65"
+Checking value of _NSIG: "65"
+Checking value of SIGRTMAX: "64"
+Checking value of SIGRTMIN: "34"
+Checking errno of iconv for illegal multibyte sequence: "0"
+checking for clnt_create(): OK
+Checking for a 64-bit host to support lmdb: NO
diff --git a/package/libtalloc/libtalloc.hash b/package/libtalloc/libtalloc.hash
new file mode 100644
index 0000000000..9d48a965d0
--- /dev/null
+++ b/package/libtalloc/libtalloc.hash
@@ -0,0 +1,4 @@
+# Locally calculated
+sha256  ef4822d2fdafd2be8e0cabc3ec3c806ae29b8268e932c5e9a4cd5585f37f9f77  talloc-2.3.1.tar.gz
+sha256  15c2767545d1e43dc35832736253bde5be956f8ffec0474a6d0f70349b646ed3  talloc.h
+sha256  8742f2dad3aaf885c7b4b699c20bfa0e9edeab380689f91a88aa90af03e6947b  pytalloc.h
diff --git a/package/libtalloc/libtalloc.mk b/package/libtalloc/libtalloc.mk
new file mode 100644
index 0000000000..57c876de6e
--- /dev/null
+++ b/package/libtalloc/libtalloc.mk
@@ -0,0 +1,53 @@
+################################################################################
+#
+# libtalloc
+#
+################################################################################
+
+LIBTALLOC_VERSION = 2.3.1
+LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
+LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
+LIBTALLOC_LICENSE = GPL-3.0+
+LIBTALLOC_LICENSE_FILES = talloc.h pytalloc.h
+LIBTALLOC_INSTALL_STAGING = YES
+
+LIBTALLOC_CONF_OPTS += --cross-compile \
+		--cross-answers=$(@D)/cache.txt \
+		--hostcc=gcc \
+		--with-libiconv=$(STAGING_DIR)/usr # (see below)
+
+#?--with-libiconv=
+# waf will search for libiconv by default in /usr/local. Because of a bug in some waf
+#?python script, /usr/local is then used in many subsequent and unrelated checks, which
+#?ultimately causes a failure when BR2_COMPILER_PARANOID_UNSAFE_PATH is set.
+# However no need to set libiconv as a dependency of libtalloc since it's optional.
+
+ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
+LIBTALLOC_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
+LIBTALLOC_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
+LIBTALLOC_DEPENDENCIES += libtirpc host-pkgconf
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+LIBTALLOC_PYTHON = \
+	PYTHON="$(HOST_DIR)/bin/python3" \
+	PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
+LIBTALLOC_DEPENDENCIES += host-python3 python3
+LIBTALLOC_CONF_ENV += \
+	$(LIBTALLOC_PYTHON)
+# There is not a --enable-python configuration option
+else
+LIBTALLOC_CONF_OPTS += --disable-python
+endif
+
+LIBTALLOC_WAF = ./buildtools/bin/waf
+
+define LIBTALLOC_POPULATE_WAF_CACHE
+	$(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt
+	echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt
+endef
+
+LIBTALLOC_PRE_CONFIGURE_HOOKS += LIBTALLOC_POPULATE_WAF_CACHE
+
+$(eval $(waf-package))
+
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Buildroot] [PATCH v5 2/2] package/freeradius-server: new package
  2020-10-19 20:00           ` [Buildroot] [PATCH v5 1/2] " David GOUARIN
@ 2020-10-19 20:00             ` David GOUARIN
  0 siblings, 0 replies; 15+ messages in thread
From: David GOUARIN @ 2020-10-19 20:00 UTC (permalink / raw)
  To: buildroot

FreeRADIUS is an open source server which implements
a protocol for remote user Authorization, Authentication
and Accounting.

Signed-off-by: David GOUARIN <dgouarin@gmail.com>

---
Changes v1 -> v2:
  fix invalid characters in Config.in

Changes v2 -> v3:
  As suggested by Matt, merge with pending upstream patch. Included most of it,
  including patches based on Yocto work :
  http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
  Didn't kept all the --without directive, as they do not seem useful, nor
  the custom INSTALL_TARGET_CMDS.

Changes v3 -> v4:
  Taken in account Thomas review
  - fix build with BR2_COMPILER_PARANOID_UNSAFE_PATH
  - import patches inside package directory instead of downloading them
  - remove config.cache file, pass the answers on the command line instead
  - add comments for weird TARGET_DIR and R directives
  - remove broken python optional feature. Managed to get it to build
with python 2.7, not 3.0 and it still fails basic testing

Changes v4 -> v5:
  - better package patches formatting

 DEVELOPERS                                    |   1 +
 package/Config.in                             |   1 +
 .../0001-host-jlibtool.patch                  |  17 ++
 ...freeradius-avoid-searching-host-dirs.patch | 200 ++++++++++++++++++
 ...s-configure.ac-add-option-for-libcap.patch |  73 +++++++
 ...configure.ac-allow-cross-compilation.patch |  40 ++++
 ...ius-fix-error-for-expansion-of-macro.patch |  64 ++++++
 package/freeradius-server/Config.in           |  18 ++
 .../freeradius-server/freeradius-server.hash  |   3 +
 .../freeradius-server/freeradius-server.mk    | 112 ++++++++++
 10 files changed, 529 insertions(+)
 create mode 100644 package/freeradius-server/0001-host-jlibtool.patch
 create mode 100644 package/freeradius-server/0002-freeradius-avoid-searching-host-dirs.patch
 create mode 100644 package/freeradius-server/0003-freeradius-configure.ac-add-option-for-libcap.patch
 create mode 100644 package/freeradius-server/0004-freeradius-configure.ac-allow-cross-compilation.patch
 create mode 100644 package/freeradius-server/0005-freeradius-fix-error-for-expansion-of-macro.patch
 create mode 100644 package/freeradius-server/Config.in
 create mode 100644 package/freeradius-server/freeradius-server.hash
 create mode 100644 package/freeradius-server/freeradius-server.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index c856d7ad45..ae688a85c4 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -711,6 +711,7 @@ N:	David du Colombier <0intro@gmail.com>
 F:	package/x264/
 
 N:	David GOUARIN <dgouarin@gmail.com>
+F:	package/freeradius-server/
 F:	package/librelp/
 F:	package/libtalloc/
 
diff --git a/package/Config.in b/package/Config.in
index a4d6fe02ae..8e3ce4fe20 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2079,6 +2079,7 @@ menu "Networking applications"
 	source "package/flannel/Config.in"
 	source "package/fmc/Config.in"
 	source "package/fping/Config.in"
+	source "package/freeradius-server/Config.in"
 	source "package/freeswitch/Config.in"
 	source "package/freeswitch-mod-bcg729/Config.in"
 	source "package/frr/Config.in"
diff --git a/package/freeradius-server/0001-host-jlibtool.patch b/package/freeradius-server/0001-host-jlibtool.patch
new file mode 100644
index 0000000000..5c0696ea1b
--- /dev/null
+++ b/package/freeradius-server/0001-host-jlibtool.patch
@@ -0,0 +1,17 @@
+jlibtool.c: while cross compiling, use host CC instead of target CC to build jlibtool
+
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+
+--- a/scripts/libtool.mk 2018-10-08 09:22:59.032031858 -0600
++++ b/scripts/libtool.mk 2018-10-08 15:04:18.406661484 -0600
+@@ -43,8 +43,8 @@ ifeq "${LIBTOOL}" "JLIBTOOL"
+    # binary!
+	${JLIBTOOL}: ${top_makedir}/jlibtool.c
+	$(Q)mkdir -p $(dir $@)
+-	$(Q)echo CC jlibtool.c
+-	$(Q)${CC} $< -o $@
++	$(Q)echo HOSTCC jlibtool.c
++	$(Q)${HOSTCC} $< -o $@
+
+    clean: jlibtool_clean
+
diff --git a/package/freeradius-server/0002-freeradius-avoid-searching-host-dirs.patch b/package/freeradius-server/0002-freeradius-avoid-searching-host-dirs.patch
new file mode 100644
index 0000000000..12ced568a2
--- /dev/null
+++ b/package/freeradius-server/0002-freeradius-avoid-searching-host-dirs.patch
@@ -0,0 +1,200 @@
+From dc41591d5ceb18900ec85894f8f7b7bb44bb3bd9 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Mon, 4 Jan 2016 01:44:04 -0500
+Subject: [PATCH] avoid searching host dirs
+
+Don't search the hardcoded host dirs to avoid
+host contamination.
+
+Upstream-Status: Inappropriate [cross-compile specific]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+Fetch from: http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+---
+ acinclude.m4                                                | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac        | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac   | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac      | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac      | 6 +++---
+ src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac     | 2 +-
+ src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac | 4 ++--
+ src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac   | 4 ++--
+ 8 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index da48acc..b513ae1 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -178,7 +178,7 @@ if test "x$smart_lib" = "x"; then
+   FR_LOCATE_DIR(smart_lib_dir,[lib$1${libltdl_cv_shlibext}])
+   FR_LOCATE_DIR(smart_lib_dir,[lib$1.a])
+ 
+-  for try in $smart_lib_dir /usr/local/lib /opt/lib; do
++  for try in $smart_lib_dir; do
+     AC_MSG_CHECKING([for $2 in -l$1 in $try])
+     LIBS="-l$1 $old_LIBS"
+     CPPFLAGS="-L$try -Wl,-rpath,$try $old_CPPFLAGS"
+@@ -218,7 +218,7 @@ ac_safe=`echo "$1" | sed 'y%./+-%__pm%'`
+ old_CPPFLAGS="$CPPFLAGS"
+ smart_include=
+ dnl #  The default directories we search in (in addition to the compilers search path)
+-smart_include_dir="/usr/local/include /opt/include"
++smart_include_dir=
+ 
+ dnl #  Our local versions
+ _smart_try_dir=
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
+index 75c851a..a262d71 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_db2/configure.ac
+@@ -57,14 +57,14 @@ if test x$with_[]modname != xno; then
+ 		esac])
+ 
+ 	dnl Check for SQLConnect in -ldb2
+-	smart_try_dir="$ibmdb2_lib_dir /usr/local/db2/lib /usr/IBMdb2/V7.1/lib"
++	smart_try_dir="$ibmdb2_lib_dir"
+ 	FR_SMART_CHECK_LIB(db2, SQLConnect)
+ 	if test "x$ac_cv_lib_db2_SQLConnect" != xyes; then
+ 		fail="$fail libdb2"
+ 	fi
+ 
+ 	dnl Check for sqlcli.h
+-	smart_try_dir="$ibmdb2_include_dir /usr/local/db2/include /usr/IBMdb2/V7.1/include"
++	smart_try_dir="$ibmdb2_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(sqlcli.h)
+ 	if test "x$ac_cv_header_sqlcli_h" != xyes; then
+ 		fail="$fail sqlcli.h"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
+index 4da57b3..752b043 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.ac
+@@ -56,14 +56,14 @@ if test x$with_[]modname != xno; then
+ 		esac])
+ 
+ 	dnl Check for isc_attach_database in -lfbclient
+-	smart_try_dir="$firebird_lib_dir /usr/lib/firebird2/lib /usr/local/firebird/lib"
++	smart_try_dir="$firebird_lib_dir"
+ 	FR_SMART_CHECK_LIB(fbclient, isc_attach_database)
+ 	if test "x$ac_cv_lib_fbclient_isc_attach_database" != xyes; then
+ 		fail="$fail libfbclient"
+ 	fi
+ 
+ 	dnl Check for ibase.h
+-	smart_try_dir="$firebird_include_dir /usr/lib/firebird2/include /usr/local/firebird/include"
++	smart_try_dir="$firebird_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(ibase.h)
+ 	if test "x$ac_cv_header_ibase_h" != xyes; then
+ 		fail="$fail ibase.h"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
+index ba6304f..3393557 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.ac
+@@ -57,14 +57,14 @@ if test x$with_[]modname != xno; then
+ 		esac])
+ 
+ 	dnl Check for SQLConnect in -liodbc
+-	smart_try_dir="$iodbc_lib_dir /usr/lib /usr/lib/iodbc /usr/local/lib/iodbc /usr/local/iodbc/lib/iodbc"
++	smart_try_dir="$iodbc_lib_dir"
+ 	FR_SMART_CHECK_LIB(iodbc, SQLConnect)
+ 	if test "x$ac_cv_lib_iodbc_SQLConnect" != xyes; then
+ 		fail="$fail libiodbc"
+ 	fi
+ 
+ 	dnl Check for isql.h
+-	smart_try_dir="$iodbc_include_dir /usr/include /usr/include/iodbc /usr/local/iodbc/include"
++	smart_try_dir="$iodbc_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(isql.h)
+ 	if test "x$ac_cv_header_isql_h" != xyes; then
+ 		fail="$fail isql.h"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
+index 1401677..2e7db44 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_mysql/configure.ac
+@@ -136,7 +136,7 @@ if test x$with_[]modname != xno; then
+ 
+ 	dnl # Check for libmysqlclient_r
+ 	if test "x$have_a_libmysqlclient" != "xyes"; then
+-	    smart_try_dir="$mysql_lib_dir /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/mysql/lib/mysql"
++	    smart_try_dir="$mysql_lib_dir"
+ 	    FR_SMART_CHECK_LIB(mysqlclient_r, mysql_init)
+ 	    if test "x$ac_cv_lib_mysqlclient_r_mysql_init" = "xyes"; then
+ 			have_a_libmysqlclient='yes'
+@@ -145,7 +145,7 @@ if test x$with_[]modname != xno; then
+ 
+ 	dnl # Check for libmysqlclient
+ 	if test "x$have_a_libmysqlclient" != "xyes"; then
+-	    smart_try_dir="$mysql_lib_dir /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/mysql/lib/mysql"
++	    smart_try_dir="$mysql_lib_dir"
+ 	    FR_SMART_CHECK_LIB(mysqlclient, mysql_init)
+ 	    if test "x$ac_cv_lib_mysqlclient_mysql_init" = "xyes"; then
+ 			have_a_libmysqlclient='yes'
+@@ -189,7 +189,7 @@ if test x$with_[]modname != xno; then
+     fi
+ 
+     if test "x$have_mysql_h" != "xyes"; then
+-		smart_try_dir="$mysql_include_dir /usr/local/include /usr/local/mysql/include"
++		smart_try_dir="$mysql_include_dir"
+ 		FR_SMART_CHECK_INCLUDE(mysql/mysql.h)
+ 		if test "x$ac_cv_header_mysql_mysql_h" = "xyes"; then
+ 	    	AC_DEFINE(HAVE_MYSQL_MYSQL_H, [], [Define if you have <mysql/mysql.h>])
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
+index 3178462..5cbc8c2 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_oracle/configure.ac
+@@ -63,7 +63,7 @@ if test x$with_[]modname != xno; then
+     dnl # Check for header files
+     dnl ############################################################
+ 
+-    smart_try_dir="$oracle_include_dir /usr/local/instaclient/include"
++    smart_try_dir="$oracle_include_dir"
+ 
+     if test "x$ORACLE_HOME" != "x"; then
+ 	smart_try_dir="${smart_try_dir} ${ORACLE_HOME}/include"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
+index 4f9a890..e1cf811 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
+@@ -41,7 +41,7 @@ if test x$with_[]modname != xno; then
+ 	  esac ]
+ 	)
+ 
+-	smart_try_dir="$rlm_sql_postgresql_include_dir /usr/include/postgresql /usr/local/pgsql/include /usr/include/pgsql"
++	smart_try_dir="$rlm_sql_postgresql_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(libpq-fe.h)
+ 	if test "x$ac_cv_header_libpqmfe_h" != "xyes"; then
+ 		fail="$fail libpq-fe.h"
+@@ -76,7 +76,7 @@ if test x$with_[]modname != xno; then
+ 		  ])
+ 	fi
+ 
+-	smart_try_dir="$rlm_sql_postgresql_lib_dir /usr/lib /usr/local/pgsql/lib"
++	smart_try_dir="$rlm_sql_postgresql_lib_dir"
+ 	FR_SMART_CHECK_LIB(pq, PQconnectdb)
+ 	if test "x$ac_cv_lib_pq_PQconnectdb" != "xyes"; then
+ 		fail="$fail libpq"
+diff --git a/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac b/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
+index 3545387..c543ed4 100644
+--- a/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
++++ b/src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.ac
+@@ -57,14 +57,14 @@ if test x$with_[]modname != xno; then
+ 		esac])
+ 
+ 	dnl Check for SQLConnect in -lodbc
+-	smart_try_dir="$unixodbc_lib_dir /usr/local/unixodbc/lib"
++	smart_try_dir="$unixodbc_lib_dir"
+ 	FR_SMART_CHECK_LIB(odbc, SQLConnect)
+ 	if test "x$ac_cv_lib_odbc_SQLConnect" != xyes; then
+ 		fail="$fail libodbc"
+ 	fi
+ 
+ 	dnl Check for sql.h
+-	smart_try_dir="$unixodbc_include_dir /usr/local/unixodbc/include"
++	smart_try_dir="$unixodbc_include_dir"
+ 	FR_SMART_CHECK_INCLUDE(sql.h)
+ 	if test "x$ac_cv_header_sql_h" != xyes; then
+ 		fail="$fail sql.h"
+-- 
+1.9.1
+
diff --git a/package/freeradius-server/0003-freeradius-configure.ac-add-option-for-libcap.patch b/package/freeradius-server/0003-freeradius-configure.ac-add-option-for-libcap.patch
new file mode 100644
index 0000000000..622d11b221
--- /dev/null
+++ b/package/freeradius-server/0003-freeradius-configure.ac-add-option-for-libcap.patch
@@ -0,0 +1,73 @@
+From 98a9eff357959d1113e33a615c2178751d5b2054 Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Thu, 22 Aug 2019 10:50:21 +0800
+Subject: [PATCH 2/2] configure.ac: add option for libcap
+
+Upstream-Status: Pending
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+
+Fetch from: http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+---
+ configure.ac | 36 +++++++++++++++++++++++++++---------
+ 1 file changed, 27 insertions(+), 9 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 65db61e..6486aac 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -977,6 +977,22 @@ fi
+ dnl Set by FR_SMART_CHECKLIB
+ LIBS="${old_LIBS}"
+ 
++dnl #
++dnl #  extra argument: --with-libcap
++dnl #
++WITH_LIBCAP=yes
++AC_ARG_WITH(libcap,
++[  --with-licap          use licap for debugger checks. (default=yes)],
++[ case "$withval" in
++  no)
++    WITH_LIBCAP=no
++    ;;
++  *)
++    WITH_LIBCAP=yes
++    ;;
++  esac ]
++)
++
+ dnl Check for cap
+ dnl extra argument: --with-cap-lib-dir=DIR
+ cap_lib_dir=
+@@ -1010,15 +1026,17 @@ AC_ARG_WITH(cap-include-dir,
+       ;;
+   esac])
+ 
+-smart_try_dir="$cap_lib_dir"
+-FR_SMART_CHECK_LIB(cap, cap_get_proc)
+-if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
+-  AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
+-else
+-  AC_DEFINE(HAVE_LIBCAP, 1,
+-    [Define to 1 if you have the `cap' library (-lcap).]
+-  )
+-  HAVE_LIBCAP=1
++if test "x$WITH_LIBCAP" = xyes; then
++  smart_try_dir="$cap_lib_dir"
++  FR_SMART_CHECK_LIB(cap, cap_get_proc)
++  if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
++    AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
++  else
++    AC_DEFINE(HAVE_LIBCAP, 1,
++      [Define to 1 if you have the `cap' library (-lcap).]
++    )
++    HAVE_LIBCAP=1
++  fi
+ fi
+ 
+ dnl #
+-- 
+2.7.4
+
diff --git a/package/freeradius-server/0004-freeradius-configure.ac-allow-cross-compilation.patch b/package/freeradius-server/0004-freeradius-configure.ac-allow-cross-compilation.patch
new file mode 100644
index 0000000000..16baf5af1a
--- /dev/null
+++ b/package/freeradius-server/0004-freeradius-configure.ac-allow-cross-compilation.patch
@@ -0,0 +1,40 @@
+From 0780b7053fb0d33d721aa70ab2ecd75299e5ba31 Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Tue, 24 Jul 2018 15:03:39 +0800
+Subject: [PATCH] configure.ac: allow cross-compilation
+
+The checking OpenSSL library and header version consistency will
+always fail in cross compiling, skip the check and give a warning
+instead for cross compiling.
+
+Upstream-Status: Inappropriate[embedded specific]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+
+update to new version 3.0.17 to fix patch warning
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+
+Fetch from: http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+---
+ src/modules/rlm_krb5/configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/modules/rlm_krb5/configure.ac b/src/modules/rlm_krb5/configure.ac
+index efc9f29..98a97e4 100644
+--- a/src/modules/rlm_krb5/configure.ac
++++ b/src/modules/rlm_krb5/configure.ac
+@@ -137,7 +137,8 @@ if test x$with_[]modname != xno; then
+ 		FR_SMART_CHECK_LIB(krb5, krb5_is_thread_safe)
+ 		if test "x$ac_cv_lib_krb5_krb5_is_thread_safe" = xyes; then
+ 			AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[return krb5_is_thread_safe() ? 0 : 1]])],
+-				[krb5threadsafe="-DKRB5_IS_THREAD_SAFE"], [AC_MSG_WARN([[libkrb5 is not threadsafe]])])
++				[krb5threadsafe="-DKRB5_IS_THREAD_SAFE"], [AC_MSG_WARN([[libkrb5 is not threadsafe]])],
++				[AC_MSG_WARN(cross compiling: not checking)])
+ 		fi
+ 	else
+ 		krb5threadsafe=""
+-- 
+2.7.4
+
diff --git a/package/freeradius-server/0005-freeradius-fix-error-for-expansion-of-macro.patch b/package/freeradius-server/0005-freeradius-fix-error-for-expansion-of-macro.patch
new file mode 100644
index 0000000000..4355653282
--- /dev/null
+++ b/package/freeradius-server/0005-freeradius-fix-error-for-expansion-of-macro.patch
@@ -0,0 +1,64 @@
+From 5b6d8b14f2696fcf1dca119212f9d0a0fa04defd Mon Sep 17 00:00:00 2001
+From: Yi Zhao <yi.zhao@windriver.com>
+Date: Wed, 18 Jan 2017 14:59:39 +0800
+Subject: [PATCH] fix error for expansion of macro in thread.h
+
+The parameter declaration is missing in expansion of macro
+which cause the build error:
+| In file included from src/freeradius-devel/libradius.h:80:0,
+|                  from src/lib/log.c:26:
+| src/lib/log.c: In function '__fr_thread_local_destroy_fr_strerror_buffer':
+| src/lib/log.c:37:31: error: 'fr_strerror_buffer' undeclared (first use in this function)
+|  fr_thread_local_setup(char *, fr_strerror_buffer) /* macro */
+|                                ^
+
+Add the missing declaration in macro.
+
+Upstream-Status: Pending
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+
+Fetch from: http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
+Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
+---
+ src/include/threads.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/include/threads.h b/src/include/threads.h
+index e36d81d..2bcb6aa 100644
+--- a/src/include/threads.h
++++ b/src/include/threads.h
+@@ -89,7 +89,7 @@ static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
+ #  define fr_thread_local_get(_n) _n
+ #elif defined(HAVE_PTHREAD_H)
+ #  include <pthread.h>
+-#  define fr_thread_local_setup(_t, _n) \
++#  define fr_thread_local_setup(_t, _n) static __thread _t _n;\
+ static pthread_key_t __fr_thread_local_key_##_n;\
+ static pthread_once_t __fr_thread_local_once_##_n = PTHREAD_ONCE_INIT;\
+ static pthread_destructor_t __fr_thread_local_destructor_##_n = NULL;\
+@@ -100,17 +100,17 @@ static void __fr_thread_local_destroy_##_n(UNUSED void *unused)\
+ static void __fr_thread_local_key_init_##_n(void)\
+ {\
+ 	(void) pthread_key_create(&__fr_thread_local_key_##_n, __fr_thread_local_destroy_##_n);\
+-	(void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
+ }\
+ static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
+ {\
+ 	__fr_thread_local_destructor_##_n = func;\
+ 	if (_n) return _n; \
+ 	(void) pthread_once(&__fr_thread_local_once_##_n, __fr_thread_local_key_init_##_n);\
++	(void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
+ 	return _n;\
+ }
+-#  define fr_thread_local_init(_n, _f)			__fr_thread_local_init_##_n(_f)
+-#  define fr_thread_local_set(_n, _v)			__fr_thread_local_set_##_n(_v)
+-#  define fr_thread_local_get(_n)			__fr_thread_local_get_##_n()
++#  define fr_thread_local_init(_n, _f)	__fr_thread_local_init_##_n(_f)
++#  define fr_thread_local_set(_n, _v) ((int)!((_n = _v) || 1))
++#  define fr_thread_local_get(_n) _n
+ #endif
+ #endif
+-- 
+2.10.2
+
diff --git a/package/freeradius-server/Config.in b/package/freeradius-server/Config.in
new file mode 100644
index 0000000000..fad8bfeb80
--- /dev/null
+++ b/package/freeradius-server/Config.in
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_FREERADIUS_SERVER
+	bool "freeradius-server"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	select BR2_PACKAGE_LIBTALLOC
+	help
+	  FreeRADIUS is an open source server which implements
+	  a protocol for remote user Authorization, Authentication
+	  and Accounting.
+
+	  http://wiki.freeradius.org/
+
+comment "freeradius-server needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
+
+comment "freeradius-server needs a glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC
+
diff --git a/package/freeradius-server/freeradius-server.hash b/package/freeradius-server/freeradius-server.hash
new file mode 100644
index 0000000000..ba338d8b7f
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  2bf914d471d4409fd72e708e308fa32ca8d01d698c518497a1d4b867d50132ae  freeradius-server-3.0.21.tar.gz
+sha256  8b9cc1e5d41938be45a368f126a6d1fda03d60a3d622dc75e776be4e90c2d2c6  COPYRIGHT
diff --git a/package/freeradius-server/freeradius-server.mk b/package/freeradius-server/freeradius-server.mk
new file mode 100644
index 0000000000..9a0934126f
--- /dev/null
+++ b/package/freeradius-server/freeradius-server.mk
@@ -0,0 +1,112 @@
+################################################################################
+#
+# freeradius-server
+#
+################################################################################
+
+FREERADIUS_SERVER_VERSION = 3.0.21
+FREERADIUS_SERVER_SITE = ftp://ftp.freeradius.org/pub/freeradius
+FREERADIUS_SERVER_LICENSE = GPL-2.0
+FREERADIUS_SERVER_LICENSE_FILES = COPYRIGHT
+FREERADIUS_SERVER_DEPENDENCIES = libtalloc
+
+# some compiler checks are not supported while cross compiling.
+# instead of removing those checks, we cache the answers
+FREERADIUS_SERVER_CONF_OPTS += \
+	ax_cv_cc_bounded_attribute=no \
+	ax_cv_cc_builtin_bswap64=no \
+	ax_cv_cc_builtin_choose_expr=no \
+	ax_cv_cc_builtin_types_compatible_p=no
+
+ifeq ($(BR2_PACKAGE_LIBCAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-libcap
+FREERADIUS_SERVER_DEPENDENCIES += libcap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-libcap
+endif
+
+ifeq ($(BR2_PACKAGE_LIBKRB5),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_krb5
+FREERADIUS_SERVER_DEPENDENCIES += libkrb5
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_krb5
+endif
+
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_pam
+FREERADIUS_SERVER_DEPENDENCIES += linux-pam
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_pam
+endif
+
+ifeq ($(BR2_PACKAGE_OPENLDAP),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_ldap
+FREERADIUS_SERVER_DEPENDENCIES += openldap
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_ldap
+endif
+
+ifeq ($(BR2_PACKAGE_MYSQL),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_mysql
+FREERADIUS_SERVER_DEPENDENCIES += mysql
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_mysql
+endif
+
+ifeq ($(BR2_PACKAGE_SQLITE),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_sqlite
+FREERADIUS_SERVER_DEPENDENCIES += sqlite
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_sqlite
+endif
+
+ifeq ($(BR2_PACKAGE_UNIXODBC),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_unixodbc
+FREERADIUS_SERVER_DEPENDENCIES += unixodbc
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_unixodbc
+endif
+
+ifeq ($(BR2_PACKAGE_POSTGRESQL),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_sql_postgresql
+FREERADIUS_SERVER_DEPENDENCIES += postgresql
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_sql_postgresql
+endif
+
+ifeq ($(BR2_PACKAGE_HAS_OPENSSL),y)
+FREERADIUS_SERVER_DEPENDENCIES += openssl
+FREERADIUS_SERVER_CONF_OPTS += --with-openssl
+else
+FREERADIUS_CONF_OPTS += --without-openssl
+endif
+
+ifeq ($(BR2_PACKAGE_PCRE),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-pcre
+FREERADIUS_SERVER_DEPENDENCIES += pcre
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-pcre
+endif
+
+ifeq ($(BR2_PACKAGE_RUBY),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-rlm_ruby
+FREERADIUS_SERVER_DEPENDENCIES += ruby
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-rlm_ruby
+endif
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+FREERADIUS_SERVER_CONF_OPTS += --with-systemd
+FREERADIUS_SERVER_DEPENDENCIES += systemd
+else
+FREERADIUS_SERVER_CONF_OPTS += --without-systemd
+endif
+
+# TARGET_DIR is set to empty to avoid creation of symlinks in hardcoded host directories
+# freeradius Makefile does not support an alternate DESTDIR, instead it uses the magic $(R) variable
+FREERADIUS_SERVER_MAKE_ENV = R=$(TARGET_DIR) TARGET_DIR=""
+
+# use MAKE1 because make install does not support parallel build
+FREERADIUS_SERVER_MAKE = $(MAKE1)
+
+$(eval $(autotools-package))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-10-19 20:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 14:37 [Buildroot] [PATCH 1/2] package/libtalloc: new package David GOUARIN
2020-10-13 14:37 ` [Buildroot] [PATCH 2/2] package/freeradius-server: " David GOUARIN
2020-10-13 19:51   ` [Buildroot] [PATCH v2 3/3] " David GOUARIN
2020-10-14 17:02     ` [Buildroot] [PATCH v3] " David GOUARIN
2020-10-14 19:26       ` Thomas Petazzoni
2020-10-15 20:06       ` [Buildroot] [PATCH v4] package/libtalloc: " David GOUARIN
2020-10-15 20:06         ` [Buildroot] [PATCH v4] package/freeradius-server: " David GOUARIN
2020-10-15 20:16         ` [Buildroot] [PATCH v4] package/libtalloc: " Thomas Petazzoni
2020-10-16  6:25           ` david gouarin
2020-10-16 10:03             ` Thomas Petazzoni
2020-10-19 20:00           ` [Buildroot] [PATCH v5 1/2] " David GOUARIN
2020-10-19 20:00             ` [Buildroot] [PATCH v5 2/2] package/freeradius-server: " David GOUARIN
2020-10-13 14:50 ` [Buildroot] [PATCH 1/2] package/libtalloc: " Matthew Weber
2020-10-13 19:50 ` [Buildroot] [PATCH v2 2/3] " David GOUARIN
2020-10-14 19:18   ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.