Skip to content

Commit

Permalink
ci: actually make things build
Browse files Browse the repository at this point in the history
  • Loading branch information
xcb-xwii committed Oct 30, 2023
1 parent 3dd3186 commit 3dd695d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:
shell: msys2 {0}
strategy:
matrix:
lua_version: [lua, lua51]
lua:
- ver: lua
make_opts:
- ver: lua51
make_opts: LUA_INC=-I/mingw64/include/lua5.1 LIBS=-llua5.1
steps:
- uses: msys2/setup-msys2@v2
with:
Expand All @@ -22,32 +26,44 @@ jobs:
base-devel
git
mingw-w64-x86_64-gcc
mingw-w64-x86_64-${{ matrix.lua_version }}
mingw-w64-x86_64-${{ matrix.lua.ver }}
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build lua-tree-sitter
run: make lua_tree_sitter.dll
run: make lua_tree_sitter.dll ${{ matrix.lua.make_opts }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lua-tree-sitter-windows-x86_64-${{ matrix.lua_version }}
name: lua-tree-sitter-windows-x86_64-${{ matrix.lua.ver }}
path: lua_tree_sitter.dll

linux-x86_64:
name: Build for Linux x86_64
runs-on: ubuntu-latest
strategy:
matrix:
lua_version: [lua, lua51]
lua:
- ver: lua
make_opts:
- ver: lua51
make_opts: LUA_INC=-I/usr/include/lua5.1 LIBS=-llua5.1
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: 'Build'
uses: docker://archlinux:latest
with:
args: sh -c "pacman -Sy --noconfirm make gcc ${{ matrix.lua_version }} && make lua_tree_sitter.so"
args: >-
sh -c "
pacman -Sy --noconfirm make gcc ${{ matrix.lua.ver }} &&
make lua_tree_sitter.so ${{ matrix.lua.make_opts }}
"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lua-tree-sitter-linux-x86_64-${{ matrix.lua_version }}
name: lua-tree-sitter-linux-x86_64-${{ matrix.lua.ver }}
path: lua_tree_sitter.so
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ INC := -Iinclude -Itree-sitter/lib/include
LUA_INC :=
TS_INC := -Itree-sitter/lib/include -Itree-sitter/lib/src

CFLAGS := -O2 -Wall -Wextra -Werror -std=c99 -pedantic -fPIC
TS_CFLAGS := -O2 -Wall -Wextra -Werror -std=gnu99 -fPIC
CFLAGS := -O3 -Wall -Wextra -Werror -std=c99 -pedantic -fPIC
TS_CFLAGS := -O3 -Wall -Wextra -Werror -std=gnu99 -fPIC

LIBS :=
LIBS := -llua
POSIX_LIBS := -ldl

lua_tree_sitter.so: $(OBJ)
Expand Down
5 changes: 5 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#include <lts/tree.h>
#include <lts/util.h>

#ifdef _WIN32
__declspec (dllexport)
#else
__attribute ((visibility("default")))
#endif
int luaopen_lua_tree_sitter(lua_State *L) {
lua_createtable(L, 0, 0);

Expand Down
3 changes: 2 additions & 1 deletion src/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ static TSLanguage *load(
memcpy(sym + SYM_PREFIX_LEN, name, name_len);

#ifdef _WIN32
TSLanguage *(*lang_func)(void) = GetProcAddress(dl, sym);
TSLanguage *(*lang_func)(void) =
(TSLanguage *(*)(void)) (void (*)(void)) GetProcAddress(dl, sym);
#else
TSLanguage *(*lang_func)(void);
*((void **) &lang_func) = dlsym(dl, sym);
Expand Down

0 comments on commit 3dd695d

Please sign in to comment.