diff --git a/package/Config.in b/package/Config.in index d377d33a..120d48f8 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1,4 +1,5 @@ source "$BR2_EXTERNAL_INFIX_PATH/package/cligen/Config.in" +source "$BR2_EXTERNAL_INFIX_PATH/package/clixon/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/factory/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/finit/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/package/ifupdown2/Config.in" diff --git a/package/clixon/Config.in b/package/clixon/Config.in new file mode 100644 index 00000000..d115a614 --- /dev/null +++ b/package/clixon/Config.in @@ -0,0 +1,82 @@ +config BR2_PACKAGE_CLIXON + bool "clixon" + depends on BR2_USE_MMU + select BR2_PACKAGE_CLIGEN +# select BR2_PACKAGE_LIBCURL +# select BR2_PACKAGE_LIBXML2 + help + Clixon is a YANG-based configuration manager, with interactive + CLI, NETCONF and RESTCONF interfaces, an embedded database and + transaction mechanism. + + Clixon has support for RESTCONF over HTTP/2 using NGHTTP2 as + well as support for FCGI using NGINX (HTTP/1), or the native + support for HTTP/1. + + If Net-SNMP is enabled, it is possible to also enable the Clixon + YANG mapping to SNMP. + + NOTE: Clixon by itself does not do anything, you need to build an + application it can run. See the example for more info. + + https://github.com/clicon/clixon + +if BR2_PACKAGE_CLIXON + +config BR2_PACKAGE_CLIXON_EXAMPLE + bool "example" + help + Install Clixon YANG + CLI example application. + +choice + prompt "restconf" + default BR2_PACKAGE_CLIXON_RESTCONF_NATIVE + +config BR2_PACKAGE_CLIXON_RESTCONF_NATIVE + bool "native" + help + Native RESTCONF frontend supports HTTP/1 by default, for + HTTP/2 it relies on the nghttp2 library. + +config BR2_PACKAGE_CLIXON_RESTCONF_FCGI + bool "nginx" + select BR2_PACKAGE_NGINX + select BR2_PACKAGE_NGINX_HTTP_FASTCGI_MODULE + help + Enable RESTCONF using NGINX fastcgi instead of native. + +config BR2_PACKAGE_CLIXON_RESTCONF_NONE + bool "disabled" + help + Disable RESTCONF frontend completely. + +endchoice + +config BR2_PACKAGE_CLIXON_HTTP1 + bool "native http/1" + default y + depends on BR2_PACKAGE_CLIXON_RESTCONF_NATIVE + help + By default, native HTTP/1 support restconf is enabled. + Disabling this leaves nginx fcgi or http/2 options. + +config BR2_PACKAGE_CLIXON_HTTP2 + bool "native http/2" + depends on BR2_PACKAGE_CLIXON_RESTCONF_NATIVE + select BR2_PACKAGE_NGHTTP2 + help + Native RESTCONF over HTTP/2 using NGHTTP2 package. + + +config BR2_PACKAGE_CLIXON_PUBLISH + bool "publish" + help + Enable publish of notification streams using SSE and curl. + +config BR2_PACKAGE_CLIXON_SNMP + bool "net-snmp" + depends on BR2_PACKAGE_NETSNMP + help + Enable mapping of YANG to SNMP. Uses AgentX interface. + +endif diff --git a/package/clixon/clixon.hash b/package/clixon/clixon.hash new file mode 100644 index 00000000..dd3d1904 --- /dev/null +++ b/package/clixon/clixon.hash @@ -0,0 +1,2 @@ +sha256 c18e0776a1a690bf72d6daee775f933a0f21fed9ed1c4a1102f493d638097030 clixon-6.0.0.tar.gz +sha256 dea515c12a123c00370347276a7e58f699c6861c1398f4c863a7facef2f86b23 LICENSE.md diff --git a/package/clixon/clixon.mk b/package/clixon/clixon.mk new file mode 100644 index 00000000..153082d5 --- /dev/null +++ b/package/clixon/clixon.mk @@ -0,0 +1,60 @@ +################################################################################ +# +# clixon +# +################################################################################ + +CLIXON_VERSION = 6.0.0 +CLIXON_SITE = $(call github,clicon,clixon,$(CLIXON_VERSION)) +CLIXON_LICENSE = Apache-2.0 +CLIXON_LICENSE_FILES = LICENSE.md +CLIXON_INSTALL_STAGING = YES +CLIXON_DEPENDENCIES = cligen #libcurl libxml2 + +ifeq ($(BR_PACKAGE_CLIXON_RESTCONF_NATIVE),y) +CLIXON_CONF_OPTS += --with-restconf=native +endif + +ifeq ($(BR_PACKAGE_CLIXON_HTTP1),y) +CLIXON_CONF_OPTS += --enable-http1 +else +CLIXON_CONF_OPTS += --disable-http1 +endif + +ifeq ($(BR_PACKAGE_CLIXON_HTTP2),y) +CLIXON_DEPENDENCIES += nghttp2 +CLIXON_CONF_OPTS += --enable-nghttp2 +else +CLIXON_CONF_OPTS += --disable-nghttp2 +endif + +ifeq ($(BR_PACKAGE_CLIXON_RESTCONF_FCGI),y) +CLIXON_DEPENDENCIES += nginx +CLIXON_CONF_OPTS += --with-restconf=fcgi +endif + +ifeq ($(BR_PACKAGE_CLIXON_RESTCONF_NONE),y) +CLIXON_CONF_OPTS += --without-restconf +endif + +ifeq ($(BR2_PACKAGE_CLIXON_PUBLISH),y) +CLIXON_CONF_OPTS += --enable-publish +else +CLIXON_CONF_OPTS += --disable-publish +endif + +ifeq ($(BR2_PACKAGE_CLIXON_SNMP),y) +CLIXON_DEPENDENCIES += netsnmp +CLIXON_CONF_OPTS += --enable-netsnmp +else +CLIXON_CONF_OPTS += --disable-netsnmp +endif + +ifeq ($(BR2_PACKAGE_CLIXON_EXAMPLE),y) +define CLIXON_INSTALL_EXAMPLE + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-example +endef +CLIXON_POST_INSTALL_TARGET_HOOKS += CLIXON_INSTALL_EXAMPLE +endif + +$(eval $(autotools-package)) diff --git a/patches/clixon/6.0.0/0001-util-clixon_util_regexp-requires-libxml2.patch b/patches/clixon/6.0.0/0001-util-clixon_util_regexp-requires-libxml2.patch new file mode 100644 index 00000000..7bb8baa1 --- /dev/null +++ b/patches/clixon/6.0.0/0001-util-clixon_util_regexp-requires-libxml2.patch @@ -0,0 +1,28 @@ +From b66f95bc9d45c306c7e5f93df457c1ff326a5f1f Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Tue, 7 Feb 2023 18:29:44 +0100 +Subject: [PATCH 1/4] util: clixon_util_regexp requires libxml2 +Organization: Addiva Elektronik + +Signed-off-by: Joachim Wiberg +--- + util/Makefile.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/util/Makefile.in b/util/Makefile.in +index 552cedda..fbb435af 100644 +--- a/util/Makefile.in ++++ b/util/Makefile.in +@@ -95,7 +95,9 @@ APPSRC += clixon_util_yang.c + APPSRC += clixon_util_xpath.c + APPSRC += clixon_util_path.c + APPSRC += clixon_util_datastore.c ++ifdef with_libxml2 + APPSRC += clixon_util_regexp.c ++endif + APPSRC += clixon_util_socket.c + APPSRC += clixon_util_validate.c + APPSRC += clixon_util_dispatcher.c +-- +2.34.1 + diff --git a/patches/clixon/6.0.0/0002-util-clixon_util_stream-requires-libcurl.patch b/patches/clixon/6.0.0/0002-util-clixon_util_stream-requires-libcurl.patch new file mode 100644 index 00000000..d7547c78 --- /dev/null +++ b/patches/clixon/6.0.0/0002-util-clixon_util_stream-requires-libcurl.patch @@ -0,0 +1,75 @@ +From 327f9ee93a67fd908d70ec4956bed3d067a1c278 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Tue, 7 Feb 2023 18:30:33 +0100 +Subject: [PATCH 2/4] util: clixon_util_stream requires libcurl +Organization: Addiva Elektronik + +Signed-off-by: Joachim Wiberg +--- + configure | 4 ++++ + configure.ac | 4 ++++ + util/Makefile.in | 4 +++- + 3 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 33aa03e1..2275c84f 100755 +--- a/configure ++++ b/configure +@@ -643,6 +643,7 @@ HAVE_HTTP1 + HAVE_LIBNGHTTP2 + enable_netsnmp + with_restconf ++with_curl + LINKAGE + LIBSTATIC_SUFFIX + SH_SUFFIX +@@ -5040,6 +5041,9 @@ fi + + $as_echo "#define CLIXON_PUBLISH_STREAMS 1" >>confdefs.h + ++ with_curl=yes ++else ++ with_curl='' + fi + + for ac_header in cligen/cligen.h +diff --git a/configure.ac b/configure.ac +index c941465a..1d3cee77 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -114,6 +114,7 @@ AC_SUBST(LIBS) + AC_SUBST(SH_SUFFIX) + AC_SUBST(LIBSTATIC_SUFFIX) + AC_SUBST(LINKAGE) ++AC_SUBST(with_curl) + AC_SUBST(with_restconf) # Set to native or fcgi -> compile apps/restconf + AC_SUBST(enable_netsnmp) # Enable build of apps/snmp + AC_SUBST(HAVE_LIBNGHTTP2,false) # consider using neutral constant such as with-http2 +@@ -228,6 +229,9 @@ if test "$ac_enable_publish" = "yes"; then + AC_CHECK_HEADERS(curl.h,[], AC_MSG_ERROR([curl missing])) + AC_CHECK_LIB(curl, curl_global_init,, AC_MSG_ERROR([libcurl missing])) + AC_DEFINE(CLIXON_PUBLISH_STREAMS, 1, [Enable publish of notification streams using SSE and curl]) ++ with_curl=yes ++else ++ with_curl='' + fi + + AC_CHECK_HEADERS(cligen/cligen.h,, AC_MSG_ERROR([CLIgen missing. Try: git clone https://github.com/clicon/cligen.git])) +diff --git a/util/Makefile.in b/util/Makefile.in +index fbb435af..dcf8f12e 100644 +--- a/util/Makefile.in ++++ b/util/Makefile.in +@@ -104,7 +104,9 @@ APPSRC += clixon_util_dispatcher.c + APPSRC += clixon_netconf_ssh_callhome.c + APPSRC += clixon_netconf_ssh_callhome_client.c + ifdef with_restconf +-APPSRC += clixon_util_stream.c # Needs curl ++ifdef with_libcurl ++APPSRC += clixon_util_stream.c ++endif + ifeq ($(with_restconf), native) + APPSRC += clixon_restconf_callhome_client.c + endif +-- +2.34.1 + diff --git a/patches/clixon/6.0.0/0003-example-main-add-missing-DESTDIR-to-standard-include.patch b/patches/clixon/6.0.0/0003-example-main-add-missing-DESTDIR-to-standard-include.patch new file mode 100644 index 00000000..863c1d1d --- /dev/null +++ b/patches/clixon/6.0.0/0003-example-main-add-missing-DESTDIR-to-standard-include.patch @@ -0,0 +1,31 @@ +From 56c94a9bde13650e413e2009e50b67f7ead059e9 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Tue, 7 Feb 2023 18:31:00 +0100 +Subject: [PATCH 3/4] example/main: add missing $(DESTDIR) to standard include + path +Organization: Addiva Elektronik + +This is used everywhere else so looks loke a simple omission. Needed +when cross-compiling (or packaging) Clixon. + +Signed-off-by: Joachim Wiberg +--- + example/main/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/example/main/Makefile.in b/example/main/Makefile.in +index 78243822..aa94895d 100644 +--- a/example/main/Makefile.in ++++ b/example/main/Makefile.in +@@ -69,7 +69,7 @@ endif + + with_restconf = @with_restconf@ + +-INCLUDES = -I$(includedir) @INCLUDES@ ++INCLUDES = -I$(DESTDIR)$(includedir) @INCLUDES@ + LINKAGE = @LINKAGE@ + LDFLAGS = @LDFLAGS@ + CPPFLAGS = @CPPFLAGS@ +-- +2.34.1 + diff --git a/patches/clixon/6.0.0/0004-example-main-replace-hard-coded-path-with-variables-.patch b/patches/clixon/6.0.0/0004-example-main-replace-hard-coded-path-with-variables-.patch new file mode 100644 index 00000000..71b28fba --- /dev/null +++ b/patches/clixon/6.0.0/0004-example-main-replace-hard-coded-path-with-variables-.patch @@ -0,0 +1,53 @@ +From 7bbc0e1e82dcfc9ba1334475386866bb885e7ec6 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Tue, 7 Feb 2023 18:32:32 +0100 +Subject: [PATCH 4/4] example/main: replace hard-coded path with variables from + configure +Organization: Addiva Elektronik + +Signed-off-by: Joachim Wiberg +--- + example/main/example.xml.in | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/example/main/example.xml.in b/example/main/example.xml.in +index 4cb2a3e4..36f225d2 100644 +--- a/example/main/example.xml.in ++++ b/example/main/example.xml.in +@@ -1,23 +1,23 @@ + +- /usr/local/etc/example.xml ++ @sysconfdir@/example.xml + ietf-netconf:startup + ietf-netconf:confirmed-commit + clixon-restconf:allow-auth-none + clixon-restconf:fcgi +- /usr/local/share/clixon ++ @YANG_INSTALLDIR@ + @YANG_STANDARD_DIR@ + clixon-example + example +- /usr/local/lib/example/backend +- /usr/local/lib/example/netconf +- /usr/local/lib/example/restconf +- /usr/local/lib/example/cli +- /usr/local/lib/example/clispec +- /usr/local/var/example/example.sock +- /usr/local/var/example/example.pidfile ++ @exec_prefix@/lib/example/backend ++ @exec_prefix@/lib/example/netconf ++ @exec_prefix@/lib/example/restconf ++ @exec_prefix@/lib/example/cli ++ @exec_prefix@/lib/example/clispec ++ @localstatedir@/run/example.sock ++ @localstatedir@/run/example.pidfile + 0 + 0 +- /usr/local/var/example ++ @localstatedir@/lib/example + init + disabled + true +-- +2.34.1 +