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

1.15    ! hauke       1: # $NetBSD: module.mk,v 1.14 2022/03/06 09:13:44 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.15    ! hauke      80: PRINT_PLIST_AWK+=      /^${LUA_EXAMPLESDIR:S|/|\\/|g}/ \
        !            81:                        { gsub(/${LUA_EXAMPLESDIR:S|/|\\/|g}/, \
        !            82:                          "$${LUA_EXAMPLESDIR}") }
        !            83: 
1.9       nia        84: LUA_LINKER_MAGIC?=     yes
                     85: 
                     86: .if !empty(LUA_LINKER_MAGIC:M[yY][eE][sS])
1.12      nia        87: BUILDLINK_TRANSFORM.Darwin+=   rm:-shared
                     88: LDFLAGS.Cygwin+=               -llua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
                     89: LDFLAGS.Darwin+=               -bundle -undefined dynamic_lookup
1.9       nia        90: .endif
1.7       ryoon      91: 
1.10      nia        92: .if ${_LUA_VERSION} != "51" && ${_LUA_VERSION} != "52"
                     93: # Any Lua>=5.3 module using these flags is invalid,
                     94: # since Lua 5.3 and newer require "long long".
1.11      nia        95: BUILDLINK_TRANSFORM+=  rm:-ansi
                     96: BUILDLINK_TRANSFORM+=  rm:-std=c89
                     97: BUILDLINK_TRANSFORM+=  rm:-std=c90
1.10      nia        98: .endif
                     99: 
1.14      nia       100: LUA_USE_BUSTED?=       no
                    101: 
1.13      nia       102: .if !empty(LUA_USE_BUSTED:M[yY][eE][sS])
                    103: TEST_DEPENDS+= ${LUA_PKGPREFIX}-busted-[0-9]*:../../devel/lua-busted
                    104: 
                    105: do-test:
1.14      nia       106:        cd ${WRKSRC} && ${TEST_ENV} \
                    107:            ${PREFIX}/bin/busted${_LUA_DOT_VERSION} \
                    108:            ${LUA_BUSTED_ARGS}
1.13      nia       109: .endif # LUA_USE_BUSTED
                    110: 
                    111: .endif # LUA_MODULE_MK

CVSweb <webmaster@jp.NetBSD.org>