code:
Patch taken from https://sources.debian.org/data/main/g/gpsbabel/1.5.3-2/debian/patches/use_minizip.

--- a/Makefile.in
+++ b/Makefile.in
@@ -120,7 +120,7 @@ LIBOBJS = queue.o route.o waypt.o filter
 	  src/core/usasciicodec.o\
 	  src/core/ziparchive.o \
 	  $(GARMIN) $(JEEPS) $(SHAPE) @ZLIB@ $(FMTS) $(FILTERS)
-OBJS = main.o globals.o $(LIBOBJS) @FILEINFO@
+OBJS = main.o globals.o $(MINIZIP) $(LIBOBJS) @FILEINFO@

 DEPFILES = $(OBJS:.o=.d)


code:
Extracted from following patch of gpsbabel:
https://github.com/gpsbabel/gpsbabel/commit/604178aa8ad4d3c3ad218df24c1e9a6a1f683bb3

From 604178aa8ad4d3c3ad218df24c1e9a6a1f683bb3 Mon Sep 17 00:00:00 2001
From: Harel Mazor <harel.mazor@gmail.com>
Date: Tue, 24 Jan 2017 00:35:04 +0200
Subject: [PATCH] Added geojson read capablity, moved magic strings to
 constants, fixed windows compilation issues.

