nmon: add new package

This commit is contained in:
AmadeusGhost 2022-11-18 23:29:40 +08:00 committed by AmadeusGhost
parent daef85a141
commit 921644a33a
3 changed files with 85 additions and 0 deletions

39
admin/nmon/Makefile Normal file
View File

@ -0,0 +1,39 @@
# SPDX-License-Identifier: GPL-2.0-or-later
include $(TOPDIR)/rules.mk
PKG_NAME:=nmon
PKG_VERSION:=16n
PKG_RELEASE:=1
PKG_SOURCE:=lmon16n.c
PKG_SOURCE_URL:=@SF/nmon
PKG_HASH:=c0012cc2d925dee940c37ceae297abac64ba5a5c30e575e7418b04028613f5f2
include $(INCLUDE_DIR)/package.mk
define Package/nmon
SECTION:=admin
CATEGORY:=Administration
URL:=https://nmon.sourceforge.net/
TITLE:=Nigel's performance Monitor
DEPENDS:=@(arm||aarch64||powerpc||i386||x86_64) \
+libc +libncurses +lscpu
endef
define Package/nmon/description
nmon is short for Nigel's performance Monitor for Linux
endef
define Build/Prepare
$(CP) ./src/* $(PKG_BUILD_DIR)
$(CP) $(DL_DIR)/$(PKG_SOURCE) $(PKG_BUILD_DIR)
$(Build/Patch)
endef
define Package/nmon/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nmon $(1)/usr/bin/
endef
$(eval $(call BuildPackage,nmon))

View File

@ -0,0 +1,28 @@
From: Mike Crute <mike@crute.us>
Date: Sun, 31 May 2020 19:26:32 +0000
Subject: [PATCH] Add glibc compatibility to nmon
musl is missing some compatibility with glibc which
this patch adds to nmon source. The fstab.h header
was not used and fails to build if it's included.
--- a/lmon16n.c
+++ b/lmon16n.c
@@ -42,6 +42,9 @@
pi_delayacct_blkio_ticks
*/
+/* Fix compatibility for glibc */
+#define __STRING(x) #x
+
/* note: RAW assumes you are using the index "i" to select the CPU */
#define RAW(member) (long)((long)(p->cpuN[i].member) - (long)(q->cpuN[i].member))
#define RAWTOTAL(member) (long)((long)(p->cpu_total.member) - (long)(q->cpu_total.member))
@@ -583,7 +586,6 @@
int isroot = 0;
#include <mntent.h>
-#include <fstab.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <net/if.h>

18
admin/nmon/src/makefile Normal file
View File

@ -0,0 +1,18 @@
# NOTE: link the curent working copy of the code to lmon.c for compiling
CFLAGS=-g -O3 -Wall
LDFLAGS=-lncurses -lm
ifndef ARCH
ARCH := $(shell uname -m)
endif
ifneq ($(findstring $(ARCH), arm aarch64),)
EXTRA_CFLAGS := -DARM
else ifneq ($(findstring $(ARCH), i386 x86_64),)
EXTRA_CFLAGS := -DX86
else ifneq ($(findstring $(ARCH), powerpc),)
EXTRA_CFLAGS := -DPOWER
endif
nmon:
$(CC) -o nmon lmon16n.c $(CFLAGS) $(LDFLAGS) $(EXTRA_CFLAGS)