Skip to content

Commit 9d87130

Browse files
committed
screen: init recipe
1 parent cf5b88e commit 9d87130

8 files changed

Lines changed: 361 additions & 0 deletions

File tree

screen/PKGBUILD

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Maintainer: Tiara Rodney <tiara@byteb4rb1e.me>
2+
# Ported from the Cygwin package by Andrew Schulman.
3+
# Upstream Cygwin recipe: https://cygwin.com/cgit/cygwin-packages/screen/
4+
5+
pkgname=screen
6+
pkgver=5.0.1
7+
pkgrel=1
8+
pkgdesc='Terminal window manager that multiplexes a physical terminal between several processes'
9+
arch=('x86_64' 'i686')
10+
url='https://www.gnu.org/software/screen/'
11+
msys2_repository_url='https://git.savannah.gnu.org/cgit/screen.git'
12+
msys2_references=(
13+
'anitya: 4772'
14+
'cpe: cpe:/a:gnu:screen'
15+
)
16+
license=('spdx:GPL-3.0-only')
17+
depends=('libxcrypt' 'ncurses')
18+
makedepends=('libxcrypt-devel' 'ncurses-devel' 'gcc' 'texinfo')
19+
backup=('etc/screenrc')
20+
source=("https://ftp.gnu.org/gnu/screen/${pkgname}-${pkgver}.tar.gz"
21+
'colortest.sh'
22+
'cygwin-auth.patch'
23+
'etcscreenrc.patch'
24+
'install-exe.patch'
25+
'peercred.patch'
26+
'texinfo.patch'
27+
'TIOCCONS.patch')
28+
sha256sums=('2dae36f4db379ffcd14b691596ba6ec18ac3a9e22bc47ac239789ab58409869d'
29+
'SKIP'
30+
'SKIP'
31+
'SKIP'
32+
'SKIP'
33+
'SKIP'
34+
'SKIP'
35+
'SKIP')
36+
37+
# The 5.0.1 tarball contains a symlink screen-5.0.1/FAQ -> doc/FAQ. Without
38+
# admin / Developer Mode on Windows, bsdtar fails while creating that symlink
39+
# and makepkg aborts extraction.
40+
noextract=("${pkgname}-${pkgver}.tar.gz")
41+
42+
prepare() {
43+
cd "${srcdir}"
44+
MSYS=winsymlinks:lnk tar -xzf "${pkgname}-${pkgver}.tar.gz"
45+
cd "${pkgname}-${pkgver}"
46+
# Cygwin patches were generated against cygport tree where source
47+
# lives under src/screen-5.0.0/... twostill carry prefix need, hence need
48+
# -p2; the rest were regenerated with -p1-style headers upstream.
49+
patch -p2 -i "${srcdir}/cygwin-auth.patch"
50+
patch -p2 -i "${srcdir}/TIOCCONS.patch"
51+
patch -p1 -i "${srcdir}/peercred.patch"
52+
patch -p1 -i "${srcdir}/install-exe.patch"
53+
patch -p1 -i "${srcdir}/etcscreenrc.patch"
54+
patch -p1 -i "${srcdir}/texinfo.patch"
55+
}
56+
57+
build() {
58+
cd "${srcdir}/${pkgname}-${pkgver}"
59+
./configure \
60+
--build=${CHOST} \
61+
--prefix=/usr \
62+
--sysconfdir=/etc \
63+
--localstatedir=/var \
64+
--mandir=/usr/share/man \
65+
--infodir=/usr/share/info \
66+
--disable-pam \
67+
--enable-utmp
68+
make
69+
make info
70+
}
71+
72+
package() {
73+
cd "${srcdir}/${pkgname}-${pkgver}"
74+
make DESTDIR="${pkgdir}" install
75+
76+
install -Dm644 etc/etcscreenrc "${pkgdir}/etc/screenrc"
77+
78+
install -Dm755 "${srcdir}/colortest.sh" "${pkgdir}/usr/share/screen/colortest.sh"
79+
80+
install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
81+
}

