code:
Use gcc as the default C compiler if CC is not set.

diff -ru gobject-introspection-1.58.1.orig/giscanner/__init__.py gobject-introspection-1.58.1/giscanner/__init__.py
--- gobject-introspection-1.58.1.orig/giscanner/__init__.py	1970-01-01 01:00:00.000000000 +0100
+++ gobject-introspection-1.58.1/giscanner/__init__.py	2018-12-03 13:33:28.788971299 +0100
@@ -22,6 +22,8 @@
 builddir = os.environ.get('UNINSTALLED_INTROSPECTION_BUILDDIR')
 if builddir is not None:
     __path__.append(os.path.join(builddir, 'giscanner'))
+if not 'CC' in os.environ:
+    os.environ['CC'] = 'gcc'
 try:
     from ._version import __version__
 except ImportError:


code:
--- a/girepository/gitypelib.c.orig
+++ b/girepository/gitypelib.c
@@ -2296,7 +2296,22 @@ _g_typelib_do_dlopen (GITypelib *typelib)
         {
           GModule *module;

+          /* 'gobject-introspection' doesn't store the path of shared
+             libraries into '.typelib' and '.gir' files.  Shared
+             libraries are searched for in the dynamic linker search
+             path.  In Guix we patch 'gobject-introspection' such that
+             it stores the absolute path of shared libraries in
+             '.typelib' and '.gir' files.  Here, in order to minimize
+             side effects, we make sure that if the library is not
+             found at the indicated path location, we try with just
+             the basename and the system dynamic library
+             infrastructure, as per default behaviour of the
+             library. */
           module = load_one_shared_library (shlibs[i]);
+          if (module == NULL && g_path_is_absolute (shlibs[i]))
+            {
+              module = load_one_shared_library (g_basename(shlibs[i]));
+            }

           if (module == NULL)
             {

license: mit


code:
Fix building of GPM with glibc 2.26:

https://bugs.gentoo.org/629774

Patches copied from Gentoo:

https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/gpm/files/gpm-1.20.7-glibc-2.26.patch?id=1618968c56caf7f8c08823908d88dc49bb8f7649
https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/gpm/files/gpm-1.20.7-sysmacros.patch?id=1618968c56caf7f8c08823908d88dc49bb8f7649

--- a/src/prog/gpm-root.y	2012-10-26 17:21:38.000000000 -0400
+++ b/src/prog/gpm-root.y	2017-09-07 20:39:51.933264063 -0400
@@ -1197,7 +1197,7 @@
    /* reap your zombies */
    childaction.sa_handler=reap_children;
 #if defined(__GLIBC__)
-   __sigemptyset(&childaction.sa_mask);
+   sigemptyset(&childaction.sa_mask);
 #else /* __GLIBC__ */
    childaction.sa_mask=0;
 #endif /* __GLIBC__ */
From b350aee4ea5785a75cb6ad770f6b768c506ebb70 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 14 Mar 2016 15:39:54 -0400
Subject: [PATCH] fix building w/newer glibc

Linux C libraries are looking to disentangle sysmacros.h from the
sys/types.h include, so make sure we pull in the header when it is
found.
---
 src/daemon/open_console.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/daemon/open_console.c b/src/daemon/open_console.c
index 4d6c0af..6dd43e6 100644
--- a/src/daemon/open_console.c
+++ b/src/daemon/open_console.c
@@ -24,6 +24,10 @@
 #include <sys/types.h>              /* major()           */
 #include <sys/ioctl.h>              /* ioctl             */

+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>          /* major() w/newer glibc */
+#endif
+
 /* Linux specific (to be outsourced in gpm2 */
 #include <linux/serial.h>           /* for serial console check */
 #include <asm/ioctls.h>            /* for serial console check */
--
2.6.2


code:
Description: Modify the default value for check_on_startup to false.
 This prevents an privacy/information disclosure unless the user
 explicitly opts-in for the update check.
Forwarded: not-needed
Origin: vendor
Author: tony mancill <tmancill@debian.org>

--- a/src/gpodder/config.py
+++ b/src/gpodder/config.py
@@ -93,7 +93,7 @@

     # Software updates from gpodder.org
     'software_update': {
-        'check_on_startup': True,  # check for updates on start
+        'check_on_startup': False,  # check for updates on start
         'last_check': 0,  # unix timestamp of last update check
         'interval': 5,  # interval (in days) to check for updates
     },


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


code:
Taken from nixpkgs, see
grantleetheme: merge themes across multiple prefixes
<https://github.com/NixOS/nixpkgs/commits/master/pkgs/applications/kde/grantleetheme/grantlee-merge-theme-dirs.patch>

diff --git a/src/grantleetheme.cpp b/src/grantleetheme.cpp
index 27d5bc8..8d43140 100644
--- a/src/grantleetheme.cpp
+++ b/src/grantleetheme.cpp
@@ -46,7 +46,7 @@ ThemePrivate::ThemePrivate(const ThemePrivate &other)
     , description(other.description)
     , name(other.name)
     , dirName(other.dirName)
-    , absolutePath(other.absolutePath)
+    , absolutePaths(other.absolutePaths)
     , author(other.author)
     , email(other.email)
     , loader(other.loader)
@@ -64,12 +64,15 @@ void ThemePrivate::setupEngine()

 void ThemePrivate::setupLoader()
 {
-    // Get the parent dir with themes, we set the theme directory separately
-    QDir dir(absolutePath);
-    dir.cdUp();
+    QStringList templateDirs;
+    for (const QString& path : absolutePaths) {
+        QDir dir(path);
+        dir.cdUp();
+        templateDirs << dir.absolutePath();
+    }

     loader = QSharedPointer<GrantleeTheme::QtResourceTemplateLoader>::create();
-    loader->setTemplateDirs({ dir.absolutePath() });
+    loader->setTemplateDirs(templateDirs);
     loader->setTheme(dirName);

     if (!sEngine) {
@@ -121,7 +124,7 @@ Theme::Theme(const QString &themePath, const QString &dirName, const QString &de
     KConfigGroup group(&config, QStringLiteral("Desktop Entry"));
     if (group.isValid()) {
         d->dirName = dirName;
-        d->absolutePath = themePath;
+        d->absolutePaths = QStringList(themePath);
         d->name = group.readEntry("Name", QString());
         d->description = group.readEntry("Description", QString());
         d->themeFileName = group.readEntry("FileName", QString());
@@ -140,7 +143,7 @@ Theme::~Theme()

 bool Theme::operator==(const Theme &other) const
 {
-    return isValid() && other.isValid() && d->absolutePath == other.absolutePath();
+    return isValid() && other.isValid() && d->absolutePaths == other.absolutePaths();
 }

 Theme &Theme::operator=(const Theme &other)
@@ -184,7 +187,15 @@ QString Theme::dirName() const

 QString Theme::absolutePath() const
 {
-    return d->absolutePath;
+    if (! d->absolutePaths.isEmpty()) {
+      return d->absolutePaths.first();
+    };
+    return QString();
+}
+
+QStringList Theme::absolutePaths() const
+{
+    return d->absolutePaths;
 }

 QString Theme::author() const
@@ -223,6 +231,13 @@ QString Theme::render(const QString &templateName, const QVariantHash &data, con
     return result;
 }

+void Theme::addThemeDir(const QString& path)
+{
+    QDir dir(path);
+    dir.cdUp();
+    d->absolutePaths << dir.absolutePath();
+}
+
 void Theme::addPluginPath(const QString &path)
 {
     if (!ThemePrivate::sEngine) {
diff --git a/src/grantleetheme.h b/src/grantleetheme.h
index a25c27b..be38299 100644
--- a/src/grantleetheme.h
+++ b/src/grantleetheme.h
@@ -48,11 +48,14 @@ public:
     Q_REQUIRED_RESULT QStringList displayExtraVariables() const;
     Q_REQUIRED_RESULT QString dirName() const;
     Q_REQUIRED_RESULT QString absolutePath() const;
+    Q_REQUIRED_RESULT QStringList absolutePaths() const;
     Q_REQUIRED_RESULT QString author() const;
     Q_REQUIRED_RESULT QString authorEmail() const;

     Q_REQUIRED_RESULT QString render(const QString &templateName, const QVariantHash &data, const QByteArray &applicationDomain = QByteArray());

+    void addThemeDir(const QString&);
+
     static void addPluginPath(const QString &path);

 private:
diff --git a/src/grantleetheme_p.h b/src/grantleetheme_p.h
index eb73dcb..00510e9 100644
--- a/src/grantleetheme_p.h
+++ b/src/grantleetheme_p.h
@@ -43,7 +43,7 @@ public:
     QString description;
     QString name;
     QString dirName;
-    QString absolutePath;
+    QStringList absolutePaths;
     QString author;
     QString email;

diff --git a/src/grantleethememanager.cpp b/src/grantleethememanager.cpp
index 606d717..dc99041 100644
--- a/src/grantleethememanager.cpp
+++ b/src/grantleethememanager.cpp
@@ -125,25 +125,18 @@ public:

         for (const QString &directory : qAsConst(themesDirectories)) {
             QDirIterator dirIt(directory, QStringList(), QDir::AllDirs | QDir::NoDotAndDotDot);
-            QStringList alreadyLoadedThemeName;
             while (dirIt.hasNext()) {
                 dirIt.next();
                 const QString dirName = dirIt.fileName();
                 GrantleeTheme::Theme theme = q->loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName);
                 if (theme.isValid()) {
                     QString themeName = theme.name();
-                    if (alreadyLoadedThemeName.contains(themeName)) {
-                        int i = 2;
-                        const QString originalName(theme.name());
-                        while (alreadyLoadedThemeName.contains(themeName)) {
-                            themeName = originalName + QStringLiteral(" (%1)").arg(i);
-                            ++i;
-                        }
-                        theme.d->name = themeName;
+                    QMap<QString, GrantleeTheme::Theme>::iterator i = themes.find(dirName);
+                    if (i != themes.end()) {
+                        i.value().addThemeDir(dirIt.filePath());
+                    } else {
+                        themes.insert(dirName, theme);
                     }
-                    alreadyLoadedThemeName << themeName;
-                    themes.insert(dirName, theme);
-                    //qDebug()<<" theme.name()"<<theme.name();
                 }
             }
             watch->addDir(directory);
@@ -366,7 +359,7 @@ QString ThemeManager::pathFromThemes(const QString &themesRelativePath, const QS
                 GrantleeTheme::Theme theme = loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName);
                 if (theme.isValid()) {
                     if (dirName == themeName) {
-                        return theme.absolutePath();
+                        return theme.absolutePaths().first();
                     }
                 }
             }


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:
python-admiral doesn't have a license
https://github.com/nspies/admiral/issues/3

diff --git a/setup.py b/setup.py
index 692b6a0..568f381 100755
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@ setup(
         'console_scripts' : ["grocsvs = grocsvs.main:main"]
     },

-    install_requires = ["admiral", "h5py", "networkx>=2.0", "pandas", "pybedtools",
+    install_requires = ["h5py", "networkx>=2.0", "pandas", "pybedtools",
                         "pyfaidx", "pysam>=0.10.0", "scipy", "ipython-cluster-helper",
                         "pygraphviz", "psutil"],

diff --git a/src/grocsvs/jobmanagers.py b/src/grocsvs/jobmanagers.py
index 6da0b58..112d7ff 100755
--- a/src/grocsvs/jobmanagers.py
+++ b/src/grocsvs/jobmanagers.py
@@ -41,34 +41,3 @@ class MultiprocessingCluster(Cluster):
         pool = multiprocessing.Pool(processes=self.processes)
         return pool.map_async(fn, args).get(999999)

-
-class AdmiralCluster(Cluster):
-    def map(self, fn, args):
-        from admiral import jobmanagers, remote
-
-        cluster_options = self.cluster_settings.cluster_options.copy()
-
-        scheduler = cluster_options.pop("scheduler")
-
-        jobmanager_class = jobmanagers.get_jobmanager(scheduler)
-        jobmanager = jobmanager_class(
-            batch_dir=self.batch_dir, log_dir=self.batch_dir)
-
-
-        if not "mem" in cluster_options:
-            cluster_options["mem"] = "16g"
-        if not "time" in cluster_options:
-            cluster_options["time"] = "12h"
-
-        jobs = []
-        #for i, arg in enumerate(args):
-
-        job_name = args[0].__class__.__name__
-        args = [[arg] for arg in args]
-        job = remote.run_remote(fn, jobmanager, job_name, args=args,
-                                array=True, overwrite=True, **cluster_options)
-
-        result = jobmanagers.wait_for_jobs([job], wait=5, progress=True)
-
-        if not result:
-            raise Exception("Some chunks failed to complete")
diff --git a/src/grocsvs/pipeline.py b/src/grocsvs/pipeline.py
index ab1bb2d..350976f 100755
--- a/src/grocsvs/pipeline.py
+++ b/src/grocsvs/pipeline.py
@@ -8,8 +8,7 @@ from grocsvs import utilities
 def make_jobmanager(jobmanager_settings, processes, batch_dir):
     jobmanager_classes = {"IPCluster":jobmanagers.IPCluster,
                           "local":    jobmanagers.LocalCluster,
-                          "multiprocessing": jobmanagers.MultiprocessingCluster,
-                          "admiral": jobmanagers.AdmiralCluster}
+                          "multiprocessing": jobmanagers.MultiprocessingCluster}

     cls = jobmanager_classes[jobmanager_settings.cluster_type]
     return cls(processes, jobmanager_settings, batch_dir)


code:
Unbundling tinyxml2 from gromacs and using our own, which is newer, broke gromacs
build.

This patch fixes three issues:

- cmake now errors out if using multiple target_link_libraries with mixed styles
  of signatures.

- Error handling API changed, fix the testutils/refdata_xml.cpp code by using the
  new API: document.ErrorStr() & tinyxml2::XML_SUCCESS.

Those fixes will be submitted for inclusion to upstream, but may not be suitable
there as long as they still keep the old version bundled.

First hunk has already been requested for merging. Third is in discussion. Second
will only be sent if third is OK'ed.

diff -ruN gromacs-2020.2/src/testutils/CMakeLists.txt gromacs-2020.2-fixed/src/testutils/CMakeLists.txt
--- gromacs-2020.2/src/testutils/CMakeLists.txt 2020-04-30 18:33:44.000000000 +0200
+++ gromacs-2020.2-fixed/src/testutils/CMakeLists.txt   2020-05-01 22:52:16.356000000 +0200
@@ -73,7 +73,7 @@

 if(HAVE_TINYXML2)
     include_directories(SYSTEM ${TinyXML2_INCLUDE_DIR})
-    target_link_libraries(testutils ${TinyXML2_LIBRARIES})
+    target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES})
 else()
     include_directories(BEFORE SYSTEM "../external/tinyxml2")
 endif()
diff -ruN gromacs-2020.2/src/testutils/refdata_xml.cpp gromacs-2020.2-fixed/src/testutils/refdata_xml.cpp
--- gromacs-2020.2/src/testutils/refdata_xml.cpp        2020-04-30 18:33:44.000000000 +0200
+++ gromacs-2020.2-fixed/src/testutils/refdata_xml.cpp  2020-05-01 23:17:09.556000000 +0200
@@ -206,21 +206,12 @@
     document.LoadFile(path.c_str());
     if (document.Error())
     {
-        const char* errorStr1 = document.GetErrorStr1();
-        const char* errorStr2 = document.GetErrorStr2();
+        const char* errorStr = document.ErrorStr();
         std::string errorString("Error was ");
-        if (errorStr1)
-        {
-            errorString += errorStr1;
-        }
-        if (errorStr2)
-        {
-            errorString += errorStr2;
-        }
-        if (!errorStr1 && !errorStr2)
-        {
+        if (errorStr)
+            errorString += errorStr;
+        else
             errorString += "not specified.";
-        }
         GMX_THROW(TestException("Reference data not parsed successfully: " + path + "\n."
                                 + errorString + "\n"));
     }
@@ -371,7 +362,7 @@
     XMLElementPtr rootElement = createRootElement(&document);
     createChildElements(rootElement, rootEntry);

-    if (document.SaveFile(path.c_str()) != tinyxml2::XML_NO_ERROR)
+    if (document.SaveFile(path.c_str()) != tinyxml2::XML_SUCCESS)
     {
         GMX_THROW(TestException("Reference data saving failed in " + path));
     }


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:
Not upstreamed.
Fixes cross-build for the Hurd, from i686-linux,
see <https://bugs.gnu.org/41982>.

From 17b242e7b80108f1467037e15b605595e4823b2e Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Sun, 21 Jun 2020 15:10:40 +0200
Subject: [PATCH v2] grub-core: Build fixes for i386
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8

* grub-core/lib/i386/relocator64.S: Avoid x86_64 instructions on i386.
---
 grub-core/lib/i386/relocator64.S | 33 +++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/grub-core/lib/i386/relocator64.S b/grub-core/lib/i386/relocator64.S
index 148f38adb..ea39908c1 100644
--- a/grub-core/lib/i386/relocator64.S
+++ b/grub-core/lib/i386/relocator64.S
@@ -63,7 +63,9 @@ VARIABLE(grub_relocator64_cr3)
 	movq	%rax, %cr3
 #endif

+#ifdef __x86_64__
 	.code64
+#endif

 	/* mov imm64, %rax */
 	.byte 	0x48
@@ -71,7 +73,14 @@ VARIABLE(grub_relocator64_cr3)
 VARIABLE(grub_relocator64_rsp)
 	.quad	0

+#ifndef __x86_64__
+	/* movq	%rax, %rsp */
+	.byte 	0x48
+	.byte	0x89
+	.byte	0xc4
+#else
 	movq	%rax, %rsp
+#endif

 #ifdef GRUB_MACHINE_EFI
 	jmp	LOCAL(skip_efi_stack_align)
@@ -85,7 +94,14 @@ VARIABLE(grub_relocator64_rsp)
 	 */
 VARIABLE(grub_relocator64_efi_start)
 	/* Align the stack as UEFI spec requires. */
+#ifndef __x86_64__
+	.byte 0x48
+        .byte 0x83
+        .byte 0xe4
+        .byte 0xf0
+#else
 	andq	$~15, %rsp
+#endif

 LOCAL(skip_efi_stack_align):
 #endif
@@ -95,8 +111,15 @@ LOCAL(skip_efi_stack_align):
 VARIABLE(grub_relocator64_rsi)
 	.quad	0

+#ifndef	__x86_64__
+	/* movq	%rax, %rsi */
+	.byte 	0x48
+	.byte	0x89
+	.byte 	0xc6
+#else
 	movq	%rax, %rsi
-
+#endif
+
 	/* mov imm64, %rax */
 	.byte 	0x48
 	.byte	0xb8
@@ -128,6 +151,14 @@ VARIABLE(grub_relocator64_rdx)
 #ifdef __APPLE__
 	.byte 0xff, 0x25
 	.quad 0
+#elif !defined (__x86_64__)
+	/* jmp *LOCAL(jump_addr) (%rip) */
+	.byte 0xff
+        .byte 0x25
+	.byte 0
+	.byte 0
+	.byte 0
+	.byte 0
 #else
 	jmp *LOCAL(jump_addr) (%rip)
 #endif
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com


code:
Change 'grub-mkrescue' to honor the 'GRUB_FAT_SERIAL_NUMBER'
environment variable.  That way, the caller can specify a fixed
serial number (instead of the randomly chosen one) to create EFI
images (the 'efi.img' file) that are reproducible bit-for-bit.

Patch by Ludovic Courtès <ludo@gnu.org>.
Mangled (for GRUB 2.04) by Tobias Geerinckx-Rice <me@tobias.gr>.

--- grub-2.04/util/grub-mkrescue.c	2019-05-20 13:01:11.000000000 +0200
+++ grub-2.04/util/grub-mkrescue.c	2019-07-08 23:57:36.912104652 +0200
@@ -809,8 +809,15 @@
       free (efidir_efi_boot);

       efiimgfat = grub_util_path_concat (2, iso9660_dir, "efi.img");
-      rv = grub_util_exec ((const char * []) { "mformat", "-C", "-f", "2880", "-L", "16", "-i",
-	    efiimgfat, "::", NULL });
+
+      const char *fat_serial_number = getenv ("GRUB_FAT_SERIAL_NUMBER");
+      const char *mformat_args[] =
+       { "mformat", "-C", "-f", "2880", "-L", "16",
+         fat_serial_number != NULL ? "-N" : "-C",
+         fat_serial_number != NULL ? fat_serial_number : "-C",
+         "-i", efiimgfat, "::", NULL };
+
+      rv = grub_util_exec (mformat_args);
       if (rv != 0)
 	grub_util_error ("`%s` invocation failed\n", "mformat");
       rv = grub_util_exec ((const char * []) { "mcopy", "-s", "-i", efiimgfat, efidir_efi, "::/", NULL });


code:
This patch is taken from OpenWrt, see:

https://github.com/openwrt/openwrt/blob/master/package/boot/grub2/patches/100-grub_setup_root.patch.

It allows to use grub-bios-setup on a raw disk-images, without root permissions.

--- a/util/grub-setup.c
+++ b/util/grub-setup.c
@@ -87,6 +87,8 @@ static struct argp_option options[] = {
    N_("install even if problems are detected"), 0},
   {"skip-fs-probe",'s',0,      0,
    N_("do not probe for filesystems in DEVICE"), 0},
+  {"root-device", 'r', N_("DEVICE"), 0,
+   N_("use DEVICE as the root device"), 0},
   {"verbose",     'v', 0,      0, N_("print verbose messages."), 0},
   {"allow-floppy", 'a', 0,      0,
    /* TRANSLATORS: The potential breakage isn't limited to floppies but it's
@@ -130,6 +132,7 @@ struct arguments
   char *core_file;
   char *dir;
   char *dev_map;
+  char *root_dev;
   int  force;
   int  fs_probe;
   int allow_floppy;
@@ -178,6 +181,13 @@ argp_parser (int key, char *arg, struct
         arguments->dev_map = xstrdup (arg);
         break;

+      case 'r':
+        if (arguments->root_dev)
+          free (arguments->root_dev);
+
+        arguments->root_dev = xstrdup (arg);
+        break;
+
       case 'f':
         arguments->force = 1;
         break;
@@ -313,7 +323,7 @@ main (int argc, char *argv[])
   GRUB_SETUP_FUNC (arguments.dir ? : DEFAULT_DIRECTORY,
 		   arguments.boot_file ? : DEFAULT_BOOT_FILE,
 		   arguments.core_file ? : DEFAULT_CORE_FILE,
-		   dest_dev, arguments.force,
+		   arguments.root_dev, dest_dev, arguments.force,
 		   arguments.fs_probe, arguments.allow_floppy,
 		   arguments.add_rs_codes);

--- a/util/setup.c
+++ b/util/setup.c
@@ -252,13 +252,12 @@ identify_partmap (grub_disk_t disk __att
 void
 SETUP (const char *dir,
        const char *boot_file, const char *core_file,
-       const char *dest, int force,
+       char *root, const char *dest, int force,
        int fs_probe, int allow_floppy,
        int add_rs_codes __attribute__ ((unused))) /* unused on sparc64 */
 {
   char *core_path;
   char *boot_img, *core_img, *boot_path;
-  char *root = 0;
   size_t boot_size, core_size;
   grub_uint16_t core_sectors;
   grub_device_t root_dev = 0, dest_dev, core_dev;
@@ -307,7 +306,10 @@ SETUP (const char *dir,

   core_dev = dest_dev;

-  {
+  if (root)
+    root_dev = grub_device_open(root);
+
+  if (!root_dev) {
     char **root_devices = grub_guess_root_devices (dir);
     char **cur;
     int found = 0;
@@ -320,6 +322,8 @@ SETUP (const char *dir,
 	char *drive;
 	grub_device_t try_dev;

+	if (root_dev)
+	  break;
 	drive = grub_util_get_grub_dev (*cur);
 	if (!drive)
 	  continue;
--- a/include/grub/util/install.h
+++ b/include/grub/util/install.h
@@ -191,13 +191,13 @@ grub_install_get_image_target (const cha
 void
 grub_util_bios_setup (const char *dir,
 		      const char *boot_file, const char *core_file,
-		      const char *dest, int force,
+		      char *root, const char *dest, int force,
 		      int fs_probe, int allow_floppy,
 		      int add_rs_codes);
 void
 grub_util_sparc_setup (const char *dir,
 		       const char *boot_file, const char *core_file,
-		       const char *dest, int force,
+		       char *root, const char *dest, int force,
 		       int fs_probe, int allow_floppy,
 		       int add_rs_codes);

--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1712,7 +1712,7 @@ main (int argc, char *argv[])
 	/*  Now perform the installation.  */
 	if (install_bootsector)
 	  grub_util_bios_setup (platdir, "boot.img", "core.img",
-				install_drive, force,
+				NULL, install_drive, force,
 				fs_probe, allow_floppy, add_rs_codes);
 	break;
       }
@@ -1738,7 +1738,7 @@ main (int argc, char *argv[])
 	/*  Now perform the installation.  */
 	if (install_bootsector)
 	  grub_util_sparc_setup (platdir, "boot.img", "core.img",
-				 install_drive, force,
+				 NULL, install_drive, force,
 				 fs_probe, allow_floppy,
 				 0 /* unused */ );
 	break;


code:
This patch is needed to build Grub on the Hurd.

Taken from upstream: https://git.savannah.gnu.org/cgit/grub.git/commit//?id=dabdfa1c6a80639197d05f683a445fa8615517fe

From 7606547586b2d6ca1b384e15e0358d3a3ddc48a6 Mon Sep 17 00:00:00 2001
From: David Michael <fedora.dm0@gmail.com>
Date: Fri, 5 Jul 2019 07:45:59 -0400
Subject: verifiers: Blocklist fallout cleanup

Blocklist fallout cleanup after commit 5c6f9bc15 (generic/blocklist: Fix
implicit declaration of function grub_file_filter_disable_compression()).

Signed-off-by: David Michael <fedora.dm0@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

---
 grub-core/osdep/generic/blocklist.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grub-core/osdep/generic/blocklist.c b/grub-core/osdep/generic/blocklist.c
index ea2a511b6..2d9040302 100644
--- a/grub-core/osdep/generic/blocklist.c
+++ b/grub-core/osdep/generic/blocklist.c
@@ -59,7 +59,7 @@ grub_install_get_blocklist (grub_device_t root_dev,

       grub_disk_cache_invalidate_all ();

-      file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | FILE_TYPE_NO_DECOMPRESS);
+      file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | GRUB_FILE_TYPE_NO_DECOMPRESS);
       if (file)
 	{
 	  if (grub_file_size (file) != core_size)
@@ -116,7 +116,7 @@ grub_install_get_blocklist (grub_device_t root_dev,

   grub_file_t file;
   /* Now read the core image to determine where the sectors are.  */
-  file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | FILE_TYPE_NO_DECOMPRESS);
+  file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE | GRUB_FILE_TYPE_NO_DECOMPRESS);
   if (! file)
     grub_util_error ("%s", grub_errmsg);


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:
From fc401acb15f15d487c942437b6fb429289dd3c67 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Fri, 31 May 2019 13:22:25 +0200
Subject: [PATCH] Add installation directory as a default directory.

In Guix, this library is installed in a separate directory in the store,
and it's typically not installed system-wide in a fixed directory. Add
the store path to the set of default directories so dependents can find
default langs and source highlighting scheme.
---
 gtksourceview/gtksourceview-utils.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gtksourceview/gtksourceview-utils.c b/gtksourceview/gtksourceview-utils.c
index 6f06bab..c3467d5 100644
--- a/gtksourceview/gtksourceview-utils.c
+++ b/gtksourceview/gtksourceview-utils.c
@@ -66,6 +66,12 @@ _gtk_source_view_get_default_dirs (const char *basename,
 							 basename,
 							 NULL));

+    /* installed dir */
+    g_ptr_array_add (dirs, g_build_filename (DATADIR,
+						 SOURCEVIEW_DIR,
+						 basename,
+						 NULL));
+
 	g_ptr_array_add (dirs, NULL);

 	return (gchar**) g_ptr_array_free (dirs, FALSE);
--
2.21.0


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 0ac5ea6a6..f73301e2f 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -1931,7 +1931,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 45e62f4e4..42012f3aa 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -974,7 +974,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;
@@ -4198,7 +4200,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 056b4c99f..63a6c050d 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1579,7 +1579,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 ());
 }

@@ -1907,7 +1907,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 ());
 }

@@ -2195,7 +2195,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
     scm_wrong_type_arg_msg (NULL, 0, str, "string");

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

   if (c_strcasecmp (encoding, "UTF-8") == 0)
     /* This is the most common case--e.g., when calling libc bindings
@@ -2247,7 +2247,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
   if (scm_i_is_narrow_string (str))
     {
       ret = mem_iconveh (scm_i_string_chars (str), ilen,
-                         "ISO-8859-1", encoding,
+                         "UTF-8", encoding,
                          (enum iconv_ilseq_handler) handler, NULL,
                          &buf, &len);


code:
Skip 'test-out-of-memory', which is unreliable in Guile 2.2.4:

  https://bugs.gnu.org/34155

--- a/test-suite/standalone/Makefile.in	1969-12-31 19:00:00.000000000 -0500
+++ b/test-suite/standalone/Makefile.in	2019-05-27 16:44:32.302355990 -0400
@@ -103,7 +103,7 @@
 	test-scm-c-bind-keyword-arguments$(EXEEXT) \
 	test-srfi-4$(EXEEXT) $(am__append_6) $(am__EXEEXT_1) \
 	test-smob-mark$(EXEEXT) test-smob-mark-race$(EXEEXT) \
-	test-stack-overflow test-out-of-memory
+	test-stack-overflow
 check_PROGRAMS = test-num2integral$(EXEEXT) test-round$(EXEEXT) \
 	test-foreign-object-c$(EXEEXT) test-list$(EXEEXT) \
 	test-unwind$(EXEEXT) test-conversion$(EXEEXT) \
@@ -1938,8 +1938,7 @@
 	test-command-line-encoding test-command-line-encoding2 \
 	test-language test-guild-compile $(am__append_3) \
 	test-foreign-object-scm test-fast-slot-ref test-mb-regexp \
-	test-use-srfi $(am__append_5) test-stack-overflow \
-	test-out-of-memory
+	test-use-srfi $(am__append_5) test-stack-overflow
 BUILT_SOURCES = $(am__append_2)
 EXTRA_DIST = test-import-order-a.scm test-import-order-b.scm \
 	test-import-order-c.scm test-import-order-d.scm \


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
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -2375,6 +2375,336 @@ 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"
+#include <libguile/variable.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:
This patch changes Guile to use a default search path relative to the
location of the `guile' binary, allowing it to be relocated.

diff --git a/libguile/load.c b/libguile/load.c
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -27,6 +27,7 @@
 #include <stat-time.h>
 #include <string.h>
 #include <stdio.h>
+#include <libgen.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -334,6 +335,32 @@ scm_init_load_path ()
   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
@@ -342,10 +369,7 @@ scm_init_load_path ()
   else if (env)
     path = scm_parse_path (scm_from_locale_string (env), path);
   else
-    path = scm_list_4 (scm_from_utf8_string (SCM_LIBRARY_DIR),
-                       scm_from_utf8_string (SCM_SITE_DIR),
-                       scm_from_utf8_string (SCM_GLOBAL_SITE_DIR),
-                       scm_from_utf8_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)
@@ -355,8 +379,7 @@ scm_init_load_path ()
     cpath = scm_parse_path (scm_from_locale_string (env), cpath);
   else
     {
-      cpath = scm_list_2 (scm_from_utf8_string (SCM_CCACHE_DIR),
-                          scm_from_utf8_string (SCM_SITE_CCACHE_DIR));
+      cpath = scm_list_1 (scm_from_locale_string (ccache_dir));
     }

 #endif /* SCM_LIBRARY_DIR */


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:
Fibers 1.0.0 has a bug in run-fibers in which peer schedulers aren't destroyed -
so if you had 4 cores, 1 would be destroyed when run-fibers returned, but the
other 3 would stay around.  Each scheduler uses 3 file descriptors, so for
machines with many cores, this resource leak adds up quickly - quickly enough
that the test suite can even fail because of it.

See https://github.com/wingo/fibers/issues/36.

This fixes that.  It should be safe to destroy the peer schedulers at the given
point because the threads that could be running them are all either dead or the
current thread.

As of May 21, 2020, this bug still existed in the 1.0.0 (latest) release and in
git master.
--- a/fibers.scm	2020-05-21 18:38:06.890690154 -0500
+++ b/fibers.scm	2020-05-21 18:38:56.395686693 -0500
@@ -137,5 +137,6 @@
              (%run-fibers scheduler hz finished? affinity))
            (lambda ()
              (stop-auxiliary-threads scheduler)))))
+      (for-each destroy-scheduler (scheduler-remote-peers scheduler))
       (destroy-scheduler scheduler)
       (apply values (atomic-box-ref ret))))))


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:
From 501ad55982a8f92a7a95c76c75944d644870181d Mon Sep 17 00:00:00 2001
From: Ludovic Courtès <ludo@gnu.org>
Date: Thu, 12 Mar 2020 15:16:04 +0100
Subject: [PATCH] load: Make Guile run-time relocatable using /proc/self/exe.