--- a/tef_xml.cc
+++ b/tef_xml.cc
@@ -72,11 +72,11 @@ tef_start(xg_string args, const QXmlStreamAttributes* attrv)
   bool valid = false;

   foreach(QXmlStreamAttribute attr, *attrv) {
-    if (attr.name().compare("Comment", Qt::CaseInsensitive) == 0) {
-      if (attr.value().compare("TourExchangeFormat", Qt::CaseInsensitive) == 0) {
+    if (attr.name().compare(QString("Comment"), Qt::CaseInsensitive) == 0) {
+      if (attr.value().compare(QString("TourExchangeFormat"), Qt::CaseInsensitive) == 0) {
         valid = true;
       }
-    } else if (attr.name().compare("Version", Qt::CaseInsensitive) == 0) {
+    } else if (attr.name().compare(QString("Version"), Qt::CaseInsensitive) == 0) {
       version = attr.value().toString().toDouble();
     }
   }
@@ -95,9 +95,9 @@ tef_header(xg_string args, const QXmlStreamAttributes* attrv)
 {
   route = route_head_alloc();
   foreach(QXmlStreamAttribute attr, *attrv) {
-    if (attr.name().compare("Name", Qt::CaseInsensitive) == 0) {
+    if (attr.name().compare(QString("Name"), Qt::CaseInsensitive) == 0) {
       route->rte_name = attr.value().toString().trimmed();
-    } else if (attr.name().compare("Software", Qt::CaseInsensitive) == 0) {
+    } else if (attr.name().compare(QString("Software"), Qt::CaseInsensitive) == 0) {
       route->rte_desc = attr.value().toString().trimmed();
     }
   }
@@ -248,20 +248,20 @@ tef_item_start(xg_string args, const QXmlStreamAttributes* attrv)
     QString attrstr = attr.value().toString();
     QByteArray attrtext = attrstr.toUtf8();

-    if (attr.name().compare("SegDescription", Qt::CaseInsensitive) == 0) {
+    if (attr.name().compare(QString("SegDescription"), Qt::CaseInsensitive) == 0) {
       wpt_tmp->shortname = attrstr.trimmed();
-    } else if (attr.name().compare("PointDescription", Qt::CaseInsensitive) == 0) {
+    } else if (attr.name().compare(QString("PointDescription"), Qt::CaseInsensitive) == 0) {
       wpt_tmp->description = attrstr.trimmed();
-    } else if (attr.name().compare("ViaStation", Qt::CaseInsensitive) == 0 &&
-               attr.value().compare("true", Qt::CaseInsensitive) == 0) {
+    } else if (attr.name().compare(QString("ViaStation"), Qt::CaseInsensitive) == 0 &&
+               attr.value().compare(QString("true"), Qt::CaseInsensitive) == 0) {
       wpt_tmp->wpt_flags.fmt_use = 1;  /* only a flag */

       /* new in TEF V2 */
-    } else if (attr.name().compare("Instruction", Qt::CaseInsensitive) == 0) {
+    } else if (attr.name().compare(QString("Instruction"), Qt::CaseInsensitive) == 0) {
       wpt_tmp->description = attrstr.trimmed();
-    } else if (attr.name().compare("Altitude", Qt::CaseInsensitive) == 0) {
+    } else if (attr.name().compare(QString("Altitude"), Qt::CaseInsensitive) == 0) {
       wpt_tmp->altitude = attrstr.toDouble();
-    } else if (attr.name().compare("TimeStamp", Qt::CaseInsensitive) == 0) {
+    } else if (attr.name().compare(QString("TimeStamp"), Qt::CaseInsensitive) == 0) {
       /* nothing for the moment */
     }
   }
--
2.16.1

license: mit


code:
Skip this performance regression test.

The test measures things on the order of 20ms.  On a loaded machine, we
have seen enough variation that the test would fail.

--- grep-2.22/tests/long-pattern-perf	2016-01-03 12:52:38.491575007 +0100
+++ grep-2.22/tests/long-pattern-perf	2016-01-03 12:53:39.768464687 +0100
@@ -16,6 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

+exit 77
 . "${srcdir=.}/init.sh"; path_prepend_ ../src

 fail=0


code:
Adds support for the environment variable SOURCE_DATE_EPOCH.

See: https://sources.debian.net/patches/groff/1.22.3-9/source-date-epoch.patch/

From abc23bc9245e18468817f2838361c3a08f7521e2 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Thu, 5 Nov 2015 11:47:34 +0000
Subject: Implement `SOURCE_DATE_EPOCH' for reproducible builds.

Author: Colin Watson <cjwatson@debian.org>
Forwarded: yes
Last-Update: 2015-11-05

Patch-Name: source-date-epoch.patch
---
 doc/groff.texinfo                 |  6 +++++
 src/devices/grohtml/grohtml.man   |  7 ++++++
 src/devices/grohtml/post-html.cpp |  5 ++--
 src/devices/gropdf/gropdf.man     |  7 ++++++
 src/devices/gropdf/gropdf.pl      |  3 ++-
 src/devices/grops/grops.man       |  7 ++++++
 src/devices/grops/ps.cpp          |  3 ++-
 src/include/curtime.h             | 23 ++++++++++++++++++
 src/libs/libgroff/Makefile.sub    |  2 ++
 src/libs/libgroff/curtime.cpp     | 51 +++++++++++++++++++++++++++++++++++++++
 src/roff/troff/input.cpp          |  3 ++-
 11 files changed, 112 insertions(+), 5 deletions(-)
 create mode 100644 src/include/curtime.h
 create mode 100644 src/libs/libgroff/curtime.cpp

diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index 066b5274..1d3c7a9f 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -1453,6 +1453,12 @@ default directory (on Unix and GNU/Linux systems, this is usually
 @item GROFF_TYPESETTER
 @tindex GROFF_TYPESETTER@r{, environment variable}
 The default output device.
+
+@item SOURCE_DATE_EPOCH
+@tindex SOURCE_DATE_EPOCH@r{, environment variable}
+A timestamp (expressed as seconds since the Unix epoch) to use in place of
+the current time when initializing time-based built-in registers such as
+@code{\n[seconds]}.
 @end table

 Note that MS-DOS and MS-Windows ports of @code{groff} use semi-colons,
diff --git a/src/devices/grohtml/grohtml.man b/src/devices/grohtml/grohtml.man
index 51eae224..4be4abbc 100644
--- a/src/devices/grohtml/grohtml.man
+++ b/src/devices/grohtml/grohtml.man
@@ -419,6 +419,13 @@ and
 for more details.
 .
 .
+.TP
+.SM
+.B SOURCE_DATE_EPOCH
+A timestamp (expressed as seconds since the Unix epoch) to use as the
+creation timestamp in place of the current time.
+.
+.
 .\" --------------------------------------------------------------------
 .SH BUGS
 .\" --------------------------------------------------------------------
diff --git a/src/devices/grohtml/post-html.cpp b/src/devices/grohtml/post-html.cpp
index fefbf014..b5fc5167 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
 #include "html.h"
 #include "html-text.h"
 #include "html-table.h"
+#include "curtime.h"

 #include <time.h>

@@ -5013,7 +5014,7 @@ void html_printer::do_file_components (void)
 	.put_string(Version_string)
 	.end_comment();

-      t = time(0);
+      t = current_time();
       html.begin_comment("CreationDate: ")
 	.put_string(ctime(&t), strlen(ctime(&t))-1)
 	.end_comment();
@@ -5126,7 +5127,7 @@ html_printer::~html_printer()
     .put_string(Version_string)
     .end_comment();

-  t = time(0);
+  t = current_time();
   html.begin_comment("CreationDate: ")
     .put_string(ctime(&t), strlen(ctime(&t))-1)
     .end_comment();
diff --git a/src/devices/gropdf/gropdf.man b/src/devices/gropdf/gropdf.man
index 3bbace6a..cc0c82f1 100644
--- a/src/devices/gropdf/gropdf.man
+++ b/src/devices/gropdf/gropdf.man
@@ -1029,6 +1029,13 @@ and
 for more details.
 .
 .
+.TP
+.SM
+.B SOURCE_DATE_EPOCH
+A timestamp (expressed as seconds since the Unix epoch) to use as the
+creation timestamp in place of the current time.
+.
+.
 .\" --------------------------------------------------------------------
 .SH FILES
 .\" --------------------------------------------------------------------
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 035d1238..c25c4c67 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -239,13 +239,14 @@ elsif (exists($ppsz{$papersz}))
     @defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]);
 }

-my (@dt)=localtime(time);
+my (@dt)=localtime($ENV{SOURCE_DATE_EPOCH} || time);
 my $dt=PDFDate(\@dt);

 my %info=('Creator' => "(groff version $cfg{GROFF_VERSION})",
 				'Producer' => "(gropdf version $cfg{GROFF_VERSION})",
 				'ModDate' => "($dt)",
 				'CreationDate' => "($dt)");
+
 while (<>)
 {
     chomp;
diff --git a/src/devices/grops/grops.man b/src/devices/grops/grops.man
index 99fb7486..272c2d18 100644
--- a/src/devices/grops/grops.man
+++ b/src/devices/grops/grops.man
@@ -1419,6 +1419,13 @@ and
 for more details.
 .
 .
+.TP
+.SM
+.B SOURCE_DATE_EPOCH
+A timestamp (expressed as seconds since the Unix epoch) to use as the
+creation timestamp in place of the current time.
+.
+.
 .\" --------------------------------------------------------------------
 .SH FILES
 .\" --------------------------------------------------------------------
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 745a503b..03e65372 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
 #include "cset.h"
 #include "nonposix.h"
 #include "paper.h"
+#include "curtime.h"

 #include "ps.h"
 #include <time.h>
@@ -1390,7 +1391,7 @@ ps_printer::~ps_printer()
 #else
     time_t
 #endif
-    t = time(0);
+    t = current_time();
     fputs(ctime(&t), out.get_file());
   }
   for (font_pointer_list *f = font_list; f; f = f->next) {
diff --git a/src/include/curtime.h b/src/include/curtime.h
new file mode 100644
index 00000000..a4105196
--- /dev/null
+++ b/src/include/curtime.h
@@ -0,0 +1,23 @@
+/* Copyright (C) 2015  Free Software Foundation, Inc.
+
+This file is part of groff.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+The GNU General Public License version 2 (GPL2) is available in the
+internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
+
+#ifdef LONG_FOR_TIME_T
+long
+#else
+time_t
+#endif
+current_time();
diff --git a/src/libs/libgroff/Makefile.sub b/src/libs/libgroff/Makefile.sub
index 840d9934..4cb4937a 100644
--- a/src/libs/libgroff/Makefile.sub
+++ b/src/libs/libgroff/Makefile.sub
@@ -32,6 +32,7 @@ OBJS=\
   cmap.$(OBJEXT) \
   color.$(OBJEXT) \
   cset.$(OBJEXT) \
+  curtime.$(OBJEXT) \
   device.$(OBJEXT) \
   errarg.$(OBJEXT) \
   error.$(OBJEXT) \
@@ -82,6 +83,7 @@ CCSRCS=\
   $(srcdir)/cmap.cpp \
   $(srcdir)/color.cpp \
   $(srcdir)/cset.cpp \
+  $(srcdir)/curtime.cpp \
   $(srcdir)/device.cpp \
   $(srcdir)/errarg.cpp \
   $(srcdir)/error.cpp \
diff --git a/src/libs/libgroff/curtime.cpp b/src/libs/libgroff/curtime.cpp
new file mode 100644
index 00000000..00821b7f
--- /dev/null
+++ b/src/libs/libgroff/curtime.cpp
@@ -0,0 +1,51 @@
+/* Copyright (C) 2015  Free Software Foundation, Inc.
+
+This file is part of groff.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+The GNU General Public License version 2 (GPL2) is available in the
+internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "errarg.h"
+#include "error.h"
+
+#ifdef LONG_FOR_TIME_T
+long
+#else
+time_t
+#endif
+current_time()
+{
+  char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+
+  if (source_date_epoch) {
+    errno = 0;
+    char *endptr;
+    long epoch = strtol(source_date_epoch, &endptr, 10);
+
+    if ((errno == ERANGE && (epoch == LONG_MAX || epoch == LONG_MIN)) ||
+	(errno != 0 && epoch == 0))
+      fatal("$SOURCE_DATE_EPOCH: strtol: %1", strerror(errno));
+    if (endptr == source_date_epoch)
+      fatal("$SOURCE_DATE_EPOCH: no digits found: %1", endptr);
+    if (*endptr != '\0')
+      fatal("$SOURCE_DATE_EPOCH: trailing garbage: %1", endptr);
+    return epoch;
+  } else
+    return time(0);
+}
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 9594f074..f7d2c18a 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
 #include "input.h"
 #include "defs.h"
 #include "unicode.h"
+#include "curtime.h"

 // Needed for getpid() and isatty()
 #include "posix.h"
@@ -8138,7 +8139,7 @@ static void init_registers()
 #else /* not LONG_FOR_TIME_T */
   time_t
 #endif /* not LONG_FOR_TIME_T */
-    t = time(0);
+    t = current_time();
   // Use struct here to work around misfeature in old versions of g++.
   struct tm *tt = localtime(&t);
   set_number_reg("seconds", int(tt->tm_sec));


code:
From 3dbdc68093e90f0ef9b77b70490d8e0b1dcfbf8f Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sun, 17 Sep 2017 21:08:45 +0200
Subject: [PATCH] Add ExceptionUtilsGenerator.java.

A gradle task (in gradle/utils.gradle) is normally used to generate an
ExceptionUtils class. Since gradle depends on groovy, we cannot use it, so
we copy the code from the gradle task to a new file. Running this file then
generates the required class.
---
 .../codehaus/groovy/ExceptionUtilsGenerator.java   | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java

diff --git a/config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java b/config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java
new file mode 100644
index 0000000..41f006d
--- /dev/null
+++ b/config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java
@@ -0,0 +1,75 @@
+package org.codehaus.groovy;
+
+import org.objectweb.asm.*;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+public class ExceptionUtilsGenerator implements Opcodes {
+    private final static Logger LOGGER = Logger.getLogger(ExceptionUtilsGenerator.class.getName());
+
+    public static void main(String... args) {
+        if (args==null || args.length==0) {
+            throw new IllegalArgumentException("You must specify at least one file");
+        }
+
+        ClassWriter cw = new ClassWriter(0);
+        MethodVisitor mv;
+
+        cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, "org/codehaus/groovy/runtime/ExceptionUtils", null, "java/lang/Object", null);
+
+        cw.visitSource("ExceptionUtils.java", null);
+
+        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+        mv.visitCode();
+        Label l0 = new Label();
+        mv.visitLabel(l0);
+        mv.visitLineNumber(18, l0);
+        mv.visitVarInsn(ALOAD, 0);
+        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
+        mv.visitInsn(RETURN);
+        Label l1 = new Label();
+        mv.visitLabel(l1);
+        mv.visitLocalVariable("this", "Lorg/codehaus/groovy/runtime/ExceptionUtils;", null, l0, l1, 0);
+        mv.visitMaxs(1, 1);
+        mv.visitEnd();
+
+        mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "sneakyThrow", "(Ljava/lang/Throwable;)V", null, null);
+        mv.visitCode();
+        Label l2 = new Label();
+        mv.visitLabel(l2);
+        mv.visitLineNumber(20, l2);
+        mv.visitVarInsn(ALOAD, 0);
+        mv.visitInsn(ATHROW);
+        Label l3 = new Label();
+        mv.visitLabel(l3);
+        mv.visitLocalVariable("e", "Ljava/lang/Throwable;", null, l2, l3, 0);
+        mv.visitMaxs(1, 1);
+        mv.visitEnd();
+
+        cw.visitEnd();
+
+        LOGGER.info("Generating ExceptionUtils");
+        byte[] bytes = cw.toByteArray();
+        for (String classFilePath : args) {
+            File classFile = new File(classFilePath);
+            if (classFile.getParentFile().exists() || classFile.getParentFile().mkdirs()) {
+                try {
+                    if (classFile.exists()) {
+                        classFile.delete();
+                    }
+                    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(classFile));
+                    bos.write(bytes);
+                    bos.close();
+                } catch (IOException e) {
+                    LOGGER.warning("Unable to write file "+classFile);
+                }
+            } else {
+                LOGGER.warning("Unable to create directory "+classFile.getParentFile());
+            }
+        }
+	}
+}
--
2.14.1


code:
Without this patch, GRUB may proceed to wipe all firmware boot entries
and report a successful installation, even if efibootmgr hit an error.

Origin URL:
https://git.sv.gnu.org/cgit/grub.git/commit/?id=6400613ad0b463abc93362086a491cd2a5e99b0d

From 6400613ad0b463abc93362086a491cd2a5e99b0d Mon Sep 17 00:00:00 2001
From: Steve McIntyre <steve@einval.com>
Date: Wed, 31 Jan 2018 21:49:36 +0000
Subject: Make grub-install check for errors from efibootmgr

Code is currently ignoring errors from efibootmgr, giving users
clearly bogus output like:

        Setting up grub-efi-amd64 (2.02~beta3-4) ...
        Installing for x86_64-efi platform.
        Could not delete variable: No space left on device
        Could not prepare Boot variable: No space left on device
        Installation finished. No error reported.

and then potentially unbootable systems. If efibootmgr fails, grub-install
should know that and report it!

We've been using similar patch in Debian now for some time, with no ill effects.

diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c
index a3fcfca..ca448bc 100644
--- a/grub-core/osdep/unix/platform.c
+++ b/grub-core/osdep/unix/platform.c
@@ -78,19 +78,20 @@ get_ofpathname (const char *dev)
 		   dev);
 }

-static void
+static int
 grub_install_remove_efi_entries_by_distributor (const char *efi_distributor)
 {
   int fd;
   pid_t pid = grub_util_exec_pipe ((const char * []){ "efibootmgr", NULL }, &fd);
   char *line = NULL;
   size_t len = 0;
+  int rc;

   if (!pid)
     {
       grub_util_warn (_("Unable to open stream from %s: %s"),
 		      "efibootmgr", strerror (errno));
-      return;
+      return errno;
     }

   FILE *fp = fdopen (fd, "r");
@@ -98,7 +99,7 @@ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor)
     {
       grub_util_warn (_("Unable to open stream from %s: %s"),
 		      "efibootmgr", strerror (errno));
-      return;
+      return errno;
     }

   line = xmalloc (80);
@@ -119,23 +120,25 @@ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor)
       bootnum = line + sizeof ("Boot") - 1;
       bootnum[4] = '\0';
       if (!verbosity)
-	grub_util_exec ((const char * []){ "efibootmgr", "-q",
+	rc = grub_util_exec ((const char * []){ "efibootmgr", "-q",
 	      "-b", bootnum,  "-B", NULL });
       else
-	grub_util_exec ((const char * []){ "efibootmgr",
+	rc = grub_util_exec ((const char * []){ "efibootmgr",
 	      "-b", bootnum, "-B", NULL });
     }

   free (line);
+  return rc;
 }

-void
+int
 grub_install_register_efi (grub_device_t efidir_grub_dev,
 			   const char *efifile_path,
 			   const char *efi_distributor)
 {
   const char * efidir_disk;
   int efidir_part;
+  int ret;
   efidir_disk = grub_util_biosdisk_get_osdev (efidir_grub_dev->disk);
   efidir_part = efidir_grub_dev->disk->partition ? efidir_grub_dev->disk->partition->number + 1 : 1;

@@ -151,23 +154,26 @@ grub_install_register_efi (grub_device_t efidir_grub_dev,
   grub_util_exec ((const char * []){ "modprobe", "-q", "efivars", NULL });
 #endif
   /* Delete old entries from the same distributor.  */
-  grub_install_remove_efi_entries_by_distributor (efi_distributor);
+  ret = grub_install_remove_efi_entries_by_distributor (efi_distributor);
+  if (ret)
+    return ret;

   char *efidir_part_str = xasprintf ("%d", efidir_part);

   if (!verbosity)
-    grub_util_exec ((const char * []){ "efibootmgr", "-q",
+    ret = grub_util_exec ((const char * []){ "efibootmgr", "-q",
 	  "-c", "-d", efidir_disk,
 	  "-p", efidir_part_str, "-w",
 	  "-L", efi_distributor, "-l",
 	  efifile_path, NULL });
   else
-    grub_util_exec ((const char * []){ "efibootmgr",
+    ret = grub_util_exec ((const char * []){ "efibootmgr",
 	  "-c", "-d", efidir_disk,
 	  "-p", efidir_part_str, "-w",
 	  "-L", efi_distributor, "-l",
 	  efifile_path, NULL });
   free (efidir_part_str);
+  return ret;
 }

 void
diff --git a/include/grub/util/install.h b/include/grub/util/install.h
index 5910b0c..0dba8b6 100644
--- a/include/grub/util/install.h
+++ b/include/grub/util/install.h
@@ -210,7 +210,7 @@ grub_install_create_envblk_file (const char *name);
 const char *
 grub_install_get_default_x86_platform (void);

-void
+int
 grub_install_register_efi (grub_device_t efidir_grub_dev,
 			   const char *efifile_path,
 			   const char *efi_distributor);
diff --git a/util/grub-install.c b/util/grub-install.c
index 5e4cdfd..690f180 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1848,9 +1848,13 @@ main (int argc, char *argv[])
 	  if (!removable && update_nvram)
 	    {
 	      /* Try to make this image bootable using the EFI Boot Manager, if available.  */
-	      grub_install_register_efi (efidir_grub_dev,
-					 "\\System\\Library\\CoreServices",
-					 efi_distributor);
+	      int ret;
+	      ret = grub_install_register_efi (efidir_grub_dev,
+					       "\\System\\Library\\CoreServices",
+					       efi_distributor);
+	      if (ret)
+	        grub_util_error (_("efibootmgr failed to register the boot entry: %s"),
+				 strerror (ret));
 	    }

 	  grub_device_close (ins_dev);
@@ -1871,6 +1875,7 @@ main (int argc, char *argv[])
 	{
 	  char * efifile_path;
 	  char * part;
+	  int ret;

 	  /* Try to make this image bootable using the EFI Boot Manager, if available.  */
 	  if (!efi_distributor || efi_distributor[0] == '\0')
@@ -1887,8 +1892,11 @@ main (int argc, char *argv[])
 			  efidir_grub_dev->disk->name,
 			  (part ? ",": ""), (part ? : ""));
 	  grub_free (part);
-	  grub_install_register_efi (efidir_grub_dev,
-				     efifile_path, efi_distributor);
+	  ret = grub_install_register_efi (efidir_grub_dev,
+					   efifile_path, efi_distributor);
+	  if (ret)
+	    grub_util_error (_("efibootmgr failed to register the boot entry: %s"),
+			     strerror (ret));
 	}
       break;


code:
Work around a test failure due to a rounding issue on 32-bit
platforms, as reported at:

  https://lists.gnu.org/archive/html/bug-gsl/2016-10/msg00000.html

--- gsl-2.2.1/linalg/test.c	2016-10-05 13:27:42.464059730 +0200
+++ gsl-2.2.1/linalg/test.c	2016-10-05 13:27:46.988095882 +0200
@@ -4843,9 +4843,6 @@ main(void)
   gsl_test(test_cholesky_decomp_unit(),  "Cholesky Decomposition [unit triangular]");
   gsl_test(test_cholesky_solve(),        "Cholesky Solve");

-  gsl_test(test_cholesky_decomp(r),      "Cholesky Decomposition");
-  gsl_test(test_cholesky_invert(r),      "Cholesky Inverse");
-  gsl_test(test_pcholesky_decomp(r),     "Pivoted Cholesky Decomposition");
   gsl_test(test_pcholesky_solve(r),      "Pivoted Cholesky Solve");
   gsl_test(test_pcholesky_invert(r),     "Pivoted Cholesky Inverse");
   gsl_test(test_mcholesky_decomp(r),     "Modified Cholesky Decomposition");


code:
Somehow, Aspell 0.60.6.1 and aspell-dict-en-2016.11.20-0 don't consider
this a valid spelling.  Skip it.

TODO: Migrate to using hunspell. According to upstream, this bug won't be fixed.
See https://bugzilla.gnome.org/show_bug.cgi?id=772406.
--- a/testsuite/test-checker.c	2017-03-24 09:50:50.000000000 -0400
+++ b/testsuite/test-checker.c	2017-06-15 21:47:07.116173895 -0400
@@ -105,10 +105,11 @@
 	 * be considered deprecated, it is better to use hunspell, so WONTFIX.
 	 * For more details, see:
 	 * https://bugzilla.gnome.org/show_bug.cgi?id=772406
+	 *
+	 * correctly_spelled = gspell_checker_check_word (checker, "spell-checking", -1, &error);
+	 * g_assert_no_error (error);
+	 * g_assert (correctly_spelled);
 	 */
-	correctly_spelled = gspell_checker_check_word (checker, "spell-checking", -1, &error);
-	g_assert_no_error (error);
-	g_assert (correctly_spelled);

 	correctly_spelled = gspell_checker_check_word (checker, "nrst-auie", -1, &error);
 	g_assert_no_error (error);


code:
This patch replaces the environment variable "GTK_IM_MODULE" with
"GUIX_GTK2_IM_MODULE_FILE" to prevent this version of GTK+ from loading input
method modules for other major versions of GTK+.

--- gtk+-2.24.30/gtk/gtkrc.c	2016-08-21 22:40:22.339660438 +0200
+++ gtk+-2.24.30/gtk/gtkrc.c	2016-08-23 10:11:11.080822710 +0200
@@ -439,7 +439,7 @@
 gchar *
 gtk_rc_get_im_module_file (void)
 {
-  const gchar *var = g_getenv ("GTK_IM_MODULE_FILE");
+  const gchar *var = g_getenv ("GUIX_GTK2_IM_MODULE_FILE");
   gchar *result = NULL;

   if (var)


code:
This patch makes GTK+ look for additional modules in a list of directories
specified by the environment variable "GUIX_GTK2_PATH".  This can be used
instead of "GTK_PATH" to make GTK+ find modules that are incompatible with
other major versions of GTK+.

--- a/gtk/gtkmodules.c	2014-09-29 22:02:17.000000000 +0200
+++ b/gtk/gtkmodules.c	2015-12-02 18:41:53.306396938 +0100
@@ -55,6 +55,7 @@
 get_module_path (void)
 {
   const gchar *module_path_env;
+  const gchar *module_guix_gtk2_path_env;
   const gchar *exe_prefix;
   const gchar *home_dir;
   gchar *home_gtk_dir = NULL;
@@ -70,6 +71,7 @@
     home_gtk_dir = g_build_filename (home_dir, ".gtk-2.0", NULL);

   module_path_env = g_getenv ("GTK_PATH");
+  module_guix_gtk2_path_env = g_getenv ("GUIX_GTK2_PATH");
   exe_prefix = g_getenv ("GTK_EXE_PREFIX");

   if (exe_prefix)
@@ -77,9 +79,21 @@
   else
     default_dir = g_build_filename (GTK_LIBDIR, "gtk-2.0", NULL);

-  if (module_path_env && home_gtk_dir)
+  if (module_guix_gtk2_path_env && module_path_env && home_gtk_dir)
+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
+				module_guix_gtk2_path_env, module_path_env, home_gtk_dir, default_dir, NULL);
+  else if (module_guix_gtk2_path_env && home_gtk_dir)
+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
+				module_guix_gtk2_path_env, home_gtk_dir, default_dir, NULL);
+  else if (module_guix_gtk2_path_env && module_path_env)
+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
+				module_guix_gtk2_path_env, module_path_env, default_dir, NULL);
+  else if (module_path_env && home_gtk_dir)
     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
 				module_path_env, home_gtk_dir, default_dir, NULL);
+  else if (module_guix_gtk2_path_env)
+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
+				module_guix_gtk2_path_env, default_dir, NULL);
   else if (module_path_env)
     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
 				module_path_env, default_dir, NULL);


code:
From: Jookia <166291@gmail.com>
Subject: [PATCHv2] gtk: Patch GTK+ to look for themes in profiles.
To: guix-devel@gnu.org
Date: Sun, 13 Mar 2016 15:17:37 +1100
Url: https://lists.gnu.org/archive/html/guix-devel/2016-03/msg00492.html

diff -Naur gtk+-2.24.28.new/gtk/gtkrc.c gtk+-2.24.28/gtk/gtkrc.c
--- gtk+-2.24.28.new/gtk/gtkrc.c	2016-03-13 10:31:14.413644362 +1100
+++ gtk+-2.24.28/gtk/gtkrc.c	2016-03-13 12:51:34.723398423 +1100
@@ -808,6 +808,8 @@
   gchar *path = NULL;
   const gchar *home_dir;
   gchar *subpath;
+  const gchar * const *xdg_data_dirs;
+  gint i;

   if (type)
     subpath = g_strconcat ("gtk-2.0-", type,
@@ -830,6 +832,22 @@
     }

   if (!path)
+    {
+      xdg_data_dirs = g_get_system_data_dirs ();
+      for (i = 0; xdg_data_dirs[i]; i++)
+        {
+          path = g_build_filename (xdg_data_dirs[i], "themes", name, subpath, NULL);
+          if (g_file_test (path, G_FILE_TEST_EXISTS))
+            break;
+          else
+            {
+              g_free (path);
+              path = NULL;
+            }
+        }
+    }
+
+  if (!path)
     {
       gchar *theme_dir = gtk_rc_get_theme_dir ();
       path = g_build_filename (theme_dir, name, subpath, NULL);


code:
This patch replaces the environment variable "GTK_IM_MODULE" with
"GUIX_GTK3_IM_MODULE_FILE" to prevent this version of GTK+ from loading input
method modules for other major versions of GTK+.

--- gtk+-3.20.3/gtk/deprecated/gtkrc.c	2016-08-21 22:40:48.168437905 +0200
+++ gtk+-3.20.3/gtk/deprecated/gtkrc.c	2016-08-23 10:12:09.097070097 +0200
@@ -768,7 +768,7 @@
 gchar *
 gtk_rc_get_im_module_file (void)
 {
-  const gchar *var = g_getenv ("GTK_IM_MODULE_FILE");
+  const gchar *var = g_getenv ("GUIX_GTK3_IM_MODULE_FILE");
   gchar *result = NULL;

   if (var)


code:
This patch makes GTK+ look for additional modules in a list of directories
specified by the environment variable "GUIX_GTK3_PATH".  This can be used
instead of "GTK_PATH" to make GTK+ find modules that are incompatible with
other major versions of GTK+.

--- a/gtk/gtkmodules.c	2015-09-20 20:09:05.060590217 +0200
+++ b/gtk/gtkmodules.c	2015-09-20 20:10:33.423124833 +0200
@@ -52,6 +52,7 @@
 get_module_path (void)
 {
   const gchar *module_path_env;
+  const gchar *module_guix_gtk3_path_env;
   const gchar *exe_prefix;
   gchar *module_path;
   gchar *default_dir;
@@ -61,6 +62,7 @@
     return result;

   module_path_env = g_getenv ("GTK_PATH");
+  module_guix_gtk3_path_env = g_getenv ("GUIX_GTK3_PATH");
   exe_prefix = g_getenv ("GTK_EXE_PREFIX");

   if (exe_prefix)
@@ -68,7 +70,13 @@
   else
     default_dir = g_build_filename (_gtk_get_libdir (), "gtk-3.0", NULL);

-  if (module_path_env)
+  if (module_guix_gtk3_path_env && module_path_env)
+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
+				module_guix_gtk3_path_env, module_path_env, default_dir, NULL);
+  else if (module_guix_gtk3_path_env)
+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
+				module_guix_gtk3_path_env, default_dir, NULL);
+  else if (module_path_env)
     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
 				module_path_env, default_dir, NULL);
   else


code:
Having DISABLE_DEPRECATED flags set in the distribution breaks
building with libraries later than those which the maintainer
happened to have installed.  This patch removes them.

diff -r -U 3 a/gtk/Makefile.am b/gtk/Makefile.am
--- a/gtk/Makefile.am	2003-05-09 15:55:05.000000000 +0200
+++ b/gtk/Makefile.am	2013-12-26 15:06:38.000000000 +0100
@@ -36,11 +36,7 @@
 	-I$(top_srcdir)			\
 	-I$(top_builddir)/gdk		\
 	$(GTKGLEXT_DEBUG_FLAGS)		\
-	$(GTKGLEXT_DEP_CFLAGS)		\
-	-DG_DISABLE_DEPRECATED		\
-	-DGDK_DISABLE_DEPRECATED	\
-	-DGDK_PIXBUF_DISABLE_DEPRECATED	\
-	-DGTK_DISABLE_DEPRECATED
+	$(GTKGLEXT_DEP_CFLAGS)

 common_ldflags = \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 	\
diff -r -U 3 a/gtk/Makefile.in b/gtk/Makefile.in
--- a/gtk/Makefile.in	2006-02-05 04:17:42.000000000 +0100
+++ b/gtk/Makefile.in	2013-12-26 15:07:00.000000000 +0100
@@ -234,11 +234,7 @@
 	-I$(top_srcdir)			\
 	-I$(top_builddir)/gdk		\
 	$(GTKGLEXT_DEBUG_FLAGS)		\
-	$(GTKGLEXT_DEP_CFLAGS)		\
-	-DG_DISABLE_DEPRECATED		\
-	-DGDK_DISABLE_DEPRECATED	\
-	-DGDK_PIXBUF_DISABLE_DEPRECATED	\
-	-DGTK_DISABLE_DEPRECATED
+	$(GTKGLEXT_DEP_CFLAGS)

 common_ldflags = \


code:
Fix doc snarfing with GCC 4.5+.
From <http://git.savannah.gnu.org/cgit/guile.git/commit/?h=branch_release-1-8&id=aac41d28358cea594bb30f6e547afb82bb6004a6>.

diff --git a/scripts/snarf-check-and-output-texi b/scripts/snarf-check-and-output-texi
index ea33e17..8cd42e8 100755
--- a/scripts/snarf-check-and-output-texi
+++ b/scripts/snarf-check-and-output-texi
@@ -267,6 +267,17 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
       (set! *file* file)
       (set! *line* line))

+     ;; newer gccs like to throw around more location markers into the
+     ;; preprocessed source; these (hash . hash) bits are what they translate to
+     ;; in snarfy terms.
+     (('location ('string . file) ('int . line) ('hash . 'hash))
+      (set! *file* file)
+      (set! *line* line))
+
+     (('location ('hash . 'hash) ('string . file) ('int . line) ('hash . 'hash))
+      (set! *file* file)
+      (set! *line* line))
+
      (('arglist rest ...)
       (set! *args* (do-arglist rest)))


code:
This hack makes Guile default to UTF-8.  This avoids calls to
`iconv_open'; `iconv_open' tries to open shared objects that aren't
available during bootstrap, so using UTF-8 avoids that (and UTF-8 has
built-in conversions in glibc, too.)

diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 7cd753009..de92653a4 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -1918,7 +1918,7 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness)
   if (scm_i_is_narrow_string (str))                                     \
     {                                                                   \
       err = mem_iconveh (scm_i_string_chars (str), c_strlen,            \
-                         "ISO-8859-1", c_utf_name,                      \
+                         "UTF-8", c_utf_name,                      \
                          iconveh_question_mark, NULL,                   \
                          &c_utf, &c_utf_len);                           \
       if (SCM_UNLIKELY (err))                                           \
diff --git a/libguile/ports.c b/libguile/ports.c
index 2a25cd58e..bdaf921ca 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -959,7 +959,9 @@ canonicalize_encoding (const char *enc)
   char *ret;
   int i;

-  if (!enc || encoding_matches (enc, sym_ISO_8859_1))
+  if (enc == NULL)
+    return sym_UTF_8;
+  if (encoding_matches (enc, sym_ISO_8859_1))
     return sym_ISO_8859_1;
   if (encoding_matches (enc, sym_UTF_8))
     return sym_UTF_8;
@@ -4182,7 +4184,7 @@ scm_init_ports (void)
     scm_c_define ("%default-port-conversion-strategy",
                   scm_make_fluid_with_default (sym_substitute));
   /* Use the locale as the default port encoding.  */
-  scm_i_set_default_port_encoding (locale_charset ());
+  scm_i_set_default_port_encoding ("UTF-8");

   scm_c_register_extension ("libguile-" SCM_EFFECTIVE_VERSION,
                             "scm_init_ice_9_ports",
diff --git a/libguile/strings.c b/libguile/strings.c
index 5c49e33d8..0131e6dc8 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1561,7 +1561,7 @@ scm_i_default_string_failed_conversion_handler (void)
 SCM
 scm_from_locale_stringn (const char *str, size_t len)
 {
-  return scm_from_stringn (str, len, locale_charset (),
+  return scm_from_stringn (str, len, "UTF-8",
                            scm_i_default_string_failed_conversion_handler ());
 }

@@ -1885,7 +1885,7 @@ char *
 scm_to_locale_stringn (SCM str, size_t *lenp)
 {
   return scm_to_stringn (str, lenp,
-                         locale_charset (),
+                         "UTF-8",
                          scm_i_default_string_failed_conversion_handler ());
 }

@@ -2216,11 +2216,11 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
   len = 0;
   enc = encoding;
   if (enc == NULL)
-    enc = "ISO-8859-1";
+    enc = "UTF-8";
   if (scm_i_is_narrow_string (str))
     {
       ret = mem_iconveh (scm_i_string_chars (str), ilen,
-                         "ISO-8859-1", enc,
+                         "UTF-8", enc,
                          (enum iconv_ilseq_handler) handler, NULL,
                          &buf, &len);


code:
This hack makes Guile default to UTF-8.  This avoids calls to
`iconv_open'; `iconv_open' tries to open shared objects that aren't
available during bootstrap, so using UTF-8 avoids that (and UTF-8 has
built-in conversions in glibc, too.)

diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index cf41f2f..facfb91 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -1887,7 +1887,7 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness)
   if (scm_i_is_narrow_string (str))                                     \
     {                                                                   \
       err = mem_iconveh (scm_i_string_chars (str), c_strlen,            \
-                         "ISO-8859-1", c_utf_name,                      \
+                         "UTF-8", c_utf_name,                      \
                          iconveh_question_mark, NULL,                   \
                          &c_utf, &c_utf_len);                           \
       if (SCM_UNLIKELY (err))                                           \
diff --git a/libguile/ports.c b/libguile/ports.c
index 301bc44..b0ea2e6 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -1750,7 +1750,7 @@ scm_ungetc (scm_t_wchar c, SCM port)
   if (pt->encoding != NULL)
     encoding = pt->encoding;
   else
-    encoding = "ISO-8859-1";
+    encoding = "UTF-8";

   len = sizeof (result_buf);
   result = u32_conv_to_encoding (encoding,
@@ -2212,7 +2212,7 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding)
   pt = SCM_PTAB_ENTRY (port);

   if (encoding == NULL)
-    encoding = "ISO-8859-1";
+    encoding = "UTF-8";

   if (pt->encoding != encoding)
     pt->encoding = scm_gc_strdup (encoding, "port");
diff --git a/libguile/posix.c b/libguile/posix.c
index 4f8b8ac..fea7f74 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1740,7 +1740,7 @@ SCM_DEFINE (scm_setlocale, "setlocale", 1, 1, 0,
       SCM_SYSERROR;
     }

-  enc = locale_charset ();
+  enc = "UTF-8";

   /* Set the default encoding for new ports.  */
   scm_i_set_default_port_encoding (enc);
diff --git a/libguile/script.c b/libguile/script.c
index 83daf8a..083891e 100644
--- a/libguile/script.c
+++ b/libguile/script.c
@@ -387,7 +387,7 @@ locale_arguments_to_string_list (int argc, char **const argv)
   SCM lst;
   const char *encoding;

-  encoding = environ_locale_charset ();
+  encoding = "UTF-8";
   for (i = argc - 1, lst = SCM_EOL;
        i >= 0;
        i--)
diff --git a/libguile/strings.c b/libguile/strings.c
index 5d0db23..8266247 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1576,7 +1576,7 @@ scm_from_locale_string (const char *str)
 SCM
 scm_from_locale_stringn (const char *str, size_t len)
 {
-  return scm_from_stringn (str, len, locale_charset (),
+  return scm_from_stringn (str, len, "UTF-8",
                            scm_i_default_port_conversion_handler ());
 }

@@ -1803,7 +1803,7 @@ char *
 scm_to_locale_stringn (SCM str, size_t *lenp)
 {
   return scm_to_stringn (str, lenp,
-                         locale_charset (),
+                         "UTF-8",
                          scm_i_default_port_conversion_handler ());
 }

@@ -2054,7 +2054,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
                         "string contains #\\nul character: ~S",
                         scm_list_1 (str));

-  if (scm_i_is_narrow_string (str) && (encoding == NULL))
+  if (scm_i_is_narrow_string (str))
     {
       /* If using native Latin-1 encoding, just copy the string
          contents.  */
@@ -2079,11 +2079,11 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
   len = 0;
   enc = encoding;
   if (enc == NULL)
-    enc = "ISO-8859-1";
+    enc = "UTF-8";
   if (scm_i_is_narrow_string (str))
     {
       ret = mem_iconveh (scm_i_string_chars (str), ilen,
-                         "ISO-8859-1", enc,
+                         "UTF-8", enc,
                          (enum iconv_ilseq_handler) handler, NULL,
                          &buf, &len);

--- guile-2.0.9/libguile/ports.c	2013-08-21 11:08:50.000000000 +0200
+++ guile-2.0.9/libguile/ports.c	2013-08-21 11:09:47.000000000 +0200
@@ -2512,7 +2512,7 @@ scm_i_port_iconv_descriptors (SCM port,
       const char *precise_encoding;

       if (!pt->encoding)
-        pt->encoding = "ISO-8859-1";
+        pt->encoding = "UTF-8";

       /* If the specified encoding is UTF-16 or UTF-32, then make
          that more precise by deciding what byte order to use. */


code:
Two patches here backporting fixes from Emacs master.

Upstream status: emailed first patch to latest committer, Robin Templeton
<robin@igalia.com>, no response.

From dfcb3b6ff318e47b84a28cfc43f50bec42fa3570 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Tue, 7 Nov 2017 18:48:03 +0100
Subject: [PATCH 1/2] backport: Port jpeg configuration to Solaris 10 with Sun
 C.

* configure.ac: Check for jpeglib 6b by trying to link it, instead
of relying on cpp magic that has problems in practice.  Check for
both jpeglib.h and jerror.h features.  Remove special case for
mingw32, which should no longer be needed (and if it were needed,
should now be addressable by hotwiring emacs_cv_jpeglib).
Fixes: bug#20332

    From fdf532b9c915ad9ba72155646d29d0f530fd72ec Mon Sep 17 00:00:00 2001
    From: Paul Eggert <address@hidden>
    Date: Wed, 15 Apr 2015 18:30:01 -0700
    Subject: [PATCH] Port jpeg configuration to Solaris 10 with Sun C.

    * configure.ac: Check for jpeglib 6b by trying to link it, instead
    of relying on cpp magic that has problems in practice.  Check for
    both jpeglib.h and jerror.h features.  Remove special case for
    mingw32, which should no longer be needed (and if it were needed,
    should now be addressable by hotwiring emacs_cv_jpeglib).
    Fixes: bug#20332
---
 configure.ac | 72 ++++++++++++++++++++++++++++--------------------------------
 1 file changed, 34 insertions(+), 38 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2445db4886..36fa8eb390 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3014,44 +3014,40 @@ AC_SUBST(LIBXPM)
 ### mingw32 doesn't use -ljpeg, since it loads the library dynamically.
 HAVE_JPEG=no
 LIBJPEG=
-if test "${opsys}" = "mingw32"; then
-  if test "${with_jpeg}" != "no"; then
-    dnl Checking for jpeglib.h can lose because of a redefinition of
-    dnl HAVE_STDLIB_H.
-    AC_CHECK_HEADER(jerror.h, HAVE_JPEG=yes, HAVE_JPEG=no)
-  fi
-  AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
-  if test "${HAVE_JPEG}" = "yes"; then
-    AC_DEFINE(HAVE_JPEG)
-    AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
-        [#include <jpeglib.h>
-	 version=JPEG_LIB_VERSION
-],
-        [AC_DEFINE(HAVE_JPEG)],
-        [AC_MSG_WARN([libjpeg found, but not version 6b or later])
-        HAVE_JPEG=no])
-  fi
-elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
-  if test "${with_jpeg}" != "no"; then
-    dnl Checking for jpeglib.h can lose because of a redefinition of
-    dnl  HAVE_STDLIB_H.
-    AC_CHECK_HEADER(jerror.h,
-      [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
-  fi
-
-  AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
-  if test "${HAVE_JPEG}" = "yes"; then
-    AC_DEFINE(HAVE_JPEG)
-    AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
-	[#include <jpeglib.h>
-	 version=JPEG_LIB_VERSION
-],
-	[AC_DEFINE(HAVE_JPEG)],
-	[AC_MSG_WARN([libjpeg found, but not version 6b or later])
-	HAVE_JPEG=no])
-  fi
-  if test "${HAVE_JPEG}" = "yes"; then
-    LIBJPEG=-ljpeg
+if test "${with_jpeg}" != "no"; then
+  AC_CACHE_CHECK([for jpeglib 6b or later],
+    [emacs_cv_jpeglib],
+    [OLD_LIBS=$LIBS
+     for emacs_cv_jpeglib in yes -ljpeg no; do
+       case $emacs_cv_jpeglib in
+	 yes) ;;
+         no) break;;
+	 *) LIBS="$LIBS $emacs_cv_jpeglib";;
+       esac
+       AC_LINK_IFELSE(
+	 [AC_LANG_PROGRAM(
+	    [[#undef HAVE_STDLIB_H /* Avoid config.h/jpeglib.h collision.  */
+	      #include <stdio.h> /* jpeglib.h needs FILE and size_t.  */
+	      #include <jpeglib.h>
+	      #include <jerror.h>
+	      char verify[JPEG_LIB_VERSION < 62 ? -1 : 1];
+	      struct jpeg_decompress_struct cinfo;
+	    ]],
+	    [[
+	      jpeg_create_decompress (&cinfo);
+	      WARNMS (&cinfo, JWRN_JPEG_EOF);
+	      jpeg_destroy_decompress (&cinfo);
+	    ]])],
+	 [emacs_link_ok=yes],
+	 [emacs_link_ok=no])
+       LIBS=$OLD_LIBS
+       test $emacs_link_ok = yes && break
+     done])
+  if test "$emacs_cv_jpeglib" != no; then
+    HAVE_JPEG=yes
+    AC_DEFINE([HAVE_JPEG], 1,
+      [Define to 1 if you have the jpeg library (typically -ljpeg).])
+    test "$emacs_cv_jpeglib" != yes && LIBJPEG=$emacs_cv_jpeglib
   fi
 fi
 AC_SUBST(LIBJPEG)
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com

From f761b92d520b72954be28ad66eb82d1a96c785fb Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Wed, 8 Nov 2017 14:05:43 +0100
Subject: [PATCH 2/2] backport fix for #24065: calloc loop when compiling with
 -O2.

This patch fixes

    EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp -l autoload \
       --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
       --eval "(setq generated-autoload-file (expand-file-name
    (unmsys--file-name
    \"../../git-checkout/lisp/calendar/cal-loaddefs.el\")))" \
       -f batch-update-autoloads ../../git-checkout/lisp/calendar
    make[2]: *** [Makefile:466: ../../git-checkout/lisp/calendar/cal-loaddefs.el] Segmentation fault

in gdb seen as

    in calloc (nmemb=<error reading variable: DWARF-2 expression error:Loop detected (257).>, size=size@entry=1) at gmalloc.c:1510

I did not find malloc-fixing commits from emacs master to cleanly
cherry-pick, so this patch replaces the relevant part in configure
(emacs 53da55b8cc45e76b836ebaadd23f46e92d25abce).

* configure.ac: backport system_malloc/hybrid_malloc detection.
---
 configure.ac | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 36fa8eb390..3cc1794f37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1966,7 +1966,25 @@ case "$opsys" in
   darwin|mingw32|sol2-10) system_malloc=yes ;;
 esac

+hybrid_malloc=
+system_malloc=yes
+
+test "$CANNOT_DUMP" = yes ||
+case "$opsys" in
+  ## darwin ld insists on the use of malloc routines in the System framework.
+  darwin | mingw32 | nacl | sol2-10) ;;
+  cygwin) hybrid_malloc=yes
+          system_malloc= ;;
+  *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
+esac
+
+if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \
+   && test "${UNEXEC_OBJ}" = unexelf.o; then
+  hybrid_malloc=yes
+fi
+
 GMALLOC_OBJ=
+HYBRID_MALLOC=
 if test "${system_malloc}" = "yes"; then
   AC_DEFINE([SYSTEM_MALLOC], 1,
     [Define to 1 to use the system memory allocator, even if it is not
@@ -1975,6 +1993,14 @@ if test "${system_malloc}" = "yes"; then
   GNU_MALLOC_reason="
     (The GNU allocators don't work with this system configuration.)"
   VMLIMIT_OBJ=
+elif test "$hybrid_malloc" = yes; then
+  AC_DEFINE(HYBRID_MALLOC, 1,
+    [Define to use gmalloc before dumping and the system malloc after.])
+  HYBRID_MALLOC=1
+  GNU_MALLOC=no
+  GNU_MALLOC_reason=" (only before dumping)"
+  GMALLOC_OBJ=gmalloc.o
+  VMLIMIT_OBJ=
 else
   test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
   VMLIMIT_OBJ=vm-limit.o
@@ -1993,10 +2019,11 @@ else
        of the main data segment.])
   fi
 fi
+AC_SUBST([HYBRID_MALLOC])
 AC_SUBST(GMALLOC_OBJ)
 AC_SUBST(VMLIMIT_OBJ)

-if test "$doug_lea_malloc" = "yes" ; then
+if test "$doug_lea_malloc" = "yes" && test "$hybrid_malloc" != yes; then
   if test "$GNU_MALLOC" = yes ; then
     GNU_MALLOC_reason="
       (Using Doug Lea's new malloc from the GNU C Library.)"
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com


code:
From 1da99396dc65993ba34ac0370ca5d6acda6a3322 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Sun, 18 Mar 2018 07:02:37 -0400
Subject: [PATCH] Add support for gdbm-1.14.

As of gdbm-1.14, 'gdbm_errno' no longer exists as a binary interface.
It has been replaced by 'gdbm_errno_location', a function that returns
int*.  We now use this new interface if it's available.
---
 gdbm.scm | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/gdbm.scm b/gdbm.scm
index b92992f..4d38cc3 100644
--- a/gdbm.scm
+++ b/gdbm.scm
@@ -17,6 +17,9 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.

+;; Modified by Mark H Weaver <mhw@netris.org> in March 2018 to support
+;; gdbm-1.14 with its new 'gdbm_errno_location' interface.
+
 (define-module (gdbm)
   #:use-module (system foreign)
   #:use-module (rnrs bytevectors)
@@ -151,10 +154,21 @@

 ;;; errors

-(define %errno (dynamic-pointer "gdbm_errno" libgdbm))
+(define %list-int
+  (list int))
+
+(define (dereference-int ptr)
+  (apply (lambda (errno) errno)
+         (parse-c-struct ptr %list-int)))
+
+(define %errno-location
+  (or (false-if-exception
+       (let ((func (dynamic-func "gdbm_errno_location" libgdbm)))
+         (pointer->procedure '* func '())))
+      (const (dynamic-pointer "gdbm_errno" libgdbm))))

 (define (gdbm-errno)
-  (pointer-address (dereference-pointer %errno)))
+  (dereference-int (%errno-location)))

 (define (gdbm-error)
   (error (pointer->string (%gdbm-strerror (gdbm-errno)))))
--
2.16.2


code:
This patch adds bindings to Linux syscalls for which glibc has symbols.

Using the FFI would have been nice, but that's not an option when using
a statically-linked Guile in an initrd that doesn't have libc.so around.

diff --git a/libguile/posix.c b/libguile/posix.c
index b0fcad5fd..1343186e3 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -2341,6 +2341,335 @@ scm_init_popen (void)
 }
 #endif /* HAVE_START_CHILD */

+
+/* Linux! */
+#ifdef __linux__
+
+#include <sys/mount.h>
+#include <sys/syscall.h>
+
+#include "libguile/foreign.h"
+#include "libguile/bytevectors.h"
+
+SCM_DEFINE (scm_mount, "mount", 3, 2, 0,
+	    (SCM source, SCM target, SCM type, SCM flags, SCM data),
+	    "Mount file system of @var{type} specified by @var{source} "
+	    "on @var{target}.")
+#define FUNC_NAME s_scm_mount
+{
+  int err;
+  char *c_source, *c_target, *c_type, *c_data;
+  unsigned long c_flags;
+
+  c_source = scm_to_locale_string (source);
+  c_target = scm_to_locale_string (target);
+  c_type = scm_to_locale_string (type);
+  c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_ulong (flags);
+
+  if (SCM_UNBNDP (data) || scm_is_false (data))
+    c_data = NULL;
+  else
+    c_data = scm_to_locale_string (data);
+
+  err = mount (c_source, c_target, c_type, c_flags, c_data);
+  if (err != 0)
+    err = errno;
+
+  free (c_source);
+  free (c_target);
+  free (c_type);
+
+  if (c_data != NULL)
+    free (c_data);
+
+  if (err != 0)
+    {
+      errno = err;
+      SCM_SYSERROR;
+    }
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_umount, "umount", 1, 0, 0,
+	    (SCM target),
+	    "Unmount the file system on @var{target}.")
+#define FUNC_NAME s_scm_umount
+{
+  int err;
+  char *c_target;
+
+  c_target = scm_to_locale_string (target);
+
+  err = umount (c_target);
+  if (err != 0)
+    err = errno;
+
+  free (c_target);
+
+  if (err != 0)
+    {
+      errno = err;
+      SCM_SYSERROR;
+    }
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+/* Linux's module installation syscall.  See `kernel/module.c' in Linux;
+   the function itself is part of the GNU libc.
+
+   Load the LEN bytes at MODULE as a kernel module, with arguments from
+   ARGS, a space-separated list of options.  */
+extern long init_module (void *module, unsigned long len, const char *args);
+
+/* Load a kernel module from FD.  FLAGS must be a bitwise or of
+   MODULE_INIT_* constants.  The GNU libc doesn't provide a wrapper for
+   this one so we use 'syscall'.  */
+static int
+finit_module (int fd, const char *args, int flags)
+{
+  return syscall (SYS_finit_module, fd, args, flags);
+}
+
+
+SCM_DEFINE (scm_load_linux_module, "load-linux-module", 1, 1, 0,
+	    (SCM data, SCM options),
+	    "Load the Linux kernel module whose contents are in bytevector "
+	    "DATA (the contents of a @code{.ko} file), with the arguments "
+	    "from the OPTIONS string.")
+#define FUNC_NAME s_scm_load_linux_module
+{
+  long err;
+  void *c_data;
+  unsigned long c_len;
+  char *c_options;
+
+  SCM_VALIDATE_BYTEVECTOR (SCM_ARG1, data);
+
+  c_data = SCM_BYTEVECTOR_CONTENTS (data);
+  c_len = SCM_BYTEVECTOR_LENGTH (data);
+  c_options =
+    scm_to_locale_string (SCM_UNBNDP (options) ? scm_nullstr : options);
+
+  err = init_module (c_data, c_len, c_options);
+
+  free (c_options);
+
+  if (err != 0)
+    SCM_SYSERROR;
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_load_linux_module_fd, "load-linux-module/fd", 1, 2, 0,
+	    (SCM fd, SCM options, SCM flags),
+	    "Load the Linux kernel module from the file at FD, "
+	    "with the arguments from the OPTIONS string, and "
+            "optionally the given FLAGS.")
+#define FUNC_NAME s_scm_load_linux_module_fd
+{
+  long err;
+  int c_fd, c_flags;
+  char *c_options;
+
+  c_fd = scm_to_int (fd);
+  c_options =
+    scm_to_locale_string (SCM_UNBNDP (options) ? scm_nullstr : options);
+  c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_int (flags);
+
+  err = finit_module (c_fd, c_options, c_flags);
+
+  free (c_options);
+
+  if (err != 0)
+    SCM_SYSERROR;
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+
+/* Rebooting, halting, and all that.  */
+
+#include <sys/reboot.h>
+
+SCM_VARIABLE_INIT (flag_RB_AUTOBOOT, "RB_AUTOBOOT",
+		   scm_from_int (RB_AUTOBOOT));
+SCM_VARIABLE_INIT (flag_RB_HALT_SYSTEM, "RB_HALT_SYSTEM",
+		   scm_from_int (RB_HALT_SYSTEM));
+SCM_VARIABLE_INIT (flag_RB_ENABLE_CAD, "RB_ENABLE_CAD",
+		   scm_from_int (RB_ENABLE_CAD));
+SCM_VARIABLE_INIT (flag_RB_DISABLE_CAD, "RB_DISABLE_CAD",
+		   scm_from_int (RB_DISABLE_CAD));
+SCM_VARIABLE_INIT (flag_RB_POWER_OFF, "RB_POWER_OFF",
+		   scm_from_int (RB_POWER_OFF));
+SCM_VARIABLE_INIT (flag_RB_SW_SUSPEND, "RB_SW_SUSPEND",
+		   scm_from_int (RB_SW_SUSPEND));
+SCM_VARIABLE_INIT (flag_RB_KEXEC, "RB_KEXEC",
+		   scm_from_int (RB_KEXEC));
+
+SCM_DEFINE (scm_reboot, "reboot", 0, 1, 0,
+	    (SCM command),
+	    "Reboot the system.  @var{command} must be one of the @code{RB_} "
+	    "constants; if omitted, @var{RB_AUTOBOOT} is used, thus "
+	    "performing a hard reset.")
+#define FUNC_NAME s_scm_reboot
+{
+  int c_command;
+
+  if (SCM_UNBNDP (command))
+    c_command = RB_AUTOBOOT;
+  else
+    c_command = scm_to_int (command);
+
+  reboot (c_command);
+
+  return SCM_UNSPECIFIED;			  /* likely unreached */
+}
+#undef FUNC_NAME
+
+/* Linux network interfaces.  See <linux/if.h>.  */
+
+#include <linux/if.h>
+#include <linux/sockios.h>
+#include "libguile/socket.h"
+
+SCM_VARIABLE_INIT (flag_IFF_UP, "IFF_UP",
+		   scm_from_int (IFF_UP));
+SCM_VARIABLE_INIT (flag_IFF_BROADCAST, "IFF_BROADCAST",
+		   scm_from_int (IFF_BROADCAST));
+SCM_VARIABLE_INIT (flag_IFF_DEBUG, "IFF_DEBUG",
+		   scm_from_int (IFF_DEBUG));
+SCM_VARIABLE_INIT (flag_IFF_LOOPBACK, "IFF_LOOPBACK",
+		   scm_from_int (IFF_LOOPBACK));
+SCM_VARIABLE_INIT (flag_IFF_POINTOPOINT, "IFF_POINTOPOINT",
+		   scm_from_int (IFF_POINTOPOINT));
+SCM_VARIABLE_INIT (flag_IFF_NOTRAILERS, "IFF_NOTRAILERS",
+		   scm_from_int (IFF_NOTRAILERS));
+SCM_VARIABLE_INIT (flag_IFF_RUNNING, "IFF_RUNNING",
+		   scm_from_int (IFF_RUNNING));
+SCM_VARIABLE_INIT (flag_IFF_NOARP, "IFF_NOARP",
+		   scm_from_int (IFF_NOARP));
+SCM_VARIABLE_INIT (flag_IFF_PROMISC, "IFF_PROMISC",
+		   scm_from_int (IFF_PROMISC));
+SCM_VARIABLE_INIT (flag_IFF_ALLMULTI, "IFF_ALLMULTI",
+		   scm_from_int (IFF_ALLMULTI));
+
+SCM_DEFINE (scm_set_network_interface_address, "set-network-interface-address",
+	    3, 0, 0,
+	    (SCM socket, SCM name, SCM address),
+	    "Configure network interface @var{name}.")
+#define FUNC_NAME s_scm_set_network_interface_address
+{
+  char *c_name;
+  struct ifreq ifr;
+  struct sockaddr *c_address;
+  size_t sa_len;
+  int fd, err;
+
+  socket = SCM_COERCE_OUTPORT (socket);
+  SCM_VALIDATE_OPFPORT (1, socket);
+  fd = SCM_FPORT_FDES (socket);
+
+  memset (&ifr, 0, sizeof ifr);
+  c_name = scm_to_locale_string (name);
+  c_address = scm_to_sockaddr (address, &sa_len);
+
+  strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1);
+  memcpy (&ifr.ifr_addr, c_address, sa_len);
+
+  err = ioctl (fd, SIOCSIFADDR, &ifr);
+  if (err != 0)
+    err = errno;
+
+  free (c_name);
+  free (c_address);
+
+  if (err != 0)
+    {
+      errno = err;
+      SCM_SYSERROR;
+    }
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_set_network_interface_flags, "set-network-interface-flags",
+	    3, 0, 0,
+	    (SCM socket, SCM name, SCM flags),
+	    "Change the flags of network interface @var{name} to "
+	    "@var{flags}.")
+#define FUNC_NAME s_scm_set_network_interface_flags
+{
+  struct ifreq ifr;
+  char *c_name;
+  int fd, err;
+
+  socket = SCM_COERCE_OUTPORT (socket);
+  SCM_VALIDATE_OPFPORT (1, socket);
+  fd = SCM_FPORT_FDES (socket);
+
+  memset (&ifr, 0, sizeof ifr);
+  c_name = scm_to_locale_string (name);
+  strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1);
+  ifr.ifr_flags = scm_to_short (flags);
+
+  err = ioctl (fd, SIOCSIFFLAGS, &ifr);
+  if (err != 0)
+    err = errno;
+
+  free (c_name);
+
+  if (err != 0)
+    {
+      errno = err;
+      SCM_SYSERROR;
+    }
+
+  return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_network_interface_flags, "network-interface-flags",
+	    2, 0, 0,
+	    (SCM socket, SCM name),
+	    "Return the flags of network interface @var{name}.")
+#define FUNC_NAME s_scm_network_interface_flags
+{
+  struct ifreq ifr;
+  char *c_name;
+  int fd, err;
+
+  socket = SCM_COERCE_OUTPORT (socket);
+  SCM_VALIDATE_OPFPORT (1, socket);
+  fd = SCM_FPORT_FDES (socket);
+
+  memset (&ifr, 0, sizeof ifr);
+  c_name = scm_to_locale_string (name);
+  strncpy (ifr.ifr_name, c_name, sizeof ifr.ifr_name - 1);
+
+  err = ioctl (fd, SIOCGIFFLAGS, &ifr);
+  if (err != 0)
+    err = errno;
+
+  free (c_name);
+
+  if (err != 0)
+    {
+      errno = err;
+      SCM_SYSERROR;
+    }
+
+  return scm_from_short (ifr.ifr_flags);
+}
+#undef FUNC_NAME
+#endif
+
 void
 scm_init_posix ()
 {


code:
The tests/org-mode.scm tests expects 'jpl-outline-es' to be read as UTF-8.

--- guile-present-0.3.0/tests/org-mode.scm	2014-09-23 22:29:51.426705753 +0200
+++ guile-present-0.3.0/tests/org-mode.scm	2014-09-23 22:30:09.634705548 +0200
@@ -194,9 +194,10 @@
                "(Just another hacker)"
                "wingo@fluendo.com")
             (p "Julien Moutte, CEO" "julien@fluendo.com")))
+   (with-fluids ((%default-port-encoding "UTF-8"))
    (call-with-input-file
        (in-vicinity *top-srcdir* "tests/jpl-outline-es")
-     org->presentation)))
+       org->presentation))))

 (setlocale LC_ALL "")
 (exit-with-summary (run-all-defined-test-cases))


