aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2021-09-09 22:11:07 +0200
committerStephan Seitz <stephan.seitz@fau.de>2022-01-23 16:27:25 +0100
commita37c97545f23eef90f833be634ef1f3db93af0ca (patch)
tree4d38a265f9702a958c5c63417229fab692c129dd /lua
parentAdd tree-sitter-norg (diff)
downloadnvim-treesitter-a37c97545f23eef90f833be634ef1f3db93af0ca.tar
nvim-treesitter-a37c97545f23eef90f833be634ef1f3db93af0ca.tar.gz
nvim-treesitter-a37c97545f23eef90f833be634ef1f3db93af0ca.tar.bz2
nvim-treesitter-a37c97545f23eef90f833be634ef1f3db93af0ca.tar.lz
nvim-treesitter-a37c97545f23eef90f833be634ef1f3db93af0ca.tar.xz
nvim-treesitter-a37c97545f23eef90f833be634ef1f3db93af0ca.tar.zst
nvim-treesitter-a37c97545f23eef90f833be634ef1f3db93af0ca.zip
Allow compilation via makefile
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/install.lua10
-rw-r--r--lua/nvim-treesitter/parsers.lua1
-rw-r--r--lua/nvim-treesitter/shell_command_selectors.lua24
3 files changed, 26 insertions, 9 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index 4b187f74c..b16143950 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -325,15 +325,7 @@ local function run_install(cache_folder, install_folder, lang, repo, with_sync,
})
end
vim.list_extend(command_list, {
- {
- cmd = cc,
- info = "Compiling...",
- err = "Error during compilation",
- opts = {
- args = vim.tbl_flatten(shell.select_compiler_args(repo, cc)),
- cwd = compile_location,
- },
- },
+ shell.select_compile_command(repo, cc, compile_location),
shell.select_mv_cmd("parser.so", parser_lib_name, compile_location),
{
cmd = function()
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 5d944ecc5..bfa4ccc86 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -896,6 +896,7 @@ list.norg = {
url = "https://github.com/vhyrro/tree-sitter-norg",
branch = "main",
files = { "src/parser.c", "src/scanner.cc" },
+ use_makefile = true,
},
maintainers = { "@JoeyGrajciar", "@vhyrro" },
}
diff --git a/lua/nvim-treesitter/shell_command_selectors.lua b/lua/nvim-treesitter/shell_command_selectors.lua
index ee784312c..fb322e014 100644
--- a/lua/nvim-treesitter/shell_command_selectors.lua
+++ b/lua/nvim-treesitter/shell_command_selectors.lua
@@ -93,6 +93,30 @@ function M.select_compiler_args(repo, compiler)
end
end
+function M.select_compile_command(repo, cc, compile_location)
+ if string.match(cc, "cl$") or string.match(cc, "cl.exe$") or not repo.use_makefile then
+ return {
+ cmd = cc,
+ info = "Compiling...",
+ err = "Error during compilation",
+ opts = {
+ args = vim.tbl_flatten(M.select_compiler_args(repo, cc)),
+ cwd = compile_location,
+ },
+ }
+ else
+ return {
+ cmd = "make",
+ info = "Compiling...",
+ err = "Error during compilation",
+ opts = {
+ args = { "--makefile=" .. utils.join_path(utils.get_package_path(), "scripts", "compile_parsers.makefile"), "CC=" .. cc },
+ cwd = compile_location,
+ },
+ }
+ end
+end
+
function M.select_install_rm_cmd(cache_folder, project_name)
if fn.has "win32" == 1 then
local dir = cache_folder .. "\\" .. project_name