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 ''')

license: mit


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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

     love.graphics.clear()

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

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

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

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

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


code:
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:
Fix various compiler warnings when built without systemd.

Submitted upstream at <https://www.redhat.com/archives/dm-devel/2020-May/thread.html>.

diff --git a/libmultipath/config.c b/libmultipath/config.c
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -696,7 +696,7 @@ process_config_dir(struct config *conf, char *dir)
 	pthread_cleanup_pop(1);
 }

-static void set_max_checkint_from_watchdog(struct config *conf)
+static void set_max_checkint_from_watchdog(__attribute__((unused)) struct config *conf)
 {
 #ifdef USE_SYSTEMD
 	char *envp = getenv("WATCHDOG_USEC");
diff --git a/multipathd/main.c b/multipathd/main.c
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -176,6 +176,7 @@ daemon_status(void)
 /*
  * I love you too, systemd ...
  */
+#ifdef USE_SYSTEMD
 static const char *
 sd_notify_status(enum daemon_status state)
 {
@@ -195,7 +196,6 @@ sd_notify_status(enum daemon_status state)
 	return NULL;
 }

-#ifdef USE_SYSTEMD
 static void do_sd_notify(enum daemon_status old_state,
 			 enum daemon_status new_state)
 {
@@ -247,7 +247,9 @@ enum daemon_status wait_for_state_change_if(enum daemon_status oldstate,
 static void __post_config_state(enum daemon_status state)
 {
 	if (state != running_state && running_state != DAEMON_SHUTDOWN) {
-		enum daemon_status old_state = running_state;
+		/* save state for sd_notify */
+		enum daemon_status
+			__attribute__((unused)) old_state = running_state;

 		running_state = state;
 		pthread_cond_broadcast(&config_cond);
@@ -272,7 +274,9 @@ int set_config_state(enum daemon_status state)
 	pthread_cleanup_push(config_cleanup, NULL);
 	pthread_mutex_lock(&config_lock);
 	if (running_state != state) {
-		enum daemon_status old_state = running_state;
+		/* save state for sd_notify */
+		enum daemon_status
+			__attribute__((unused)) old_state = running_state;

 		if (running_state == DAEMON_SHUTDOWN)
 			rc = EINVAL;
@@ -2280,7 +2284,6 @@ checkerloop (void *ap)
 	struct timespec last_time;
 	struct config *conf;
 	int foreign_tick = 0;
-	bool use_watchdog;

 	pthread_cleanup_push(rcu_unregister, NULL);
 	rcu_register_thread();
@@ -2292,11 +2295,15 @@ checkerloop (void *ap)
 	get_monotonic_time(&last_time);
 	last_time.tv_sec -= 1;

-	/* use_watchdog is set from process environment and never changes */
 	conf = get_multipath_config();
-	use_watchdog = conf->use_watchdog;
 	put_multipath_config(conf);

+#ifdef USE_SYSTEMD
+	/* use_watchdog is set from process environment and never changes */
+	bool use_watchdog;
+	use_watchdog = conf->use_watchdog;
+#endif
+
 	while (1) {
 		struct timespec diff_time, start_time, end_time;
 		int num_paths = 0, strict_timing, rc = 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:


code:
Create a shared version of the MUMPS library.

Index: mumps/src/Makefile
===================================================================
--- mumps.orig/src/Makefile
+++ mumps/src/Makefile
@@ -23,8 +23,10 @@ z:

 include $(topdir)/Makefile.inc

-mumps_lib:    $(libdir)/libmumps_common$(PLAT)$(LIBEXT) \
-              $(libdir)/lib$(ARITH)mumps$(PLAT)$(LIBEXT)
+mumps_lib:    $(libdir)/libmumps_common$(PLAT).a \
+              $(libdir)/libmumps_common$(PLAT).so \
+              $(libdir)/lib$(ARITH)mumps$(PLAT).a \
+              $(libdir)/lib$(ARITH)mumps$(PLAT).so

 OBJS_COMMON_MOD = \
         lr_common.o \
@@ -167,14 +169,22 @@ OBJS_OTHER = \
         $(ARITH)tools.o\
         $(ARITH)type3_root.o

-$(libdir)/libmumps_common$(PLAT)$(LIBEXT):      $(OBJS_COMMON_MOD) $(OBJS_COMMON_OTHER)
-	$(AR)$@ $?
+$(libdir)/libmumps_common$(PLAT).a:      $(OBJS_COMMON_MOD) $(OBJS_COMMON_OTHER)
+	$(AR) $@ $?
 	$(RANLIB) $@

-$(libdir)/lib$(ARITH)mumps$(PLAT)$(LIBEXT):    $(OBJS_MOD) $(OBJS_OTHER)
-	$(AR)$@ $?
+$(libdir)/libmumps_common$(PLAT).so:      $(OBJS_COMMON_MOD) $(OBJS_COMMON_OTHER)
+	$(FC) -shared $^ -Wl,-soname,libmumps_common$(PLAT)-5.2.1.so -L$(libdir) $(LORDERINGS) -lpthread $(MPIFLIB) $(MPICLIB) $(LEXTRAS) -o $(libdir)/libmumps_common$(PLAT)-5.2.1.so -Wl,-z,defs
+	ln -s libmumps_common$(PLAT)-5.2.1.so $@
+
+$(libdir)/lib$(ARITH)mumps$(PLAT).a:    $(OBJS_MOD) $(OBJS_OTHER)
+	$(AR) $@ $?
 	$(RANLIB) $@

+$(libdir)/lib$(ARITH)mumps$(PLAT).so:    $(OBJS_MOD) $(OBJS_OTHER)
+	$(FC) -shared $^ -Wl,-soname,lib$(ARITH)mumps$(PLAT)-5.2.1.so -L$(libdir) -lmumps_common$(PLAT) $(LORDERINGS) $(MPIFLIB) $(LEXTRAS) $(LIBBLAS) $(SCALAP) $(LAPACK) -o $(libdir)/lib$(ARITH)mumps$(PLAT)-5.2.1.so -Wl,-z,defs
+	ln -s lib$(ARITH)mumps$(PLAT)-5.2.1.so $@
+
 # Dependencies between modules:
 $(ARITH)mumps_load.o:		$(ARITH)mumps_comm_buffer.o \
 				$(ARITH)mumps_struc_def.o \
@@ -290,13 +300,13 @@ $(OBJS_OTHER):$(OBJS_COMMON_MOD) $(OBJS_

 .SUFFIXES: .c .F .o
 .F.o:
-	$(FC) $(OPTF) $(INCS) $(IORDERINGSF) $(ORDERINGSF) -I. -I../include -c $*.F $(OUTF)$*.o
+	$(FC) $(OPTF) $(INCS) $(IORDERINGSF) $(ORDERINGSF) -I. -I../include -fPIC -c $*.F $(OUTF)$*.o
 .c.o:
-	$(CC) $(OPTC) $(INCS) -I../include $(CDEFS) $(IORDERINGSC) $(ORDERINGSC) -c $*.c $(OUTC)$*.o
+	$(CC) $(OPTC) $(INCS) -I../include $(CDEFS) $(IORDERINGSC) $(ORDERINGSC) -fPIC -c $*.c $(OUTC)$*.o

 $(ARITH)mumps_c.o:	mumps_c.c
 	$(CC) $(OPTC) $(INCS) $(CDEFS) -DMUMPS_ARITH=MUMPS_ARITH_$(ARITH) \
-	      $(IORDERINGSC) $(ORDERINGSC) -I../include -c mumps_c.c $(OUTC)$@
+	      $(IORDERINGSC) $(ORDERINGSC) -I../include -fPIC -c mumps_c.c $(OUTC)$@

 clean:


code:
Create static and shared versions of the PORD library.

Index: mumps/PORD/lib/Makefile
===================================================================
--- mumps.orig/PORD/lib/Makefile
+++ mumps/PORD/lib/Makefile
@@ -9,7 +9,7 @@

 INCLUDES = -I../include

-COPTIONS = $(INCLUDES) $(CFLAGS) $(OPTFLAGS)
+COPTIONS = $(INCLUDES) $(CFLAGS) $(OPTFLAGS) -fPIC

 OBJS = graph.o gbipart.o gbisect.o ddcreate.o ddbisect.o nestdiss.o \
        multisector.o gelim.o bucket.o tree.o \
@@ -24,12 +24,16 @@ OBJS = graph.o gbipart.o gbisect.o ddcre
 .c.o:
 	$(CC) $(COPTIONS) -c $*.c $(OUTC)$*.o

-libpord$(LIBEXT):$(OBJS)
-	$(AR)$@ $(OBJS)
+libpord$(PLAT).a:$(OBJS)
+	$(AR) $@ $(OBJS)
 	$(RANLIB) $@

+libpord$(PLAT).so: $(OBJS)
+	$(CC) -shared $(OBJS) -Wl,-soname,libpord$(PLAT)-5.2.1.so -o libpord$(PLAT)-5.2.1.so -Wl,-z,defs
+	ln -s libpord$(PLAT)-5.2.1.so $@
+
 clean:
 	rm -f *.o

 realclean:
-	rm -f *.o libpord.a
+	rm -f *.o libpord*.a *.so
Index: mumps/Makefile
===================================================================
--- mumps.orig/Makefile
+++ mumps/Makefile
@@ -54,7 +54,7 @@ dexamples:	d
 multi_example:	s d c z
 	(cd examples ; $(MAKE) multi)

-requiredobj: Makefile.inc $(LIBSEQNEEDED) $(libdir)/libpord$(PLAT)$(LIBEXT)
+requiredobj: Makefile.inc $(LIBSEQNEEDED) $(libdir)/libpord$(PLAT).a $(libdir)/libpord$(PLAT).so

 # dummy MPI library (sequential version)

@@ -62,19 +62,25 @@ libseqneeded:
 	(cd libseq; $(MAKE))

 # Build the libpord.a library and copy it into $(topdir)/lib
-$(libdir)/libpord$(PLAT)$(LIBEXT):
+$(libdir)/libpord$(PLAT).a:
 	if [ "$(LPORDDIR)" != "" ] ; then \
 	  cd $(LPORDDIR); \
 	  $(MAKE) CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" RANLIB="$(RANLIB)" OUTC="$(OUTC)" LIBEXT=$(LIBEXT); \
 	fi;
 	if [ "$(LPORDDIR)" != "" ] ; then \
-	  cp $(LPORDDIR)/libpord$(LIBEXT) $@; \
+	  cp $(LPORDDIR)/libpord$(PLAT).a $@; \
 	fi;

+$(libdir)/libpord$(PLAT).so:
+	if [ "$(LPORDDIR)" != "" ] ; then \
+	cd $(LPORDDIR); make CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" ARFUNCT= RANLIB="$(RANLIB)" libpord$(PLAT).so; fi;
+	if [ "$(LPORDDIR)" != "" ] ; then \
+	cp -a $(LPORDDIR)/libpord*.so lib/; fi;
+
 clean:
 	(cd src; $(MAKE) clean)
 	(cd examples; $(MAKE) clean)
-	(cd $(libdir); $(RM) *$(PLAT)$(LIBEXT))
+	(cd $(libdir); $(RM) *$(PLAT).a *$(PLAT).so)
 	(cd libseq; $(MAKE) clean)
 	if [ "$(LPORDDIR)" != "" ] ; then \
 	  cd $(LPORDDIR); $(MAKE) realclean; \


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

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

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


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

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

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

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


code:
Disable locales other than C and POSIX because of a compilation error.
By Danny Milosavljevic <dannym@scratchpost.org>
This patch is distributed under BSD-3 license.
See https://github.com/osresearch/heads/pull/610
diff -ruN b/source/patches/gcc-5.3.0-locale.diff guix-build-musl-cross-0.1-3.a8a6649.drv-12/source/patches/gcc-5.3.0-locale.diff
--- a/patches/gcc-5.3.0-locale.diff	1970-01-01 01:00:00.000000000 +0100
+++ b/patches/gcc-5.3.0-locale.diff	2020-05-02 14:20:47.213564509 +0200
@@ -0,0 +1,12 @@
+--- gcc-5.3.0/libstdc++-v3/config/locale/gnu/ctype_members.cc.orig	2020-05-02 14:16:31.376147000 +0200
++++ gcc-5.3.0/libstdc++-v3/config/locale/gnu/ctype_members.cc	2020-05-02 14:16:56.716279576 +0200
+@@ -47,7 +47,8 @@
+ 	this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
+ 	this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
+ 	this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
+-	this->_M_table = this->_M_c_locale_ctype->__ctype_b;
++	//this->_M_table = this->_M_c_locale_ctype->__ctype_b;
++	throw 3;
+       }
+   }
+


code:
By default 'mutt' embeds configure flags and the output of 'gcc -v',
which contains the store file name of Bash and GCC.  This patch makes
sure we don't embed a reference to these in 'mutt'.

--- mutt-1.5.23/txt2c.sh	2015-06-26 22:56:56.500731643 +0200
+++ mutt-1.5.23/txt2c.sh	2015-06-26 22:57:26.664583900 +0200
@@ -21,6 +21,8 @@ txt2c_fallback () {
 	echo ";"
 }

+echo "unsigned char $1[] = \"value of '$1' not kept\";"
+exit 0
 ./txt2c test </dev/null >/dev/null 2>&1 &&
 ./txt2c "$1" ||
 txt2c_fallback "$1"


code:
Patch taken from Debian sid.  Adapted to 4.2.4.6 for Guix by Tobias
Geerinckx-Rice <me@tobias.gr>.

Description: Support uncompressing and compressing soft links.
 Historically, ncompress for Debian has been built using a command line
 directly in debian/rules.  For 4.2.4.5-1, I simplified by swtching to the
 upstream Makefile.  However, that caused a regression - the Debian version of
 ncompress has always successfully handled soft links, but this stopped
 working.  To revert to the original behavior, I need to remove -DLSTAT from
 the build options, to be consistent with how the code was previously built.
Author: Kenneth J. Pronovici <pronovic@debian.org>
Bug-Debian: http://bugs.debian.org/918836
Index: ncompress/GNUmakefile
===================================================================
--- ncompress.orig/GNUmakefile
+++ ncompress/GNUmakefile
@@ -9,7 +9,7 @@ distclean: cleanup

 Makefile: Makefile.def GNUmakefile
 	sed \
-		-e 's:options= :options= -DUTIME_H -DLSTAT :' \
+		-e 's:options= :options= -DUTIME_H :' \
 		Makefile.def > Makefile

 check:


code:
--- a/libdispatch/derror.c
+++ b/libdispatch/derror.c
@@ -13,7 +13,7 @@
 #endif

 /* Tell the user the version of netCDF. */
-static const char nc_libvers[] = PACKAGE_VERSION " of "__DATE__" "__TIME__" $";
+static const char nc_libvers[] = PACKAGE_VERSION" $";

 /**
 \defgroup lib_version Library Version


code:
From a83702834938b23cc2e843589aa223e2024a7e6f Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion@cora.nwra.com>
Date: Tue, 29 Nov 2016 11:48:01 -0700
Subject: [PATCH] Add missing #include "err_macros.h" to tst_h_par.c

---
 h5_test/tst_h_par.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/h5_test/tst_h_par.c b/h5_test/tst_h_par.c
index c3da7f4..a419d55 100644
--- a/h5_test/tst_h_par.c
+++ b/h5_test/tst_h_par.c
@@ -11,6 +11,7 @@
    $Id: tst_h_par.c,v 1.15 2010/05/25 13:53:04 ed Exp $
 */
 #include <nc_tests.h>
+#include "err_macros.h"
 #include <hdf5.h>

 /* Defining USE_MPE causes the MPE trace library to be used (and you


code:
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Thu, 28 Feb 2019 20:29:00 +0100
Subject: [PATCH] netpbm: Fix CVE-2017-2586.

Copied verbatim from Debian[0].

[0]: https://sources.debian.org/data/main/n/netpbm-free/2:10.78.05-0.1/debian/patches/netpbm-CVE-2017-2586.patch

---
diff -urNp old/converter/other/svgtopam.c new/converter/other/svgtopam.c
--- old/converter/other/svgtopam.c	2017-02-08 12:11:02.593690917 +0100
+++ new/converter/other/svgtopam.c	2017-02-08 12:13:05.192846469 +0100
@@ -676,7 +676,7 @@ stringToUint(const char *   const string

     /* TODO: move this to nstring.c */

-    if (strlen(string) == 0)
+    if (string == NULL || strlen(string) == 0)
         pm_asprintf(errorP, "Value is a null string");
     else {
         char * tailptr;


code:
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Thu, 28 Feb 2019 20:29:00 +0100
Subject: [PATCH] netpbm: Fix CVE-2017-2587.

Copied verbatim from Debian[0].

[0]: https://sources.debian.org/data/main/n/netpbm-free/2:10.78.05-0.1/debian/patches/netpbm-CVE-2017-2587.patch

---
diff -urNp old/converter/other/svgtopam.c new/converter/other/svgtopam.c
--- old/converter/other/svgtopam.c	2017-02-08 12:11:02.593690917 +0100
+++ new/converter/other/svgtopam.c	2017-02-08 13:49:38.319029371 +0100
@@ -771,12 +771,17 @@ createCanvas(unsigned int const width,

     MALLOCVAR_NOFAIL(canvasP);

-    canvasP->width  = width;
-    canvasP->height = height;
-    canvasP->pixels = ppm_allocarray(width, height);
-    canvasP->maxval = maxval;
+    if(canvasP != NULL){
+        canvasP->width  = width;
+        canvasP->height = height;
+        canvasP->pixels = ppm_allocarray(width, height);
+        canvasP->maxval = maxval;
+
+        *canvasPP = canvasP;
+    } else {
+       pm_error("can't allocate memory for canvas");
+    }

-    *canvasPP = canvasP;
 }


code:
Increase the timeout on dictionary tests to accommodate slower machines.

--- netsurf-3.6/test/hashtable.c
+++ netsurf-3.6/test/hashtable.c
@@ -286,6 +286,7 @@
 	tcase_add_checked_fixture(tc_dict_s,
 				  dicts_hashtable_create,
 				  dict_hashtable_teardown);
+	tcase_set_timeout(tc_dict_s, 30);

 	tcase_add_test(tc_dict_s, hashtable_dict_test);

@@ -297,6 +298,7 @@
 	tcase_add_checked_fixture(tc_dict_l,
 				  dictl_hashtable_create,
 				  dict_hashtable_teardown);
+	tcase_set_timeout(tc_dict_l, 30);

 	tcase_add_test(tc_dict_l, hashtable_dict_test);


code:
Fix include directory for system utf8proc.

--- netsurf-3.10/utils/idna.c
+++ netsurf-3.10/utils/idna.c
@@ -167,7 +167,7 @@

 #ifdef WITH_UTF8PROC

-#include <libutf8proc/utf8proc.h>
+#include <utf8proc.h>

 int32_t idna_contexto[] = {
 	/* CONTEXTO codepoints which have a rule defined */


code:
From d3026a6d331298003ccc6cd9d2e20dcb7fa9ae1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20=C4=8Cech?= <sleep_walker@gnu.org>
Date: Wed, 3 Jul 2019 13:31:54 +0200
Subject: [PATCH] respect NM_VPN_PLUGIN_DIR

---
 src/vpn/nm-vpn-manager.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/vpn/nm-vpn-manager.c b/src/vpn/nm-vpn-manager.c
index d063916..d779166 100644
--- a/src/vpn/nm-vpn-manager.c
+++ b/src/vpn/nm-vpn-manager.c
@@ -223,6 +223,7 @@ nm_vpn_manager_init (NMVpnManager *self)
 	GSList *infos, *info;
 	const char *conf_dir_etc = _nm_vpn_plugin_info_get_default_dir_etc ();
 	const char *conf_dir_lib = _nm_vpn_plugin_info_get_default_dir_lib ();
+	const char *conf_dir_user = _nm_vpn_plugin_info_get_default_dir_user ();

 	/* Watch the VPN directory for changes */
 	file = g_file_new_for_path (conf_dir_lib);
@@ -241,6 +242,14 @@ nm_vpn_manager_init (NMVpnManager *self)
 		                                         G_CALLBACK (vpn_dir_changed), self);
 	}

+	file = g_file_new_for_path (conf_dir_user);
+	priv->monitor_etc = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);
+	g_object_unref (file);
+	if (priv->monitor_etc) {
+		priv->monitor_id_etc = g_signal_connect (priv->monitor_etc, "changed",
+		                                         G_CALLBACK (vpn_dir_changed), self);
+	}
+
 	/* first read conf_dir_lib. The name files are not really user configuration, but
 	 * plugin configuration. Hence we expect ~newer~ plugins to install their files
 	 * in /usr/lib/NetworkManager. We want to prefer those files.
@@ -255,6 +264,11 @@ nm_vpn_manager_init (NMVpnManager *self)
 		try_add_plugin (self, info->data);
 	g_slist_free_full (infos, g_object_unref);

+	infos = _nm_vpn_plugin_info_list_load_dir (conf_dir_user, TRUE, 0, NULL, NULL);
+	for (info = infos; info; info = info->next)
+		try_add_plugin (self, info->data);
+	g_slist_free_full (infos, g_object_unref);
+
 	priv->active_services = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
 }

--
2.22.0


code:
Remove fixed search paths from autotools.

--- a/m4/package_utilies.m4	1970-01-01 01:00:01.000000000 +0100
+++ b/m4/package_utilies.m4	2020-07-07 12:41:48.871661042 +0200
@@ -23,32 +23,32 @@
     AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])

     if test -z "$MAKE"; then
-        AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/freeware/bin)
+        AC_PATH_PROG(MAKE, gmake)
     fi
     if test -z "$MAKE"; then
-        AC_PATH_PROG(MAKE, make,, /usr/bin)
+        AC_PATH_PROG(MAKE, make)
     fi
     make=$MAKE
     AC_SUBST(make)
     AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])

     if test -z "$LIBTOOL"; then
-	AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
+	AC_PATH_PROG(LIBTOOL, glibtool)
     fi
     if test -z "$LIBTOOL"; then
-	AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
+	AC_PATH_PROG(LIBTOOL, libtool)
     fi
     libtool=$LIBTOOL
     AC_SUBST(libtool)
     AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])

     if test -z "$TAR"; then
-        AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
+        AC_PATH_PROG(TAR, tar)
     fi
     tar=$TAR
     AC_SUBST(tar)
     if test -z "$ZIP"; then
-        AC_PATH_PROG(ZIP, gzip,, /bin:/usr/local/bin:/usr/freeware/bin)
+        AC_PATH_PROG(ZIP, gzip)
     fi

     zip=$ZIP
@@ -61,25 +61,25 @@
     AC_SUBST(makedepend)

     if test -z "$AWK"; then
-        AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
+        AC_PATH_PROG(AWK, awk)
     fi
     awk=$AWK
     AC_SUBST(awk)

     if test -z "$SED"; then
-        AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
+        AC_PATH_PROG(SED, sed)
     fi
     sed=$SED
     AC_SUBST(sed)

     if test -z "$ECHO"; then
-        AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
+        AC_PATH_PROG(ECHO, echo)
     fi
     echo=$ECHO
     AC_SUBST(echo)

     if test -z "$SORT"; then
-        AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
+        AC_PATH_PROG(SORT, sort)
     fi
     sort=$SORT
     AC_SUBST(sort)


code:
The Guile process taking the role of PID 1 during Guix builds does not reap
zombie processes, which makes them continue responding to "kill -0".

--- a/src/testsuite/stop-server.sh	2015-02-05 11:24:00.535908842 +0100
+++ b/src/testsuite/stop-server.sh	2015-02-05 11:25:00.264351349 +0100
@@ -1,6 +1,21 @@
 #!/bin/sh
 # ngIRCd Test Suite

+process_is_alive(){
+    ! process_is_dead "$1" && ! process_is_undead "$1"
+}
+
+process_is_dead(){
+    ! kill -0 "$1"
+}
+
+process_is_undead(){
+    case $(ps -p "$1" -o state=) in
+        (Z*) true ;;
+        (*) false ;;
+    esac
+}
+
 [ -z "$srcdir" ] && srcdir=`dirname $0`

 # read in functions
@@ -24,7 +40,7 @@

 # waiting ...
 for i in 1 2 3 4 5; do
-  kill -0 $pid > /dev/null 2>&1; r=$?
+  process_is_alive $pid > /dev/null 2>&1; r=$?
   if [ $r -ne 0 ]; then
     echo " ok".
     exit 0


code:
We've seen some tests take up to 60s to complete on a busy armhf
machine. Even a busy x86_64 machine can use more than 5s on some tests.

Increase timeouts to increase chances of a successful build.

--- a/nss/gtests/ssl_gtest/tls_connect.cc	2017-03-14 22:47:30.855813629 +0100
+++ b/nss/gtests/ssl_gtest/tls_connect.cc	2017-03-14 22:48:49.042335273 +0100
@@ -245,7 +245,7 @@

   ASSERT_TRUE_WAIT((client_->state() != TlsAgent::STATE_CONNECTING) &&
                        (server_->state() != TlsAgent::STATE_CONNECTING),
-                   5000);
+                   300000);
 }

 void TlsConnectTestBase::EnableExtendedMasterSecret() {
@@ -385,7 +385,7 @@
   if (failing_side == TlsAgent::CLIENT) {
     failing_agent = client_;
   }
-  ASSERT_TRUE_WAIT(failing_agent->state() == TlsAgent::STATE_ERROR, 5000);
+  ASSERT_TRUE_WAIT(failing_agent->state() == TlsAgent::STATE_ERROR, 300000);
 }

 void TlsConnectTestBase::ConfigureVersion(uint16_t version) {


code:
Description: Create nss.pc and nss-config
Author: Lars Wendler <polynomial-c@gentoo.org>
Source: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/nss/files/nss-3.17.1-gentoo-fixups.patch

Modifications:
  Change libdir from ${prefix}/lib64 to ${prefix}/lib/nss.
  Remove optional patching in nss/Makefile.
  Include -L$libdir in output from "nss-config --libs".

Later adapted to apply cleanly to nss-3.21.

--- nss-3.21/nss/config/Makefile
+++ nss-3.21/nss/config/Makefile
@@ -0,0 +1,40 @@
+CORE_DEPTH = ..
+DEPTH      = ..
+
+include $(CORE_DEPTH)/coreconf/config.mk
+
+NSS_MAJOR_VERSION = `grep "NSS_VMAJOR" ../lib/nss/nss.h | awk '{print $$3}'`
+NSS_MINOR_VERSION = `grep "NSS_VMINOR" ../lib/nss/nss.h | awk '{print $$3}'`
+NSS_PATCH_VERSION = `grep "NSS_VPATCH" ../lib/nss/nss.h | awk '{print $$3}'`
+PREFIX = /usr
+
+all: export libs
+
+export:
+	# Create the nss.pc file
+	mkdir -p $(DIST)/lib/pkgconfig
+	sed -e "s,@prefix@,$(PREFIX)," \
+	    -e "s,@exec_prefix@,\$${prefix}," \
+	    -e "s,@libdir@,\$${prefix}/lib/nss," \
+	    -e "s,@includedir@,\$${prefix}/include/nss," \
+	    -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION),g" \
+	    -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \
+	    -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \
+	    nss.pc.in > nss.pc
+	chmod 0644 nss.pc
+	cp nss.pc $(DIST)/lib/pkgconfig
+
+	# Create the nss-config script
+	mkdir -p $(DIST)/bin
+	sed -e "s,@prefix@,$(PREFIX)," \
+	    -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION)," \
+	    -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \
+	    -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \
+	    nss-config.in > nss-config
+	chmod 0755 nss-config
+	cp nss-config $(DIST)/bin
+
+libs:
+
+dummy: all export libs
+
--- nss-3.21/nss/config/nss-config.in
+++ nss-3.21/nss/config/nss-config.in
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+prefix=@prefix@
+
+major_version=@NSS_MAJOR_VERSION@
+minor_version=@NSS_MINOR_VERSION@
+patch_version=@NSS_PATCH_VERSION@
+
+usage()
+{
+	cat <<EOF
+Usage: nss-config [OPTIONS] [LIBRARIES]
+Options:
+	[--prefix[=DIR]]
+	[--exec-prefix[=DIR]]
+	[--includedir[=DIR]]
+	[--libdir[=DIR]]
+	[--version]
+	[--libs]
+	[--cflags]
+Dynamic Libraries:
+	nss
+	ssl
+	smime
+	nssutil
+EOF
+	exit $1
+}
+
+if test $# -eq 0; then
+	usage 1 1>&2
+fi
+
+lib_ssl=yes
+lib_smime=yes
+lib_nss=yes
+lib_nssutil=yes
+
+while test $# -gt 0; do
+  case "$1" in
+  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  case $1 in
+    --prefix=*)
+      prefix=$optarg
+      ;;
+    --prefix)
+      echo_prefix=yes
+      ;;
+    --exec-prefix=*)
+      exec_prefix=$optarg
+      ;;
+    --exec-prefix)
+      echo_exec_prefix=yes
+      ;;
+    --includedir=*)
+      includedir=$optarg
+      ;;
+    --includedir)
+      echo_includedir=yes
+      ;;
+    --libdir=*)
+      libdir=$optarg
+      ;;
+    --libdir)
+      echo_libdir=yes
+      ;;
+    --version)
+      echo ${major_version}.${minor_version}.${patch_version}
+      ;;
+    --cflags)
+      echo_cflags=yes
+      ;;
+    --libs)
+      echo_libs=yes
+      ;;
+    ssl)
+      lib_ssl=yes
+      ;;
+    smime)
+      lib_smime=yes
+      ;;
+    nss)
+      lib_nss=yes
+      ;;
+    nssutil)
+      lib_nssutil=yes
+      ;;
+    *)
+      usage 1 1>&2
+      ;;
+  esac
+  shift
+done
+
+# Set variables that may be dependent upon other variables
+if test -z "$exec_prefix"; then
+    exec_prefix=`pkg-config --variable=exec_prefix nss`
+fi
+if test -z "$includedir"; then
+    includedir=`pkg-config --variable=includedir nss`
+fi
+if test -z "$libdir"; then
+    libdir=`pkg-config --variable=libdir nss`
+fi
+
+if test "$echo_prefix" = "yes"; then
+    echo $prefix
+fi
+
+if test "$echo_exec_prefix" = "yes"; then
+    echo $exec_prefix
+fi
+
+if test "$echo_includedir" = "yes"; then
+    echo $includedir
+fi
+
+if test "$echo_libdir" = "yes"; then
+    echo $libdir
+fi
+
+if test "$echo_cflags" = "yes"; then
+    echo -I$includedir
+fi
+
+if test "$echo_libs" = "yes"; then
+      libdirs=-L$libdir
+      if test -n "$lib_ssl"; then
+	libdirs="$libdirs -lssl${major_version}"
+      fi
+      if test -n "$lib_smime"; then
+	libdirs="$libdirs -lsmime${major_version}"
+      fi
+      if test -n "$lib_nss"; then
+	libdirs="$libdirs -lnss${major_version}"
+      fi
+      if test -n "$lib_nssutil"; then
+       libdirs="$libdirs -lnssutil${major_version}"
+      fi
+      echo $libdirs
+fi
+
--- nss-3.21/nss/config/nss.pc.in
+++ nss-3.21/nss/config/nss.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: NSS
+Description: Network Security Services
+Version: @NSS_MAJOR_VERSION@.@NSS_MINOR_VERSION@.@NSS_PATCH_VERSION@
+Requires: nspr >= 4.8
+Libs: -L${libdir} -lssl3 -lsmime3 -lnss3 -lnssutil3
+Cflags: -I${includedir}
+
--- nss-3.21/nss/manifest.mn
+++ nss-3.21/nss/manifest.mn
@@ -10,4 +10,4 @@

 RELEASE = nss

-DIRS = coreconf lib cmd cpputil gtests
+DIRS = coreconf lib cmd cpputil gtests config


code:
Fix CVE-2019-9755:

https://security-tracker.debian.org/tracker/CVE-2019-9755
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-9755

Patch copied from upstream source repository:

https://sourceforge.net/p/ntfs-3g/ntfs-3g/ci/85c1634a26faa572d3c558d4cf8aaaca5202d4e9/

From 85c1634a26faa572d3c558d4cf8aaaca5202d4e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= <jean-pierre.andre@wanadoo.fr>
Date: Wed, 19 Dec 2018 15:57:50 +0100
Subject: [PATCH] Fixed reporting an error when failed to build the mountpoint

The size check was inefficient because getcwd() uses an unsigned int
argument.
---
 src/lowntfs-3g.c | 6 +++++-
 src/ntfs-3g.c    | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c
index 993867fa..0660439b 100644
--- a/src/lowntfs-3g.c
+++ b/src/lowntfs-3g.c
@@ -4411,7 +4411,8 @@ int main(int argc, char *argv[])
 	else {
 		ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX);
 		if (ctx->abs_mnt_point) {
-			if (getcwd(ctx->abs_mnt_point,
+			if ((strlen(opts.mnt_point) < PATH_MAX)
+			    && getcwd(ctx->abs_mnt_point,
 				     PATH_MAX - strlen(opts.mnt_point) - 1)) {
 				strcat(ctx->abs_mnt_point, "/");
 				strcat(ctx->abs_mnt_point, opts.mnt_point);
@@ -4419,6 +4420,9 @@ int main(int argc, char *argv[])
 			/* Solaris also wants the absolute mount point */
 				opts.mnt_point = ctx->abs_mnt_point;
 #endif /* defined(__sun) && defined (__SVR4) */
+			} else {
+				free(ctx->abs_mnt_point);
+				ctx->abs_mnt_point = (char*)NULL;
 			}
 		}
 	}
diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c
index 6ce89fef..4e0912ae 100644
--- a/src/ntfs-3g.c
+++ b/src/ntfs-3g.c
@@ -4148,7 +4148,8 @@ int main(int argc, char *argv[])
 	else {
 		ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX);
 		if (ctx->abs_mnt_point) {
-			if (getcwd(ctx->abs_mnt_point,
+			if ((strlen(opts.mnt_point) < PATH_MAX)
+			    && getcwd(ctx->abs_mnt_point,
 				     PATH_MAX - strlen(opts.mnt_point) - 1)) {
 				strcat(ctx->abs_mnt_point, "/");
 				strcat(ctx->abs_mnt_point, opts.mnt_point);
@@ -4156,6 +4157,9 @@ int main(int argc, char *argv[])
 			/* Solaris also wants the absolute mount point */
 				opts.mnt_point = ctx->abs_mnt_point;
 #endif /* defined(__sun) && defined (__SVR4) */
+			} else {
+				free(ctx->abs_mnt_point);
+				ctx->abs_mnt_point = (char*)NULL;
 			}
 		}
 	}
--
2.21.0


code:
Make configure assume nvi can store backups in /var/tmp.

--- a/dist/configure	2014-09-01 14:46:01.075778095 +0200
+++ b/dist/configure	2014-09-01 14:52:08.411790122 +0200
@@ -21319,23 +21319,8 @@
 if test "${vi_cv_path_preserve+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  	dirlist="/var/preserve /var/tmp /usr/tmp"
-	vi_cv_path_preserve=no
-	for i in $dirlist; do
-		if test -d $i/vi.recover; then
-			vi_cv_path_preserve=$i/vi.recover
-			break;
-		fi
-	done
-	if test "$vi_cv_path_preserve" = no; then
-		for i in $dirlist; do
-			if test -d $i -a -w $i; then
-				vi_cv_path_preserve=$i/vi.recover
-				break;
-			fi
-		done
-
-	fi
+#	Assume /var/tmp
+	vi_cv_path_preserve=/var/tmp/vi.recover
 fi

 if test "$vi_cv_path_preserve" = no; then


code:
This patch originates from the Debian project, see https://www.debian.org/

03db4.dpatch  by  <hesso@pool.math.tu-berlin.de>

libdb4 compatibility adjustments.

In particular, this patch adds extra file permission checking and passes the
DB_CREATE flag to the first invocation of db_open on the file's database
structure, which rids us of the following message:

  BDB0635 DB_CREATE must be specified to create databases.

--- nvi-1.81.6.orig/common/msg.c	2009-02-26 14:26:58.350336128 +0100
+++ nvi-1.81.6/common/msg.c	2009-02-26 14:29:05.235335829 +0100
@@ -724,9 +724,18 @@
 		p = buf;
 	} else
 		p = file;
+	if (access(p, F_OK) != 0) {
+		if (first) {
+			first = 0;
+			return (1);
+		}
+		sp->db_error = ENOENT;
+		msgq_str(sp, M_DBERR, p, "%s");
+		return (1);
+	}
 	if ((sp->db_error = db_create(&db, 0, 0)) != 0 ||
 	    (sp->db_error = db->set_re_source(db, p)) != 0 ||
-	    (sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) {
+	    (sp->db_error = db_open(db, NULL, DB_RECNO, DB_CREATE, 0)) != 0) {
 		if (first) {
 			first = 0;
 			return (1);


code:
This patch originates from the Debian project, see https://www.debian.org/

18dbpagesize_binpower.dpatch by  <hesso@pool.math.tu-berlin.de>

Make sure that the pagesize passed to db__set_pagesize() is a power of two.

nvi stores the content of files in BDB database structures. When initiating a
file, it picks a page size for the database to fit the file within 15 pages,
with a minimal page size of 1K and maximal of 10K.

In vanilla nvi, this size is calculated as a multiple of 1024. Modern versions
of BDB, however, require the page size of a database to be a power of two, which
this patch addresses, ridding us of the following message:

  BDB0511 page sizes must be a power-of-2

--- nvi-1.81.6.orig/common/exf.c	2009-03-09 01:48:01.695862889 +0100
+++ nvi-1.81.6/common/exf.c	2009-03-09 10:42:41.147866272 +0100
@@ -249,11 +249,10 @@
 		 * (vi should have good locality) or smaller than 1K.
 		 */
 		psize = ((sb.st_size / 15) + 1023) / 1024;
-		if (psize > 10)
-			psize = 10;
-		if (psize == 0)
-			psize = 1;
-		psize *= 1024;
+		if (psize >= 8) psize=8<<10;
+		else if (psize >= 4) psize=4<<10;
+		else if (psize >= 2) psize=2<<10;
+		else psize=1<<10;

 		F_SET(ep, F_DEVSET);
 		ep->mdev = sb.st_dev;


code:
From 6a08014b77bf435f025ecdac08396580b85f159a Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Sat, 8 Sep 2018 20:22:45 +0200
Subject: [PATCH] fix binary literals.

---
 module/nyacc/lex.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/module/nyacc/lex.scm b/module/nyacc/lex.scm
index 2ec9895..b205212 100644
--- a/module/nyacc/lex.scm
+++ b/module/nyacc/lex.scm
@@ -345,10 +345,11 @@
 	  ((char-numeric? ch) (iter chl '$fixed ba 1 ch))
 	  ((char=? #\. ch) (iter (cons ch chl) #f ba 15 (read-char)))
 	  (else #f)))
-	((10) ;; allow x after 0
+	((10) ;; allow x, b after 0
 	 (cond
 	  ((eof-object? ch) (iter chl ty ba 5 ch))
 	  ((char=? #\x ch) (iter (cons ch chl) ty 16 1 (read-char)))
+          ((char=? #\b ch) (iter (cons ch chl) ty 2 1 (read-char)))
 	  (else (iter chl ty ba 1 ch))))
 	((15) ;; got `.' only
 	 (cond
--
2.18.0


code:
Adjust the bundled Gnulib to cope with removal of libio interface in Glibc 2.28.

Based on this upstream gnulib patch:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a71827c0bc5e0ec67af23edef4f15cee8e

--- a/liboath/gl/fflush.c
+++ b/liboath/gl/fflush.c
@@ -33,7 +33,7 @@
 #undef fflush

-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */

 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
 static void
@@ -72,7 +72,7 @@

 #endif

-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+#if ! (defined _IO_EOF_SEEN  || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)

 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
@@ -148,7 +148,7 @@
   if (stream == NULL || ! freading (stream))
     return fflush (stream);

-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */

   clear_ungetc_buffer_preserving_position (stream);

--- a/liboath/gl/fpurge.c
+++ b/liboath/gl/fpurge.c
@@ -62,7 +62,7 @@
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, because they need it for implementing getc() and putc() as
      fast macros.  */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   fp->_IO_read_end = fp->_IO_read_ptr;
   fp->_IO_write_ptr = fp->_IO_write_base;
   /* Avoid memory leak when there is an active ungetc buffer.  */
--- a/libaoth/gl/freading.c
+++ b/liboath/gl/freading.c
@@ -31,7 +31,7 @@
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, because they need it for implementing getc() and putc() as
      fast macros.  */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   return ((fp->_flags & _IO_NO_WRITES) != 0
           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
               && fp->_IO_read_base != NULL));
--- a/liboath/gl/fseeko.c
+++ b/liboath/gl/fseeko.c
@@ -47,7 +47,7 @@
 #endif

   /* These tests are based on fpurge.c.  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN  || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   if (fp->_IO_read_end == fp->_IO_read_ptr
       && fp->_IO_write_ptr == fp->_IO_write_base
       && fp->_IO_save_base == NULL)
@@ -123,7 +123,7 @@
           return -1;
         }

-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN  || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
       fp->_flags &= ~_IO_EOF_SEEN;
       fp->_offset = pos;
 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
--- a/liboath/gl/stdio-impl.h
+++ b/liboath/gl/stdio-impl.h
@@ -18,6 +18,11 @@
    the same implementation of stdio extension API, except that some fields
    have different naming conventions, or their access requires some casts.  */

+/* Glibc 2.28 made _IO_IN_BACKUP private, so define it here for now.  */
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
+# define _IO_IN_BACKUP 0x100
+#endif
+
 /* BSD stdio derived implementations.  */

 #if defined __NetBSD__                         /* NetBSD */


code:
From: Stephane Glondu <steph@glondu.net>
Date: Sun, 16 Aug 2015 20:59:14 +0200
Subject: Add a .file directive to generated .s files

When no .file directive is given, the toolchain records the filename
of the .o file, which is sometimes random, making generated objects
non-deterministic.

We use Location.input_name for adding .file directives to assembly
files. Note: when the file is preprocessed, this reference holds the
name of the temporary file. Hence, files compiled with -pp are still
not deterministic.

Bug-Debian: https://bugs.debian.org/795784
Bug-Debian: https://bugs.debian.org/796336
---
 asmcomp/amd64/emit.mlp | 1 +
 asmcomp/arm/emit.mlp   | 1 +
 asmcomp/arm64/emit.mlp | 1 +
 asmcomp/i386/emit.mlp  | 1 +
 asmcomp/power/emit.mlp | 1 +
 asmcomp/sparc/emit.mlp | 1 +
 6 files changed, 6 insertions(+)

diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp
index d56d0f5..4d7aa30 100644
--- a/asmcomp/amd64/emit.mlp
+++ b/asmcomp/amd64/emit.mlp
@@ -794,6 +794,7 @@ let data l =
 let begin_assembly() =
   reset_debug_info();                   (* PR#5603 *)
   float_constants := [];
+  `	.file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
   if !Clflags.dlcode then begin
     (* from amd64.S; could emit these constants on demand *)
     if macosx then
diff --git a/asmcomp/arm/emit.mlp b/asmcomp/arm/emit.mlp
index 4948fb2..6f30fba 100644
--- a/asmcomp/arm/emit.mlp
+++ b/asmcomp/arm/emit.mlp
@@ -892,6 +892,7 @@ let data l =

 let begin_assembly() =
   reset_debug_info();
+  `	.file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
   `	.syntax	unified\n`;
   begin match !arch with
   | ARMv4   -> `	.arch	armv4t\n`
diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp
index 750c2b2..5afbb8a 100644
--- a/asmcomp/arm64/emit.mlp
+++ b/asmcomp/arm64/emit.mlp
@@ -942,6 +942,7 @@ let data l =

 let begin_assembly() =
   reset_debug_info();
+  `	.file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
   `	.data\n`;
   `	.globl	{emit_symbol lbl_begin}\n`;
diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp
index 98df5f9..531150f 100644
--- a/asmcomp/i386/emit.mlp
+++ b/asmcomp/i386/emit.mlp
@@ -986,6 +986,7 @@ let data l =
 let begin_assembly() =
   reset_debug_info();                   (* PR#5603 *)
   float_constants := [];
+  `	.file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
   `	.data\n`;
   `	.globl	{emit_symbol lbl_begin}\n`;
diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp
index 4344085..343132b 100644
--- a/asmcomp/power/emit.mlp
+++ b/asmcomp/power/emit.mlp
@@ -887,6 +887,7 @@ let data l =
 let begin_assembly() =
   defined_functions := StringSet.empty;
   external_functions := StringSet.empty;
+  `	.file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
   (* Emit the beginning of the segments *)
   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
   emit_string data_space;
diff --git a/asmcomp/sparc/emit.mlp b/asmcomp/sparc/emit.mlp
index 877a3d5..7b041e9 100644
--- a/asmcomp/sparc/emit.mlp
+++ b/asmcomp/sparc/emit.mlp
@@ -727,6 +727,7 @@ let data l =
 (* Beginning / end of an assembly file *)

 let begin_assembly() =
+  `	.file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
   `	.data\n`;
   `	.global	{emit_symbol lbl_begin}\n`;


code:
Adapted from upstream commit 659615c7b100a89eafe6253e7a5b9d84d0e8df74,
this patch omits the upstream changes to 'Changes' and 'VERSION'.

http://seclists.org/oss-sec/2016/q2/170
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-8869
https://github.com/ocaml/ocaml/commit/659615c7b100a89eafe6253e7a5b9d84d0e8df74
---
 byterun/alloc.c  | 4 ++--
 byterun/intern.c | 2 +-
 byterun/str.c    | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/byterun/alloc.c b/byterun/alloc.c
index 96a21bf..0db9947 100644
--- a/byterun/alloc.c
+++ b/byterun/alloc.c
@@ -153,7 +153,7 @@ CAMLexport int caml_convert_flag_list(value list, int *flags)
 /* [size] is a [value] representing number of words (fields) */
 CAMLprim value caml_alloc_dummy(value size)
 {
-  mlsize_t wosize = Int_val(size);
+  mlsize_t wosize = Long_val(size);

   if (wosize == 0) return Atom(0);
   return caml_alloc (wosize, 0);
@@ -169,7 +169,7 @@ CAMLprim value caml_alloc_dummy_function(value size,value arity)
 /* [size] is a [value] representing number of floats. */
 CAMLprim value caml_alloc_dummy_float (value size)
 {
-  mlsize_t wosize = Int_val(size) * Double_wosize;
+  mlsize_t wosize = Long_val(size) * Double_wosize;

   if (wosize == 0) return Atom(0);
   return caml_alloc (wosize, 0);
diff --git a/byterun/intern.c b/byterun/intern.c
index 89d13d1..7b8d049 100644
--- a/byterun/intern.c
+++ b/byterun/intern.c
@@ -291,7 +291,7 @@ static void intern_rec(value *dest)
   case OFreshOID:
     /* Refresh the object ID */
     /* but do not do it for predefined exception slots */
-    if (Int_val(Field((value)dest, 1)) >= 0)
+    if (Long_val(Field((value)dest, 1)) >= 0)
       caml_set_oo_id((value)dest);
     /* Pop item and iterate */
     sp--;
diff --git a/byterun/str.c b/byterun/str.c
index 5ad4e29..885772f 100644
--- a/byterun/str.c
+++ b/byterun/str.c
@@ -266,7 +266,7 @@ CAMLprim value caml_string_greaterequal(value s1, value s2)
 CAMLprim value caml_blit_string(value s1, value ofs1, value s2, value ofs2,
                                 value n)
 {
-  memmove(&Byte(s2, Long_val(ofs2)), &Byte(s1, Long_val(ofs1)), Int_val(n));
+  memmove(&Byte(s2, Long_val(ofs2)), &Byte(s1, Long_val(ofs1)), Long_val(n));
   return Val_unit;
 }

@@ -278,7 +278,7 @@ CAMLprim value caml_fill_string(value s, value offset, value len, value init)

 CAMLprim value caml_bitvect_test(value bv, value n)
 {
-  int pos = Int_val(n);
+  intnat pos = Long_val(n);
   return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7)));
 }

--
2.7.4


code:
From bc3b353cb2f26cf10aa5c5caebddf6d3d5b1e318 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Fri, 21 Sep 2018 22:31:29 +0200
Subject: [PATCH] fix camlp4 in another directory

---
 Makefile                              | 11 ++++++-----
 configure                             | 13 ++++++++++++-
 tests/Makefile                        |  2 +-
 tests/camlp4-comments/Makefile        |  2 +-
 tests/camlp4-exclude-file/Makefile    |  2 +-
 tests/camlp4-exclude/Makefile         |  2 +-
 tests/camlp4-instrument-fast/Makefile |  2 +-
 tests/camlp4-instrument/Makefile      |  2 +-
 tests/combine-expr/Makefile           |  2 +-
 tests/ppx-comments/Makefile           |  2 +-
 tests/ppx-exclude-file/Makefile       |  2 +-
 tests/ppx-exclude/Makefile            |  2 +-
 tests/ppx-instrument-fast/Makefile    |  2 +-
 tests/ppx-instrument/Makefile         |  2 +-
 tests/report/Makefile                 |  2 +-
 15 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index b0980ee..6697922 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ PATH_BUILD=$(PATH_BASE)/_build
 PATH_OCAMLDOC=$(PATH_BASE)/ocamldoc
 PATH_SRC=$(PATH_BASE)/src
 PATH_TESTS=$(PATH_BASE)/tests
-PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect
+PATH_INSTALL=$(PREFIX)/lib/ocaml/bisect

 # DEFINITIONS
@@ -33,7 +33,8 @@ PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect
 PROJECT_NAME=bisect
 OCAMLBUILD=ocamlbuild
 OCAMLBUILD_ENV=WARNINGS=$(WARNINGS) PATH_OCAML_PREFIX=$(PATH_OCAML_PREFIX)
-OCAMLBUILD_FLAGS=-classic-display -no-links
+CAMLP4_INCLUDE=$(shell test -z $(CAMLP4_LIBDIR) || echo "-cflags -I,$(CAMLP4_LIBDIR)")
+OCAMLBUILD_FLAGS=-classic-display -no-links $(CAMLP4_INCLUDE)
 MODULES_ODOCL=$(PROJECT_NAME).odocl
 MODULES_MLPACK=$(PROJECT_NAME).mlpack
 MODULES_MLPACK_PP=$(PROJECT_NAME)_pp.mlpack
@@ -80,11 +81,11 @@ veryclean: clean
 	rm -f $(PATH_OCAMLDOC)/*.html $(PATH_OCAMLDOC)/*.css

 install: FORCE
-	cp $(PATH_BUILD)/src/report/report.byte $(PATH_OCAML_PREFIX)/bin/bisect-report; \
+	cp $(PATH_BUILD)/src/report/report.byte $(PREFIX)/bin/bisect-report; \
 	if [ "$(PPX)" = "TRUE" ]; then \
-	  cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PATH_OCAML_PREFIX)/bin; \
+	  cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PREFIX)/bin; \
 	fi; \
-	(which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PATH_OCAML_PREFIX)/bin/bisect-report.opt || true); \
+	(which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PREFIX)/bin/bisect-report.opt || true); \
 	if [ -x "$(PATH_OCAMLFIND)" ]; then \
 	  $(PATH_OCAMLFIND) query $(PROJECT_NAME) && $(PATH_OCAMLFIND) remove $(PROJECT_NAME) || true; \
 	  $(PATH_OCAMLFIND) install $(PROJECT_NAME) META -optional \
diff --git a/configure b/configure
index bb7ebf4..43ef46b 100755
--- a/configure
+++ b/configure
@@ -21,7 +21,9 @@
 # default values
 ocamlbuild=`which ocamlbuild || echo '/usr/local/bin/ocamlbuild'`
 bin_path=`dirname $ocamlbuild`
+prefix=''
 ocaml_prefix=`dirname $bin_path`
+camlp4_prefix=`dirname $(dirname $(which camlp4of))`
 ocamlfind=`which ocamlfind 2> /dev/null || echo ''`
 native_dynlink='TRUE'
 devel='FALSE'
@@ -32,8 +34,12 @@ ppx='FALSE'
 while [ $# -gt 0 ]
 do
     case "$1" in
+        -prefix)
+            prefix="$2"; shift;;
         -ocaml-prefix)
             ocaml_prefix="$2"; shift;;
+        -camlp4-prefix)
+            camlp4_prefix="$2"; shift;;
         -ocamlfind)
             ocamlfind="$2"; shift;;
         -no-native-dynlink)
@@ -45,7 +51,7 @@ do
         -ppx)
             ppx='TRUE';;
         *)
-            echo "usage: $0 [-ocaml-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
+            echo "usage: $0 [-prefix <path>] [-ocaml-prefix <path>] [-camlp4-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
             exit 1;;
         esac
         shift
@@ -57,6 +63,9 @@ if [ "$no_camlp4" = "TRUE" -a "$ppx" = "FALSE" ]; then
   exit 1
 fi

+# prefix default value
+test -z $prefix && prefix=$ocaml_prefix
+
 # make options
 make_quiet=`make -f - <<EOF
 default: gnumake
@@ -66,7 +75,9 @@ EOF`

 # file creation
 echo "# timestamp: `date`" > Makefile.config
+echo "PREFIX=$prefix" >> Makefile.config
 echo "PATH_OCAML_PREFIX=$ocaml_prefix" >> Makefile.config
+echo "PATH_CAMLP4_PREFIX=$camlp4_prefix" >> Makefile.config
 echo "PATH_OCAMLFIND=$ocamlfind" >> Makefile.config
 echo "NATIVE_DYNLINK=$native_dynlink" >> Makefile.config
 echo "WARNINGS=$devel" >> Makefile.config
diff --git a/tests/Makefile b/tests/Makefile
index 1aba27f..9642323 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -41,7 +41,7 @@ one: FORCE
 	else \
 	  echo "Running tests for '$(NAME)'..." | tee -a _log; \
           (cd $(NAME) && \
-	    $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin \
+	    $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin PATH_CAMLP4_PREFIX=$(PATH_CAMLP4_PREFIX) \
 	    COMPILER=ocamlc EXECUTABLE=bytecode RUN=./ LIB_EXT=cma EXE_SUFFIX='' \
 	    REPORT=../../_build/src/report/report.byte && \
 	  cd ..) || echo '*** error' >> _log; \
diff --git a/tests/camlp4-comments/Makefile b/tests/camlp4-comments/Makefile
index 33fca72..a918118 100644
--- a/tests/camlp4-comments/Makefile
+++ b/tests/camlp4-comments/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cmp
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cmp
diff --git a/tests/camlp4-exclude-file/Makefile b/tests/camlp4-exclude-file/Makefile
index ab13983..e2520fa 100644
--- a/tests/camlp4-exclude-file/Makefile
+++ b/tests/camlp4-exclude-file/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cmp
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cmp
diff --git a/tests/camlp4-exclude/Makefile b/tests/camlp4-exclude/Makefile
index 18aada4..d71a7bc 100644
--- a/tests/camlp4-exclude/Makefile
+++ b/tests/camlp4-exclude/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cmp
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cmp
diff --git a/tests/camlp4-instrument-fast/Makefile b/tests/camlp4-instrument-fast/Makefile
index f60767f..8506e38 100644
--- a/tests/camlp4-instrument-fast/Makefile
+++ b/tests/camlp4-instrument-fast/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cmp
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cmp
diff --git a/tests/camlp4-instrument/Makefile b/tests/camlp4-instrument/Makefile
index 33fca72..a918118 100644
--- a/tests/camlp4-instrument/Makefile
+++ b/tests/camlp4-instrument/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cmp
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cmp
diff --git a/tests/combine-expr/Makefile b/tests/combine-expr/Makefile
index 46ae9eb..e8e2af2 100644
--- a/tests/combine-expr/Makefile
+++ b/tests/combine-expr/Makefile
@@ -1,4 +1,4 @@
-COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
+COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)

 default: clean compile run report

diff --git a/tests/ppx-comments/Makefile b/tests/ppx-comments/Makefile
index f8c645a..667526f 100644
--- a/tests/ppx-comments/Makefile
+++ b/tests/ppx-comments/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cm*
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cm*
diff --git a/tests/ppx-exclude-file/Makefile b/tests/ppx-exclude-file/Makefile
index a575a77..0dd1a20 100644
--- a/tests/ppx-exclude-file/Makefile
+++ b/tests/ppx-exclude-file/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cm*
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cm*
diff --git a/tests/ppx-exclude/Makefile b/tests/ppx-exclude/Makefile
index a517af4..f502a42 100644
--- a/tests/ppx-exclude/Makefile
+++ b/tests/ppx-exclude/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cm*
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cm*
diff --git a/tests/ppx-instrument-fast/Makefile b/tests/ppx-instrument-fast/Makefile
index da78bb6..1195988 100644
--- a/tests/ppx-instrument-fast/Makefile
+++ b/tests/ppx-instrument-fast/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cm*
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cm*
diff --git a/tests/ppx-instrument/Makefile b/tests/ppx-instrument/Makefile
index f8c645a..667526f 100644
--- a/tests/ppx-instrument/Makefile
+++ b/tests/ppx-instrument/Makefile
@@ -2,7 +2,7 @@ default:
 	@rm -fr *.result *.cm*
 	@for file in *.ml; do \
 		echo "     testing '$$file' ..."; \
-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
+		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
 		diff -q $$file.reference $$file.result || exit 1; \
 	done
 	@rm -fr *.result *.cm*
diff --git a/tests/report/Makefile b/tests/report/Makefile
index a7ffe44..a968bf9 100644
--- a/tests/report/Makefile
+++ b/tests/report/Makefile
@@ -1,4 +1,4 @@
-COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
+COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
 XMLLINT=$(shell which xmllint)

 default: clean compile run report
--
2.18.0


code:
From 0aaddfceeea3e89df196ab1846da54d09713a512 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Thu, 15 Dec 2016 21:17:31 +0100
Subject: [PATCH] fix configure

---
 Makefile.in | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index d040f4c..85e0b38 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -32,6 +32,7 @@ BISECT_REPORT	= @BISECT_REPORT@
 BYTESWAP_H	= @BYTESWAP_H@

 OCAMLLIB	= @OCAMLLIB@
+BISECTLIB	= $(shell if test -z $${BISECTLIB}; then echo $(OCAMLLIB); else echo $${BISECTLIB}; fi)
 top_srcdir	= @top_srcdir@

 pkg_cil		= @OCAML_PKG_cil@
@@ -47,9 +48,9 @@ OCAMLOPTPACKAGES = $(OCAMLCPACKAGES)
 OCAMLOPTLIBS	= -linkpkg

 ifneq ($(enable_coverage),no)
-OCAMLCFLAGS     += -I +bisect -pp 'camlp4o $(OCAMLLIB)/bisect/instrument.cma'
+OCAMLCFLAGS     += -I +bisect -pp 'camlp4o $(BISECTLIB)/bisect/instrument.cma'
 OCAMLCLIBS	+= -I +bisect bisect.cma
-OCAMLOPTFLAGS   += -I +bisect -pp 'camlp4o $(OCAMLLIB)/bisect/instrument.cma'
+OCAMLOPTFLAGS   += -I +bisect -pp 'camlp4o $(BISECTLIB)/bisect/instrument.cma'
 OCAMLOPTLIBS	+= -I +bisect bisect.cmxa
 endif

@@ -110,7 +111,7 @@ bitstring_persistent.cmi: bitstring_persistent.mli
	  -I +camlp4 -pp camlp4of -c $<

 pa_bitstring.cmo: pa_bitstring.ml bitstring.cma bitstring_persistent.cma
-	$(OCAMLFIND) ocamlc bitstring.cma -I +camlp4 dynlink.cma camlp4lib.cma \
+	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) bitstring.cma -I +camlp4 dynlink.cma camlp4lib.cma \
	  -pp camlp4of -c $< -o $@

 bitstring-objinfo: bitstring_objinfo.cmo bitstring.cma bitstring_persistent.cma
@@ -133,7 +134,7 @@ byteswap.h: byteswap.in.h
 ifeq ($(enable_coverage),no)
 PP	= -pp 'camlp4o bitstring.cma bitstring_persistent.cma pa_bitstring.cmo'
 else
-PP	= -pp 'camlp4o $(OCAMLLIB)/bisect/bisect.cma bitstring.cma bitstring_persistent.cma pa_bitstring.cmo'
+PP	= -pp 'camlp4o $(BISECTLIB)/bisect/bisect.cma bitstring.cma bitstring_persistent.cma pa_bitstring.cmo'
 endif

 check: test
--
2.11.0


code:
From aeca7656f499d7f4595319858f242276920e31bb Mon Sep 17 00:00:00 2001
From: Louis Gesbert <louis.gesbert@ocamlpro.com>
Date: Sat, 2 Dec 2017 12:51:01 +0100
Subject: [PATCH] Fix for ocaml 4.06

---
 common/criteria_lexer.mll | 8 ++++----
 common/util.ml            | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/criteria_lexer.mll b/common/criteria_lexer.mll
index 71f9178..fc4eae3 100644
--- a/common/criteria_lexer.mll
+++ b/common/criteria_lexer.mll
@@ -18,7 +18,7 @@
     let c = Lexing.lexeme_char lexbuf 2 in (* the delimiter can be any character *)
     (* find the terminating delimiter *)
     let endpos =
-      try String.index_from lexbuf.lex_buffer (lexbuf.lex_start_pos + 3) c with
+      try Bytes.index_from lexbuf.lex_buffer (lexbuf.lex_start_pos + 3) c with
       |Invalid_argument _ ->
           raise (Format822.Syntax_error (
             Format822.error lexbuf "String too short"))
@@ -27,9 +27,9 @@
             Format822.error lexbuf (Printf.sprintf "cannot find: %c" c)))
     in
     let len = endpos - (lexbuf.lex_start_pos + 3) in
-    let s = String.sub lexbuf.lex_buffer (lexbuf.lex_start_pos + 3) len in
-    lexbuf.Lexing.lex_curr_pos <- lexbuf.Lexing.lex_start_pos + ((String.length s)+4);
-    s
+    let s = Bytes.sub lexbuf.lex_buffer (lexbuf.lex_start_pos + 3) len in
+    lexbuf.Lexing.lex_curr_pos <- lexbuf.Lexing.lex_start_pos + ((Bytes.length s)+4);
+    Bytes.to_string s

 }

diff --git a/common/util.ml b/common/util.ml
index 598f266..36ca3d1 100644
--- a/common/util.ml
+++ b/common/util.ml
@@ -87,7 +87,7 @@ module MakeMessages(X : sig val label : string end) = struct
   let clean label =
     try
       let s = Filename.chop_extension (Filename.basename label) in
-      String.capitalize s
+      String.capitalize_ascii s
     with Invalid_argument _ -> label

   let create ?(enabled=false) label =
--
2.11.0