LuaJIT / LuaJIT

Mirror of the LuaJIT git repository
http://luajit.org
Other
4.53k stars 939 forks source link

Hardcoded `DEFAULT_CC` flag overrides CC env var (no other software do this?) #1231

Closed brunvonlope closed 5 days ago

brunvonlope commented 2 weeks ago

We are trying to build GIMP flatpak with Clang and noticed that luajit is the only dependency that ignores CC=ccache clang environment variable due this line in the Makefile:

https://github.com/LuaJIT/LuaJIT/blob/93e87998b24021b94de8d1c8db244444c46fb6e9/src/Makefile#L29

So we workaround it adding the DEFAULT_CC flag pointing to clang. MSYS2 does a similar thing: https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-luajit/004-fix-default-cc.patch. But this should be really necessary or, in the end, this flag isn't being pervasive?

(That's the first time that I've seen a software forcing a compiler, sorry if I am being ignorant).

MikePall commented 5 days ago

Environment variables vs. Makefile variables, and in particular CC and CFLAGS, is a long-standing debate. There are good reasons why it's done this way and LuaJIT is far from the only package.

Makefile variables can always be overriden at the command line by adding them as arguments, e.g.:

make 'CC=ccache clang'

This is the recommended way and does not require any Makefile patching.