x11/ly: update to 0.6.0

This update also incorporate some patches from upstream to fix an
issue with cusom X command
While here:
- remove dependency on gnu coreutils
- remove patches or part of patches which has been upstream

PR:	272368
Initial patch send by: 	embhd@posteo.de
This commit is contained in:
Baptiste Daroussin 2023-07-31 15:54:08 +02:00
parent 937a073cf8
commit 09e2ae1953
10 changed files with 148 additions and 141 deletions

View file

@ -1,8 +1,13 @@
PORTNAME= ly
DISTVERSIONPREFIX= v
DISTVERSION= 0.5.3
DISTVERSION= 0.6.0
CATEGORIES= x11
PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
PATCHFILES+= 0edb0012abb52ce13d1e9157e7a25557cda01195.patch:-p1
PATCHFILES+= 42bf929756675f1e6cb922f721665d581574fdc6.patch:-p1
PATCHFILES+= 2ca870cfc5cd6611bb1fd52dcd67ef40895ad787.patch:-p1
MAINTAINER= bapt@FreeBSD.org
COMMENT= TUI (ncurses-like) display manager for X and Wayland
WWW= https://github.com/fairyglade/ly
@ -10,8 +15,6 @@ WWW= https://github.com/fairyglade/ly
LICENSE= WTFPL
LICENSE_FILE= ${WRKSRC}/license.md
BUILD_DEPENDS= ginstall:sysutils/coreutils
USES= gmake localbase xorg
USE_GITHUB= yes
GH_ACCOUNT= fairyglade
@ -26,8 +29,6 @@ MAKE_ARGS= CC="${CC}" \
DISTVERSIONFULL="${DISTVERSIONFULL}"
ALL_TARGET= final
BINARY_ALIAS= install=ginstall
SUB_FILES= pkg-message
_GITDIR= ${WRKDIR}/${GH_PROJECT}-git

View file

@ -1,6 +1,6 @@
TIMESTAMP = 1680865749
SHA256 (fairyglade-ly-v0.5.3_GH0.tar.gz) = ddbd8bd6d7a00867d269154c564d0c059f2d5b0df111e1995b4abfbb89f683d5
SIZE (fairyglade-ly-v0.5.3_GH0.tar.gz) = 22464
TIMESTAMP = 1690811292
SHA256 (fairyglade-ly-v0.6.0_GH0.tar.gz) = 10b3777f49e0a9370efe5132b3c6618294330700a14a659ee66b5bf313f4baae
SIZE (fairyglade-ly-v0.6.0_GH0.tar.gz) = 32706
SHA256 (nullgemm-argoat-36c41f09ecc2a10c9acf35e4194e08b6fa10cf45_GH0.tar.gz) = 5c284cae748b1cec4eef311845f53ad673f91996ec425c6e323f0c40e829e77f
SIZE (nullgemm-argoat-36c41f09ecc2a10c9acf35e4194e08b6fa10cf45_GH0.tar.gz) = 5497
SHA256 (nullgemm-configator-8227b3a835bf4c7e50a57e4ad6aff620ba0dc349_GH0.tar.gz) = bde1826acb80092bd551985082dc872c7f3e48e03132c377f0e5cdd2f9f331e3
@ -9,3 +9,9 @@ SHA256 (nullgemm-dragonfail-6b40d1f8b7f6dda9746e688666af623dfbcceb94_GH0.tar.gz)
SIZE (nullgemm-dragonfail-6b40d1f8b7f6dda9746e688666af623dfbcceb94_GH0.tar.gz) = 3348
SHA256 (nullgemm-termbox_next-2312da153e44face7bb45aa2798ec284289c17ca_GH0.tar.gz) = b788c86e1454c32cd218d0478a87def0a4d1322fef407885359d1ed0c343b045
SIZE (nullgemm-termbox_next-2312da153e44face7bb45aa2798ec284289c17ca_GH0.tar.gz) = 23558
SHA256 (0edb0012abb52ce13d1e9157e7a25557cda01195.patch) = 0a9fcc8b04d3c2562dc6c3ed81f643a0431aab862680d05d34f9eaeb07db9471
SIZE (0edb0012abb52ce13d1e9157e7a25557cda01195.patch) = 739
SHA256 (42bf929756675f1e6cb922f721665d581574fdc6.patch) = 9328794678317d02ce6ac4b9220c14b55f59923c435a2fab76a05aa45bb8db99
SIZE (42bf929756675f1e6cb922f721665d581574fdc6.patch) = 25931
SHA256 (2ca870cfc5cd6611bb1fd52dcd67ef40895ad787.patch) = d0f0f9c4d7d3168916776b6b1df4917bf3d95ca2b61af312cada203f73deefe6
SIZE (2ca870cfc5cd6611bb1fd52dcd67ef40895ad787.patch) = 1215

