Hi,
This is a document I wrote with a bunch of ideas on how to change the
rockspec format to reduce the amount of tedious writing, make it less
error-prone, improve portability, etc.
Posting them here first so we can do a first round of discussion
before we move to Github issues, PRs, wiki, etc.
This is by no means a full list of possible changes. I took a pretty
big rockspec as a testing ground: LuaSec, with the aim of making it as
short as possible. The one attached is what I came up with, and the
document below are the changes inspired by it.
Waiting for your feedback,
Hisham
Streamlining the rockspec format
================================
if build.type is not given, assume builtin.
If build.modules is not given:
Try one of these:
1) if there's a src/ dir, assume everything inside it is to be
installed according to default rules for .lua and .c files
2) if there's a lua/ dir, assume everything inside it is to be
installed according to default rules for .lua files
3) if there are *.lua or *.c files in the root, assume they are to
be installed according to default rules for .lua and .c files
Use array part of build.modules for shorthand notation:
if string entry is a directory, assume everything inside it is to
be installed according to default rules for .lua and .c files
if string entry is glob of files, expand glob and assume this is
the list of files to install
use build.base_dir to extract the dirname when converting paths
to module names (e.g. build = { modules = { "src/lua/*.lua" },
base_dir = "src/lua" } )
When building C code:
If external_dependencies are given and `libdirs`, `libraries` or
`incdirs` is not given, propagate the data from external_dependencies
automatically.
Add a `language` key, which may be set globally as
`build.language`. Support at first "C", "C99", "C++", "C++11",
producing appropriate compiler flags.
Add a `depends` to specify which libraries to pull definitions
from, when building multiple modules that depend on different
libraries in the same rock.
When specifying dependencies:
Add a `build_dependencies` table, checked only during `luarocks build`.
Add a `provides` table for allowing virtual dependencies. Depending
on a virtual dependency may specify a default suggestion ( "json
(default to dkjson)" ).
Range operator "to" -- "lua 5.1 to 5.3" ("<pkg> <ax>.<ay> to
<bx>.<by>" means "<pkg >= <ax>.<ay>, < <bx>.<by + 1>")
Optional dependencies:
support "or" expressions in dependencies.
support "optionally" prefix.
Default behavior: install optional dependencies by default but
keep going if they fail. --optionals={none,install,try (default)}
When specifying external dependencies:
A library name without a `.` means a libname suitable for use with
-l<libname>. Auto-add it.
Add a `libraries` field to support an array of libraries.
Add other fields that are allowed in the builtin mode, such as
`defines`, for auto-propagation
Support a list of alternatives when searching paths, and support globs.
Add a `distro_suggestions` field, for error messages only. Check
`cfg.distro`, which should be configured by upstream.
On Windows:
Add <external_dependency>_BINDIR to automatic libdirs. (found in
LuaSec - is this common practice?)
Platform overrides:
Expand `platforms` at deeper levels (at any level that does not
allow arbitrary keys).
Assume that non-arbitrary-keyed entries starting with "append_"
mean that the corresponding table is to be appended.
Support installing arbitrary resource files.
In `build.modules`:
In the array part, if name (or result of glob expansion) is of
an unknown extension, copy it as-is.
In the hash part, if key contains a slash, assume it is the
filename. If unknown extension, copy it as-is.
Add a `resources` (`assets`? simply `files`?) entry for installing
straight into share/ (manpages, icons, etc.)
rockspec_format = "3.0"
package = "LuaSec"
version = "0.6alpha-2"
source = {
url = "git://github.com/brunoos/luasec",
tag = "luasec-0.6alpha"
}
description = {
summary = "A binding for OpenSSL library to provide TLS/SSL communication
over LuaSocket.",
detailed = "This version delegates to LuaSocket the TCP connection
establishment between the client and server. Then LuaSec uses this connection
to start a secure TLS/SSL session.",
homepage = "https://github.com/brunoos/luasec/wiki",
license = "MIT"
}
dependencies = {
"lua >= 5.1", "luasocket"
}
external_dependencies = {
OPENSSL = {
header = "openssl/ssl.h",
platforms = {
unix = {
libraries = { "ssl", "crypto" },
},
windows = {
libraries = { "libeay32", "ssleay32", "ws2_32" },
},
},
}
}
build = {
copy_directories = {
"samples"
},
modules = {
['ssl.https'] = "src/https.lua",
ssl = {
sources = {
"src/x509.c", "src/context.c", "src/ssl.c",
"src/luasocket/buffer.c",
"src/luasocket/io.c", "src/luasocket/timeout.c",
},
incdirs = {
"$(OPENSSL_INCDIR)", "src/", "src/luasocket",
},
platforms = {
unix = {
append_sources = { "src/luasocket/usocket.c" },
},
windows = {
defines = {
"WIN32", "NDEBUG", "_WINDOWS", "_USRDLL", "LSEC_EXPORTS",
"BUFFER_DEBUG", "LSEC_API=__declspec(dllexport)",
"LUASEC_INET_NTOP", "WINVER=0x0501", "_WIN32_WINNT=0x0501",
"NTDDI_VERSION=0x05010300"
},
append_sources = { "src/luasocket/wsocket.c" },
}
}
}
}
}
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers