diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-06-18 11:23:43 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-06-18 11:23:43 +0000 |
commit | c594597e3480253f361154c71491adf03bc896d3 (patch) | |
tree | 4f656c0861c6ccf00118df41fc5e224bfc4e31b9 /Build | |
parent | 352dcc581b20e25d7cc394cf602b3617cd305369 (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')
21 files changed, 477 insertions, 126 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-0.9.29/src/hb-ot-cmap-table.hh b/Build/source/libs/harfbuzz/harfbuzz-0.9.29/src/hb-ot-cmap-table.hh new file mode 100644 index 00000000000..b0f01e120fc --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-0.9.29/src/hb-ot-cmap-table.hh @@ -0,0 +1,380 @@ +/* + * Copyright © 2014 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_OT_CMAP_TABLE_HH +#define HB_OT_CMAP_TABLE_HH + +#include "hb-open-type-private.hh" + + +namespace OT { + + +/* + * cmap -- Character To Glyph Index Mapping Table + */ + +#define HB_OT_TAG_cmap HB_TAG('c','m','a','p') + + +struct CmapSubtableFormat0 +{ + friend struct CmapSubtable; + + private: + inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const + { + hb_codepoint_t gid = codepoint < 256 ? glyphIdArray[codepoint] : 0; + if (!gid) + return false; + *glyph = gid; + return true; + } + + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (this); + return TRACE_RETURN (c->check_struct (this)); + } + + protected: + USHORT format; /* Format number is set to 0. */ + USHORT length; /* Byte length of this subtable. */ + USHORT language; /* Ignore. */ + BYTE glyphIdArray[256];/* An array that maps character + * code to glyph index values. */ + public: + DEFINE_SIZE_STATIC (6 + 256); +}; + +struct CmapSubtableFormat4 +{ + friend struct CmapSubtable; + + private: + inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const + { + unsigned int segCount; + const USHORT *endCount; + const USHORT *startCount; + const USHORT *idDelta; + const USHORT *idRangeOffset; + const USHORT *glyphIdArray; + unsigned int glyphIdArrayLength; + + segCount = this->segCountX2 / 2; + endCount = this->values; + startCount = endCount + segCount + 1; + idDelta = startCount + segCount; + idRangeOffset = idDelta + segCount; + glyphIdArray = idRangeOffset + segCount; + glyphIdArrayLength = (this->length - 16 - 8 * segCount) / 2; + + /* Custom bsearch. */ + int min = 0, max = (int) segCount - 1; + unsigned int i; + while (min <= max) + { + int mid = (min + max) / 2; + if (codepoint < startCount[mid]) + max = mid - 1; + else if (codepoint > endCount[mid]) + min = mid + 1; + else + { + i = mid; + goto found; + } + } + return false; + + found: + hb_codepoint_t gid; + unsigned int rangeOffset = idRangeOffset[i]; + if (rangeOffset == 0) + gid = codepoint + idDelta[i]; + else + { + /* Somebody has been smoking... */ + unsigned int index = rangeOffset / 2 + (codepoint - startCount[i]) + i - segCount; + if (unlikely (index >= glyphIdArrayLength)) + return false; + gid = glyphIdArray[index]; + if (unlikely (!gid)) + return false; + gid += idDelta[i]; + } + + *glyph = gid & 0xFFFF; + return true; + } + + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (this); + return TRACE_RETURN (c->check_struct (this) && + c->check_range (this, length) && + 16 + 4 * (unsigned int) segCountX2 < length); + } + + protected: + USHORT format; /* Format number is set to 4. */ + USHORT length; /* This is the length in bytes of the + * subtable. */ + USHORT language; /* Ignore. */ + USHORT segCountX2; /* 2 x segCount. */ + USHORT searchRange; /* 2 * (2**floor(log2(segCount))) */ + USHORT entrySelector; /* log2(searchRange/2) */ + USHORT rangeShift; /* 2 x segCount - searchRange */ + + USHORT values[VAR]; +#if 0 + USHORT endCount[segCount]; /* End characterCode for each segment, + * last=0xFFFF. */ + USHORT reservedPad; /* Set to 0. */ + USHORT startCount[segCount]; /* Start character code for each segment. */ + SHORT idDelta[segCount]; /* Delta for all character codes in segment. */ + USHORT idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */ + USHORT glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */ +#endif + + public: + DEFINE_SIZE_ARRAY (14, values); +}; + +struct CmapSubtableLongGroup +{ + friend struct CmapSubtableFormat12; + friend struct CmapSubtableFormat13; + + int cmp (hb_codepoint_t codepoint) const + { + if (codepoint < startCharCode) return -1; + if (codepoint > endCharCode) return +1; + return 0; + } + + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (this); + return TRACE_RETURN (c->check_struct (this)); + } + + private: + ULONG startCharCode; /* First character code in this group. */ + ULONG endCharCode; /* Last character code in this group. */ + ULONG glyphID; /* Glyph index; interpretation depends on + * subtable format. */ + public: + DEFINE_SIZE_STATIC (12); +}; + +template <typename UINT> +struct CmapSubtableTrimmed +{ + friend struct CmapSubtable; + + private: + inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const + { + /* Rely on our implicit array bound-checking. */ + hb_codepoint_t gid = glyphIdArray[codepoint - startCharCode]; + if (!gid) + return false; + *glyph = gid; + return true; + } + + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (this); + return TRACE_RETURN (c->check_struct (this) && glyphIdArray.sanitize (c)); + } + + protected: + UINT formatReserved; /* Subtable format and (maybe) padding. */ + UINT length; /* Byte length of this subtable. */ + UINT language; /* Ignore. */ + UINT startCharCode; /* First character code covered. */ + GenericArrayOf<UINT, GlyphID> + glyphIdArray; /* Array of glyph index values for character + * codes in the range. */ + public: + DEFINE_SIZE_ARRAY (5 * sizeof (UINT), glyphIdArray); +}; + +struct CmapSubtableFormat6 : CmapSubtableTrimmed<USHORT> {}; +struct CmapSubtableFormat10 : CmapSubtableTrimmed<ULONG > {}; + +template <typename T> +struct CmapSubtableLongSegmented +{ + friend struct CmapSubtable; + + private: + inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const + { + int i = groups.search (codepoint); + if (i == -1) + return false; + *glyph = T::group_get_glyph (groups[i], codepoint); + return true; + } + + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (this); + return TRACE_RETURN (c->check_struct (this) && groups.sanitize (c)); + } + + protected: + USHORT format; /* Subtable format; set to 12. */ + USHORT reserved; /* Reserved; set to 0. */ + ULONG length; /* Byte length of this subtable. */ + ULONG language; /* Ignore. */ + LongArrayOf<CmapSubtableLongGroup> + groups; /* Groupings. */ + public: + DEFINE_SIZE_ARRAY (16, groups); +}; + +struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12> +{ + static inline hb_codepoint_t group_get_glyph (const CmapSubtableLongGroup &group, + hb_codepoint_t u) + { return group.glyphID + (u - group.startCharCode); } +}; + +struct CmapSubtableFormat13 : CmapSubtableLongSegmented<CmapSubtableFormat13> +{ + static inline hb_codepoint_t group_get_glyph (const CmapSubtableLongGroup &group, + hb_codepoint_t u HB_UNUSED) + { return group.glyphID; } +}; + +struct CmapSubtable +{ + /* Note: We intentionally do NOT implement subtable formats 2 and 8. */ + + inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const + { + switch (u.format) { + case 0: return u.format0 .get_glyph(codepoint, glyph); + case 4: return u.format4 .get_glyph(codepoint, glyph); + case 6: return u.format6 .get_glyph(codepoint, glyph); + case 10: return u.format10.get_glyph(codepoint, glyph); + case 12: return u.format12.get_glyph(codepoint, glyph); + case 13: return u.format13.get_glyph(codepoint, glyph); + default:return false; + } + } + + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (this); + if (!u.format.sanitize (c)) return TRACE_RETURN (false); + switch (u.format) { + case 0: return TRACE_RETURN (u.format0 .sanitize (c)); + case 4: return TRACE_RETURN (u.format4 .sanitize (c)); + case 6: return TRACE_RETURN (u.format6 .sanitize (c)); + case 10: return TRACE_RETURN (u.format10.sanitize (c)); + case 12: return TRACE_RETURN (u.format12.sanitize (c)); + case 13: return TRACE_RETURN (u.format13.sanitize (c)); + default:return TRACE_RETURN (true); + } + } + + protected: + union { + USHORT format; /* Format identifier */ + CmapSubtableFormat0 format0; + CmapSubtableFormat4 format4; + CmapSubtableFormat6 format6; + CmapSubtableFormat10 format10; + CmapSubtableFormat12 format12; + CmapSubtableFormat13 format13; + } u; + public: + DEFINE_SIZE_UNION (2, format); +}; + + +struct EncodingRecord +{ + int cmp (const EncodingRecord &other) const + { + int ret; + ret = other.platformID.cmp (platformID); + if (ret) return ret; + ret = other.encodingID.cmp (encodingID); + if (ret) return ret; + return 0; + } + + inline bool sanitize (hb_sanitize_context_t *c, void *base) { + TRACE_SANITIZE (this); + return TRACE_RETURN (c->check_struct (this) && + subtable.sanitize (c, base)); + } + + USHORT platformID; /* Platform ID. */ + USHORT encodingID; /* Platform-specific encoding ID. */ + LongOffsetTo<CmapSubtable> + subtable; /* Byte offset from beginning of table to the subtable for this encoding. */ + public: + DEFINE_SIZE_STATIC (8); +}; + +struct cmap +{ + static const hb_tag_t tableTag = HB_OT_TAG_cmap; + + inline const CmapSubtable *find_subtable (unsigned int platform_id, + unsigned int encoding_id) const + { + EncodingRecord key; + key.platformID.set (platform_id); + key.encodingID.set (encoding_id); + + int result = encodingRecord.search (key); + if (result == -1) + return NULL; + + return &(this+encodingRecord[result].subtable); + } + + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (this); + return TRACE_RETURN (c->check_struct (this) && + likely (version == 0) && + encodingRecord.sanitize (c, this)); + } + + USHORT version; /* Table version number (0). */ + ArrayOf<EncodingRecord> encodingRecord; /* Encoding tables. */ + public: + DEFINE_SIZE_ARRAY (4, encodingRecord); +}; + + +} /* namespace OT */ + + +#endif /* HB_OT_CMAP_TABLE_HH */ diff --git a/Build/source/libs/lua52/ChangeLog b/Build/source/libs/lua52/ChangeLog index 1098c44d2dc..cb0a43c5918 100644 --- a/Build/source/libs/lua52/ChangeLog +++ b/Build/source/libs/lua52/ChangeLog @@ -1,3 +1,7 @@ +2014-06-02 Peter Breitenlohner <peb@mppmu.mpg.de> + + * Makefile.am (AM_CPPFLAGS): Drop LUAI_HASHLIMIT. + 2014-03-21 Peter Breitenlohner <peb@mppmu.mpg.de> * configure.ac: Add -DHAVE_UNISTD_H to LUA52_DEFINES because diff --git a/Build/source/libs/lua52/Makefile.am b/Build/source/libs/lua52/Makefile.am index 7b53e991372..3eb696515d6 100644 --- a/Build/source/libs/lua52/Makefile.am +++ b/Build/source/libs/lua52/Makefile.am @@ -1,4 +1,4 @@ -## Proxy Makefile.am to build lua52 for TeX Live. +## Proxy Makefile.am to build Lua52 for TeX Live. ## ## Copyright (C) 2013, 2014 Peter Breitenlohner <tex-live@tug.org> ## @@ -6,9 +6,7 @@ ## gives unlimited permission to copy and/or distribute it, ## with or without modifications, as long as this notice is preserved. ## -ACLOCAL_AMFLAGS = -I ../../m4 - -## We want to re-distribute the whole original zlib source tree. +## We want to re-distribute the whole Lua52 source tree. ## EXTRA_DIST = $(LUA52_TREE) @@ -22,7 +20,7 @@ dist-hook: SUBDIRS = . include -AM_CPPFLAGS = -I$(top_srcdir)/$(LUA52_TREE)/src $(LUA52_DEFINES) -DLUAI_HASHLIMIT=6 +AM_CPPFLAGS = -I$(top_srcdir)/$(LUA52_TREE)/src $(LUA52_DEFINES) AM_CFLAGS = $(WARNING_CFLAGS) noinst_LIBRARIES = liblua52.a diff --git a/Build/source/libs/lua52/Makefile.in b/Build/source/libs/lua52/Makefile.in index e85871336dd..c15bfae71af 100644 --- a/Build/source/libs/lua52/Makefile.in +++ b/Build/source/libs/lua52/Makefile.in @@ -574,10 +574,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ACLOCAL_AMFLAGS = -I ../../m4 EXTRA_DIST = $(LUA52_TREE) $(LUA52_TREE)-PATCHES error.exp SUBDIRS = . include -AM_CPPFLAGS = -I$(top_srcdir)/$(LUA52_TREE)/src $(LUA52_DEFINES) -DLUAI_HASHLIMIT=6 +AM_CPPFLAGS = -I$(top_srcdir)/$(LUA52_TREE)/src $(LUA52_DEFINES) AM_CFLAGS = $(WARNING_CFLAGS) noinst_LIBRARIES = liblua52.a nodist_liblua52_a_SOURCES = \ diff --git a/Build/source/libs/lua52/configure b/Build/source/libs/lua52/configure index bdb379d9a7c..c7e30434d3d 100755 --- a/Build/source/libs/lua52/configure +++ b/Build/source/libs/lua52/configure @@ -5170,7 +5170,7 @@ fi done -LUA52_DEFINES=-DLUA_COMPAT_MODULE +LUA52_DEFINES='-DLUA_COMPAT_MODULE -DLUAI_HASHLIMIT=6' if test "x$kpse_cv_have_win32" = xno; then LUA52_DEFINES="$LUA52_DEFINES -DLUA_USE_POSIX" 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]) diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index accf5a718fa..845a1dd3ed2 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,15 @@ +2014-06-02 Peter Breitenlohner <peb@mppmu.mpg.de> + + * lua/luatex-api.h: Use '#define LUAI_HASHLIMIT 5' as default, + as in ../../libs/lua52/lua-5.2.3/src/lstring.c and in + ../../libs/luajit/LuaJIT-2.0.3/src/lj_str.c. + * lua/lstatslib.c, tex/printing.w: Use LUAI_HASHLIMIT instead of + LUATEX_HASHCHARS and LUAJITTEX_HASHCHARS. + + * lua/luatex-api.h: Define MyName as "LuajitTeX"/"LuaTeX" and + my_name as "luajittex"/"luatex". + * lua/luainit.w, luatex.c, tex/printing.w: Use MyName, my_name. + 2014-05-14 Peter Breitenlohner <peb@mppmu.mpg.de> * tex/filename.w: Avoid redefinition of promptfilenamehelpmsg, diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c index eae0bcb98f4..2d301d7369f 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c @@ -89,11 +89,7 @@ static const char *luatexrevision(void) static lua_Number get_luatexhashchars(void) { -#ifdef LuajitTeX - return (lua_Number) LUAJITTEX_HASHCHARS; -#else - return (lua_Number) LUATEX_HASHCHARS; -#endif + return (lua_Number) LUAI_HASHLIMIT; } static const char *get_luatexhashtype(void) diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w index c95ecb43867..dbf49093516 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luainit.w +++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w @@ -53,25 +53,14 @@ and five environment variables: @c const_string LUATEX_IHELP[] = { -#ifdef LuajitTeX - "Usage: luajittex --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]", - " or: luajittex --lua=FILE [OPTION]... \\FIRST-LINE", - " or: luajittex --lua=FILE [OPTION]... &FMT ARGS", - " Run LuajitTeX on TEXNAME, usually creating TEXNAME.pdf.", -#else - "Usage: luatex --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]", - " or: luatex --lua=FILE [OPTION]... \\FIRST-LINE", - " or: luatex --lua=FILE [OPTION]... &FMT ARGS", - " Run LuaTeX on TEXNAME, usually creating TEXNAME.pdf.", -#endif + "Usage: " my_name " --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]", + " or: " my_name " --lua=FILE [OPTION]... \\FIRST-LINE", + " or: " my_name " --lua=FILE [OPTION]... &FMT ARGS", + " Run " MyName " on TEXNAME, usually creating TEXNAME.pdf.", " Any remaining COMMANDS are processed as luatex input, after TEXNAME is read.", "", " Alternatively, if the first non-option argument begins with a backslash,", -#ifdef LuajitTeX - " luajittex interprets all non-option arguments as an input line.", -#else - " luatex interprets all non-option arguments as an input line.", -#endif + " " my_name " interprets all non-option arguments as an input line.", "", " Alternatively, if the first non-option argument begins with a &, the", " next word is taken as the FMT to read, overriding all else. Any", @@ -94,11 +83,7 @@ const_string LUATEX_IHELP[] = { " --fmt=FORMAT load the format file FORMAT", " --halt-on-error stop processing at the first error", " --help display help and exit", -#ifdef LuajitTeX - " --ini be iniluajittex, for dumping formats", -#else - " --ini be iniluatex, for dumping formats", -#endif + " --ini be ini" my_name ", for dumping formats", " --interaction=STRING set interaction mode (STRING=batchmode/nonstopmode/scrollmode/errorstopmode)", " --jobname=STRING set the job name to STRING", " --kpathsea-debug=NUMBER set path searching debugging flags according to the bits of NUMBER", @@ -419,11 +404,7 @@ static void parse_options(int ac, char **av) } else if (ARGUMENT_IS("version")) { print_version_banner(); /* *INDENT-OFF* */ -#ifdef LuajitTeX - puts("\n\nExecute 'luajittex --credits' for credits and version details.\n\n" -#else - puts("\n\nExecute 'luatex --credits' for credits and version details.\n\n" -#endif + puts("\n\nExecute '" my_name " --credits' for credits and version details.\n\n" "There is NO warranty. Redistribution of this software is covered by\n" "the terms of the GNU General Public License, version 2 or (at your option)\n" "any later version. For more information about these matters, see the file\n" @@ -442,11 +423,7 @@ static void parse_options(int ac, char **av) print_version_banner(); /* *INDENT-OFF* */ puts("\n\nThe LuaTeX team is Hans Hagen, Hartmut Henkel, Taco Hoekwater.\n" -#ifdef LuajitTex - "LuajitTeX merges and builds upon (parts of) the code from these projects:\n\n" -#else - "LuaTeX merges and builds upon (parts of) the code from these projects:\n\n" -#endif + MyName " merges and builds upon (parts of) the code from these projects:\n\n" "tex by Donald Knuth\n" "etex by Peter Breitenlohner, Phil Taylor and friends\n" "omega by John Plaice and Yannis Haralambous\n" @@ -872,33 +849,21 @@ void lua_initialize(int ac, char **av) static char LC_CTYPE_C[] = "LC_CTYPE=C"; static char LC_COLLATE_C[] = "LC_COLLATE=C"; static char LC_NUMERIC_C[] = "LC_NUMERIC=C"; -#ifdef LuajitTeX - static char engine_luatex[] = "engine=luajittex"; -#else - static char engine_luatex[] = "engine=luatex"; -#endif + static char engine_luatex[] = "engine=" my_name; /* Save to pass along to topenin. */ argc = ac; argv = av; if (luatex_svn < 0) { -#ifdef LuajitTeX - const char *fmt = "This is LuajitTeX, Version %s" WEB2CVERSION; -#else - const char *fmt = "This is LuaTeX, Version %s" WEB2CVERSION; -#endif + const char *fmt = "This is " MyName ", Version %s" WEB2CVERSION; size_t len; len = strlen(fmt) + strlen(luatex_version_string) ; banner = xmalloc(len); sprintf(banner, fmt, luatex_version_string); } else { -#ifdef LuajitTeX - const char *fmt = "This is LuajitTeX, Version %s" WEB2CVERSION " (rev %d)"; -#else - const char *fmt = "This is LuaTeX, Version %s" WEB2CVERSION " (rev %d)"; -#endif + const char *fmt = "This is " MyName ", Version %s" WEB2CVERSION " (rev %d)"; size_t len; len = strlen(fmt) + strlen(luatex_version_string) + 6; banner = xmalloc(len); diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h index 77792e94b4d..a42b147c301 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h +++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h @@ -30,6 +30,11 @@ # include "lualib.h" #ifdef LuajitTeX # include "luajit.h" +# define MyName "LuajitTeX" +# define my_name "luajittex" +#else +# define MyName "LuaTeX" +# define my_name "luatex" #endif #ifdef __cplusplus @@ -135,10 +140,8 @@ extern char *jithash_hashname ; #endif -#ifdef LuajitTeX -#define LUAJITTEX_HASHCHARS 6 /* todo: It must be like that one on lj_str.c */ -#else -#define LUATEX_HASHCHARS 6 /* todo: It must be LUAI_HASHLIMIT! */ +#if !defined(LUAI_HASHLIMIT) +#define LUAI_HASHLIMIT 5 #endif extern unsigned char show_luahashchars ; diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index fb655167849..b98c250493b 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -26,11 +26,7 @@ int luatex_version = 79; /* \.{\\luatexversion} */ int luatex_revision = '1'; /* \.{\\luatexrevision} */ int luatex_date_info = 2014040100; /* the compile date is now hardwired */ const char *luatex_version_string = "beta-0.79.1"; -#ifdef LuajitTeX -const char *engine_name = "luajittex"; /* the name of this engine */ -#else -const char *engine_name = "luatex"; /* the name of this engine */ -#endif +const char *engine_name = my_name; /* the name of this engine */ #include <kpathsea/c-ctype.h> #include <kpathsea/line.h> diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w index 53bd0c79a8a..9b2404c0196 100644 --- a/Build/source/texk/web2c/luatexdir/tex/printing.w +++ b/Build/source/texk/web2c/luatexdir/tex/printing.w @@ -462,28 +462,16 @@ void print_banner(const char *v, int ver) callback_id = callback_defined(start_run_callback); if (callback_id == 0) { if (ver < 0) -#ifdef LuajitTeX - fprintf(term_out, "This is LuajitTeX, Version %s ", v); -#else - fprintf(term_out, "This is LuaTeX, Version %s ", v); -#endif + fprintf(term_out, "This is " MyName ", Version %s ", v); else -#ifdef LuajitTeX - fprintf(term_out, "This is LuajitTeX, Version %s%s (rev %d) ", v, -#else - fprintf(term_out, "This is LuaTeX, Version %s%s (rev %d) ", v, -#endif + fprintf(term_out, "This is " MyName ", Version %s%s (rev %d) ", v, WEB2CVERSION, ver); if (format_ident > 0) print(format_ident); print_ln(); if (show_luahashchars){ wterm(' '); -#ifdef LuajitTeX - fprintf(term_out,"Number of bits used by the hash function (luajittex): %d",LUAJITTEX_HASHCHARS); -#else - fprintf(term_out,"Number of bits used by the hash function (luatex): %d",LUATEX_HASHCHARS); -#endif + fprintf(term_out,"Number of bits used by the hash function (" my_name "): %d",LUAI_HASHLIMIT); print_ln(); } if (shellenabledp) { @@ -508,17 +496,9 @@ void log_banner(const char *v, int ver) if (month > 12) month = 0; if (ver < 0) -#ifdef LuajitTeX - fprintf(log_file, "This is LuajitTeX, Version %s ", v); -#else - fprintf(log_file, "This is LuaTeX, Version %s ", v); -#endif + fprintf(log_file, "This is " MyName ", Version %s ", v); else -#ifdef LuajitTeX - fprintf(log_file, "This is LuajitTeX, Version %s%s (rev %d) ", v, -#else - fprintf(log_file, "This is LuaTeX, Version %s%s (rev %d) ", v, -#endif + fprintf(log_file, "This is " MyName ", Version %s%s (rev %d) ", v, WEB2CVERSION, ver); print(format_ident); print_char(' '); |