fix install by changing cc arguments position

This commit is contained in:
kiyan42 2020-04-27 15:27:59 +02:00
parent efd363f810
commit f8029cfc64

View file

@ -34,9 +34,9 @@ local function get_cache_dir()
end end
local function iter_cmd(cmd_list, i, ft) local function iter_cmd(cmd_list, i, ft)
if i == #cmd_list then return print('Treesitter parser for '..ft..' has been installed') end if i == #cmd_list + 1 then return print('Treesitter parser for '..ft..' has been installed') end
local attr = cmd_list[i + 1] local attr = cmd_list[i]
if attr.info then print(attr.info) end if attr.info then print(attr.info) end
handle = luv.spawn(attr.cmd, attr.opts, vim.schedule_wrap(function(code) handle = luv.spawn(attr.cmd, attr.opts, vim.schedule_wrap(function(code)
@ -76,12 +76,12 @@ local function run_install(cache_folder, package_path, ft, repo)
args = vim.tbl_flatten({ args = vim.tbl_flatten({
'-o', '-o',
'parser.so', 'parser.so',
'-I./src',
repo.files,
'-shared', '-shared',
'-Os',
'-lstdc++', '-lstdc++',
'-fPIC', '-fPIC',
'-Os',
'-I./src',
repo.files
}), }),
cwd = compile_location cwd = compile_location
} }
@ -100,7 +100,7 @@ local function run_install(cache_folder, package_path, ft, repo)
} }
} }
iter_cmd(command_list, 0, ft) iter_cmd(command_list, 1, ft)
end end
-- TODO(kyazdani): this should work on windows too -- TODO(kyazdani): this should work on windows too