summaryrefslogtreecommitdiff
path: root/liboping
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-09-11 14:02:48 +0200
committerErich Eckner <git@eckner.net>2022-09-11 21:21:43 +0200
commit12d40f83e26ff12f4da5ce578c2934783bcd3850 (patch)
tree7f80a45b0cc577c16382b8ece622df9f66a68a02 /liboping
parent35e4269f65e5272f7b53929963f890eee7a31caf (diff)
downloadarchlinuxewe-12d40f83e26ff12f4da5ce578c2934783bcd3850.tar.xz
liboping new
Diffstat (limited to 'liboping')
-rw-r--r--liboping/PKGBUILD48
-rw-r--r--liboping/format.patch30
-rw-r--r--liboping/install8
-rw-r--r--liboping/ncursesw.patch21
4 files changed, 107 insertions, 0 deletions
diff --git a/liboping/PKGBUILD b/liboping/PKGBUILD
new file mode 100644
index 000000000..1ead55ed9
--- /dev/null
+++ b/liboping/PKGBUILD
@@ -0,0 +1,48 @@
+# Maintainer: Erich Eckner <arch at eckner dot net>
+# Contributor: lilydjwg <lilydjwg@gmail.com>
+# Contributor: Gaetan Bisson <bisson@archlinux.org>
+
+pkgname=liboping
+pkgver=1.10.0
+pkgrel=14
+pkgdesc='C library to generate ICMP echo requests, better known as "ping packets"'
+url='https://noping.cc/'
+arch=('i486' 'i686' 'pentium4' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
+license=('GPL')
+depends=('libcap')
+makedepends=('ncurses')
+optdepends=('perl: perl bindings'
+ 'ncurses: noping CLI tool')
+source=("${url}files/${pkgname}-${pkgver}.tar.bz2"
+ 'ncursesw.patch' 'format.patch')
+sha256sums=('eb38aa93f93e8ab282d97e2582fbaea88b3f889a08cbc9dbf20059c3779d5cd8'
+ '64db954250e7cd4f77ed28d0d4f3deb1525ebe4145c6b20caafc2459c8b1c780'
+ '1975ebcfeb24e9269f49d23075295866b62511e500574f2c86d562e18f01dda7')
+
+install=install
+
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ # Setting capabilities/setuid is futile in fakeroot.
+ # (We do that in the install script.)
+ sed -i 's/ install-exec-hook//g' src/Makefile.in
+
+ # Our ncurses has full UTF8 support although not called ncursesw.
+ patch -p1 -i ../ncursesw.patch
+ patch -p1 -i ../format.patch
+
+ # Be serious.
+ sed '/-Wall -Werror/d' -i src/Makefile.*
+}
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ ./configure --prefix=/usr --with-perl-bindings='INSTALLDIRS=vendor'
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/liboping/format.patch b/liboping/format.patch
new file mode 100644
index 000000000..cc0b99e05
--- /dev/null
+++ b/liboping/format.patch
@@ -0,0 +1,30 @@
+--- liboping-1.10.0-old/src/oping.c 2017-05-11 15:32:27.000000000 +0800
++++ liboping-1.10.0/src/oping.c 2022-03-14 16:36:47.476525817 +0800
+@@ -1125,7 +1125,7 @@
+ wattron (ctx->window, COLOR_PAIR(color));
+
+ if (has_utf8())
+- mvwprintw (ctx->window, /* y = */ 3, /* x = */ x + 2, symbol);
++ mvwprintw (ctx->window, /* y = */ 3, /* x = */ x + 2, "%s", symbol);
+ else
+ mvwaddch (ctx->window, /* y = */ 3, /* x = */ x + 2, symbolc);
+
+@@ -1223,7 +1223,7 @@
+ mvwaddch (ctx->window, /* y = */ 3, /* x = */ x + 2, ' ');
+ else if (has_utf8 ())
+ mvwprintw (ctx->window, /* y = */ 3, /* x = */ x + 2,
+- hist_symbols_utf8[index]);
++ "%s", hist_symbols_utf8[index]);
+ else
+ mvwaddch (ctx->window, /* y = */ 3, /* x = */ x + 2,
+ hist_symbols_acs[index] | A_ALTCHARSET);
+@@ -1600,8 +1600,7 @@
+
+ HOST_PRINTF ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i ",
+ data_len, context->host, context->addr,
+- sequence, recv_ttl,
+- format_qos (recv_qos, recv_qos_str, sizeof (recv_qos_str)));
++ sequence, recv_ttl);
+ if ((recv_qos != 0) || (opt_send_qos != 0))
+ {
+ HOST_PRINTF ("qos=%s ",
diff --git a/liboping/install b/liboping/install
new file mode 100644
index 000000000..04cdb38f8
--- /dev/null
+++ b/liboping/install
@@ -0,0 +1,8 @@
+post_upgrade() {
+ setcap cap_net_raw=ep usr/bin/oping
+ setcap cap_net_raw=ep usr/bin/noping
+}
+
+post_install() {
+ post_upgrade
+}
diff --git a/liboping/ncursesw.patch b/liboping/ncursesw.patch
new file mode 100644
index 000000000..da126a718
--- /dev/null
+++ b/liboping/ncursesw.patch
@@ -0,0 +1,21 @@
+diff -Naur old/src/oping.c new/src/oping.c
+--- old/src/oping.c 2017-05-10 21:32:27.000000000 -1000
++++ new/src/oping.c 2018-06-13 08:29:44.887061003 -1000
+@@ -903,7 +903,6 @@
+ #if USE_NCURSES
+ static _Bool has_utf8() /* {{{ */
+ {
+-# if HAVE_NCURSESW_NCURSES_H
+ if (!opt_utf8)
+ {
+ /* Automatically determine */
+@@ -913,9 +912,6 @@
+ opt_utf8 = 1;
+ }
+ return ((_Bool) (opt_utf8 - 1));
+-# else
+- return (0);
+-# endif
+ } /* }}} _Bool has_utf8 */
+
+ static int update_graph_boxplot (ping_context_t *ctx) /* {{{ */