htop: initial package

This commit is contained in:
awiouy 2017-07-06 22:59:44 +02:00 committed by cvh
parent 2b7f76693f
commit a0606e9d03
4 changed files with 177 additions and 0 deletions

View File

@ -0,0 +1,32 @@
################################################################################
# This file is part of LibreELEC - https://LibreELEC.tv
# Copyright (C) 2016-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
PKG_NAME="htop"
PKG_VERSION="2.0.2"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="https://hisham.hm/htop"
PKG_URL="https://github.com/hishamhm/htop/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain netbsd-curses"
PKG_SECTION="tools"
PKG_SHORTDESC="An interactive process viewer for Unix"
PKG_AUTORECONF="yes"
pre_configure_target() {
export CFLAGS="$CFLAGS -fno-strict-aliasing -lncurses -lterminfo"
}

View File

@ -0,0 +1,105 @@
From: awiouy <awiouy@gmail.com>
Date: Thu, 6 Jul 2017 18:51:24 +0200
Subject: [PATCH] htop: netbsd-curses support
---
RichString.c | 59 -----------------------------------------------------------
1 file changed, 59 deletions(-)
diff --git a/RichString.c b/RichString.c
index e7dd4e83..0ff1bb02 100644
--- a/RichString.c
+++ b/RichString.c
@@ -18,21 +18,7 @@ in the source distribution for its full text.
#include <ctype.h>
#include <assert.h>
-#ifdef HAVE_NCURSESW_CURSES_H
-#include <ncursesw/curses.h>
-#elif HAVE_NCURSES_NCURSES_H
-#include <ncurses/ncurses.h>
-#elif HAVE_NCURSES_CURSES_H
-#include <ncurses/curses.h>
-#elif HAVE_NCURSES_H
-#include <ncurses.h>
-#elif HAVE_CURSES_H
#include <curses.h>
-#endif
-
-#ifdef HAVE_LIBNCURSESW
-#include <wctype.h>
-#endif
#define RichString_size(this) ((this)->chlen)
#define RichString_sizeVal(this) ((this).chlen)
@@ -41,19 +27,11 @@ in the source distribution for its full text.
#define RichString_beginAllocated(this) memset(&this, 0, sizeof(RichString)); (this).chptr = (this).chstr;
#define RichString_end(this) RichString_prune(&(this));
-#ifdef HAVE_LIBNCURSESW
-#define RichString_printVal(this, y, x) mvadd_wchstr(y, x, (this).chptr)
-#define RichString_printoffnVal(this, y, x, off, n) mvadd_wchnstr(y, x, (this).chptr + off, n)
-#define RichString_getCharVal(this, i) ((this).chptr[i].chars[0] & 255)
-#define RichString_setChar(this, at, ch) do{ (this)->chptr[(at)] = (CharType) { .chars = { ch, 0 } }; } while(0)
-#define CharType cchar_t
-#else
#define RichString_printVal(this, y, x) mvaddchstr(y, x, (this).chptr)
#define RichString_printoffnVal(this, y, x, off, n) mvaddchnstr(y, x, (this).chptr + off, n)
#define RichString_getCharVal(this, i) ((this).chptr[i])
#define RichString_setChar(this, at, ch) do{ (this)->chptr[(at)] = ch; } while(0)
#define CharType chtype
-#endif
typedef struct RichString_ {
int chlen;
@@ -87,41 +65,6 @@ static void RichString_extendLen(RichString* this, int len) {
#define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN && this->chlen < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0)
-#ifdef HAVE_LIBNCURSESW
-
-static inline void RichString_writeFrom(RichString* this, int attrs, const char* data_c, int from, int len) {
- wchar_t data[len+1];
- len = mbstowcs(data, data_c, len);
- if (len < 0)
- return;
- int newLen = from + len;
- RichString_setLen(this, newLen);
- for (int i = from, j = 0; i < newLen; i++, j++) {
- this->chptr[i] = (CharType) { .attr = attrs & 0xffffff, .chars = { (iswprint(data[j]) ? data[j] : '?') } };
- }
-}
-
-inline void RichString_setAttrn(RichString* this, int attrs, int start, int finish) {
- cchar_t* ch = this->chptr + start;
- for (int i = start; i <= finish; i++) {
- ch->attr = attrs;
- ch++;
- }
-}
-
-int RichString_findChar(RichString* this, char c, int start) {
- wchar_t wc = btowc(c);
- cchar_t* ch = this->chptr + start;
- for (int i = start; i < this->chlen; i++) {
- if (ch->chars[0] == wc)
- return i;
- ch++;
- }
- return -1;
-}
-
-#else
-
static inline void RichString_writeFrom(RichString* this, int attrs, const char* data_c, int from, int len) {
int newLen = from + len;
RichString_setLen(this, newLen);
@@ -148,8 +91,6 @@ int RichString_findChar(RichString* this, char c, int start) {
return -1;
}
-#endif
-
void RichString_prune(RichString* this) {
if (this->chlen > RICHSTRING_MAXLEN)
free(this->chptr);

View File

@ -0,0 +1,36 @@
From 308aed7fc91f40db7b7f69095c1a7b777bfeb934 Mon Sep 17 00:00:00 2001
From: awiouy <awiouy@gmail.com>
Date: Thu, 6 Jul 2017 18:50:57 +0200
Subject: [PATCH] htop: remove set_escdelay - fixed in netbsd-curses 0.2.1
drop this patch at netbsd-curses bump to 0.2.1 or higher
---
InfoScreen.c | 1 -
ScreenManager.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/InfoScreen.c b/InfoScreen.c
index e27494c7..28017c63 100644
--- a/InfoScreen.c
+++ b/InfoScreen.c
@@ -117,7 +117,6 @@ void InfoScreen_run(InfoScreen* this) {
if (this->inc->active)
move(LINES-1, CRT_cursorX);
- set_escdelay(25);
int ch = getch();
if (ch == ERR) {
diff --git a/ScreenManager.c b/ScreenManager.c
index 05e1c024..5d1d07d1 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -189,7 +189,6 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
}
int prevCh = ch;
- set_escdelay(25);
ch = getch();
HandlerResult result = IGNORED;

View File

@ -48,6 +48,7 @@ PKG_DEPENDS_TARGET="toolchain \
hddtemp \
hd-idle \
hid_mapper \
htop \
i2c-tools \
inotify-tools \
jq \
@ -111,6 +112,9 @@ addon() {
# hid_mapper
cp -P $(get_build_dir hid_mapper)/hid_mapper $ADDON_BUILD/$PKG_ADDON_ID/bin
# htop
cp -P $(get_build_dir htop)/.install_pkg/usr/bin/htop $ADDON_BUILD/$PKG_ADDON_ID/bin
# i2c-tools
cp -P $(get_build_dir i2c-tools)/tools/i2cdetect $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -P $(get_build_dir i2c-tools)/tools/i2cdump $ADDON_BUILD/$PKG_ADDON_ID/bin