diff options
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r-- | gnu/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch | 14 | ||||
-rw-r--r-- | gnu/packages/patches/gpsbabel-fix-i686-test.patch | 46 | ||||
-rw-r--r-- | gnu/packages/patches/gpsbabel-minizip.patch | 13 | ||||
-rw-r--r-- | gnu/packages/patches/gpsbabel-qstring.patch | 69 | ||||
-rw-r--r-- | gnu/packages/patches/icecat-makeicecat.patch | 4 | ||||
-rw-r--r-- | gnu/packages/patches/pidgin-libnm.patch | 60 | ||||
-rw-r--r-- | gnu/packages/patches/pidgin-vv-gst.patch | 48 | ||||
-rw-r--r-- | gnu/packages/patches/pulseview-qt515-compat.patch | 145 | ||||
-rw-r--r-- | gnu/packages/patches/rust-1.48-linker-locale.patch | 14 | ||||
-rw-r--r-- | gnu/packages/patches/smalltalk-multiplication-overflow.patch | 121 |
10 files changed, 376 insertions, 158 deletions
diff --git a/gnu/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch b/gnu/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch deleted file mode 100644 index 6c49bdcdde..0000000000 --- a/gnu/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch +++ /dev/null @@ -1,14 +0,0 @@ -Fix completion for R5RS Scheme. -See https://github.com/ashinn/scheme-complete/issues/1 - ---- scheme-complete-master/scheme-complete.el.orig 2015-12-25 21:59:09.896909029 +0100 -+++ scheme-complete-master/scheme-complete.el 2015-12-25 21:59:17.924993998 +0100 -@@ -591,7 +591,7 @@ - '((exact->inexact (lambda (z) z)) - (inexact->exact (lambda (z) z))) - (mapcar #'(lambda (x) -- (list x (scheme-env-lookup *scheme-r7rs-info* x))) -+ (scheme-env-lookup *scheme-r7rs-info* x)) - *scheme-r5rs-bindings*)))) - *scheme-r5rs-info*) - diff --git a/gnu/packages/patches/gpsbabel-fix-i686-test.patch b/gnu/packages/patches/gpsbabel-fix-i686-test.patch new file mode 100644 index 0000000000..5ba0305113 --- /dev/null +++ b/gnu/packages/patches/gpsbabel-fix-i686-test.patch @@ -0,0 +1,46 @@ +https://github.com/gpsbabel/gpsbabel/commit/465a74194d53acea5c8d74c5cf3cb2940546ec92.patch +Can be removed next release + +From 465a74194d53acea5c8d74c5cf3cb2940546ec92 Mon Sep 17 00:00:00 2001 +From: tsteven4 <13596209+tsteven4@users.noreply.github.com> +Date: Fri, 7 Aug 2020 11:29:22 -0600 +Subject: [PATCH] fix i386 regression error with engima. (#620) + +this was motivated by the test failure seen at +https://buildd.debian.org/status/fetch.php?pkg=gpsbabel&arch=i386&ver=1.7.0%2Bds-4&stamp=1596794554&raw=0 +--- + enigma.cc | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/enigma.cc b/enigma.cc +index 850f27b4e..32fea92d6 100644 +--- a/enigma.cc ++++ b/enigma.cc +@@ -21,9 +21,16 @@ + + */ + ++#include <cmath> // for fabs, lround ++#include <cstdint> // for int32_t, uint8_t, uint32_t ++#include <cstdlib> // for abs ++#include <cstring> // for strlen, memcpy, memset ++ ++#include <QtCore/QString> // for QString ++ + #include "defs.h" +-#include <cmath> +-#include <cstdlib> ++#include "gbfile.h" // for gbfclose, gbfopen_le, gbfread, gbfwrite, gbfile ++ + + #define MYNAME "Enigma binary route and waypoint file format" + +@@ -177,7 +184,7 @@ enigma_waypt_disp(const Waypoint* wpt) + le_write32(&ewpt.longitude, decToEnigmaPosition(wpt->longitude)); + ewpt.waypoint_type = WTYPE_WAYPOINT; + if (wpt->altitude != unknown_alt) { +- le_write32(&ewpt.data.wp_altitude, METERS_TO_FEET(wpt->altitude) + 1000); ++ le_write32(&ewpt.data.wp_altitude, lround(METERS_TO_FEET(wpt->altitude)) + 1000); + } + if (wpt->shortname != nullptr) { + ewpt.shortname_len = (uint8_t) min(6, strlen(CSTRc(wpt->shortname))); diff --git a/gnu/packages/patches/gpsbabel-minizip.patch b/gnu/packages/patches/gpsbabel-minizip.patch deleted file mode 100644 index 8f3bb36f57..0000000000 --- a/gnu/packages/patches/gpsbabel-minizip.patch +++ /dev/null @@ -1,13 +0,0 @@ -Patch taken from https://sources.debian.org/data/main/g/gpsbabel/1.5.3-2/debian/patches/use_minizip. - ---- a/Makefile.in -+++ b/Makefile.in -@@ -120,7 +120,7 @@ LIBOBJS = queue.o route.o waypt.o filter - src/core/usasciicodec.o\ - src/core/ziparchive.o \ - $(GARMIN) $(JEEPS) $(SHAPE) @ZLIB@ $(FMTS) $(FILTERS) --OBJS = main.o globals.o $(LIBOBJS) @FILEINFO@ -+OBJS = main.o globals.o $(MINIZIP) $(LIBOBJS) @FILEINFO@ - - DEPFILES = $(OBJS:.o=.d) -
\ No newline at end of file diff --git a/gnu/packages/patches/gpsbabel-qstring.patch b/gnu/packages/patches/gpsbabel-qstring.patch deleted file mode 100644 index 8ba1a7213b..0000000000 --- a/gnu/packages/patches/gpsbabel-qstring.patch +++ /dev/null @@ -1,69 +0,0 @@ -Extracted from following patch of gpsbabel: -https://github.com/gpsbabel/gpsbabel/commit/604178aa8ad4d3c3ad218df24c1e9a6a1f683bb3 - -From 604178aa8ad4d3c3ad218df24c1e9a6a1f683bb3 Mon Sep 17 00:00:00 2001 -From: Harel Mazor <harel.mazor@gmail.com> -Date: Tue, 24 Jan 2017 00:35:04 +0200 -Subject: [PATCH] Added geojson read capablity, moved magic strings to - constants, fixed windows compilation issues. - ---- a/tef_xml.cc -+++ b/tef_xml.cc -@@ -72,11 +72,11 @@ tef_start(xg_string args, const QXmlStreamAttributes* attrv) - bool valid = false; - - foreach(QXmlStreamAttribute attr, *attrv) { -- if (attr.name().compare("Comment", Qt::CaseInsensitive) == 0) { -- if (attr.value().compare("TourExchangeFormat", Qt::CaseInsensitive) == 0) { -+ if (attr.name().compare(QString("Comment"), Qt::CaseInsensitive) == 0) { -+ if (attr.value().compare(QString("TourExchangeFormat"), Qt::CaseInsensitive) == 0) { - valid = true; - } -- } else if (attr.name().compare("Version", Qt::CaseInsensitive) == 0) { -+ } else if (attr.name().compare(QString("Version"), Qt::CaseInsensitive) == 0) { - version = attr.value().toString().toDouble(); - } - } -@@ -95,9 +95,9 @@ tef_header(xg_string args, const QXmlStreamAttributes* attrv) - { - route = route_head_alloc(); - foreach(QXmlStreamAttribute attr, *attrv) { -- if (attr.name().compare("Name", Qt::CaseInsensitive) == 0) { -+ if (attr.name().compare(QString("Name"), Qt::CaseInsensitive) == 0) { - route->rte_name = attr.value().toString().trimmed(); -- } else if (attr.name().compare("Software", Qt::CaseInsensitive) == 0) { -+ } else if (attr.name().compare(QString("Software"), Qt::CaseInsensitive) == 0) { - route->rte_desc = attr.value().toString().trimmed(); - } - } -@@ -248,20 +248,20 @@ tef_item_start(xg_string args, const QXmlStreamAttributes* attrv) - QString attrstr = attr.value().toString(); - QByteArray attrtext = attrstr.toUtf8(); - -- if (attr.name().compare("SegDescription", Qt::CaseInsensitive) == 0) { -+ if (attr.name().compare(QString("SegDescription"), Qt::CaseInsensitive) == 0) { - wpt_tmp->shortname = attrstr.trimmed(); -- } else if (attr.name().compare("PointDescription", Qt::CaseInsensitive) == 0) { -+ } else if (attr.name().compare(QString("PointDescription"), Qt::CaseInsensitive) == 0) { - wpt_tmp->description = attrstr.trimmed(); -- } else if (attr.name().compare("ViaStation", Qt::CaseInsensitive) == 0 && -- attr.value().compare("true", Qt::CaseInsensitive) == 0) { -+ } else if (attr.name().compare(QString("ViaStation"), Qt::CaseInsensitive) == 0 && -+ attr.value().compare(QString("true"), Qt::CaseInsensitive) == 0) { - wpt_tmp->wpt_flags.fmt_use = 1; /* only a flag */ - - /* new in TEF V2 */ -- } else if (attr.name().compare("Instruction", Qt::CaseInsensitive) == 0) { -+ } else if (attr.name().compare(QString("Instruction"), Qt::CaseInsensitive) == 0) { - wpt_tmp->description = attrstr.trimmed(); -- } else if (attr.name().compare("Altitude", Qt::CaseInsensitive) == 0) { -+ } else if (attr.name().compare(QString("Altitude"), Qt::CaseInsensitive) == 0) { - wpt_tmp->altitude = attrstr.toDouble(); -- } else if (attr.name().compare("TimeStamp", Qt::CaseInsensitive) == 0) { -+ } else if (attr.name().compare(QString("TimeStamp"), Qt::CaseInsensitive) == 0) { - /* nothing for the moment */ - } - } --- -2.16.1 - diff --git a/gnu/packages/patches/icecat-makeicecat.patch b/gnu/packages/patches/icecat-makeicecat.patch index 73e87b9612..3f16880260 100644 --- a/gnu/packages/patches/icecat-makeicecat.patch +++ b/gnu/packages/patches/icecat-makeicecat.patch @@ -25,7 +25,7 @@ index 8be2362..48716f2 100755 -wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz.asc -gpg --recv-keys --keyserver keyserver.ubuntu.com 14F26682D0916CDD81E37B6D61B7B526D98F0353 -gpg --verify firefox-${FFVERSION}esr.source.tar.xz.asc --echo -n 5e69f9bfd1a35decdae8d4b28da8100820e58b429f539fa9884802347631cf53 firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c - +-echo -n 0d07b74cb66b94018e3d7f11531f95c76a955e0016a3c401241d0d85062ae7ce firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c - - -echo Extracting Firefox tarball -tar -xf firefox-${FFVERSION}esr.source.tar.xz @@ -37,7 +37,7 @@ index 8be2362..48716f2 100755 +# wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz.asc +# gpg --recv-keys --keyserver keyserver.ubuntu.com 14F26682D0916CDD81E37B6D61B7B526D98F0353 +# gpg --verify firefox-${FFVERSION}esr.source.tar.xz.asc -+# echo -n 5e69f9bfd1a35decdae8d4b28da8100820e58b429f539fa9884802347631cf53 firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c - ++# echo -n 0d07b74cb66b94018e3d7f11531f95c76a955e0016a3c401241d0d85062ae7ce firefox-${FFVERSION}esr.source.tar.xz |sha256sum -c - +# +# echo Extracting Firefox tarball +# tar -xf firefox-${FFVERSION}esr.source.tar.xz diff --git a/gnu/packages/patches/pidgin-libnm.patch b/gnu/packages/patches/pidgin-libnm.patch deleted file mode 100644 index d34af749af..0000000000 --- a/gnu/packages/patches/pidgin-libnm.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Tobias Geerinckx-Rice <me@tobias.gr> -Date: Sun, 24 May 2020 16:11:01 +0200 -Subject: [PATCH] gnu: pidgin: Find libnm. - -Copied verbatim from[0]. - -[0]: https://git.archlinux.org/svntogit/packages.git/plain/trunk/pidgin-nm-1.0.patch?h=packages/pidgin - -diff --git a/configure.ac b/configure.ac -index 04836fa..0a2d451 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1423,18 +1423,24 @@ fi - dnl Check for NetworkManager.h; if we don't have it, oh well - if test "x$enable_dbus" = "xyes" ; then - if test "x$enable_nm" = "xyes" ; then -- PKG_CHECK_MODULES(NETWORKMANAGER, [NetworkManager >= 0.5.0], [ -+ PKG_CHECK_MODULES(NETWORKMANAGER, [libnm], [ - AC_SUBST(NETWORKMANAGER_CFLAGS) - AC_SUBST(NETWORKMANAGER_LIBS) - AC_DEFINE(HAVE_NETWORKMANAGER, 1, [Define if we have NetworkManager.]) - ], [ -- enable_nm=no -- if test "x$force_deps" = "xyes" ; then -- AC_MSG_ERROR([ -+ PKG_CHECK_MODULES(NETWORKMANAGER, [NetworkManager >= 0.5.0], [ -+ AC_SUBST(NETWORKMANAGER_CFLAGS) -+ AC_SUBST(NETWORKMANAGER_LIBS) -+ AC_DEFINE(HAVE_NETWORKMANAGER, 1, [Define if we have NetworkManager.]) -+ ], [ -+ enable_nm=no -+ if test "x$force_deps" = "xyes" ; then -+ AC_MSG_ERROR([ - NetworkManager development headers not found. - Use --disable-nm if you do not need NetworkManager support. - ]) -- fi]) -+ fi]) -+ ]) - fi - else - enable_nm=no -diff --git a/libpurple/network.c b/libpurple/network.c -index c43e3c7..b17e439 100644 ---- a/libpurple/network.c -+++ b/libpurple/network.c -@@ -939,8 +939,13 @@ nm_update_state(NMState state) - #if NM_CHECK_VERSION(0,8,992) - case NM_STATE_DISCONNECTING: - #endif -+#if NM_CHECK_VERSION(1,0,0) -+ if (prev != NM_STATE_CONNECTED_GLOBAL && prev != NM_STATE_UNKNOWN) -+ break; -+#else - if (prev != NM_STATE_CONNECTED && prev != NM_STATE_UNKNOWN) - break; -+#endif - if (ui_ops != NULL && ui_ops->network_disconnected != NULL) - ui_ops->network_disconnected(); - break; diff --git a/gnu/packages/patches/pidgin-vv-gst.patch b/gnu/packages/patches/pidgin-vv-gst.patch new file mode 100644 index 0000000000..e0553dd119 --- /dev/null +++ b/gnu/packages/patches/pidgin-vv-gst.patch @@ -0,0 +1,48 @@ +Name: Gary Kramlich +Date: 2020-07-12 +Source: https://keep.imfreedom.org/pidgin/pidgin/rev/39ac50435cfb + +diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c +--- a/libpurple/mediamanager.c ++++ b/libpurple/mediamanager.c +@@ -2231,6 +2231,7 @@ + purple_media_manager_unregister_gst_device(PurpleMediaManager *manager, + GstDevice *device) + { ++#ifdef USE_VV + GList *i; + gchar *name; + gchar *device_class; +@@ -2277,6 +2278,7 @@ + + g_free(name); + g_free(device_class); ++#endif /* USE_VV */ + } + + static gboolean +@@ -2304,7 +2306,7 @@ + static void + purple_media_manager_init_device_monitor(PurpleMediaManager *manager) + { +-#if GST_CHECK_VERSION(1, 4, 0) ++#if GST_CHECK_VERSION(1, 4, 0) && defined(USE_VV) + GstBus *bus; + GList *i; + +@@ -2334,6 +2336,7 @@ + PurpleMediaElementType type) + { + GList *result = NULL; ++#ifdef USE_VV + GList *i; + + for (i = manager->priv->elements; i; i = i->next) { +@@ -2347,6 +2350,7 @@ + result = g_list_prepend(result, info); + } + } ++#endif /* USE_VV */ + + return result; + } diff --git a/gnu/packages/patches/pulseview-qt515-compat.patch b/gnu/packages/patches/pulseview-qt515-compat.patch new file mode 100644 index 0000000000..a7156b2018 --- /dev/null +++ b/gnu/packages/patches/pulseview-qt515-compat.patch @@ -0,0 +1,145 @@ +https://sigrok.org/gitweb/?p=pulseview.git;a=patch;h=ae726b70a7ada9a4be5808e00f0c951318479684 + +From ae726b70a7ada9a4be5808e00f0c951318479684 Mon Sep 17 00:00:00 2001 +From: Valentin Ochs <a@0au.de> +Date: Sat, 20 Jun 2020 16:01:27 +0200 +Subject: [PATCH] Replace obsolete/deprecated Qt methods + +--- + pv/subwindows/decoder_selector/subwindow.cpp | 2 +- + pv/util.cpp | 21 ++++++++++++++++++-- + pv/util.hpp | 10 ++++++++++ + pv/views/trace/decodetrace.cpp | 3 ++- + pv/views/trace/ruler.cpp | 2 +- + pv/widgets/timestampspinbox.cpp | 2 +- + 6 files changed, 34 insertions(+), 6 deletions(-) + +diff --git a/pv/subwindows/decoder_selector/subwindow.cpp b/pv/subwindows/decoder_selector/subwindow.cpp +index 94ed6f4b..2c65dcf2 100644 +--- a/pv/subwindows/decoder_selector/subwindow.cpp ++++ b/pv/subwindows/decoder_selector/subwindow.cpp +@@ -185,7 +185,7 @@ QToolBar* SubWindow::create_toolbar(QWidget *parent) const + int SubWindow::minimum_width() const + { + QFontMetrics m(info_label_body_->font()); +- const int label_width = m.width(QString(tr(initial_notice))); ++ const int label_width = util::text_width(m, tr(initial_notice)); + + return label_width + min_width_margin; + } +diff --git a/pv/util.cpp b/pv/util.cpp +index 897254e1..dfb8c72b 100644 +--- a/pv/util.cpp ++++ b/pv/util.cpp +@@ -143,7 +143,7 @@ QString format_time_si(const Timestamp& v, SIPrefix prefix, + QString s; + QTextStream ts(&s); + if (sign && !v.is_zero()) +- ts << forcesign; ++ ts.setNumberFlags(ts.numberFlags() | QTextStream::ForceSign); + ts << qSetRealNumberPrecision(precision) << (v * multiplier); + ts << ' ' << prefix << unit; + +@@ -169,7 +169,7 @@ QString format_value_si(double v, SIPrefix prefix, unsigned precision, + QString s; + QTextStream ts(&s); + if (sign && (v != 0)) +- ts << forcesign; ++ ts.setNumberFlags(ts.numberFlags() | QTextStream::ForceSign); + ts.setRealNumberNotation(QTextStream::FixedNotation); + ts.setRealNumberPrecision(precision); + ts << (v * multiplier) << ' ' << prefix << unit; +@@ -279,5 +279,22 @@ vector<string> split_string(string text, string separator) + return result; + } + ++/** ++ * Return the width of a string in a given font. ++ * ++ * @param[in] metric metrics of the font ++ * @param[in] string the string whose width should be determined ++ * ++ * @return width of the string in pixels ++ */ ++std::streamsize text_width(const QFontMetrics &metric, const QString &string) ++{ ++#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) ++ return metric.horizontalAdvance(string); ++#else ++ return metric.width(string); ++#endif ++} ++ + } // namespace util + } // namespace pv +diff --git a/pv/util.hpp b/pv/util.hpp +index fab29a14..49ae04b2 100644 +--- a/pv/util.hpp ++++ b/pv/util.hpp +@@ -30,6 +30,7 @@ + + #include <QMetaType> + #include <QString> ++#include <QFontMetrics> + + using std::string; + using std::vector; +@@ -143,6 +144,15 @@ QString format_time_minutes(const Timestamp& t, signed precision = 0, + + vector<string> split_string(string text, string separator); + ++/** ++ * Return the width of a string in a given font. ++ * @param[in] metric metrics of the font ++ * @param[in] string the string whose width should be determined ++ * ++ * @return width of the string in pixels ++ */ ++std::streamsize text_width(const QFontMetrics &metric, const QString &string); ++ + } // namespace util + } // namespace pv + +diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp +index 67c9b1c4..93c7c5a9 100644 +--- a/pv/views/trace/decodetrace.cpp ++++ b/pv/views/trace/decodetrace.cpp +@@ -161,7 +161,8 @@ DecodeTrace::DecodeTrace(pv::Session &session, + + // Determine shortest string we want to see displayed in full + QFontMetrics m(QApplication::font()); +- min_useful_label_width_ = m.width("XX"); // e.g. two hex characters ++ // e.g. two hex characters ++ min_useful_label_width_ = util::text_width(m, "XX"); + + default_row_height_ = (ViewItemPaintParams::text_height() * 6) / 4; + annotation_height_ = (ViewItemPaintParams::text_height() * 5) / 4; +diff --git a/pv/views/trace/ruler.cpp b/pv/views/trace/ruler.cpp +index 555794fc..83ffed28 100644 +--- a/pv/views/trace/ruler.cpp ++++ b/pv/views/trace/ruler.cpp +@@ -283,7 +283,7 @@ void Ruler::paintEvent(QPaintEvent*) + const int rightedge = width(); + const int x_tick = tick.first; + if ((x_tick > leftedge) && (x_tick < rightedge)) { +- const int x_left_bound = QFontMetrics(font()).width(tick.second) / 2; ++ const int x_left_bound = util::text_width(QFontMetrics(font()), tick.second) / 2; + const int x_right_bound = rightedge - x_left_bound; + const int x_legend = min(max(x_tick, x_left_bound), x_right_bound); + p.drawText(x_legend, ValueMargin, 0, text_height, +diff --git a/pv/widgets/timestampspinbox.cpp b/pv/widgets/timestampspinbox.cpp +index fea8175e..01424a5b 100644 +--- a/pv/widgets/timestampspinbox.cpp ++++ b/pv/widgets/timestampspinbox.cpp +@@ -76,7 +76,7 @@ QSize TimestampSpinBox::minimumSizeHint() const + { + const QFontMetrics fm(fontMetrics()); + const int l = round(value_).str().size() + precision_ + 10; +- const int w = fm.width(QString(l, '0')); ++ const int w = util::text_width(fm, QString(l, '0')); + const int h = lineEdit()->minimumSizeHint().height(); + return QSize(w, h); + } +-- +2.24.0.rc2 + diff --git a/gnu/packages/patches/rust-1.48-linker-locale.patch b/gnu/packages/patches/rust-1.48-linker-locale.patch new file mode 100644 index 0000000000..d06dcbe682 --- /dev/null +++ b/gnu/packages/patches/rust-1.48-linker-locale.patch @@ -0,0 +1,14 @@ +https://github.com/rust-lang/rust/pull/74416 +diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs +index 3df956c465e..f45fee45be4 100644 +--- a/compiler/rustc_codegen_ssa/src/back/linker.rs ++++ b/compiler/rustc_codegen_ssa/src/back/linker.rs +@@ -28,7 +28,7 @@ + pub fn disable_localization(linker: &mut Command) { + // No harm in setting both env vars simultaneously. + // Unix-style linkers. +- linker.env("LC_ALL", "C"); ++ linker.env("LC_ALL", "en_US.UTF-8"); + // MSVC's `link.exe`. + linker.env("VSLANG", "1033"); + } diff --git a/gnu/packages/patches/smalltalk-multiplication-overflow.patch b/gnu/packages/patches/smalltalk-multiplication-overflow.patch new file mode 100644 index 0000000000..7a0b4d02f7 --- /dev/null +++ b/gnu/packages/patches/smalltalk-multiplication-overflow.patch @@ -0,0 +1,121 @@ +Extracted from this commit without the ChangeLog to avoid conflicts: +http://git.savannah.gnu.org/cgit/smalltalk.git/commit/?id=72ada189aba0283c551ead16635c1983968080b8 + +The upstream commit message is +From 72ada189aba0283c551ead16635c1983968080b8 Mon Sep 17 00:00:00 2001 +From: Holger Hans Peter Freyther <holger@moiji-mobile.com> +Date: Sat, 7 Nov 2015 18:09:31 +0100 +Subject: libgst: Add alternative multiplication overflow check + +Apple clang on OSX and the version on FreeBSD optimize the +multiplication check away. Clang introduced a family of +builtins to do the multiplication and check for the overflow +and GCC made the API usable. For clang we would need to know +if intptr_t is of type int, long int, long long int and +then use the smul, smull smulll. +Luckily clang is adopting the better interface and this is +what we are starting to use now. This means the new code +will be used on GCC5 (and later) and some future versions of +clang. + +2015-11-07 Holger Hans Peter Freyther <holger@freyther.de> + + * build-aux/overflow-builtins.m4: Add new macro. + * configure.ac: Use GST_C_OVERFLOW_BUILTINS macro. + +2015-11-07 Holger Hans Peter Freyther <holger@freyther.de> + + * interp.inl: Add alternative mul_with_check implementation. +--- + ChangeLog | 5 +++++ + build-aux/overflow-builtins.m4 | 23 +++++++++++++++++++++++ + configure.ac | 1 + + libgst/ChangeLog | 4 ++++ + libgst/interp.inl | 22 ++++++++++++++++++++++ + 5 files changed, 55 insertions(+) + create mode 100644 build-aux/overflow-builtins.m4 + +diff --git a/build-aux/overflow-builtins.m4 b/build-aux/overflow-builtins.m4 +new file mode 100644 +index 00000000..9d050196 +--- /dev/null ++++ b/build-aux/overflow-builtins.m4 +@@ -0,0 +1,23 @@ ++dnl Check whether the host supports synchronization builtins. ++ ++AC_DEFUN([GST_C_OVERFLOW_BUILTINS], [ ++ AC_REQUIRE([AC_CANONICAL_HOST]) ++ AC_CACHE_CHECK([whether the host supports __builtin_mul_overflow], ++ gst_cv_have_builtin_mul_overflow, [ ++ save_CFLAGS="$CFLAGS" ++ case $host in ++ i?86-apple-darwin*) ;; ++ i?86-*-*) CFLAGS="$CFLAGS -march=i486" ;; ++ esac ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foovar = 0;]], [[ ++if (__builtin_mul_overflow(44444, 55555, &foovar)) ++ return 23;]])], ++ [gst_cv_have_builtin_mul_overflow=yes], ++ [gst_cv_have_builtin_mul_overflow=no]) ++ CFLAGS="$save_CFLAGS" ++ ]) ++ if test $gst_cv_have_builtin_mul_overflow = yes; then ++ AC_DEFINE(HAVE_OVERFLOW_BUILTINS, 1, ++ [Define to 1 if the host supports __builtin_*_overflow builtins]) ++ fi ++]) +diff --git a/configure.ac b/configure.ac +index e789be45..0bac23ef 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -243,6 +243,7 @@ GST_C_SYNC_BUILTINS + if test $gst_cv_have_sync_fetch_and_add = no; then + AC_MSG_ERROR([Synchronization primitives not found, please use a newer compiler.]) + fi ++GST_C_OVERFLOW_BUILTINS + + GST_LOCK + AC_SYS_LARGEFILE +diff --git a/libgst/interp.inl b/libgst/interp.inl +index e18e27c7..dbc631bc 100644 +--- a/libgst/interp.inl ++++ b/libgst/interp.inl +@@ -159,6 +159,27 @@ sub_with_check (OOP op1, OOP op2, mst_Boolean *overflow) + OOP + mul_with_check (OOP op1, OOP op2, mst_Boolean *overflow) + { ++#ifdef HAVE_OVERFLOW_BUILTINS ++ intptr_t a = TO_INT (op1); ++ intptr_t b = TO_INT (op2); ++ intptr_t result; ++ ++ if (__builtin_mul_overflow(a, b, &result)) ++ { ++ *overflow = true; ++ return FROM_INT(0); ++ } ++ ++ ++ if (result < MIN_ST_INT || result > MAX_ST_INT) ++ { ++ *overflow = true; ++ return FROM_INT(0); ++ } ++ ++ *overflow = false; ++ return FROM_INT(result); ++#else + intptr_t a = TO_INT (op1); + intptr_t b = TO_INT (op2); + intmax_t result = (intmax_t)a * b; +@@ -188,6 +209,7 @@ mul_with_check (OOP op1, OOP op2, mst_Boolean *overflow) + } + + return FROM_INT (0); ++#endif + } + + /* State of the random generator. +-- +2.29.2 + |