SHA256
1
0
forked from pool/gnuplot

Accepting request 104758 from home:burnus:branches:Publishing

Fix building with newer LUA versions (i.e. fix "openSUSE Factory" build failures)

Changed since last request: Re-diffed gnuplot.changes. (For some reason, there was a gnuplot.changes merge failure despite osc pull - and there was some spurious change in that file. Try again ...)

Builds successfully on oS 12.1 and Factory. 11.4 is unresolvable (texlive issue). SLES 11 fails as texlive-2007 clashes with texlive-bin-2010 (i386) or because of different tex.fmt (mixing different TeX versions, x86-64). SLES 10 fails for epstopdf in ghostscript. All those issues are unrelated to the patch.

OBS-URL: https://build.opensuse.org/request/show/104758
OBS-URL: https://build.opensuse.org/package/show/Publishing/gnuplot?expand=0&rev=28
This commit is contained in:
Dr. Werner Fink 2012-02-13 15:43:25 +00:00 committed by Git OBS Bridge
parent 1e6a74c439
commit aae35d918e
3 changed files with 122 additions and 5 deletions

108
gnuplot-lua.diff Normal file
View File

@ -0,0 +1,108 @@
Support lua 5.2, based on Rev. 1.17.2.1 from the
gnuplot branch-4-6-stable.
Cf. http://gnuplot.cvs.sourceforge.net/viewvc/gnuplot/gnuplot/term/lua.trm?view=log
--- term/lua.trm.orig 2012-02-09 20:16:56.000000000 +0100
+++ term/lua.trm 2012-02-09 20:17:07.000000000 +0100
@@ -113,6 +113,41 @@
*/
static char last_error_msg[MAX_LINE_LEN+1] = "";
+#if LUA_VERSION_NUM > 501
+/*
+ * two helper functions to ease transitioning to lua 5.2
+ */
+
+/*
+ * same as lua_getfield(L, LUA_GLOBALINDEXS, f) in lua 5.1
+ */
+static void LUA_getfield_global(lua_State *L, const char *f)
+{
+ lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
+ lua_getfield(L, -1, f);
+ lua_replace(L, -2);
+}
+/*
+ * approximately the same as luaL_register(L, libname, l) in lua 5.1
+ */
+static void LUA_register(lua_State *L, const char *libname, const luaL_Reg *l)
+{
+ if (!libname)
+ luaL_setfuncs(L, l, 0);
+ else {
+ LUA_getfield_global(L, "package");
+ lua_getfield(L, -1, "loaded");
+ lua_newtable(L);
+ luaL_setfuncs(L, l, 0);
+ lua_pushvalue(L, -1);
+ lua_setglobal(L, libname);
+ lua_setfield(L, -2, libname);
+ lua_pop(L, 2);
+ lua_getglobal(L, libname);
+ }
+}
+#endif /* LUA_VERSION_NUM > 501 */
+
/*
* Handle Lua functions
*/
@@ -378,8 +413,11 @@
return(1);
}
-
+#if LUA_VERSION_NUM > 500
+static const luaL_Reg gp_methods[] = {
+#else
static const luaL_reg gp_methods[] = {
+#endif
{"write", LUA_GP_write},
{"int_error", LUA_GP_int_error},
{"int_warn", LUA_GP_int_warn},
@@ -395,7 +433,11 @@
static void
LUA_register_gp_fnc ()
{
+#if LUA_VERSION_NUM > 501
+ LUA_register(L, LUA_GP_FNC, gp_methods);
+#else
luaL_register(L, LUA_GP_FNC, gp_methods);
+#endif
}
@@ -524,7 +566,11 @@
*/
if (L)
lua_close(L);
+#if LUA_VERSION_NUM > 500
+ L = luaL_newstate();
+#else
L = lua_open();
+#endif
luaL_openlibs(L); /* Load Lua libraries */
luaopen_debug(L);
@@ -571,14 +617,22 @@
sf = lua_gettop(L);
/* lua_settop(L, 0);*/ /* clear stack */
+#if LUA_VERSION_NUM > 501
+ LUA_getfield_global(L, "debug");
+#else
lua_getfield(L, LUA_GLOBALSINDEX, "debug");
+#endif
lua_getfield(L, -1, "traceback");
lua_remove(L, -2); /* rm debug */
tb = lua_gettop(L); /* store "traceback" */
/* create table `term' */
lua_newtable(L);
lua_setglobal(L, "term");
+#if LUA_VERSION_NUM > 501
+ LUA_getfield_global(L, "term");
+#else
lua_getfield(L, LUA_GLOBALSINDEX, "term");
+#endif
luaterm = lua_gettop(L); /* store `term' */
/* register gp functions */

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Feb 13 15:03:20 UTC 2012 - burnus@net-b.de
- Make gnuplot build with newer LUA version.
-------------------------------------------------------------------
Mon Feb 13 11:46:11 UTC 2012 - werner@suse.de
@ -660,7 +665,7 @@ Thu Oct 23 13:59:59 MET DST 1997 - werner@suse.de
Mon Feb 3 23:03:09 MET 1997 - werner@suse.de
- Update auf Version 3.5-beta-3.6pl319
- Diese Version hat splines und bezier zum Fit für
- Diese Version hat splines und bezier zum Fit für
von Messdaten.
- verschoben von ap1 -> xap1
@ -668,7 +673,7 @@ Mon Feb 3 23:03:09 MET 1997 - werner@suse.de
Wed Nov 13 23:06:41 MET 1996 - werner@suse.de
- Neu Erstellen des Paketes:
Mit vollständiger Dokumentation und Beispielen
Mit vollständiger Dokumentation und Beispielen
unter /usr/doc/packages/gnuplot/
- fig und bfig (xfig-Format 2.1)
wird von xfig in xfig-Format 3.2 konvertiert.

View File

@ -1,7 +1,7 @@
#
# spec file for package gnuplot
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: gnuplot
BuildRequires: automake
BuildRequires: cairo-devel
@ -48,11 +49,11 @@ BuildRequires: plotutils-devel
BuildRequires: plotutils
%endif
Url: http://www.gnuplot.info/
License: SUSE-Gnuplot and GPL-2.0+
Group: Productivity/Graphics/Visualization/Graph
Version: 4.4.4
Release: 0
Summary: GNUplot a Function Plotting Utility
License: SUSE-Gnuplot and GPL-2.0+
Group: Productivity/Graphics/Visualization/Graph
Source0: gnuplot-%{version}.tar.bz2
Source2: gnuplot-fr.doc.bz2
Source3: README.whynot
@ -61,6 +62,7 @@ Patch1: gnuplot-4.4.0-x11ovf.dif
Patch2: gnuplot-4.4.0-fonts.dif
Patch4: gnuplot-4.4.0-demo.dif
Patch6: gnuplot-4.2.5-fix-format-errors.dif
Patch7: gnuplot-lua.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{expand: %%global _exec_prefix %(type -p pkg-config &>/dev/null && pkg-config --variable prefix x11 || echo /usr/X11R6)}
%if "%_exec_prefix" == "/usr/X11R6"
@ -89,6 +91,7 @@ and can easily be extended to include new devices.
%package doc
Summary: Documentation of GNUplot
Group: Productivity/Graphics/Visualization/Graph
Requires: %{name}
Requires(post): %install_info_prereq
Requires(postun): %install_info_prereq
@ -113,6 +116,7 @@ test $? -eq 0 || exit 1
%patch -P 2 -p 0 -b .font
%patch -P 4 -p 0
%patch -P 6 -p 0
%patch -P 7 -p 0
%patch -P 0 -p 0
%build