lua: New package
[ipfire-2.x.git] / src / patches / lua-5.3.0-autotoolize.patch
1 diff -up lua-5.3.0/configure.ac.autoxxx lua-5.3.0/configure.ac
2 --- lua-5.3.0/configure.ac.autoxxx      2015-01-15 10:20:03.826889574 -0500
3 +++ lua-5.3.0/configure.ac      2015-01-15 10:20:03.826889574 -0500
4 @@ -0,0 +1,69 @@
5 +AC_PREREQ(2.59)
6 +AC_INIT([lua], [5.3.0], [https://bugzilla.redhat.com/], [lua-at], [http://www.lua.org])
7 +AC_SUBST([MAJOR_VERSION], [5.3])
8 +
9 +AC_CONFIG_HEADERS([config.h])
10 +AC_CONFIG_SRCDIR([src/lapi.c])
11 +
12 +AM_INIT_AUTOMAKE([1.9 foreign])
13 +
14 +AC_PROG_CC
15 +AC_PROG_LIBTOOL
16 +
17 +AC_ARG_WITH(
18 +  [readline],
19 +  [AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])],
20 +  [use_readline=$withval],
21 +  [use_readline=yes]
22 +)
23 +
24 +LUA_LIBS="-lm"
25 +
26 +# Check for readline
27 +READLINE_DEFS="#undef LUA_USE_READLINE"
28 +if test "x$use_readline" == "xyes"; then
29 +  AC_CHECK_LIB([readline], [readline], [:], [use_readline=no], [-lncurses])
30 +  AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [use_readline=no])
31 +  if test "x$use_readline" == "xno"; then
32 +    AC_MSG_WARN([readline headers could not be found, disabling readline support])
33 +  else
34 +    READLINE_DEFS="#define LUA_USE_READLINE"
35 +    READLINE_LIBS="-lreadline -lncurses"
36 +  fi
37 +fi
38 +AC_SUBST(READLINE_DEFS)
39 +AC_SUBST(READLINE_LIBS)
40 +
41 +case "$host" in
42 +  *-mingw*)  use_os=win32  ;;
43 +  *-darwin*) use_os=macosx ;;
44 +  *)         use_os=posix  ;;
45 +esac
46 +
47 +POSIX_DEFS="#undef LUA_USE_POSIX"
48 +LUA_DL_DEFS="#undef LUA_USE_DLOPEN"
49 +LUA_BUILD_AS_DLL_DEFS="#undef LUA_BUILD_AS_DLL"
50 +
51 +if test "x$use_os" == "xwin32"; then
52 +  LUA_BUILD_AS_DLL_DEFS="#define LUA_BUILD_AS_DLL"
53 +elif test "x$use_os" == "xmacosx"; then
54 +  POSIX_DEFS="#define LUA_USE_POSIX"
55 +  LUA_DL_DEFS="#define LUA_DL_DYLD"
56 +elif test "x$use_os" == "xposix"; then
57 +  POSIX_DEFS="#define LUA_USE_POSIX"
58 +  LUA_DL_DEFS="#define LUA_DL_DLOPEN"
59 +  LUA_LIBS="$LUA_LIBS -ldl"
60 +fi
61 +AC_SUBST(POSIX_DEFS)
62 +AC_SUBST(LUA_DL_DEFS)
63 +AC_SUBST(LUA_BUILD_AS_DLL_DEFS)
64 +
65 +AC_SUBST(LUA_LIBS)
66 +
67 +AC_CONFIG_FILES([Makefile
68 +                 src/Makefile
69 +                 src/lua.pc
70 +                 src/luaconf.h.template
71 +                 doc/Makefile
72 +])
73 +AC_OUTPUT
74 diff -up lua-5.3.0/doc/Makefile.am.autoxxx lua-5.3.0/doc/Makefile.am
75 --- lua-5.3.0/doc/Makefile.am.autoxxx   2015-01-15 10:20:03.826889574 -0500
76 +++ lua-5.3.0/doc/Makefile.am   2015-01-15 10:20:03.826889574 -0500
77 @@ -0,0 +1,4 @@
78 +man1_MANS = lua.1 luac.1
79 +
80 +EXTRA_DIST = \
81 +       contents.html logo.gif lua.1 luac.1 lua.css manual.css manual.html osi-certified-72x60.png readme.html
82 diff -up lua-5.3.0/Makefile.am.autoxxx lua-5.3.0/Makefile.am
83 --- lua-5.3.0/Makefile.am.autoxxx       2015-01-15 10:20:03.826889574 -0500
84 +++ lua-5.3.0/Makefile.am       2015-01-15 10:20:03.826889574 -0500
85 @@ -0,0 +1,3 @@
86 +SUBDIRS = src doc
87 +
88 +EXTRA_DIST = README
89 diff -up lua-5.3.0/src/.gitignore.autoxxx lua-5.3.0/src/.gitignore
90 --- lua-5.3.0/src/.gitignore.autoxxx    2015-01-15 10:20:03.826889574 -0500
91 +++ lua-5.3.0/src/.gitignore    2015-01-15 10:20:03.826889574 -0500
92 @@ -0,0 +1,5 @@
93 +lua
94 +lua.pc
95 +luac
96 +luaconf.h
97 +luaconf.h.template
98 diff -up lua-5.3.0/src/luaconf.h.template.in.autoxxx lua-5.3.0/src/luaconf.h.template.in
99 --- lua-5.3.0/src/luaconf.h.template.in.autoxxx 2015-01-15 10:20:03.828889562 -0500
100 +++ lua-5.3.0/src/luaconf.h.template.in 2015-01-15 10:22:37.420027778 -0500
101 @@ -11,6 +11,11 @@
102  #include <limits.h>
103  #include <stddef.h>
104  
105 +@POSIX_DEFS@
106 +@LUA_DL_DEFS@
107 +@LUA_BUILD_AS_DLL_DEFS@
108 +@READLINE_DEFS@
109 +
110  
111  /*
112  ** ===================================================================
113 @@ -175,9 +180,9 @@
114  
115  #else                  /* }{ */
116  
117 -#define LUA_ROOT       "/usr/local/"
118 -#define LUA_LDIR       LUA_ROOT "share/lua/" LUA_VDIR "/"
119 -#define LUA_CDIR       LUA_ROOT "lib/lua/" LUA_VDIR "/"
120 +#define LUA_ROOT       "@prefix@/"
121 +#define LUA_LDIR       "@pkgdatadir@/lua/" LUA_VDIR "/"
122 +#define LUA_CDIR       "@libdir@/lua/" LUA_VDIR "/"
123  #define LUA_PATH_DEFAULT  \
124                 LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
125                 LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
126 diff -up lua-5.3.0/src/lua.pc.in.autoxxx lua-5.3.0/src/lua.pc.in
127 --- lua-5.3.0/src/lua.pc.in.autoxxx     2015-01-15 10:20:03.827889568 -0500
128 +++ lua-5.3.0/src/lua.pc.in     2015-01-15 10:20:03.827889568 -0500
129 @@ -0,0 +1,13 @@
130 +V= @MAJOR_VERSION@
131 +R= @VERSION@
132 +prefix= @prefix@
133 +exec_prefix=${prefix}
134 +libdir= @libdir@
135 +includedir=${prefix}/include
136 +
137 +Name: Lua
138 +Description: An Extensible Extension Language
139 +Version: ${R}
140 +Requires:
141 +Libs: -llua @LUA_LIBS@
142 +Cflags: -I${includedir}
143 diff -up lua-5.3.0/src/Makefile.am.autoxxx lua-5.3.0/src/Makefile.am
144 --- lua-5.3.0/src/Makefile.am.autoxxx   2015-01-15 10:20:03.826889574 -0500
145 +++ lua-5.3.0/src/Makefile.am   2015-01-15 10:20:03.826889574 -0500
146 @@ -0,0 +1,46 @@
147 +AM_CFLAGS = -Wall
148 +
149 +include_HEADERS = lua.h lualib.h lauxlib.h lua.hpp
150 +
151 +nodist_include_HEADERS = luaconf.h
152 +
153 +lib_LTLIBRARIES = liblua.la
154 +liblua_la_LDFLAGS = -release @MAJOR_VERSION@
155 +liblua_la_SOURCES = \
156 +       lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c lcorolib.c lctype.c ldblib.c \
157 +       ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c \
158 +       loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c \
159 +       ltable.c ltablib.c ltm.c lundump.c lutf8lib.c lvm.c lzio.c \
160 +       lapi.h lcode.h lctype.h ldebug.h ldo.h lfunc.h lgc.h llex.h llimits.h \
161 +       lmem.h lobject.h lopcodes.h lparser.h lstate.h lstring.h ltable.h ltm.h \
162 +       lundump.h lvm.h lzio.h
163 +
164 +pkgconfigdir = $(libdir)/pkgconfig
165 +pkgconfig_DATA = lua.pc
166 +
167 +bin_PROGRAMS = lua luac
168 +
169 +lua_SOURCES = lua.c
170 +lua_LDADD = liblua.la @LUA_LIBS@ @READLINE_LIBS@
171 +lua_DEPENDENCIES = liblua.la
172 +
173 +luac_SOURCES = luac.c
174 +# Statically link liblua against luac since luac uses symbols not exported in liblua
175 +luac_LDADD = .libs/liblua.a @LUA_LIBS@
176 +luac_DEPENDENCIES = liblua.la
177 +
178 +EXTRA_DIST = luaconf.h.template
179 +BUILT_SOURCES = luaconf.h
180 +CLEANFILES = luaconf.h luaconf.h.template
181 +
182 +readline_defs = @READLINE_DEFS@
183 +
184 +edit =         sed \
185 +         -e 's,%prefix%,$(prefix),g' \
186 +         -e 's,%lua_datadir%,$(datadir),g' \
187 +         -e 's,%lua_libdir%,$(libdir),g'
188 +
189 +luaconf.h : luaconf.h.template
190 +       rm -f $@ $@.tmp
191 +       $(edit) $< >$@.tmp
192 +       mv $@.tmp $@