summaryrefslogtreecommitdiff
path: root/sysutils/nnn/Makefile
blob: 1f779c26adcb486c542772a27b4d0c2ec144dcad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# $NetBSD: Makefile,v 1.20 2020/06/23 23:32:30 sjmulder Exp $

DISTNAME=	nnn-3.2
PKGREVISION=	2
CATEGORIES=	sysutils
MASTER_SITES=	${MASTER_SITE_GITHUB:=jarun/}
GITHUB_TAG=	v${PKGVERSION_NOREV}

MAINTAINER=	sjmulder@NetBSD.org
HOMEPAGE=	https://github.com/jarun/nnn/
COMMENT=	Optimized, feature-packed terminal file manager
LICENSE=	2-clause-bsd

USE_TOOLS+=	gmake pkg-config
USE_CURSES=	wide set_escdelay

INSTALLATION_DIRS+=	share/bash-completion/completions
INSTALLATION_DIRS+=	share/fish/vendor_completions.d
INSTALLATION_DIRS+=	share/zsh/site-functions

.include "../../mk/bsd.prefs.mk"

# NetBSD:
#   Prevent pulling in builtin termcap which conflicts with ncurses'
#   implementation, causing a crash at startup. See:
#   https://github.com/jarun/nnn/issues/445
#
# Illumos:
#   -lreadline links to system curses, causing conflicts with ncurses
.if ${OPSYS} == "NetBSD" || ${OPSYS} == "SunOS"
READLINE_DEFAULT=	readline
.endif

# clock_gettime() on older glibc (eg RHEL 6). See:
# https://github.com/jarun/nnn/issues/453
MAKE_ENV.Linux+=	LDLIBS=-lrt

CFLAGS.SunOS+=		-D__EXTENSIONS__

.include "../../mk/compiler.mk"

# nnn uses -std=c11 for `restrict` but c99 has it too, so use that on
# old GCC versions that don't support c11.
# https://github.com/jarun/nnn/issues/605
.if !empty(CC_VERSION:Mgcc-[123].*) || \
    !empty(CC_VERSION:Mgcc-4.[0123456].*)
SUBST_CLASSES+=		c11
SUBST_MESSAGE.c11=	Use c99 on old GCC instead of c11
SUBST_STAGE.c11=	pre-configure
SUBST_FILES.c11=	Makefile
SUBST_SED.c11=		-e 's/-std=c11/-std=c99/'
.endif

MAKE_ENV+=	MANPREFIX=${PREFIX}/${PKGMANDIR}
MAKE_ENV+=	CFLAGS_OPTIMIZATION=
MAKE_ENV+=	CFLAGS_CURSES=${BUILDLINK_CFLAGS.curses:Q}
MAKE_ENV+=	LDLIBS_CURSES=${BUILDLINK_LDADD.curses:Q}

post-install:
	${INSTALL_DATA} \
		${WRKSRC}/misc/auto-completion/bash/nnn-completion.bash \
		${DESTDIR}${PREFIX}/share/bash-completion/completions/nnn
	${INSTALL_DATA} \
		${WRKSRC}/misc/auto-completion/fish/nnn.fish \
		${DESTDIR}${PREFIX}/share/fish/vendor_completions.d/
	${INSTALL_DATA} \
		${WRKSRC}/misc/auto-completion/zsh/_nnn \
		${DESTDIR}${PREFIX}/share/zsh/site-functions

.include "options.mk"

.include "../../mk/curses.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"