Skip to content

Commit

Permalink
golua lib build cmds steal flags from CGO's gcc flags
Browse files Browse the repository at this point in the history
which maybe will make it work...
  • Loading branch information
afitz committed Jul 29, 2010
1 parent 0c517ba commit acca3cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lua51/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ endif

ifndef LUA51_INCLUDE_DIR
CGO_CFLAGS+=`pkg-config --cflags $(LUA51_LIBNAME)`
LUA51_INCLUDE_DIR:=$(shell pkg-config --cflags-only-I $(LUA51_LIBNAME) | sed 's/-I//' | sed 's/[ ]*$$//')
else
CGO_CFLAGS+=-I$(LUA51_INCLUDE_DIR)
endif
Expand All @@ -39,7 +40,8 @@ GOFILES=lua_defs.go

CLEANFILES+=lua_defs.go

LUA_HEADER_FILES=/usr/include/lua5.1/lua.h /usr/include/lua5.1/lauxlib.h /usr/include/lua5.1/lualib.h
LUA_HEADERS=lua.h lauxlib.h lualib.h
LUA_HEADER_FILES:=$(patsubst %,$(LUA51_INCLUDE_DIR)/%,$(LUA_HEADERS))

include $(GOROOT)/src/Make.pkg

Expand All @@ -51,7 +53,7 @@ libgolua.a: golua.o
ar rcs libgolua.a golua.o

golua.o: golua.c
gcc -I/usr/include/lua5.1 -c golua.c -o golua.o
gcc $(CGO_CFLAGS) $(_CGO_CFLAGS_$(GOARCH)) -c golua.c -o golua.o

lua_defs.go:
echo "package lua51;" > lua_defs.go
Expand Down
3 changes: 2 additions & 1 deletion lua51/lua.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ func ToGoFunction(L *State, index int) (f GoFunction) {

func ToString(L *State, index int) string {
var size C.size_t;
return C.GoString(C.lua_tolstring(L.s, C.int(index), &size));
//C.GoString(C.lua_tolstring(L.s, C.int(index), &size));
return C.GoString(C.lua_tolstring(L.s,C.int(index),&size));
}

func ToInteger(L *State, index int) int {
Expand Down

0 comments on commit acca3cb

Please sign in to comment.