code:
This patch changes Guile to use a default search path relative to the
location of the `guile' binary, allowing it to be relocated.

--- a/libguile/load.c
+++ b/libguile/load.c
@@ -26,6 +26,7 @@

 #include <string.h>
 #include <stdio.h>
+#include <libgen.h>

 #include "libguile/_scm.h"
 #include "libguile/alist.h"
@@ -325,6 +326,32 @@
   SCM cpath = SCM_EOL;

 #ifdef SCM_LIBRARY_DIR
+  char *program, *bin_dir, *prefix, *module_dir, *ccache_dir;
+
+  /* Determine the source and compiled module directories at run-time,
+     relative to the executable's location.
+
+     Note: Use /proc/self/exe instead of argv[0] because the latter is
+     not necessarily an absolute, nor a valid file name.  */
+
+  program = scm_gc_malloc_pointerless (256, "string");
+  readlink ("/proc/self/exe", program, 256);
+
+  bin_dir = dirname (strdupa (program));
+
+  prefix = scm_gc_malloc_pointerless (strlen (bin_dir) + 4, "string");
+  strcpy (prefix, bin_dir);
+  strcat (prefix, "/..");
+  prefix = canonicalize_file_name (prefix);
+
+  module_dir = scm_gc_malloc_pointerless (strlen (prefix) + 50, "string");
+  strcpy (module_dir, prefix);
+  strcat (module_dir, "/share/guile/" SCM_EFFECTIVE_VERSION);
+
+  ccache_dir = scm_gc_malloc_pointerless (strlen (prefix) + 50, "string");
+  strcpy (ccache_dir, prefix);
+  strcat (ccache_dir, "/lib/guile/" SCM_EFFECTIVE_VERSION "/ccache");
+
   env = scm_i_mirror_backslashes (getenv ("GUILE_SYSTEM_PATH"));
   if (env && strcmp (env, "") == 0)
     /* special-case interpret system-path=="" as meaning no system path instead
@@ -333,10 +360,7 @@
   else if (env)
     path = scm_parse_path (scm_from_locale_string (env), path);
   else
-    path = scm_list_4 (scm_from_locale_string (SCM_LIBRARY_DIR),
-                       scm_from_locale_string (SCM_SITE_DIR),
-                       scm_from_locale_string (SCM_GLOBAL_SITE_DIR),
-                       scm_from_locale_string (SCM_PKGDATA_DIR));
+    path = scm_list_1 (scm_from_locale_string (module_dir));

   env = scm_i_mirror_backslashes (getenv ("GUILE_SYSTEM_COMPILED_PATH"));
   if (env && strcmp (env, "") == 0)
@@ -346,8 +370,7 @@
     cpath = scm_parse_path (scm_from_locale_string (env), cpath);
   else
     {
-      cpath = scm_list_2 (scm_from_locale_string (SCM_CCACHE_DIR),
-                          scm_from_locale_string (SCM_SITE_CCACHE_DIR));
+      cpath = scm_list_1 (scm_from_locale_string (ccache_dir));
     }

 #endif /* SCM_LIBRARY_DIR */


code:
This patch fixes a bug in guile-rsvg's build system, whereby the CFLAGS
and LDFLAGS for Guile would not be captured.

--- guile-rsvg-2.18.1/configure.ac	2015-08-31 22:30:30.578909480 +0200
+++ guile-rsvg-2.18.1/configure.ac	2015-08-31 22:32:15.071516084 +0200
@@ -39,6 +39,10 @@ AC_SUBST(WARN_CFLAGS)

 GUILE_PKG([2.2 2.0 1.8])

+dnl The above macro fails to set the 'GUILE_CFLAGS' and 'GUILE_LIBS'
+dnl substitution variables, hence this line.
+PKG_CHECK_MODULES(GUILE, guile-$GUILE_EFFECTIVE_VERSION)
+
 PKG_CHECK_MODULES(GUILE_CAIRO, guile-cairo >= 1.4.0)
 AC_SUBST(GUILE_CAIRO_LIBS)
 AC_SUBST(GUILE_CAIRO_CFLAGS)


code:
Lookup gzdoom pk3 files in the installed directory in
addition to the path that is stored in ~/.config/gzdoom/.

Simply replacing the hardcoded /usr/share would leave the
configfile pointing to outdated guix builds, which could get
garbage collected and break the gzdoom installation.
This ensures that the files installed with the corresponding
build will be used.

--- /src/d_main.cpp	2018-01-16 22:13:09.700602781 +0200
+++ /src/d_main.cpp	2018-01-16 22:22:36.560617961 +0200
@@ -1716,6 +1716,11 @@
 		return wad;
 	}

+    mysnprintf (wad, countof(wad), "%s/%s", GUIX_OUT_PK3, file);
+    if (DirEntryExists (wad)) {
+        return wad;
+    }
+
 	if (GameConfig != NULL && GameConfig->SetSection ("FileSearch.Directories"))
 	{
 		const char *key;


code:
Do not clobber PKG_CONFIG_PATH during configure.

--- HandBrake-0.10.5/gtk/module.rules.orig	2016-02-11 14:14:05.000000000 -0600
+++ HandBrake-0.10.5/gtk/module.rules	2016-10-29 22:27:50.550960848 -0500
@@ -15,7 +15,7 @@
 	set -e; cd $(GTK.src/); NOCONFIGURE=1 ./autogen.sh
 	set -e; cd $(GTK.build/); $(call fn.ABSOLUTE,$(GTK.src/))configure \
 		$(GTK.CONFIGURE.extra) \
-		PKG_CONFIG_PATH=$(BUILD/)contrib/lib/pkgconfig \
+		PKG_CONFIG_PATH=$(BUILD/)contrib/lib/pkgconfig$(if $(PKG_CONFIG_PATH),:)$(PKG_CONFIG_PATH) \
 	    CFLAGS="$(call fn.ARGS,GTK.GCC,.g .O *D ?extra)" \
 	    LDFLAGS="$(call fn.ARGS,GTK.GCC,?strip .g .O ?extra.exe)" \
 	    --prefix=$(PREFIX) \
--- Handbrake-0.10.5-0.77d09e9-checkout/make/include/contrib.defs	1969-12-31 18:00:00.000000000 -0600
+++ Handbrake-0.10.5-0.77d09e9-checkout/make/include/contrib.defs	2016-11-01 13:11:43.826144311 -0500
@@ -119,7 +119,7 @@
     endif
     $(1).CONFIGURE.env.CPPFLAGS = CPPFLAGS="-I$$(call fn.ABSOLUTE,$(CONTRIB.build/))include $$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra *D)"
     $(1).CONFIGURE.env.LDFLAGS  = LDFLAGS="-L$$(call fn.ABSOLUTE,$(CONTRIB.build/))lib $$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra.exe *D)"
-    $(1).CONFIGURE.env.PKG_CONFIG_PATH  = PKG_CONFIG_PATH="$$(call fn.ABSOLUTE,$$(CONTRIB.build/))lib/pkgconfig"
+    $(1).CONFIGURE.env.PKG_CONFIG_PATH  = PKG_CONFIG_PATH="$$(call fn.ABSOLUTE,$$(CONTRIB.build/))lib/pkgconfig$(if $(PKG_CONFIG_PATH),:)$(PKG_CONFIG_PATH)"

     $(1).CONFIGURE.env.args = !CC !CFLAGS !CXX !CXXFLAGS !CPPFLAGS !LD !LDFLAGS !PKG_CONFIG_PATH !LOCAL_PATH !CROSS
     $(1).CONFIGURE.env = $$(call fn.ARGS,$(1).CONFIGURE.env,$$($(1).CONFIGURE.env.args))


code:
Copied from upstream repository.
Hunk #2 is removed since it cannot be applied and it is not needed.

From 7cead7137bf54851c1b7df5a3854351296d21276 Mon Sep 17 00:00:00 2001
From: Vasantha Ganesh K <vasanthaganesh.k@tuta.io>
Date: Thu, 22 Jun 2017 23:38:40 +0530
Subject: [PATCH] removed `check-conventions' from make

