[Buildroot] [PATCH v4 3/3] package/drogon: new package

Dario Binacchi <[email protected]>
Newsgroups net.busybox.buildroot
Message-ID <[email protected]>
Drogon is a C++17/20 based HTTP application framework. It can be used to
easily build various types of web application server programs using C++.

Project page: https://github.com/drogonframework/drogon

Signed-off-by: Dario Binacchi <[email protected]>

---

Changes v3 -> v4:
- Add dependency on BR2_USE_MMU for libuuid
- Update version to 1.9.13.
- Add hash file for drogon-v1.9.13-git4.tar.gz and LICENSE.
- Drop patches already merged in version v1.9.13
- Fix typo EXMPLES -> EXAMPLES
- Fix building failure on SPARC/SPARC64

Changes v2 -> v3:
- The PRs related to the patches have all been merged. The first PR was
  merged by combining the three patches into a single one. Replace all
  Upstream: links with the link to the final commit.
- Add help text to the added KConfig options.
- Select external libraries for BROTLI and YAML_CONFIG options.
- Drop the host configurations. Files too.
- Always add -DBUILD_CTL=ON to HOST_DROGON_CONF_OPTS (together with
  -DBUILD_TESTS=OFF and -DBUILD_EXAMPLES=OFF).

Changes v1 -> v2:
- Drop BR2_ARCH_IS_64 dependency. It has been tested on imx6ull platform.
- Add DROGON_INSTALL_STAGING
- Add 0004-Fix-building-error-for-Werror-unused-value.patch for trantor
  submodule.

 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 ...OLLRDHUP-mismatch-on-Linux-SPARC-SPA.patch | 93 +++++++++++++++++++
 package/drogon/Config.in                      | 52 +++++++++++
 package/drogon/drogon.hash                    |  3 +
 package/drogon/drogon.mk                      | 63 +++++++++++++
 6 files changed, 213 insertions(+)
 create mode 100644 package/drogon/0001-Fix-EPOLLRDHUP-POLLRDHUP-mismatch-on-Linux-SPARC-SPA.patch
 create mode 100644 package/drogon/Config.in
 create mode 100644 package/drogon/drogon.hash
 create mode 100644 package/drogon/drogon.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 75fcdbef2ee7..9057629b46db 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -816,6 +816,7 @@ F:	package/babeld/
 F:	package/bc/
 F:	package/cmocka/
 F:	package/connman/
+F:	package/drogon/
 F:	package/empty/
 F:	package/iana-assignments/
 F:	package/inih/
diff --git a/package/Config.in b/package/Config.in
index 015f635ad16c..acb9b49273e3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1991,6 +1991,7 @@ menu "Networking"
 	source "package/davici/Config.in"
 	source "package/dht/Config.in"
 	source "package/dpdk/Config.in"
+	source "package/drogon/Config.in"
 	source "package/enet/Config.in"
 	source "package/filemq/Config.in"
 	source "package/fmlib/Config.in"
