OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.1 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../lua-pty/lpty-make-install.patch
  5. # Copyright (C) 2013 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. Improve Makefile
  17. - support different config styles
  18. The config style can be either 'auto' (default) or 'pkgconfig'.
  19. Note:
  20. The 'auto' config style will only work properly when building
  21. on the same host the binary is supposed to run on.
  22. - use more commonly used variable names
  23. - use `install` instead of `cp` when installing
  24. - add uninstall target
  25. --- a/Makefile 2013-03-29 00:51:54.000000000 +0100
  26. +++ b/Makefile 2013-04-23 13:43:40.146993101 +0200
  27. @@ -3,25 +3,49 @@
  28. # Gunnar Zötl <gz@tset.de>, 2011.
  29. # Released under MIT/X11 license. See file LICENSE for details.
  30. +DESTDIR=
  31. +PREFIX=/usr/local
  32. +
  33. +# if no config style is given we use 'auto' preserving the initial behavior
  34. +ifeq ($(CONFIGSTYLE), )
  35. +CONFIGSTYLE=auto
  36. +endif
  37. +
  38. # try some automatic discovery
  39. +# Note: This will only work properly when building on the same host
  40. +ifeq ($(CONFIGSTYLE),auto)
  41. OS = $(shell uname -s)
  42. LUAVERSION = $(shell lua -v 2>&1|awk '{split($$2, a, "."); print a[1] "." a[2]}')
  43. LUADIR = $(shell dirname `which lua`)
  44. LUAROOT = $(shell dirname $(LUADIR))
  45. +INCDIRS=-I$(LUAROOT)/include
  46. +LIBDIRS=-L$(LUAROOT)/lib
  47. +INSTALL_CMOD=$(PREFIX)/lib/lua/$(LUAVERSION)
  48. +INSTALL_LMOD=$(PREFIX)/share/lua/$(LUAVERSION)
  49. +else
  50. +# use pkg-config instead of the basic auto discovery
  51. +ifeq ($(CONFIGSTYLE),pkgconfig)
  52. +PKGCONFIG=pkg-config
  53. +PREFIX=$(shell $(PKGCONFIG) --variable=prefix lua)
  54. +INSTALL_CMOD=$(shell $(PKGCONFIG) --variable=INSTALL_CMOD lua)
  55. +INCDIRS+=-I$(shell $(PKGCONFIG) --variable=includedir lua)
  56. +LIBDIRS+=-L$(shell $(PKGCONFIG) --variable=libdir lua)
  57. +else
  58. +$(warning Unknown config style)
  59. +$(warning You need to set the config style to 'auto' or 'pkgconfig')
  60. +$(warning example to use `pkg-config`: "make CONFIGSTYLE=pkgconfig")
  61. +$(error )
  62. +endif
  63. +endif
  64. +
  65. # Defaults
  66. CC = gcc
  67. TARGET = lpty.so
  68. DEBUG= #-g -lefence
  69. CFLAGS=-O2 -fPIC $(DEBUG)
  70. -INCDIRS=-I$(LUAROOT)/include
  71. -LIBDIRS=-L$(LUAROOT)/lib
  72. LDFLAGS=-shared $(DEBUG)
  73. -INSTALL_ROOT=/usr/local
  74. -SO_INST_ROOT=$(INSTALL_ROOT)/lib/lua/$(LUAVERSION)
  75. -LUA_INST_ROOT=$(INSTALL_ROOT)/share/lua/$(LUAVERSION)
  76. -
  77. # OS specialities
  78. ifeq ($(OS),Darwin)
  79. LDFLAGS = -bundle -undefined dynamic_lookup -all_load
  80. @@ -36,7 +60,10 @@
  81. $(CC) $(CFLAGS) $(INCDIRS) -c $< -o $@
  82. install: all
  83. - cp $(TARGET) $(SO_INST_ROOT)
  84. + install -m 755 $(TARGET) $(DESTDIR)$(INSTALL_CMOD)
  85. +
  86. +uninstall:
  87. + rm -vf $(DESTDIR)$(INSTALL_CMOD)/$(TARGET)
  88. test: all
  89. cd samples && LUA_CPATH=../\?.so lua lptytest.lua