---
 Makefile                          |   7 +-
 tests/haskell-code-conventions.el | 165 ------------------------------
 2 files changed, 1 insertion(+), 171 deletions(-)
 delete mode 100644 tests/haskell-code-conventions.el

diff --git a/Makefile b/Makefile
index b2c89d6..aa907c5 100644
--- a/Makefile
+++ b/Makefile
@@ -79,12 +79,7 @@ build-$(EMACS_VERSION)/build-flag : build-$(EMACS_VERSION) $(patsubst %.el,build
 check-%: tests/%-tests.el
 	$(BATCH) -l "$<" -f ert-run-tests-batch-and-exit;

-check: compile $(AUTOLOADS) check-ert check-conventions
-
-check-conventions :
-	$(BATCH) -l tests/haskell-code-conventions.el                                           \
-                 -f haskell-check-conventions-batch-and-exit
-	@echo "conventions are okay"
+check: compile $(AUTOLOADS) check-ert

 check-ert: $(ELCHECKS)
 	$(BATCH) --eval "(when (= emacs-major-version 24)					\
--
2.18.0


code:
Copied verbatim from upstream repository.

From cee22450ee30e79952f594796721dc6b17798ee6 Mon Sep 17 00:00:00 2001
From: Sascha Wilde <wilde@sha-bang.de>
Date: Fri, 23 Sep 2016 15:35:59 +0200
Subject: [PATCH] Removed unused lexical variables.

---
 haskell-lexeme.el  | 3 +--
 haskell-process.el | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/haskell-lexeme.el b/haskell-lexeme.el
index 4256a79..b832560 100644
--- a/haskell-lexeme.el
+++ b/haskell-lexeme.el
@@ -138,8 +138,7 @@ When match is successful, match-data will contain:
   (match-text 2) - whole qualified identifier
   (match-text 3) - unqualified part of identifier
   (match-text 4) - closing backtick"
-  (let ((begin (point))
-        (match-data-old (match-data))
+  (let ((match-data-old (match-data))
         first-backtick-start
         last-backtick-start
         qid-start
diff --git a/haskell-process.el b/haskell-process.el
index b4efba2..4f3f859 100644
--- a/haskell-process.el
+++ b/haskell-process.el
@@ -160,9 +160,7 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
 (defun haskell-process-log (msg)
   "Effective append MSG to the process log (if enabled)."
   (when haskell-process-log
-    (let* ((append-to (get-buffer-create "*haskell-process-log*"))
-           (windows (get-buffer-window-list append-to t t))
-           move-point-in-windows)
+    (let* ((append-to (get-buffer-create "*haskell-process-log*")))
       (with-current-buffer append-to
         ;; point should follow insertion so that it stays at the end
         ;; of the buffer
--
2.18.0


code:
Changes necessary for shared library linking to succeed.

diff --git a/src/Makefile.in b/src/Makefile.in
index 9534473..12411bf 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -73,7 +73,7 @@ LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
 	$(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+LINK = HDF4_USE_SHLIB=yes $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(libhdfeos_la_SOURCES)
 DIST_SOURCES = $(libhdfeos_la_SOURCES)
@@ -125,8 +125,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@

-# Set LDFLAGS to alow the HDF-EOS library to use extern variables from HDF4
-LDFLAGS = -Wl,-single_module
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@


code:
Fix multi-line string formatting in fortran test programs (reported upstream).

diff --git a/samples/appendfield.f b/samples/appendfield.f
index 42c4b6b..58257f7 100644
--- a/samples/appendfield.f
+++ b/samples/appendfield.f
@@ -22,8 +22,8 @@ c
          inarray(i) = i
       enddo

-      swfid = swopen("SwathFile_created_with_hadeos_sample_file_writer_o
-     1f_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+      swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
       swid = swattach(swfid, "Swath1")

diff --git a/samples/definefields.f b/samples/definefields.f
index 89859e4..f3b3497 100644
--- a/samples/definefields.f
+++ b/samples/definefields.f
@@ -24,8 +24,8 @@ c	DFACC_RDWR accesscode in the open statement.  The SWopen
 c	routine returns the swath fileid, swfid, which is used to
 c	identify the file in subsequent routines.

-	swfid = swopen("SwathFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 c
diff --git a/samples/definegdflds.f b/samples/definegdflds.f
index 177422e..1b7fcf6 100644
--- a/samples/definegdflds.f
+++ b/samples/definegdflds.f
@@ -21,8 +21,8 @@
 	fillval1=-7.0
 	fillval2=-9999.0

-	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_writer_
-     1of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 	gdid1 = gdattach(gdfid, "UTMGrid")
diff --git a/samples/definelevels.f b/samples/definelevels.f
index 2496d5f..64b2842 100644
--- a/samples/definelevels.f
+++ b/samples/definelevels.f
@@ -32,8 +32,8 @@ c	DFACC_RDWR access code in the open statement.  The ptopen
 c	routine returns the point fileid, ptfid, which is used to
 c	identify the file in subsequent routines.

-	ptfid = ptopen("PointFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	ptfid = ptopen("PointFile_created_with_hadeos_sample_file_write"//
+     1  "r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 c
diff --git a/samples/inquiregrid.f b/samples/inquiregrid.f
index 8110461..8ce71e4 100644
--- a/samples/inquiregrid.f
+++ b/samples/inquiregrid.f
@@ -18,8 +18,8 @@

-	gdfid = gdopen('GridFile_created_with_hadeos_sample_file_writer_
-     1of_HDFEOS2_version_219_or_higher_release.hdf', DFACC_READ)
+	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)

 	if (gdfid .ne. -1) then
diff --git a/samples/inquireswath.f b/samples/inquireswath.f
index 899ee59..78c292b 100644
--- a/samples/inquireswath.f
+++ b/samples/inquireswath.f
@@ -24,8 +24,8 @@ c
 c	Open the Swath File for read only access
 c

-	swfid = swopen("SwathFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)
+	swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)

 	if (swfid .NE. -1) then
diff --git a/samples/readdimscalegrid.f b/samples/readdimscalegrid.f
index fed5540..a0bb48a 100644
--- a/samples/readdimscalegrid.f
+++ b/samples/readdimscalegrid.f
@@ -34,8 +34,8 @@
 !     * id, gdfid, which is used to identify the file in subsequent routines.
 !     */

-	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_writer_
-     1of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 !    /*
 !     * If the grid file cannot be found, gdopen will return -1 for the file
diff --git a/samples/readdimscaleswath.f b/samples/readdimscaleswath.f
index 97b6264..1b61624 100644
--- a/samples/readdimscaleswath.f
+++ b/samples/readdimscaleswath.f
@@ -33,8 +33,8 @@
 !     * id, swfid, which is used to identify the file in subsequent routines.
 !     */

-	swfid = swopen("SwathFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 !    /*
 !     * If the swath file cannot be found, swopen will return -1 for the file
diff --git a/samples/readfields.f b/samples/readfields.f
index 873b30a..29d42f0 100644
--- a/samples/readfields.f
+++ b/samples/readfields.f
@@ -21,8 +21,8 @@ c
 c     Open the HDF swath file, "SwathFile.hdf"
 c

-	swfid = swopen("SwathFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)
+	swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)

 	if (swfid .NE. -1) then
diff --git a/samples/readgdflds.f b/samples/readgdflds.f
index e5fe85f..ff2bd86 100644
--- a/samples/readgdflds.f
+++ b/samples/readgdflds.f
@@ -9,8 +9,8 @@
 	integer DFNT_FLOAT32
 	parameter (DFNT_FLOAT32=5)

-	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_writer_
-     1of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 	if (gdfid .ne. -1) then

diff --git a/samples/readlevels.f b/samples/readlevels.f
index a7fd033..f349398 100644
--- a/samples/readlevels.f
+++ b/samples/readlevels.f
@@ -36,8 +36,8 @@ c
 c     Open the HDF swath file, "PointFile.hdf".
 c

-	ptfid = ptopen("PointFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)
+	ptfid = ptopen("PointFile_created_with_hadeos_sample_file_write"//
+     +  "r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)

 c
 c    Read Simple Point
@@ -47,6 +47,8 @@ c
 	status = ptlevinfo(ptid, 0, fldlist, fldtype, fldorder)
 	n = ptnrecs(ptid, 0)

+	write(*,*) n
+
 	do 5 i=1,n
 	   recs(i) = i - 1
  5	continue
diff --git a/samples/setupgrid.f b/samples/setupgrid.f
index be5408c..cf4bd04 100644
--- a/samples/setupgrid.f
+++ b/samples/setupgrid.f
@@ -34,8 +34,8 @@ c      code in the open statement.  The GDopen routine returns the grid
 c      file id, gdfid, which is used to identify the file in subsequent
 c      routines in the library.
 c
-      gdfid = gdopen('GridFile_created_with_hadeos_sample_file_writer_of
-     1_HDFEOS2_version_219_or_higher_release.hdf',DFACC_CREATE)
+      gdfid = gdopen('GridFile_created_with_hadeos_sample_file_writer_"//
+     1"of_HDFEOS2_version_219_or_higher_release.hdf',DFACC_CREATE)

 c
 c     Create UTM Grid
diff --git a/samples/setupswath.f b/samples/setupswath.f
index d0289d6..fbaa0bb 100644
--- a/samples/setupswath.f
+++ b/samples/setupswath.f
@@ -22,8 +22,8 @@ c      code in the open statement.  The SWopen routine returns the swath
 c      file id, swfid, which is used to identify the file in subsequent
 c      routines in the library.
 c
-      swfid = swopen('SwathFile_created_with_hadeos_sample_file_writer_o
-     1f_HDFEOS2_version_219_or_higher_release.hdf',DFACC_CREATE)
+      swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf",DFACC_CREATE)

 c
 c     The first of these, SWcreate, creates the swath, "Swath1", within the
diff --git a/samples/subsetgrid.f b/samples/subsetgrid.f
index c57e541..087e5b1 100644
--- a/samples/subsetgrid.f
+++ b/samples/subsetgrid.f
@@ -22,8 +22,8 @@ c
 c     Open the HDF grid file, "GridFile.hdf"
 c

-	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_writer_
-     1of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)
+	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)

 	if (gdfid .NE. -1) then

diff --git a/samples/subsetpoint.f b/samples/subsetpoint.f
index 9e72c5f..2e76d7d 100644
--- a/samples/subsetpoint.f
+++ b/samples/subsetpoint.f
@@ -21,8 +21,8 @@ c
 c     Open the HDF point file, "PointFile.hdf"
 c

-	ptfid = ptopen("PointFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)
+	ptfid = ptopen("PointFile_created_with_hadeos_sample_file_write"//
+     1  "r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)

 	if (ptfid .NE. -1) then

diff --git a/samples/subsetswath.f b/samples/subsetswath.f
index dcee609..9af8a46 100644
--- a/samples/subsetswath.f
+++ b/samples/subsetswath.f
@@ -28,8 +28,8 @@ c
 c     Open the HDF swath file, "SwathFile.hdf"
 c

-	swfid = swopen("SwathFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)
+	swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)

 	if (swfid .NE. -1) then

diff --git a/samples/writedimscalegrid.f b/samples/writedimscalegrid.f
index 09688d8..42013fe 100644
--- a/samples/writedimscalegrid.f
+++ b/samples/writedimscalegrid.f
@@ -29,8 +29,8 @@
 !     * id, gdfid, which is used to identify the file in subsequent routines.
 !     */

-	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_writer_
-     1of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 !    /*
 !     * If the grid file cannot be found, gdopen will return -1 for the file
diff --git a/samples/writedimscaleswath.f b/samples/writedimscaleswath.f
index 1151671..1a911a6 100644
--- a/samples/writedimscaleswath.f
+++ b/samples/writedimscaleswath.f
@@ -31,8 +31,8 @@
 !     * id, swfid, which is used to identify the file in subsequent routines.
 !     */

-	swfid = swopen("SwathFile_created_with_hadeos_sample_file_write
-     1r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 !    /*
 !     * If the swath file cannot be found, swopen will return -1 for the file
diff --git a/samples/writefields.f b/samples/writefields.f
index a743661..862b96c 100644
--- a/samples/writefields.f
+++ b/samples/writefields.f
@@ -31,8 +31,8 @@ c
 c     Open the HDF swath file, "SwathFile.hdf"
 c

-	swfid = swopen("SwathFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 	if (swfid .NE. -1) then
diff --git a/samples/writegdflds.f b/samples/writegdflds.f
index d1540b3..81aef75 100644
--- a/samples/writegdflds.f
+++ b/samples/writegdflds.f
@@ -23,8 +23,8 @@
 	enddo

-	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_writer_
-     1of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	gdfid = gdopen("GridFile_created_with_hadeos_sample_file_write"//
+     1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 	if (gdfid .ne. -1) then

diff --git a/samples/writelevels.f b/samples/writelevels.f
index 88e7780..cb40c9e 100644
--- a/samples/writelevels.f
+++ b/samples/writelevels.f
@@ -32,8 +32,8 @@ c
 c     Open the HDF point file, "PointFile.hdf".
 c

-	ptfid = ptopen("PointFile_created_with_hadeos_sample_file_writer
-     1_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
+	ptfid = ptopen("PointFile_created_with_hadeos_sample_file_write"//
+     +  "r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)

 c
--
2.10.0


code:
Don't build the GCTP bundled with the source and link with the
system's -lgctp instead.  We also remove references to the
"testdrivers" directory, which is not distributed together with the
source, causing autoreconf to fail.

diff --git a/Makefile.in b/Makefile.in
index d468af2..90428a7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -206,7 +206,7 @@ LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
 @TESTDRIVERS_CONDITIONAL_TRUE@TESTDRIVERS = testdrivers
 @INSTALL_INCLUDE_CONDITIONAL_FALSE@INCLUDE =
 @INSTALL_INCLUDE_CONDITIONAL_TRUE@INCLUDE = include
-SUBDIRS = gctp src $(INCLUDE) samples $(TESTDRIVERS)
+SUBDIRS = src $(INCLUDE) samples $(TESTDRIVERS)
 all: all-recursive

 .SUFFIXES:
diff --git a/include/Makefile.in b/include/Makefile.in
index 9938b23..afb7f40 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -190,7 +190,7 @@ LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
 # Boilerplate include

 # Headers to install
-include_HEADERS = HE2_config.h HdfEosDef.h HDFEOSVersion.h cfortHdf.h ease.h
+include_HEADERS = HdfEosDef.h HDFEOSVersion.h cfortHdf.h ease.h
 all: HE2_config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am

diff --git a/samples/Makefile.in b/samples/Makefile.in
index 9da6e28..6a6186c 100644
--- a/samples/Makefile.in
+++ b/samples/Makefile.in
@@ -108,7 +108,6 @@ AppendField_SOURCES = AppendField.c
 AppendField_OBJECTS = AppendField.$(OBJEXT)
 AppendField_LDADD = $(LDADD)
 am__DEPENDENCIES_1 = $(top_builddir)/src/libhdfeos.la
-am__DEPENDENCIES_2 = $(top_builddir)/gctp/src/libGctp.la
 AppendField_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
 DefineFields_SOURCES = DefineFields.c
 DefineFields_OBJECTS = DefineFields.$(OBJEXT)
@@ -481,7 +480,7 @@ sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 LIBHDFEOS2 = $(top_builddir)/src/libhdfeos.la
-LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+LIBGCTP =

 # Boilerplate definitions file

--
2.10.0


code:
Make shared library linking work.
---
 src/Makefile.in | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/Makefile.in b/src/Makefile.in
index 86880e5..24efffe 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -72,7 +72,7 @@ LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
 	$(AM_CFLAGS) $(CFLAGS) -DH5_USE_16_API
 CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+LINK = HDF5_USE_SHLIB=yes $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(libhe5_hdfeos_la_SOURCES)
 DIST_SOURCES = $(libhe5_hdfeos_la_SOURCES)
@@ -124,9 +124,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@

-# Set LDFLAGS to allow the HDF-EOS library to use extern variables from
-# HDF5
-LDFLAGS = -Wl,-single_module
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
--
2.10.0


code:
Ill-placed #endif causes missing symbol errors when compiling without
szip.  Reported to upstream maintainer.
---
 src/EHapi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/EHapi.c b/src/EHapi.c
index 46a9b5c..208f447 100755
--- a/src/EHapi.c
+++ b/src/EHapi.c
@@ -11379,6 +11379,7 @@ int HE5_szip_can_encode(void )
   return(-1);
 }

+#endif /* H5_HAVE_FILTER_SZIP */

 /*----------------------------------------------------------------------------|
@@ -11509,8 +11510,6 @@ HE5_EHHEisHE5(char *filename)
     }
 }

-#endif /* H5_HAVE_FILTER_SZIP */
-

 #ifndef __cplusplus

--
2.10.0


code:
Fix fortran line length/indentation issues in Fortran test programs.
Reported to upstream maintainer.

diff --git a/samples/he5_gd_writedataF_32.f b/samples/he5_gd_writedataF_32.f
index 515edf9..9c86299 100755
--- a/samples/he5_gd_writedataF_32.f
+++ b/samples/he5_gd_writedataF_32.f
@@ -77,26 +77,26 @@ c           ------------------------------

 		attr4 = "ABCDEFGH"
 		count(1) = 8
-		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR"
+     &               ,HE5T_NATIVE_CHAR,count,attr4)
 	write(*,*) 'Status returned by he5_gdwrattr():  ',status

 		attr4 = "111"
 		count(1) = 3
-		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1"
+     &               ,HE5T_NATIVE_CHAR,count,attr4)
 	write(*,*) 'Status returned by he5_gdwrgattr():  ',status

 		attr4 = "222222"
 		count(1) = 6
-		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2"
+     &               ,HE5T_NATIVE_CHAR,count,attr4)
 	write(*,*) 'Status returned by he5_ehwrglatt():  ',status

 		attr5 = "abcdefgh111111111111"
 		count(1) = 20
-		status = he5_gdwrlattr(gdid,"Vegetation","LocalAttribute_0",
-	1	HE5T_NATIVE_CHAR,count,attr5)
+		status = he5_gdwrlattr(gdid,"Vegetation"
+     &               ,"LocalAttribute_0",HE5T_NATIVE_CHAR,count,attr5)
 	write(*,*) 'Status returned by he5_gdwrlattr():  ',status

 		 endif
diff --git a/samples/he5_gd_writedataF_64.f b/samples/he5_gd_writedataF_64.f
index eff04f5..62a7398 100755
--- a/samples/he5_gd_writedataF_64.f
+++ b/samples/he5_gd_writedataF_64.f
@@ -77,26 +77,26 @@ c           ------------------------------

 		attr4 = "ABCDEFGH"
 		count(1) = 8
-		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR"
+     &               ,HE5T_NATIVE_CHAR,count,attr4)
 	write(*,*) 'Status returned by he5_gdwrattr():  ',status

 		attr4 = "111"
 		count(1) = 3
-		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1"
+     &               ,HE5T_NATIVE_CHAR,count,attr4)
 	write(*,*) 'Status returned by he5_gdwrgattr():  ',status

 		attr4 = "222222"
 		count(1) = 6
-		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2"
+     &               ,HE5T_NATIVE_CHAR,count,attr4)
 	write(*,*) 'Status returned by he5_ehwrglatt():  ',status

 		attr5 = "abcdefgh111111111111"
 		count(1) = 20
-		status = he5_gdwrlattr(gdid,"Vegetation","LocalAttribute_0",
-	1	HE5T_NATIVE_CHAR,count,attr5)
+		status = he5_gdwrlattr(gdid,"Vegetation"
+     &               ,"LocalAttribute_0",HE5T_NATIVE_CHAR,count,attr5)
 	write(*,*) 'Status returned by he5_gdwrlattr():  ',status

 		 endif
diff --git a/samples/he5_sw_writedataF_32.f b/samples/he5_sw_writedataF_32.f
index 7abab9b..fedd49a 100755
--- a/samples/he5_sw_writedataF_32.f
+++ b/samples/he5_sw_writedataF_32.f
@@ -173,20 +173,21 @@ c     Write Global Attribute
 c     ----------------------
 			attr4 = "ABCDEFGH"
 			count(1) = 8
-			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR"
+     &                       ,HE5T_NATIVE_CHAR,count,attr4)
 	write(*,*) 'Status returned by he5_swwrattr():  ',status

 			attr4 = "111"
 			count(1) = 3
-			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1"
+     &                       ,HE5T_NATIVE_CHAR,count,attr4)
 	write(*,*) 'Status returned by he5_swwrgattr():  ',status

 			attr4 = "222222"
 			count(1) = 6
-			status = he5_ehwrglatt(swfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+			status = he5_ehwrglatt(swfid
+     &                       ,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR
+     &                       ,count,attr4)
 	write(*,*) 'Status returned by he5_ehwrglatt():  ',status

 c     Write Local Attribute
diff --git a/samples/he5_sw_writedataF_64.f b/samples/he5_sw_writedataF_64.f
index 79e34bd..e5d74cb 100755
--- a/samples/he5_sw_writedataF_64.f
+++ b/samples/he5_sw_writedataF_64.f
@@ -162,25 +162,27 @@ c     Write Global Attribute
 c     ----------------------
 			attr4 = "ABCDEFGH"
 			count(1) = 8
-			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR"
+     &                       ,HE5T_NATIVE_CHAR,count,attr4)

 			attr4 = "111"
 			count(1) = 3
-			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1"
+     &                       ,HE5T_NATIVE_CHAR,count,attr4)

 			attr4 = "222222"
 			count(1) = 6
-			status = he5_ehwrglatt(swfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
-	1	count,attr4)
+			status = he5_ehwrglatt(swfid
+     &                       ,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR
+     &                       ,count,attr4)

 c     Write Local Attribute
 c     ---------------------
 			attr5 = "abababababababababab"
 			count(1) = 20
-			status = he5_swwrlattr(swid,"Density","LocalAttribute_0",
-	1	HE5T_NATIVE_CHAR,count,attr5)
+			status = he5_swwrlattr(swid,"Density"
+     &                       ,"LocalAttribute_0",HE5T_NATIVE_CHAR,count
+     &                       ,attr5)

 		 endif
--
2.10.0


code:
Don't build/install/use bundled gctp code/headers.

* cproj.h, proj.h: part of GCTP, therefore already present.
* HE5_config.h, tutils.h: used for library building and testing.

diff --git a/Makefile.in b/Makefile.in
index f160d0d..367b537 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -206,7 +206,7 @@ LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
 @TESTDRIVERS_CONDITIONAL_TRUE@TESTDRIVERS = testdrivers
 @INSTALL_INCLUDE_CONDITIONAL_FALSE@INCLUDE =
 @INSTALL_INCLUDE_CONDITIONAL_TRUE@INCLUDE = include
-SUBDIRS = gctp src $(INCLUDE) samples $(TESTDRIVERS)
+SUBDIRS = src $(INCLUDE) samples $(TESTDRIVERS)
 all: all-recursive

 .SUFFIXES:
diff --git a/samples/Makefile.in b/samples/Makefile.in
index 59331dd..64fda89 100644
--- a/samples/Makefile.in
+++ b/samples/Makefile.in
@@ -206,7 +206,6 @@ he5_gd_datainfo_SOURCES = he5_gd_datainfo.c
 he5_gd_datainfo_OBJECTS = he5_gd_datainfo.$(OBJEXT)
 he5_gd_datainfo_LDADD = $(LDADD)
 am__DEPENDENCIES_1 = $(top_builddir)/src/libhe5_hdfeos.la
-am__DEPENDENCIES_2 = $(top_builddir)/gctp/src/libGctp.la
 he5_gd_datainfo_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_2)
 he5_gd_defexternalfld_SOURCES = he5_gd_defexternalfld.c
@@ -1093,7 +1092,7 @@ sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
-LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+LIBGCTP =

 # Boilerplate definitions file

diff --git a/include/Makefile.in b/include/Makefile.in
index a572128..64dabb5 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -190,8 +190,7 @@ LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
 # Boilerplate include

 # Headers to install
-include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h HE5_config.h cproj.h ease.h \
-                  isin.h proj.h tutils.h cfortHdf.h
+include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h ease.h isin.h cfortHdf.h

 all: HE5_config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
--
2.10.0