|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
# 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
|
|
|
|
|
# Copyright (C) 2013 The OpenSDE Project
|
|
|
|
|
#
|
|
|
|
|
# More information can be found in the files COPYING and README.
|
|
|
|
|
#
|
|
|
|
@ -14,33 +14,88 @@
|
|
|
|
|
# version.
|
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
|
|
|
|
Description: Add make (un)install target and use pkg-config to find module dir
|
|
|
|
|
Improve Makefile
|
|
|
|
|
|
|
|
|
|
--- ./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
|
|
|
|
|
- support different config styles
|
|
|
|
|
|
|
|
|
|
The config style can be either 'auto' (default) or 'pkgconfig'.
|
|
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
|
|
|
|
|
The 'auto' config style will only work properly when building
|
|
|
|
|
on the same host the binary is supposed to run on.
|
|
|
|
|
|
|
|
|
|
- use more commonly used variable names
|
|
|
|
|
- use `install` instead of `cp` when installing
|
|
|
|
|
- add uninstall target
|
|
|
|
|
|
|
|
|
|
--- a/Makefile 2013-03-29 00:51:54.000000000 +0100
|
|
|
|
|
+++ b/Makefile 2013-04-23 13:43:40.146993101 +0200
|
|
|
|
|
@@ -3,25 +3,49 @@
|
|
|
|
|
# Gunnar Zötl <gz@tset.de>, 2011.
|
|
|
|
|
# Released under MIT/X11 license. See file LICENSE for details.
|
|
|
|
|
|
|
|
|
|
+INSTALL_CMOD=$(shell pkg-config --variable=INSTALL_CMOD lua)
|
|
|
|
|
+DESTDIR=
|
|
|
|
|
+PREFIX=/usr/local
|
|
|
|
|
+
|
|
|
|
|
+# if no config style is given we use 'auto' preserving the initial behavior
|
|
|
|
|
+ifeq ($(CONFIGSTYLE), )
|
|
|
|
|
+CONFIGSTYLE=auto
|
|
|
|
|
+endif
|
|
|
|
|
+
|
|
|
|
|
+# 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.)
|
|
|
|
|
# try some automatic discovery
|
|
|
|
|
+# Note: This will only work properly when building on the same host
|
|
|
|
|
+ifeq ($(CONFIGSTYLE),auto)
|
|
|
|
|
OS = $(shell uname -s)
|
|
|
|
|
LUAVERSION = $(shell lua -v 2>&1|awk '{split($$2, a, "."); print a[1] "." a[2]}')
|
|
|
|
|
LUADIR = $(shell dirname `which lua`)
|
|
|
|
|
LUAROOT = $(shell dirname $(LUADIR))
|
|
|
|
|
+INCDIRS=-I$(LUAROOT)/include
|
|
|
|
|
+LIBDIRS=-L$(LUAROOT)/lib
|
|
|
|
|
+INSTALL_CMOD=$(PREFIX)/lib/lua/$(LUAVERSION)
|
|
|
|
|
+INSTALL_LMOD=$(PREFIX)/share/lua/$(LUAVERSION)
|
|
|
|
|
+else
|
|
|
|
|
+# use pkg-config instead of the basic auto discovery
|
|
|
|
|
+ifeq ($(CONFIGSTYLE),pkgconfig)
|
|
|
|
|
+PKGCONFIG=pkg-config
|
|
|
|
|
+PREFIX=$(shell $(PKGCONFIG) --variable=prefix lua)
|
|
|
|
|
+INSTALL_CMOD=$(shell $(PKGCONFIG) --variable=INSTALL_CMOD lua)
|
|
|
|
|
+INCDIRS+=-I$(shell $(PKGCONFIG) --variable=includedir lua)
|
|
|
|
|
+LIBDIRS+=-L$(shell $(PKGCONFIG) --variable=libdir lua)
|
|
|
|
|
+else
|
|
|
|
|
+$(warning Unknown config style)
|
|
|
|
|
+$(warning You need to set the config style to 'auto' or 'pkgconfig')
|
|
|
|
|
+$(warning example to use `pkg-config`: "make CONFIGSTYLE=pkgconfig")
|
|
|
|
|
+$(error )
|
|
|
|
|
+endif
|
|
|
|
|
+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)
|
|
|
|
|
# Defaults
|
|
|
|
|
CC = gcc
|
|
|
|
|
TARGET = lpty.so
|
|
|
|
|
DEBUG= #-g -lefence
|
|
|
|
|
CFLAGS=-O2 -fPIC $(DEBUG)
|
|
|
|
|
-INCDIRS=-I$(LUAROOT)/include
|
|
|
|
|
-LIBDIRS=-L$(LUAROOT)/lib
|
|
|
|
|
LDFLAGS=-shared $(DEBUG)
|
|
|
|
|
|
|
|
|
|
-INSTALL_ROOT=/usr/local
|
|
|
|
|
-SO_INST_ROOT=$(INSTALL_ROOT)/lib/lua/$(LUAVERSION)
|
|
|
|
|
-LUA_INST_ROOT=$(INSTALL_ROOT)/share/lua/$(LUAVERSION)
|
|
|
|
|
-
|
|
|
|
|
# OS specialities
|
|
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
|
LDFLAGS = -bundle -undefined dynamic_lookup -all_load
|
|
|
|
|
@@ -36,7 +60,10 @@
|
|
|
|
|
$(CC) $(CFLAGS) $(INCDIRS) -c $< -o $@
|
|
|
|
|
|
|
|
|
|
install: all
|
|
|
|
|
- cp $(TARGET) $(SO_INST_ROOT)
|
|
|
|
|
+ install -m 755 $(TARGET) $(DESTDIR)$(INSTALL_CMOD)
|
|
|
|
|
+
|
|
|
|
|
+uninstall:
|
|
|
|
|
+ rm -vf $(INSTALL_CMOD)/lpty.so
|
|
|
|
|
+ rm -vf $(DESTDIR)$(INSTALL_CMOD)/$(TARGET)
|
|
|
|
|
|
|
|
|
|
test: all
|
|
|
|
|
cd samples && LUA_CPATH=../\?.so lua lptytest.lua
|
|
|
|
|