# $OpenBSD$

COMMENT =	package manager for lua

DISTNAME =	luarocks-3.7.0

CATEGORIES =	devel

HOMEPAGE =	https://luarocks.org/

MAINTAINER =	Omar Polo <op@omarpolo.com>

# MIT
PERMIT_PACKAGE =	Yes

MASTER_SITES =		https://luarocks.org/releases/

MODULES =		lang/lua
MODLUA_SA =		Yes

RUN_DEPENDS =		archivers/zip \
			net/curl

FLAVORS =		lua51 lua52 lua53
FLAVOR ?=

USE_GMAKE =		Yes
MAKE_FILE =		GNUmakefile

CONFIGURE_STYLE =	simple
CONFIGURE_ARGS =	--with-lua-include=${MODLUA_INCL_DIR} \
			--with-lua-lib=${LOCALBASE}/lib \
			--sysconfdir=${PREFIX}/share/examples/luarocks \
			--lua-version=${MODLUA_VERSION}

NO_TEST =		Yes

ALL_TARGET =		build

post-configure:
	sed -i 's,/usr/bin/env lua,${MODLUA_BIN},g' ${WRKSRC}/src/bin/*

post-install:
	cd ${PREFIX}/bin && \
		mv luarocks luarocks-${MODLUA_VERSION} && \
		mv luarocks-admin luarocks-admin-${MODLUA_VERSION}

.include <bsd.port.mk>
