3 changed files with 100 additions and 25 deletions
@ -2,7 +2,7 @@ |
|||||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||||
#
|
#
|
||||||
# Filename: package/.../lua-pty/lpty-make-install.patch
|
# 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.
|
# More information can be found in the files COPYING and README.
|
||||||
#
|
#
|
||||||
@ -14,33 +14,88 @@ |
|||||||
# version.
|
# version.
|
||||||
# --- SDE-COPYRIGHT-NOTE-END ---
|
# --- 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
|
- support different config styles
|
||||||
+++ ./Makefile 2012-04-24 13:52:54.383354702 +0200
|
|
||||||
@@ -5,6 +5,15 @@
|
The config style can be either 'auto' (default) or 'pkgconfig'.
|
||||||
LIBDIRS=-L/usr/local/lib
|
|
||||||
LDFLAGS=-shared
|
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 <[email protected]>, 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
|
# try some automatic discovery
|
||||||
+ifeq ($(INSTALL_CMOD), )
|
+# Note: This will only work properly when building on the same host
|
||||||
+$(warning Could not determine path where to install Lua C modules!)
|
+ifeq ($(CONFIGSTYLE),auto)
|
||||||
+$(warning You need to provide the path manually by using "make INSTALL_CMOD=/path" for example.)
|
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 )
|
+$(error )
|
||||||
+endif
|
+endif
|
||||||
|
+endif
|
||||||
+
|
+
|
||||||
all: lpty.so
|
|
||||||
|
|
||||||
lpty.so: lpty.o
|
# Defaults
|
||||||
@@ -21,3 +30,9 @@
|
CC = gcc
|
||||||
rm -f $dir/.DS_Store; \
|
TARGET = lpty.so
|
||||||
rm -f $dir/._*; \
|
DEBUG= #-g -lefence
|
||||||
done
|
CFLAGS=-O2 -fPIC $(DEBUG)
|
||||||
+
|
-INCDIRS=-I$(LUAROOT)/include
|
||||||
+install: all
|
-LIBDIRS=-L$(LUAROOT)/lib
|
||||||
+ install -m 755 lpty.so $(INSTALL_CMOD)
|
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:
|
+uninstall:
|
||||||
+ rm -vf $(INSTALL_CMOD)/lpty.so
|
+ rm -vf $(DESTDIR)$(INSTALL_CMOD)/$(TARGET)
|
||||||
|
|
||||||
|
test: all
|
||||||
|
cd samples && LUA_CPATH=../\?.so lua lptytest.lua
|
||||||
|
@ -0,0 +1,20 @@ |
|||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||||
|
# |
||||||
|
# Filename: package/.../lua-pty/lua-pty.conf |
||||||
|
# Copyright (C) 2013 The OpenSDE Project |
||||||
|
# |
||||||
|
# More information can be found in the files COPYING and README. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License as published by |
||||||
|
# the Free Software Foundation; version 2 of the License. A copy of the |
||||||
|
# GNU General Public License can be found in the file COPYING. |
||||||
|
# --- SDE-COPYRIGHT-NOTE-END --- |
||||||
|
|
||||||
|
if pkginstalled pkgconfig; then |
||||||
|
var_insert makeopt ' ' "CONFIGSTYLE=pkgconfig" |
||||||
|
var_insert makeinstopt ' ' "CONFIGSTYLE=pkgconfig" |
||||||
|
else |
||||||
|
var_insert makeinstopt ' ' "PREFIX=$/prefix" |
||||||
|
fi |
Loading…
Reference in new issue