git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] add basic lua infrastructure

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 25, 2012, 21:18 UTC
Message-ID
<7vy5jxvm1l.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120925034211.GC3656@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> On Tue, Sep 25, 2012 at 03:21:10AM +0000, Robin H. Johnson wrote:
>
>> On Mon, Sep 24, 2012 at 08:25:12PM -0400,  Jeff King wrote:
>> > +ifdef USE_LUA
>> > +	BASIC_CFLAGS += -DUSE_LUA `pkg-config --cflags lua5.2`
>> > +	EXTLIBS += `pkg-config --libs lua5.2`
>> > +endif
>> Can you please hoist the packagename out to a variable? It's just plain
>> "lua" on Gentoo.
>
> Yeah. I mentioned these patches were very rough, but I didn't go into
> detail on all the bad points.  That is definitely one of them. I have no
> idea what the "normal" name is; my debian system sticks the version
> number in to allow multiple concurrent versions.

Yeah, there is no point nitpicking yet. Even the choice of lua is not all that interesting; embedding _any_ reasonable interpreter, and figuring out which operations and codepaths in us benefit most from such embedding, are of bigger interest at this early stage.

How about doing this on top at the minimum? You can let pkg-config to tell you where -I<directory> and what -l<lib> is, or you can set it yourself.

    $ make USE_LUA=YesPlease \
    	LUA_INCLUDE_ARG=-I/usr/include/lua5.2 \
        LUA_LINK_ARG=-llua5.2
or
    $ make USE_LUA=lua5.2
 Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git i/Makefile w/Makefile
index 620df89..90335ba 100644
--- i/Makefile
+++ w/Makefile
@@ -1898,8 +1898,14 @@ ifdef USE_NED_ALLOCATOR
 endif
 
 ifdef USE_LUA
-	BASIC_CFLAGS += -DUSE_LUA `pkg-config --cflags lua5.2`
-	EXTLIBS += `pkg-config --libs lua5.2`
+	# You can say
+	# $ make USE_LUA=YesPlease LUA_INCLUDE_ARG=-I/usr/include
+	# or
+	# $ make USE_LUA=lua5.2
+	LUA_INCLUDE_ARG ?= $(shell pkg-config --cflags $(USE_LUA))
+	LUA_LINK_ARG ?= $(shell pkg-config --libs $(USE_LUA))
+	BASIC_CFLAGS += -DUSE_LUA $(LUA_INCLUDE_ARG)
+	EXTLIBS += $(LUA_LINK_ARG)
 endif
 
 ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
Previous: Jeff KingNext: Jeff King
Message 8 of 15 in “git log --pretty=lua”
  1. 0/3 git log --pretty=luaJeff King, Sep 25, 2012
  2. 1/3 pretty: make some commit-parsing helpers more publicJeff King, Sep 25, 2012
  3. 2/3 add basic lua infrastructureJeff King, Sep 25, 2012
  4. Nguyen Thai Ngoc DuySep 25, 2012
  5. Jeff KingSep 25, 2012
  6. Robin H. JohnsonSep 25, 2012
  7. Jeff KingSep 25, 2012
  8. Junio C HamanoSep 25, 2012
  9. 3/3 add a "lua" pretty formatJeff King, Sep 25, 2012
  10. Jeff KingOct 6, 2012
  11. Nguyen Thai Ngoc DuySep 25, 2012
  12. Stephen BashSep 25, 2012
  13. Matthieu MoySep 25, 2012
  14. Junio C HamanoSep 25, 2012
  15. Nguyen Thai Ngoc DuySep 30, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.