Import from

    http://git.savannah.gnu.org/cgit/guix.git/commit/?id=920f2c42ce3345dc1355a41377ebf01a33fdae51
---
 libguile/load.c | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/libguile/load.c b/libguile/load.c
index c2ee5093a..128cdf95a 100644
--- 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_init_load_path ()
   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 @@ scm_init_load_path ()
   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 @@ scm_init_load_path ()
     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 */
--
2.24.0


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:
Source: https://gitlab.gnome.org/GNOME/gvfs/-/commit/13551f3f40d41f1357126ac5a26d0fa012cd8123

Note: This change should be incorporated into stable version 1.46.x of gvfs.

From 13551f3f40d41f1357126ac5a26d0fa012cd8123 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 16 Jun 2020 13:28:35 +0200
Subject: [PATCH] afc: Add support for libplist-2.2

Which changed name from libplist to libplist-2.0 to embed its API
version number in the library name.
---
 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 1750f65ca..187bfd55f 100644
--- a/meson.build
+++ b/meson.build
@@ -357,7 +357,10 @@ config_h.set('HAVE_LOGIND', enable_logind)
 enable_afc = get_option('afc')
 if enable_afc
   libimobiledevice_dep = dependency('libimobiledevice-1.0', version: '>= 1.2')
-  libplist_dep = dependency('libplist', version: '>= 0.15')
+  libplist_dep = dependency('libplist-2.0', required: false)
+  if not libplist_dep.found()
+    libplist_dep = dependency('libplist', version: '>= 0.15')
+  endif
 endif

 # *** Check if we should build with GOA volume monitor ***
--
GitLab


code:
--- /CMakeLists.txt	2020-01-20 21:47:35.460119141 +0100
+++ /CMakeLists.txt	2020-01-20 21:47:47.690112400 +0100
@@ -195,12 +195,12 @@
 #endif()

 # GME
-#find_path( GME_INCLUDE_DIR gme/gme.h )
-#find_library( GME_LIBRARIES gme )
-#mark_as_advanced( GME_INCLUDE_DIR GME_LIBRARIES )
-#FIND_PACKAGE_HANDLE_STANDARD_ARGS( GME
-#	REQUIRED_VARS GME_LIBRARIES GME_INCLUDE_DIR
-#)
+find_path( GME_INCLUDE_DIR gme/gme.h )
+find_library( GME_LIBRARIES gme )
+mark_as_advanced( GME_INCLUDE_DIR GME_LIBRARIES )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( GME
+	REQUIRED_VARS GME_LIBRARIES GME_INCLUDE_DIR
+)

 if( MSVC )
 	# Eliminate unreferenced functions and data


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:
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@