lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I've put together an alternative to luaposix.

http://25thandclement.com/~william/projects/lunix.html

I couldn't use luaposix as-is because 1) it's not thread-safe, 2) some
interfaces are not consistent across platforms (e.g. clock_gettime on OS X),
and 3) it doesn't include very common but non-POSIX interfaces (e.g. timegm,
arc4random).

Fixing those issues would require significant changes, which in some cases I
suspect wouldn't be welcome. So I took the opportunity to start a new
library which needn't be backward compatible or restrict itself to POSIX.

The project has three main goals:

1) Thread-safety--be as thread-safe as possible on the host platform.
   That means using thread-safe patterns within the implementation, and
   providing supplemental or replacement thread-safe implementations for a
   common interface.

2) Portability--Emulate a binding when not native to a supported platform so
   Lua user code needn't care. The emphasis is on portability of Lua user
   code rather than portability of the implementation. Of course it still
   follows that the implementation must be portable across the supported
   platforms.

3) Convenience--Don't restrict ourselves to POSIX or even common libc
   routines. For example, mkpath() is a very common API which derives from
   the internal implementation of the BSD mkdir utility.

There's quite alot more work to do, especially regarding directory listings.
I need to refactor some opendir/readdir bindings, and also add support for
BSD fts(3)--a saner alternative to POSIX nftw(3).

I also need to fix the mode parsing code, as I'm attempting to completely
adhere to the POSIX chmod(1) syntax.

And I just filed a bug against OpenBSD for a broken getpwnam_r (and
cousins), which I still need to workaround in the module.

BUILDING
========

To compile, the traditional GNU make variables are supported--prefix,
CPPFLAGS, CFLAGS, LDFLAGS, etc--as well as targets--all, install, clean,
etc. GNU make is required, but on Solaris and the BSDs a POSIX makefile stub
will automatically execute gmake.

By default it builds for _both_ Lua 5.1 and Lua 5.2. To compile for one or
another build with the target all5.1 or all5.2 and install with install5.1
or install5.2. If missing pkg-config, or pkg-config is unaware of your Lua
installation(s), make sure CPPFLAGS includes pointers to or near the
relevant include directories.