dvtm: new recipe.

Lightly tested on 64 bits hrev58996, and 32 bits beta5.

Haven't used it before, but basic functionality seems to be there.
This commit is contained in:
Oscar Lesta
2025-08-06 15:22:24 -03:00
committed by OscarL
parent d56e712db4
commit d73155702d
3 changed files with 204 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
SUMMARY="A dynamic virtual terminal manager"
DESCRIPTION="dvtm brings the concept of tiling window management, popularized by
X11-window managers like dwm to the console. As a console window manager it tries
to make it easy to work with multiple console based programs."
HOMEPAGE="http://www.brain-dump.org/projects/dvtm"
COPYRIGHT="2013-2016 Marc André Tanner"
LICENSE="MIT
ISC"
REVISION="1"
srcGitRev="7bcf43f8dbd5c4a67ec573a1248114caa75fa3c2"
SOURCE_URI="https://github.com/martanne/dvtm/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="5ad3bb68c7f064a2ff96a2e70637b8a974f7c69018cd546651bc7c0f1eaaf2ea"
SOURCE_DIR="dvtm-$srcGitRev"
PATCHES="dvtm-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
dvtm$secondaryArchSuffix = $portVersion
cmd:dvtm = $portVersion
cmd:dvtm_editor = $portVersion
cmd:dvtm_pager = $portVersion
cmd:dvtm_status = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libncursesw$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libncursesw$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
"
TEST_REQUIRES="
cmd:diff
cmd:vis
cmd:which
cmd:wget
"
BUILD()
{
make $jobArgs \
PREFIX=$prefix \
MANPREFIX=$manDir \
TERMINFO=$dataDir/terminfo \
LIBS="-lnetwork -lncursesw"
}
INSTALL()
{
make $jobArgs \
PREFIX=$prefix \
MANPREFIX=$manDir \
TERMINFO=$dataDir/terminfo \
install
}
# Attention!
#
# - It downloads a text file from: http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
# for testing (we could patch that to use a copy via "additional-files" instead if needed).
# - hangs at the end, and looks better when ran outside of HaikuPorter.
# Prepare to kill "/bin/bash" and/or "dvtm" and/or "testsuite.sh" to regain
# control of your terminal.
TEST()
{
testsuite.sh
}

View File

@@ -0,0 +1,13 @@
Copyright (c) <year>, <copyright holder>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,115 @@
From 8cf2fd903fdd93f4d732052bdac0b00d7eae603e Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Wed, 6 Aug 2025 14:07:14 -0300
Subject: Initial Haiku patch.
diff --git a/forkpty-haiku.c b/forkpty-haiku.c
new file mode 100644
index 0000000..c6e466b
--- /dev/null
+++ b/forkpty-haiku.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <unistd.h>
+
+#ifndef TTY_NAME_MAX
+#define TTY_NAME_MAX TTYNAME_MAX
+#endif
+
+pid_t forkpty(int *master, char *name, struct termios *tio, struct winsize *ws)
+{
+ int slave;
+ char *path;
+ pid_t pid;
+
+ if ((*master = open("/dev/ptmx", O_RDWR|O_NOCTTY)) == -1)
+ return -1;
+ if (grantpt(*master) != 0)
+ goto out;
+ if (unlockpt(*master) != 0)
+ goto out;
+
+ if ((path = ptsname(*master)) == NULL)
+ goto out;
+ if (name != NULL)
+ strlcpy(name, path, TTY_NAME_MAX);
+ if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1)
+ goto out;
+
+ switch (pid = fork()) {
+ case -1:
+ goto out;
+ case 0:
+ close(*master);
+
+ setsid();
+#ifdef TIOCSCTTY
+ if (ioctl(slave, TIOCSCTTY, NULL) == -1)
+ return -1;
+#endif
+/*
+ if (ioctl(slave, I_PUSH, "ptem") == -1)
+ return -1;
+ if (ioctl(slave, I_PUSH, "ldterm") == -1)
+ return -1;
+*/
+ if (tio != NULL && tcsetattr(slave, TCSAFLUSH, tio) == -1)
+ return -1;
+ if (ioctl(slave, TIOCSWINSZ, ws) == -1)
+ return -1;
+
+ dup2(slave, 0);
+ dup2(slave, 1);
+ dup2(slave, 2);
+ if (slave > 2)
+ close(slave);
+ return 0;
+ }
+
+ close(slave);
+ return pid;
+
+out:
+ if (*master != -1)
+ close(*master);
+ if (slave != -1)
+ close(slave);
+ return -1;
+}
diff --git a/vt.c b/vt.c
index 15dabc1..bc45355 100644
--- a/vt.c
+++ b/vt.c
@@ -46,6 +46,8 @@
# include "forkpty-aix.c"
#elif defined __sun
# include "forkpty-sunos.c"
+#elif defined __HAIKU__
+# include "forkpty-haiku.c"
#endif
#ifndef NCURSES_ATTR_SHIFT
--
2.48.1