summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorØrjan Malde <red@foxi.me>2023-09-06 13:10:58 +0200
committerØrjan Malde <red@foxi.me>2023-09-06 13:10:58 +0200
commit6fc46ad12aa3e514129fd164f3cf662ba255d8e3 (patch)
tree5b9e6f979668c5e6ae84d73b5ae172582244ed05
parent6abdbe9d187a7e37ef63bd5f74832a25b467854f (diff)
downloadmidipix_build-6fc46ad12aa3e514129fd164f3cf662ba255d8e3.tar.bz2
midipix_build-6fc46ad12aa3e514129fd164f3cf662ba255d8e3.tar.xz
groups.d/211.native_packages_cmdline.group: coreutils: partial uptime(1) functionality
Signed-off-by: Ørjan Malde <red@foxi.me>
-rw-r--r--groups.d/211.native_packages_cmdline.group4
-rw-r--r--patches/coreutils/uptime.patch42
2 files changed, 46 insertions, 0 deletions
diff --git a/groups.d/211.native_packages_cmdline.group b/groups.d/211.native_packages_cmdline.group
index b3094f1f..73b925ce 100644
--- a/groups.d/211.native_packages_cmdline.group
+++ b/groups.d/211.native_packages_cmdline.group
@@ -53,6 +53,10 @@ the_silver_searcher toilet tree terminally_tetris ubase which zsh";
: ${PKG_COREUTILS_VERSION:=9.1};
: ${PKG_COREUTILS_URL:=https://ftp.gnu.org/gnu/coreutils/coreutils-${PKG_COREUTILS_VERSION}.tar.xz};
: ${PKG_COREUTILS_CONFIGURE_ARGS_EXTRA:="--enable-no-install-program=kill"}
+: ${PKG_COREUTILS_CFLAGS_CONFIGURE_EXTRA:="-I${PREFIX_NATIVE}/include/pemagine -I${PREFIX_NATIVE}/include/dalist"};
+: ${PKG_COREUTILS_ENV_VARS_EXTRA:="LIBS=-lntapi"};
+: ${PKG_COREUTILS_CONFIG_CACHE_EXTRA:="
+gl_cv_have_proc_uptime=yes"};
: ${PKG_CPIO_SHA256SUM:=fcdc15d60f7267a6fc7efcd6b9db7b6c8966c4f2fbbb964c24d41336fd3f2c12};
: ${PKG_CPIO_VERSION:=2.14};
: ${PKG_CPIO_URL:=https://ftp.gnu.org/gnu/cpio/cpio-${PKG_CPIO_VERSION}.tar.bz2};
diff --git a/patches/coreutils/uptime.patch b/patches/coreutils/uptime.patch
new file mode 100644
index 00000000..2f2edcc0
--- /dev/null
+++ b/patches/coreutils/uptime.patch
@@ -0,0 +1,42 @@
+diff -ru coreutils-9.1.orig/src/uptime.c coreutils-9.1/src/uptime.c
+--- coreutils-9.1.orig/src/uptime.c 2022-04-08 13:22:18.000000000 +0200
++++ coreutils-9.1/src/uptime.c 2023-09-06 12:26:22.909930119 +0200
+@@ -30,6 +30,11 @@
+ # include <OS.h>
+ #endif
+
++#ifdef __midipix__
++#undef sa_handler
++#include <ntapi/ntapi.h>
++#endif
++
+ #include "c-strtod.h"
+ #include "die.h"
+ #include "error.h"
+@@ -59,6 +64,26 @@
+ struct tm *tmn;
+ double avg[3];
+ int loads;
++#ifdef __midipix__
++ ntapi_vtbl *__ntapi;
++ nt_system_time_of_day_information stodi;
++
++ if((ntapi_init(&__ntapi)) == 0)
++ {
++ char buf[BUFSIZ];
++ long long nt_time;
++ __ntapi->zw_query_system_information(NT_SYSTEM_TIME_OF_DAY_INFORMATION, &stodi, sizeof(stodi), NULL);
++ nt_time = (stodi.current_time.quad - stodi.boot_time.quad) / 100000ULL;
++ sprintf(buf, "%u.%02u", nt_time / 100, nt_time % 100);
++ {
++ char *end_ptr;
++ double upsecs = c_strtod (buf, &end_ptr);
++ if (buf != end_ptr)
++ uptime = (0 <= upsecs && upsecs < TYPE_MAXIMUM (time_t)
++ ? upsecs : -1);
++ }
++ }
++#endif
+ #ifdef HAVE_PROC_UPTIME
+ FILE *fp;
+