aboutsummaryrefslogtreecommitdiff
path: root/editors/mle/Makefile
blob: 2ad4b8052e3419b57ab7d2c0b4332f0f8c15870a (plain) (blame)
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
PORTNAME=	mle
DISTVERSIONPREFIX=	v
DISTVERSION=	1.5.0
CATEGORIES=	editors

MAINTAINER=	as@php.net
COMMENT=	Small, flexible, terminal-based text editor
WWW=		https://github.com/adsr/mle

LICENSE=	APACHE20
LICENSE_FILE=	${WRKSRC}/LICENSE

BUILD_DEPENDS=	${LOCALBASE}/include/uthash.h:devel/uthash
LIB_DEPENDS=	libpcre.so:devel/pcre
TEST_DEPENDS=	${LOCALBASE}/bin/gpaste:sysutils/coreutils \
		${LOCALBASE}/bin/grep:textproc/gnugrep \
		bash:shells/bash \
		gfind:misc/findutils

USES=		compiler:c11 gmake localbase:ldflags shebangfix lua:54
SHEBANG_FILES=	tests/func/*.sh tests/run.sh
USE_GITHUB=	yes
GH_ACCOUNT=	adsr

TEST_TARGET=	test
PLIST_FILES=	bin/mle

post-patch:
	@${REINPLACE_CMD} -e 's|lua5.4|lua54|g' ${WRKSRC}/mle.h
	@${REINPLACE_CMD} -e 's|lua5.4|lua-5.4|g' ${WRKSRC}/Makefile
	@${REINPLACE_CMD} -e 's|-O0|-O2|g' ${WRKSRC}/Makefile

	# Fix shell commands in tests
	@${REINPLACE_CMD} -e 's|find|gfind|g' \
		-e 's|grep|${LOCALBASE}/bin/grep|g' \
		${WRKSRC}/tests/run.sh \
		${WRKSRC}/tests/func/*.sh
	@${REINPLACE_CMD} -e 's|p a s t e|g p a s t e|g' \
		${WRKSRC}/tests/func/test_lua.sh

	# Remove assertion that relies on UTF-8 codeset (fixed upstream)
	@${REINPLACE_CMD} -e '/0wv/d' \
		${WRKSRC}/tests/unit/test_bline_insert.c

	# Remove assertions that rely on GNU tooling output
	@${REINPLACE_CMD} -e '/shell_line/d' \
		${WRKSRC}/tests/func/test_multi_cursor.sh
	@${REINPLACE_CMD} -e '/byte_count/d' \
		${WRKSRC}/tests/func/test_coarse_undo.sh

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/mle ${STAGEDIR}${PREFIX}/bin

pre-test:
	# Remove backup files generated by REINPLACE_CMD. Those must not exist
	# for the tests to run properly.
	@${FIND} ${WRKSRC}/tests -name '*.sh.bak' -delete

.include <bsd.port.mk>