code:
Upstream patch to remove libunique dependency, and use glib >= 2.28.0
to handle unique apps both for GTK+ 2 and 3.
https://sourceforge.net/p/lxde/patches/539/

From a7d3b40a79a7a16c1f5d50d2bd466570258dae29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com>
Date: Sun, 22 Jan 2017 01:09:59 +0100
Subject: [PATCH] Use GApplication for unique app handling

Remove libunique dependency, and use glib >= 2.28.0 to handle unique apps both for GTK+ 2 and 3.
---
 Makefile.am           |  6 ------
 configure.ac          |  7 +------
 lxclipboard/main.vala | 16 +---------------
 lxpolkit/main.vala    | 16 +---------------
 4 files changed, 3 insertions(+), 42 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c2e1fe8..e3a3b97 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -90,9 +90,6 @@ if USE_GTK3
 lxclipboard_lxclipboard_VALAFLAGS += --define USE_GTK3
 else
 lxclipboard_lxclipboard_VALAFLAGS += --define USE_GTK2
-lxclipboard_lxclipboard_VALAFLAGS += --pkg unique-1.0
-lxclipboard_lxclipboard_CPPFLAGS += $(UNIQUE_CFLAGS)
-lxclipboard_lxclipboard_LDADD += $(UNIQUE_LIBS)
 endif

 lxpolkit_lxpolkit_vala_SOURCES = \
@@ -137,9 +134,6 @@ if USE_GTK3
 lxpolkit_lxpolkit_VALAFLAGS += --define USE_GTK3
 else
 lxpolkit_lxpolkit_VALAFLAGS += --define USE_GTK2
-lxpolkit_lxpolkit_VALAFLAGS += --pkg unique-1.0
-lxpolkit_lxpolkit_CPPFLAGS += $(UNIQUE_CFLAGS)
-lxpolkit_lxpolkit_LDADD += $(UNIQUE_LIBS)
 endif

 lxsession_db_lxsession_db_SOURCES = \
diff --git a/configure.ac b/configure.ac
index 06ddbb3..9126f4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ PKG_CHECK_MODULES(X11, [x11])
 AC_SUBST(X11_CFLAGS)
 AC_SUBST(X11_LIBS)

-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0])
+PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.28.0])
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)

@@ -79,11 +79,6 @@ else
     CFLAGS="$CFLAGS -D USE_GTK2"
     gtk_modules="gtk+-2.0 >= 2.6.0"
     VALA_GTK_LIBS="gtk+-2.0"
-
-    PKG_CHECK_MODULES(UNIQUE, [unique-1.0])
-    AC_SUBST(UNIQUE_CFLAGS)
-    AC_SUBST(UNIQUE_LIBS)
-
   fi
   PKG_CHECK_MODULES(GTK, [$gtk_modules])
   AC_SUBST(GTK_CFLAGS)
diff --git a/lxclipboard/main.vala b/lxclipboard/main.vala
index bee4044..3d4a8d7 100644
--- a/lxclipboard/main.vala
+++ b/lxclipboard/main.vala
@@ -17,9 +17,6 @@
  *      MA 02110-1301, USA.
  */
 using Gtk;
-#if USE_GTK2
-using Unique;
-#endif

 namespace Lxsession
 {
@@ -28,17 +25,7 @@ namespace Lxsession
         public static int main(string[] args)
         {
             Gtk.init (ref args);
-#if USE_GTK2
-            Unique.App app = new Unique.App("org.lxde.lxclipboard", null);
-
-            if(app.is_running)
-            {
-                message("lxclipboard is already running. Existing");
-                return 0;
-            }
-#endif
-# if USE_GTK3
-            Gtk.Application app = new Gtk.Application (
+            GLib.Application app = new GLib.Application (
                 "org.lxde.lxclipboard",
                 GLib.ApplicationFlags.FLAGS_NONE);
             app.register ();
@@ -48,7 +35,6 @@ namespace Lxsession
                 message("lxclipboard is already running. Existing");
                 return 0;
             }
-#endif

             clipboard_start ();

diff --git a/lxpolkit/main.vala b/lxpolkit/main.vala
index c0d6ae2..50c3cb7 100644
--- a/lxpolkit/main.vala
+++ b/lxpolkit/main.vala
@@ -17,9 +17,6 @@
  *      MA 02110-1301, USA.
  */
 using Gtk;
-#if USE_GTK2
-using Unique;
-#endif

 const string GETTEXT_PACKAGE = "lxsession";

@@ -33,17 +30,7 @@ namespace Lxsession
             Intl.bind_textdomain_codeset(GETTEXT_PACKAGE, "utf-8");

             Gtk.init (ref args);
-#if USE_GTK2
-            Unique.App app = new Unique.App("org.lxde.lxpolkit", null);
-
-            if(app.is_running)
-            {
-                message(_("lxpolkit is already running. Existing"));
-                return 0;
-            }
-#endif
-# if USE_GTK3
-            Gtk.Application app = new Gtk.Application (
+            GLib.Application app = new GLib.Application (
                 "org.lxde.lxpolkit",
                 GLib.ApplicationFlags.FLAGS_NONE);
             app.register ();
@@ -53,7 +40,6 @@ namespace Lxsession
                 message(_("lxpolkit is already running. Existing"));
                 return 0;
             }
-#endif

             policykit_agent_init();

--
2.11.0


code:
See https://www.lyx.org/trac/ticket/10800#comment:17
diff --git a/src/tex2lyx/test/test-structure.lyx.lyx b/src/tex2lyx/test/test-structure.lyx.lyx
index feff755cd2..2c7f2ace5c 100644
--- a/src/tex2lyx/test/test-structure.lyx.lyx
+++ b/src/tex2lyx/test/test-structure.lyx.lyx
@@ -212,7 +212,7 @@ This causes the
 \begin_inset Flex Flex:Strong
 status collapsed

-\begin_layout Standard
+\begin_layout Plain Layout
 logikalmkup
 \end_layout

license: mit


code:
Without this patch, the MH test suite would fail when building with
glibc 2.26, with 'ali' segfaulting like this:

  Core was generated by `/tmp/guix-build-mailutils-3.4.drv-0/mailutils-3.4/mh/.libs/ali -a ./Mail/mh_ali'.
  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  0x00007f8eac263a14 in hash (
      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>, hash_num=0) at assoc.c:102
  102	  for (i = 0; *name; name++)
  (gdb) bt
  #0  0x00007f8eac263a14 in hash (
      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>, hash_num=0) at assoc.c:102
  #1  0x00007f8eac263e6b in assoc_find_slot (assoc=0xaa59e0,
      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>, install=0x0, slot=0x7ffcddcbf2b8) at assoc.c:219
  #2  0x00007f8eac264124 in mu_assoc_lookup (assoc=0xaa59e0,
      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>, dataptr=0x7ffcddcbf2e0) at assoc.c:308
  #3  0x00007f8eac29e8ac in mu_ident_deref (
      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>) at ident.c:98
  #4  0x00007f8eac29f8a6 in mu_locus_point_deinit (pt=0xaa5718) at locus.c:48
  #5  0x00007f8eac29fa1b in mu_locus_range_deinit (lr=0xaa5718) at locus.c:99
  #6  0x00007f8eac29f9db in mu_locus_range_copy (dest=0xaa5718,
      src=0x622be0 <ali_yylloc>) at locus.c:89
  #7  0x0000000000408a2a in push_source (name=0xaa74bc "mh_aliases2", fail=1)
      at mh_alias_lex.l:170

commit b330af9008e4c9168b379867b854f5900a539ad7
Author: Sergey Poznyakoff <gray@gnu.org>
Date:   Sat Nov 18 10:15:48 2017 +0200

    Fix the use of uninitialized memory

    * mh/mh_alias_lex.l (push_source): Initialize locus range prior to copying
    to it.
    * libmailutils/cfg/parser.y (mu_cfg_tree_create_node): Likewise.
    * libmu_sieve/util.c: (mu_sieve_value_create): Likewise.

diff --git a/libmailutils/cfg/parser.y b/libmailutils/cfg/parser.y
index 4503c7781..3436b8d90 100644
--- a/libmailutils/cfg/parser.y
+++ b/libmailutils/cfg/parser.y
@@ -1134,10 +1134,9 @@ mu_cfg_tree_create_node (struct mu_cfg_tree *tree,

   np = mu_alloc (size);
   np->type = type;
+  mu_locus_range_init (&np->locus);
   if (loc)
     mu_locus_range_copy (&np->locus, loc);
-  else
-    memset (&np->locus, 0, sizeof np->locus);
   p = (char*) (np + 1);
   np->tag = p;
   strcpy (p, tag);
diff --git a/libmu_sieve/sieve-lex.l b/libmu_sieve/sieve-lex.l
index fd145bfe1..f14e80194 100644
--- a/libmu_sieve/sieve-lex.l
+++ b/libmu_sieve/sieve-lex.l
@@ -190,6 +190,7 @@ push_source (const char *name)
     {
       ctx = mu_sieve_malloc (mu_sieve_machine, sizeof (*ctx));
       ctx->trk = trk;
+      mu_locus_range_init (&ctx->incl_range);
       mu_locus_range_copy (&ctx->incl_range, &yylloc);
       ctx->i_node = sieve_source_inode;
       ctx->input = input_stream;
diff --git a/libmu_sieve/util.c b/libmu_sieve/util.c
index 8d62a60c2..7d71b5509 100644
--- a/libmu_sieve/util.c
+++ b/libmu_sieve/util.c
@@ -55,6 +55,7 @@ mu_sieve_value_create (mu_sieve_machine_t mach, mu_sieve_data_type type,
   val->locus.end.mu_line = locus->end.mu_line;
   val->locus.end.mu_col = locus->end.mu_col;

+  mu_locus_range_init (&val->locus);
   mu_locus_range_copy (&val->locus, locus);
   switch (type)
     {
diff --git a/mh/mh_alias_lex.l b/mh/mh_alias_lex.l
index 371353ed3..b97264b38 100644
--- a/mh/mh_alias_lex.l
+++ b/mh/mh_alias_lex.l
@@ -167,6 +167,7 @@ push_source (const char *name, int fail)
     {
       ctx = mu_alloc (sizeof (*ctx));
       ctx->trk = trk;
+      mu_locus_range_init (&ctx->incl_range);
       mu_locus_range_copy (&ctx->incl_range, &yylloc);
       ctx->exec_p = exec_p;
       ctx->i_node = ali_source_inode;


code:
Work with the new glob interface in glibc 2.27.

Taken from this upstream commit:
https://git.savannah.gnu.org/cgit/make.git/commit/?id=193f1e81edd6b1b56b0eb0ff8aa4b41c7b4257b4

diff --git a/dir.c b/dir.c
index adbb8a9..c343e4c 100644
--- a/dir.c
+++ b/dir.c
@@ -1299,15 +1299,40 @@ local_stat (const char *path, struct stat *buf)
 }
 #endif

+/* Similarly for lstat.  */
+#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
+# ifndef VMS
+#  ifndef HAVE_SYS_STAT_H
+int lstat (const char *path, struct stat *sbuf);
+#  endif
+# else
+    /* We are done with the fake lstat.  Go back to the real lstat */
+#   ifdef lstat
+#     undef lstat
+#   endif
+# endif
+# define local_lstat lstat
+#elif defined(WINDOWS32)
+/* Windows doesn't support lstat().  */
+# define local_lstat local_stat
+#else
+static int
+local_lstat (const char *path, struct stat *buf)
+{
+  int e;
+  EINTRLOOP (e, lstat (path, buf));
+  return e;
+}
+#endif
+
 void
 dir_setup_glob (glob_t *gl)
 {
   gl->gl_opendir = open_dirstream;
   gl->gl_readdir = read_dirstream;
   gl->gl_closedir = free;
+  gl->gl_lstat = local_lstat;
   gl->gl_stat = local_stat;
-  /* We don't bother setting gl_lstat, since glob never calls it.
-     The slot is only there for compatibility with 4.4 BSD.  */
 }

 void


code:
Purity: don't look for library dependencies (of the form `-lfoo') in
/lib and /usr/lib.  Likewise, when searching for included Makefiles,
don't look in /usr/include and friends.

Patch from Nixpkgs, by Eelco Dolstra.

diff -rc make-3.81-orig/read.c make-3.81/read.c
*** make-3.81-orig/read.c	2006-03-17 15:24:20.000000000 +0100
--- make-3.81/read.c	2007-05-24 17:16:31.000000000 +0200
***************
*** 99,107 ****
--- 99,109 ----
  #endif
      INCLUDEDIR,
  #ifndef _AMIGA
+ #if 0
      "/usr/gnu/include",
      "/usr/local/include",
      "/usr/include",
+ #endif
  #endif
      0
    };
diff -rc make-3.81-orig/remake.c make-3.81/remake.c
*** make-3.81-orig/remake.c	2006-03-20 03:36:37.000000000 +0100
--- make-3.81/remake.c	2007-05-24 17:06:54.000000000 +0200
***************
*** 1452,1460 ****
--- 1452,1462 ----
    static char *dirs[] =
      {
  #ifndef _AMIGA
+ #if 0
        "/lib",
        "/usr/lib",
  #endif
+ #endif
  #if defined(WINDOWS32) && !defined(LIBDIR)
  /*
   * This is completely up to the user at product install time. Just define


code:
From 93efa48a7b972fc463406603574a4d508eefe792 Mon Sep 17 00:00:00 2001
From: Sergei Golubchik <serg@mariadb.org>
Date: Sun, 13 May 2018 18:50:21 +0200
Subject: [PATCH] fix failing main.mysql_client_test test on 32bit

in `ulonglong=ulong*uint` multiplication
is done in ulong, wrapping around on 32bit.

This became visible after C/C changed the
default charset to utf8, thus changing
mbmaxlem from 1 to 3.
---
 tests/mysql_client_fw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c
index f69eb28a2871..4d036887629a 100644
--- a/tests/mysql_client_fw.c
+++ b/tests/mysql_client_fw.c
@@ -768,7 +768,7 @@ static void do_verify_prepare_field(MYSQL_RES *result,
 {
   MYSQL_FIELD *field;
   CHARSET_INFO *cs;
-  ulonglong expected_field_length;
+  ulonglong expected_field_length= length;

   if (!(field= mysql_fetch_field_direct(result, no)))
   {
@@ -777,7 +777,7 @@ static void do_verify_prepare_field(MYSQL_RES *result,
   }
   cs= get_charset(field->charsetnr, 0);
   DIE_UNLESS(cs);
-  if ((expected_field_length= length * cs->mbmaxlen) > UINT_MAX32)
+  if ((expected_field_length*= cs->mbmaxlen) > UINT_MAX32)
     expected_field_length= UINT_MAX32;
   if (!opt_silent)
   {


code:
Work around this GCC ICE: <https://bugs.gnu.org/31708>.  It shows up
only when doing native compiles on armhf-linux.

--- mariadb-10.1.33/plugin/semisync/semisync_master.cc	2018-07-28 02:13:12.604020250 +0200
+++ mariadb-10.1.33/plugin/semisync/semisync_master.cc	2018-07-28 02:14:11.907753417 +0200
@@ -847,6 +847,8 @@
   return function_exit(kWho, 0);
 }

+volatile const void *kSyncHeaderPtr = &ReplSemiSyncMaster::kSyncHeader;
+
 int ReplSemiSyncMaster::reserveSyncHeader(unsigned char *header,
 					  unsigned long size)
 {
@@ -873,7 +875,7 @@
     /* Set the magic number and the sync status.  By default, no sync
      * is required.
      */
-    memcpy(header, kSyncHeader, sizeof(kSyncHeader));
+    memcpy(header, (void *)kSyncHeaderPtr, sizeof(kSyncHeader));
     hlen= sizeof(kSyncHeader);
   }
   return function_exit(kWho, hlen);


code:
Remove install target for non-existant directory.

--- a/src/CMakeLists.txt	2015-09-13 20:52:28.517344327 +0200
+++ b/src/CMakeLists.txt	2015-09-13 20:53:04.842453987 +0200
@@ -122,12 +122,6 @@
 		DESTINATION
 			${CMAKE_INSTALL_PREFIX}/share/applications
 	)
