code:
From eccc46eaf7903a8e837813795498b12c078faaea Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Wed, 11 Mar 2020 21:53:32 +0100
Subject: [PATCH] Fix old dependencies

---
 .../enforcer/AbstractBanDependencies.java     |  2 +-
 .../enforcer/BanTransitiveDependencies.java   |  2 +-
 .../enforcer/DependencyConvergence.java       | 17 ++++++++---------
 .../enforcer/RequireUpperBoundDeps.java       | 19 +++++++++----------
 .../enforcer/utils/DependencyVersionMap.java  |  6 +++---
 5 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
index 2888a61..2b944b7 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
@@ -119,7 +119,7 @@ public abstract class AbstractBanDependencies
         Set<Artifact> dependencies = null;
         try
         {
-            DependencyNode node = graphBuilder.buildDependencyGraph( project, null );
+            DependencyNode node = graphBuilder.buildDependencyGraph( project.getProjectBuildingRequest(), null );
             if ( searchTransitive )
             {
                 dependencies = ArtifactUtils.getAllDescendants( node );
diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java
index 6e1dcd4..1b964ba 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java
@@ -158,7 +158,7 @@ public class BanTransitiveDependencies
         try
         {
             MavenProject project = (MavenProject) helper.evaluate( "${project}" );
-            rootNode = createDependencyGraphBuilder().buildDependencyGraph( project, null );
+            rootNode = createDependencyGraphBuilder().buildDependencyGraph( project.getProjectBuildingRequest(), null );
         }
         catch ( Exception e )
         {
diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
index 684f984..ca7ad3a 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
@@ -35,9 +35,9 @@ import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugins.enforcer.utils.DependencyVersionMap;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.dependency.tree.DependencyNode;
-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
+import org.apache.maven.shared.dependency.graph.DependencyNode;
+import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
+import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException;
 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;

@@ -60,7 +60,7 @@ public class DependencyConvergence
     // CHECKSTYLE_OFF: LineLength
     /**
      * Uses the {@link EnforcerRuleHelper} to populate the values of the
-     * {@link DependencyTreeBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)}
+     * {@link DependencyGraphBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)}
      * factory method.

      * This method simply exists to hide all the ugly lookup that the {@link EnforcerRuleHelper} has to do.
      *
@@ -75,16 +75,15 @@ public class DependencyConvergence
         try
         {
             MavenProject project = (MavenProject) helper.evaluate( "${project}" );
-            DependencyTreeBuilder dependencyTreeBuilder =
-                (DependencyTreeBuilder) helper.getComponent( DependencyTreeBuilder.class );
+            DependencyGraphBuilder dependencyTreeBuilder =
+                (DependencyGraphBuilder) helper.getComponent( DependencyGraphBuilder.class );
             ArtifactRepository repository = (ArtifactRepository) helper.evaluate( "${localRepository}" );
             ArtifactFactory factory = (ArtifactFactory) helper.getComponent( ArtifactFactory.class );
             ArtifactMetadataSource metadataSource =
                 (ArtifactMetadataSource) helper.getComponent( ArtifactMetadataSource.class );
             ArtifactCollector collector = (ArtifactCollector) helper.getComponent( ArtifactCollector.class );
             ArtifactFilter filter = null; // we need to evaluate all scopes
-            DependencyNode node = dependencyTreeBuilder.buildDependencyTree( project, repository, factory,
-                                                                             metadataSource, filter, collector );
+            DependencyNode node = dependencyTreeBuilder.buildDependencyGraph( project.getProjectBuildingRequest(), filter);
             return node;
         }
         catch ( ExpressionEvaluationException e )
@@ -95,7 +94,7 @@ public class DependencyConvergence
         {
             throw new EnforcerRuleException( "Unable to lookup a component " + e.getLocalizedMessage(), e );
         }
-        catch ( DependencyTreeBuilderException e )
+        catch ( DependencyGraphBuilderException e )
         {
             throw new EnforcerRuleException( "Could not build dependency tree " + e.getLocalizedMessage(), e );
         }
diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireUpperBoundDeps.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireUpperBoundDeps.java
index 458554a..2de9870 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireUpperBoundDeps.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireUpperBoundDeps.java
@@ -38,10 +38,10 @@ import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
 import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.dependency.tree.DependencyNode;
-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
-import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.graph.DependencyNode;
+import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
+import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException;
+import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;
 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;

@@ -91,7 +91,7 @@ public class RequireUpperBoundDeps
     // CHECKSTYLE_OFF: LineLength
     /**
      * Uses the {@link EnforcerRuleHelper} to populate the values of the
-     * {@link DependencyTreeBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)}
+     * {@link DependencyGraphBuilder#buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)}
      * factory method.

      * This method simply exists to hide all the ugly lookup that the {@link EnforcerRuleHelper} has to do.
      *
@@ -106,8 +106,8 @@ public class RequireUpperBoundDeps
         try
         {
             MavenProject project = (MavenProject) helper.evaluate( "${project}" );
-            DependencyTreeBuilder dependencyTreeBuilder =
-                (DependencyTreeBuilder) helper.getComponent( DependencyTreeBuilder.class );
+            DependencyGraphBuilder dependencyTreeBuilder =
+                (DependencyGraphBuilder) helper.getComponent( DependencyGraphBuilder.class );
             ArtifactRepository repository = (ArtifactRepository) helper.evaluate( "${localRepository}" );
             ArtifactFactory factory = (ArtifactFactory) helper.getComponent( ArtifactFactory.class );
             ArtifactMetadataSource metadataSource =
@@ -115,8 +115,7 @@ public class RequireUpperBoundDeps
             ArtifactCollector collector = (ArtifactCollector) helper.getComponent( ArtifactCollector.class );
             ArtifactFilter filter = null; // we need to evaluate all scopes
             DependencyNode node =
-                dependencyTreeBuilder.buildDependencyTree( project, repository, factory, metadataSource, filter,
-                                                           collector );
+                dependencyTreeBuilder.buildDependencyGraph( project.getProjectBuildingRequest(), filter);
             return node;
         }
         catch ( ExpressionEvaluationException e )
@@ -127,7 +126,7 @@ public class RequireUpperBoundDeps
         {
             throw new EnforcerRuleException( "Unable to lookup a component " + e.getLocalizedMessage(), e );
         }
-        catch ( DependencyTreeBuilderException e )
+        catch ( DependencyGraphBuilderException e )
         {
             throw new EnforcerRuleException( "Could not build dependency tree " + e.getLocalizedMessage(), e );
         }
diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/DependencyVersionMap.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/DependencyVersionMap.java
index b6213fa..2c2a645 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/DependencyVersionMap.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/DependencyVersionMap.java
@@ -26,8 +26,8 @@ import java.util.Map;

 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.shared.dependency.tree.DependencyNode;
-import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.graph.DependencyNode;
+import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;

 /**
  * @author Brian Fox
@@ -132,4 +132,4 @@ public class DependencyVersionMap
         }
         return output;
     }
-}
\ No newline at end of file
+}
--
2.24.1


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

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

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

repo_name: maximed/guix

license: mit


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

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

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


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

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


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

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

--
cgit v0.12


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

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

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

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

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

---


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

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

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

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

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

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

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

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


code:
This is needed to make Mercurial read the HGEXTENSIONPATH to detect
third-party extensions.  It is called HGEXTENSIONPATH and not
HG_EXTENSION_PATH to keep it consistent with other environment variables for
Mercurial, e.g. HGENCODINGAMBIGUOUS, HGEDITOR ...  Hopefully I or someone else
will get this into Mercurial proper.

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -13,6 +13,7 @@
 import imp
 import inspect
 import os
+import sys

 from .i18n import (
     _,
@@ -108,6 +109,11 @@

 def _importh(name):
     """import and return the <name> module"""
+    # Read HGEXTENSIONSPATH environment variable when import extensions.
+    extension_path = os.getenv("HGEXTENSIONSPATH")
+    if extension_path is not None:
+        for path in extension_path:
+            sys.path.append(path)
     mod = __import__(pycompat.sysstr(name))
     components = name.split(b'.')
     for comp in components[1:]:


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

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

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

This test fails on i686-linux. I couldn't come up with a regex that
could be used to disable it just on i686-linux, so we disable it
completely with this patch:

https://gitlab.freedesktop.org/mesa/mesa/-/issues/4091

diff --git a/src/util/meson.build b/src/util/meson.build
index 0893f64..909b3e0 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -289,18 +289,6 @@ if with_tests
      suite : ['util'],
   )

-  test(
-    'u_debug_stack',
-    executable(
-      'u_debug_stack_test',
-      files('u_debug_stack_test.cpp'),
-      include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
-      dependencies : [idep_mesautil, idep_gtest],
-      c_args : [c_msvc_compat_args],
-    ),
-     suite : ['util'],
-  )
-
   process_test_exe = executable(
     'process_test',
     files('process_test.c'),


code:
From c184e95096881a13f29ebd7fc507fe305d3d8de5 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Thu, 4 Oct 2018 22:03:31 +0200
Subject: [PATCH] build.sh: Update for mes 0.18.

---
 build.sh   | 92 +++++++++++++++++++++++++++++++++++++-----------------
 install.sh |  6 ++--
 2 files changed, 66 insertions(+), 32 deletions(-)

diff --git a/build.sh b/build.sh
index 335a7bb..19a0029 100755
--- a/build.sh
+++ b/build.sh
@@ -18,7 +18,8 @@
 # along with mescc-tools.  If not, see <http://www.gnu.org/licenses/>.

 set -eux
-MES_SEED=${MES_SEED-../mescc-tools-seed/libs}
+MES_PREFIX=${MES_PREFIX-../mes}
+MES_SEED=${MES_SEED-../mes-seed}
 MESCC_TOOLS_SEED=${MESCC_TOOLS_SEED-../mescc-tools-seed}

 #########################################
@@ -32,15 +33,23 @@ MESCC_TOOLS_SEED=${MESCC_TOOLS_SEED-../mescc-tools-seed}
 # blood-elf
 # Create proper debug segment
 $MESCC_TOOLS_SEED/blood-elf\
+    -f $MESCC_TOOLS_SEED/file_print.M1\
+    -f $MESCC_TOOLS_SEED/match.M1\
+    -f $MESCC_TOOLS_SEED/numerate_number.M1\
+    -f $MESCC_TOOLS_SEED/string.M1\
     -f $MESCC_TOOLS_SEED/blood-elf.M1\
     -o blood-elf-blood-elf-footer.M1

 # Build
 # M1-macro phase
 $MESCC_TOOLS_SEED/M1 --LittleEndian --Architecture 1\
-    -f $MES_SEED/x86.M1\
-    -f $MES_SEED/crt1.M1\
-    -f $MES_SEED/libc+tcc-mes.M1\
+    -f $MES_PREFIX/lib/x86-mes/x86.M1\
+    -f $MES_SEED/x86-mes/crt1.S\
+    -f $MES_SEED/x86-mes/libc+tcc.S\
+    -f $MESCC_TOOLS_SEED/file_print.M1\
+    -f $MESCC_TOOLS_SEED/match.M1\
+    -f $MESCC_TOOLS_SEED/numerate_number.M1\
+    -f $MESCC_TOOLS_SEED/string.M1\
     -f $MESCC_TOOLS_SEED/blood-elf.M1\
     -f blood-elf-blood-elf-footer.M1\
     -o blood-elf.hex2
@@ -49,7 +58,7 @@ $MESCC_TOOLS_SEED/hex2\
     --LittleEndian\
     --Architecture 1\
     --BaseAddress 0x1000000\
-    -f $MES_SEED/elf32-header.hex2\
+    -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
     -f blood-elf.hex2\
     --exec_enable\
     -o bin/blood-elf
@@ -65,9 +74,13 @@ $MESCC_TOOLS_SEED/hex2\
 $MESCC_TOOLS_SEED/M1 \
     --LittleEndian\
     --Architecture 1\
-    -f $MES_SEED/x86.M1\
-    -f $MES_SEED/crt1.M1\
-    -f $MES_SEED/libc+tcc-mes.M1\
+    -f $MES_PREFIX/lib/x86-mes/x86.M1\
+    -f $MES_SEED/x86-mes/crt1.S\
+    -f $MES_SEED/x86-mes/libc+tcc.S\
+    -f $MESCC_TOOLS_SEED/file_print.M1\
+    -f $MESCC_TOOLS_SEED/match.M1\
+    -f $MESCC_TOOLS_SEED/numerate_number.M1\
+    -f $MESCC_TOOLS_SEED/string.M1\
     -f $MESCC_TOOLS_SEED/M1.M1\
     -f M1-footer.M1\
     -o M1.hex2
@@ -76,7 +89,7 @@ $MESCC_TOOLS_SEED/hex2 \
     --LittleEndian\
     --Architecture 1\
     --BaseAddress 0x1000000\
-    -f $MES_SEED/elf32-header.hex2\
+    -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
     -f M1.hex2\
     --exec_enable\
     -o bin/M1
@@ -92,9 +105,13 @@ $MESCC_TOOLS_SEED/hex2 \
 ./bin/M1 \
     --LittleEndian\
     --Architecture 1\
-    -f $MES_SEED/x86.M1\
-    -f $MES_SEED/crt1.M1\
-    -f $MES_SEED/libc+tcc-mes.M1\
+    -f $MES_PREFIX/lib/x86-mes/x86.M1\
+    -f $MES_SEED/x86-mes/crt1.S\
+    -f $MES_SEED/x86-mes/libc+tcc.S\
+    -f $MESCC_TOOLS_SEED/file_print.M1\
+    -f $MESCC_TOOLS_SEED/match.M1\
+    -f $MESCC_TOOLS_SEED/numerate_number.M1\
+    -f $MESCC_TOOLS_SEED/string.M1\
     -f $MESCC_TOOLS_SEED/hex2.M1\
     -f hex2-footer.M1\
     -o hex2.hex2
@@ -103,10 +120,10 @@ $MESCC_TOOLS_SEED/hex2 \
       --LittleEndian\
       --Architecture 1\
       --BaseAddress 0x1000000\
-      -f $MES_SEED/elf32-header.hex2\
+      -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
       -f hex2.hex2\
       --exec_enable\
-      -o bin/hex2
+      -o bin/hex2-0

 #########################
 # Phase-1 Self-host     #
@@ -123,18 +140,22 @@ $MESCC_TOOLS_SEED/hex2 \
 ./bin/M1 \
     --LittleEndian\
     --Architecture 1\
-    -f $MES_SEED/x86.M1\
-    -f $MES_SEED/crt1.M1\
-    -f $MES_SEED/libc+tcc-mes.M1\
+    -f $MES_PREFIX/lib/x86-mes/x86.M1\
+    -f $MES_SEED/x86-mes/crt1.S\
+    -f $MES_SEED/x86-mes/libc+tcc.S\
+    -f $MESCC_TOOLS_SEED/file_print.M1\
+    -f $MESCC_TOOLS_SEED/match.M1\
+    -f $MESCC_TOOLS_SEED/numerate_number.M1\
+    -f $MESCC_TOOLS_SEED/string.M1\
     -f $MESCC_TOOLS_SEED/blood-elf.M1\
     -f blood-elf-blood-elf-footer.M1\
     -o blood-elf.hex2
 # Hex2-linker phase
-./bin/hex2 \
+./bin/hex2-0 \
     --LittleEndian\
     --Architecture 1\
     --BaseAddress 0x1000000\
-    -f $MES_SEED/elf32-header.hex2\
+    -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
     -f blood-elf.hex2\
     --exec_enable\
     -o blood-elf
@@ -150,18 +171,22 @@ $MESCC_TOOLS_SEED/hex2 \
 ./bin/M1 \
     --LittleEndian\
     --Architecture 1\
-    -f $MES_SEED/x86.M1\
-    -f $MES_SEED/crt1.M1\
-    -f $MES_SEED/libc+tcc-mes.M1\
+    -f $MES_PREFIX/lib/x86-mes/x86.M1\
+    -f $MES_SEED/x86-mes/crt1.S\
+    -f $MES_SEED/x86-mes/libc+tcc.S\
+    -f $MESCC_TOOLS_SEED/file_print.M1\
+    -f $MESCC_TOOLS_SEED/match.M1\
+    -f $MESCC_TOOLS_SEED/numerate_number.M1\
+    -f $MESCC_TOOLS_SEED/string.M1\
     -f $MESCC_TOOLS_SEED/M1.M1\
     -f M1-footer.M1\
     -o M1.hex2
 # Hex2-linker phase
-./bin/hex2 \
+./bin/hex2-0 \
     --LittleEndian\
     --Architecture 1\
     --BaseAddress 0x1000000\
-    -f $MES_SEED/elf32-header.hex2\
+    -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
     -f M1.hex2\
     --exec_enable\
     -o bin/M1
@@ -177,18 +202,27 @@ $MESCC_TOOLS_SEED/hex2 \
 ./bin/M1 \
     --LittleEndian\
     --Architecture 1\
-    -f $MES_SEED/x86.M1\
-    -f $MES_SEED/crt1.M1\
-    -f $MES_SEED/libc+tcc-mes.M1\
+    -f $MES_PREFIX/lib/x86-mes/x86.M1\
+    -f $MES_SEED/x86-mes/crt1.S\
+    -f $MES_SEED/x86-mes/libc+tcc.S\
+    -f $MESCC_TOOLS_SEED/file_print.M1\
+    -f $MESCC_TOOLS_SEED/match.M1\
+    -f $MESCC_TOOLS_SEED/numerate_number.M1\
+    -f $MESCC_TOOLS_SEED/string.M1\
     -f $MESCC_TOOLS_SEED/hex2.M1\
     -f hex2-footer.M1\
     -o hex2.hex2
 # Hex2-linker phase
-./bin/hex2 \
+./bin/hex2-0 \
       --LittleEndian\
       --Architecture 1\
       --BaseAddress 0x1000000\
-      -f $MES_SEED/elf32-header.hex2\
+      -f $MES_PREFIX/lib/x86-mes/elf32-header.hex2\
       -f hex2.hex2\
       --exec_enable\
       -o bin/hex2
+
+# TODO
+touch bin/exec_enable
+touch bin/get_machine
+touch bin/kaem
diff --git a/install.sh b/install.sh
index e4dccff..29e58d6 100644
--- a/install.sh
+++ b/install.sh
@@ -18,6 +18,6 @@
 PREFIX=${PREFIX-usr}

 mkdir -p "$PREFIX/bin"
-cp blood-elf "$PREFIX/bin/blood-elf"
-cp hex2 "$PREFIX/bin/hex2"
-cp M1 "$PREFIX/bin/M1"
+cp bin/blood-elf "$PREFIX/bin/blood-elf"
+cp bin/hex2 "$PREFIX/bin/hex2"
+cp bin/M1 "$PREFIX/bin/M1"
--
2.18.0


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

Original patch for Meson 0.42.0 by Peter Mikkelsen <petermikkelsen10@gmail.com>

--- meson-0.47.1/mesonbuild/minstall.py.old	2018-08-10 11:01:27.812327013 +0200
+++ meson-0.47.1/mesonbuild/minstall.py	2018-08-10 11:01:51.940368505 +0200
@@ -436,15 +436,6 @@
                         print("Symlink creation does not work on this platform. "
                               "Skipping all symlinking.")
                         printed_symlink_error = True
-            if os.path.isfile(outname):
-                try:
-                    depfixer.fix_rpath(outname, install_rpath, final_path,
-                                       install_name_mappings, verbose=False)
-                except SystemExit as e:
-                    if isinstance(e.code, int) and e.code == 0:
-                        pass
-                    else:
-                        raise

 def run(args):
     parser = buildparser()


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

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

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

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


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

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

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

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

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


code:
This patch includes

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

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

Upstream status: not yet presented upstream.

diff --git a/mingw-w64-headers/crt/float.h b/mingw-w64-headers/crt/float.h
index 5874f4e..bdf4ead 100644
--- a/mingw-w64-headers/crt/float.h
+++ b/mingw-w64-headers/crt/float.h
@@ -22,6 +22,15 @@
 #if (__GNUC__ < 4)
 #error Corrupt install of gcc-s internal headers, or search order was changed.
 #else
+
+        /* From gcc-4.9.3 float.h.  */
+        #undef FLT_EPSILON
+        #undef DBL_EPSILON
+        #undef LDBL_EPSILON
+        #define FLT_EPSILON	__FLT_EPSILON__
+        #define DBL_EPSILON	__DBL_EPSILON__
+        #define LDBL_EPSILON	__LDBL_EPSILON__
+
 	/* #include_next <float_ginclude.h> */

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

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

   __CRT_INLINE double __cdecl fabs (double x)
   {
@@ -905,7 +907,7 @@ __mingw_choose_expr (                                         \
 /* 7.12.7.3  */
   extern double __cdecl hypot (double, double) __MINGW_ATTRIB_DEPRECATED_MSVC2005; /* in libmoldname.a */
   extern float __cdecl hypotf (float x, float y);
-#ifndef __CRT__NO_INLINE
+#if 0 //ndef __CRT__NO_INLINE
   __CRT_INLINE float __cdecl hypotf (float x, float y) { return (float) hypot ((double)x, (double)y);}
 #endif
   extern long double __cdecl hypotl (long double, long double);


code:
This following patch was originally found at the debian mingw-w64 team's
mingw-w64 repo located here:
https://salsa.debian.org/mingw-w64-team/mingw-w64.git

Invoke the following in the aforementioned repo to see the original patch:

  $ git show 4974e2c:debian/patches/dlltool-temp-prefix.patch

Description: Specify dlltool's temp prefix
Author: Stephen Kitt <steve@sk2.org>

By default dlltool uses its pid for the object files it generates.
Enforcing its temp prefix allows the files it generates to be
reproducible.

--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -36,7 +36,7 @@
   DTDEF32=$(GENLIB) $(DLLTOOLFLAGS32) $(AM_DLLTOOLFLAGS)
   DTDEF64=$(GENLIB) $(DLLTOOLFLAGS64) $(AM_DLLTOOLFLAGS)
 else
-  AM_DLLTOOLFLAGS=-k --as=$(AS) --output-lib $@
+  AM_DLLTOOLFLAGS=-k --as=$(AS) --output-lib $@ --temp-prefix $$(basename $@ .a)
   DLLTOOLFLAGSARM32=-m arm
   DLLTOOLFLAGSARM64=-m arm64
   DLLTOOLFLAGS32=--as-flags=--32 -m i386


code:
This following patch was originally found at the debian mingw-w64 team's
mingw-w64 repo located here:
https://salsa.debian.org/mingw-w64-team/mingw-w64.git

Invoke the following in the aforementioned repo to see the original patch:

  $ git show 4974e2c:debian/patches/reproducible-gendef.patch

Description: Drop __DATE__ from gendef
Author: Stephen Kitt <skitt@debian.org>

This allows gendef to be built reproducibly.

--- a/mingw-w64-tools/gendef/src/gendef.c
+++ b/mingw-w64-tools/gendef/src/gendef.c
@@ -196,7 +196,6 @@
                    "  By default, the output files are named after their DLL counterparts\n"
                    "  gendef MYDLL.DLL     Produces MYDLL.def\n"
                    "  gendef - MYDLL.DLL   Prints the exports to stdout\n");
-  fprintf (stderr, "\nBuilt on %s\n", __DATE__);
   fprintf (stderr, "\nReport bugs to <mingw-w64-public@lists.sourceforge.net>\n");
   exit (0);
 }


code:
See https://groups.google.com/forum/#!topic/minisat/FCocZsC8oMQ
This seems to only be a problem with newer versions of g++, and
upstream development seems to have stopped in 2013.

diff -rupN minisat-2.2.0/core/SolverTypes.h minisat-2.2.0.patched/core/SolverTypes.h
--- a/minisat/core/SolverTypes.h	2010-07-10 17:07:36.000000000 +0100
+++ b/minisat/core/SolverTypes.h	2014-03-29 11:57:49.000000000 +0000
@@ -47,7 +47,7 @@ struct Lit {
     int     x;

     // Use this as a constructor:
-    friend Lit mkLit(Var var, bool sign = false);
+    //friend Lit mkLit(Var var, bool sign = false);

     bool operator == (Lit p) const { return x == p.x; }
     bool operator != (Lit p) const { return x != p.x; }
@@ -55,7 +55,7 @@ struct Lit {
 };

-inline  Lit  mkLit     (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; }
+inline  Lit  mkLit     (Var var, bool sign = false) { Lit p; p.x = var + var + (int)sign; return p; }
 inline  Lit  operator ~(Lit p)              { Lit q; q.x = p.x ^ 1; return q; }
 inline  Lit  operator ^(Lit p, bool b)      { Lit q; q.x = p.x ^ (unsigned int)b; return q; }
 inline  bool sign      (Lit p)              { return p.x & 1; }


code:
Avoid the default dynamic executable, which depends on minisat.so
Instead install the release version, which is statically linked.

diff --git a/Makefile b/Makefile
index ceb9d77..7b91906 100644
--- a/Makefile
+++ b/Makefile
@@ -191,9 +191,9 @@ install-lib: $(BUILD_DIR)/release/lib/$(MINISAT_SLIB) $(BUILD_DIR)/dynamic/lib/$
 	ln -sf $(MINISAT_DLIB).$(SOMAJOR) $(DESTDIR)$(libdir)/$(MINISAT_DLIB)
 	$(INSTALL) -m 644 $(BUILD_DIR)/release/lib/$(MINISAT_SLIB) $(DESTDIR)$(libdir)

-install-bin: $(BUILD_DIR)/dynamic/bin/$(MINISAT)
+install-bin: $(BUILD_DIR)/release/bin/$(MINISAT)
 	$(INSTALL) -d $(DESTDIR)$(bindir)
-	$(INSTALL) -m 755 $(BUILD_DIR)/dynamic/bin/$(MINISAT) $(DESTDIR)$(bindir)
+	$(INSTALL) -m 755 $(BUILD_DIR)/release/bin/$(MINISAT) $(DESTDIR)$(bindir)

 clean:
 	rm -f $(foreach t, release debug profile dynamic, $(foreach o, $(SRCS:.cc=.o), $(BUILD_DIR)/$t/$o)) \


code:
Avoid using MAXPATHLEN and MAXHOSTLEN on the Hurd.

Taken from https://salsa.debian.org/debian/krb5/-/blob/master/debian/patches/debian-local/0001-Debian-HURD-compatibility.patch

From: Sam Hartman <hartmans@debian.org>
Date: Mon, 26 Dec 2011 18:05:13 -0500
Subject: Debian: HURD compatibility

HURD has no MAXPATHLEN or MAXHOSTLEN.

Patch-Category: debian-local
---
 src/clients/ksu/ksu.h                       | 4 ++++
 src/include/k5-int.h                        | 3 +++
 src/kadmin/ktutil/ktutil_funcs.c            | 4 ++++
 src/kprop/kprop_util.c                      | 4 ++++
 src/lib/gssapi/spnego/spnego_mech.c         | 3 +++
 src/lib/krb5/os/sn2princ.c                  | 4 ++++
 src/plugins/kdb/db2/libdb2/include/db-int.h | 4 ++++
 src/tests/resolve/resolve.c                 | 4 ++++
 8 files changed, 30 insertions(+)

$ diff -u krb5-1.18/src/util/ss/help.c.orig krb5-1.18/src/util/ss/help.c
--- krb5-1.18/src/util/ss/help.c.orig	2020-03-07 23:25:52.712418587 +0100
+++ krb5-1.18/src/util/ss/help.c	2020-03-07 23:26:25.764941122 +0100
@@ -6,6 +6,9 @@
  */

 #include <sys/param.h>
+#ifndef MAXPATHLEN
+# define MAXPATHLEN 4096
+#endif
 #include <sys/types.h>
 #include <errno.h>
 #include <sys/file.h>
$ diff -u krb5-1.18/src/lib/krb5/os/hostrealm.c.orig krb5-1.18/src/lib/krb5/os/hostrealm.c
--- krb5-1.18/src/lib/krb5/os/hostrealm.c.orig	2020-03-07 23:33:19.931420994 +0100
+++ krb5-1.18/src/lib/krb5/os/hostrealm.c	2020-03-07 23:33:58.628026424 +0100
@@ -42,6 +42,10 @@
 #endif
 #endif

+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 256
+#endif
+
 struct hostrealm_module_handle {
     struct krb5_hostrealm_vtable_st vt;
     krb5_hostrealm_moddata data;
diff --git a/src/clients/ksu/ksu.h b/src/clients/ksu/ksu.h
index 3bf0bd4..f680b33 100644
--- a/src/clients/ksu/ksu.h
+++ b/src/clients/ksu/ksu.h
@@ -56,6 +56,10 @@
 #define MAX_CMD 2048 /* this is temp, should use realloc instead,
                         as done in most of the code */

+#ifndef MAXPATHLEN
+# define MAXPATHLEN 4096
+#endif
+

 extern int optind;
 extern char * optarg;
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index 6522422..e4f1678 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -589,6 +589,9 @@ extern char *strdup (const char *);
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>                  /* MAXPATHLEN */
 #endif
+#ifndef MAXPATHLEN
+# define MAXPATHLEN 4096
+#endif

 #ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>                   /* prototypes for file-related
diff --git a/src/kadmin/ktutil/ktutil_funcs.c b/src/kadmin/ktutil/ktutil_funcs.c
index 6d119a2..fb7fa22 100644
--- a/src/kadmin/ktutil/ktutil_funcs.c
+++ b/src/kadmin/ktutil/ktutil_funcs.c
@@ -34,6 +34,10 @@
 #include <string.h>
 #include <ctype.h>

+#ifndef MAXPATHLEN
+# define MAXPATHLEN 4096
+#endif
+
 /*
  * Free a kt_list
  */
diff --git a/src/kprop/kprop_util.c b/src/kprop/kprop_util.c
index c32d174..d72ab18 100644
--- a/src/kprop/kprop_util.c
+++ b/src/kprop/kprop_util.c
@@ -32,6 +32,10 @@
 #include <sys/types.h>
 #include <sys/socket.h>

+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 256
+#endif
+
 /*
  * Convert an IPv4 or IPv6 socket address to a newly allocated krb5_address.
  * There is similar code elsewhere in the tree, so this should possibly become
diff --git a/src/lib/gssapi/spnego/spnego_mech.c b/src/lib/gssapi/spnego/spnego_mech.c
index 9d6027c..585d8a6 100644
--- a/src/lib/gssapi/spnego/spnego_mech.c
+++ b/src/lib/gssapi/spnego/spnego_mech.c
@@ -65,6 +65,9 @@
 #include	"gssapiP_spnego.h"
 #include	<gssapi_err_generic.h>

+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 256
+#endif

 #undef g_token_size
 #undef g_verify_token_header
diff --git a/src/lib/krb5/os/sn2princ.c b/src/lib/krb5/os/sn2princ.c
index 5932fd9..187daa8 100644
--- a/src/lib/krb5/os/sn2princ.c
+++ b/src/lib/krb5/os/sn2princ.c
@@ -126,6 +126,10 @@ find_trailer(const char *hostname)
     return p;
 }

+#ifndef MAXHOSTNAMELEN
+# define MAXHOSTNAMELEN 256
+#endif
+
 krb5_error_code KRB5_CALLCONV
 krb5_sname_to_principal(krb5_context context, const char *hostname,
                         const char *sname, krb5_int32 type,
diff --git a/src/plugins/kdb/db2/libdb2/include/db-int.h b/src/plugins/kdb/db2/libdb2/include/db-int.h
index 7e981d4..d83b3b6 100644
--- a/src/plugins/kdb/db2/libdb2/include/db-int.h
+++ b/src/plugins/kdb/db2/libdb2/include/db-int.h
@@ -280,4 +280,8 @@ void	 __dbpanic __P((DB *dbp));
 #ifndef O_BINARY
 #define O_BINARY	0		/* Needed for Win32 compiles */
 #endif
+
+#ifndef MAXPATHLEN
+# define MAXPATHLEN 4096
+#endif
 #endif /* _DB_INT_H_ */
diff --git a/src/tests/resolve/resolve.c b/src/tests/resolve/resolve.c
index 7339d21..38f7253 100644
--- a/src/tests/resolve/resolve.c
+++ b/src/tests/resolve/resolve.c
@@ -73,6 +73,10 @@ char *strchr();
 #include <netinet/in.h>
 #include <netdb.h>

+#ifndef MAXHOSTNAMELEN
+# define MAXHOSTNAMELEN 256
+#endif
+
 int
 main(argc, argv)
     int argc;


code:
Fix a null pointer dereference when no DNS search path is configured.
This showed up as a segfault while running the gsasl test suite.

Taken from upstream:
https://github.com/krb5/krb5/commit/cd82bf377e7fad2409c76bf8b241920692f34fda

diff --git a/src/lib/krb5/os/dnsglue.c b/src/lib/krb5/os/dnsglue.c
index e35ca9d76c..0cd213fdd7 100644
--- a/src/lib/krb5/os/dnsglue.c
+++ b/src/lib/krb5/os/dnsglue.c
@@ -91,7 +91,7 @@ static int initparse(struct krb5int_dns_state *);
 #define DECLARE_HANDLE(h) struct __res_state h
 #define INIT_HANDLE(h) (memset(&h, 0, sizeof(h)), res_ninit(&h) == 0)
 #define SEARCH(h, n, c, t, a, l) res_nsearch(&h, n, c, t, a, l)
-#define PRIMARY_DOMAIN(h) strdup(h.dnsrch[0])
+#define PRIMARY_DOMAIN(h) ((h.dnsrch[0] == NULL) ? NULL : strdup(h.dnsrch[0]))
 #if HAVE_RES_NDESTROY
 #define DESTROY_HANDLE(h) res_ndestroy(&h)
 #else
@@ -104,7 +104,8 @@ static int initparse(struct krb5int_dns_state *);
 #define DECLARE_HANDLE(h)
 #define INIT_HANDLE(h) (res_init() == 0)
 #define SEARCH(h, n, c, t, a, l) res_search(n, c, t, a, l)
-#define PRIMARY_DOMAIN(h) strdup(_res.defdname)
+#define PRIMARY_DOMAIN(h) \
+    ((_res.defdname == NULL) ? NULL : strdup(_res.defdname))
 #define DESTROY_HANDLE(h)

 #endif


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

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

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

 #include "testing.h"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 } modprobe_flags_t;

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

 	recursion_depth = 0;
+ 	char *module_dir = NULL;

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

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

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


code:
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index 7553f87e..8e865c6c 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -37,19 +37,7 @@

 find_package(Miniupnpc REQUIRED)

-message(STATUS "Using in-tree miniupnpc")
-add_subdirectory(miniupnp/miniupnpc)
-set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
-if(MSVC)
-  set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
-elseif(NOT MSVC)
-  set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
-endif()
-if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
-	set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE")
-endif()
-
-set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
+set(UPNP_LIBRARIES "miniupnpc" PARENT_SCOPE)

 find_package(Unbound)

diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 74924e4f..3554dd0d 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -49,9 +49,9 @@
 #include "storages/levin_abstract_invoke2.h"
 #include "cryptonote_core/cryptonote_core.h"

-#include <miniupnp/miniupnpc/miniupnpc.h>
-#include <miniupnp/miniupnpc/upnpcommands.h>
-#include <miniupnp/miniupnpc/upnperrors.h>
+#include <miniupnpc/miniupnpc.h>
+#include <miniupnpc/upnpcommands.h>
+#include <miniupnpc/upnperrors.h>

 #undef MONERO_DEFAULT_LOG_CATEGORY
 #define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"


code:
--- mono-4.4.1/mcs/class/monodoc/Monodoc/storage/ZipStorage.cs.orig	2018-11-26 22:16:25.008879747 +0100
+++ mono-4.4.1/mcs/class/monodoc/Monodoc/storage/ZipStorage.cs	2018-11-26 22:21:53.969770985 +0100
@@ -74,6 +74,12 @@
 				id = GetNewCode ();

 			ZipEntry entry = new ZipEntry (id);
+			var SOURCE_DATE_EPOCH_string = Environment.GetEnvironmentVariable("SOURCE_DATE_EPOCH");
+			if (SOURCE_DATE_EPOCH_string != null)
+			{
+				var SOURCE_DATE_EPOCH = Convert.ToInt64(SOURCE_DATE_EPOCH_string);
+				entry.DateTime = new DateTime(SOURCE_DATE_EPOCH, DateTimeKind.Utc);
+			}
 			zipOutput.PutNextEntry (entry);
 		}


code:
--- a/src/CMakeLists.txt	2021-05-28 13:07:25.655107983 +0200
+++ b/src/CMakeLists.txt	2021-05-28 13:09:55.764025497 +0200
@@ -21,24 +21,6 @@

-### Link HTSlib
-
-ExternalProject_Add(htslib
-    PREFIX ${CMAKE_BINARY_DIR}/htslib
-    GIT_REPOSITORY "https://github.com/samtools/htslib.git"
-    GIT_TAG "1.3.1"
-    UPDATE_COMMAND ""
-    BUILD_IN_SOURCE 1
-    CONFIGURE_COMMAND ""
-    BUILD_COMMAND make
-    INSTALL_COMMAND make install prefix=${CMAKE_BINARY_DIR}/htslib
-    LOG_DOWNLOAD 1
-)
-link_directories (${CMAKE_BINARY_DIR}/htslib/lib)
-include_directories (${CMAKE_BINARY_DIR}/htslib/include)
-
-
-
 ### Set version

 # Get the current working branch
@@ -64,13 +46,6 @@

 # 2. Boost version from find_package (Boost_VERSION)

-# 3. Get HTSlib version from git
-execute_process(
-    COMMAND git describe --always
-    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/htslib
-    OUTPUT_VARIABLE HTSLIB_VERSION
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-)
 set(HTSLIB_VERSION "1.3.1 ${HTSLIB_VERSION}")

 # 4. write version.hpp file
@@ -105,7 +80,6 @@
 add_executable (mosaic main.cpp ${HEADER_FILES})
 target_link_libraries (mosaic LINK_PUBLIC ${Boost_LIBRARIES})
 target_link_libraries (mosaic LINK_PUBLIC hts)
-add_dependencies (mosaic htslib)

 ### Doxygen API documentation


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

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

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

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

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


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

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

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


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

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

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

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

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

 install:: js-config.h


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

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

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

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

 if test -n "$IS_ALPHA"; then

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

     ContinuousSpace<EventEntry> events;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

 fi

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

 AR_FLAGS='crs $@'

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

 fi # COMPILE_ENVIRONMENT

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


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

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

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


code:
This patch was downloaded from https://sourceforge.net/p/mpg321/bugs/51/ and
fixes CVE-2019-14247.

Description: Handle illegal bitrate value
Author: Chrysostomos Nanakos <cnanakos@debian.org>
Bug-Debian: https://bugs.debian.org/870406
Bug-Debian: https://bugs.debian.org/887057

--- mpg321-0.3.2.orig/mad.c
+++ mpg321-0.3.2/mad.c
@@ -574,6 +574,12 @@ void scan(void const *ptr, ssize_t len,

     if (!is_vbr)
     {
+	if (header.bitrate <= 0)
+        {
+            fprintf(stderr, "Illegal bit allocation value\n");
+            return;
+        }
+
         double time = (len * 8.0) / (header.bitrate); /* time in seconds */
         double timefrac = (double)time - ((long)(time));
         long nsamples = 32 * MAD_NSBSAMPLES(&header); /* samples per frame */


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

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

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

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

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

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

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

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

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

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

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

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

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

     love.graphics.clear()

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

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

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

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

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


code:
Fix a bug whereby 'mformat' could end up passing uninitialized bytes
to write(2).  This could be reproduced with:

  mformat -C -f 1440 -L 16  -N 77777777 -i  /tmp/x ::

where the output of /tmp/x would be non-deterministic.

Patch by Ludovic Courtès <ludo@gnu.org>.

--- mtools-4.0.23/mformat.c	2019-04-21 00:12:01.496116195 +0200
+++ mtools-4.0.23/mformat.c	2019-04-21 00:12:36.675967157 +0200
@@ -927,6 +927,7 @@ void mformat(int argc, char **argv, int

 	char *endptr;

+	memset(&boot.bytes, '\0', sizeof boot);
 	hs = hs_set = 0;
 	argtracks = 0;
 	argheads = 0;


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

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

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


code:
Create a shared version of the sequential library, MUST BE LAST IN SERIES

Index: mumps/libseq/Makefile
===================================================================
--- mumps.orig/libseq/Makefile
+++ mumps/libseq/Makefile
@@ -8,15 +8,17 @@ all: libmpiseq

 include ../Makefile.inc

-libmpiseq: libmpiseq$(PLAT)$(LIBEXT)
+libmpiseq: libmpiseq$(PLAT).a libmpiseq$(PLAT).so

-libmpiseq$(PLAT)$(LIBEXT): mpi.o mpic.o elapse.o
-	$(AR)$@ mpi.o mpic.o elapse.o
+libmpiseq$(PLAT).a: mpi.o mpic.o elapse.o
+	$(AR) $@ mpi.o mpic.o elapse.o
 	$(RANLIB) $@
+libmpiseq$(PLAT).so: mpi.o mpic.o elapse.o
+	$(FC) -shared $^ -Wl,-soname,libmpiseq$(PLAT)-5.2.1.so -o libmpiseq$(PLAT)-5.2.1.so -Wl,-z,defs
 .f.o:
-	$(FC) $(OPTF)              -c $*.f $(OUTF)$*.o
+	$(FC) $(OPTF)              -fPIC -c $*.f $(OUTF)$*.o
 .c.o:
-	$(CC) $(OPTC) $(CDEFS) -I. -c $*.c $(OUTC)$*.o
+	$(CC) $(OPTC) $(CDEFS) -I. -fPIC -c $*.c $(OUTC)$*.o

 clean:
-	$(RM) *.o *$(LIBEXT)
+	$(RM) *.o *.a *.so
Index: mumps/Makefile
===================================================================
--- mumps.orig/Makefile
+++ mumps/Makefile
@@ -60,6 +60,7 @@ requiredobj: Makefile.inc $(LIBSEQNEEDED

 libseqneeded:
 	(cd libseq; $(MAKE))
+	cp libseq/lib* $(libdir)

 # Build the libpord.a library and copy it into $(topdir)/lib
 $(libdir)/libpord$(PLAT).a: