Skip to content

Commit

Permalink
build lpeg manually for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
chrox committed Mar 10, 2015
1 parent fb6e46c commit 1a4c1fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ thirdparty/gettext/gettext-0.*.*
giflib-5.1.0
libjpeg-turbo-1.3.1
jpeg
lpeg*

kpvcrlib/build

Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ all: $(OUTPUT_DIR)/libs $(if $(ANDROID),,$(LUAJIT)) \
$(GIF_LIB) \
$(TURBO_FFI_WRAP_LIB) \
$(LUA_SPORE_ROCK) \
$(if $(ANDROID),lpeg,) \
$(if $(or $(ANDROID),$(WIN32)),,$(OUTPUT_DIR)/tar) \
$(if $(or $(ANDROID),$(WIN32)),,$(OUTPUT_DIR)/sdcv) \
$(if $(or $(ANDROID),$(WIN32)),,$(OUTPUT_DIR)/zsync) \
Expand Down Expand Up @@ -543,6 +544,17 @@ $(LUA_SPORE_ROCK):
$(if $(ANDROID),LDFLAGS="$(LDFLAGS) $(CURDIR)/$(LUAJIT_LIB)",) \
CC="$(CC)" CFLAGS="$(CFLAGS) -I$(CURDIR)/$(LUA_DIR)/src" LD="$(LD)"

# override lpeg built by luarocks, this is only necessary for Android
lpeg:
mkdir -p $(OUTPUT_DIR)/rocks/lib/lua/5.1
mkdir -p $(OUTPUT_DIR)/rocks/share/lua/5.1
rm -rf lpeg* && luarocks download lpeg && luarocks unpack lpeg*.rock
cd lpeg*/lpeg* && $(CC) $(DYNLIB_CFLAGS) -I$(CURDIR)/$(LUA_DIR)/src \
$(CURDIR)/$(LUAJIT_LIB) \
-o lpeg.so lpcap.c lpcode.c lpprint.c lptree.c lpvm.c \
&& cp -rf lpeg.so $(CURDIR)/$(OUTPUT_DIR)/rocks/lib/lua/5.1 \
&& cp -rf re.lua $(CURDIR)/$(OUTPUT_DIR)/rocks/share/lua/5.1

# ===========================================================================
# helper target for creating standalone android toolchain from NDK
# NDK variable should be set in your environment and it should point to
Expand Down

0 comments on commit 1a4c1fa

Please sign in to comment.