screen/TIOCCONS.patch

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--- origsrc/screen-5.0.0/tty.c 2024-08-29 04:55:03.000000000 +0900
2+
+++ src/screen-5.0.0/tty.c 2025-04-06 00:57:11.489640800 +0900
3+
@@ -802,6 +802,7 @@ static void consredir_readev_fn(Event *
4+
5+
int TtyGrabConsole(int fd, bool on, char *rc_name)
6+
{
7+
+#ifndef __CYGWIN__
8+
Display *d;
9+
#ifdef SRIOCSREDIR
10+
int cfd;
11+
@@ -880,6 +881,7 @@ int TtyGrabConsole(int fd, bool on, char
12+
consredir_ev.type = EV_READ;
13+
consredir_ev.handler = consredir_readev_fn;
14+
evenq(&consredir_ev);
15+
+#endif
16+
return 0;
17+
}
18+

screen/colortest.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
3+
# Print colored text, with guidance about the terminal's color capabilities
4+
# Adapted from:
5+
# - 256color2.pl by Todd Larason <jtl@molehill.org>
6+
# - https://github.com/termstandard/colors
7+
# By Andrew Schulman <andrex.e.schulman@gmail.com>
8+
9+
# System colors (range 0-15)
10+
11+
echo System colors:
12+
for ((color = 0; color < 8; ++color)) ; do
13+
printf "\033[48;5;${color}m "
14+
done
15+
printf "\033[0m\n"
16+
for ((color = 8; $color < 16; ++color)) ; do
17+
printf "\033[48;5;${color}m "
18+
done
19+
printf "\033[0m\n\n"
20+
21+
# Color cube (range 16-231)
22+
23+
echo Color cube, 6x6x6:
24+
for ((g = 0; g < 6; ++g)) ; do
25+
for ((r = 0; r < 6; ++r)) ; do
26+
for ((b = 0; b < 6; ++b)) ; do
27+
color=$(( 16 + 36*r + 6*g + b ))
28+
printf "\033[48;5;${color}m "
29+
done
30+
printf "\033[0m "
31+
done
32+
echo
33+
done
34+
echo
35+
36+
# Grayscale ramp (range 232-255)
37+
38+
echo Grayscale ramp:
39+
for ((color = 232; color < 256; ++color)) ; do
40+
printf "\033[48;5;${color}m "
41+
done
42+
printf "\033[0m\n\n"
43+
44+
# Truecolor ramp
45+
46+
for n in $(tput cols) $COLUMNS 80 ; do
47+
ncols=$n
48+
break
49+
done
50+
51+
echo Truecolor ramp:
52+
for ((col = 0; col < ncols; ++col)) ; do
53+
r=$(( 255 - ( 255 * col / ncols ) ))
54+
g=$(( 510 * col / ncols )) ; if (( g > 255 )) ; then g=$(( 510 - g )) ; fi
55+
b=$(( 255 * col / ncols ))
56+
printf "\033[48;2;%d;%d;%dm" $r $g $b
57+
printf "\033[38;2;%d;%d;%dm" $(( 255 - r )) $(( 255 - g )) $(( 255 - b ))
58+
printf -- "-\033[0m"
59+
done
60+
echo
61+
62+
# Interpretation
63+
64+
ncols=$(printf "%3d" $ncols)
65+
cat <<END
66+
67+
If your terminal supports
68+
this many colors: 8 16 256 24-bit
69+
70+
Then you'll see about this many
71+
distinct shades of color above:
72+
73+
System colors .................. 8 16 8-16 16
74+
Color cube (each square) ....... 3 10 36 36
75+
Greyscale ramp (incl. black) ... 1 4 25 25
76+
Truecolor ramp ................. 1 1 1-64 ${ncols}
77+
78+
See /usr/share/doc/screen/README.msys2 for information about terminal color
79+
support on MSYS2.
80+
END

screen/cygwin-auth.patch

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
--- origsrc/screen-5.0.0/socket.c 2025-04-08 00:24:31.851467200 +0900
2+
+++ src/screen-5.0.0/socket.c 2025-04-08 16:31:46.927444900 +0900
3+
@@ -82,6 +82,17 @@
4+
#include "tty.h"
5+
#include "utmp.h"
6+
7+
+#ifdef __CYGWIN__
8+
+typedef void *HANDLE;
9+
+typedef void *HMODULE;
10+
+typedef uint32_t DWORD;
11+
+typedef uintptr_t DWORD_PTR;
12+
+#define INVALID_HANDLE_VALUE ((HANDLE)-1)
13+
+#define WINVER 0x0502
14+
+#define MAX_PATH 260
15+
+#include <sys/cygwin.h>
16+
+#endif
17+
+
18+
static int CheckPid(pid_t);
19+
static void ExecCreate(Message *);
20+
static void DoCommandMsg(Message *);
21+
@@ -1214,6 +1225,7 @@ static bool CheckPassword(const char *pa
22+
#else /* ENABLE_PAM */
23+
24+
static bool CheckPassword(const char *password) {
25+
+#ifndef __CYGWIN__
26+
bool ret = false;
27+
char *passwd = 0;
28+
29+
@@ -1256,6 +1264,16 @@ static bool CheckPassword(const char *pa
30+
ret = (strcmp(passwd, p->sp_pwdp) == 0);
31+
#endif
32+
return ret;
33+
+#else
34+
+ struct passwd *p;
35+
+ p = getpwnam(ppp->pw_name);
36+
+ if (p == NULL)
37+
+ return false;
38+
+
39+
+ HANDLE hToken = (HANDLE) cygwin_logon_user (p, password);
40+
+ cygwin_set_impersonation_token (hToken);
41+
+ return hToken != INVALID_HANDLE_VALUE;
42+
+#endif
43+
}
44+
#endif /* ENABLE_PAM */
45+

screen/etcscreenrc.patch

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
diff --unified '--color=auto' -urN screen-5.0.1.orig/etc/etcscreenrc screen-5.0.1/etc/etcscreenrc
2+
--- screen-5.0.1.orig/etc/etcscreenrc 2025-05-15 11:31:27.000000000 -0400
3+
+++ screen-5.0.1/etc/etcscreenrc 2025-09-25 07:53:06.039806300 -0400
4+
@@ -1,20 +1,14 @@
5+
-#
6+
-# This is an example for the global screenrc file.
7+
-# You may want to install this file as /usr/local/etc/screenrc.
8+
-# Check config.h for the exact location.
9+
-#
10+
-# Flaws of termcap and standard settings are done here.
11+
-#
12+
13+
#startup_message off
14+
15+
#defflow on # will force screen to process ^S/^Q
16+
+defflow off # leave it off, so we can use ^S to save in *emacs
17+
18+
-deflogin on
19+
+#deflogin on
20+
#autodetach off
21+
22+
-vbell on
23+
-vbell_msg " Wuff ---- Wuff!! "
24+
+#vbell on
25+
+#vbell_msg " Wuff ---- Wuff!! "
26+
27+
# all termcap entries are now duplicated as terminfo entries.
28+
# only difference should be the slightly modified syntax, and check for
29+
@@ -65,6 +59,9 @@
30+
termcap xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
31+
terminfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
32+
33+
+# Set the hardstatus prop on gui terms to set the titlebar/icon title
34+
+termcapinfo xterm*|rxvt*|kterm*|Eterm*|cygwin hs:ts=\E]0;:fs=\007:ds=\E]0;\007
35+
+
36+
#
37+
# Do not use xterms alternate window buffer.
38+
# This one would not add lines to the scrollback buffer.
39+
@@ -81,14 +78,19 @@
40+
termcap wy75-42 nx:xo:Z0=\E[?3h\E[31h:Z1=\E[?3l\E[31h
41+
terminfo wy75-42 nx:xo:Z0=\E[?3h\E[31h:Z1=\E[?3l\E[31h
42+
43+
-#remove some stupid / dangerous key bindings
44+
+# Enable true (24-bit) color
45+
+truecolor on
46+
+
47+
+# Remove some unwanted key bindings
48+
bind ^k
49+
#bind L
50+
bind ^\
51+
-#make them better
52+
-bind \\ quit
53+
-bind K kill
54+
-bind I login on
55+
-bind O login off
56+
-bind } history
57+
+
58+
+# Adjust key bindings
59+
+bind \\ quit --confirm
60+
+bind k kill --confirm
61+
+bind K kill
62+
+bind I login on
63+
+bind O login off
64+
+bind } history
65+

screen/install-exe.patch

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff '--color=auto' -urN screen-5.0.0.orig/Makefile.in screen-5.0.0/Makefile.in
2+
--- screen-5.0.0.orig/Makefile.in 2024-08-28 15:55:03.000000000 -0400
3+
+++ screen-5.0.0/Makefile.in 2024-09-18 10:51:07.853494400 -0400
4+
@@ -20,7 +20,7 @@
5+
bindir = $(exec_prefix)/bin
6+
7+
VERSION = @PACKAGE_VERSION@
8+
-SCREEN = screen-$(VERSION)
9+
+SCREEN = screen
10+
11+
DATE_FMT = %Y-%m-%d %H:%m:%S
12+
ifdef SOURCE_DATE_EPOCH
13+
@@ -77,14 +77,7 @@
14+
$(CC) $(CPPFLAGS) $(CFLAGS) $< -o $@ $*.o tests/mallocmock.o
15+
16+
install_bin: screen installdirs
17+
- -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
18+
- then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi
19+
$(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN)
20+
- -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN)
21+
-# This doesn't work if $(bindir)/screen is a symlink
22+
- -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi
23+
- rm -f $(DESTDIR)$(bindir)/screen
24+
- (cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen)
25+
cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)
26+
27+
###############################################################################

screen/peercred.patch

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
diff '--color=auto' -urN screen-5.0.0.m1/socket.c screen-5.0.0/socket.c
2+
--- screen-5.0.0.m1/socket.c 2024-08-28 15:55:03.000000000 -0400
3+
+++ screen-5.0.0/socket.c 2024-09-18 11:01:23.921380700 -0400
4+
@@ -361,6 +361,9 @@
5+
a.sun_path[ARRAY_SIZE(a.sun_path) - 1] = 0;
6+
xseteuid(real_uid);
7+
xsetegid(real_gid);
8+
+ #ifdef __CYGWIN__
9+
+ setsockopt(s, SOL_SOCKET, SO_PEERCRED, NULL, 0);
10+
+ #endif
11+
if (connect(s, (struct sockaddr *)&a, strlen(SocketPath) + 2) != -1) {
12+
if (quietflag) {
13+
Kill(D_userpid, SIG_BYE);
14+
@@ -390,6 +393,9 @@
15+
chmod(SocketPath, SOCKMODE);
16+
if (chown(SocketPath, real_uid, real_gid))
17+
Panic(errno, "chown");
18+
+ #ifdef __CYGWIN__
19+
+ setsockopt(s, SOL_SOCKET, SO_PEERCRED, NULL, 0);
20+
+ #endif
21+
if (listen(s, 5) == -1)
22+
Panic(errno, "listen");
23+
#ifdef F_SETOWN
24+
@@ -412,6 +418,9 @@
25+
a.sun_path[ARRAY_SIZE(a.sun_path) - 1] = 0;
26+
xseteuid(real_uid);
27+
xsetegid(real_gid);
28+
+ #ifdef __CYGWIN__
29+
+ setsockopt(s, SOL_SOCKET, SO_PEERCRED, NULL, 0);
30+
+ #endif
31+
if (connect(s, (struct sockaddr *)&a, strlen(SocketPath) + 2) == -1) {
32+
if (err)
33+
Msg(errno, "%s: connect", SocketPath);

screen/texinfo.patch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --unified '--color=auto' -urN screen-5.0.1.orig/doc/screen.texinfo screen-5.0.1/doc/screen.texinfo
2+
--- screen-5.0.1.orig/doc/screen.texinfo 2025-05-15 11:39:40.000000000 -0400
3+
+++ screen-5.0.1/doc/screen.texinfo 2025-09-25 07:28:15.906312000 -0400
4+
@@ -5940,7 +5940,7 @@
5+
hardware and operating system, the compiler used to compile, a
6+
description of the bug behavior, and the conditions that triggered the
7+
bug. In case of security issue please send an mail to
8+
-@w{@samp{alexander_naumov@opensuse.org}}.
9+
+@w{@samp{alexander_naumov@@opensuse.org}}.
10+
11+
@node Availability, , Reporting Bugs, Bugs
12+
@section Availability

0 commit comments

Comments
 (0)