Skip to content

Commit 50cef62

Browse files
authored
Merge pull request #1635 from ychin/ci-fix-homebrew-iconv-and-lua-5.5
Fix Homebrew iconv builds and Lua 5.5 dynamic builds
2 parents 4c57525 + 859d963 commit 50cef62

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

.github/workflows/macvim-buildtest.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,10 @@ jobs:
232232
sed -i.bak -f ci/config.mk.optimized.sed src/auto/config.mk
233233
fi
234234
235-
# Use Homebrew GNU libiconv since Apple iconv has been broken since macOS 14
236-
sed -i.bak -f ci/config.mk.brew-libiconv.sed src/auto/config.mk
235+
if ${{ inputs.publish == true }}; then
236+
# Use Homebrew GNU libiconv since Apple iconv has been broken since macOS 14
237+
sed -i.bak -f ci/config.mk.brew-libiconv.sed src/auto/config.mk
238+
fi
237239
238240
- name: Modify configure result
239241
if: inputs.publish
@@ -284,9 +286,11 @@ jobs:
284286
echo 'Found external dynamic linkage!'; false
285287
fi
286288
287-
# Make sure we are not using system iconv, which has been buggy since macOS 14.
288-
if otool -L ${VIM_BIN} | grep '^\s*/usr/lib/libiconv'; then
289-
echo 'Using system iconv! We should be linking against GNU iconv instead.'; false
289+
if ${{ inputs.publish == true }}; then
290+
# Make sure we are not using system iconv, which has been buggy since macOS 14.
291+
if otool -L ${VIM_BIN} | grep '^\s*/usr/lib/libiconv'; then
292+
echo 'Using system iconv! We should be linking against GNU iconv instead.'; false
293+
fi
290294
fi
291295
292296
# Make sure that --disable-sparkle flag will properly exclude all references to Sparkle symbols. This is

src/if_lua.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ static void luaV_call_lua_func_free(void *state);
215215
# define luaopen_os dll_luaopen_os
216216
# define luaopen_package dll_luaopen_package
217217
# define luaopen_debug dll_luaopen_debug
218-
# define luaL_openlibs dll_luaL_openlibs
218+
# if LUA_VERSION_NUM >= 505
219+
# define luaL_openselectedlibs dll_luaL_openselectedlibs
220+
# else
221+
# define luaL_openlibs dll_luaL_openlibs
222+
# endif
219223

220224
// lauxlib
221225
# if LUA_VERSION_NUM <= 501
@@ -331,7 +335,11 @@ int (*dll_luaopen_io) (lua_State *L);
331335
int (*dll_luaopen_os) (lua_State *L);
332336
int (*dll_luaopen_package) (lua_State *L);
333337
int (*dll_luaopen_debug) (lua_State *L);
338+
# if LUA_VERSION_NUM >= 505
339+
void (*dll_luaL_openselectedlibs) (lua_State *L, int load, int preload);
340+
# else
334341
void (*dll_luaL_openlibs) (lua_State *L);
342+
# endif
335343

336344
typedef void **luaV_function;
337345
typedef struct {
@@ -439,7 +447,11 @@ static const luaV_Reg luaV_dll[] = {
439447
{"luaopen_os", (luaV_function) &dll_luaopen_os},
440448
{"luaopen_package", (luaV_function) &dll_luaopen_package},
441449
{"luaopen_debug", (luaV_function) &dll_luaopen_debug},
450+
# if LUA_VERSION_NUM >= 505
451+
{"luaL_openselectedlibs", (luaV_function) &dll_luaL_openselectedlibs},
452+
# else
442453
{"luaL_openlibs", (luaV_function) &dll_luaL_openlibs},
454+
# endif
443455
{NULL, NULL}
444456
};
445457

@@ -2571,7 +2583,11 @@ luaopen_vim(lua_State *L)
25712583
luaV_newstate(void)
25722584
{
25732585
lua_State *L = luaL_newstate();
2586+
# if LUA_VERSION_NUM >= 505
2587+
luaL_openselectedlibs(L, ~0, 0); // core libs
2588+
# else
25742589
luaL_openlibs(L); // core libs
2590+
# endif
25752591
lua_pushcfunction(L, luaopen_vim); // vim
25762592
lua_call(L, 0, 0);
25772593
return L;

0 commit comments

Comments
 (0)