diff --git a/package/drogon/0001-Fix-EPOLLRDHUP-POLLRDHUP-mismatch-on-Linux-SPARC-SPA.patch b/package/drogon/0001-Fix-EPOLLRDHUP-POLLRDHUP-mismatch-on-Linux-SPARC-SPA.patch
new file mode 100644
index 000000000000..7a9fab389fec
--- /dev/null
+++ b/package/drogon/0001-Fix-EPOLLRDHUP-POLLRDHUP-mismatch-on-Linux-SPARC-SPA.patch
@@ -0,0 +1,93 @@
+From 9ecfb965e6ea02583874e534f8936ebb43a9db29 Mon Sep 17 00:00:00 2001
+From: Dario Binacchi <[email protected]>
+Date: Mon, 20 Jul 2026 16:16:22 +0200
+Subject: [PATCH] Fix EPOLLRDHUP/POLLRDHUP mismatch on Linux SPARC/SPARC64
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix a build failure reported by Buildroot autobuild for the
+bootlin-sparc64-glibc configuration:
+
+  EpollPoller.cc:41:26: error: static assertion failed:
+  EPOLLRDHUP != POLLRDHUP
+
+On SPARC/SPARC64, EPOLLRDHUP (0x2000) and POLLRDHUP (0x0800) are
+different bits, breaking the assumption elsewhere in this file that
+epoll and poll flags are interchangeable.
+
+Introduce a combined RDHUP value for this architecture and translate
+it before epoll_ctl() and after epoll_wait(), since revents_ is later
+tested against POLLRDHUP in Channel::handleEvent() — otherwise
+half-close detection would silently break at runtime.
+
+This patch is inspired by the equivalent fix in lighttpd:
+https://redmine.lighttpd.net/issues/3251
+
+Signed-off-by: Dario Binacchi <[email protected]>
+Upstream: https://github.com/an-tao/trantor/pull/407
+---
+ trantor/trantor/net/inner/poller/EpollPoller.cc | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/trantor/trantor/net/inner/poller/EpollPoller.cc b/trantor/trantor/net/inner/poller/EpollPoller.cc
+index c9c4f7d481b4..812b48c30d79 100644
+--- a/trantor/trantor/net/inner/poller/EpollPoller.cc
++++ b/trantor/trantor/net/inner/poller/EpollPoller.cc
+@@ -22,6 +22,9 @@
+ #include <assert.h>
+ #include <strings.h>
+ #include <iostream>
++#if (defined(__sparc__) || defined(__sparc))
++#define TRANTOR_RDHUP 0x2800 /* EPOLLRDHUP | POLLRDHUP */
++#endif
+ #elif defined _WIN32
+ #include "Wepoll.h"
+ #include <assert.h>
+@@ -38,7 +41,12 @@ namespace trantor
+ static_assert(EPOLLIN == POLLIN, "EPOLLIN != POLLIN");
+ static_assert(EPOLLPRI == POLLPRI, "EPOLLPRI != POLLPRI");
+ static_assert(EPOLLOUT == POLLOUT, "EPOLLOUT != POLLOUT");
++#if (defined(__sparc__) || defined(__sparc))
++static_assert(EPOLLRDHUP & TRANTOR_RDHUP,
++              "EPOLLRDHUP not included in TRANTOR_RDHUP");
++#else
+ static_assert(EPOLLRDHUP == POLLRDHUP, "EPOLLRDHUP != POLLRDHUP");
++#endif
+ static_assert(EPOLLERR == POLLERR, "EPOLLERR != POLLERR");
+ static_assert(EPOLLHUP == POLLHUP, "EPOLLHUP != POLLHUP");
+ #endif
+@@ -127,7 +135,15 @@ void EpollPoller::fillActiveChannels(int numEvents,
+         assert(it != channels_.end());
+         assert(it->second == channel);
+ #endif
+-        channel->setRevents(events_[i].events);
++        int revents = events_[i].events;
++#if defined(__linux__) && (defined(__sparc__) || defined(__sparc))
++        if (revents & EPOLLRDHUP)
++        {
++            revents &= ~EPOLLRDHUP;
++            revents |= POLLRDHUP;
++        }
++#endif
++        channel->setRevents(revents);
+         activeChannels->push_back(channel);
+     }
+     // LOG_TRACE<<"active Channels num:"<<activeChannels->size();
+@@ -205,6 +221,13 @@ void EpollPoller::update(int operation, Channel *channel)
+     struct epoll_event event;
+     memset(&event, 0, sizeof(event));
+     event.events = channel->events();
++#if defined(__linux__) && (defined(__sparc__) || defined(__sparc))
++    if (event.events & TRANTOR_RDHUP)
++    {
++        event.events &= ~TRANTOR_RDHUP;
++        event.events |= EPOLLRDHUP;
++    }
++#endif
+     event.data.ptr = channel;
+     int fd = channel->fd();
+     if (::epoll_ctl(epollfd_, operation, fd, &event) < 0)
+-- 
+2.43.0
+
diff --git a/package/drogon/Config.in b/package/drogon/Config.in
new file mode 100644
index 000000000000..cbb44197e418
--- /dev/null
+++ b/package/drogon/Config.in
@@ -0,0 +1,52 @@
+config BR2_PACKAGE_DROGON
+	bool "drogon"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_11 # C++17/20
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_MMU # util-linux (libuuid)
+	select BR2_PACKAGE_JSONCPP
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
+	select BR2_PACKAGE_ZLIB
+	help
+	  Drogon is a C++17/20 based HTTP application framework.
+	  Drogon can be used to easily build various types of web
+	  application server programs using C++.
+
+	  https://github.com/drogonframework/drogon
+
+if BR2_PACKAGE_DROGON
+
+config BR2_PACKAGE_DROGON_BROTLI
+	bool "build Brotli"
+	select BR2_PACKAGE_BROTLI
+	help
+	  Add support for brotli compression.
+
+config BR2_PACKAGE_DROGON_CTL
+	bool "build drogon_ctl"
+	help
+	  drogon_ctl is a command-line tool used to generate
+	  project skeletons and source code.
+
+config BR2_PACKAGE_DROGON_EXAMPLES
+	bool "build examples"
+
+config BR2_PACKAGE_DROGON_ORM
+	bool "build orm"
+	help
+	  Enable the ORM module for typed database access.
+
+config BR2_PACKAGE_DROGON_YAML_CONFIG
+	bool "build yaml config"
+	select BR2_PACKAGE_YAML_CPP
+	help
+	  Add support for YAML configuration via yaml-cpp.
+
+endif
+
+comment "drogon needs a toolchain w/ C++, threads, gcc >= 11"
+	depends on BR2_USE_MMU
+	depends on !BR2_INSTALL_LIBSTDCPP || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_11 || \
+		!BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/drogon/drogon.hash b/package/drogon/drogon.hash
new file mode 100644
index 000000000000..997fd519e1d6
--- /dev/null
+++ b/package/drogon/drogon.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  1d7dc4591b61c34903362209e58a3f92903c76ce6514ffba5ccfaa86a2e3227c  drogon-v1.9.13-git4.tar.gz
+sha256  7e1ed2ca339c384279f1e195e99916eb0145a0d87659969c7e22f8fdd53e11fd  LICENSE
diff --git a/package/drogon/drogon.mk b/package/drogon/drogon.mk
new file mode 100644
index 000000000000..89b1b2720c7d
--- /dev/null
+++ b/package/drogon/drogon.mk
@@ -0,0 +1,63 @@
+################################################################################
+#
+# drogon
+#
+################################################################################
+
+DROGON_VERSION = v1.9.13
+DROGON_SITE = https://github.com/drogonframework/drogon
+DROGON_SITE_METHOD = git
+DROGON_GIT_SUBMODULES = YES
+DROGON_LICENSE = MIT
+DROGON_LICENSE_FILES = LICENSE
+DROGON_INSTALL_STAGING = YES
+
+DROGON_DEPENDENCIES = jsoncpp util-linux zlib
+HOST_DROGON_DEPENDENCIES = host-jsoncpp host-util-linux host-zlib
+
+DROGON_CONF_OPTS = \
+	-DBUILD_TESTS=OFF
+
+HOST_DROGON_CONF_OPTS = \
+	-DBUILD_CTL=ON \
+	-DBUILD_EXAMPLES=OFF \
+	-DBUILD_TESTS=OFF
+
+ifeq ($(BR2_PACKAGE_DROGON_BROTLI),y)
+DROGON_DEPENDENCIES += brotli
+DROGON_CONF_OPTS += -DBUILD_BROTLI=ON
+else
+DROGON_CONF_OPTS += -DBUILD_BROTLI=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_DROGON_CTL),y)
+# When we have drogon_ctl for the target, we need to build the
+# _drogon_ctl tool with host-drogon support so that it can be
+# run during the building process
+DROGON_DEPENDENCIES += host-drogon
+DROGON_CONF_OPTS += -DBUILD_CTL=ON
+else
+DROGON_CONF_OPTS += -DBUILD_CTL=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_DROGON_EXAMPLES),y)
+DROGON_CONF_OPTS += -DBUILD_EXAMPLES=ON
+else
+DROGON_CONF_OPTS += -DBUILD_EXAMPLES=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_DROGON_ORM),y)
+DROGON_CONF_OPTS += -DBUILD_ORM=ON
+else
+DROGON_CONF_OPTS += -DBUILD_ORM=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_DROGON_YAML_CONFIG),y)
+DROGON_DEPENDENCIES += yaml-cpp
+DROGON_CONF_OPTS += -DBUILD_YAML_CONFIG=ON
+else
+DROGON_CONF_OPTS += -DBUILD_YAML_CONFIG=OFF
+endif
+
+$(eval $(cmake-package))
+$(eval $(host-cmake-package))
-- 
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.