drawterm: update to 0.0.20200619

Fixes https://github.com/void-linux/void-packages/pull/23047
This commit is contained in:
q66 2020-06-19 16:55:25 +02:00 committed by Daniel Kolesa
parent 772128eab1
commit 15f745f4a5
8 changed files with 148 additions and 210 deletions

View file

@ -1,123 +0,0 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH DRAWTERM 1 "October 16, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
drawterm \- connect to Plan 9 CPU servers from other operating systems
.SH SYNOPSIS
.B drawterm
.RB [ \-d ]\|
.RB [ -a
.IR authserver ]
.RB [ -c
.IR cpuserver ]
.RB [ -e
.IR encription_hash_algs ]
.RB [ -k
.IR keyspec ]
.RB [ -s
.IR secstoreserver ]
.RB [ -u
.IR username ]
.RB [ -C
.I command args
.IR ... ]
.br
.SH DESCRIPTION
\fBdrawterm\fP is not a Plan 9 program.
It is a program that users of non-Plan 9 systems can use to establish
graphical
.BR cpu (1)
connections with Plan 9 CPU servers. Just as a real Plan 9 terminal does, a
\fBdrawterm\fP serves its local name space as well as some devices (the
keyboard, mouse, and screen) to a remote CPU server, which mounts this name
space on
.I /mnt/term
and starts a shell.
Typically, either explicitly or via the profile, one uses the shell to start
.BR rio (1).
.PP
By default, drawterm uses the CPU server \fB$cpu\fP or \fIcpu\fP, and the
authentication server \fB$auth\fP or \fIauth\fP,
.SH OPTIONS
This program follows the syntax of the cpu(1) Plan 9 command.
A summary of options is included below.
.TP
.B \-h
Show summary of options.
.TP
.B \-a
Specifies the authentication server to use. If not present uses the
.B $auth
environment variable, if present, or tries with a host name of
.BR auth .
.TP
.B \-c
Specifies the cpu server to use. If not present uses the
.B $cpu
environment variable, if present, or tries with a host name of
.BR cpu .
.TP
.B \-u
Specifies the username to authenticate with. If not present uses the
.B $USER
environment variable, if present, or asks interactively for an username.
.TP
.B \-s
Specifies the secstore server to use.
.TP
.B \-C
Specifies a command to be executed remotely.
.TP
.BR \-e , \-k
Allow for selecting the hash algorithm and keys used, they have the same
meaning as in \fBcpu\fP(1).
.SH SOURCE
In Plan 9 distributions, \fI/sys/src/cmd/unix/drawterm\fP.
.SH DIAGNOSTICS
Drawterm prints most diagnostics in its own window.
.SH BUGS
Although at first \fBdrawterm\fP may seem like a Plan 9 terminal, in fact it
is just a way to provide a CPU server with some terminal devices.
The difference is important because one cannot run terminal-resident programs
when using \fBdrawterm\fP.
The illusion can be improved by delicate adjustments in
\fI/usr/$user/lib/profile\fP.
Should import latest /dev/draw to allow resize of window
Should copy 9term code and make console window a real 9term window instead.
Should implement /dev/label.
.SH SEE ALSO
.BR cpu (1),
.BR rio (1)
in the Plan 9 documentation
.SH AUTHOR
drawterm was written by Russ Cox <rsc@swtch.com>.
.PP
This manual page was written by Russ Cox <rsc@swtch.com>, with modifications
by Martín Ferrari <tincho@debian.org> for the Debian project.

View file

@ -1,18 +0,0 @@
#include "u.h"
#include "libc.h"
int
tas(int *x)
{
/* Use the GCC builtin __sync_add_and_fetch() for optimal code */
int v = __sync_add_and_fetch(x, 1);
switch(v) {
case 0:
case 1:
return v;
default:
print("canlock: corrupted 0x%lux\n", v);
return 1;
}
}

View file

@ -1,9 +0,0 @@
--- gui-x11/Makefile.orig 2015-05-13 14:54:57.102693961 +0200
+++ gui-x11/Makefile 2015-05-13 14:55:13.879692706 +0200
@@ -11,3 +11,6 @@
$(AR) r $(LIB) $(OFILES)
$(RANLIB) $(LIB)
+%.$O: %.c
+ $(CC) $(CFLAGS) $*.c
+

