On Sun, Dec 13, 2015 at 05:27:36PM +0100, Ludovic Courtès wrote: > Leo Famulari <l...@famulari.name> skribis: > > > * gnu/packages/lua.scm (lua-5.1)[arguments]: Rewrite make-flags so that > > Lua is built with platform-specific instructions for shared library > > loading (dlopen). > > * gnu/packages/patches/lua51-liblua-so.patch: Install liblua.so with > > execute bit set. Move "-fPIC" flag from patch to package definition. > > [...] > > > + #:make-flags (list "PLAT= linux" > > + "CFLAGS= -O2 -Wall -fPIC $(MYCFLAGS)" > > + "MYLDFLAGS= -fPIC" > > Why not just: > > MYCFLAGS=-fPIC > > instead of CFLAGS=…? This would be consistent with how MYLDFLAGS is > used.
Because lua-5.1's Makefile is broken in a tricky way. When building Lua you are supposed to set PLAT in order to tailor the build to your platform. The problem is that MYCFLAGS is clobbered and redefined based on the value of PLAT. So, MYCFLAGS isn't actually available for customizing the in the way that MYLDFLAGS is. [0] CFLAGS, on the other hand, never gets redefined, so we can use it to pass -fPIC. [1] The other CFLAGS options in the patch are default values in the upstream Makefile that I chose to preserve. > > > + (string-append "INSTALL_TOP= " > > + (assoc-ref %outputs "out")) > > + (string-append "INSTALL_MAN= " > > + (assoc-ref %outputs "out") > > + "/share/man/man1")))))) > > I’m under the impression that these two variables aren’t needed since > things already get installed in the right place, no? The current lua-5.1 package definition is inheriting from lua-5.2, where these are set. Since this patch series gives lua-5.1 its own (arguments), I reproduced these variables. I've rebased the unmerged parts of the patch series on master, and made the requested changes. I'll send them shortly. [0] Actually, MYLDFLAGS gets clobbered as well if you build for the platforms 'aix' or 'mingw'. [1] Again, 'aix' clobbers CFLAGS.