-	install(
-		FILES
-			${MARS_SOURCE_DIR}/resources/mars
-		DESTINATION
-			${CMAKE_INSTALL_PREFIX}/share/menu
-	)

 else(UNIX)
 	# executable


code:
This is a concatenation of the following two patches:

  https://github.com/jcowgill/M.A.R.S./commit/33d5affabf8ff84f2c028b9303c6a9e83cc824ad.patch
  https://patch-diff.githubusercontent.com/raw/thelaui/M.A.R.S./pull/2.patch

Their purpose is to allow Mars to be built against the latest version of SFML.

From 33d5affabf8ff84f2c028b9303c6a9e83cc824ad Mon Sep 17 00:00:00 2001
From: James Cowgill <james410@cowgill.org.uk>
Date: Sat, 9 May 2015 01:54:14 +0100
Subject: [PATCH] Remove dependency on GLU - fixes build with SFML 2.3

---
 premake4.lua           |  8 ++++----
 src/Shaders/postFX.cpp |  2 +-
 src/System/window.cpp  | 12 ++++++------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/premake4.lua b/premake4.lua
index 023dddd..5af4495 100755
--- a/premake4.lua
+++ b/premake4.lua
@@ -11,11 +11,11 @@ project "mars"
     defines { "NDEBUG" }
     flags   { "Optimize" }
     if os.get() == "windows" then
-      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" }
+      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" }
     elseif os.get() == "macosx" then
       links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" }
     else
-      links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
+      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
       libdirs { "/usr/lib", "/usr/local/lib" }
     end

@@ -23,10 +23,10 @@ project "mars"
     defines { "_DEBUG", "DEBUG" }
     flags   { "Symbols" }
     if os.get() == "windows" then
-      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" }
+      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" }
     elseif os.get() == "macosx" then
       links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" }
     else
-      links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
+      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
       libdirs { "/usr/lib", "/usr/local/lib" }
     end
diff --git a/src/Shaders/postFX.cpp b/src/Shaders/postFX.cpp
index 987f411..f767a47 100644
--- a/src/Shaders/postFX.cpp
+++ b/src/Shaders/postFX.cpp
@@ -78,7 +78,7 @@ namespace postFX {
             postFX_.loadFromFile(settings::C_dataPath + "shaders/bump.frag", sf::Shader::Fragment);
             bumpMap_.create(SPACE_X_RESOLUTION*0.5f, SPACE_Y_RESOLUTION*0.5f);
             glViewport(0,0,SPACE_X_RESOLUTION*0.5f,SPACE_Y_RESOLUTION*0.5f);
-            gluOrtho2D(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0);
+            glOrtho(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0, -1, 1);
             glEnable(GL_BLEND);
             glMatrixMode(GL_MODELVIEW);
             postFX_.setParameter("BumpMap", bumpMap_.getTexture());
diff --git a/src/System/window.cpp b/src/System/window.cpp
index e9a099a..8e12dcc 100644
--- a/src/System/window.cpp
+++ b/src/System/window.cpp
@@ -222,7 +222,7 @@ namespace window {
         glLoadIdentity();

         // Setup translation (according to left-upper corner)
-        gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f);
+        glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1);

         // probably improves performance...
         glDisable(GL_LIGHTING);
@@ -247,7 +247,7 @@ namespace window {

         glMatrixMode(GL_PROJECTION);
         glLoadIdentity();
-        gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
+        glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
         glMatrixMode(GL_MODELVIEW);
         glLoadIdentity();

@@ -255,7 +255,7 @@ namespace window {

         glMatrixMode(GL_PROJECTION);
         glLoadIdentity();
-        gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f);
+        glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1);
         glMatrixMode(GL_MODELVIEW);
         glLoadIdentity();
     }
@@ -270,7 +270,7 @@ namespace window {
             glLoadIdentity();
             setViewPort();

-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
+            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);

             glMatrixMode(GL_MODELVIEW);
             glLoadIdentity();
@@ -284,7 +284,7 @@ namespace window {
             glLoadIdentity();
             setViewPort();

-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
+            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);

             glMatrixMode(GL_MODELVIEW);
             glLoadIdentity();
@@ -294,7 +294,7 @@ namespace window {
         else {
             glMatrixMode(GL_PROJECTION);
             glLoadIdentity();
-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
+            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
             glMatrixMode(GL_MODELVIEW);
             glLoadIdentity();
         }

From a97d0d6a19b5b43e3c53081e36f1f1747b6674e6 Mon Sep 17 00:00:00 2001
From: Sylvain BOILARD <boilard@crans.org>
Date: Wed, 23 Jan 2013 02:02:47 +0100
Subject: [PATCH] Use sf::Shader::Bind() correctly after latest update of the
 SFML's API.

---
 src/System/window.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/System/window.cpp b/src/System/window.cpp
index e9a099a..3ffcf65 100644
--- a/src/System/window.cpp
+++ b/src/System/window.cpp
@@ -307,13 +307,11 @@ namespace window {
         window_.setActive(true);
         glEnable(GL_TEXTURE_2D);

-        if (shader)
-            shader->bind();
+        sf::Shader::bind(shader);

         window_.draw(toBeDrawn, states);

-        if (shader)
-            shader->unbind();
+        sf::Shader::bind(NULL);

         window_.popGLStates();
         glPopMatrix();


code:
From da9e282d834f0e2128501a8154128dc95b4c599d Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sat, 9 Sep 2017 20:34:38 +0200
Subject: [PATCH] Add a script to generate component.xml files.

plexus-component-metadata is normally used for this task, but it
depends on maven-core, which depends on maven-model-builder, which needs
plexus-component-metadata. This script is meant to break this dependency
cycle.
---
 components.sh | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)
 create mode 100755 components.sh

diff --git a/components.sh b/components.sh
new file mode 100755
index 0000000..c6748bd
--- /dev/null
+++ b/components.sh
@@ -0,0 +1,148 @@
+## This script generates a rough plexus/components.xml file. It is meant to
+## replace plexus-component-metadata as it eventually has a recursive dependency
+## on itself.
+##
+## This script must be run in the source directory (usually src/main/java).
+
+# Finds the complete name from a class name.
+function find_role() {
+    role=$1
+    # Find role
+    case $role in
+      "SettingsWriter" | "SettingsReader")
+        role=org.apache.maven.settings.io.$role
+        ;;
+      "SecDispatcher")
+        role=org.sonatype.plexus.components.sec.dispatcher.$role
+        ;;
+      "SettingsDecrypter")
+        role=org.apache.maven.settings.crypto.$role
+        ;;
+      "SettingsBuilder")
+        role=org.apache.maven.settings.building.$role
+        ;;
+      "SettingsValidator")
+        role=org.apache.maven.settings.validation.$role
+        ;;
+      "LoggerFactory")
+        role=org.eclipse.aether.spi.log.$role
+        ;;
+      "RemoteRepositoryManager" | "VersionResolver" | "VersionRangeResolver" \
+      | "ArtifactResolver" | "RepositoryEventDispatcher" | "MetadataResolver" \
+      | "SyncContextFactory" | "MetadataGeneratorFactory" | "MetadatResolver" \
+      | "ArtifactDescriptorReader")
+        role=org.eclipse.aether.impl.$role
+        ;;
+      "ModelBuilder" | "ModelProcessor")
+        role=org.apache.maven.model.building.$role
+        ;;
+      "ModelValidator")
+        role=org.apache.maven.model.validation.$role
+        ;;
+      "ProfileInjector" | "ProfileSelector")
+        role=org.apache.maven.model.profile.$role
+        ;;
+      "ProfileActivator")
+        role=org.apache.maven.model.profile.activation.$role
+        ;;
+      "SuperPomProvider")
+        role=org.apache.maven.model.superpom.$role
+        ;;
+      "ReportConfigurationExpander" | "PluginConfigurationExpander" \
+      | "ReportingConverter" | "LifecycleBindingsInjector")
+        role=org.apache.maven.model.plugin.$role
+        ;;
+      "ModelLocator")
+        role=org.apache.maven.model.locator.$role
+        ;;
+      "ModelPathTranslator" | "PathTranslator" | "UrlNormalizer" | "ModelUrlNormalizer")
+        role=org.apache.maven.model.path.$role
+        ;;
+      "DependencyManagementInjector" | "PluginManagementInjector")
+        role=org.apache.maven.model.management.$role
+        ;;
+      "ModelWriter" | "ModelReader")
+        role=org.apache.maven.model.io.$role
+        ;;
+      "DependencyManagementImporter")
+        role=org.apache.maven.model.composition.$role
+        ;;
+      "ModelNormalizer")
+        role=org.apache.maven.model.normalization.$role
+        ;;
+      "ModelInterpolator")
+        role=org.apache.maven.model.interpolation.$role
+        ;;
+      "InheritanceAssembler")
+        role=org.apache.maven.model.inheritance.$role
+        ;;
+      *)
+        role=$role
+        ;;
+    esac
+    echo $role
+}
+
+function generate_xml() {
+echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+echo "<component-set>"
+echo "<components>"
+
+for file in `find -name '*.java'`; do
+  annot=`grep "@Component" $file`
+  if [ "$?" == "0" ]; then
+    # We have a component!
+    role=$(echo $annot | sed 's|.*role = \(.*\).class.*|\1|')
+    role_hint=$(echo $annot | sed 's|.*hint = "\(.*\)" .*|\1|')
+    if [ "$role_hint" = "$annot" ]; then
+      role_hint=default
+    fi
+    implem=$(echo $file | sed -e 's|^\./||' -e 's|\.java||' -e 's|/|.|g')
+    role=$(find_role $role)
+
+    echo "<component>"
+    echo "  <role>$role</role>"
+    echo "  <role-hint>$role_hint</role-hint>"
+    echo "  <implementation>$implem</implementation>"
+    echo "  <description />"
+    echo "  <isolated-realm>false</isolated-realm>"
+    echo "  <requirements>"
+    reqn=1
+    cont=true
+    while [ "$cont" = "true" ]; do
+      requirement=$(grep "@Requirement" $file -A1 | head -n ${reqn} | tail -1)
+      ((reqn++))
+      property=$(grep "@Requirement" $file -A1 | head -n ${reqn} | tail -1)
+      if (echo $requirement | grep "@Requirement" >/dev/null); then
+        ((reqn++))
+        ((reqn++))
+        optional=$(echo $requirement | sed 's|.*optional = \(.*\) .*|\1|')
+        req_role=$(echo $requirement | sed 's|.*role = \(.*\).class .*|\1|')
+        if (echo $req_role | grep "@Requirement" >/dev/null); then
+          req_role=$(echo $property | sed 's|.*private \(.*\) .*|\1|')
+        fi
+        req_role=$(find_role $req_role)
+        req_name=$(echo $property | sed 's|[^ ]* [^ ]* \([^ ;]*\).*|\1|')
+        echo "    <requirement>"
+        echo "      <role>$req_role</role>"
+        echo "      <field-name>$req_name</field-name>"
+        if (echo $optional | grep "@Requirement" >/dev/null); then
+          :
+        else
+          echo "      <optional>$optional</optional>"
+        fi
+        echo "    </requirement>"
+      else
+        cont=false
+      fi
+    done
+    echo "  </requirements>"
+    echo "</component>"
+  fi
+done
+
+echo "</components>"
+echo "</component-set>"
+}
+
+(cd $1; generate_xml) > $2
--
2.14.1


code:
From 1d20c0e403f1a38d4aca830e0eb4db03ba43efd3 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Tue, 19 Sep 2017 22:21:29 +0200
Subject: [PATCH] Add sisu-maven-plugin replacement

---
 sisu.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100755 sisu.sh

