Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Mar 2022 15:35:12 GMT
From:      Mateusz Piotrowski <0mp@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 1d91011b3e54 - main - x11/autorandr: Add a new port
Message-ID:  <202203151535.22FFZCww057282@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by 0mp:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1d91011b3e5444955ec85b0143e211886035b9e7

commit 1d91011b3e5444955ec85b0143e211886035b9e7
Author:     Mateusz Piotrowski <0mp@FreeBSD.org>
AuthorDate: 2022-03-15 15:31:37 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2022-03-15 15:34:38 +0000

    x11/autorandr: Add a new port
    
    Autorandr allows for auto-detecting displays and configuring them with
    xrandr.
    
    Although autorandr is present in the PyPI repositories, I decided to not
    prefix this package with py*- as no other package managers do that.
    Autorandr should be considered an end-user application.
    
    WWW: https://github.com/phillipberndt/autorandr
---
 x11/Makefile                                       |  1 +
 x11/autorandr/Makefile                             | 54 ++++++++++++++++++++++
 x11/autorandr/distinfo                             |  5 ++
 x11/autorandr/files/patch-autorandr.py             | 38 +++++++++++++++
 ...ntrib_autorandr__launcher_autorandr__launcher.c | 11 +++++
 x11/autorandr/pkg-descr                            |  4 ++
 6 files changed, 113 insertions(+)

diff --git a/x11/Makefile b/x11/Makefile
index 3bbde49a3128..63ffd644bbc9 100644
--- a/x11/Makefile
+++ b/x11/Makefile
@@ -17,6 +17,7 @@
     SUBDIR += arandr
     SUBDIR += arcan-trayicon
     SUBDIR += aterm
+    SUBDIR += autorandr
     SUBDIR += babl
     SUBDIR += bbappconf
     SUBDIR += bbdock
