Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jun 2021 13:03:53 GMT
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 458c0053ef12 - main - misc/clifm: new port had been added (+)
Message-ID:  <202106181303.15ID3rTo078177@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/ports/commit/?id=458c0053ef12c03bc5663e907e618b9fa096ebc1

commit 458c0053ef12c03bc5663e907e618b9fa096ebc1
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2021-06-18 12:59:54 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2021-06-18 13:02:32 +0000

    misc/clifm: new port had been added (+)
    
    Unlike most of the terminal file managers, CliFM replaces the
    traditional curses interface by a simple command-line interface.
    It is a file manager, but also a shell extension.
    
    WWW: https://github.com/leo-arch/clifm
---
 misc/Makefile                     |   1 +
 misc/clifm/Makefile               |  24 +++++++++
 misc/clifm/distinfo               |   3 ++
 misc/clifm/files/patch-src_misc.c | 102 ++++++++++++++++++++++++++++++++++++++
 misc/clifm/pkg-descr              |  13 +++++
 misc/clifm/pkg-plist              |  33 ++++++++++++
 6 files changed, 176 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index 1d170dba3a9f..eca4d228f1df 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -38,6 +38,7 @@
     SUBDIR += cinnamon-translations
     SUBDIR += cldr-emoji-annotation
     SUBDIR += clex
+    SUBDIR += clifm
     SUBDIR += cloc
     SUBDIR += clpbar
     SUBDIR += cmatrix