View file

@ -0,0 +1,9 @@
--- gui-x11/Makefile
+++ gui-x11/Makefile
@@ -13,3 +13,6 @@ $(LIB): $(OFILES)
x11.$O: ../glenda-t.xbm
+%.$O: %.c
+ $(CC) $(CFLAGS) $*.c
+

View file

@ -1,18 +0,0 @@
https://bitbucket.org/rsc/drawterm/issue/7/drawterm-emulation-of-2-mouse-button-does#comment-16264332
--- gui-x11/x11.c Sun Jan 02 18:33:44 2011 -0500
+++ gui-x11/x11.c Sat May 05 01:00:27 2012 -0700
@@ -1340,8 +1340,12 @@
ms.buttons |= 1;
if(s & Button2Mask)
ms.buttons |= 2;
- if(s & Button3Mask)
- ms.buttons |= 4;
+ if(s & Button3Mask){
+ if (s & ShiftMask)
+ ms.buttons |= 2;
+ else
+ ms.buttons |= 4;
+ }
if(s & Button4Mask)
ms.buttons |= 8;
if(s & Button5Mask)

View file

@ -0,0 +1,17 @@
--- gui-x11/x11.c
+++ gui-x11/x11.c
@@ -1004,8 +1004,12 @@ xmouse(XEvent *e)
ms.buttons |= 1;
if(s & Button2Mask)
ms.buttons |= 2;
- if(s & Button3Mask)
- ms.buttons |= 4;
+ if(s & Button3Mask){
+ if (s & ShiftMask)
+ ms.buttons |= 2;
+ else
+ ms.buttons |= 4;
+ }
if(s & Button4Mask)
ms.buttons |= 8;
if(s & Button5Mask)

View file

@ -0,0 +1,109 @@
From 21f709644699dca4014691d050ff08990023b6d3 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Fri, 19 Jun 2020 16:42:24 +0200
Subject: [PATCH] Add posix-generic which uses gcc builtins instead of
arch-specific assembly. We can then use this for all our archs.
Also make sure our CFLAGS/LDFLAGS are respected.
---
Make.unix | 11 +++++------
posix-generic/Makefile | 15 +++++++++++++++
posix-generic/getcallerpc.c | 8 ++++++++
posix-generic/tas.c | 18 ++++++++++++++++++
4 files changed, 46 insertions(+), 6 deletions(-)
create mode 100644 posix-generic/Makefile
create mode 100644 posix-generic/getcallerpc.c
create mode 100644 posix-generic/tas.c
diff --git Make.unix Make.unix
index f61c516..3a536b3 100644
--- Make.unix
+++ Make.unix
@@ -4,14 +4,14 @@ PTHREAD=-pthread
AR=ar
AS=as
RANLIB=ranlib
-X11=/usr/X11R6
+override X11 := $(XBPS_CROSS_BASE)/usr/include/X11
CC=gcc
-CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -D_THREAD_SAFE $(PTHREAD) -O2
+override CFLAGS := -fno-strict-aliasing -Wall -Wno-missing-braces -Wno-parentheses -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -D_THREAD_SAFE $(PTHREAD) $(CFLAGS)
O=o
OS=posix
GUI=x11
-LDADD=-L$(X11)/lib64 -L$(X11)/lib -lX11 -ggdb -lm
-LDFLAGS=$(PTHREAD)
+LDADD=-L$(X11)/lib64 -L$(X11)/lib -lX11 -lm
+override LDFLAGS := $(PTHREAD) $(LDFLAGS)
TARG=drawterm
# AUDIO=none
AUDIO=unix
@@ -19,5 +19,4 @@ AUDIO=unix
all: default
libmachdep.a:
- arch=`uname -m|sed 's/i.86/386/;s/Power Macintosh/power/; s/x86_64/amd64/; s/armv[567].*/arm/; s/aarch64/arm64/'`; \
- (cd posix-$$arch && make)
+ cd posix-generic && make
diff --git posix-generic/Makefile posix-generic/Makefile
new file mode 100644
index 0000000..970204e
--- /dev/null
+++ posix-generic/Makefile
@@ -0,0 +1,15 @@
+ROOT=..
+include ../Make.config
+LIB=../libmachdep.a
+
+OFILES=\
+ getcallerpc.$O\
+ tas.$O
+
+default: $(LIB)
+$(LIB): $(OFILES)
+ $(AR) r $(LIB) $(OFILES)
+ $(RANLIB) $(LIB)
+
+%.$O: %.c
+ $(CC) $(CFLAGS) $*.c
diff --git posix-generic/getcallerpc.c posix-generic/getcallerpc.c
new file mode 100644
index 0000000..3614c59
--- /dev/null
+++ posix-generic/getcallerpc.c
@@ -0,0 +1,8 @@
+#include "u.h"
+#include "libc.h"
+
+uintptr
+getcallerpc(void *a)
+{
+ return ((uintptr*)a)[-1];
+}
diff --git posix-generic/tas.c posix-generic/tas.c
new file mode 100644
index 0000000..289f747
--- /dev/null
+++ posix-generic/tas.c
@@ -0,0 +1,18 @@
+#include "u.h"
+#include "libc.h"
+
+int
+tas(int *x)
+{
+ /* Use the GCC builtin __sync_fetch_and_add() for optimal code */
+ int v = __sync_fetch_and_add(x, 1);
+ switch(v) {
+ case 0:
+ case 1:
+ return v;
+ default:
+ print("canlock: corrupted 0x%lux\n", v);
+ return 1;
+ }
+}
+
--
2.27.0

