From 4e2665bd9839bfd78d006b670d1fe1e06b01638f Mon Sep 17 00:00:00 2001 From: Rafael Senties Martinelli Date: Sat, 22 Nov 2025 13:36:49 +0000 Subject: [PATCH] Port of goaccess --- recipes/tui/goaccess/recipe.toml | 44 +++++++++++++++++++++++ recipes/tui/goaccess/redox1.patch | 34 ++++++++++++++++++ recipes/tui/goaccess/redox2.patch | 60 +++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 recipes/tui/goaccess/recipe.toml create mode 100644 recipes/tui/goaccess/redox1.patch create mode 100644 recipes/tui/goaccess/redox2.patch diff --git a/recipes/tui/goaccess/recipe.toml b/recipes/tui/goaccess/recipe.toml new file mode 100644 index 00000000..7fcff9e3 --- /dev/null +++ b/recipes/tui/goaccess/recipe.toml @@ -0,0 +1,44 @@ + +[source] +tar = "https://tar.goaccess.io/goaccess-1.9.4.tar.gz" +blake3 = "a7a7641c98956e8941191956129141e071321851d004269c7d21bce536d9224a" + +#git = "https://github.com/allinurl/goaccess.git" +#branch = "master" + +patches = [ + "redox1.patch", + "redox2.patch", +] + +# This is only needed when compiling from git. The tar.gz already has the make files. +script = """ +autoreconf -fiv +automake --add-missing --copy --force-missing +""" + +[build] +dependencies = ["ncursesw"] +template = "custom" + +script = """ +# Compile bin2c to be executed on the host +gcc -O2 -o "$COOKBOOK_BUILD/bin2c" "$COOKBOOK_SOURCE/src/bin2c.c" +chmod +x "$COOKBOOK_BUILD/bin2c" + +# Compile goaccess +export COOKBOOK_NOSTRIP=1 +DYNAMIC_INIT +COOKBOOK_CONFIGURE_FLAGS+=( + --host=$ARCH-unknown-redox + --enable-utf8 + --disable-geoip + --prefix=/usr + --disable-dependency-tracking + --with-bin2c-path="$COOKBOOK_BUILD/src/bin2c" +) +cookbook_configure +""" + + + diff --git a/recipes/tui/goaccess/redox1.patch b/recipes/tui/goaccess/redox1.patch new file mode 100644 index 00000000..f44ddb0a --- /dev/null +++ b/recipes/tui/goaccess/redox1.patch @@ -0,0 +1,34 @@ +From 2444d71e7815c8b7f3bd4462b8418d9c7e8c5667 Mon Sep 17 00:00:00 2001 +From: Rafael Senties Martinelli +Date: Sun, 19 Oct 2025 19:42:46 +0200 +Subject: [PATCH 1/2] Ensure fixed-width integers and PIPE_BUF are defined for + Redox or minimal libc + +--- + src/websocket.h | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/websocket.h b/src/websocket.h +index 79d03dff..31847b10 100644 +--- a/src/websocket.h ++++ b/src/websocket.h +@@ -45,8 +45,15 @@ + #include + #endif + +-#if defined(__linux__) || defined(__CYGWIN__) ++#if defined(__linux__) || defined(__CYGWIN__) || defined(__redox__) + # include ++#if defined(__redox__) ++# include /* for uint*_t types */ ++# include /* for PIPE_BUF */ ++# ifndef PIPE_BUF ++# define PIPE_BUF 4096 ++# endif ++#endif + #if ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 9)) + #if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) + # include +-- +2.51.1.dirty + diff --git a/recipes/tui/goaccess/redox2.patch b/recipes/tui/goaccess/redox2.patch new file mode 100644 index 00000000..482b7fcd --- /dev/null +++ b/recipes/tui/goaccess/redox2.patch @@ -0,0 +1,60 @@ +From 4a564a6b0f9d4ee7a804b9dbb391e7421187014b Mon Sep 17 00:00:00 2001 +From: Rafael Senties Martinelli +Date: Sun, 19 Oct 2025 20:08:10 +0200 +Subject: [PATCH 2/2] Add option to ignore building bin2c + +--- + Makefile.am | 9 +++++++++ + configure.ac | 16 ++++++++++++++++ + 2 files changed, 25 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index 7696c8f5..8d0fcdcd 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -51,6 +51,15 @@ CLEANFILES = \ + resources/js/charts.js.tmp \ + resources/js/app.js.tmp + ++# Prevent rebuilding bin2c if binary already exists ++bin2c$(EXEEXT): ++if USE_PREBUILT_BIN2C ++ @echo "Using prebuilt bin2c from $(BIN2C_PATH)" ++ cp $(BIN2C_PATH) bin2c$(EXEEXT) ++else ++ $(AM_V_CCLD)$(LINK) $(bin2c_OBJECTS) $(bin2c_LDADD) $(LIBS) ++endif ++ + # Tpls + src/tpls.h: bin2c$(EXEEXT) $(srcdir)/resources/tpls.html + if HAS_SEDTR +diff --git a/configure.ac b/configure.ac +index 790499ce..feaf72d2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -105,6 +105,22 @@ if test "$with_getline" = "yes"; then + AC_DEFINE([WITH_GETLINE], 1, [Build using GNU getline.]) + fi + ++# bin2c ++AC_ARG_WITH([bin2c-path], ++ [AS_HELP_STRING([--with-bin2c-path=PATH], [Use prebuilt bin2c binary at PATH])], ++ [BIN2C_PATH="$withval"], ++ [BIN2C_PATH=""]) ++ ++if test -n "$BIN2C_PATH"; then ++ USE_PREBUILT_BIN2C=true ++else ++ USE_PREBUILT_BIN2C=false ++fi ++ ++AM_CONDITIONAL([USE_PREBUILT_BIN2C], [test "$USE_PREBUILT_BIN2C" = true]) ++AC_SUBST([BIN2C_PATH]) ++ ++ + # UTF8 + AC_ARG_ENABLE([utf8],[AS_HELP_STRING([--enable-utf8],[Enable ncurses library that handles wide characters. Default is disabled])],[utf8="$enableval"],[utf8=no]) + +-- +2.51.1.dirty +