diff --git a/misc/clifm/Makefile b/misc/clifm/Makefile
new file mode 100644
index 000000000000..90769df4590b
--- /dev/null
+++ b/misc/clifm/Makefile
@@ -0,0 +1,24 @@
+# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
+
+PORTNAME=	clifm
+PORTVERSION=	1.1
+DISTVERSIONPREFIX=	v
+CATEGORIES=	misc
+
+MAINTAINER=	danfe@FreeBSD.org
+COMMENT=	Non-curses, KISS file manager for the terminal
+
+LICENSE=	GPLv2
+
+USES=		desktop-file-utils gettext-runtime gmake localbase readline
+USE_GITHUB=	yes
+GH_ACCOUNT=	leo-arch
+ALL_TARGET=	build
+MAKE_ENV=	INSTALLPREFIX=${STAGEDIR}${PREFIX}/bin \
+		DESKTOPPREFIX=${STAGEDIR}${PREFIX}/share
+
+post-patch:
+	@${REINPLACE_CMD} -e '/^CFLAGS/s,=.*-march=native,+=,' \
+		${WRKSRC}/src/Makefile
+
+.include <bsd.port.mk>
diff --git a/misc/clifm/distinfo b/misc/clifm/distinfo
new file mode 100644
index 000000000000..8acd70659951
--- /dev/null
+++ b/misc/clifm/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1622268275
+SHA256 (leo-arch-clifm-v1.1_GH0.tar.gz) = e2be66e8000fc43f177e472045d9d30f44625e854d85b4cdf5aad8179d32d5af
+SIZE (leo-arch-clifm-v1.1_GH0.tar.gz) = 7195392
diff --git a/misc/clifm/files/patch-src_misc.c b/misc/clifm/files/patch-src_misc.c
new file mode 100644
index 000000000000..0e2d7c9ffc7d
--- /dev/null
+++ b/misc/clifm/files/patch-src_misc.c
@@ -0,0 +1,102 @@
+--- src/misc.c.orig	2021-05-29 06:04:35 UTC
++++ src/misc.c
+@@ -31,6 +31,10 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/stat.h>
++#if defined(__FreeBSD__)
++#include <sys/mount.h>
++#include <sys/sysctl.h>
++#endif
+ #include <time.h>
+ #include <unistd.h>
+ #include <readline/readline.h>
+@@ -255,9 +259,16 @@ new_instance(char *dir, int sudo)
+ 	}
+ 
+ 	/* Get absolute path of executable name of itself */
++#if defined(__linux__)
+ 	char *self = realpath("/proc/self/exe", NULL);
+ 
+ 	if (!self) {
++#elif defined(__FreeBSD__)
++	const int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
++	char *self = malloc(PATH_MAX);
++	size_t len = PATH_MAX;
++	if (!self || sysctl(mib, 4, self, &len, NULL, 0) == -1) {
++#endif
+ 		fprintf(stderr, "%s: %s\n", PROGRAM_NAME, strerror(errno));
+ 		return EXIT_FAILURE;
+ 	}
+@@ -812,6 +823,7 @@ set_shell(char *str)
+ int
+ list_mountpoints(void)
+ {
++#if defined(__linux__)
+ 	FILE *mp_fp = fopen("/proc/mounts", "r");
+ 
+ 	if (!mp_fp) {
+@@ -819,13 +831,15 @@ list_mountpoints(void)
+ 				PROGRAM_NAME, strerror(errno));
+ 		return EXIT_FAILURE;
+ 	}
++#endif
+ 
+ 	printf(_("%sMountpoints%s\n\n"), bold, df_c);
+ 
+ 	char **mountpoints = (char **)NULL;
+ 	size_t mp_n = 0;
+-	int exit_status = EXIT_SUCCESS;
++	int i, j, exit_status = EXIT_SUCCESS;
+ 
++#if defined(__linux__)
+ 	size_t line_size = 0;
+ 	char *line = (char *)NULL;
+ 	ssize_t line_len = 0;
+@@ -870,6 +884,10 @@ list_mountpoints(void)
+ 	free(line);
+ 	line = (char *)NULL;
+ 	fclose(mp_fp);
++#elif defined(__FreeBSD__)
++	struct statfs *fslist;
++	mp_n = getmntinfo(&fslist, MNT_NOWAIT);
++#endif
+ 
+ 	/* This should never happen: There should always be a mountpoint,
+ 	 * at least "/" */
+@@ -877,6 +895,26 @@ list_mountpoints(void)
+ 		fputs(_("mp: There are no available mountpoints\n"), stdout);
+ 		return EXIT_SUCCESS;
+ 	}
++#if defined(__FreeBSD__)
++	for (i = j = 0; i < mp_n; i++) {
++		/* Do not list all mountpoints, but only those corresponding
++		 * to a block device (/dev) */
++		if (strncmp(fslist[i].f_mntfromname, "/dev/", 5) == 0) {
++			printf("%s%u%s %s%s%s (%s)\n", el_c, j + 1, df_c,
++			    (access(fslist[i].f_mntonname, R_OK | X_OK)
++			    == 0) ? di_c : nd_c, fslist[i].f_mntonname,
++			    df_c, fslist[i].f_mntfromname);
++			/* Store the mountpoint into an array */
++			mountpoints = (char **)xrealloc(mountpoints,
++			    (j + 1) * sizeof(char *));
++			mountpoints[j++] = savestring(fslist[i].f_mntonname,
++			    strlen(fslist[i].f_mntonname));
++		}
++	}
++	/* Update filesystem counter as it would be used to free() the
++	 * mountpoints entries later (below) */
++	mp_n = j;
++#endif
+ 
+ 	putchar('\n');
+ 	/* Ask the user and chdir into the selected mountpoint */
+@@ -922,7 +960,7 @@ list_mountpoints(void)
+ 	/* Free stuff and exit */
+ 	free(input);
+ 
+-	int i = (int)mp_n;
++	i = (int)mp_n;
+ 	while (--i >= 0)
+ 		free(mountpoints[i]);
+ 
diff --git a/misc/clifm/pkg-descr b/misc/clifm/pkg-descr
new file mode 100644
index 000000000000..1588853c1ff8
--- /dev/null
+++ b/misc/clifm/pkg-descr
@@ -0,0 +1,13 @@
+Unlike most of the terminal file managers, CliFM replaces the traditional
+curses interface by a simple command-line interface.  It is a file manager,
+but also a shell extension.
+
+Search for files, copy, rename, and trash some of them, but, at the same
+time, update/upgrade your system, add some cronjob, stop a service, and
+run nano (or vi, or emacs, if you like).
+
+Those familiar with the command-line will find in a file manager based on
+it a desirable addition to its functionality.  The command-line is still
+there, never hidden.
+
+WWW: https://github.com/leo-arch/clifm
diff --git a/misc/clifm/pkg-plist b/misc/clifm/pkg-plist
new file mode 100644
index 000000000000..ef396d41ed04
--- /dev/null
+++ b/misc/clifm/pkg-plist
@@ -0,0 +1,33 @@
+bin/clifm
+share/applications/clifm.desktop
+share/bash-completion/completions/clifm
+%%DATADIR%%/functions/cd_on_quit.sh
+%%DATADIR%%/functions/file_picker.sh
+%%DATADIR%%/functions/subshell_notice.sh
+%%DATADIR%%/mimelist.cfm
+%%DATADIR%%/plugins/BFG.sh
+%%DATADIR%%/plugins/batch_create.sh
+%%DATADIR%%/plugins/clip.sh
+%%DATADIR%%/plugins/colors.sh
+%%DATADIR%%/plugins/dragondrop.sh
+%%DATADIR%%/plugins/finder.sh
+%%DATADIR%%/plugins/fzfdesel.sh
+%%DATADIR%%/plugins/fzfhist.sh
+%%DATADIR%%/plugins/fzfnav.sh
+%%DATADIR%%/plugins/fzfsel.sh
+%%DATADIR%%/plugins/git_status.sh
+%%DATADIR%%/plugins/ihelp.sh
+%%DATADIR%%/plugins/img_viewer.sh
+%%DATADIR%%/plugins/jumper.sh
+%%DATADIR%%/plugins/kbgen.c
+%%DATADIR%%/plugins/mime_list.sh
+%%DATADIR%%/plugins/music_player.sh
+%%DATADIR%%/plugins/pdf_viewer.sh
+%%DATADIR%%/plugins/rgfind.sh
+%%DATADIR%%/plugins/update.sh
+%%DATADIR%%/plugins/vid_viewer.sh
+%%DATADIR%%/plugins/wallpaper_setter.sh
+share/icons/hicolor/scalable/apps/clifm.svg
+share/locale/es/LC_MESSAGES/clifm.mo
+share/man/man1/clifm.1.gz
+share/zsh/site-functions/_clifm



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