summaryrefslogtreecommitdiff
path: root/time/todotxt/Makefile
blob: dd3026f2c95a523a028bf293f9664ee52a5825c1 (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
# $NetBSD: Makefile,v 1.2 2018/04/25 15:23:55 leot Exp $

DISTNAME=	todotxt-2.11.0
CATEGORIES=	time
MASTER_SITES=	${MASTER_SITE_GITHUB:=todotxt/}
GITHUB_PROJECT=	todo.txt-cli
GITHUB_TAG=	v${PKGVERSION_NOREV}

MAINTAINER=	leot@NetBSD.org
HOMEPAGE=	http://todotxt.org/
COMMENT=	Simple and extensible shell script for managing your todo.txt file
LICENSE=	gnu-gpl-v3

USE_TOOLS+=	bash:run gmake:test gsed:run

SUBST_CLASSES+=		todosh
SUBST_STAGE.todosh=	pre-configure
SUBST_MESSAGE.todosh=	Adjusting hard-coded paths, version and use GNU sed
SUBST_FILES.todosh+=	todo.sh
SUBST_SED.todosh+=	-e '/TODOTXT_GLOBAL_CFG_FILE=/ s,/etc/todo/config,${PKG_SYSCONFDIR}/todo.cfg,'
SUBST_SED.todosh+=	-E -e 's,([(| ])sed ,\1${TOOLS_PATH.gsed} ,g'
SUBST_SED.todosh+=	-e 's,@DEV_VERSION@,${PKGVERSION_NOREV},g'

SUBST_CLASSES+=		todocfg
SUBST_STAGE.todocfg=	pre-configure
SUBST_MESSAGE.todocfg=	Adjusting TOOL_DIR path to user's HOME
SUBST_FILES.todocfg+=	todo.cfg
SUBST_SED.todocfg+=	-e '/^export TODO_DIR/ s,=.*,=$$HOME/.todo,'

# XXX: REPLACE_BASH only affect the `#!' on the first line, so we need to
# XXX: manually adjust the other in the middle of the shell script.
SUBST_CLASSES+=		shebang
SUBST_STAGE.shebang=	pre-configure
SUBST_MESSAGE.shebang=	Replace hardcoded /bin/bash in the middle of scripts
SUBST_FILES.shebang+=	tests/actions-test-lib.sh
SUBST_SED.shebang+=	-e '2,$$s;!/bin/bash;!${BASH};'

REPLACE_BASH+=	todo.sh
REPLACE_BASH+=	tests/*.sh

USE_LANGUAGES=	# none

NO_BUILD=	yes

EGDIR=		${PREFIX}/share/examples/todotxt
DOCDIR=		${PREFIX}/share/doc/todotxt

PKG_SYSCONFSUBDIR=	todotxt
CONF_FILES=		${EGDIR}/todo.cfg \
			${PKG_SYSCONFDIR}/todo.cfg

TEST_TARGET=	test

INSTALLATION_DIRS=	bin ${DOCDIR} ${EGDIR}

do-install:
	${INSTALL_SCRIPT} ${WRKSRC}/todo.sh ${DESTDIR}${PREFIX}/bin
	${INSTALL_DATA} ${WRKSRC}/todo.cfg ${DESTDIR}${EGDIR}
	${INSTALL_DATA} ${WRKSRC}/todo_completion ${DESTDIR}${EGDIR}
	${INSTALL_DATA} ${WRKSRC}/README.md ${DESTDIR}${DOCDIR}
	${INSTALL_DATA} ${WRKSRC}/USAGE.md ${DESTDIR}${DOCDIR}

.include "../../mk/bsd.pkg.mk"