diff --git a/sisu.sh b/sisu.sh
new file mode 100755
index 0000000..979f373
--- /dev/null
+++ b/sisu.sh
@@ -0,0 +1,12 @@
+## This script generates a rough javax.inject.Named file. It is meant to
+## replace sisu-maven-plugin as it eventually has a recursive dependency
+## on maven.
+##
+## This script must be run in the source directory (usually src/main/java).
+
+for file in `(cd $1; find -name '*.java')`; do
+  annot=`grep "^@Named" $1/$file`
+  if [ "$annot" != "" ]; then
+    echo $file | sed -e 's|^\./||' -e 's|\.java||' -e 's|/|.|g'
+  fi
+done > $2
--
2.14.1


code:
Change 'ensure-directories-exist' to look for 'mkdir' in $PATH, not in /bin.

--- maxima-5.36.1/lisp-utils/defsystem.lisp.orig	2014-11-22 16:21:30.000000000 -0500
+++ maxima-5.36.1/lisp-utils/defsystem.lisp	2015-05-25 21:53:31.223648483 -0400
@@ -4627,7 +4627,7 @@
         (cmd (if (member :win32 *features*)
                  (format nil "mkdir \"~a\""
                          (coerce (subst #\\ #\/ (coerce (namestring dir) 'list)) 'string))
-                 (format nil "/bin/mkdir -p ~S" (namestring dir)))))
+                 (format nil "mkdir -p ~S" (namestring dir)))))
    (unless (directory dir)
      (lisp:system cmd))
    ;; The second return value is supposed to be T if directories were


code:
This patch allows us to install the Vixie-compatible binaries as
non-root without creating /var/run, etc.

--- mcron-1.0.6/makefile.in	2010-06-19 20:44:17.000000000 +0200
+++ mcron-1.0.6/makefile.in	2010-07-04 16:16:25.000000000 +0200
@@ -1004,15 +1004,11 @@ mcron.c : main.scm crontab.scm makefile.
 	@rm -f mcron.escaped.scm > /dev/null 2>&1

 install-exec-hook:
-	@if [ "x@NO_VIXIE_CLOBBER@" != "xyes"   -a   "`id -u`" -eq "0" ]; then \
+	@if [ "x@NO_VIXIE_CLOBBER@" != "xyes" ]; then \
        rm -f $(fpp)cron$(EXEEXT) > /dev/null 2>&1; \
        $(INSTALL) --mode='u=rwx' mcron$(EXEEXT) $(fpp)cron$(EXEEXT); \
        rm -f $(fpp)crontab$(EXEEXT) > /dev/null 2>&1; \
        $(INSTALL) --mode='u=rwxs,og=rx' mcron$(EXEEXT) $(fpp)crontab$(EXEEXT); \
-       $(INSTALL) -d --mode='u=rwx' $(DESTDIR)/var/cron; \
-       $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)/var/run; \
-       $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)@GUILE_SITE@; \
-       $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)@GUILE_SITE@/mcron; \
     elif [ "x@NO_VIXIE_CLOBBER@" = "xyes" ]; then \
        echo "Not installing Vixie-style programs"; \
     else \


code:
From 4876e3a692739bb9ca00d0f500fd5f4b3eb16ce3 Mon Sep 17 00:00:00 2001
From: Tom Callaway <spot@fedoraproject.org>
Date: Fri, 7 Sep 2012 11:39:29 -0400
Subject: apply fix for CVE-2012-4409 (thanks to Raphael Geissert)

