summaryrefslogtreecommitdiff
path: root/Build/source/libs/luajit
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:23:43 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:23:43 +0000
commitc594597e3480253f361154c71491adf03bc896d3 (patch)
tree4f656c0861c6ccf00118df41fc5e224bfc4e31b9 /Build/source/libs/luajit
parent352dcc581b20e25d7cc394cf602b3617cd305369 (diff)
LuaTeX: Somewhat better handling of Lua52/LuaJIT
git-svn-id: svn://tug.org/texlive/trunk@34278 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/luajit')
-rw-r--r--Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/ChangeLog6
-rw-r--r--Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/patch-05-LuaJITTeX16
-rw-r--r--Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c10
-rw-r--r--Build/source/libs/luajit/Makefile.am4
-rwxr-xr-xBuild/source/libs/luajit/configure18
-rw-r--r--Build/source/libs/luajit/configure.ac13
-rw-r--r--Build/source/libs/luajit/native/Makefile.in1
-rw-r--r--Build/source/libs/luajit/native/aclocal.m41
-rwxr-xr-xBuild/source/libs/luajit/native/configure6
-rw-r--r--Build/source/libs/luajit/native/configure.ac9
10 files changed, 51 insertions, 33 deletions
diff --git a/Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/ChangeLog b/Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/ChangeLog
index f57e15b4b73..0fa9944f9df 100644
--- a/Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/ChangeLog
+++ b/Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-05-LuaJITTeX (lj_str_new): Replace '6' by LUAI_HASHLIMIT
+ and use '#define LUAI_HASHLIMIT 5' as default as in
+ ../../libs/lua52/lua-5.2.3/src/lstring.c.
+
2014-03-14 Peter Breitenlohner <peb@mppmu.mpg.de>
Import LuaJIT-2.0.3.
diff --git a/Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/patch-05-LuaJITTeX b/Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/patch-05-LuaJITTeX
index d1e95b59f06..a33bf70ea4e 100644
--- a/Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/patch-05-LuaJITTeX
+++ b/Build/source/libs/luajit/LuaJIT-2.0.3-PATCHES/patch-05-LuaJITTeX
@@ -12,17 +12,25 @@ diff -ur -x lbitlib.c LuaJIT-2.0.3.orig/src/lj_def.h LuaJIT-2.0.3/src/lj_def.h
#define LJ_STACK_EXTRA 5 /* Extra stack space (metamethods). */
diff -ur -x lbitlib.c LuaJIT-2.0.3.orig/src/lj_str.c LuaJIT-2.0.3/src/lj_str.c
--- LuaJIT-2.0.3.orig/src/lj_str.c 2014-03-12 13:10:00.000000000 +0100
-+++ LuaJIT-2.0.3/src/lj_str.c 2014-03-14 10:04:14.540946490 +0100
-@@ -90,6 +90,8 @@
++++ LuaJIT-2.0.3/src/lj_str.c 2014-06-02 14:10:04.000000000 +0200
+@@ -90,6 +90,16 @@
g->strhash = newhash;
}
++/*
++** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to
++** compute its hash
++*/
++#if !defined(LUAI_HASHLIMIT)
++#define LUAI_HASHLIMIT 5
++#endif
++
+#define cast(t, exp) ((t)(exp))
+int luajittex_choose_hash_function = 0 ;
/* Intern a string and return string object. */
GCstr *lj_str_new(lua_State *L, const char *str, size_t lenx)
{
-@@ -98,27 +100,44 @@
+@@ -98,27 +108,44 @@
GCobj *o;
MSize len = (MSize)lenx;
MSize a, b, h = len;
@@ -37,7 +45,7 @@ diff -ur -x lbitlib.c LuaJIT-2.0.3.orig/src/lj_str.c LuaJIT-2.0.3/src/lj_str.c
+ if (luajittex_choose_hash_function==0) {
+ /* Lua 5.1.5 hash function */
+ /* for 5.2 max methods we also need to patch the vm eq */
-+ step = (len>>6)+1; /* if string is too long, don't hash all its chars Was 5, we try 6*/
++ step = (len>>LUAI_HASHLIMIT)+1; /* if string is too long, don't hash all its chars */
+ for (l1=len; l1>=step; l1-=step) /* compute hash */
+ h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));
+ } else {
diff --git a/Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c b/Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c
index 62ad5e891f5..b5fd45e5004 100644
--- a/Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c
+++ b/Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c
@@ -90,6 +90,14 @@ void lj_str_resize(lua_State *L, MSize newmask)
g->strhash = newhash;
}
+/*
+** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to
+** compute its hash
+*/
+#if !defined(LUAI_HASHLIMIT)
+#define LUAI_HASHLIMIT 5
+#endif
+
#define cast(t, exp) ((t)(exp))
int luajittex_choose_hash_function = 0 ;
/* Intern a string and return string object. */
@@ -111,7 +119,7 @@ GCstr *lj_str_new(lua_State *L, const char *str, size_t lenx)
if (luajittex_choose_hash_function==0) {
/* Lua 5.1.5 hash function */
/* for 5.2 max methods we also need to patch the vm eq */
- step = (len>>6)+1; /* if string is too long, don't hash all its chars Was 5, we try 6*/
+ step = (len>>LUAI_HASHLIMIT)+1; /* if string is too long, don't hash all its chars */
for (l1=len; l1>=step; l1-=step) /* compute hash */
h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));
} else {
diff --git a/Build/source/libs/luajit/Makefile.am b/Build/source/libs/luajit/Makefile.am
index 344e7f60f45..e32186a5f79 100644
--- a/Build/source/libs/luajit/Makefile.am
+++ b/Build/source/libs/luajit/Makefile.am
@@ -1,10 +1,10 @@
-## Makefile.am for the TeX Live subdirectory libs/luajit/native/
+## Proxy Makefile.am to build LuaJIT for TeX Live.
##
## Copyright (C) 2014 Luigi Scarso <luigi.scarso@gmail.com>
## Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
-## We want to re-distribute the whole original luajit source tree.
+## We want to re-distribute the whole original LuaJIT source tree.
##
EXTRA_DIST = $(LUAJIT_TREE)
diff --git a/Build/source/libs/luajit/configure b/Build/source/libs/luajit/configure
index 1f36913ba1f..a2ae6dde03b 100755
--- a/Build/source/libs/luajit/configure
+++ b/Build/source/libs/luajit/configure
@@ -3767,6 +3767,11 @@ IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+if test "x$host_alias" != x && test "x$build_alias" = x; then :
+ as_fn_error $? "when cross-compiling you must specify both --host and --build." "$LINENO" 5
+fi
+eval kpse_build_alias=\${build_alias-$build}
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -4844,7 +4849,7 @@ if test "$ac_res" != no; then :
fi
-LUAJIT_DEFINES=-DLUAJIT_ENABLE_LUA52COMPAT
+LUAJIT_DEFINES='-DLUAJIT_ENABLE_LUA52COMPAT -DLUAI_HASHLIMIT=6'
case $host_os:$host_cpu in #(
*darwin*:x86_64) :
@@ -5465,6 +5470,7 @@ ac_config_files="$ac_config_files Makefile include/Makefile"
+
subdirs="$subdirs native"
@@ -6921,10 +6927,12 @@ test $ac_write_fail = 0 ||
ac_configure_args="$ac_configure_args DASM_ARCH=$DASM_ARCH"
if test "x$cross_compiling" = xyes; then :
- cache_file=/dev/null
- ac_configure_args="$ac_configure_args --host='$kpse_build_alias' \
- CC='$BUILDCC' CPPFLAGS='$BUILDCPPFLAGS'\
- CFLAGS='$BUILDCFLAGS' LDFLAGS='$BUILDLDFLAGS'"
+ if test "x$cache_file" != x/dev/null; then :
+ cache_file=config.cache
+fi
+ac_configure_args="$ac_configure_args --host='$kpse_build_alias' \
+CC='$BUILDCC' CFLAGS='$BUILDCFLAGS' \
+CPPFLAGS='$BUILDCPPFLAGS' LDFLAGS='$BUILDLDFLAGS'"
fi
# configure is writing to config.log, and then calls config.status.
diff --git a/Build/source/libs/luajit/configure.ac b/Build/source/libs/luajit/configure.ac
index 38ba43f560e..9d3f891d75d 100644
--- a/Build/source/libs/luajit/configure.ac
+++ b/Build/source/libs/luajit/configure.ac
@@ -15,7 +15,7 @@ AC_CONFIG_MACRO_DIRS([../../m4 m4])
KPSE_BASIC([luajit])
-AC_CANONICAL_HOST
+KPSE_CANONICAL_HOST
AC_PROG_CC
AM_PROG_AS
@@ -62,16 +62,9 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile include/Makefile])
-AC_CONFIG_SUBDIRS([native])
-
dnl Pass DASM_ARCH to the subdirectory native,
dnl which must be configured for the build system.
-dnl When cross compiling, can not share the cache file with the subdirectory!
-AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args DASM_ARCH=$DASM_ARCH"
-AS_IF([test "x$cross_compiling" = xyes],
- [cache_file=/dev/null
- ac_configure_args="$ac_configure_args --host='$kpse_build_alias' \
- CC='$BUILDCC' CPPFLAGS='$BUILDCPPFLAGS'\
- CFLAGS='$BUILDCFLAGS' LDFLAGS='$BUILDLDFLAGS'"])])
+AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args DASM_ARCH=$DASM_ARCH"])
+KPSE_NATIVE_SUBDIRS([native])
AC_OUTPUT
diff --git a/Build/source/libs/luajit/native/Makefile.in b/Build/source/libs/luajit/native/Makefile.in
index b0b90971f21..0da973b5ca1 100644
--- a/Build/source/libs/luajit/native/Makefile.in
+++ b/Build/source/libs/luajit/native/Makefile.in
@@ -95,6 +95,7 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../../m4/kpse-common.m4 \
$(top_srcdir)/../../../m4/kpse-luajit-flags.m4 \
+ $(top_srcdir)/../../../m4/kpse-search-libs.m4 \
$(top_srcdir)/../../../m4/kpse-warnings.m4 \
$(top_srcdir)/../version.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
diff --git a/Build/source/libs/luajit/native/aclocal.m4 b/Build/source/libs/luajit/native/aclocal.m4
index 62977e15511..6da5fe3f569 100644
--- a/Build/source/libs/luajit/native/aclocal.m4
+++ b/Build/source/libs/luajit/native/aclocal.m4
@@ -1185,4 +1185,5 @@ AC_SUBST([am__untar])
m4_include([../../../m4/kpse-common.m4])
m4_include([../../../m4/kpse-luajit-flags.m4])
+m4_include([../../../m4/kpse-search-libs.m4])
m4_include([../../../m4/kpse-warnings.m4])
diff --git a/Build/source/libs/luajit/native/configure b/Build/source/libs/luajit/native/configure
index 5dd00401042..0a943985893 100755
--- a/Build/source/libs/luajit/native/configure
+++ b/Build/source/libs/luajit/native/configure
@@ -4444,7 +4444,7 @@ IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-LUAJIT_DEFINES=-DLUAJIT_ENABLE_LUA52COMPAT
+LUAJIT_DEFINES='-DLUAJIT_ENABLE_LUA52COMPAT -DLUAI_HASHLIMIT=6'
case $host_os:$host_cpu in #(
*darwin*:x86_64) :
@@ -4455,7 +4455,7 @@ esac
-lj_save_LIBS=$LIBS
+kpse_search_save_LIBS=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pow" >&5
$as_echo_n "checking for library containing pow... " >&6; }
if ${ac_cv_search_pow+:} false; then :
@@ -4512,7 +4512,7 @@ if test "$ac_res" != no; then :
fi
-LIBS=$lj_save_LIBS
+LIBS=$kpse_search_save_LIBS
case $ac_cv_search_pow in #(
"none required") :
;; #(
diff --git a/Build/source/libs/luajit/native/configure.ac b/Build/source/libs/luajit/native/configure.ac
index f023c94b15e..0eee8bb1b0e 100644
--- a/Build/source/libs/luajit/native/configure.ac
+++ b/Build/source/libs/luajit/native/configure.ac
@@ -20,14 +20,7 @@ AC_PROG_LN_S
KPSE_LUAJIT_DEFINES
-lj_save_LIBS=$LIBS
-AC_SEARCH_LIBS([pow], [m])
-LIBS=$lj_save_LIBS
-AS_CASE([$ac_cv_search_pow],
- ["none required"], [],
- [no], [AC_MSG_ERROR([Sorry, did not find pow()])],
- [MATH_LIB=$ac_cv_search_pow])
-AC_SUBST([MATH_LIB])
+KPSE_SEARCH_LIBS([MATH_LIB], [pow], [m])
AC_SUBST([DASM_ARCH])