[vlc-commits] contrib: use 32-bits LUAC file format on all platforms
Rémi Denis-Courmont
git at videolan.org
Wed Dec 14 19:03:36 CET 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Dec 14 20:00:47 2011 +0200| [01ec2d6e8c9347a0c8fec3db0937ef786a97910e] | committer: Rémi Denis-Courmont
contrib: use 32-bits LUAC file format on all platforms
In other words, 64-bits platform will support 32-bits LUAC files and
reject 64-bits LUAC files when using contribs.
This should ease cross-compilation and copying luac files manually.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=01ec2d6e8c9347a0c8fec3db0937ef786a97910e
---
contrib/src/lua/luac-32bits.patch | 99 +++++++++++++++++++++++++++++++++++++
contrib/src/lua/rules.mak | 1 +
2 files changed, 100 insertions(+), 0 deletions(-)
diff --git a/contrib/src/lua/luac-32bits.patch b/contrib/src/lua/luac-32bits.patch
new file mode 100644
index 0000000..9f34518
--- /dev/null
+++ b/contrib/src/lua/luac-32bits.patch
@@ -0,0 +1,99 @@
+diff -ru lua.orig/src/ldump.c lua/src/ldump.c
+--- lua.orig/src/ldump.c 2011-12-14 19:26:18.000000000 +0200
++++ lua/src/ldump.c 2011-12-14 19:49:20.000000000 +0200
+@@ -44,7 +44,8 @@
+
+ static void DumpInt(int x, DumpState* D)
+ {
+- DumpVar(x,D);
++ int32_t i = x;
++ DumpVar(i,D);
+ }
+
+ static void DumpNumber(lua_Number x, DumpState* D)
+@@ -62,12 +63,12 @@
+ {
+ if (s==NULL || getstr(s)==NULL)
+ {
+- size_t size=0;
++ uint32_t size=0;
+ DumpVar(size,D);
+ }
+ else
+ {
+- size_t size=s->tsv.len+1; /* include trailing '\0' */
++ uint32_t size=s->tsv.len+1; /* include trailing '\0' */
+ DumpVar(size,D);
+ DumpBlock(getstr(s),size,D);
+ }
+diff -ru lua.orig/src/luaconf.h lua/src/luaconf.h
+--- lua.orig/src/luaconf.h 2011-12-14 19:26:18.000000000 +0200
++++ lua/src/luaconf.h 2011-12-14 19:54:25.000000000 +0200
+@@ -10,6 +10,8 @@
+
+ #include <limits.h>
+ #include <stddef.h>
++#include <stdint.h>
++#include <sys/types.h>
+
+
+ /*
+@@ -409,20 +411,12 @@
+ ** part always works, but may waste space on machines with 64-bit
+ ** longs.) Probably you do not need to change this.
+ */
+-#if LUAI_BITSINT >= 32
+-#define LUAI_UINT32 unsigned int
+-#define LUAI_INT32 int
+-#define LUAI_MAXINT32 INT_MAX
++
++#define LUAI_UINT32 uint32_t
++#define LUAI_INT32 int32_t
++#define LUAI_MAXINT32 0x7ffffff
+ #define LUAI_UMEM size_t
+-#define LUAI_MEM ptrdiff_t
+-#else
+-/* 16-bit ints */
+-#define LUAI_UINT32 unsigned long
+-#define LUAI_INT32 long
+-#define LUAI_MAXINT32 LONG_MAX
+-#define LUAI_UMEM unsigned long
+-#define LUAI_MEM long
+-#endif
++#define LUAI_MEM ssize_t
+
+
+ /*
+Seulement dans lua/src: lua.o
+diff -ru lua.orig/src/lundump.c lua/src/lundump.c
+--- lua.orig/src/lundump.c 2011-12-14 19:26:18.000000000 +0200
++++ lua/src/lundump.c 2011-12-14 19:50:41.000000000 +0200
+@@ -60,7 +60,7 @@
+
+ static int LoadInt(LoadState* S)
+ {
+- int x;
++ int32_t x;
+ LoadVar(S,x);
+ IF (x<0, "bad integer");
+ return x;
+@@ -75,7 +75,7 @@
+
+ static TString* LoadString(LoadState* S)
+ {
+- size_t size;
++ uint32_t size;
+ LoadVar(S,size);
+ if (size==0)
+ return NULL;
+@@ -219,8 +219,8 @@
+ *h++=(char)LUAC_VERSION;
+ *h++=(char)LUAC_FORMAT;
+ *h++=(char)*(char*)&x; /* endianness */
+- *h++=(char)sizeof(int);
+- *h++=(char)sizeof(size_t);
++ *h++=(char)sizeof(int32_t);
++ *h++=(char)sizeof(uint32_t);
+ *h++=(char)sizeof(Instruction);
+ *h++=(char)sizeof(lua_Number);
+ *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */
diff --git a/contrib/src/lua/rules.mak b/contrib/src/lua/rules.mak
index 9321663..fc11618 100644
--- a/contrib/src/lua/rules.mak
+++ b/contrib/src/lua/rules.mak
@@ -32,6 +32,7 @@ $(TARBALLS)/lua-$(LUA_VERSION).tar.gz:
lua: lua-$(LUA_VERSION).tar.gz .sum-lua
$(UNPACK)
$(APPLY) $(SRC)/lua/lua-noreadline.patch
+ $(APPLY) $(SRC)/lua/luac-32bits.patch
ifdef HAVE_MACOSX
(cd $(UNPACK_DIR) && \
sed -e 's%gcc%$(CC)%' \
More information about the vlc-commits
mailing list