lua-cassandra
lua-cassandra copied to clipboard
Allow installing rocks locally - fix openssl include
/usr/local is not writable on my machine by purpose, so make dev
fails
with permission error. I've changed the Makefile to allow installing
rocks in the user's home directory. This is optional, so by default make dev
will have the same behaviour as now.
I'm not super happy with this solution either, imo the right thing would be to create a local tree inside this directory and install the dependencies there instead of polluting the system. That's possible and it works, however it required me to set the lua load paths in several places and wasn't "backward compatible", so I chose to go with this solution for now which should be easier to code-review.
Another issue that I encountered is that openssl header files on macOS
are not inside /usr/local
, which mean I couldn't install luasec. To
fix this I've added an optional OPENSSL_DIR env variable that can be
used to configure luarocks. (This is the suggested procedure on luasec's
website).
I've also added luasec and luasocket as lua-cassandra dependencies since without them the tests break. There doesn't seem to be a way to mark luasec as optional (since it's only require if you enable ssl) unfortunately.
Oh also, luarocks make
requires the rockspec file as argument. I don't know if this changed in a recent version of luarocks or why it used to work for you
I believe if /usr/local isn't writable by default on your machine, that it may be your responsibility to either:
Well, /usr/local on my laptop is not writable exactly to forbid tools (like pip or luarocks) to install stuff there without me noticing. Global installs for dependencies are bad because if you work on more than one project you'll keep having conflicting dependencies and one project will keep upgrading / downgrading the libraries.
Another example is that /usr/local
is not writable on our work devboxes since they're shared between multiple user, so we'd have even worse conflicts.
install the LuaRocks system tree in a writable directory
that's basically what --local does
install this library and its dependencies in the user tree (via the --local flag like you did)
yeah, I can do that but it'd be much nicer to be able to just use the Makefile since we already have one. I don't think adding the possibility to use --local
in the Makefile itself is a big issue (the changes are minimal and backward compatible).