1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

New port: misc/nnn: Missing terminal file browser for X

Submitted by:	224600
Reported by:	Dmitri Goutnik <dg@syrec.org>
Approved by:	tcberner (mentor)
Differential Revision:	https://reviews.freebsd.org/D13646
This commit is contained in:
Yuri Victorovich 2017-12-27 17:47:29 +00:00
parent 94d2930d00
commit 0a399ebf74
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=457381
6 changed files with 154 additions and 0 deletions

View File

@ -280,6 +280,7 @@
SUBDIR += najitool
SUBDIR += newer
SUBDIR += nms
SUBDIR += nnn
SUBDIR += nsf
SUBDIR += numchar
SUBDIR += nut

67
misc/nnn/Makefile Normal file
View File

@ -0,0 +1,67 @@
# $FreeBSD$
PORTNAME= nnn
DISTVERSIONPREFIX= v
DISTVERSION= 1.6
CATEGORIES= misc shells
MAINTAINER= dg@syrec.org
COMMENT= Missing terminal file browser for X
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
RUN_DEPENDS= bash:shells/bash \
xdg-open:devel/xdg-utils
USES= gmake localbase ncurses readline shebangfix
USE_GITHUB= yes
GH_ACCOUNT= jarun
SHEBANG_FILES= nlay
MAKE_ARGS= PREFIX=${PREFIX} MANPREFIX=${PREFIX}/man
CFLAGS+= -D_WITH_DPRINTF # enable dprintf prototype
OPTIONS_DEFINE= ATOOL BASH DOCS EXAMPLES FISH MEDIAINFO ZSH
OPTIONS_DEFAULT= ATOOL MEDIAINFO
ATOOL_DESC= List and extract archives
MEDIAINFO_DESC= Show media information
ATOOL_RUN_DEPENDS= atool:archivers/atool
MEDIAINFO_RUN_DEPENDS= mediainfo:multimedia/mediainfo
BASH_PLIST_FILES= etc/bash_completion.d/nnn-completion.bash
FISH_PLIST_FILES= share/fish/completions/nnn.fish
ZSH_PLIST_FILES= share/zsh/site-functions/_nnn
PLIST_FILES= bin/nnn \
bin/nlay \
man/man1/nnn.1.gz
PORTDOCS= README.md
PORTEXAMPLES= *
post-install-BASH-on:
@${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
${INSTALL_DATA} ${WRKSRC}/scripts/auto-completion/bash/nnn-completion.bash \
${STAGEDIR}${PREFIX}/etc/bash_completion.d
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_MAN} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
post-install-EXAMPLES-on:
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
cd ${WRKSRC}/scripts && ${COPYTREE_SHARE} "copier quitcd" ${STAGEDIR}${EXAMPLESDIR}
post-install-FISH-on:
@${MKDIR} ${STAGEDIR}${PREFIX}/share/fish/completions
${INSTALL_DATA} ${WRKSRC}/scripts/auto-completion/fish/nnn.fish \
${STAGEDIR}${PREFIX}/share/fish/completions
post-install-ZSH-on:
@${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
${INSTALL_DATA} ${WRKSRC}/scripts/auto-completion/zsh/_nnn \
${STAGEDIR}${PREFIX}/share/zsh/site-functions
.include <bsd.port.mk>

3
misc/nnn/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1514234740
SHA256 (jarun-nnn-v1.6_GH0.tar.gz) = e8b10a3b9847ba7ad3317f608691aaebcdaf2b67219d732f7a5d468221d3e83e
SIZE (jarun-nnn-v1.6_GH0.tar.gz) = 37456

View File

@ -0,0 +1,20 @@
--- Makefile.orig 2017-12-25 13:40:20 UTC
+++ Makefile
@@ -10,7 +10,7 @@ ifeq ($(shell pkg-config ncursesw && ech
CFLAGS += $(shell pkg-config --cflags ncursesw)
LDLIBS += $(shell pkg-config --libs ncursesw)
else
- LDLIBS += -lncurses
+ LDLIBS += -lncursesw
endif
DISTFILES = nlay nnn.c nnn.h nnn.1 Makefile README.md LICENSE
@@ -23,7 +23,7 @@ all: $(BIN) $(PLAYER)
$(SRC): nnn.h
$(BIN): $(SRC)
- $(CC) -O2 $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
strip $@
debug: $(SRC)

View File

@ -0,0 +1,40 @@
Upstreamed, remove after the next release:
- https://github.com/jarun/nnn/pull/70
- https://github.com/jarun/nnn/pull/69
--- nnn.c.orig 2017-12-25 13:40:20 UTC
+++ nnn.c
@@ -260,7 +260,7 @@ static char * const utils[] = {
#ifdef __APPLE__
"/usr/bin/open",
#else
- "/usr/bin/xdg-open",
+ "xdg-open",
#endif
"nlay",
"atool"
@@ -1544,20 +1544,22 @@ show_stats(char *fpath, char *fname, str
/* Show size, blocks, file type */
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
dprintf(fd, "\n Size: %-15lld Blocks: %-10lld IO Block: %-6d %s",
+ (long long)sb->st_size, (long long)sb->st_blocks, sb->st_blksize, desc);
#else
dprintf(fd, "\n Size: %-15ld Blocks: %-10ld IO Block: %-6ld %s",
-#endif
sb->st_size, sb->st_blocks, sb->st_blksize, desc);
+#endif
/* Show containing device, inode, hardlink count */
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
sprintf(g_buf, "%xh/%ud", sb->st_dev, sb->st_dev);
dprintf(fd, "\n Device: %-15s Inode: %-11llu Links: %-9hu",
+ g_buf, (unsigned long long)sb->st_ino, sb->st_nlink);
#else
sprintf(g_buf, "%lxh/%lud", sb->st_dev, sb->st_dev);
dprintf(fd, "\n Device: %-15s Inode: %-11lu Links: %-9lu",
-#endif
g_buf, sb->st_ino, sb->st_nlink);
+#endif
/* Show major, minor number for block or char device */
if (perms[0] == 'b' || perms[0] == 'c')

23
misc/nnn/pkg-descr Normal file
View File

@ -0,0 +1,23 @@
nnn is a fast and resource-sensitive file browser which integrates well with
your DE and favorite GUI utilities, works with the desktop opener, supports
bookmarks, has smart navigation shortcuts, has navigate-as-you-type mode,
disk usage analyzer mode, comprehensive file details and much more.
nnn can:
- open any file in the default desktop application or a custom one
- navigate-as-you-type (search-as-you-type enabled even on directory
switch)
- check disk usage with number of files in current directory tree
- run desktop search utility (gnome-search-tool or catfish) in any
directory
- copy absolute file path to clipboard, spawn a terminal and use the file
path
- navigate instantly using shortcuts like ~, -, & or handy bookmarks
- use cd ..... at chdir prompt to go to a parent directory
- show detailed file stats, media info, list and extract archives
- pin a directory you may need to revisit and jump to it anytime
- lock the current terminal after a specified idle time
- change directory on exit
WWW: https://github.com/jarun/nnn