lua.port.mk 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # $OpenBSD: lua.port.mk,v 1.35 2016/10/31 18:46:09 jca Exp $
  2. CATEGORIES += lang/lua
  3. #
  4. # Handle multiple versions/flavors.
  5. # Defaults to MODLUA_DEFAULT_VERSION if no FLAVOR is set.
  6. #
  7. # Define the default version and use that if MODLUA_VERSION is not set.
  8. MODLUA_DEFAULT_VERSION = 5.1
  9. FLAVOR ?= # empty
  10. # without a flavor, assume ${MODLUA_DEFAULT_VERSION}
  11. .if ${FLAVOR:Mlua52}
  12. MODLUA_VERSION = 5.2
  13. .elif ${FLAVOR:Mlua53}
  14. MODLUA_VERSION = 5.3
  15. .else
  16. MODLUA_VERSION ?= ${MODLUA_DEFAULT_VERSION}
  17. .endif
  18. .if "${MODLUA_VERSION}" == "5.1"
  19. _MODLUA_PKG_PREFIX = lua
  20. MODLUA_FLAVOR = # empty
  21. .elif "${MODLUA_VERSION}" == "5.2"
  22. _MODLUA_PKG_PREFIX = lua52
  23. MODLUA_FLAVOR = lua52
  24. .elif "${MODLUA_VERSION}" == "5.3"
  25. _MODLUA_PKG_PREFIX = lua53
  26. MODLUA_FLAVOR = lua53
  27. .else
  28. ERRORS += "Invalid MODLUA_VERSION set: ${MODLUA_VERSION}."
  29. .endif
  30. # Based on lua version, adjust the prefix. But don't change the prefix
  31. # of default (5.1) packages. Unless it's just a standalone application
  32. # that happens to embed lua (in which case MODLUA_SA needs to be set
  33. # and we'll just append the flavor suffix.
  34. MODLUA_SA ?= No
  35. .if "${MODLUA_VERSION}" != "5.1"
  36. .if !${MODLUA_SA:L:Myes}
  37. FULLPKGNAME ?= ${PKGNAME:S/^lua/${_MODLUA_PKG_PREFIX}/}
  38. .endif
  39. .endif
  40. #
  41. # Shorthand variables used for common tasks, e.g. pkg-config use ${MODLUA_DEP}.
  42. #
  43. MODLUA_DEP_VERSION ?= ${MODLUA_VERSION:S/.//g}
  44. MODLUA_DEP = lua${MODLUA_DEP_VERSION}
  45. MODLUA_WANTLIB = lua${MODLUA_VERSION}
  46. MODLUA_LIB = -l${MODLUA_WANTLIB}
  47. _MODLUA_RUN_DEPENDS = lang/lua/${MODLUA_VERSION}
  48. MODLUA_LIB_DEPENDS = ${_MODLUA_RUN_DEPENDS}
  49. MODLUA_BIN = ${LOCALBASE}/bin/lua${MODLUA_DEP_VERSION}
  50. # Propagate the flavor to all dependencies
  51. .for r in ${MODLUA_RUN_DEPENDS}
  52. _MODLUA_RUN_DEPS += ${r},${MODLUA_FLAVOR}
  53. .endfor
  54. .for b in ${MODLUA_BUILD_DEPENDS}
  55. _MODLUA_BUILD_DEPENDS += ${b},${MODLUA_FLAVOR}
  56. .endfor
  57. .for x in ${MODLUA_TEST_DEPENDS}
  58. _MODLUA_TEST_DEPENDS +=${x},${MODLUA_FLAVOR}
  59. .endfor
  60. #
  61. # Default directories
  62. #
  63. # Where the lua distribution headers have been installed to.
  64. MODLUA_INCL_DIR = ${LOCALBASE}/include/lua-${MODLUA_VERSION}/
  65. # Where the example will be installed
  66. MODLUA_EXAMPLEDIR = ${PREFIX}/share/examples/${FULLPKGNAME}/
  67. # Where the docs will be installed
  68. MODLUA_DOCDIR = ${PREFIX}/share/doc/${FULLPKGNAME}/
  69. # Where the lua libraries will be installed to
  70. MODLUA_LIBDIR = ${PREFIX}/lib/lua/${MODLUA_VERSION}/
  71. # Where the lua modules will be installed to
  72. MODLUA_DATADIR = ${PREFIX}/share/lua/${MODLUA_VERSION}/
  73. #
  74. # Fixup run/build dependencies if needed
  75. #
  76. MODLUA_RUNDEP ?= Yes
  77. MODLUA_BUILDDEP ?= Yes
  78. .if ${MODLUA_RUNDEP:L} == yes
  79. RUN_DEPENDS += ${_MODLUA_RUN_DEPENDS} \
  80. ${_MODLUA_RUN_DEPS}
  81. .endif
  82. .if ${NO_BUILD:L} == "no" && "${MODLUA_BUILDDEP:L}" == "yes"
  83. BUILD_DEPENDS += ${_MODLUA_BUILD_DEPENDS} \
  84. ${_MODLUA_RUN_DEPENDS}
  85. .endif
  86. TEST_DEPENDS += ${_MODLUA_TEST_DEPENDS}
  87. SUBST_VARS += MODLUA_VERSION MODLUA_LIB MODLUA_INCL_DIR \
  88. MODLUA_EXAMPLEDIR MODLUA_DOCDIR MODLUA_LIBDIR \
  89. MODLUA_DATADIR MODLUA_DEP MODLUA_DEP_VERSION \
  90. MODLUA_BIN