View file

@ -1,32 +1,29 @@
--- makefile.orig 2020-07-28 15:35:08 UTC
--- makefile.orig 2023-06-15 07:30:09 UTC
+++ makefile
@@ -1,9 +1,9 @@
NAME = ly
CC = gcc
@@ -3,7 +3,7 @@ FLAGS+= -Wall -Wextra -Werror=vla -Wno-unused-paramete
FLAGS = -std=c99 -pedantic -g
-FLAGS+= -Wall -Wextra -Werror=vla -Wno-unused-parameter
+FLAGS+= -Wall -Wextra -Wno-unused-parameter
FLAGS+= -Wall -Wextra -Werror=vla -Wno-unused-parameter
#FLAGS+= -DDEBUG
-FLAGS+= -DGIT_VERSION_STRING=\"$(shell git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')\"
+FLAGS+= -DGIT_VERSION_STRING=\"${DISTVERSIONFULL}\"
-FLAGS+= -DLY_VERSION=\"$(shell git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')\"
+FLAGS+= -DLY_VERSION=\"${DISTVERSIONFULL}\"
LINK = -lpam -lxcb
VALGRIND = --show-leak-kinds=all --track-origins=yes --leak-check=full --suppressions=../res/valgrind.supp
CMD = ./$(NAME)
@@ -12,6 +12,10 @@ OS:= $(shell uname -s)
@@ -12,6 +12,10 @@ endif
ifeq ($(OS), Linux)
FLAGS+= -D_DEFAULT_SOURCE
endif
+ifeq ($(OS), FreeBSD)
+ FLAGS+= -D_DEFAULT_SOURCE ${CPPFLAGS} ${CFLAGS}
+ LINK+= ${LIBS}
+ LINK+= ${LIBS}
+endif
BIND = bin
OBJD = obj
@@ -71,15 +75,14 @@ leakgrind: $(BIND)/$(NAME)
@@ -71,14 +75,14 @@ install: $(BIND)/$(NAME)
install: $(BIND)/$(NAME)
@echo "installing"
@echo "installing ly"
- @install -dZ ${DESTDIR}/etc/ly
- @install -DZ $(BIND)/$(NAME) -t ${DESTDIR}/usr/bin
- @install -DZ $(RESD)/config.ini -t ${DESTDIR}/etc/ly
@ -34,16 +31,15 @@
- @install -DZ $(RESD)/wsetup.sh -t $(DATADIR)
- @install -dZ $(DATADIR)/lang
- @install -DZ $(RESD)/lang/* -t $(DATADIR)/lang
- @install -DZ $(RESD)/ly.service -m 644 -t ${DESTDIR}/usr/lib/systemd/system
- @install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d
+ @install -dZ ${DESTDIR}${PREFIX}/etc/ly
+ @install -DZ $(BIND)/$(NAME) -t ${DESTDIR}${PREFIX}/bin
+ @install -DZ $(RESD)/config.ini -t ${DESTDIR}${PREFIX}/etc/ly
+ @install -DZ $(RESD)/xsetup.sh -t ${DESTDIR}${PREFIX}/etc/ly
+ @install -DZ $(RESD)/wsetup.sh -t ${DESTDIR}${PREFIX}/etc/ly
+ @install -dZ ${DESTDIR}${PREFIX}/etc/ly/lang
+ @install -DZ $(RESD)/lang/* -t ${DESTDIR}${PREFIX}/etc/ly/lang
+ @install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}${PREFIX}/etc/pam.d
+ @install -d ${DESTDIR}/etc/ly
+ @install $(BIND)/$(NAME) -t ${DESTDIR}/usr/bin
+ @install $(RESD)/config.ini -t ${DESTDIR}/etc/ly
+ @install $(RESD)/xsetup.sh -t $(DATADIR)
+ @install $(RESD)/wsetup.sh -t $(DATADIR)
+ @install -d $(DATADIR)/lang
+ @install $(RESD)/lang/* -t $(DATADIR)/lang
+ @install $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d
installnoconf: $(BIND)/$(NAME)
@echo "installing without the configuration file"
@echo "installing ly without the configuration file"

View file

@ -1,72 +1,78 @@
--- res/config.ini.orig 2020-07-28 15:35:08 UTC
--- res/config.ini.orig 2023-07-31 13:38:18 UTC
+++ res/config.ini
@@ -1,3 +1,5 @@
+# This is a FreeBSD-ready patched version of the upstream configuration file.
+
# animation enabled
# Animation enabled/disabled
#animate = false
#animate = true
@@ -53,12 +55,14 @@
# cookie generator
#mcookie_cmd = /usr/bin/mcookie
+mcookie_cmd = /usr/bin/openssl rand -hex 16
@@ -74,6 +76,7 @@
# event timeout in milliseconds
#min_refresh_delta = 5
# default path
#path = /sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin
+path = /sbin:/bin:%%LOCALBASE%%/sbin:%%LOCALBASE%%/bin:/usr/sbin:/usr/bin:/usr/bin/env
# command executed when pressing F2
#restart_cmd = /sbin/shutdown -r now
@@ -68,12 +72,14 @@
# file in which to save and load the default desktop and login
# File in which to save and load the default desktop and login
#save_file = /etc/ly/save
+save_file = %%ETCDIR%%/save
+save_file = /usr/local/etc/ly/save
# service name (set to ly to use the provided pam config file)
#service_name = ly
# command executed when pressing F1
# Remove power management command hints
@@ -87,6 +90,7 @@
# Command executed when pressing shutdown_key
#shutdown_cmd = /sbin/shutdown -a now
+shutdown_cmd = /sbin/shutdown -p now
# terminal reset command (tput is faster)
#term_reset_cmd = /usr/bin/tput reset
@@ -81,8 +87,12 @@
# Command executed when pressing restart_key
#restart_cmd = /sbin/shutdown -r now
@@ -100,11 +104,16 @@
# tty in use
#tty = 2
+# vt in use by X or Wayland
+#vt = 9
+
# wayland setup command
+
# Console path
#console_dev = /dev/console
# Default path
#path = /sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin
+path = /sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/bin/env
# Event timeout in milliseconds
@@ -118,16 +127,19 @@
# Cookie generator
#mcookie_cmd = /usr/bin/mcookie
+mcookie_cmd = /usr/bin/openssl rand -hex 16
# Wayland setup command
#wayland_cmd = /etc/ly/wsetup.sh
+wayland_cmd = %%ETCDIR%%/wsetup.sh
+wayland_cmd = /usr/local/etc/ly/wsetup.sh
# add wayland specifier to session names
# Add wayland specifier to session names
#wayland_specifier = false
@@ -90,15 +100,20 @@
# wayland desktop environments
# Wayland desktop environments
#waylandsessions = /usr/share/wayland-sessions
+waylandsessions = %%LOCALBASE%%/share/wayland-sessions
+waylandsessions = /usr/local/share/wayland-sessions
# xorg server command
# xinitrc
@@ -135,12 +147,16 @@
# Xorg server command
#x_cmd = /usr/bin/X
+x_cmd = %%LOCALBASE%%/bin/X
+x_cmd = /usr/local/bin/X
# xorg setup command
# Xorg setup command
#x_cmd_setup = /etc/ly/xsetup.sh
+x_cmd_setup = %%ETCDIR%%/xsetup.sh
+x_cmd_setup = /usr/local/etc/ly/xsetup.sh
# xorg xauthority edition tool
# Xorg xauthority edition tool
#xauth_cmd = /usr/bin/xauth
+xauth_cmd = %%LOCALBASE%%/bin/xauth
+xauth_cmd = /usr/local/bin/xauth
# xorg desktop environments
# Xorg desktop environments
#xsessions = /usr/share/xsessions
+xsessions = %%LOCALBASE%%/share/xsessions
+xsessions = /usr/local/share/xsessions

View file

@ -1,4 +1,4 @@
--- res/xsetup.sh.orig 2020-02-03 07:51:05 UTC
--- res/xsetup.sh.orig 2023-06-15 07:30:09 UTC
+++ res/xsetup.sh
@@ -55,8 +55,8 @@ esac
[ -f $HOME/.xprofile ] && . $HOME/.xprofile
@ -6,8 +6,8 @@
# run all system xinitrc shell scripts.
-if [ -d /etc/X11/xinit/xinitrc.d ]; then
- for i in /etc/X11/xinit/xinitrc.d/* ; do
+if [ -d %%LOCALBASE%%/etc/X11/xinit/xinitrc.d ]; then
+ for i in %%LOCALBASE%%/etc/X11/xinit/xinitrc.d/* ; do
+if [ -d /usr/local/etc/X11/xinit/xinitrc.d ]; then
+ for i in /usr/local/etc/X11/xinit/xinitrc.d/* ; do
if [ -x "$i" ]; then
. "$i"
fi
@ -17,25 +17,25 @@
# by the scripts to work
-xsessionddir="/etc/X11/Xsession.d"
-OPTIONFILE=/etc/X11/Xsession.options
+xsessionddir="%%LOCALBASE%%/etc/X11/Xsession.d"
+OPTIONFILE=%%LOCALBASE%%/etc/X11/Xsession.options
+xsessionddir="/usr/local/etc/X11/Xsession.d"
+OPTIONFILE=/usr/local/etc/X11/Xsession.options
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
@@ -82,12 +82,12 @@ if [ -d "$xsessionddir" ]; then
@@ -82,12 +82,12 @@ fi
done
fi
-if [ -d /etc/X11/Xresources ]; then
- for i in /etc/X11/Xresources/*; do
+if [ -d %%LOCALBASE%%/etc/X11/Xresources ]; then
+ for i in %%LOCALBASE%%/etc/X11/Xresources/*; do
+if [ -d /usr/local/etc/X11/Xresources ]; then
+ for i in /usr/local/etc/X11/Xresources/*; do
[ -f $i ] && xrdb -merge $i
done
-elif [ -f /etc/X11/Xresources ]; then
- xrdb -merge /etc/X11/Xresources
+elif [ -f %%LOCALBASE%%/etc/X11/Xresources ]; then
+ xrdb -merge %%LOCALBASE%%/etc/X11/Xresources
+elif [ -f /usr/local/etc/X11/Xresources ]; then
+ xrdb -merge /usr/local/etc/X11/Xresources
fi
[ -f $HOME/.Xresources ] && xrdb -merge $HOME/.Xresources
[ -f $XDG_CONFIG_HOME/X11/Xresources ] && xrdb -merge $XDG_CONFIG_HOME/X11/Xresources

View file

@ -1,4 +1,4 @@
--- src/config.c.orig 2021-10-07 13:58:27 UTC
--- src/config.c.orig 2023-07-31 13:38:18 UTC
+++ src/config.c
@@ -11,8 +11,8 @@
#include <unistd.h>
@ -6,30 +6,30 @@
#ifndef DEBUG
- #define INI_LANG DATADIR "/lang/%s.ini"
- #define INI_CONFIG "/etc/ly/config.ini"
+ #define INI_LANG "%%ETCDIR%%/lang/%s.ini"
+ #define INI_CONFIG "%%ETCDIR%%/config.ini"
+ #define INI_LANG "/usr/local/etc/ly/lang/%s.ini"
+ #define INI_CONFIG "/usr/local/etc/ly/config.ini"
#else
#define INI_LANG "../res/lang/%s.ini"
#define INI_CONFIG "../res/config.ini"
@@ -185,6 +185,7 @@ void config_load(const char *cfg_path)
{"shutdown_cmd", &config.shutdown_cmd, config_handle_str},
@@ -190,6 +190,7 @@ void config_load(const char *cfg_path)
{"shutdown_key", &config.shutdown_key, config_handle_str},
{"term_reset_cmd", &config.term_reset_cmd, config_handle_str},
{"tty", &config.tty, config_handle_u8},
+ {"vt", &config.vt, config_handle_u8},
{"wayland_cmd", &config.wayland_cmd, config_handle_str},
{"wayland_specifier", &config.wayland_specifier, config_handle_bool},
{"waylandsessions", &config.waylandsessions, config_handle_str},
@@ -194,7 +195,7 @@ void config_load(const char *cfg_path)
@@ -200,7 +201,7 @@ void config_load(const char *cfg_path)
{"xsessions", &config.xsessions, config_handle_str},
};
- uint16_t map_len[] = {34};
+ uint16_t map_len[] = {35};
- uint16_t map_len[] = {41};
+ uint16_t map_len[] = {42};
struct configator_param* map[] =
{
map_no_section,
@@ -291,6 +292,7 @@ void config_defaults()
config.shutdown_cmd = strdup("/sbin/shutdown -a now");
@@ -302,6 +303,7 @@ void config_defaults()
config.shutdown_key = strdup("F1");
config.term_reset_cmd = strdup("/usr/bin/tput reset");
config.tty = 2;
+ config.vt = 9;

View file

@ -1,7 +1,7 @@
--- src/config.h.orig 2021-10-07 13:58:27 UTC
--- src/config.h.orig 2023-07-31 13:27:47 UTC
+++ src/config.h
@@ -89,6 +89,7 @@ struct config
char* shutdown_cmd;
@@ -94,6 +94,7 @@ struct config
char* shutdown_key;
char* term_reset_cmd;
uint8_t tty;
+ uint8_t vt;

View file

@ -1,11 +0,0 @@
--- src/draw.c.orig 2022-02-04 14:30:20 UTC
+++ src/draw.c
@@ -47,7 +47,7 @@ void draw_init(struct term_buf* buf)
+ (config.input_len + 1)
+ buf->labels_max_len;
-#if defined(__linux__)
+#if defined(__linux__) || defined(__FreeBSD__)
buf->box_chars.left_up = 0x250c;
buf->box_chars.left_down = 0x2514;
buf->box_chars.right_up = 0x2510;

View file

@ -1,7 +1,6 @@
diff -ru bak.ly-0.5.2/src/login.c ly-0.5.2/src/login.c
--- src/login.c 2021-10-16 23:20:01.325733000 -0400
+++ src/login.c 2021-10-16 23:21:46.738595000 -0400
@@ -18,7 +18,7 @@
--- src/login.c.orig 2023-06-15 07:30:09 UTC
+++ src/login.c
@@ -19,7 +19,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
@ -10,39 +9,40 @@ diff -ru bak.ly-0.5.2/src/login.c ly-0.5.2/src/login.c
#include <xcb/xcb.h>
int get_free_display()
@@ -213,6 +213,11 @@
@@ -214,13 +214,13 @@ void env_init(struct passwd* pwd)
// clean env
environ[0] = NULL;
- setenv("TERM", term ? term : "linux", 1);
+ setenv("TERM", term ? term : "xterm", 1);
setenv("HOME", pwd->pw_dir, 1);
setenv("PWD", pwd->pw_dir, 1);
setenv("SHELL", pwd->pw_shell, 1);
setenv("USER", pwd->pw_name, 1);
setenv("LOGNAME", pwd->pw_name, 1);
- setenv("LANG", lang ? lang : "C", 1);
+ setenv("LANG", lang ? lang : "C.UTF-8", 1);
+ if (lang == NULL)
+ {
+ lang = "C.UTF-8";
+ }
+
if (term != NULL)
{
setenv("TERM", term, 1);
@@ -243,9 +248,15 @@
// Set PATH if specified in the configuration
if (strlen(config.path))
@@ -259,9 +259,15 @@ void env_xdg(const char* tty_id, const char* desktop_n
void env_xdg(const char* tty_id, const enum display_server display_server)
void env_xdg(const char* tty_id, const char* desktop_name)
{
- char user[15];
- snprintf(user, 15, "/run/user/%d", getuid());
- setenv("XDG_RUNTIME_DIR", user, 0);
+ // The "/run/user/%d" directory is not available on FreeBSD. It is much
+ // better to stick to the defaults and let applications using
+ // XDG_RUNTIME_DIR to fall back to directories inside user's home
+ // directory.
+ /*
+ * char user[15];
+ * snprintf(user, 15, "/run/user/%d", getuid());
+ * setenv("XDG_RUNTIME_DIR", user, 0);
+ */
setenv("XDG_SESSION_CLASS", "user", 0);
setenv("XDG_SEAT", "seat0", 0);
setenv("XDG_VTNR", tty_id, 0);
@@ -271,8 +282,8 @@
}
char user[20];
snprintf(user, 20, "/run/user/%d", getuid());
setenv("XDG_RUNTIME_DIR", user, 0);
+ */
setenv("XDG_SESSION_CLASS", "user", 0);
setenv("XDG_SESSION_ID", "1", 0);
setenv("XDG_SESSION_DESKTOP", desktop_name, 0);
@@ -269,8 +275,8 @@ void env_xdg(const char* tty_id, const char* desktop_n
setenv("XDG_VTNR", tty_id, 0);
}
-void add_utmp_entry(
@ -52,7 +52,7 @@ diff -ru bak.ly-0.5.2/src/login.c ly-0.5.2/src/login.c
char *username,
pid_t display_pid
) {
@@ -283,24 +294,23 @@
@@ -281,24 +287,23 @@ void add_utmp_entry(
/* only correct for ptys named /dev/tty[pqr][0-9a-z] */
strcpy(entry->ut_id, ttyname(STDIN_FILENO) + strlen("/dev/tty"));
@ -88,17 +88,17 @@ diff -ru bak.ly-0.5.2/src/login.c ly-0.5.2/src/login.c
+ endutxent();
}
void xauth(const char* display_name, const char* shell, const char* dir)
@@ -581,7 +591,7 @@
void xauth(const char* display_name, const char* shell, char* pwd)
@@ -616,7 +621,7 @@ void auth(
// get a display
char vt[5];
snprintf(tty_id, 3, "%d", config.tty);
- snprintf(vt, 5, "vt%d", config.tty);
+ snprintf(vt, 5, "vt%d", config.vt);
++ snprintf(vt, 5, "vt%d", config.vt);
// set env
// set env (this clears the environment)
env_init(pwd);
@@ -636,13 +646,13 @@
@@ -671,13 +676,13 @@ void auth(
}
// add utmp audit

View file

@ -1,11 +1,20 @@
bin/ly
@dir %%ETCDIR%%/lang
%%ETCDIR%%/lang/cat.ini
%%ETCDIR%%/lang/cs.ini
%%ETCDIR%%/lang/de.ini
%%ETCDIR%%/lang/en.ini
%%ETCDIR%%/lang/es.ini
%%ETCDIR%%/lang/fr.ini
%%ETCDIR%%/lang/it.ini
%%ETCDIR%%/lang/pl.ini
%%ETCDIR%%/lang/pt.ini
%%ETCDIR%%/lang/pt_BR.ini
%%ETCDIR%%/lang/ro.ini
%%ETCDIR%%/lang/ru.ini
%%ETCDIR%%/lang/sr.ini
%%ETCDIR%%/lang/sv.ini
%%ETCDIR%%/lang/tr.ini
%%ETCDIR%%/lang/uk.ini
@sample %%ETCDIR%%/config.ini.sample
@sample %%ETCDIR%%/wsetup.sh.sample
@sample %%ETCDIR%%/xsetup.sh.sample