aboutsummaryrefslogtreecommitdiff
path: root/docs/rock_file_format.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/rock_file_format.md')
-rw-r--r--docs/rock_file_format.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/docs/rock_file_format.md b/docs/rock_file_format.md
new file mode 100644
index 00000000..10748bde
--- /dev/null
+++ b/docs/rock_file_format.md
@@ -0,0 +1,51 @@
1# Rock file format
2
3This page describes the .rock file format used by LuaRocks.
4
5Note that there are different [types of rocks](types_of_rocks.md).
6
7## Filenames
8
9* .rock and .rockspec filenames must be all-lowercase
10* Rock names must follow the format "$NAME-$VERSION-$REVISION.$PLATFORM.rock", where:
11
12 * $NAME is an arbitrary name (matchable via `"[a-z0-9_-]+"`)
13 * $VERSION is a version number parseable by LuaRocks (e.g. "1.0", "2.1beta1", "scm" for git-HEAD/svn-master rockspecs)
14 * $REVISION is the rockspec revision number, a positive integer
15 * $PLATFORM must follow the format "$OS-$ARCH", where:
16
17 * $OS is an operating system identifier known by LuaRocks
18 * $ARCH is a hardware architecture identifier known by LuaRocks
19
20## Source rocks
21
22A source rock must contain at its root the rockspec file. For a rock called `myrock-1.0-1.src.rock` it would be called:
23
24* `myrock-1.0-1.rockspec` - the [rockspec file](Rockspec format) in the archive root
25
26Additionally, it must contain the sources:
27
28* If the `source.url` field is specified using a file download protocol-type URL (`http://`, `https://`, `file://` and so on) pointing to the source archive (or source file in case of a single-file rock), the rock should contain the product of downloading this URL.
29 * For example, a source rock may contain two files: `myrock-1.0-1.rockspec` and `myrock-1.0.tar.gz`
30* If the `source.url` field is specified using a Source Control Manager (SCM) protocol-type URL (`git://`, `hg://`, `svn://` and so on), the rock should contain the corresponding checked-out sources. The SCM metadata (e.g. the `.git` directory) does not need to be present. (Note: This is not specific to "scm" rocks that point to in-development repositories; a stable-version rockspec may use a SCM-based URL and an SCM tag with `source.tag` in the rockspec to point to a release version).
31 * For example, a source rock may contain at the root the rockspec `myrock-1.0-1.rockspec` and a directory `myrock` that would be the result of `git clone https://github.com/example/myrock`
32
33## Binary rocks
34
35A binary rock must contain at its root two files. For a rock called `myrock-1.0-1.linux-x86.rock` they would be called:
36
37* `myrock-1.0-1.rockspec` - the [rockspec file](Rockspec-format) in the archive root
38* `rock_manifest` - a [rock manifest file](Rock-manifest-file-format)
39
40These standard directories are handled specially:
41
42* `lib/` - a directory containing binary modules (the contents of this directory are files that go into `$PREFIX/lib/lua/5.x/` in a vanilla Lua installation on Unix). The directory structure inside this directory is replicated when installing.
43* `lua/` - a directory containing Lua modules (the contents of this directory are files that go into `$PREFIX/share/lua/5.x/` in a vanilla Lua installation on Unix). The directory structure inside this directory is replicated when installing.
44* `bin/` - a directory containing executable Lua scripts (the contents of this directory are files that go into `$PREFIX/bin/` in a vanilla Lua installation on Unix)
45* `doc/` or `docs/` - documentation files - if present, their contents are listed when running `luarocks doc`. The directory structure inside this directory is replicated when installing.
46
47Any additional directories in the .rock file are copied verbatim (including subdirectories) to `$ROCK_TREE/lib/luarocks/rocks-5.x/myrock/1.0-1/` (common directories are `tests`, `samples`, `examples`, etc.
48
49### Pure-Lua rocks
50
51Pure-Lua rocks are identical to binary rocks, except that they don't have a `lib/` directory containing binary modules. When a rock contains only `lua/` files and no `lib/` files, it automatically gains the `.all.rock` file extension. If the rock is platform-specific, the packager may rename the file to the proper platform, or specify the list of supported platforms in the `supported_platforms` table of the rockspec.