# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../lua-posix/makefile.patch
# Copyright (C) 2006 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
--- posix/Makefile	2003-11-06 01:26:49.000000000 +0100
+++ posix-5.1-alpha/Makefile	2005-09-04 14:17:03.000000000 +0200
@@ -1,10 +1,20 @@
 # makefile for POSIX library for Lua
 
 # change these to reflect your Lua installation
-LUA= /tmp/lhf/lua-5.0
-LUAINC= $(LUA)/include
-LUALIB= $(LUA)/lib
-LUABIN= $(LUA)/bin
+LUA= lua
+
+LUAINC= $(LUA_ROOT)/include
+LUALIB= $(LUA_ROOT)/lib
+LUABIN= $(LUA_ROOT)/bin
+
+# installation path
+LUA_ROOT= $(shell pkg-config --variable prefix lua)
+LUA_CDIR= $(shell pkg-config --variable INSTALL_CMOD lua)
+LUA_LDIR= $(shell pkg-config --variable INSTALL_LMOD lua)
+
+INSTALL = install
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_EXEC = $(INSTALL) -m 755
 
 # no need to change anything below here
 CFLAGS= -fPIC $(INCS) $(WARN) -O2 $G
@@ -16,23 +26,25 @@
 
 OBJS= $(MYLIB).o
 
-T= $(MYLIB).so
+all:	$(MYLIB).so
 
-all:	test
+test:	$(MYLIB).so
+	$(LUA) -l$(MYNAME) test.lua
 
-test:	$T
-	$(LUABIN)/lua -l$(MYNAME) test.lua
+$(MYLIB).so:	$(OBJS)
+	$(CC) $(LDFLAGS) -o $@ -shared $(OBJS)
 
-$T:	$(OBJS)
-	$(CC) -o $@ -shared $(OBJS)
+install:
+	$(INSTALL_EXEC) $(MYLIB).so $(LUA_CDIR)/
+	$(INSTALL_DATA) $(MYNAME).lua $(LUA_LDIR)/
 
 $(OBJS): modemuncher.c
 
-tree:	$T
+tree:	$(MYLIB).so
 	$(LUABIN)/lua -l$(MYNAME) tree.lua .
 
 clean:
-	rm -f $(OBJS) $T core core.* a.out
+	rm -f $(OBJS) $(MYLIB).so core core.* a.out
 
 x:
 	@echo "$(MYNAME) library:"