From e46f544c2745ebe75ac7bdcd857c92bc499bd278 Mon Sep 17 00:00:00 2001
From: Luigi Scarso <luigi.scarso@gmail.com>
Date: Thu, 1 Oct 2015 17:19:48 +0000
Subject: [PATCH] sync with TL38511

---
 source/build-aux/texinfo.tex                  | 14 ++++-
 source/libs/README                            |  4 +-
 source/libs/luajit/ChangeLog                  |  5 ++
 .../patch-07-x86_64-cygwin                    | 59 +++++++++++++++++++
 source/libs/luajit/Makefile.am                |  2 +-
 source/libs/luajit/Makefile.in                |  2 +-
 source/libs/luajit/configure                  | 26 +++++++-
 source/libs/luajit/configure.ac               |  7 ++-
 source/libs/luajit/m4/lj-system.m4            |  7 ++-
 source/texk/README                            |  6 +-
 source/texk/kpathsea/texmf.cnf                |  2 +-
 11 files changed, 118 insertions(+), 16 deletions(-)
 create mode 100644 source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-07-x86_64-cygwin

diff --git a/source/build-aux/texinfo.tex b/source/build-aux/texinfo.tex
index bff8eb017..347f86396 100644
--- a/source/build-aux/texinfo.tex
+++ b/source/build-aux/texinfo.tex
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2015-09-20.17}
+\def\texinfoversion{2015-09-23.01}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -4864,11 +4864,17 @@ end
 \def\requireopenindexfile#1{%
 \ifnum\csname #1indfile\endcsname=0
   \expandafter\newwrite \csname#1indfile\endcsname
-  \immediate\openout\csname#1indfile\endcsname \jobname.#1 % Open the file
+  \edef\suffix{#1}%
+  % A .fls suffix would conflict with the file extension for the output
+  % of -recorder, so use .f1s instead.
+  \ifx\suffix\indexisfl\def\suffix{f1}\fi
+  % Open the file
+  \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
   % Using \immediate here prevents an object entering into the current box,
   % which could confound checks such as those in \safewhatsit for preceding
   % skips.
 \fi}
+\def\indexisfl{fl}
 
 % Output \ as {\indexbackslash}, because \ is an escape character in
 % the index files.
