Skip to content

Commit

Permalink
Merge pull request #121 from nuko8/fix/build_for_osx
Browse files Browse the repository at this point in the history
Tweaks for the build on Mac OS X
  • Loading branch information
pavouk committed Oct 2, 2015
2 parents 2273728 + dab172c commit 6cdd7bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lgi/Makefile
Expand Up @@ -25,6 +25,7 @@ ifeq ($(HOST_OS),darwin)
CORE = corelgilua51.so
LIBFLAG = -bundle -undefined dynamic_lookup
CCSHARED = -fno-common
GOBJECT_INTROSPECTION_LIBDIR = $(shell pkg-config --variable=libdir $(GINAME))
else
CORE = corelgilua51.so
LIBFLAG = -shared
Expand All @@ -39,6 +40,9 @@ ifndef COPTFLAGS
CFLAGS = -Wall -Wextra -O2 -g
endif
endif
ifeq ($(HOST_OS),darwin)
CFLAGS += -DGOBJECT_INTROSPECTION_LIBDIR=\"$(GOBJECT_INTROSPECTION_LIBDIR)\"
endif
ALL_CFLAGS = $(CCSHARED) $(COPTFLAGS) $(LUA_CFLAGS) $(shell $(PKG_CONFIG) --cflags $(PKGS)) $(CFLAGS)
LIBS += $(shell $(PKG_CONFIG) --libs $(PKGS))
ALL_LDFLAGS = $(LIBFLAG) $(LDFLAGS)
Expand Down
7 changes: 7 additions & 0 deletions lgi/core.c
Expand Up @@ -536,6 +536,13 @@ core_module (lua_State *L)
name = g_strdup_printf (MODULE_NAME_FORMAT_PLAIN,
luaL_checkstring (L, 1));

#if defined(__APPLE__)
char *path = g_module_build_path (GOBJECT_INTROSPECTION_LIBDIR,
name);
g_free(name);
name = path;
#endif

/* Try to load the module. */
GModule *module = g_module_open (name, 0);
if (module == NULL)
Expand Down

0 comments on commit 6cdd7bd

Please sign in to comment.