I'm afraid I'm the only one that wants this, but I would really love the
ability to specify C99 when compiling Lua modules. All the Lua modules I've
written in C use C99 features (some more, some less). I rationalize this
because
1. C99 is now fourteen years old
2. I started with C89 in 1991! I think I can safely use a standard
that is fourteen years old by now! [3]
But unfortunately, the supoprt for C99 in Luarocks is ... possible, but it
still has issues. For instance, I have the following Rockspec [1]:
package = "org.conman.uuid"
version = "1.2.0-1"
source =
{
url = "git://github.com/spc476/SPCUUID.git",
tag = "1.2.0"
}
supported_platforms = { "unix" }
description =
{
homepage = "http://github.com/spc476/SPCUUID.git",
maintainer = "Sean Conner <[email protected]>",
license = "LGPL",
summary = "A Lua module to generate UUIDs",
detailed = [[
org.conman.uuid provides functionality to generate UUIDs based on
RFC-4122. It supports MAC/timed based UUIDs (v1), name-based UUIDs
(v3/MD5,v5/SHA-1) and random UUIDs (v4).
]]
}
dependencies =
{
"lua ~> 5.1"
}
build =
{
type = "make",
build_target = "lua",
install_target = "install-lua",
build_variables =
{
CC = "$(CC) -std=c99",
CFLAGS = "$(CFLAGS)",
},
install_variables =
{
LUALIB = "$(LIBDIR)"
},
}
This is usable (it took long enough) but I'm not terribly happy with it,
because of that [[ CC = "$(CC) -std=c99" ]] business. Yes, I could change
it to [[ CC = "gcc -std=c99" ]] since (and I have checked) all the Unix
variants define CC as "gcc" and it has a good chance of working (except for
Solaris [2]). But I, personally, would feel better if I had some way of
specifying C99.
Now, I'm using the make build type because the built in one doesn't work
for me. I could do (and to tell you the truth, I would prefer this method):
build =
{
type = "builtin",
modules =
{
['org.conman.uuid'] =
{
sources =
{
'src/luauuid.c' ,
'src/uuid_ns_dns.c',
'src/uuid_ns_null.c',
'src/uuid_ns_oid.c',
'src/uuid_ns_url.c',
'src/uuid_ns_x500.c',
'src/uuidlib_cmp.c',
'src/uuidlib_parse.c',
'src/uuidlib_toa.c',
'src/uuidlib_v1.c',
'src/uuidlib_v2.c',
'src/uuidlib_v3.c',
'src/uuidlib_v4.c',
'src/uuidlib_v5.c'
}
}
}
}
And this works if I set CC to "gcc -std=c99" in the LuaRocks configuration
file. But I can't do this:
build =
{
type = "builtin",
modules =
{
['org.conman.uuid'] =
{
sources =
{
'src/luauuid.c' ,
'src/uuid_ns_dns.c',
'src/uuid_ns_null.c',
'src/uuid_ns_oid.c',
'src/uuid_ns_url.c',
'src/uuid_ns_x500.c',
'src/uuidlib_cmp.c',
'src/uuidlib_parse.c',
'src/uuidlib_toa.c',
'src/uuidlib_v1.c',
'src/uuidlib_v2.c',
'src/uuidlib_v3.c',
'src/uuidlib_v4.c',
'src/uuidlib_v5.c'
}
}
},
variables =
{
CC = "gcc -std=c99"
}
}
As the builtin type does not honor the variables block. I see a few
solutions to this. One, a flag for build:
build.c99 = true -- use C99 when compiling
Two, a C99 variable, plus the builtin type supporting the variables
block.
I'm working on getting rockspecs written for all my modules, and this is
the biggest stumbling block I currently have.
-spc (Please tell me I'm not the only one using C99 ... )
[1]
https://github.com/spc476/SPCUUID/blob/master/org.conman.uuid-1.2.0-1.rockspec
[2] I tried using LuaRocks on Solaris at work (I would like to see if it
makes things easier for me) but LuaRocks just ... doesn't ... work
... on Solaris. It may be because of the compiler (The Sun one---we
don't use GCC on that platform) or some other Solaris weirdness, but
I digress ...
[3] Screw you, Microsoft!
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Luarocks-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luarocks-developers