summaryrefslogtreecommitdiffhomepage
path: root/contrib/luaposix
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/luaposix')
-rw-r--r--contrib/luaposix/.gitignore2
-rw-r--r--contrib/luaposix/Makefile43
-rw-r--r--contrib/luaposix/patches/100-darwin_compile.patch27
3 files changed, 72 insertions, 0 deletions
diff --git a/contrib/luaposix/.gitignore b/contrib/luaposix/.gitignore
new file mode 100644
index 0000000000..c900421f8a
--- /dev/null
+++ b/contrib/luaposix/.gitignore
@@ -0,0 +1,2 @@
+luaposix-*
+patches/series
diff --git a/contrib/luaposix/Makefile b/contrib/luaposix/Makefile
new file mode 100644
index 0000000000..4f16b53625
--- /dev/null
+++ b/contrib/luaposix/Makefile
@@ -0,0 +1,43 @@
+include ../../build/config.mk
+
+LUAPOSIX_VERSION = 5.1.2
+LUAPOSIX_SITE = http://luaforge.net/frs/download.php/3063/
+LUAPOSIX_DIR = luaposix-$(LUAPOSIX_VERSION)
+LUAPOSIX_FILE = $(LUAPOSIX_DIR).tar.gz
+LUAPOSIX_URL = $(LUAPOSIX_SITE)/$(LUAPOSIX_FILE)
+LUAPOSIX_PATCHDIR = patches
+
+all: compile
+
+$(LUAPOSIX_FILE):
+ wget -O $@ $(LUAPOSIX_URL) || rm -f $@
+
+$(LUAPOSIX_PATCHDIR)/series:
+ (cd $(LUAPOSIX_PATCHDIR); ls *.patch | sort > series)
+
+$(LUAPOSIX_DIR)/.prepared: $(LUAPOSIX_FILE)
+ rm -rf $(LUAPOSIX_DIR)
+ tar xvfz $(LUAPOSIX_FILE)
+ ln -s ../$(LUAPOSIX_PATCHDIR) $(LUAPOSIX_DIR)/patches
+ touch $@
+
+$(LUAPOSIX_DIR)/.patched: $(LUAPOSIX_DIR)/.prepared $(LUAPOSIX_PATCHDIR)/series
+ (cd $(LUAPOSIX_DIR); \
+ if [ -x "$$(which quilt 2>/dev/null)" ]; then \
+ quilt push -a; \
+ else \
+ cat patches/*.patch | patch -p1; \
+ fi; \
+ )
+ touch $@
+
+compile: $(LUAPOSIX_DIR)/.patched
+ $(MAKE) -C $(LUAPOSIX_DIR) CC=$(CC) CFLAGS="$(CFLAGS)" OS="$(OS)"
+ mkdir -p dist/usr/lib/lua
+ cp $(LUAPOSIX_DIR)/posix.so dist/usr/lib/lua/
+
+compile-all: compile
+
+clean:
+ rm -rf $(LUAPOSIX_DIR) $(LUAPOSIX_FILE)
+ rm -f $(LUAPOSIX_PATCHDIR)/series
diff --git a/contrib/luaposix/patches/100-darwin_compile.patch b/contrib/luaposix/patches/100-darwin_compile.patch
new file mode 100644
index 0000000000..07943acab5
--- /dev/null
+++ b/contrib/luaposix/patches/100-darwin_compile.patch
@@ -0,0 +1,27 @@
+Index: luaposix-5.1.2/Makefile
+===================================================================
+--- luaposix-5.1.2.orig/Makefile 2008-01-29 14:49:27.000000000 +0100
++++ luaposix-5.1.2/Makefile 2008-05-28 14:15:30.000000000 +0200
+@@ -34,6 +34,13 @@
+
+ T= $(MYLIB).so
+
++OS=$(shell uname)
++ifeq ($(OS),Darwin)
++ LDFLAGS_SHARED=-bundle -undefined dynamic_lookup
++else
++ LDFLAGS_SHARED=-shared
++endif
++
+ # targets
+ phony += all
+ all: $T
+@@ -43,7 +50,7 @@
+ $(LUA) test.lua
+
+ $T: $(OBJS)
+- $(CC) $(LDFLAGS) -o $@ -shared $(OBJS)
++ $(CC) $(LDFLAGS) -o $@ $(LDFLAGS_SHARED) $(OBJS)
+
+ $(OBJS): modemuncher.c
+