Annotation of pkgsrc/lang/lua/module.mk, revision 1.14

1.14    ! nia         1: # $NetBSD: module.mk,v 1.13 2022/02/19 20:39:58 nia Exp $
1.1       minskim     2: #
                      3: # This Makefile fragment is intended to be included by packages that
1.6       alnsn       4: # install Lua modules.
                      5: #
1.9       nia         6: # === Package-settable variables ===
                      7: #
                      8: # LUA_LINKER_MAGIC
                      9: #      This appends LDFLAGS to properly link Lua modules on non-ELF
                     10: #      linkers.
                     11: #
                     12: #      You probably want to set this to "no" if the package links
                     13: #      binaries that are not Lua modules.
                     14: #
                     15: #      Possible values: yes no
                     16: #      Default: yes
                     17: #
1.13      nia        18: # LUA_USE_BUSTED
                     19: #      Use busted to run tests and provide a do-test target.
                     20: #
                     21: #      Possible values: yes no
1.14    ! nia        22: #      Default: no
        !            23: #
        !            24: # LUA_BUSTED_ARGS
        !            25: #      Arguments to pass to the busted command when LUA_USE_BUSTED.
1.13      nia        26: #
1.6       alnsn      27: # === Defined variables ===
                     28: #
                     29: # LUA_LDIR
                     30: #      Path where Lua modules are installed.
                     31: #
                     32: # LUA_CDIR
                     33: #      Path where Lua C modules are installed. Not defined if
                     34: #      NO_BUILD variable is set to "yes".
                     35: #
                     36: # LUA_DOCDIR
                     37: #      Path where documentation files are installed.
                     38: #
                     39: # LUA_EXAMPLESDIR
                     40: #      Path where example files are installed.
                     41: #
                     42: # Keywords: lua
                     43: #
1.1       minskim    44: 
                     45: .if !defined(LUA_MODULE_MK)
                     46: LUA_MODULE_MK= # defined
                     47: 
1.6       alnsn      48: .if !defined(LUA_LUAVERSION_MK)
1.5       dholland   49: .include "../../lang/lua/luaversion.mk"
1.6       alnsn      50: .endif
1.1       minskim    51: 
1.5       dholland   52: LUA_LDIR=      share/lua/${_LUA_DOT_VERSION}
1.1       minskim    53: PLIST_SUBST+=  LUA_LDIR=${LUA_LDIR}
                     54: 
1.6       alnsn      55: PRINT_PLIST_AWK+=      /^${LUA_LDIR:S|/|\\/|g}/ \
                     56:                        { gsub(/${LUA_LDIR:S|/|\\/|g}/, "$${LUA_LDIR}") }
                     57: 
1.1       minskim    58: .if defined(NO_BUILD) && empty(NO_BUILD:M[Nn][Oo])
1.5       dholland   59: DEPENDS+=      ${LUA_BASEDEPENDS}
                     60: 
1.1       minskim    61: .else
1.5       dholland   62: LUA_CDIR=      lib/lua/${_LUA_DOT_VERSION}
1.1       minskim    63: PLIST_SUBST+=  LUA_CDIR=${LUA_CDIR}
                     64: 
1.4       joerg      65: PRINT_PLIST_AWK+=      /^${LUA_CDIR:S|/|\\/|g}/ \
                     66:                        { gsub(/${LUA_CDIR:S|/|\\/|g}/, "$${LUA_CDIR}") }
                     67: 
1.5       dholland   68: .include "${LUA_PKGSRCDIR}/buildlink3.mk"
1.1       minskim    69: .endif
                     70: 
1.6       alnsn      71: LUA_DOCDIR=    share/doc/${PKGBASE}
                     72: PLIST_SUBST+=  LUA_DOCDIR=${LUA_DOCDIR}
                     73: 
1.8       nia        74: PRINT_PLIST_AWK+=      /^${LUA_DOCDIR:S|/|\\/|g}/ \
                     75:                        { gsub(/${LUA_DOCDIR:S|/|\\/|g}/, "$${LUA_DOCDIR}") }
                     76: 
1.6       alnsn      77: LUA_EXAMPLESDIR=       share/examples/${PKGBASE}
                     78: PLIST_SUBST+=          LUA_EXAMPLESDIR=${LUA_EXAMPLESDIR}
                     79: 
1.9       nia        80: LUA_LINKER_MAGIC?=     yes
                     81: 
                     82: .if !empty(LUA_LINKER_MAGIC:M[yY][eE][sS])
1.12      nia        83: BUILDLINK_TRANSFORM.Darwin+=   rm:-shared
                     84: LDFLAGS.Cygwin+=               -llua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
                     85: LDFLAGS.Darwin+=               -bundle -undefined dynamic_lookup
1.9       nia        86: .endif
1.7       ryoon      87: 
1.10      nia        88: .if ${_LUA_VERSION} != "51" && ${_LUA_VERSION} != "52"
                     89: # Any Lua>=5.3 module using these flags is invalid,
                     90: # since Lua 5.3 and newer require "long long".
1.11      nia        91: BUILDLINK_TRANSFORM+=  rm:-ansi
                     92: BUILDLINK_TRANSFORM+=  rm:-std=c89
                     93: BUILDLINK_TRANSFORM+=  rm:-std=c90
1.10      nia        94: .endif
                     95: 
1.14    ! nia        96: LUA_USE_BUSTED?=       no
        !            97: 
1.13      nia        98: .if !empty(LUA_USE_BUSTED:M[yY][eE][sS])
                     99: TEST_DEPENDS+= ${LUA_PKGPREFIX}-busted-[0-9]*:../../devel/lua-busted
                    100: 
                    101: do-test:
1.14    ! nia       102:        cd ${WRKSRC} && ${TEST_ENV} \
        !           103:            ${PREFIX}/bin/busted${_LUA_DOT_VERSION} \
        !           104:            ${LUA_BUSTED_ARGS}
1.13      nia       105: .endif # LUA_USE_BUSTED
                    106: 
                    107: .endif # LUA_MODULE_MK

CVSweb <webmaster@jp.NetBSD.org>