@@ -5059,7 +5065,9 @@ end
   % as its first line, TeX doesn't complain about mismatched braces
   % (because it thinks @} is a control sequence).
   \catcode`\@ = 11
-  \openin 1 \jobname.#1s
+  % See comment in \requireopenindexfile.
+  \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
+  \openin 1 \jobname.\indexname s
   \ifeof 1
     % \enddoublecolumns gets confused if there is no text in the index,
     % and it loses the chapter title and the aux file entries for the
diff --git a/source/libs/README b/source/libs/README
index 2e850bc01..78aa8d162 100644
--- a/source/libs/README
+++ b/source/libs/README
@@ -1,4 +1,4 @@
-$Id: README 38475 2015-09-27 14:11:56Z peter $
+$Id: README 38510 2015-10-01 06:50:49Z peter $
 Public domain.  Originally created by Karl Berry, 2005.
 
 Libraries we compile for TeX Live.
@@ -24,7 +24,7 @@ gmp 6.0.0 - checked 25mar14
 graphite2 1.3.3 - checked 27sep15
   http://sourceforge.net/projects/silgraphite/files/graphite2/
 
-harfbuzz 1.0.3 - checked 2sep15
+harfbuzz 1.0.4 - checked 1oct15
   http://www.freedesktop.org/software/harfbuzz/release/
 
 icu 56.1 (rc) - checked 27sep15
diff --git a/source/libs/luajit/ChangeLog b/source/libs/luajit/ChangeLog
index 0d821f1cb..5d02d9a8d 100644
--- a/source/libs/luajit/ChangeLog
+++ b/source/libs/luajit/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-28  Peter Breitenlohner  <peb@mppmu.mpg.de>
+
+	* Makefile.am, configure.ac, m4/lj-system.m4: Try to stay
+	closer to the distributed build system.
+
 2015-09-09  Peter Breitenlohner  <peb@mppmu.mpg.de>
 
 	* Makefile.am, m4/lj-system.m4: Keep preprocessed src/lj_arch.h
diff --git a/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-07-x86_64-cygwin b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-07-x86_64-cygwin
new file mode 100644
index 000000000..b3bdead9d
--- /dev/null
+++ b/source/libs/luajit/LuaJIT-2.1.0-beta1-PATCHES/patch-07-x86_64-cygwin
@@ -0,0 +1,59 @@
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lj_alloc.c LuaJIT-2.1.0-beta1/src/lj_alloc.c
+--- LuaJIT-2.1.0-beta1.orig/src/lj_alloc.c	2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lj_alloc.c	2015-09-27 19:05:37.000000000 +0200
+@@ -196,7 +196,7 @@
+   return ptr;
+ }
+ 
+-#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__)
++#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__) || defined(__CYGWIN__)
+ 
+ /* OSX and FreeBSD mmap() use a naive first-fit linear search.
+ ** That's perfect for us. Except that -pagezero_size must be set for OSX,
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lj_arch.h LuaJIT-2.1.0-beta1/src/lj_arch.h
+--- LuaJIT-2.1.0-beta1.orig/src/lj_arch.h	2015-09-04 08:58:07.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lj_arch.h	2015-09-27 19:05:37.000000000 +0200
+@@ -155,7 +155,11 @@
+ #define LJ_ARCH_NAME		"x64"
+ #define LJ_ARCH_BITS		64
+ #define LJ_ARCH_ENDIAN		LUAJIT_LE
+-#define LJ_ABI_WIN		LJ_TARGET_WINDOWS
++#if LJ_TARGET_WINDOWS || __CYGWIN__
++#define LJ_ABI_WIN		1
++#else
++#define LJ_ABI_WIN		0
++#endif
+ #define LJ_TARGET_X64		1
+ #define LJ_TARGET_X86ORX64	1
+ #define LJ_TARGET_EHRETREG	0
+diff -ur LuaJIT-2.1.0-beta1.orig/src/lj_err.c LuaJIT-2.1.0-beta1/src/lj_err.c
+--- LuaJIT-2.1.0-beta1.orig/src/lj_err.c	2015-08-25 23:35:00.000000000 +0200
++++ LuaJIT-2.1.0-beta1/src/lj_err.c	2015-09-27 19:05:37.000000000 +0200
+@@ -183,7 +183,7 @@
+ 
+ /* -- External frame unwinding -------------------------------------------- */
+ 
+-#if defined(__GNUC__) && !LJ_NO_UNWIND && !LJ_TARGET_WINDOWS
++#if defined(__GNUC__) && !LJ_NO_UNWIND && !LJ_ABI_WIN
+ 
+ /*
+ ** We have to use our own definitions instead of the mandatory (!) unwind.h,
+@@ -349,7 +349,7 @@
+ 
+ #endif
+ 
+-#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
++#elif LJ_TARGET_X64 && LJ_ABI_WIN
+ 
+ /*
+ ** Someone in Redmond owes me several days of my life. A lot of this is
+@@ -414,7 +414,9 @@
+     if (cf2) {  /* We catch it, so start unwinding the upper frames. */
+       if (rec->ExceptionCode == LJ_MSVC_EXCODE ||
+ 	  rec->ExceptionCode == LJ_GCC_EXCODE) {
++#if LJ_TARGET_WINDOWS
+ 	__DestructExceptionObject(rec, 1);
++#endif
+ 	setstrV(L, L->top++, lj_err_str(L, LJ_ERR_ERRCPP));
+       } else if (!LJ_EXCODE_CHECK(rec->ExceptionCode)) {
+ 	/* Don't catch access violations etc. */
diff --git a/source/libs/luajit/Makefile.am b/source/libs/luajit/Makefile.am
index 1eb620204..fcf39f6a4 100644
--- a/source/libs/luajit/Makefile.am
+++ b/source/libs/luajit/Makefile.am
@@ -16,7 +16,7 @@ EXTRA_DIST += $(LUAJIT_TREE)-PATCHES
 include $(srcdir)/../../am/dist_hook.am
 NEVER_NAMES += $(NEVER_NAMES_SUB) $(NEVER_NAMES_LT)
 
-AM_CPPFLAGS = -I$(srcdir)/$(LUAJIT_TREE)/src $(LUAJIT_DEFINES)
+AM_CPPFLAGS = -I$(srcdir)/$(LUAJIT_TREE)/src $(LUAJIT_DEFINES) -U_FORTIFY_SOURCE
 AM_CFLAGS = $(LUAJIT_CFLAGS) -Wall
 AM_CCASFLAGS = $(LUAJIT_CFLAGS)
 
diff --git a/source/libs/luajit/Makefile.in b/source/libs/luajit/Makefile.in
index 9c6a2cbed..a350a8902 100644
--- a/source/libs/luajit/Makefile.in
+++ b/source/libs/luajit/Makefile.in
@@ -675,7 +675,7 @@ NEVER_DIST = `find . $(NEVER_NAMES)`
 NEVER_NAMES = -name .svn $(NEVER_NAMES_SUB) $(NEVER_NAMES_LT)
 NEVER_NAMES_SUB = -o -name .deps -o -name .dirstamp -o -name '*.$(OBJEXT)'
 NEVER_NAMES_LT = -o -name .libs -o -name '*.lo'
-AM_CPPFLAGS = -I$(srcdir)/$(LUAJIT_TREE)/src $(LUAJIT_DEFINES)
+AM_CPPFLAGS = -I$(srcdir)/$(LUAJIT_TREE)/src $(LUAJIT_DEFINES) -U_FORTIFY_SOURCE
 AM_CFLAGS = $(LUAJIT_CFLAGS) -Wall
 AM_CCASFLAGS = $(LUAJIT_CFLAGS)
 SUBDIRS = . native include
diff --git a/source/libs/luajit/configure b/source/libs/luajit/configure
index 84b03b5d6..0ab857b34 100755
--- a/source/libs/luajit/configure
+++ b/source/libs/luajit/configure
@@ -14144,15 +14144,19 @@ if ac_fn_c_try_cpp "$LINENO"; then :
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for architecture" >&5
 $as_echo_n "checking for architecture... " >&6; }
 cp conftest.i system_flags
+LUAJIT_CFLAGS='-fomit-frame-pointer'
 if grep 'LJ_TARGET_X64 ' conftest.i >/dev/null 2>&1; then :
   LJARCH=x64
 elif grep 'LJ_TARGET_X86 ' conftest.i >/dev/null 2>&1; then :
   LJARCH=x86
-         LUAJIT_CFLAGS='-march=i686 -msse -msse2 -mfpmath=sse'
+         LUAJIT_CFLAGS="$LUAJIT_CFLAGS -march=i686 -msse -msse2 -mfpmath=sse"
 elif grep 'LJ_TARGET_ARM ' conftest.i >/dev/null 2>&1; then :
   LJARCH=arm
 elif grep 'LJ_TARGET_ARM64 ' conftest.i >/dev/null 2>&1; then :
   LJARCH=arm64
+         if test "x$LJHOST" = xiOS; then :
+  LUAJIT_CFLAGS='-fno-omit-frame-pointer'
+fi
 elif grep 'LJ_TARGET_PPC ' conftest.i >/dev/null 2>&1; then :
   LJARCH=ppc
          if grep 'LJ_LE 1' conftest.i >/dev/null 2>&1; then :
@@ -14263,12 +14267,30 @@ CPPFLAGS=$lj_save_CPPFLAGS
 case $LJHOST in #(
   Windows) :
     LJVM_MODE=peobj
-                    LUAJIT_CFLAGS=-malign-double ;; #(
+                    LUAJIT_CFLAGS="$LUAJIT_CFLAGS -malign-double" ;; #(
   Darwin | iOS) :
     LJVM_MODE=machasm ;; #(
   *) :
     LJVM_MODE=elfasm ;;
 esac
+lj_save_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -fno-stack-protector"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  LUAJIT_CFLAGS="$LUAJIT_CFLAGS -fno-stack-protector"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS=$lj_save_CFLAGS
  if test "x$LJVM_MODE" = xpeobj; then
   PEOBJ_TRUE=
   PEOBJ_FALSE='#'
diff --git a/source/libs/luajit/configure.ac b/source/libs/luajit/configure.ac
index bec139f35..d56af8258 100644
--- a/source/libs/luajit/configure.ac
+++ b/source/libs/luajit/configure.ac
@@ -48,9 +48,14 @@ AS_CASE([$host_os],
 LJ_ARCH()
 AS_CASE([$LJHOST],
         [Windows], [LJVM_MODE=peobj
-                    LUAJIT_CFLAGS=-malign-double],
+                    LUAJIT_CFLAGS="$LUAJIT_CFLAGS -malign-double"],
         [Darwin | iOS], [LJVM_MODE=machasm],
                         [LJVM_MODE=elfasm])
+lj_save_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -fno-stack-protector"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
+                  [LUAJIT_CFLAGS="$LUAJIT_CFLAGS -fno-stack-protector"])
+CFLAGS=$lj_save_CFLAGS
 AM_CONDITIONAL([PEOBJ], [test "x$LJVM_MODE" = xpeobj])
 
 AC_SUBST([LUAJIT_CFLAGS])
diff --git a/source/libs/luajit/m4/lj-system.m4 b/source/libs/luajit/m4/lj-system.m4
index 5f0d164af..f8069d79c 100644
--- a/source/libs/luajit/m4/lj-system.m4
+++ b/source/libs/luajit/m4/lj-system.m4
@@ -13,15 +13,18 @@ m4_define([_LJ_ARCH], [dnl
 rm -f dynasm_flags native_flags
 AC_MSG_CHECKING([for architecture])
 cp conftest.i system_flags
+LUAJIT_CFLAGS='-fomit-frame-pointer'
 AS_IF([grep 'LJ_TARGET_X64 ' conftest.i >/dev/null 2>&1],
         [LJARCH=x64],
       [grep 'LJ_TARGET_X86 ' conftest.i >/dev/null 2>&1],
         [LJARCH=x86
-         LUAJIT_CFLAGS='-march=i686 -msse -msse2 -mfpmath=sse'],
+         LUAJIT_CFLAGS="$LUAJIT_CFLAGS -march=i686 -msse -msse2 -mfpmath=sse"],
       [grep 'LJ_TARGET_ARM ' conftest.i >/dev/null 2>&1],
         [LJARCH=arm],
       [grep 'LJ_TARGET_ARM64 ' conftest.i >/dev/null 2>&1],
-        [LJARCH=arm64],
+        [LJARCH=arm64
+         AS_IF([test "x$LJHOST" = xiOS],
+               [LUAJIT_CFLAGS='-fno-omit-frame-pointer'])],
       [grep 'LJ_TARGET_PPC ' conftest.i >/dev/null 2>&1],
         [LJARCH=ppc
          AS_IF([grep 'LJ_LE 1' conftest.i >/dev/null 2>&1],
diff --git a/source/texk/README b/source/texk/README
index f185a5ddd..c5fad1a86 100644
--- a/source/texk/README
+++ b/source/texk/README
@@ -1,4 +1,4 @@
-$Id: README 38471 2015-09-27 12:22:13Z peter $
+$Id: README 38494 2015-09-29 07:38:47Z peter $
 Copyright 2006-2015 TeX Users Group.
 You may freely use, modify and/or distribute this file.
 
@@ -59,8 +59,8 @@ dvipos - ?
 
 dvipsk - maintained here, by us
 
-dvisvgm 1.10 - checked 28jul15
-  http://dvisvgm.2ix.de/Downloads
+dvisvgm 1.11 - checked 29sep15
+  http://dvisvgm.bplaced.net/Downloads
 
 gregorio 4.0.0-beta2
   https://github.com/gregorio-project/gregorio/releases/
diff --git a/source/texk/kpathsea/texmf.cnf b/source/texk/kpathsea/texmf.cnf
index 1b0df4b50..3c50cfe9e 100644
--- a/source/texk/kpathsea/texmf.cnf
+++ b/source/texk/kpathsea/texmf.cnf
@@ -224,7 +224,7 @@ TEXINPUTS.platex-ng = .;$TEXMF/tex/{uplatex,platex,latex,generic,}//
 % (e)up(La)TeX, and for upmpost
 TEXINPUTS.uplatex = .;$TEXMF/tex/{uplatex,platex,latex,generic,}//
 TEXINPUTS.uptex   = .;$TEXMF/tex/{uptex,ptex,plain,generic,}//
-TEXINPUTS.euptex  = .;$TEXMF/tex/{uptex,ptex,plain,generic}//
+TEXINPUTS.euptex  = .;$TEXMF/tex/{uptex,ptex,plain,generic,}//
 TEX.upmpost = euptex
 
 % pBibTeX bibliographies and style files.
-- 
GitLab