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

1.13    ! nia         1: # $NetBSD: module.mk,v 1.12 2021/12/06 18:54:32 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
        !            22: #      Default: yes
        !            23: #
1.6       alnsn      24: # === Defined variables ===
                     25: #
                     26: # LUA_LDIR
                     27: #      Path where Lua modules are installed.
                     28: #
                     29: # LUA_CDIR
                     30: #      Path where Lua C modules are installed. Not defined if
                     31: #      NO_BUILD variable is set to "yes".
                     32: #
                     33: # LUA_DOCDIR
                     34: #      Path where documentation files are installed.
                     35: #
                     36: # LUA_EXAMPLESDIR
                     37: #      Path where example files are installed.
                     38: #
                     39: # Keywords: lua
                     40: #
1.1       minskim    41: 
                     42: .if !defined(LUA_MODULE_MK)
                     43: LUA_MODULE_MK= # defined
                     44: 
1.6       alnsn      45: .if !defined(LUA_LUAVERSION_MK)
1.5       dholland   46: .include "../../lang/lua/luaversion.mk"
1.6       alnsn      47: .endif
1.1       minskim    48: 
1.5       dholland   49: LUA_LDIR=      share/lua/${_LUA_DOT_VERSION}
1.1       minskim    50: PLIST_SUBST+=  LUA_LDIR=${LUA_LDIR}
                     51: 
1.6       alnsn      52: PRINT_PLIST_AWK+=      /^${LUA_LDIR:S|/|\\/|g}/ \
                     53:                        { gsub(/${LUA_LDIR:S|/|\\/|g}/, "$${LUA_LDIR}") }
                     54: 
1.1       minskim    55: .if defined(NO_BUILD) && empty(NO_BUILD:M[Nn][Oo])
1.5       dholland   56: DEPENDS+=      ${LUA_BASEDEPENDS}
                     57: 
1.1       minskim    58: .else
1.5       dholland   59: LUA_CDIR=      lib/lua/${_LUA_DOT_VERSION}
1.1       minskim    60: PLIST_SUBST+=  LUA_CDIR=${LUA_CDIR}
                     61: 
1.4       joerg      62: PRINT_PLIST_AWK+=      /^${LUA_CDIR:S|/|\\/|g}/ \
                     63:                        { gsub(/${LUA_CDIR:S|/|\\/|g}/, "$${LUA_CDIR}") }
                     64: 
1.5       dholland   65: .include "${LUA_PKGSRCDIR}/buildlink3.mk"
1.1       minskim    66: .endif
                     67: 
1.6       alnsn      68: LUA_DOCDIR=    share/doc/${PKGBASE}
                     69: PLIST_SUBST+=  LUA_DOCDIR=${LUA_DOCDIR}
                     70: 
1.8       nia        71: PRINT_PLIST_AWK+=      /^${LUA_DOCDIR:S|/|\\/|g}/ \
                     72:                        { gsub(/${LUA_DOCDIR:S|/|\\/|g}/, "$${LUA_DOCDIR}") }
                     73: 
1.6       alnsn      74: LUA_EXAMPLESDIR=       share/examples/${PKGBASE}
                     75: PLIST_SUBST+=          LUA_EXAMPLESDIR=${LUA_EXAMPLESDIR}
                     76: 
1.9       nia        77: LUA_LINKER_MAGIC?=     yes
                     78: 
                     79: .if !empty(LUA_LINKER_MAGIC:M[yY][eE][sS])
1.12      nia        80: BUILDLINK_TRANSFORM.Darwin+=   rm:-shared
                     81: LDFLAGS.Cygwin+=               -llua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
                     82: LDFLAGS.Darwin+=               -bundle -undefined dynamic_lookup
1.9       nia        83: .endif
1.7       ryoon      84: 
1.10      nia        85: .if ${_LUA_VERSION} != "51" && ${_LUA_VERSION} != "52"
                     86: # Any Lua>=5.3 module using these flags is invalid,
                     87: # since Lua 5.3 and newer require "long long".
1.11      nia        88: BUILDLINK_TRANSFORM+=  rm:-ansi
                     89: BUILDLINK_TRANSFORM+=  rm:-std=c89
                     90: BUILDLINK_TRANSFORM+=  rm:-std=c90
1.10      nia        91: .endif
                     92: 
1.13    ! nia        93: .if !empty(LUA_USE_BUSTED:M[yY][eE][sS])
        !            94: TEST_DEPENDS+= ${LUA_PKGPREFIX}-busted-[0-9]*:../../devel/lua-busted
        !            95: 
        !            96: do-test:
        !            97:        cd ${WRKSRC} && ${PREFIX}/bin/busted${_LUA_DOT_VERSION}
        !            98: .endif # LUA_USE_BUSTED
        !            99: 
        !           100: .endif # LUA_MODULE_MK

CVSweb <webmaster@jp.NetBSD.org>