diff --git a/x11/autorandr/Makefile b/x11/autorandr/Makefile
new file mode 100644
index 000000000000..32eb004d67fb
--- /dev/null
+++ b/x11/autorandr/Makefile
@@ -0,0 +1,54 @@
+PORTNAME=	autorandr
+DISTVERSION=	1.12.1
+CATEGORIES=	x11
+PATCH_SITES=	https://github.com/phillipberndt/autorandr/commit/
+PATCHFILES=	2bc71d562765e2023b26a31c485769612e3eb91e.patch:-p1 # PR 282
+
+MAINTAINER=	0mp@FreeBSD.org
+COMMENT=	Auto-detect displays and configure them with xrandr
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/gpl-3.0.txt
+
+BUILD_DEPENDS=	gsed:textproc/gsed
+RUN_DEPENDS=	xrandr:x11/xrandr
+
+USES=		gmake pkgconfig python:3.3-3.10 shebangfix xorg
+# Use GitHub instead of MASTER_SITES=CHEESESHOP to get additional files like
+# the manual page and the license.
+USE_GITHUB=	yes
+GH_ACCOUNT=	phillipberndt
+USE_PYTHON=	autoplist concurrent distutils
+USE_XORG=	xcb
+
+MAKE_ARGS=	BASH_COMPLETIONS_DIR=${PREFIX}/share/bash-completion/completions \
+		PREFIX=${PREFIX} \
+		XDG_AUTOSTART_DIR=${PREFIX}/etc/xdg/autostart
+BINARY_ALIAS=	sed=gsed
+
+PLIST_FILES=	bin/${PORTNAME}-launcher \
+		etc/xdg/autostart/autorandr-launcher.desktop \
+		share/bash-completion/completions/autorandr \
+		share/man/man1/${PORTNAME}.1.gz
+
+_EXTRA_BUILD_TARGETS=	contrib/autorandr_launcher/autorandr-launcher
+_EXTRA_INSTALL_TARGETS=	install_bash_completion install_launcher \
+			install_manpage
+
+# Regenerate the patches with:
+#   make clean extract do-patch PATCHFILES=
+post-patch:
+	${REINPLACE_CMD} 's|%%PREFIX%%|${PREFIX}|g' \
+		${WRKSRC}/${PORTNAME}.py \
+		${WRKSRC}/contrib/autorandr_launcher/autorandr_launcher.c
+
+post-build:
+	${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${BUILD_WRKSRC} ${MAKE_ARGS} \
+		${_EXTRA_BUILD_TARGETS}
+
+post-install:
+	${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${INSTALL_WRKSRC} ${MAKE_ARGS} \
+		${_EXTRA_INSTALL_TARGETS}
+	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}-launcher
+
+.include <bsd.port.mk>
diff --git a/x11/autorandr/distinfo b/x11/autorandr/distinfo
new file mode 100644
index 000000000000..f0accfab318b
--- /dev/null
+++ b/x11/autorandr/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1647355348
+SHA256 (phillipberndt-autorandr-1.12.1_GH0.tar.gz) = 2fa2fa6e76a208dc6e2f3a5c743aef14b8b3fd0ed18132e25f79cde3a00b0309
+SIZE (phillipberndt-autorandr-1.12.1_GH0.tar.gz) = 45550
+SHA256 (2bc71d562765e2023b26a31c485769612e3eb91e.patch) = e3e7335d2cd2aebe9fe8b633f570bbd22ecf0b82ada392ee5c8da1a2e41f6b34
+SIZE (2bc71d562765e2023b26a31c485769612e3eb91e.patch) = 3801
diff --git a/x11/autorandr/files/patch-autorandr.py b/x11/autorandr/files/patch-autorandr.py
new file mode 100644
index 000000000000..c5b6286c6762
--- /dev/null
+++ b/x11/autorandr/files/patch-autorandr.py
@@ -0,0 +1,38 @@
+--- autorandr.py.orig	2021-12-22 12:28:03 UTC
++++ autorandr.py
+@@ -121,6 +121,8 @@ Usage: autorandr [options]
+ def is_closed_lid(output):
+     if not re.match(r'(eDP(-?[0-9]\+)*|LVDS(-?[0-9]\+)*)', output):
+         return False
++    print("Checking for a closed lid via /proc is not supported on FreeBSD.", file=sys.stderr)
++    return False
+     lids = glob.glob("/proc/acpi/button/lid/*/state")
+     if len(lids) == 1:
+         state_file = lids[0]
+@@ -1114,7 +1116,7 @@ def exec_scripts(profile_path, script_name, meta_infor
+     if profile_path:
+         candidate_directories.append(profile_path)
+     candidate_directories.append(user_profile_path)
+-    for config_dir in os.environ.get("XDG_CONFIG_DIRS", "/etc/xdg").split(":"):
++    for config_dir in os.environ.get("XDG_CONFIG_DIRS", "%%PREFIX%%/etc/xdg").split(":"):
+         candidate_directories.append(os.path.join(config_dir, "autorandr"))
+ 
+     for folder in candidate_directories:
+@@ -1191,6 +1193,8 @@ def dispatch_call_to_sessions(argv):
+             sys.exit(1)
+         os.waitpid(child_pid, 0)
+ 
++    print("/proc is not supported on FreeBSD; aborting.", file=sys.stderr)
++    sys.exit(1)
+     for directory in os.listdir("/proc"):
+         directory = os.path.join("/proc/", directory)
+         if not os.path.isdir(directory):
+@@ -1321,7 +1325,7 @@ def main(argv):
+     try:
+         # Load profiles from each XDG config directory
+         # The XDG spec says that earlier entries should take precedence, so reverse the order
+-        for directory in reversed(os.environ.get("XDG_CONFIG_DIRS", "/etc/xdg").split(":")):
++        for directory in reversed(os.environ.get("XDG_CONFIG_DIRS", "%%PREFIX%%/etc/xdg").split(":")):
+             system_profile_path = os.path.join(directory, "autorandr")
+             if os.path.isdir(system_profile_path):
+                 profiles.update(load_profiles(system_profile_path))
diff --git a/x11/autorandr/files/patch-contrib_autorandr__launcher_autorandr__launcher.c b/x11/autorandr/files/patch-contrib_autorandr__launcher_autorandr__launcher.c
new file mode 100644
index 000000000000..a759cdaef292
--- /dev/null
+++ b/x11/autorandr/files/patch-contrib_autorandr__launcher_autorandr__launcher.c
@@ -0,0 +1,11 @@
+--- contrib/autorandr_launcher/autorandr_launcher.c.orig	2022-03-15 15:02:37 UTC
++++ contrib/autorandr_launcher/autorandr_launcher.c
+@@ -38,7 +38,7 @@ static int ar_launch()
+ 	pid_t pid = fork();
+ 	if (pid == 0) {
+ 		static char *argv[] =
+-		    { "/usr/bin/autorandr", "--change", "--default", "default", NULL };
++		    { "%%PREFIX%%/bin/autorandr", "--change", "--default", "default", NULL };
+ 		execve(argv[0], argv, environ);
+ 		exit(127);
+ 	} else {
diff --git a/x11/autorandr/pkg-descr b/x11/autorandr/pkg-descr
new file mode 100644
index 000000000000..99ff4377c0b9
--- /dev/null
+++ b/x11/autorandr/pkg-descr
@@ -0,0 +1,4 @@
+Automatically select an xrandr display configuration based on connected
+devices.
+
+WWW: https://github.com/phillipberndt/autorandr



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203151535.22FFZCww057282>