diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-17 05:10:42 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-17 15:59:04 -0300 |
| commit | 2b89e2a8d08895ca5ae93cf88267e68addec5bd6 (patch) | |
| tree | 117c11f8392f4615d02c34e446e926c8abba2d32 /src | |
| parent | 0931933acc19ba7aff11afe7a1f9d52929ca0d43 (diff) | |
| download | luarocks-2b89e2a8d08895ca5ae93cf88267e68addec5bd6.tar.gz luarocks-2b89e2a8d08895ca5ae93cf88267e68addec5bd6.tar.bz2 luarocks-2b89e2a8d08895ca5ae93cf88267e68addec5bd6.zip | |
feat(builtin): inherit inc and libdirs from external_dependencies
If a rockspec has external_dependencies but the module entry does
not specify incdirs or libdirs, then autoextract those values from
external_dependencies and apply it to the module entry.
Hopefully this will improve compatibility of existing rockspecs
that did not fully specify their incdirs and libdirs, such as
https://github.com/brimworks/lua-yajl/blob/078e48147e89d34b8224a07129675aa9b5820630/rockspecs/lua-yajl-2.0-1.rockspec
Fixes #1239.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/build/builtin.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 33e19c6b..73337544 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
| @@ -279,11 +279,12 @@ function builtin.run(rockspec, no_install) | |||
| 279 | local luadir = path.lua_dir(rockspec.name, rockspec.version) | 279 | local luadir = path.lua_dir(rockspec.name, rockspec.version) |
| 280 | local libdir = path.lib_dir(rockspec.name, rockspec.version) | 280 | local libdir = path.lib_dir(rockspec.name, rockspec.version) |
| 281 | 281 | ||
| 282 | local autolibs, autoincdirs, autolibdirs = autoextract_libs(rockspec.external_dependencies, rockspec.variables) | ||
| 283 | |||
| 282 | if not build.modules then | 284 | if not build.modules then |
| 283 | if rockspec:format_is_at_least("3.0") then | 285 | if rockspec:format_is_at_least("3.0") then |
| 284 | local libs, incdirs, libdirs = autoextract_libs(rockspec.external_dependencies, rockspec.variables) | ||
| 285 | local install, copy_directories | 286 | local install, copy_directories |
| 286 | build.modules, install, copy_directories = builtin.autodetect_modules(libs, incdirs, libdirs) | 287 | build.modules, install, copy_directories = builtin.autodetect_modules(autolibs, autoincdirs, autolibdirs) |
| 287 | build.install = build.install or install | 288 | build.install = build.install or install |
| 288 | build.copy_directories = build.copy_directories or copy_directories | 289 | build.copy_directories = build.copy_directories or copy_directories |
| 289 | else | 290 | else |
| @@ -332,7 +333,7 @@ function builtin.run(rockspec, no_install) | |||
| 332 | if not object then | 333 | if not object then |
| 333 | object = source.."."..cfg.obj_extension | 334 | object = source.."."..cfg.obj_extension |
| 334 | end | 335 | end |
| 335 | ok = compile_object(object, source, info.defines, info.incdirs) | 336 | ok = compile_object(object, source, info.defines, info.incdirs or autoincdirs) |
| 336 | if not ok then | 337 | if not ok then |
| 337 | return nil, "Failed compiling object "..object | 338 | return nil, "Failed compiling object "..object |
| 338 | end | 339 | end |
| @@ -345,7 +346,7 @@ function builtin.run(rockspec, no_install) | |||
| 345 | if not ok then return nil, err end | 346 | if not ok then return nil, err end |
| 346 | end | 347 | end |
| 347 | lib_modules[module_name] = dir.path(libdir, module_name) | 348 | lib_modules[module_name] = dir.path(libdir, module_name) |
| 348 | ok = compile_library(module_name, objects, info.libraries, info.libdirs, name) | 349 | ok = compile_library(module_name, objects, info.libraries, info.libdirs or autolibdirs, name) |
| 349 | if not ok then | 350 | if not ok then |
| 350 | return nil, "Failed compiling module "..module_name | 351 | return nil, "Failed compiling module "..module_name |
| 351 | end | 352 | end |
