move and update htop to 3.0.5 from root-repo (#9998)

package `htop` will be merged into one and should be usable for all users while keeping it up-to-date
This commit is contained in:
marcusz 2022-04-15 15:36:10 +08:00 committed by GitHub
parent f259208661
commit ce99a04eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 82 deletions

View File

@ -3,10 +3,10 @@ TERMUX_PKG_DESCRIPTION="Fill your console with Hollywood melodrama technobabble"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.21
TERMUX_PKG_REVISION=3
TERMUX_PKG_REVISION=4
TERMUX_PKG_SRCURL=https://launchpad.net/hollywood/trunk/${TERMUX_PKG_VERSION}/+download/hollywood_${TERMUX_PKG_VERSION}.orig.tar.gz
TERMUX_PKG_SHA256=793ef1f022b376e131c75e05ff1b55a010c0f4193225bb79018855cb9ab89acb
TERMUX_PKG_DEPENDS="bmon, byobu, cmatrix, coreutils, dash, gawk, htop-legacy, man, tree, util-linux"
TERMUX_PKG_DEPENDS="bmon, byobu, cmatrix, coreutils, dash, gawk, htop, man, tree, util-linux"
TERMUX_PKG_RECOMMENDS="apg"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true

View File

@ -1,26 +0,0 @@
TERMUX_PKG_HOMEPAGE=https://hisham.hm/htop/
TERMUX_PKG_DESCRIPTION="Interactive process viewer for Linux"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
# DO NOT UPDATE
TERMUX_PKG_VERSION=1:2.2.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/htop-dev/htop/archive/${TERMUX_PKG_VERSION:2}.tar.gz
TERMUX_PKG_SHA256=fb23275090ee5fb19266384c39c69519c8b3844b8f6444730094949c621197c0
# htop checks setlocale() return value for UTF-8 support, so use libandroid-support.
TERMUX_PKG_DEPENDS="ncurses, libandroid-support"
TERMUX_PKG_CONFLICTS="htop"
TERMUX_PKG_REPLACES="htop"
TERMUX_PKG_PROVIDES="htop"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_RM_AFTER_INSTALL="share/applications share/pixmaps"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
ac_cv_lib_ncursesw6_addnwstr=yes
LIBS=-landroid-support
"
termux_step_pre_configure() {
./autogen.sh
export CFLAGS+=" -fcommon"
}

View File

@ -1,54 +0,0 @@
diff -uNr htop-2.1.0/linux/LinuxProcessList.c htop-2.1.0.mod/linux/LinuxProcessList.c
--- htop-2.1.0/linux/LinuxProcessList.c 2018-02-04 20:57:13.000000000 +0200
+++ htop-2.1.0.mod/linux/LinuxProcessList.c 2018-03-05 17:57:46.901891199 +0200
@@ -37,6 +37,14 @@
#include <linux/taskstats.h>
#endif
+#ifndef major
+#define major(rdev) ((rdev)>>8)
+#endif
+
+#ifndef minor
+#define minor(rdev) ((rdev) & 0xff)
+#endif
+
/*{
#include "ProcessList.h"
@@ -241,7 +249,7 @@
// Update CPU count:
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
- CRT_fatalError("Cannot open " PROCSTATFILE);
+ return pl;
}
char buffer[PROC_LINE_LENGTH + 1];
int cpus = -1;
@@ -966,7 +974,7 @@
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
- CRT_fatalError("Cannot open " PROCSTATFILE);
+ return 0;
}
int cpus = this->super.cpuCount;
assert(cpus > 0);
diff -uNr htop-2.1.0/Process.c htop-2.1.0.mod/Process.c
--- htop-2.1.0/Process.c 2018-02-04 20:57:13.000000000 +0200
+++ htop-2.1.0.mod/Process.c 2018-03-05 17:59:16.522983619 +0200
@@ -29,6 +29,14 @@
#include <assert.h>
#include <math.h>
+#ifndef major
+#define major(rdev) ((rdev)>>8)
+#endif
+
+#ifndef minor
+#define minor(rdev) ((rdev) & 0xff)
+#endif
+
#ifdef __ANDROID__
#define SYS_ioprio_get __NR_ioprio_get
#define SYS_ioprio_set __NR_ioprio_set

29
packages/htop/build.sh Normal file
View File

@ -0,0 +1,29 @@
TERMUX_PKG_HOMEPAGE=https://htop.dev/
TERMUX_PKG_DESCRIPTION="Interactive process viewer for Linux"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.0.5
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/htop-dev/htop/archive/${TERMUX_PKG_VERSION}/htop-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=4c2629bd50895bd24082ba2f81f8c972348aa2298cc6edc6a21a7fa18b73990c
# htop checks setlocale() return value for UTF-8 support, so use libandroid-support.
TERMUX_PKG_DEPENDS="libandroid-support, ncurses"
TERMUX_PKG_BREAKS="htop-legacy"
TERMUX_PKG_CONFLICTS="htop-legacy"
TERMUX_PKG_REPLACES="htop-legacy"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_RM_AFTER_INSTALL="share/applications share/pixmaps"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
ac_cv_lib_ncursesw6_addnwstr=yes
LIBS=-landroid-support
"
termux_step_pre_configure() {
./autogen.sh
}
termux_step_create_debscripts() {
cp -f $TERMUX_PKG_BUILDER_DIR/postinst ./
sed -i "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" ./postinst
}

View File

@ -0,0 +1,33 @@
--- ./Process.c.orig 2021-02-13 11:57:02.747930225 +0000
+++ ./Process.c 2021-02-13 11:58:40.299938503 +0000
@@ -35,6 +35,13 @@
#include <sys/sysmacros.h>
#endif
+#ifndef major
+#define major(rdev) ((rdev)>>8)
+#endif
+
+#ifndef minor
+#define minor(rdev) ((rdev) & 0xff)
+#endif
static uid_t Process_getuid = (uid_t)-1;
--- ./linux/LinuxProcessList.c.orig 2021-02-13 11:57:02.747930225 +0000
+++ ./linux/LinuxProcessList.c 2021-02-13 11:59:30.411609089 +0000
@@ -52,6 +52,14 @@
#include <sys/sysmacros.h>
#endif
+#ifndef major
+#define major(rdev) ((rdev)>>8)
+#endif
+
+#ifndef minor
+#define minor(rdev) ((rdev) & 0xff)
+#endif
+
#ifdef HAVE_SENSORS_SENSORS_H
#include "LibSensors.h"
#endif

23
packages/htop/postinst Normal file
View File

@ -0,0 +1,23 @@
#!@TERMUX_PREFIX@/bin/sh
PREFIX="@TERMUX_PREFIX@"
# create htop directory if it doesn't exist
mkdir -p "${PREFIX}/var/htop"
# check if we can read /proc/stat file.
if cat /proc/stat >/dev/null 2>&1; then
ln -sf /proc/stat "${PREFIX}/var/htop/stat"
else
# generate dummy procstat file if we can't read the actual /proc/stat file
cat > "${PREFIX}/var/htop/stat" <<- EOT
cpu 1035 500 702 8510 1547 0 272 0 0 0
cpu0 636 290 372 3891 931 0 200 0 0 0
intr 35286 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 1779 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ctxt 256127
btime 1649820629
processes 3837
procs_running 1
procs_blocked 0
softirq 93709 0 7679 0 7721 25554 0 25669 7394 0 19692
EOT
fi

View File

@ -0,0 +1,12 @@
diff -uNr htop-3.0.5/linux/LinuxProcessList.h htop-3.0.5.mod/linux/LinuxProcessList.h
--- htop-3.0.5/linux/LinuxProcessList.h 2021-01-11 17:18:21.000000000 +0000
+++ htop-3.0.5.mod/linux/LinuxProcessList.h 2022-04-13 05:47:15.726020765 +0000
@@ -85,7 +85,7 @@
#endif
#ifndef PROCSTATFILE
-#define PROCSTATFILE PROCDIR "/stat"
+#define PROCSTATFILE "@TERMUX_PREFIX@/var/htop/stat"
#endif
#ifndef PROCMEMINFOFILE