openbsd-ports/lang/lua/lua.port.mk

129 lines
3.2 KiB
Makefile
Raw Normal View History

# $OpenBSD: lua.port.mk,v 1.33 2015/10/18 20:20:50 sthen Exp $
2015-07-14 23:14:42 +00:00
CATEGORIES += lang/lua
#
# Handle multiple versions/flavors.
# Defaults to MODLUA_DEFAULT_VERSION if no FLAVOR is set.
#
# Define the default version and use that if MODLUA_VERSION is not set.
2015-07-14 23:14:42 +00:00
MODLUA_DEFAULT_VERSION = 5.1
# If a port already has flavors, append our lua flavors to it, unless it
# requests a specific version of lua. Otherwise set the FLAVORS list to
# just the lua flavors.
.if !defined(MODLUA_VERSION)
. if !defined(FLAVORS)
2015-07-14 23:14:42 +00:00
FLAVORS ?= lua52 lua53
. else
2015-07-14 23:14:42 +00:00
FLAVORS += lua52 lua53
. endif
.endif
2015-07-14 23:14:42 +00:00
FLAVOR ?= # empty
2012-07-11 10:06:11 +00:00
# without a flavor, assume ${MODLUA_DEFAULT_VERSION}
.if ${FLAVOR:Mlua52}
2015-07-14 23:14:42 +00:00
MODLUA_VERSION = 5.2
2015-01-14 20:07:45 +00:00
.elif ${FLAVOR:Mlua53}
2015-07-14 23:14:42 +00:00
MODLUA_VERSION = 5.3
2012-07-11 10:10:57 +00:00
.else
2015-07-14 23:14:42 +00:00
MODLUA_VERSION ?= ${MODLUA_DEFAULT_VERSION}
.endif
2012-07-10 18:34:26 +00:00
.if "${MODLUA_VERSION}" == "5.1"
2015-07-14 23:14:42 +00:00
_MODLUA_PKG_PREFIX = lua
MODLUA_FLAVOR = # empty
2012-07-10 18:34:26 +00:00
.elif "${MODLUA_VERSION}" == "5.2"
2015-07-14 23:14:42 +00:00
_MODLUA_PKG_PREFIX = lua52
MODLUA_FLAVOR = lua52
2015-01-14 20:07:45 +00:00
.elif "${MODLUA_VERSION}" == "5.3"
2015-07-14 23:14:42 +00:00
_MODLUA_PKG_PREFIX = lua53
MODLUA_FLAVOR = lua53
2012-07-11 10:10:57 +00:00
.else
2015-07-14 23:14:42 +00:00
ERRORS += "Invalid MODLUA_VERSION set: ${MODLUA_VERSION}."
.endif
# Based on lua version, adjust the prefix. But don't change the prefix
# of default (5.1) packages. Unless it's just a standalone application
# that happens to embed lua (in which case MODLUA_SA needs to be set
# and we'll just append the flavor suffix.
2015-07-14 23:14:42 +00:00
MODLUA_SA ?= No
2012-07-10 18:34:26 +00:00
.if "${MODLUA_VERSION}" != "5.1"
.if !${MODLUA_SA:L:Myes}
2015-07-14 23:14:42 +00:00
FULLPKGNAME ?= ${PKGNAME:S/^lua/${_MODLUA_PKG_PREFIX}/}
.endif
.endif
#
# Shorthand variables used for common tasks, e.g. pkg-config use ${MODLUA_DEP}.
#
2015-07-14 23:14:42 +00:00
MODLUA_DEP_VERSION ?= ${MODLUA_VERSION:S/.//g}
MODLUA_DEP = lua${MODLUA_DEP_VERSION}
2015-07-14 23:14:42 +00:00
MODLUA_WANTLIB = lua${MODLUA_VERSION}
MODLUA_LIB = -l${MODLUA_WANTLIB}
2015-07-14 23:14:42 +00:00
_MODLUA_RUN_DEPENDS = lang/lua/${MODLUA_VERSION}
2015-07-14 23:14:42 +00:00
MODLUA_LIB_DEPENDS = ${_MODLUA_RUN_DEPENDS}
2013-06-02 16:59:48 +00:00
2015-07-14 23:14:42 +00:00
MODLUA_BIN = ${LOCALBASE}/bin/lua${MODLUA_DEP_VERSION}
# Propagate the flavor to all dependencies
.for r in ${MODLUA_RUN_DEPENDS}
2015-07-14 23:14:42 +00:00
_MODLUA_RUN_DEPS += ${r},${MODLUA_FLAVOR}
.endfor
.for b in ${MODLUA_BUILD_DEPENDS}
2015-07-14 23:14:42 +00:00
_MODLUA_BUILD_DEPENDS += ${b},${MODLUA_FLAVOR}
.endfor
2013-03-11 11:20:26 +00:00
.for x in ${MODLUA_TEST_DEPENDS}
2015-07-14 23:14:42 +00:00
_MODLUA_TEST_DEPENDS +=${x},${MODLUA_FLAVOR}
.endfor
#
# Default directories
#
# Where the lua distribution headers have been installed to.
2015-07-14 23:14:42 +00:00
MODLUA_INCL_DIR = ${LOCALBASE}/include/lua-${MODLUA_VERSION}/
2012-05-15 15:11:06 +00:00
# Where the example will be installed
2015-07-14 23:14:42 +00:00
MODLUA_EXAMPLEDIR = ${PREFIX}/share/examples/${FULLPKGNAME}/
2012-05-15 15:11:06 +00:00
# Where the docs will be installed
2015-07-14 23:14:42 +00:00
MODLUA_DOCDIR = ${PREFIX}/share/doc/${FULLPKGNAME}/
# Where the lua libraries will be installed to
2015-07-14 23:14:42 +00:00
MODLUA_LIBDIR = ${PREFIX}/lib/lua/${MODLUA_VERSION}/
# Where the lua modules will be installed to
2015-07-14 23:14:42 +00:00
MODLUA_DATADIR = ${PREFIX}/share/lua/${MODLUA_VERSION}/
#
# Fixup run/build dependencies if needed
#
2015-07-14 23:14:42 +00:00
MODLUA_RUNDEP ?= Yes
MODLUA_BUILDDEP ?= Yes
2012-05-15 19:24:21 +00:00
.if ${MODLUA_RUNDEP:L} == yes
2015-07-14 23:14:42 +00:00
RUN_DEPENDS += ${_MODLUA_RUN_DEPENDS} \
${_MODLUA_RUN_DEPS}
.endif
2012-07-10 18:34:26 +00:00
.if ${NO_BUILD:L} == "no" && "${MODLUA_BUILDDEP:L}" == "yes"
2015-07-14 23:14:42 +00:00
BUILD_DEPENDS += ${_MODLUA_BUILD_DEPENDS} \
${_MODLUA_RUN_DEPENDS}
.endif
2015-07-14 23:14:42 +00:00
TEST_DEPENDS += ${_MODLUA_TEST_DEPENDS}
2015-07-14 23:14:42 +00:00
SUBST_VARS += MODLUA_VERSION MODLUA_LIB MODLUA_INCL_DIR \
MODLUA_EXAMPLEDIR MODLUA_DOCDIR MODLUA_LIBDIR \
MODLUA_DATADIR MODLUA_DEP MODLUA_DEP_VERSION \
MODLUA_BIN