diff options
| author | Apoorv Sachan <71246790+clitic@users.noreply.github.com> | 2022-12-08 19:40:45 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-08 11:10:45 -0300 |
| commit | 525a3bccf105190c4b78c5c8eee9821e9951583d (patch) | |
| tree | a08f97f64a5c2ba4cb46bcf66e1fc62edda899ca /src | |
| parent | 500aeba152d6da90331788885df99ea314081c6f (diff) | |
| download | luarocks-525a3bccf105190c4b78c5c8eee9821e9951583d.tar.gz luarocks-525a3bccf105190c4b78c5c8eee9821e9951583d.tar.bz2 luarocks-525a3bccf105190c4b78c5c8eee9821e9951583d.zip | |
build.builtin: added support for clang on Windows (#1466)
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/build/builtin.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index e7c0ae38..cd4d4486 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
| @@ -180,12 +180,20 @@ function builtin.run(rockspec, no_install) | |||
| 180 | add_flags(extras, "-I%s", incdirs) | 180 | add_flags(extras, "-I%s", incdirs) |
| 181 | return execute(variables.CC.." "..variables.CFLAGS, "-c", "-o", object, "-I"..variables.LUA_INCDIR, source, unpack(extras)) | 181 | return execute(variables.CC.." "..variables.CFLAGS, "-c", "-o", object, "-I"..variables.LUA_INCDIR, source, unpack(extras)) |
| 182 | end | 182 | end |
| 183 | compile_library = function(library, objects, libraries, libdirs) | 183 | compile_library = function(library, objects, libraries, libdirs, name) |
| 184 | local extras = { unpack(objects) } | 184 | local extras = { unpack(objects) } |
| 185 | add_flags(extras, "-L%s", libdirs) | 185 | add_flags(extras, "-L%s", libdirs) |
| 186 | add_flags(extras, "-l%s", libraries) | 186 | add_flags(extras, "-l%s", libraries) |
| 187 | extras[#extras+1] = dir.path(variables.LUA_LIBDIR, variables.LUALIB) | 187 | extras[#extras+1] = dir.path(variables.LUA_LIBDIR, variables.LUALIB) |
| 188 | extras[#extras+1] = "-l" .. (variables.MSVCRT or "m") | 188 | |
| 189 | if variables.CC == "clang" or variables.CC == "clang-cl" then | ||
| 190 | local exported_name = name:gsub("%.", "_") | ||
| 191 | exported_name = exported_name:match('^[^%-]+%-(.+)$') or exported_name | ||
| 192 | extras[#extras+1] = string.format("-Wl,-export:luaopen_%s", exported_name) | ||
| 193 | else | ||
| 194 | extras[#extras+1] = "-l" .. (variables.MSVCRT or "m") | ||
| 195 | end | ||
| 196 | |||
| 189 | local ok = execute(variables.LD.." "..variables.LDFLAGS.." "..variables.LIBFLAG, "-o", library, unpack(extras)) | 197 | local ok = execute(variables.LD.." "..variables.LDFLAGS.." "..variables.LIBFLAG, "-o", library, unpack(extras)) |
| 190 | return ok | 198 | return ok |
| 191 | end | 199 | end |