--- mcrypt-2.6.8/src/extra.c.CVE-2012-4409	2012-09-07 11:00:55.906870746 -0400
+++ mcrypt-2.6.8/src/extra.c	2012-09-07 11:00:27.967858365 -0400
@@ -242,6 +242,8 @@ int check_file_head(FILE * fstream, char
 			if (m_getbit(0, sflag) != 0) { /* if the first bit is set */
 				*salt_size = m_setbit(0, sflag, 0);
 				if (*salt_size > 0) {
+					if (*salt_size > sizeof(tmp_buf))
+						err_quit(_("Salt is too long\n"));
 					fread(tmp_buf, 1, *salt_size,
 					      fstream);
 					memmove(salt, tmp_buf, *salt_size);

--
cgit v0.12


code:
diff --git a/mcrypt-CVE-2012-4426.patch b/mcrypt-CVE-2012-4426.patch
new file mode 100644
index 0000000..747f428
--- mcrypt-2.6.8/src/errors.c
+++ mcrypt-2.6.8/src/errors.c
@@ -25,24 +25,24 @@

 void err_quit(char *errmsg)
 {
-	fprintf(stderr, errmsg);
+	fprintf(stderr, "%s", errmsg);
 	exit(-1);
 }

 void err_warn(char *errmsg)
 {
 	if (quiet <= 1)
-		fprintf(stderr, errmsg);
+		fprintf(stderr, "%s", errmsg);
 }

 void err_info(char *errmsg)
 {
 	if (quiet == 0)
-		fprintf(stderr, errmsg);
+		fprintf(stderr, "%s", errmsg);
 }

 void err_crit(char *errmsg)
 {
 	if (quiet <= 2)
-		fprintf(stderr, errmsg);
+		fprintf(stderr, "%s", errmsg);
 }

---


code:
From b0716eac4e800a0ea53e1b949250f671702f28a0 Mon Sep 17 00:00:00 2001
From: Tom Callaway <spot@fedoraproject.org>
Date: Tue, 30 Oct 2012 15:39:24 -0400
Subject: apply workaround to CVE-2012-4527

--- mcrypt-2.6.8.orig/src/mcrypt.c
+++ mcrypt-2.6.8/src/mcrypt.c
@@ -41,6 +41,8 @@
 # include <time.h>
 #endif

+#define WIDTH 80
+
 static char rcsid[] =
     "$Id: mcrypt.c,v 1.2 2007/11/07 17:10:21 nmav Exp $";

@@ -482,7 +484,7 @@
 #ifdef HAVE_STAT
       if (stream_flag == FALSE) {
 	 if (is_normal_file(file[i]) == FALSE) {
-	    sprintf(tmperr,
+	    snprintf(tmperr, WIDTH,
 		    _
 		    ("%s: %s is not a regular file. Skipping...\n"),
 		    program_name, file[i]);
@@ -501,7 +503,7 @@
 	    dinfile = file[i];
 	 if ((isatty(fileno((FILE *) (stdin))) == 1)
 	     && (stream_flag == TRUE) && (force == 0)) {	/* not a tty */
-	    sprintf(tmperr,
+	    snprintf(tmperr, WIDTH,
 		    _
 		    ("%s: Encrypted data will not be read from a terminal.\n"),
 		    program_name);
@@ -520,7 +522,7 @@
 	    einfile = file[i];
 	 if ((isatty(fileno((FILE *) (stdout))) == 1)
 	     && (stream_flag == TRUE) && (force == 0)) {	/* not a tty */
-	    sprintf(tmperr,
+	    snprintf(tmperr, WIDTH,
 		    _
 		    ("%s: Encrypted data will not be written to a terminal.\n"),
 		    program_name);
@@ -544,7 +546,7 @@
 	    strcpy(outfile, einfile);
 	    /* if file has already the .nc ignore it */
 	    if (strstr(outfile, ".nc") != NULL) {
-	       sprintf(tmperr,
+	       snprintf(tmperr, WIDTH,
 		       _
 		       ("%s: file %s has the .nc suffix... skipping...\n"),
 		       program_name, outfile);
@@ -590,10 +592,10 @@

 	 if (x == 0) {
 	    if (stream_flag == FALSE) {
-	       sprintf(tmperr, _("File %s was decrypted.\n"), dinfile);
+	       snprintf(tmperr, WIDTH, _("File %s was decrypted.\n"), dinfile);
 	       err_warn(tmperr);
 	    } else {
-	       sprintf(tmperr, _("Stdin was decrypted.\n"));
+	       snprintf(tmperr, WIDTH, _("Stdin was decrypted.\n"));
 	       err_warn(tmperr);
 	    }
 #ifdef HAVE_STAT
@@ -610,7 +612,7 @@

 	 } else {
 	    if (stream_flag == FALSE) {
-	       sprintf(tmperr,
+	       snprintf(tmperr, WIDTH,
 		       _
 		       ("File %s was NOT decrypted successfully.\n"),
 		       dinfile);
@@ -636,10 +638,10 @@

 	 if (x == 0) {
 	    if (stream_flag == FALSE) {
-	       sprintf(tmperr, _("File %s was encrypted.\n"), einfile);
+	       snprintf(tmperr, WIDTH, _("File %s was encrypted.\n"), einfile);
 	       err_warn(tmperr);
 	    } else {
-	       sprintf(tmperr, _("Stdin was encrypted.\n"));
+	       snprintf(tmperr, WIDTH, _("Stdin was encrypted.\n"));
 	       err_warn(tmperr);
 	    }
 #ifdef HAVE_STAT
@@ -655,7 +657,7 @@

 	 } else {
 	    if (stream_flag == FALSE) {
-	       sprintf(tmperr,
+	       snprintf(tmperr, WIDTH,
 		       _
 		       ("File %s was NOT encrypted successfully.\n"),
 		       einfile);
-
git v0.12


code:
disk_cache_create() here looks up the users home directory from <pwd.h>
which resolves to "/" in the build environment. I could not find an easy
way to set the home directory to something else, so we disable this test
for now.

--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -170,11 +170,6 @@
    unsetenv("MESA_GLSL_CACHE_DIR");
    unsetenv("XDG_CACHE_HOME");

-   cache = disk_cache_create("test", "make_check", 0);
-   expect_non_null(cache, "disk_cache_create with no environment variables");
-
-   disk_cache_destroy(cache);
-
    /* Test with XDG_CACHE_HOME set */
    setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
    cache = disk_cache_create("test", "make_check", 0);


code:
This patch removes a part of meson that clears the rpath upon installation.
This will only be applied to a special version of meson, used for the
meson-build-system.

Patch by Peter Mikkelsen <petermikkelsen10@gmail.com>

--- meson-0.42.0/mesonbuild/minstall.py.orig	2017-09-09 01:49:39.147374148 +0200
+++ meson-0.42.0/mesonbuild/minstall.py	2017-09-09 01:51:01.209134717 +0200
@@ -436,15 +436,6 @@
                         print("Symlink creation does not work on this platform. "
                               "Skipping all symlinking.")
                         printed_symlink_error = True
-            if os.path.isfile(outname):
-                try:
-                    depfixer.fix_rpath(outname, install_rpath, final_path,
-                                       install_name_mappings, verbose=False)
-                except SystemExit as e:
-                    if isinstance(e.code, int) and e.code == 0:
-                        pass
-                    else:
-                        raise

 def run(args):
     parser = buildparser()


code:
This patch changes metabat so that (1) it is not build statically, (2) it uses
shared libraries rather than static libraries where possible.

diff --git a/SConstruct b/SConstruct
index 69cdc0a..ac99bcb 100644
--- a/SConstruct
+++ b/SConstruct
@@ -26,8 +26,6 @@ debug = ARGUMENTS.get('DEBUG', None)
 build_flags = ['-Wall', '-g', '-std=c++11', '-fopenmp']
 link_flags = ['-lstdc++', '-lm', '-fopenmp']

-if platform.platform(True, True).find('Darwin') == -1:
-    link_flags.extend(['-static', '-static-libgcc', '-static-libstdc++'])

 if debug is None:
     build_flags.extend(['-O3', '-DNDEBUG', '-Wno-unknown-pragmas', '-Wno-deprecated-declarations', '-Wno-overflow', '-Wno-unused-variable'])
@@ -110,17 +108,17 @@ def findStaticOrShared( lib, testPaths, static_source_list, link_flag_list, stat
     for path in testPaths:
         if not os.path.isdir(path):
             continue
+        for testfile in ('%s/lib%s.so' % (path, lib), '%s/lib%s.dylib' % (path, lib)):
+            if os.path.isfile(testfile):
+                print "Found shared library %s as %s" % (lib, testfile)
+                link_flag_list.extend( ["-L%s" % (path), "-l%s" % (lib) ] )
+                return
         for suffix in staticSuffixes:
             testfile = '%s/lib%s%s' % (path, lib, suffix)
             if os.path.isfile(testfile):
                 static_source_list.append(testfile)
                 print "Found static library %s as %s" % (lib, testfile)
                 return
-        for testfile in ('%s/lib%s.so' % (path, lib), '%s/lib%s.dylib' % (path, lib)):
-            if os.path.isfile(testfile):
-                print "Found shared library %s as %s" % (lib, testfile)
-                link_flag_list.extend( ["-L%s" % (path), "-l%s" % (lib) ] )
-                return
     print "Could not find library for %s!!! Looked in %s" % (lib, testPaths)
     return


code:
This patch from resolution of https://sourceforge.net/p/mhash/bugs/37/

--- a/src/keygen_test.c
+++ b/src/keygen_test.c
@@ -121,8 +121,6 @@

 	mhash_keygen_ext(KEYGEN_S2K_SALTED, data, key, keysize, password, passlen);

-	mutils_memset(tmp, 0, keysize * 2);
-
 	tmp = mutils_asciify(key, keysize);

 	result = mutils_strcmp((mutils_word8 *) KEY2, tmp);


code:
This patch includes

   * mingw-w64-headers/include/winnt.h: compile fixes for1 gcc-4.9.3
   * mingw-w64-headers/crt/math.h: Likewise
   * mingw-w64-headers/crt/float.h (FLT_EPSILON,DBL_EPSILON,LDBL_EPSILON): Add
   symbols.
   * mingw-w64-headers/crt/stat.h (S_ISLNK,S_ISSOCK,S_ISUID,S_ISGID,S_ISLINK):
   Add symbols.
   (lstat): Add function.
   * mingw-w64-headers/crt/_mingw_stat64.h: Likewise
   * mingw-w64-headers/crt/stdlib.h (realpath): Add function.

Needed for building with gcc-4.9.3 and using with cross-libtool-2.4.6.

Upstream status: not yet presented upstream.

index 9c5cf87..74a8541 100644
--- a/mingw-w64-crt/misc/dirname.c
+++ b/mingw-w64-crt/misc/dirname.c
@@ -29,6 +29,12 @@
 #define __cdecl  /* this may not be defined.                   */
 #endif

+char *__cdecl
+realpath(const char *name, char *resolved)
+{
+  return resolved ? strcpy (resolved, name) : strdup (name);
+}
+
 char * __cdecl
 dirname(char *path)
 {
diff --git a/mingw-w64-headers/crt/_mingw_stat64.h b/mingw-w64-headers/crt/_mingw_stat64.h
index 17e754c..7d2339b 100644
--- a/mingw-w64-headers/crt/_mingw_stat64.h
+++ b/mingw-w64-headers/crt/_mingw_stat64.h
@@ -2,13 +2,17 @@

 #ifdef _USE_32BIT_TIME_T
 #define _fstat32 _fstat
+#define _lstat32 _lstat
 #define _stat32 _stat
 #define _wstat32 _wstat
 #define _fstat32i64 _fstati64
+#define _lstat32i64 _lstati64
 #define _stat32i64 _stati64
 #define _wstat32i64 _wstati64
 #else
 #define _fstat _fstat64i32
+#define _lstat _lstat64i32
+#define _lstati64 _lstat64
 #define _fstati64 _fstat64
 #define _stat _stat64i32
 #define _stati64 _stat64
diff --git a/mingw-w64-headers/crt/float.h b/mingw-w64-headers/crt/float.h
index 5874f4e..bdf4ead 100644
--- a/mingw-w64-headers/crt/float.h
+++ b/mingw-w64-headers/crt/float.h
@@ -22,6 +22,15 @@
 #if (__GNUC__ < 4)
 #error Corrupt install of gcc-s internal headers, or search order was changed.
 #else
+
+        /* From gcc-4.9.3 float.h.  */
+        #undef FLT_EPSILON
+        #undef DBL_EPSILON
+        #undef LDBL_EPSILON
+        #define FLT_EPSILON	__FLT_EPSILON__
+        #define DBL_EPSILON	__DBL_EPSILON__
+        #define LDBL_EPSILON	__LDBL_EPSILON__
+
 	/* #include_next <float_ginclude.h> */

    	/* Number of decimal digits, q, such that any floating-point number with q
diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h
index 1e970f4..99a332f 100644
--- a/mingw-w64-headers/crt/math.h
+++ b/mingw-w64-headers/crt/math.h
@@ -216,6 +216,7 @@ extern "C" {
 #endif
   }

+#if 0
   __CRT_INLINE long double __cdecl fabsl (long double x)
   {
 #ifdef __arm__
@@ -226,6 +227,7 @@ extern "C" {
     return res;
 #endif
   }
+#endif

   __CRT_INLINE double __cdecl fabs (double x)
   {
@@ -905,7 +907,7 @@ __mingw_choose_expr (                                         \
 /* 7.12.7.3  */
   extern double __cdecl hypot (double, double) __MINGW_ATTRIB_DEPRECATED_MSVC2005; /* in libmoldname.a */
   extern float __cdecl hypotf (float x, float y);
-#ifndef __CRT__NO_INLINE
+#if 0 //ndef __CRT__NO_INLINE
   __CRT_INLINE float __cdecl hypotf (float x, float y) { return (float) hypot ((double)x, (double)y);}
 #endif
   extern long double __cdecl hypotl (long double, long double);
diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h
index dfc5ae4..6f0fee3 100644
--- a/mingw-w64-headers/crt/stdlib.h
+++ b/mingw-w64-headers/crt/stdlib.h
@@ -8,6 +8,7 @@

 #include <crtdefs.h>
 #include <limits.h>
+#include <string.h>

 #if defined (__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) && !defined (__USE_MINGW_STRTOX)
 #define __USE_MINGW_STRTOX 1
@@ -676,6 +677,8 @@ unsigned long __cdecl _lrotr(unsigned long,int);

 #endif /* !__NO_ISOCEXT */

+char *__cdecl realpath (const char *name, char *resolved);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/mingw-w64-headers/crt/sys/stat.h b/mingw-w64-headers/crt/sys/stat.h
index ed60219..d88b4f1 100644
--- a/mingw-w64-headers/crt/sys/stat.h
+++ b/mingw-w64-headers/crt/sys/stat.h
@@ -58,16 +58,21 @@ extern "C" {
 #include <_mingw_stat64.h>

 #define _S_IFMT 0xF000
+#define _S_IFLNK 0xA000
+#define _S_IFSOCK 0xC000
 #define _S_IFDIR 0x4000
 #define _S_IFCHR 0x2000
 #define _S_IFIFO 0x1000
 #define _S_IFREG 0x8000
+#define _S_ISUID 0x0400
+#define _S_ISGID 0x0200
 #define _S_IREAD 0x0100
 #define _S_IWRITE 0x0080
 #define _S_IEXEC 0x0040

   _CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat);
   _CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat);
+  static inline int __cdecl _lstat32(const char *_Name,struct _stat32 *_Stat) {return _stat32(_Name, _Stat);}
   _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat);
   _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat);
   int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat);
@@ -97,6 +102,9 @@ extern "C" {
   _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat);
   _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat);
   int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat);
+  static inline int __cdecl _lstat64(const char *_Name,struct _stat64 *_Stat) {return _stat64(_Name, _Stat);}
+  static inline int __cdecl _lstat32i64(const char *_Name,struct _stat32i64 *_Stat) {return _stat32i64(_Name, _Stat);}
+  static inline int __cdecl _lstat64i32(const char *_Name,struct _stat64i32 *_Stat) {return _stat64i32(_Name, _Stat);}
 #ifndef __CRT__NO_INLINE
   __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat)
   {
@@ -132,6 +140,8 @@ extern "C" {
 #ifndef	NO_OLDNAMES
 #define	_S_IFBLK	0x3000	/* Block: Is this ever set under w32? */

+#define S_IFLNK _S_IFLNK
+#define S_IFSOCK _S_IFSOCK
 #define S_IFMT _S_IFMT
 #define S_IFDIR _S_IFDIR
 #define S_IFCHR _S_IFCHR
@@ -162,6 +172,11 @@ extern "C" {
 #define S_IXOTH    (S_IXGRP >> 3)
 #define S_IRWXO    (S_IRWXG >> 3)

+#define S_ISUID _S_ISUID
+#define S_ISGID _S_ISGID
+
+#define S_ISLNK(m)	(((m) & S_IFMT) == S_IFLNK)
+#define S_ISSOCK(m)	(((m) & S_IFMT) == S_IFSOCK)
 #define	S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
 #define	S_ISFIFO(m)	(((m) & S_IFMT) == S_IFIFO)
 #define	S_ISCHR(m)	(((m) & S_IFMT) == S_IFCHR)
@@ -174,6 +189,7 @@ extern "C" {
 int __cdecl stat(const char *_Filename,struct stat *_Stat);
 int __cdecl fstat(int _Desc,struct stat *_Stat);
 int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat);
+static inline int __cdecl lstat(const char *_Filename,struct stat *_Stat){return stat(_Filename, _Stat);}

 #ifndef __CRT__NO_INLINE
 #ifdef _USE_32BIT_TIME_T
@@ -262,9 +278,11 @@ __CRT_INLINE int __cdecl

 #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
 #ifdef _USE_32BIT_TIME_T
+#define lstat _lstat32i64
 #define stat _stat32i64
 #define fstat _fstat32i64
 #else
+#define lstat _lstat64
 #define stat _stat64
 #define fstat _fstat64
 #endif
diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h
index 52af29b..8626396 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -6895,7 +6895,12 @@ __buildmemorybarrier()
 	  DWORD Reg : 3;
 	  DWORD R : 1;
 	  DWORD L : 1;
+/* C is used as a const specifier */
+#define save_C C
+#undef C
 	  DWORD C : 1;
+#define C save_C
+#undef save_C
 	  DWORD StackAdjust : 10;
 	} DUMMYSTRUCTNAME;
       } DUMMYUNIONNAME;


code:
This patch changes 'modprobe' & co. so they honor the 'LINUX_MODULE_DIRECTORY'
environment variable, rather than looking for modules exclusively in
/lib/modules.

Original patch by David Guibert, from Nixpkgs; adjusted to use
'LINUX_MODULE_DIRECTORY' rather than 'MODULE_DIR' as the variable name.

diff --git a/depmod.c b/depmod.c
index a1d2f8c..ff579c7 100644
--- a/depmod.c
+++ b/depmod.c
@@ -48,9 +48,6 @@

 #include "testing.h"

-#ifndef MODULE_DIR
-#define MODULE_DIR "/lib/modules/"
-#endif

 #ifndef MODULE_BUILTIN_KEY
 #define MODULE_BUILTIN_KEY "built-in"
@@ -1516,6 +1513,7 @@ static int parse_config_file(const char *filename,
 	char *line;
 	unsigned int linenum = 0;
 	FILE *cfile;
+ 	char *module_dir;

 	cfile = fopen(filename, "r");
 	if (!cfile) {
@@ -1525,6 +1523,10 @@ static int parse_config_file(const char *filename,
 		return 0;
 	}

+        if((module_dir = getenv("LINUX_MODULE_DIRECTORY")) == NULL) {
+                module_dir = "/lib/modules";
+        }
+
 	while ((line = getline_wrapped(cfile, &linenum)) != NULL) {
 		char *ptr = line;
 		char *cmd, *modname;
@@ -1549,8 +1551,8 @@ static int parse_config_file(const char *filename,
 							     0, *search);
 					continue;
 				}
-				nofail_asprintf(&dirname, "%s%s%s/%s", basedir,
-					MODULE_DIR, kernelversion, search_path);
+				nofail_asprintf(&dirname, "%s%s/%s/%s", basedir,
+					module_dir, kernelversion, search_path);
 				len = strlen(dirname);
 				*search = add_search(dirname, len, *search);
 				free(dirname);
@@ -1564,8 +1566,8 @@ static int parse_config_file(const char *filename,
 			if (!regex_match(kernelversion, (const char *)version))
 				continue;

-			nofail_asprintf(&pathname, "%s%s%s/%s/%s.ko", basedir,
-				MODULE_DIR, kernelversion, subdir, modname);
+			nofail_asprintf(&pathname, "%s%s/%s/%s/%s.ko", basedir,
+				module_dir, kernelversion, subdir, modname);

 			*overrides = add_override(pathname, *overrides);
 			free(pathname);
@@ -1737,6 +1739,7 @@ int main(int argc, char *argv[])
 	char *basedir = "", *dirname, *version;
 	char *system_map = NULL, *module_symvers = NULL;
 	int i;
+ 	char *module_dir;
 	const char *config = NULL;

 	if (native_endianness() == 0)
@@ -1832,7 +1835,11 @@ int main(int argc, char *argv[])
 	if (optind == argc)
 		all = 1;

-	nofail_asprintf(&dirname, "%s%s%s", basedir, MODULE_DIR, version);
+        if((module_dir = getenv("LINUX_MODULE_DIRECTORY")) == NULL) {
+                module_dir = "/lib/modules";
+        }
+
+	nofail_asprintf(&dirname, "%s%s/%s", basedir, module_dir, version);

 	if (maybe_all) {
 		if (!doing_stdout && !depfile_out_of_date(dirname))
@@ -1849,8 +1856,8 @@ int main(int argc, char *argv[])
 		char *dirname;
 		size_t len;

-		nofail_asprintf(&dirname, "%s%s%s/updates", basedir,
-				MODULE_DIR, version);
+		nofail_asprintf(&dirname, "%s%s/%s/updates", basedir,
+				module_dir, version);
 		len = strlen(dirname);
 		search = add_search(dirname, len, search);
 	}
diff --git a/modinfo.c b/modinfo.c
index 1dd8469..6a1865b 100644
--- a/modinfo.c
+++ b/modinfo.c
@@ -19,9 +19,6 @@
 #include "zlibsupport.h"
 #include "testing.h"

-#ifndef MODULE_DIR
-#define MODULE_DIR "/lib/modules"
-#endif

 struct param
 {
@@ -193,6 +190,11 @@ static struct elf_file *grab_module(const char *name,
 	struct utsname buf;
 	char *depname, *p, *moddir;
 	struct elf_file *module;
+ 	char *module_dir;
+
+        if((module_dir = getenv("LINUX_MODULE_DIRECTORY")) == NULL) {
+                module_dir = "/lib/modules";
+        }

 	if (strchr(name, '.') || strchr(name, '/')) {
 		module = grab_elf_file(name);
@@ -207,9 +209,9 @@ static struct elf_file *grab_module(const char *name,
 		kernel = buf.release;
 	}
 	if (strlen(basedir))
-		nofail_asprintf(&moddir, "%s/%s/%s", basedir, MODULE_DIR, kernel);
+		nofail_asprintf(&moddir, "%s/%s/%s", basedir, module_dir, kernel);
 	else
-		nofail_asprintf(&moddir, "%s/%s", MODULE_DIR, kernel);
+		nofail_asprintf(&moddir, "%s/%s", module_dir, kernel);

 	/* Search for it in modules.dep. */
 	nofail_asprintf(&depname, "%s/%s", moddir, "modules.dep");
diff --git a/modprobe.c b/modprobe.c
index 5464f45..cb57917 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -86,10 +86,6 @@ typedef enum

 } modprobe_flags_t;

-#ifndef MODULE_DIR
-#define MODULE_DIR "/lib/modules"
-#endif
-
 /**
  * print_usage - output the prefered program usage
  *
@@ -2136,6 +2132,7 @@ int main(int argc, char *argv[])
 	struct modprobe_conf conf = {};

 	recursion_depth = 0;
+ 	char *module_dir = NULL;

 	/* Prepend options from environment. */
 	argv = merge_args(getenv("MODPROBE_OPTIONS"), argv, &argc);
@@ -2233,7 +2230,11 @@ int main(int argc, char *argv[])
 	if (argc < optind + 1 && !dump_config && !list_only)
 		print_usage(argv[0]);

-	nofail_asprintf(&dirname, "%s%s/%s", basedir, MODULE_DIR, buf.release);
+	if((module_dir = getenv("LINUX_MODULE_DIRECTORY")) == NULL) {
+		module_dir = "/lib/modules";
+	}
+
+	nofail_asprintf(&dirname, "%s%s/%s", basedir, module_dir, buf.release);

 	/* Old-style -t xxx wildcard?  Only with -l. */
 	if (list_only) {


code:
This reverts commit 1e20d705e7c64d2b17c031f345057d1e8850fafa, so that it's possible to use our own
miniupnpc, instead of a git submodule.
---
 CMakeLists.txt          |  8 ++++++++
 external/CMakeLists.txt | 41 +++++++++++++++++++++++++++++++----------
 src/p2p/net_node.inl    | 13 ++++++++++---
 3 files changed, 49 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b93988e..ef948885 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -430,6 +430,14 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/translations")

 add_subdirectory(external)

+# Final setup for miniupnpc
+if(UPNP_STATIC OR IOS)
+  add_definitions("-DUPNP_STATIC")
+else()
+  add_definitions("-DUPNP_DYNAMIC")
+  include_directories(${UPNP_INCLUDE})
+endif()
+
 # Final setup for libunbound
 include_directories(${UNBOUND_INCLUDE})
 link_directories(${UNBOUND_LIBRARY_DIRS})
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index 1fc4d64c..b4f712ee 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -34,21 +34,42 @@
 # We always compile if we are building statically to reduce static dependency issues...
 # ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with
 # others.
+if(NOT IOS)
+    find_package(Miniupnpc QUIET)
+endif()

-find_package(Miniupnpc REQUIRED)
+# If we have the correct shared version and we're not building static, use it
+if(STATIC OR IOS)
+ set(USE_SHARED_MINIUPNPC false)
+elseif(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
+ set(USE_SHARED_MINIUPNPC true)
+endif()

-message(STATUS "Using in-tree miniupnpc")
+if(USE_SHARED_MINIUPNPC)
+  message(STATUS "Using shared miniupnpc found at ${MINIUPNP_INCLUDE_DIR}")

-add_subdirectory(miniupnp/miniupnpc)
+  set(UPNP_STATIC false PARENT_SCOPE)
+  set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE)
+  set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE)
+else()
+  if(STATIC)
+    message(STATUS "Using miniupnpc from local source tree for static build")
+  else()
+    message(STATUS "Using miniupnpc from local source tree (/external/miniupnp/miniupnpc)")
+  endif()

-set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
-if(MSVC)
-  set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
-elseif(NOT MSVC)
-  set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
-endif()
+  add_subdirectory(miniupnp/miniupnpc)
+
+  set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
+  if(MSVC)
+    set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
+  elseif(NOT MSVC)
+    set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
+  endif()

-set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
+  set(UPNP_STATIC true PARENT_SCOPE)
+  set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
+endif()

 find_package(Unbound)

diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 9b21705e..76340a22 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -49,9 +49,16 @@
 #include "storages/levin_abstract_invoke2.h"
 #include "cryptonote_core/cryptonote_core.h"

-#include <miniupnp/miniupnpc/miniupnpc.h>
-#include <miniupnp/miniupnpc/upnpcommands.h>
-#include <miniupnp/miniupnpc/upnperrors.h>
+// We have to look for miniupnpc headers in different places, dependent on if its compiled or external
+#ifdef UPNP_STATIC
+  #include <miniupnp/miniupnpc/miniupnpc.h>
+  #include <miniupnp/miniupnpc/upnpcommands.h>
+  #include <miniupnp/miniupnpc/upnperrors.h>
+#else
+  #include "miniupnpc.h"
+  #include "upnpcommands.h"
+  #include "upnperrors.h"
+#endif

 #undef MONERO_DEFAULT_LOG_CATEGORY
 #define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"
--
2.16.2


code:
From e724bb7018a482640c4f194f88b554af2c59d76e Mon Sep 17 00:00:00 2001
From: Mark Benvenuto <mark.benvenuto@mongodb.com>
Date: Wed, 20 Sep 2017 11:50:02 -0400
Subject: [PATCH] SERVER-30857 Support unknown Linux distributions

---
 src/mongo/rpc/metadata/client_metadata.cpp | 6 ------
 src/mongo/util/processinfo_linux.cpp       | 9 ++++++---
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/mongo/rpc/metadata/client_metadata.cpp b/src/mongo/rpc/metadata/client_metadata.cpp
index 845a315dd74..a959a4e31e9 100644
--- a/src/mongo/rpc/metadata/client_metadata.cpp
+++ b/src/mongo/rpc/metadata/client_metadata.cpp
@@ -302,9 +302,6 @@ void ClientMetadata::serializePrivate(StringData driverName,
                                       StringData osArchitecture,
                                       StringData osVersion,
                                       BSONObjBuilder* builder) {
-    invariant(!driverName.empty() && !driverVersion.empty() && !osType.empty() && !osName.empty() &&
-              !osArchitecture.empty() && !osVersion.empty());
-
     BSONObjBuilder metaObjBuilder(builder->subobjStart(kMetadataDocumentName));

     {
@@ -347,9 +344,6 @@ Status ClientMetadata::serializePrivate(StringData driverName,
                                         StringData osVersion,
                                         StringData appName,
                                         BSONObjBuilder* builder) {
-    invariant(!driverName.empty() && !driverVersion.empty() && !osType.empty() && !osName.empty() &&
-              !osArchitecture.empty() && !osVersion.empty());
-
     if (appName.size() > kMaxApplicationNameByteLength) {
         return Status(ErrorCodes::ClientMetadataAppNameTooLarge,
                       str::stream() << "The '" << kApplication << "." << kName
diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
index c3debf377bd..c2813b026b0 100644
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -376,10 +376,13 @@ class LinuxSysHelper {
             if ((nl = name.find('\n', nl)) != string::npos)
                 // stop at first newline
                 name.erase(nl);
-            // no standard format for name and version.  use kernel version
-            version = "Kernel ";
-            version += LinuxSysHelper::readLineFromFile("/proc/sys/kernel/osrelease");
+        } else {
+            name = "unknown";
         }
+
+        // There is no standard format for name and version so use the kernel version.
+        version = "Kernel ";
+        version += LinuxSysHelper::readLineFromFile("/proc/sys/kernel/osrelease");
     }

     /**


code:
https://build.opensuse.org/package/view_file/openSUSE:Factory/mozjs17/mozjs-aarch64-support.patch

index c071c33..90764c3 100644
--- a/js/src/assembler/jit/ExecutableAllocator.h
+++ b/js/src/assembler/jit/ExecutableAllocator.h
@@ -382,6 +382,12 @@ public:
     {
         reprotectRegion(start, size, Executable);
     }
+#elif WTF_CPU_AARCH64 && WTF_PLATFORM_LINUX
+    static void cacheFlush(void* code, size_t size)
+    {
+        intptr_t end = reinterpret_cast<intptr_t>(code) + size;
+        __builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(end));
+    }
 #else
     static void makeWritable(void*, size_t) {}
     static void makeExecutable(void*, size_t) {}
diff --git a/js/src/assembler/wtf/Platform.h b/js/src/assembler/wtf/Platform.h
index 0c84896..e8763a7 100644
--- a/js/src/assembler/wtf/Platform.h
+++ b/js/src/assembler/wtf/Platform.h
@@ -325,6 +325,10 @@
 #define WTF_THUMB_ARCH_VERSION 0
 #endif

+/* CPU(AArch64) - 64-bit ARM */
+#if defined(__aarch64__)
+#define WTF_CPU_AARCH64 1
+#endif

 /* WTF_CPU_ARMV5_OR_LOWER - ARM instruction set v5 or earlier */
 /* On ARMv5 and below the natural alignment is required.
diff --git a/js/src/configure.in b/js/src/configure.in
index 15605b2..19fd704 100644
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -1121,6 +1121,10 @@ arm*)
     CPU_ARCH=arm
     ;;

+aarch64)
+    CPU_ARCH=aarch64
+    ;;
+
 mips|mipsel)
     CPU_ARCH="mips"
     ;;
diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
index 0eec2d9..fe26dab 100644
--- a/mfbt/double-conversion/utils.h
+++ b/mfbt/double-conversion/utils.h
@@ -58,6 +58,7 @@
     defined(__mips__) || defined(__powerpc__) || \
     defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
     defined(__SH4__) || defined(__alpha__) || \
+    defined(__aarch64__) || \
     defined(_MIPS_ARCH_MIPS32R2)
 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)


code:
This patch is sourced from Debian's mozjs24 patch set.

Description: Add arm64 support
Author: Andreas Schwab <schwab@suse.de>
Origin: vendor, https://build.opensuse.org/package/view_file/openSUSE:Factory/mozjs17/mozjs-aarch64-support.patch
Forwarded: no
Last-Update: 2014-01-03

Index: b/mfbt/double-conversion/utils.h
===================================================================
--- a/mfbt/double-conversion/utils.h
+++ b/mfbt/double-conversion/utils.h
@@ -58,7 +58,7 @@
     defined(__mips__) || defined(__powerpc__) || \
     defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
     defined(__SH4__) || defined(__alpha__) || \
-    defined(_MIPS_ARCH_MIPS32R2)
+    defined(_MIPS_ARCH_MIPS32R2) || defined(__aarch64__)
 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
 #if defined(_WIN32)


code:
Taken from https://bug1339931.bmoattachments.org/attachment.cgi?id=8837770.

Add major version to pkg-config filename.
Author: Rico Tzschichholz <ricotz@ubuntu.com>
Forwarded: no
Last-Update: 2015-05-04

Index: b/js/src/Makefile.in
===================================================================
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -214,10 +214,10 @@
 $(JS_CONFIG_NAME): js-config
    cp $^ $@

-$(LIBRARY_NAME).pc: js.pc
+$(JS_LIBRARY_NAME).pc: js.pc
 	cp $^ $@

-install:: $(LIBRARY_NAME).pc
+install:: $(JS_LIBRARY_NAME).pc
 	$(SYSINSTALL) $^ $(DESTDIR)$(libdir)/pkgconfig

 install:: js-config.h


code:
Taken from https://bug1339931.bmoattachments.org/attachment.cgi?id=8837771.

# HG changeset patch
# Parent 4732a0e5d22bc7e5c1f1ace7a182d537d9cc2c6a
Add major version to shell and js-config filenames.
Author: Rico Tzschichholz <ricotz@ubuntu.com>
Forwarded: no
Last-Update: 2014-10-29

---
diff --git a/js/src/configure b/js/src/configure
--- a/js/src/configure
+++ b/js/src/configure
@@ -1696,8 +1696,13 @@
 MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
 IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`

+if test -n "$JS_STANDALONE"; then
+JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
+JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
+else
 JS_SHELL_NAME=js
 JS_CONFIG_NAME=js-config
+fi

 if test -n "$IS_ALPHA"; then

diff --git a/js/src/configure.in b/js/src/configure.in
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -234,16 +234,13 @@ MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSI
 MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
 IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`

-dnl XXX in a temporary bid to avoid developer anger at renaming files
-dnl XXX before "js" symlinks exist, don't change names.
-dnl
-dnl if test -n "$JS_STANDALONE"; then
-dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
-dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
-dnl else
+if test -n "$JS_STANDALONE"; then
+JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
+JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
+else
 JS_SHELL_NAME=js
 JS_CONFIG_NAME=js-config
-dnl fi
+fi

 changequote([,])
 if test -n "$IS_ALPHA"; then

diff -r 80a9e64d75f5 js/src/Makefile.in
--- a/js/src/Makefile.in        Wed Jun 25 15:11:42 2014 +0200
+++ b/js/src/Makefile.in        Sat Jul 05 14:08:38 2014 +0200
@@ -273,6 +273,9 @@
 SCRIPTS = $(JS_CONFIG_NAME)
 SDK_BINARY = $(JS_CONFIG_NAME)

+$(JS_CONFIG_NAME): js-config
+	cp $^ $@
+
 $(JS_LIBRARY_NAME).pc: js.pc
 	cp $^ $@


code:
Squashed version of several commits to fix the tracelogger.

Taken from
https://github.com/GNOME/jhbuild/blob/master/patches/mozjs38-fix-tracelogger.patch.

# === Fix the SM38 tracelogger ===
# This patch is a squashed version of several patches that were adapted
# to fix failing hunks.
#
# Applied in the following order, they are:
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1223767
#    Assertion failure: i < size_, at js/src/vm/TraceLoggingTypes.h:210
#    Also fix stop-information to make reduce.py work correctly.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1227914
#    Limit the memory tracelogger can take.
#    This causes tracelogger to flush data to the disk regularly and prevents out of
#    memory issues if a lot of data gets logged.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1155618
#    Fix tracelogger destructor that touches possibly uninitialised hash table.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1223636
#    Don't treat extraTextId as containing only extra ids.
#    This fixes an assertion failure: id == nextTextId at js/src/vm/TraceLoggingGraph.cpp
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1227028
#    Fix when to keep the payload of a TraceLogger event.
#    This fixes an assertion failure: textId < uint32_t(1 << 31) at js/src/vm/TraceLoggingGraph.h
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1266649
#    Handle failing to add to pointermap gracefully.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1280648
#    Don't cache based on pointers to movable GC things.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1224123
#    Fix the use of LastEntryId in tracelogger.h.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1231170
#    Use size in debugger instead of the current id to track last logged item.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1221844
#    Move TraceLogger_Invalidation to LOG_ITEM.
#    Add some debug checks to logTimestamp.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1255766
#    Also mark resizing of memory.
# * https://bugzilla.mozilla.org/show_bug.cgi?id=1259403
#    Only increase capacity by multiples of 2.
#    Always make sure there are 3 free slots for events.
# ===

diff --git a/js/src/jit-test/tests/tracelogger/bug1231170.js b/js/src/jit-test/tests/tracelogger/bug1231170.js
new file mode 100644
index 0000000..023e93e
--- /dev/null
+++ b/js/src/jit-test/tests/tracelogger/bug1231170.js
@@ -0,0 +1,3 @@
+var du = new Debugger();
+if (typeof du.drainTraceLogger === "function")
+    du.drainTraceLogger();
diff --git a/js/src/jit-test/tests/tracelogger/bug1266649.js b/js/src/jit-test/tests/tracelogger/bug1266649.js
new file mode 100644
index 0000000..81ae7ad
--- /dev/null
+++ b/js/src/jit-test/tests/tracelogger/bug1266649.js
@@ -0,0 +1,10 @@
+
+var du = new Debugger();
+if (typeof du.setupTraceLogger === "function" &&
+    typeof oomTest === 'function')
+{
+    du.setupTraceLogger({
+        Scripts: true
+    })
+    oomTest(() => function(){});
+}
diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp
index 93e2fda..09049d6 100644
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -1055,6 +1055,8 @@ IonScript::Destroy(FreeOp* fop, IonScript* script)

     script->destroyCaches();
     script->unlinkFromRuntime(fop);
+    // Frees the potential event we have set.
+    script->traceLoggerScriptEvent_ = TraceLoggerEvent();
     fop->free_(script);
 }

diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp
index 26262fd..af7f313 100644
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -369,10 +369,10 @@ Debugger::Debugger(JSContext* cx, NativeObject* dbg)
     objects(cx),
     environments(cx),
 #ifdef NIGHTLY_BUILD
-    traceLoggerLastDrainedId(0),
+    traceLoggerLastDrainedSize(0),
     traceLoggerLastDrainedIteration(0),
 #endif
-    traceLoggerScriptedCallsLastDrainedId(0),
+    traceLoggerScriptedCallsLastDrainedSize(0),
     traceLoggerScriptedCallsLastDrainedIteration(0)
 {
     assertSameCompartment(cx, dbg);
@@ -3907,9 +3907,9 @@ Debugger::drainTraceLogger(JSContext* cx, unsigned argc, Value* vp)
     size_t num;
     TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
     bool lostEvents = logger->lostEvents(dbg->traceLoggerLastDrainedIteration,
-                                         dbg->traceLoggerLastDrainedId);
+                                         dbg->traceLoggerLastDrainedSize);
     EventEntry* events = logger->getEventsStartingAt(&dbg->traceLoggerLastDrainedIteration,
-                                                     &dbg->traceLoggerLastDrainedId,
+                                                     &dbg->traceLoggerLastDrainedSize,
                                                      &num);

     RootedObject array(cx, NewDenseEmptyArray(cx));
@@ -4002,10 +4002,10 @@ Debugger::drainTraceLoggerScriptCalls(JSContext* cx, unsigned argc, Value* vp)
     size_t num;
     TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
     bool lostEvents = logger->lostEvents(dbg->traceLoggerScriptedCallsLastDrainedIteration,
-                                         dbg->traceLoggerScriptedCallsLastDrainedId);
+                                         dbg->traceLoggerScriptedCallsLastDrainedSize);
     EventEntry* events = logger->getEventsStartingAt(
                                          &dbg->traceLoggerScriptedCallsLastDrainedIteration,
-                                         &dbg->traceLoggerScriptedCallsLastDrainedId,
+                                         &dbg->traceLoggerScriptedCallsLastDrainedSize,
                                          &num);

     RootedObject array(cx, NewDenseEmptyArray(cx));
diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h
index 8cac36a..c92d685 100644
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -314,10 +314,10 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
      * lost events.
      */
 #ifdef NIGHTLY_BUILD
-    uint32_t traceLoggerLastDrainedId;
+    uint32_t traceLoggerLastDrainedSize;
     uint32_t traceLoggerLastDrainedIteration;
 #endif
-    uint32_t traceLoggerScriptedCallsLastDrainedId;
+    uint32_t traceLoggerScriptedCallsLastDrainedSize;
     uint32_t traceLoggerScriptedCallsLastDrainedIteration;

     class FrameRange;
diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp
index 6715b36..9766a6f 100644
--- a/js/src/vm/TraceLogging.cpp
+++ b/js/src/vm/TraceLogging.cpp
@@ -131,7 +131,7 @@ TraceLoggerThread::init()
 {
     if (!pointerMap.init())
         return false;
-    if (!extraTextId.init())
+    if (!textIdPayloads.init())
         return false;
     if (!events.init())
         return false;
@@ -185,10 +185,10 @@ TraceLoggerThread::~TraceLoggerThread()
         graph = nullptr;
     }

-    for (TextIdHashMap::Range r = extraTextId.all(); !r.empty(); r.popFront())
-        js_delete(r.front().value());
-    extraTextId.finish();
-    pointerMap.finish();
+    if (textIdPayloads.initialized()) {
+        for (TextIdHashMap::Range r = textIdPayloads.all(); !r.empty(); r.popFront())
+            js_delete(r.front().value());
+    }
 }

 bool
@@ -287,7 +287,7 @@ TraceLoggerThread::eventText(uint32_t id)
     if (id < TraceLogger_Last)
         return TLTextIdString(static_cast<TraceLoggerTextId>(id));

-    TextIdHashMap::Ptr p = extraTextId.lookup(id);
+    TextIdHashMap::Ptr p = textIdPayloads.lookup(id);
     MOZ_ASSERT(p);

     return p->value()->string();
@@ -341,13 +341,15 @@ TraceLoggerThread::extractScriptDetails(uint32_t textId, const char** filename,
 TraceLoggerEventPayload*
 TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId textId)
 {
-    TextIdHashMap::AddPtr p = extraTextId.lookupForAdd(textId);
-    if (p)
+    TextIdHashMap::AddPtr p = textIdPayloads.lookupForAdd(textId);
+    if (p) {
+        MOZ_ASSERT(p->value()->textId() == textId); // Sanity check.
         return p->value();
+    }

     TraceLoggerEventPayload* payload = js_new<TraceLoggerEventPayload>(textId, (char*)nullptr);

-    if (!extraTextId.add(p, textId, payload))
+    if (!textIdPayloads.add(p, textId, payload))
         return nullptr;

     return payload;
@@ -357,8 +359,10 @@ TraceLoggerEventPayload*
 TraceLoggerThread::getOrCreateEventPayload(const char* text)
 {
     PointerHashMap::AddPtr p = pointerMap.lookupForAdd((const void*)text);
-    if (p)
+    if (p) {
+        MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check.
         return p->value();
+    }

     size_t len = strlen(text);
     char* str = js_pod_malloc<char>(len + 1);
@@ -369,7 +373,7 @@ TraceLoggerThread::getOrCreateEventPayload(const char* text)
     MOZ_ASSERT(ret == len);
     MOZ_ASSERT(strlen(str) == len);

-    uint32_t textId = extraTextId.count() + TraceLogger_Last;
+    uint32_t textId = nextTextId;

     TraceLoggerEventPayload* payload = js_new<TraceLoggerEventPayload>(textId, str);
     if (!payload) {
@@ -377,17 +381,19 @@ TraceLoggerThread::getOrCreateEventPayload(const char* text)
         return nullptr;
     }

-    if (!extraTextId.putNew(textId, payload)) {
+    if (!textIdPayloads.putNew(textId, payload)) {
         js_delete(payload);
         return nullptr;
     }

-    if (!pointerMap.add(p, text, payload))
-        return nullptr;
-
     if (graph.get())
         graph->addTextId(textId, str);

+    nextTextId++;
+
+    if (!pointerMap.add(p, text, payload))
+        return nullptr;
+
     return payload;
 }

@@ -407,9 +413,14 @@ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, const char* f
     if (!traceLoggerState->isTextIdEnabled(type))
         return getOrCreateEventPayload(type);

-    PointerHashMap::AddPtr p = pointerMap.lookupForAdd(ptr);
-    if (p)
-        return p->value();
+    PointerHashMap::AddPtr p;
+    if (ptr) {
+        p = pointerMap.lookupForAdd(ptr);
+        if (p) {
+            MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check.
+            return p->value();
+        }
+    }

     // Compute the length of the string to create.
     size_t lenFilename = strlen(filename);
@@ -428,24 +439,28 @@ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, const char* f
     MOZ_ASSERT(ret == len);
     MOZ_ASSERT(strlen(str) == len);

-    uint32_t textId = extraTextId.count() + TraceLogger_Last;
+    uint32_t textId = nextTextId;
     TraceLoggerEventPayload* payload = js_new<TraceLoggerEventPayload>(textId, str);
     if (!payload) {
         js_free(str);
         return nullptr;
     }

-    if (!extraTextId.putNew(textId, payload)) {
+    if (!textIdPayloads.putNew(textId, payload)) {
         js_delete(payload);
         return nullptr;
     }

-    if (!pointerMap.add(p, ptr, payload))
-        return nullptr;
-
     if (graph.get())
         graph->addTextId(textId, str);

+    nextTextId++;
+
+    if (ptr) {
+        if (!pointerMap.add(p, ptr, payload))
+            return nullptr;
+    }
+
     return payload;
 }

@@ -453,14 +468,14 @@ TraceLoggerEventPayload*
 TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, JSScript* script)
 {
     return getOrCreateEventPayload(type, script->filename(), script->lineno(), script->column(),
-                                   script);
+                                   nullptr);
 }

 TraceLoggerEventPayload*
 TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type,
                                            const JS::ReadOnlyCompileOptions& script)
 {
-    return getOrCreateEventPayload(type, script.filename(), script.lineno, script.column, &script);
+    return getOrCreateEventPayload(type, script.filename(), script.lineno, script.column, nullptr);
 }

 void
@@ -485,7 +500,7 @@ TraceLoggerThread::startEvent(uint32_t id)
     if (!traceLoggerState->isTextIdEnabled(id))
        return;

-    logTimestamp(id);
+    log(id);
 }

 void
@@ -510,7 +525,7 @@ TraceLoggerThread::stopEvent(uint32_t id)
     if (!traceLoggerState->isTextIdEnabled(id))
         return;

-    logTimestamp(TraceLogger_Stop);
+    log(TraceLogger_Stop);
 }

 void
@@ -522,23 +537,57 @@ TraceLoggerThread::logTimestamp(TraceLoggerTextId id)
 void
 TraceLoggerThread::logTimestamp(uint32_t id)
 {
+    MOZ_ASSERT(id > TraceLogger_LastTreeItem && id < TraceLogger_Last);
+    log(id);
+}
+
+void
+TraceLoggerThread::log(uint32_t id)
+{
     if (enabled == 0)
         return;

     MOZ_ASSERT(traceLoggerState);
-    if (!events.ensureSpaceBeforeAdd()) {
+
+    // We request for 3 items to add, since if we don't have enough room
+    // we record the time it took to make more place. To log this information
+    // we need 2 extra free entries.
+    if (!events.hasSpaceForAdd(3)) {
         uint64_t start = rdtsc() - traceLoggerState->startupTime;

-        if (graph.get())
-            graph->log(events);
+        if (!events.ensureSpaceBeforeAdd(3)) {
+            if (graph.get())
+                graph->log(events);
+
+            iteration_++;
+            events.clear();
+
+            // Remove the item in the pointerMap for which the payloads
+            // have no uses anymore
+            for (PointerHashMap::Enum e(pointerMap); !e.empty(); e.popFront()) {
+                if (e.front().value()->uses() != 0)
+                    continue;
+
+                TextIdHashMap::Ptr p = textIdPayloads.lookup(e.front().value()->textId());
+                MOZ_ASSERT(p);
+                textIdPayloads.remove(p);
+
+                e.removeFront();
+            }

-        iteration_++;
-        events.clear();
+            // Free all payloads that have no uses anymore.
+            for (TextIdHashMap::Enum e(textIdPayloads); !e.empty(); e.popFront()) {
+                if (e.front().value()->uses() == 0) {
+                    js_delete(e.front().value());
+                    e.removeFront();
+                }
+            }
+        }

         // Log the time it took to flush the events as being from the
         // Tracelogger.
         if (graph.get()) {
-            MOZ_ASSERT(events.capacity() > 2);
+            MOZ_ASSERT(events.hasSpaceForAdd(2));
             EventEntry& entryStart = events.pushUninitialized();
             entryStart.time = start;
             entryStart.textId = TraceLogger_Internal;
@@ -548,13 +597,6 @@ TraceLoggerThread::logTimestamp(uint32_t id)
             entryStop.textId = TraceLogger_Stop;
         }

-        // Free all TextEvents that have no uses anymore.
-        for (TextIdHashMap::Enum e(extraTextId); !e.empty(); e.popFront()) {
-            if (e.front().value()->uses() == 0) {
-                js_delete(e.front().value());
-                e.removeFront();
-            }
-        }
     }

     uint64_t time = rdtsc() - traceLoggerState->startupTime;
@@ -956,3 +998,16 @@ TraceLoggerEvent::~TraceLoggerEvent()
     if (payload_)
         payload_->release();
 }
+
+TraceLoggerEvent&
+TraceLoggerEvent::operator=(const TraceLoggerEvent& other)
+{
+    if (hasPayload())
+        payload()->release();
+    if (other.hasPayload())
+        other.payload()->use();
+
+    payload_ = other.payload_;
+
+    return *this;
+}
diff --git a/js/src/vm/TraceLogging.h b/js/src/vm/TraceLogging.h
index a124dcb..91a1eb0 100644
--- a/js/src/vm/TraceLogging.h
+++ b/js/src/vm/TraceLogging.h
@@ -110,6 +110,9 @@ class TraceLoggerEvent {
     bool hasPayload() const {
         return !!payload_;
     }
+
+    TraceLoggerEvent& operator=(const TraceLoggerEvent& other);
+    TraceLoggerEvent(const TraceLoggerEvent& event) = delete;
 };

 /**
@@ -130,6 +133,10 @@ class TraceLoggerEventPayload {
         uses_(0)
     { }

+    ~TraceLoggerEventPayload() {
+        MOZ_ASSERT(uses_ == 0);
+    }
+
     uint32_t textId() {
         return textId_;
     }
@@ -166,7 +173,8 @@ class TraceLoggerThread
     mozilla::UniquePtr<TraceLoggerGraph> graph;

     PointerHashMap pointerMap;
-    TextIdHashMap extraTextId;
+    TextIdHashMap textIdPayloads;
+    uint32_t nextTextId;

     ContinuousSpace<EventEntry> events;

@@ -181,6 +189,7 @@ class TraceLoggerThread
       : enabled(0),
         failed(false),
         graph(),
+        nextTextId(TraceLogger_Last),
         iteration_(0),
         top(nullptr)
     { }
@@ -195,22 +204,22 @@ class TraceLoggerThread
     bool enable(JSContext* cx);
     bool disable();

-    // Given the previous iteration and lastEntryId, return an array of events
+    // Given the previous iteration and size, return an array of events
     // (there could be lost events). At the same time update the iteration and
-    // lastEntry and gives back how many events there are.
-    EventEntry* getEventsStartingAt(uint32_t* lastIteration, uint32_t* lastEntryId, size_t* num) {
+    // size and gives back how many events there are.
+    EventEntry* getEventsStartingAt(uint32_t* lastIteration, uint32_t* lastSize, size_t* num) {
         EventEntry* start;
         if (iteration_ == *lastIteration) {
-            MOZ_ASSERT(events.lastEntryId() >= *lastEntryId);
-            *num = events.lastEntryId() - *lastEntryId;
-            start = events.data() + *lastEntryId + 1;
+            MOZ_ASSERT(*lastSize <= events.size());
+            *num = events.size() - *lastSize;
+            start = events.data() + *lastSize;
         } else {
-            *num = events.lastEntryId() + 1;
+            *num = events.size();
             start = events.data();
         }

         *lastIteration = iteration_;
-        *lastEntryId = events.lastEntryId();
+        *lastSize = events.size();
         return start;
     }

@@ -220,16 +229,16 @@ class TraceLoggerThread
                               const char** lineno, size_t* lineno_len, const char** colno,
                               size_t* colno_len);

-    bool lostEvents(uint32_t lastIteration, uint32_t lastEntryId) {
+    bool lostEvents(uint32_t lastIteration, uint32_t lastSize) {
         // If still logging in the same iteration, there are no lost events.
         if (lastIteration == iteration_) {
-            MOZ_ASSERT(lastEntryId <= events.lastEntryId());
+            MOZ_ASSERT(lastSize <= events.size());
             return false;
         }

-        // When proceeded to the next iteration and lastEntryId points to
-        // the maximum capacity there are no logs that are lost.
-        if (lastIteration + 1 == iteration_ && lastEntryId == events.capacity())
+        // If we are in a consecutive iteration we are only sure we didn't lose any events,
+        // when the lastSize equals the maximum size 'events' can get.
+        if (lastIteration == iteration_ - 1 && lastSize == events.maxSize())
             return false;

         return true;
@@ -268,6 +277,7 @@ class TraceLoggerThread
     void stopEvent(uint32_t id);
   private:
     void stopEvent();
+    void log(uint32_t id);

   public:
     static unsigned offsetOfEnabled() {
diff --git a/js/src/vm/TraceLoggingGraph.cpp b/js/src/vm/TraceLoggingGraph.cpp
index d1b7f2e..a4eb273 100644
--- a/js/src/vm/TraceLoggingGraph.cpp
+++ b/js/src/vm/TraceLoggingGraph.cpp
@@ -276,7 +276,7 @@ TraceLoggerGraph::flush()
         if (bytesWritten < tree.size())
             return false;

-        treeOffset += tree.lastEntryId();
+        treeOffset += tree.size();
         tree.clear();
     }

@@ -359,7 +359,7 @@ TraceLoggerGraph::startEventInternal(uint32_t id, uint64_t timestamp)

     if (parent.lastChildId() == 0) {
         MOZ_ASSERT(!entry.hasChildren());
-        MOZ_ASSERT(parent.treeId() == tree.lastEntryId() + treeOffset);
+        MOZ_ASSERT(parent.treeId() == treeOffset + tree.size() - 1);

         if (!updateHasChildren(parent.treeId()))
             return false;
diff --git a/js/src/vm/TraceLoggingTypes.h b/js/src/vm/TraceLoggingTypes.h
index f1c9d0c..10b76d6 100644
--- a/js/src/vm/TraceLoggingTypes.h
+++ b/js/src/vm/TraceLoggingTypes.h
@@ -21,7 +21,6 @@
     _(Internal)                                       \
     _(Interpreter)                                    \
     _(InlinedScripts)                                 \
-    _(Invalidation)                                   \
     _(IonCompilation)                                 \
     _(IonCompilationPaused)                           \
     _(IonLinking)                                     \
@@ -60,6 +59,7 @@

 #define TRACELOGGER_LOG_ITEMS(_)                      \
     _(Bailout)                                        \
+    _(Invalidation)                                   \
     _(Disable)                                        \
     _(Enable)                                         \
     _(Stop)
@@ -130,6 +130,9 @@ class ContinuousSpace {
     uint32_t size_;
     uint32_t capacity_;

+    // The maximum amount of ram memory a continuous space structure can take (in bytes).
+    static const uint32_t LIMIT = 200 * 1024 * 1024;
+
   public:
     ContinuousSpace ()
      : data_(nullptr)
@@ -151,6 +154,10 @@ class ContinuousSpace {
         data_ = nullptr;
     }

+    static uint32_t maxSize() {
+        return LIMIT / sizeof(T);
+    }
+
     T* data() {
         return data_;
     }
@@ -187,11 +194,14 @@ class ContinuousSpace {
         if (hasSpaceForAdd(count))
             return true;

+        // Limit the size of a continuous buffer.
+        if (size_ + count > maxSize())
+            return false;
+
         uint32_t nCapacity = capacity_ * 2;
-        if (size_ + count > nCapacity)
-            nCapacity = size_ + count;
-        T* entries = (T*) js_realloc(data_, nCapacity * sizeof(T));
+        nCapacity = (nCapacity < maxSize()) ? nCapacity : maxSize();

+        T* entries = (T*) js_realloc(data_, nCapacity * sizeof(T));
         if (!entries)
             return false;


code:
Taken from
https://trac.wildfiregames.com/export/18656/ps/trunk/libraries/source/spidermonkey/FixVersionDetectionConfigure.diff.

Fixes a version detection issue in 0ad.  See
https://lists.gnu.org/archive/html/guix-devel/2017-01/msg00625.html.

diff --git a/js/src/configure b/js/src/configure
--- a/js/src/configure
+++ b/js/src/configure
@@ -1662,70 +1662,6 @@ esac

 fi

-MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
-MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
-MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
-
-cat >> confdefs.pytmp <<EOF
-    (''' MOZILLA_VERSION ''', r''' "$MOZILLA_VERSION" ''')
-EOF
-cat >> confdefs.h <<EOF
-#define MOZILLA_VERSION "$MOZILLA_VERSION"
-EOF
-
-cat >> confdefs.pytmp <<EOF
-    (''' MOZILLA_VERSION_U ''', r''' $MOZILLA_VERSION ''')
-EOF
-cat >> confdefs.h <<EOF
-#define MOZILLA_VERSION_U $MOZILLA_VERSION
-EOF
-
-cat >> confdefs.pytmp <<EOF
-    (''' MOZILLA_UAVERSION ''', r''' "$MOZILLA_UAVERSION" ''')
-EOF
-cat >> confdefs.h <<EOF
-#define MOZILLA_UAVERSION "$MOZILLA_UAVERSION"
-EOF
-
-
-
-# Separate version into components for use in shared object naming etc
-
-MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
-MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
-MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
-IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
-
-JS_SHELL_NAME=js
-JS_CONFIG_NAME=js-config
-
-
-if test -n "$IS_ALPHA"; then
-
-  MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
-
-fi
-cat >> confdefs.pytmp <<EOF
-    (''' MOZJS_MAJOR_VERSION ''', r''' $MOZJS_MAJOR_VERSION ''')
-EOF
-cat >> confdefs.h <<EOF
-#define MOZJS_MAJOR_VERSION $MOZJS_MAJOR_VERSION
-EOF
-
-cat >> confdefs.pytmp <<EOF
-    (''' MOZJS_MINOR_VERSION ''', r''' $MOZJS_MINOR_VERSION ''')
-EOF
-cat >> confdefs.h <<EOF
-#define MOZJS_MINOR_VERSION $MOZJS_MINOR_VERSION
-EOF
-
-
-
-
-
-
-
-

 AR_FLAGS='crs $@'

@@ -5731,6 +5565,71 @@ XCFLAGS="$X_CFLAGS"

 fi # COMPILE_ENVIRONMENT

+MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
+MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
+MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
+
+cat >> confdefs.pytmp <<EOF
+    (''' MOZILLA_VERSION ''', r''' "$MOZILLA_VERSION" ''')
+EOF
+cat >> confdefs.h <<EOF
+#define MOZILLA_VERSION "$MOZILLA_VERSION"
+EOF
+
+cat >> confdefs.pytmp <<EOF
+    (''' MOZILLA_VERSION_U ''', r''' $MOZILLA_VERSION ''')
+EOF
+cat >> confdefs.h <<EOF
+#define MOZILLA_VERSION_U $MOZILLA_VERSION
+EOF
+
+cat >> confdefs.pytmp <<EOF
+    (''' MOZILLA_UAVERSION ''', r''' "$MOZILLA_UAVERSION" ''')
+EOF
+cat >> confdefs.h <<EOF
+#define MOZILLA_UAVERSION "$MOZILLA_UAVERSION"
+EOF
+
+
+
+# Separate version into components for use in shared object naming etc
+
+MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
+MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
+MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
+IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
+
+JS_SHELL_NAME=js
+JS_CONFIG_NAME=js-config
+
+
+if test -n "$IS_ALPHA"; then
+
+  MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
+
+fi
+cat >> confdefs.pytmp <<EOF
+    (''' MOZJS_MAJOR_VERSION ''', r''' $MOZJS_MAJOR_VERSION ''')
+EOF
+cat >> confdefs.h <<EOF
+#define MOZJS_MAJOR_VERSION $MOZJS_MAJOR_VERSION
+EOF
+
+cat >> confdefs.pytmp <<EOF
+    (''' MOZJS_MINOR_VERSION ''', r''' $MOZJS_MINOR_VERSION ''')
+EOF
+cat >> confdefs.h <<EOF
+#define MOZJS_MINOR_VERSION $MOZJS_MINOR_VERSION
+EOF
+
+
+
+
+
+
+
+
+
 AS_BIN=$AS
 AR_LIST='$(AR) t'
 AR_EXTRACT='$(AR) x'
@@ -16003,13 +15908,6 @@ sed 's/$/,/' >> $CONFIG_STATUS <<EOF
     (''' ANDROID_NDK ''', r''' $ANDROID_NDK ''')
     (''' ANDROID_TOOLCHAIN ''', r''' $ANDROID_TOOLCHAIN ''')
     (''' ANDROID_PLATFORM ''', r''' $ANDROID_PLATFORM ''')
-    (''' MOZILLA_SYMBOLVERSION ''', r''' $MOZILLA_SYMBOLVERSION ''')
-    (''' JS_SHELL_NAME ''', r''' $JS_SHELL_NAME ''')
-    (''' JS_CONFIG_NAME ''', r''' $JS_CONFIG_NAME ''')
-    (''' MOZJS_MAJOR_VERSION ''', r''' $MOZJS_MAJOR_VERSION ''')
-    (''' MOZJS_MINOR_VERSION ''', r''' $MOZJS_MINOR_VERSION ''')
-    (''' MOZJS_PATCH_VERSION ''', r''' $MOZJS_PATCH_VERSION ''')
-    (''' MOZJS_ALPHA ''', r''' $MOZJS_ALPHA ''')
     (''' HOST_CC ''', r''' $HOST_CC ''')
     (''' HOST_CXX ''', r''' $HOST_CXX ''')
     (''' HOST_RANLIB ''', r''' $HOST_RANLIB ''')
@@ -16061,6 +15959,13 @@ sed 's/$/,/' >> $CONFIG_STATUS <<EOF
     (''' X_PRE_LIBS ''', r''' $X_PRE_LIBS ''')
     (''' X_LIBS ''', r''' $X_LIBS ''')
     (''' X_EXTRA_LIBS ''', r''' $X_EXTRA_LIBS ''')
+    (''' MOZILLA_SYMBOLVERSION ''', r''' $MOZILLA_SYMBOLVERSION ''')
+    (''' JS_SHELL_NAME ''', r''' $JS_SHELL_NAME ''')
+    (''' JS_CONFIG_NAME ''', r''' $JS_CONFIG_NAME ''')
+    (''' MOZJS_MAJOR_VERSION ''', r''' $MOZJS_MAJOR_VERSION ''')
+    (''' MOZJS_MINOR_VERSION ''', r''' $MOZJS_MINOR_VERSION ''')
+    (''' MOZJS_PATCH_VERSION ''', r''' $MOZJS_PATCH_VERSION ''')
+    (''' MOZJS_ALPHA ''', r''' $MOZJS_ALPHA ''')
     (''' SOLARIS_SUNPRO_CC ''', r''' $SOLARIS_SUNPRO_CC ''')
     (''' SOLARIS_SUNPRO_CXX ''', r''' $SOLARIS_SUNPRO_CXX ''')
     (''' MOZ_THUMB2 ''', r''' $MOZ_THUMB2 ''')


code:
Description: Zero ao_sample_format structure to cope with libao 1.0.0
Author: Colin Watson <cjwatson@debian.org>
Bug-Debian: http://bugs.debian.org/591396
Bug-Ubuntu: https://bugs.launchpad.net/bugs/710268
Forwarded: no
Last-Update: 2013-05-07

Index: b/ao.c
===================================================================
--- a/ao.c
+++ b/ao.c
@@ -123,6 +123,7 @@

   /* initialize ao_format struct */
   /* XXX VERY WRONG */
+  memset(&ao_fmt, 0, sizeof(ao_fmt));
   ao_fmt.bits=16;       /*tmp_stream_info.average_bitrate;*/
   ao_fmt.rate=streaminfo->sample_freq;
   ao_fmt.channels=streaminfo->channels;


code:
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Tue, 19 Jun 2018 04:37:46 +0200
Subject: gnu: mrrescue: Support Love 11.

The patch below was copied verbatim from an as-yet-unmerged PR[0] to
make Mr. Rescue run on a newer version of the Löve engine.

[0]: https://github.com/SimonLarsen/mrrescue/pull/17
---
From ab23031e0c2faecb77fde1be8a41d6f8ea4e6eda Mon Sep 17 00:00:00 2001
From: Mystro256 <alexjnewt@hotmail.com>
Date: Sun, 10 Jun 2018 21:19:23 -0400
Subject: [PATCH] Love 11 support

---
 conf.lua            | 2 +-
 config.lua          | 6 +++---
 highscore_entry.lua | 4 ++--
 highscore_list.lua  | 4 ++--
 ingame.lua          | 6 +++---
 ingame_menu.lua     | 4 ++--
 joystick.lua        | 4 ++--
 main.lua            | 2 +-
 resources.lua       | 4 ++--
 util.lua            | 4 ++--
 10 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/conf.lua b/conf.lua
index 8776da4..f00b216 100644
--- a/conf.lua
+++ b/conf.lua
@@ -1,6 +1,6 @@
 function love.conf(t)
     t.identity = "mrrescue"
-    t.version = "0.10.0"
+    t.version = "11.0"
     t.console = false
     t.accelerometerjoystick = true
     t.gammacorrect = false
diff --git a/config.lua b/config.lua
index 63eeb04..71c2b66 100644
--- a/config.lua
+++ b/config.lua
@@ -38,7 +38,7 @@ function loadConfig()
 			config[i] = v
 		end
 	end
-	if love.filesystem.exists("settings") then
+	if love.filesystem.getInfo("settings")~= nil then
 		local data = love.filesystem.read("settings")
 		local file = TSerial.unpack(data)
 		for i,v in pairs(file) do
@@ -52,7 +52,7 @@ function loadConfig()
 end

 function loadHighscores()
-	if love.filesystem.exists("highscores") then
+	if love.filesystem.getInfo("highscores")~= nil then
 		local data = love.filesystem.read("highscores")
 		local file = TSerial.unpack(data)
 		for i=1,3 do
@@ -64,7 +64,7 @@ function loadHighscores()
 end

 function loadStats()
-	if love.filesystem.exists("stats") then
+	if love.filesystem.getInfo("stats")~= nil then
 		local data = love.filesystem.read("stats")
 		stats = TSerial.unpack(data)
 	end
diff --git a/highscore_entry.lua b/highscore_entry.lua
index 2f763af..3b3bb73 100644
--- a/highscore_entry.lua
+++ b/highscore_entry.lua
@@ -45,9 +45,9 @@ function highscore_entry.draw()
 		for ix = 1,10 do
 			if highscore_entry.selection == char then
 				lg.rectangle("fill", 33+ix*16, 66+iy*16, 14, 14)
-				lg.setColor(0,0,0,255)
+				lg.setColor(0,0,0,1)
 				lg.print(KEYBOARD:sub(char,char), 37+ix*16, 70+iy*16)
-				lg.setColor(255,255,255,255)
+				lg.setColor(1,1,1,1)
 			else
 				lg.print(KEYBOARD:sub(char,char), 37+ix*16, 70+iy*16)
 			end
diff --git a/highscore_list.lua b/highscore_list.lua
index 6a17973..b66d0e2 100644
--- a/highscore_list.lua
+++ b/highscore_list.lua
@@ -31,10 +31,10 @@ function highscore_list.draw()
 		if scores[i] then
 			if highscore_list.level == highscore_list.hllevel
 			and highscore_list.hlpos == i then
-				lg.setColor(25,118,115,255)
+				lg.setColor(25/255,118/255,115/255,1)
 				lg.print(scores[i].name,   48, 14+i*16)
 				lg.print(scores[i].score, 105, 14+i*16)
-				lg.setColor(255,255,255,255)
+				lg.setColor(1,1,1,1)
 			else
 				lg.print(scores[i].name,   48, 14+i*16)
 				lg.print(scores[i].score, 105, 14+i*16)
diff --git a/ingame.lua b/ingame.lua
index 52004f1..f5c6f7c 100644
--- a/ingame.lua
+++ b/ingame.lua
@@ -189,16 +189,16 @@ function ingame.draw()
 		lg.pop()

 		if map.type == MT_NORMAL then
-			lg.setBlendMode("multiply")
+			lg.setBlendMode("multiply", "premultiplied")
 			lg.draw(canvas, 0,0)
 			lg.setBlendMode("alpha")
 		end

 		-- Draw red screen if hit
 		if player.heat > 0 then
-			lg.setColor(255,255,255,cap(player.heat*255, 16, 255))
+			lg.setColor(1,1,1,cap(player.heat*255, 16, 255)/255)
 			lg.draw(img.red_screen, quad.red_screen, 0,0)
-			lg.setColor(255,255,255,255)
+			lg.setColor(1,1,1,1)
 		end

 		-- Draw hud
diff --git a/ingame_menu.lua b/ingame_menu.lua
index 9fcf768..82a8459 100644
--- a/ingame_menu.lua
+++ b/ingame_menu.lua
@@ -18,10 +18,10 @@ function ingame_menu.draw()
 	lg.pop()

 	lg.scale(config.scale)
-	lg.setColor(0,0,0,238)
+	lg.setColor(0,0,0,238/255)
 	lg.rectangle("fill", 0, 0, WIDTH, HEIGHT)

-	lg.setColor(255,255,255,255)
+	lg.setColor(1,1,1,1)
 	lg.printf("PAUSED", 0, 46, WIDTH, "center")
 	lg.print("RESUME", 103, 92)
 	lg.print("QUIT", 103, 106)
diff --git a/joystick.lua b/joystick.lua
index 50ccadb..72d545e 100644
--- a/joystick.lua
+++ b/joystick.lua
@@ -22,11 +22,11 @@ function joystick.draw()
 	lg.printf("SET JOYSTICK", 0, 39, WIDTH, "center")
 	for i=1,4 do
 		if joystick.waiting == true and joystick.selection == i then
-			lg.setColor(195,52,41)
+			lg.setColor(195/255,52/255,41/255)
 		end
 		lg.print(string.upper(joykeynames[i]), 65, 53+i*13)
 		lg.print(config.joykeys[joykeynames[i]], 165, 53+i*13)
-		lg.setColor(255,255,255)
+		lg.setColor(1,1,1)
 	end
 	lg.print("DEFAULT", 65, 118)
 	lg.print("BACK", 65, 131)
diff --git a/main.lua b/main.lua
index 9433e42..56096fa 100644
--- a/main.lua
+++ b/main.lua
@@ -273,7 +273,7 @@ function love.releaseerrhand(msg)
     local font = love.graphics.newFont(14)
     love.graphics.setFont(font)

-    love.graphics.setColor(255, 255, 255, 255)
+    love.graphics.setColor(1, 1, 1, 1)

     love.graphics.clear()

diff --git a/resources.lua b/resources.lua
index e5aa70d..1bab520 100644
--- a/resources.lua
+++ b/resources.lua
@@ -7,7 +7,7 @@ local snd = {}	-- sound Sources

 local IMAGE_FILES = {
 	"splash", "tangram", "lovesplashpixel", "howto",
-	"tiles", "door", "boldfont", "captain_dialog", "captain_dialog_sad",
+	"tiles", "door", "captain_dialog", "captain_dialog_sad",
 	"boss_health", "highscore_panes", "exclamation", "stats_screen",
 	"awards", "hud", "hud2", "hud_people", "item_slots", "water_bar",
 	"reserve_bar", "overloaded_bar", "temperature_bar", "temperature_bar_blink",
@@ -147,7 +147,7 @@ function loadResources()
 	img.stream:setWrap("repeat", "clamp")

 	-- Create fonts
-	font.bold = lg.newImageFont(img.boldfont, " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!'-:*@<>+/_$&?", 2)
+	font.bold = lg.newImageFont("data/boldfont.png", " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!'-:*@<>+/_$&?", 2)
 	lg.setFont(font.bold)

 	-- Create quads
diff --git a/util.lua b/util.lua
index b9976da..656600a 100644
--- a/util.lua
+++ b/util.lua
@@ -105,9 +105,9 @@ end

 function drawBox(x,y,w,h)
-	lg.setColor(30,23,18)
+	lg.setColor(30/255,23/255,18/255)
 	lg.rectangle("fill",x+1,y+1,w-2,h-2)
-	lg.setColor(255,255,255)
+	lg.setColor(1,1,1)
 	-- Draw sides
 	lg.draw(img.menu_box, quad.box_left, x, y+1, 0, 1, (h-2))
 	lg.draw(img.menu_box, quad.box_left, x+w, y+1, 0, -1, (h-2))


code:
From ea861fe86743c8402bbad77d8d1dd9de8dce447e Mon Sep 17 00:00:00 2001
From: Mikkel Krautz <mikkel@krautz.dk>
Date: Fri, 29 Dec 2017 14:47:25 +0100
Subject: [PATCH] AudioOutput: do not use non-existant template version of
 std::abs.

This change fixes AudioOutput to use the float overload of std::abs:

    float std::abs(float);

instead of a non-existant template version (for newer Boost 1.66).

Fixes mumble-voip/mumble#3281

---
 src/mumble/AudioOutput.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp
index cbe0c0e2b..7a0a5e2ab 100644
--- a/src/mumble/AudioOutput.cpp
+++ b/src/mumble/AudioOutput.cpp
@@ -437,7 +437,7 @@ bool AudioOutput::mix(void *outbuff, unsigned int nsamp) {
 					top[2] = 0.0f;
 				}

-				if (std::abs<float>(front[0] * top[0] + front[1] * top[1] + front[2] * top[2]) > 0.01f) {
+				if (std::abs(front[0] * top[0] + front[1] * top[1] + front[2] * top[2]) > 0.01f) {
 					// Not perpendicular. Assume Y up and rotate 90 degrees.

 					float azimuth = 0.0f;


code:
Building sublibraries in parallel can lead to race conditions on the libseq
and lipord targets.

--- MUMPS_5.0.0/Makefile.orig	2015-06-15 10:08:54.523146562 -0500
+++ MUMPS_5.0.0/Makefile	2015-06-15 10:19:44.074367512 -0500
@@ -11,6 +11,7 @@
 	sexamples dexamples cexamples zexamples \
 	mumps_lib requiredobj libseqneeded clean

+.NOTPARALLEL:
 alllib:		c z s d
 all:		cexamples zexamples sexamples dexamples


code:
Mupen64Plus supports a single data directory and a single plugin directory in
its configuration, yet we need data and plugin files from a variety of
packages.  The best way to deal with this is to install all packages from
which data and plugin files are needed into one's profile, and point the
configuration there.  Hence, the ui-console package provides propagated inputs
for packages with the most important data and plugin files, and this patch
provides the user instructions on what needs to be done in order to have
Mupen64Plus find the relevant data and plugins.

--- a/src/plugin.c
+++ b/src/plugin.c
@@ -122,6 +122,22 @@ m64p_error PluginSearchLoad(m64p_handle ConfigUI)
     {
         const char *plugindir = (*ConfigGetParamString)(ConfigUI, "PluginDir");
         lib_filelist = osal_library_search(plugindir);
+        /* Guix specific */
+        if (lib_filelist == NULL)
+        {
+            DebugMessage(M64MSG_ERROR, "No plugins found in PluginDir path: %s", plugindir);
+            DebugMessage(M64MSG_ERROR,
+                         "\n\n"
+                         "*********************************\n"
+                         "*** Notice for GNU Guix users ***\n"
+                         "*********************************\n"
+                         "\n"
+                         "You might want to edit your mupen64plus.cfg (in $XDG_CONFIG_HOME by default)\n"
+                         "and set SharedDataPath to /path/to/my_guix_profile/share/mupen64plus and\n"
+                         "PluginDir to /path/to/my_guix_profile/lib/mupen64plus so that data and plugins\n"
+                         "are found.\n"
+                         "\n");
+        }
     }

     /* if still no plugins found, search some common system folders */


code:
From 21507b3600c616bca7049004eb518cf11f45f299 Mon Sep 17 00:00:00 2001
From: "Anthony J. Bentley" <anthony@cathet.us>
Date: Sun, 7 Jun 2015 02:41:28 -0600
Subject: [PATCH] Correct the path to the GLEW header.

---
 src/glshader.cpp | 2 +-
 src/rgl.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glshader.cpp b/src/glshader.cpp
index 4729945..a8947ea 100644
--- a/src/glshader.cpp
+++ b/src/glshader.cpp
@@ -23,7 +23,7 @@
 #include <stdio.h>
 #include <string.h>
 #include "rgl_assert.h"
-#include <glew.h>
+#include <GL/glew.h>
 #if defined(__MACOSX__)
 #include <OpenGL/gl.h>
 #include <OpenGL/glext.h>
diff --git a/src/rgl.h b/src/rgl.h
index c15f93f..1748406 100644
--- a/src/rgl.h
+++ b/src/rgl.h
@@ -26,7 +26,7 @@
 #include "rgl_assert.h"
 #include "rdp.h"

-#include <glew.h>
+#include <GL/glew.h>
 #if defined(__MACOSX__)
 #include <OpenGL/gl.h>
 #elif defined(__MACOS__)