summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2023-07-16 12:22:14 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2023-07-16 17:25:48 +0200
commitf961edbe39e28707a04a47f3971d8ed71beb5e8a (patch)
tree1eb1ccf62e7445571c204e66e829dd19a853dada
parent0d2fe2d2fcb6541b209a561499d44bb4cc62f3c1 (diff)
Add wayland/havoc a simple wayland terminal emulator
-rw-r--r--wayland/havoc/Makefile29
-rw-r--r--wayland/havoc/distinfo2
-rw-r--r--wayland/havoc/patches/patch-Makefile26
-rw-r--r--wayland/havoc/patches/patch-havoc_cfg25
-rw-r--r--wayland/havoc/patches/patch-main_c45
-rw-r--r--wayland/havoc/patches/patch-tsm_Makefile9
-rw-r--r--wayland/havoc/pkg/DESCR7
-rw-r--r--wayland/havoc/pkg/PLIST3
8 files changed, 146 insertions, 0 deletions
diff --git a/wayland/havoc/Makefile b/wayland/havoc/Makefile
new file mode 100644
index 0000000..62aa5c8
--- /dev/null
+++ b/wayland/havoc/Makefile
@@ -0,0 +1,29 @@
+COMMENT = minimal terminal emulator for wayland
+
+
+GH_ACCOUNT = ii8
+GH_PROJECT = havoc
+GH_TAGNAME = 0.4.0
+
+CATEGORIES = wayland
+HOMEPAGE = https://github.com/ii8/havoc
+
+WANTLIB = epoll-shim util wayland-client wayland-cursor xkbcommon m c
+
+# MIT
+PERMIT_PACKAGE = Yes
+
+USE_GMAKE = Yes
+
+LIB_DEPENDS = devel/epoll-shim \
+ wayland/wayland \
+ x11/xkbcommon
+ALL_TARGET =
+
+post-install:
+ ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/havoc
+ ${INSTALL_DATA} ${WRKSRC}/havoc.cfg ${PREFIX}/share/examples/havoc
+
+DEBUG_PACKAGES = ${BUILD_PACKAGES}
+
+.include <bsd.port.mk>
diff --git a/wayland/havoc/distinfo b/wayland/havoc/distinfo
new file mode 100644
index 0000000..2c80039
--- /dev/null
+++ b/wayland/havoc/distinfo
@@ -0,0 +1,2 @@
+SHA256 (havoc-0.4.0.tar.gz) = +dO1FnzPAc6SW+hm8qz0z7NyOsh4JXVXx61EGy7f33s=
+SIZE (havoc-0.4.0.tar.gz) = 94878
diff --git a/wayland/havoc/patches/patch-Makefile b/wayland/havoc/patches/patch-Makefile
new file mode 100644
index 0000000..2ac3e50
--- /dev/null
+++ b/wayland/havoc/patches/patch-Makefile
@@ -0,0 +1,26 @@
+Index: Makefile
+--- Makefile.orig
++++ Makefile
+@@ -6,11 +6,11 @@ BINDIR ?= $(PREFIX)/bin
+
+ VERSION="0.4.0"
+
+-CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -Wno-parentheses
++CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -I/usr/local/include -I/usr/local/include/libepoll-shim
+ override CFLAGS += -DVERSION=\"$(VERSION)\"
+
+ VPATH=$(WAYLAND_PROTOCOLS_DIR)/stable/xdg-shell
+-LIBS=-lrt -lm -lutil -lwayland-client -lwayland-cursor -lxkbcommon -Ltsm -lhtsm
++LIBS=-L/usr/local/lib -R/usr/local/lib -lm -lutil -lwayland-client -lwayland-cursor -lxkbcommon -Ltsm -lhtsm -lepoll-shim
+ OBJ=xdg-shell.o gtk-primary-selection.o glyph.o main.o
+ GEN=xdg-shell.c xdg-shell.h gtk-primary-selection.c gtk-primary-selection.h
+
+@@ -18,7 +18,7 @@ havoc: tsm $(OBJ)
+ $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
+
+ install: havoc
+- install -D -t $(DESTDIR)$(BINDIR) havoc
++ install -m 755 havoc $(BINDIR)
+
+ uninstall:
+ rm -f $(DESTDIR)$(BINDIR)/havoc
diff --git a/wayland/havoc/patches/patch-havoc_cfg b/wayland/havoc/patches/patch-havoc_cfg
new file mode 100644
index 0000000..d42f7b1
--- /dev/null
+++ b/wayland/havoc/patches/patch-havoc_cfg
@@ -0,0 +1,25 @@
+Index: havoc.cfg
+--- havoc.cfg.orig
++++ havoc.cfg
+@@ -11,7 +11,7 @@ margin=no
+
+ [terminal]
+ # size of terminal
+-rows=16
++rows=35
+ columns=140
+
+ # number of lines to keep in scrollback
+@@ -19,10 +19,10 @@ scrollback=1000
+
+ [font]
+ # height of a single glyph in pixels
+-size=18
++size=14
+
+ # absolute path to a truetype font
+-path=/usr/share/fonts/TTF/DejaVuSansMono.ttf
++path=/usr/X11R6/lib/X11/fonts/TTF/DejaVuSansMono.ttf
+
+ [bind]
+ # bind keys to actions
diff --git a/wayland/havoc/patches/patch-main_c b/wayland/havoc/patches/patch-main_c
new file mode 100644
index 0000000..13cbecd
--- /dev/null
+++ b/wayland/havoc/patches/patch-main_c
@@ -0,0 +1,45 @@
+Index: main.c
+--- main.c.orig
++++ main.c
+@@ -13,7 +13,13 @@
+ #include <sys/timerfd.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#ifndef __OpenBSD__
+ #include <pty.h>
++#else
++#include <sys/ioctl.h>
++#include <sys/ttycom.h>
++#include <util.h>
++#endif
+
+ #include <xkbcommon/xkbcommon-compose.h>
+ #include <wayland-client-core.h>
+@@ -213,7 +219,13 @@ static void handle_tty(int ev)
+ char data[256];
+ int len;
+
+- if (ev & EPOLLIN) {
++ if (ev & EPOLLHUP) {
++ epoll_ctl(term.fd, EPOLL_CTL_DEL, term.master_fd, NULL);
++ close(term.master_fd);
++ term.master_fd = -1;
++ if (!term.opt.linger)
++ term.die = true;
++ } else if (ev & EPOLLIN) {
+ term.need_redraw = true;
+ len = read(term.master_fd, data, sizeof(data));
+ assert(len);
+@@ -223,12 +235,6 @@ static void handle_tty(int ev)
+ } else {
+ tsm_vte_input(term.vte, data, len);
+ }
+- } else if (ev & EPOLLHUP) {
+- epoll_ctl(term.fd, EPOLL_CTL_DEL, term.master_fd, NULL);
+- close(term.master_fd);
+- term.master_fd = -1;
+- if (!term.opt.linger)
+- term.die = true;
+ }
+ }
+
diff --git a/wayland/havoc/patches/patch-tsm_Makefile b/wayland/havoc/patches/patch-tsm_Makefile
new file mode 100644
index 0000000..cac9449
--- /dev/null
+++ b/wayland/havoc/patches/patch-tsm_Makefile
@@ -0,0 +1,9 @@
+Index: tsm/Makefile
+--- tsm/Makefile.orig
++++ tsm/Makefile
+@@ -1,4 +1,5 @@
+ CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -Wno-parentheses
++CFLAGS += -I/usr/local/include
+
+ OBJ=wcwidth.o shl-htable.o\
+ tsm-render.o tsm-screen.o tsm-selection.o\
diff --git a/wayland/havoc/pkg/DESCR b/wayland/havoc/pkg/DESCR
new file mode 100644
index 0000000..b1c8dbb
--- /dev/null
+++ b/wayland/havoc/pkg/DESCR
@@ -0,0 +1,7 @@
+A minimal terminal emulator for Wayland ported to OpenBSD.
+
+havoc will search for a file called havoc.cfg in $XDG_CONFIG_HOME
+first, then in $HOME/.config and last in the current working
+directory.
+
+See the example havoc.cfg for available options.
diff --git a/wayland/havoc/pkg/PLIST b/wayland/havoc/pkg/PLIST
new file mode 100644
index 0000000..6f5d261
--- /dev/null
+++ b/wayland/havoc/pkg/PLIST
@@ -0,0 +1,3 @@
+@bin bin/havoc
+share/examples/havoc/
+share/examples/havoc/havoc.cfg