mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(build): distinguish vim.mpack from global require'mpack'
problem: the api of vim.mpack is not compatible with a system provided mpack solution: don't require 'mpack' directly from the system path
This commit is contained in:
parent
dbcd1985d1
commit
ffaf74f147
@ -1,4 +1,4 @@
|
|||||||
local mpack = require('mpack')
|
local mpack = vim.mpack
|
||||||
|
|
||||||
if arg[1] == '--help' then
|
if arg[1] == '--help' then
|
||||||
print('Usage: lua genvimvim.lua src/nvim runtime/syntax/vim/generated.vim')
|
print('Usage: lua genvimvim.lua src/nvim runtime/syntax/vim/generated.vim')
|
||||||
|
@ -1171,9 +1171,6 @@ static const luaL_reg mpack_functions[] = {
|
|||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef NLUA_WIN32
|
|
||||||
__declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
int luaopen_mpack(lua_State *L)
|
int luaopen_mpack(lua_State *L)
|
||||||
{
|
{
|
||||||
/* Unpacker */
|
/* Unpacker */
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
|
|
||||||
#ifdef NLUA_WIN32
|
|
||||||
__declspec(dllexport)
|
|
||||||
#endif
|
|
||||||
int luaopen_mpack(lua_State *L);
|
int luaopen_mpack(lua_State *L);
|
||||||
|
13
src/nlua0.c
Normal file
13
src/nlua0.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include <lua.h>
|
||||||
|
|
||||||
|
#include "mpack/lmpack.h"
|
||||||
|
|
||||||
|
LUA_API int luaopen_nlua0(lua_State* L);
|
||||||
|
|
||||||
|
LUA_API int luaopen_nlua0(lua_State* L) {
|
||||||
|
lua_getglobal(L, "vim");
|
||||||
|
luaopen_mpack(L);
|
||||||
|
lua_setfield(L, -2, "mpack");
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
@ -15,7 +15,7 @@ endif()
|
|||||||
|
|
||||||
add_library(nlua0 MODULE)
|
add_library(nlua0 MODULE)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_compile_definitions(nlua0 PUBLIC LUA_BUILD_AS_DLL NLUA_WIN32)
|
target_compile_definitions(nlua0 PUBLIC LUA_BUILD_AS_DLL LUA_LIB)
|
||||||
set_target_properties(nlua0 PROPERTIES ENABLE_EXPORTS TRUE)
|
set_target_properties(nlua0 PROPERTIES ENABLE_EXPORTS TRUE)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set_target_properties(nlua0 PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
set_target_properties(nlua0 PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||||
@ -322,6 +322,7 @@ if(PREFER_LUA)
|
|||||||
target_compile_definitions(main_lib INTERFACE NVIM_VENDOR_BIT)
|
target_compile_definitions(main_lib INTERFACE NVIM_VENDOR_BIT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
list(APPEND NLUA0_SOURCES ${PROJECT_SOURCE_DIR}/src/nlua0.c)
|
||||||
foreach(subdir
|
foreach(subdir
|
||||||
os
|
os
|
||||||
api
|
api
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
local mpack = require('mpack')
|
local mpack = vim.mpack
|
||||||
|
|
||||||
local hashy = require'generators.hashy'
|
local hashy = require'generators.hashy'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
local mpack = require('mpack')
|
local mpack = vim.mpack
|
||||||
|
|
||||||
assert(#arg == 5)
|
assert(#arg == 5)
|
||||||
local input = io.open(arg[1], 'rb')
|
local input = io.open(arg[1], 'rb')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
local mpack = require('mpack')
|
local mpack = vim.mpack
|
||||||
|
|
||||||
local autodir = arg[1]
|
local autodir = arg[1]
|
||||||
local metadata_file = arg[2]
|
local metadata_file = arg[2]
|
||||||
|
@ -4,6 +4,7 @@ package.path = srcdir .. '/src/nvim/?.lua;' ..srcdir .. '/runtime/lua/?.lua;' ..
|
|||||||
_G.vim = require'vim.shared'
|
_G.vim = require'vim.shared'
|
||||||
_G.vim.inspect = require 'vim.inspect'
|
_G.vim.inspect = require 'vim.inspect'
|
||||||
package.cpath = package.cpath .. ';' .. nlualib
|
package.cpath = package.cpath .. ';' .. nlualib
|
||||||
|
require 'nlua0'
|
||||||
|
|
||||||
arg[0] = table.remove(arg, 1)
|
arg[0] = table.remove(arg, 1)
|
||||||
return loadfile(arg[0])()
|
return loadfile(arg[0])()
|
||||||
|
Loading…
Reference in New Issue
Block a user