move 'htop' to root-repo and add htop-legacy corresponding to htop v2.x

This commit is contained in:
Leonid Pliushch 2020-09-02 15:31:27 +03:00
parent d9bf81ed12
commit 66d543d2be
4 changed files with 23 additions and 63 deletions

View File

@ -1,20 +1,15 @@
TERMUX_PKG_HOMEPAGE=https://htop.dev/
TERMUX_PKG_HOMEPAGE=https://hisham.hm/htop/
TERMUX_PKG_DESCRIPTION="Interactive process viewer for Linux"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_VERSION=3.0.0
TERMUX_PKG_VERSION=2.2.0
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=1c0661f0ae5f4e2874da250b60cd515e4ac4c041583221adfe95f10e18d1a4e6
TERMUX_PKG_SRCURL=http://hisham.hm/htop/releases/${TERMUX_PKG_VERSION}/htop-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=d9d6826f10ce3887950d709b53ee1d8c1849a70fa38e91d5896ad8cbc6ba3c57
# htop checks setlocale() return value for UTF-8 support, so use libandroid-support.
TERMUX_PKG_DEPENDS="libandroid-support, ncurses"
TERMUX_PKG_DEPENDS="ncurses, libandroid-support"
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
}

View File

@ -16,6 +16,24 @@ diff -uNr htop-2.1.0/linux/LinuxProcessList.c htop-2.1.0.mod/linux/LinuxProcessL
/*{
#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

View File

@ -1,32 +0,0 @@
From b992d52bcf8ff8c51c847cd4bbf33a7db441dbe9 Mon Sep 17 00:00:00 2001
From: Nathan Scott <nathans@redhat.com>
Date: Fri, 28 Aug 2020 16:57:21 +1000
Subject: [PATCH] Increae the size of sysfs power supply path buffers
Resolves https://github.com/htop-dev/htop/issues/15
---
linux/Battery.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux/Battery.c b/linux/Battery.c
index 4014a50..a8784da 100644
--- a/linux/Battery.c
+++ b/linux/Battery.c
@@ -107,7 +107,7 @@ static ACPresence procAcpiCheck() {
if (entryName[0] != 'A')
continue;
- char statePath[50];
+ char statePath[256];
xSnprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName);
FILE* file = fopen(statePath, "r");
if (!file) {
@@ -191,7 +191,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
if (!dirEntry)
break;
char* entryName = (char *) dirEntry->d_name;
- const char filePath[50];
+ const char filePath[256];
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName);
int fd1 = open(filePath, O_RDONLY);

View File

@ -1,21 +0,0 @@
diff -uNr htop-3.0.0/linux/LinuxProcessList.c htop-3.0.0.mod/linux/LinuxProcessList.c
--- htop-3.0.0/linux/LinuxProcessList.c 2020-08-27 02:36:56.000000000 +0300
+++ htop-3.0.0.mod/linux/LinuxProcessList.c 2020-08-29 11:55:19.994514529 +0300
@@ -265,7 +265,7 @@
// Update CPU count:
file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
- CRT_fatalError("Cannot open " PROCSTATFILE);
+ CRT_fatalError("Cannot open '/proc/stat'.\nOn Android 8 and higher access to this file is restricted by SELinux.\nRoot your device in order to get 'htop' working properly.\n");
}
int cpus = 0;
do {
@@ -1127,7 +1127,7 @@
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
- CRT_fatalError("Cannot open " PROCSTATFILE);
+ CRT_fatalError("Cannot open '/proc/stat'.\nOn Android 8 and higher access to this file is restricted by SELinux.\nRoot your device in order to get 'htop' working properly.\n");
}
int cpus = this->super.cpuCount;
assert(cpus > 0);