# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../lua-pty/lpty-make-install.patch
# Copyright (C) 2010 - 2012 The OpenSDE 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 ---

Description: Add make (un)install target and use pkg-config to find module dir

--- ./Makefile.orig	2010-09-26 14:42:59.000000000 +0200
+++ ./Makefile		2012-04-24 13:52:54.383354702 +0200
@@ -5,6 +5,15 @@
 LIBDIRS=-L/usr/local/lib
 LDFLAGS=-shared
 
+INSTALL_CMOD=$(shell pkg-config --variable=INSTALL_CMOD lua)
+
+# if INSTALL_CMOD is empty we have to abort
+ifeq ($(INSTALL_CMOD), )
+$(warning Could not determine path where to install Lua C modules!)
+$(warning You need to provide the path manually by using "make INSTALL_CMOD=/path" for example.)
+$(error )
+endif
+
 all: lpty.so
 
 lpty.so: lpty.o
@@ -21,3 +30,9 @@
 		rm -f $dir/.DS_Store; \
 		rm -f $dir/._*; \
 	done
+
+install: all
+	install -m 755 lpty.so $(INSTALL_CMOD)
+
+uninstall:
+	rm -vf $(INSTALL_CMOD)/lpty.so