Module luarocks.build
Module implementing the LuaRocks "build" command. Builds a rock, compiling its C parts if any.
Functions
apply_patches (rockspec) | Applies patches inlined in the build.patches section and extracts files inlined in the build.extra_files section of a rockspec. |
build_rock (rock_file, need_to_fetch, no_deps) | Build and install a rock. |
build_rockspec (rockspec_file, need_to_fetch, minimal_mode, no_deps) | Build and install a rock given a rockspec. |
extract_from_rockspec (files) | Write to the current directory the contents of a table, where each key is a file name and its value is the file content. |
install_files (files, location, is_module_path) | Install files to a given location. |
run (..., name, version) | Driver function for "build" command. |
Functions
- apply_patches (rockspec)
-
Applies patches inlined in the build.patches section and extracts files inlined in the build.extra_files section of a rockspec.
Parameters
- rockspec: table: A rockspec table.
Return value:
boolean or (nil, string): True if succeeded or nil and an error message. - build_rock (rock_file, need_to_fetch, no_deps)
-
Build and install a rock.
Parameters
- rock_file: string: local or remote filename of a rock.
- need_to_fetch: boolean: true if sources need to be fetched, false if the rockspec was obtained from inside a source rock.
- no_deps:
Return value:
boolean or (nil, string, [string]): True if build was successful, or false and an error message and an optional error code. - build_rockspec (rockspec_file, need_to_fetch, minimal_mode, no_deps)
-
Build and install a rock given a rockspec.
Parameters
- rockspec_file: string: local or remote filename of a rockspec.
- need_to_fetch: boolean: true if sources need to be fetched, false if the rockspec was obtained from inside a source rock.
- minimal_mode: boolean: true if there's no need to fetch, unpack or change dir (this is used by "luarocks make"). Implies need_to_fetch = false.
- no_deps: boolean: true if dependency check needs to be skipped
Return value:
boolean or (nil, string, [string]): True if succeeded or nil and an error message followed by an error code. - extract_from_rockspec (files)
-
Write to the current directory the contents of a table, where each key is a file name and its value is the file content.
Parameters
- files: table: The table of files to be written.
- install_files (files, location, is_module_path)
-
Install files to a given location. Takes a table where the array part is a list of filenames to be copied. In the hash part, other keys, if is_module_path is set, are identifiers in Lua module format, to indicate which subdirectory the file should be copied to. For example, install_files({["foo.bar"] = "src/bar.lua"}, "boo") will copy src/bar.lua to boo/foo.
Parameters
- files: table or nil: A table containing a list of files to copy in the format described above. If nil is passed, this function is a no-op. Directories should be delimited by forward slashes as in internet URLs.
- location: string: The base directory files should be copied to.
- is_module_path: boolean: True if string keys in files should be interpreted as dotted module paths.
Return value:
boolean or (nil, string): True if succeeded or nil and an error message. - run (..., name, version)
-
Driver function for "build" command.
Parameters
- ...:
- name: string: A local or remote rockspec or rock file. If a package name is given, forwards the request to "search" and, if returned a result, installs the matching rock.
- version: string: When passing a package name, a version number may also be given.
Return value:
boolean or (nil, string): True if build was successful; nil and an error message otherwise.