View file

@ -1,56 +1,27 @@
# Template file for 'drawterm'
pkgname=drawterm
version=0.0.20170121
revision=2
_hghash=a5098deb5e1c
version=0.0.20200619
revision=1
_hghash=9daaec18b823
wrksrc=${pkgname}-${_hghash}
makedepends="libX11-devel libXt-devel"
short_desc="Connect to Plan 9 CPU servers from other operating systems"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="LPL-1.02"
homepage="https://bitbucket.org/rsc/drawterm/overview"
distfiles="http://distfiles.voidlinux.de/${pkgname}-${version}/${pkgname}-${version}.tar.gz"
checksum=34cf3f54670d801ca649134d06b09d1c75178af9a785f0fb49203bee560e5199
homepage="http://drawterm.9front.org/"
distfiles="https://code.9front.org/hg/${pkgname}/archive/${_hghash}.tar.gz"
checksum=15c4ac4bbaee888e2a8eb50cf7c4ff883d393253c91dc9e2ba2df5bc2a10940d
CFLAGS="-fno-strict-aliasing"
case "$XBPS_TARGET_MACHINE" in
armv5*) CFLAGS+=" -DARMv5" ;;
esac
if [ "${XBPS_TARGET_MACHINE}" = armv5tel ]; then
CFLAGS+=" -DARMv5"
fi
post_extract() {
# Copy support for aarch64
mkdir ${wrksrc}/posix-aarch64
cp ${wrksrc}/posix-arm/* ${wrksrc}/posix-aarch64/
# test-and-set implementation using GCC builtin
cp ${FILESDIR}/tas.c ${wrksrc}/posix-aarch64/
# the bundled ppc implementation is broken
cp ${FILESDIR}/tas.c ${wrksrc}/posix-power/
}
do_configure() {
local _arch;
case "$XBPS_TARGET_MACHINE" in
aarch64*) _arch=aarch64 ;;
arm*) _arch=arm ;;
i686*) _arch=386 ;;
mips*) _arch=mips ;;
x86_64*) _arch=amd64 ;;
ppc*) _arch=power ;;
esac
sed -i Make* */Makefile \
-e 's%$(CFLAGS)%$(_CFLAGS)%' \
-e 's%$(LDFLAGS)%$(_LDFLAGS)%'
sed -i -e 's%^CFLAGS=%_CFLAGS=$(CFLAGS) %' \
-e 's%^LDFLAGS=%_LDFLAGS=$(LDFLAGS) %' \
-e "s%arch=.*%arch=$_arch; \\\\%" Make.unix
}
do_build() {
make AR=$AR RANLIB=$RANLIB CC=$CC CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CONF=unix ${makejobs}
make AR=$AR AS=$AS RANLIB=$RANLIB CC=$CC CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CONF=unix ${makejobs}
}
do_install() {
vbin drawterm
vlicense LICENSE
vman $FILESDIR/drawterm.1
vman drawterm.1
}