Skip to content

Commit

Permalink
main/vte-common: update to 0.78.0
Browse files Browse the repository at this point in the history
  • Loading branch information
q66 committed Sep 29, 2024
1 parent d43f531 commit f8f4002
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 3 deletions.
111 changes: 111 additions & 0 deletions main/vte-common/patches/libcxx.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
From 9516e749b11ea800b5d1fe2808ffcc4a092e3f8e Mon Sep 17 00:00:00 2001
From: q66 <[email protected]>
Date: Sun, 29 Sep 2024 01:50:02 +0200
Subject: [PATCH] work around lack of c++17 compliance in libc++ + fixes

---
src/color-test.cc | 2 +-
src/icu-glue.hh | 1 +
src/minifont.cc | 1 +
src/termprops.hh | 40 +++++++++++++++++++++++++++++-----------
4 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/src/color-test.cc b/src/color-test.cc
index 0ed9089..1bfad31 100644
--- a/src/color-test.cc
+++ b/src/color-test.cc
@@ -165,7 +165,7 @@ static void
test_color_to_string (void)
{
auto test = [](std::string str,
- bool alpha = false) constexpr noexcept -> void
+ bool alpha = false) noexcept -> void
{
auto const value = parse<rgba>(str);
assert(value);
diff --git a/src/icu-glue.hh b/src/icu-glue.hh
index f2c3331..f72999b 100644
--- a/src/icu-glue.hh
+++ b/src/icu-glue.hh
@@ -20,6 +20,7 @@
#include <glib.h>
#include <memory>
#include <optional>
+#include <string_view>

namespace vte::base {

diff --git a/src/minifont.cc b/src/minifont.cc
index 9be96d6..8d8c441 100644
--- a/src/minifont.cc
+++ b/src/minifont.cc
@@ -19,6 +19,7 @@
#include "config.h"

#include <cmath>
+#include <algorithm>

#include "cairo-glue.hh"

diff --git a/src/termprops.hh b/src/termprops.hh
index 0d3f0f4..8f22a3d 100644
--- a/src/termprops.hh
+++ b/src/termprops.hh
@@ -24,6 +24,8 @@
#include "glib-glue.hh"

#include <cmath> // for std::isfinite
+#include <cctype>
+#include <cstdlib>

#include <charconv>
#include <optional>
@@ -388,18 +390,34 @@ template<std::floating_point T>
inline std::optional<TermpropValue>
parse_termprop_floating(std::string_view const& str) noexcept
{
- auto v = T{};
- if (auto [ptr, err] = std::from_chars(std::begin(str),
- std::end(str),
- v,
- std::chars_format::general);
- err == std::errc() &&
- ptr == std::end(str) &&
- std::isfinite(v)) {
- return double(v);
+ /* do away with differences of from_chars and strtod, that is:
+ * - stuff starting with whitespace or sign
+ * - hex literals
+ */
+ if (str.size() == 0) return std::nullopt;
+ if (str[0] != '.' && !std::isdigit(str[0])) return std::nullopt;
+ if (str[0] == '0' && str.size() >= 2 && (str[1] == 'x' || str[1] == 'X'))
+ return std::nullopt;
+ /* lol no c api to parse unterminated buffers */
+ std::string big;
+ char buf[64];
+ char *strp = buf;
+ if (str.size() < sizeof(buf)) {
+ memcpy(buf, str.data(), str.size());
+ buf[str.size()] = '\0';
+ } else {
+ big = str;
+ strp = big.data();
}
-
- return std::nullopt;
+ /* now parse the mf */
+ char *end = nullptr;
+ auto vf = strtold(strp, &end);
+ /* did not parse cleanly */
+ if (!end || *end) return std::nullopt;
+ /* now get the right type */
+ auto v = static_cast<T>(vf);
+ if (!std::isfinite(v)) return std::nullopt;
+ return v;
}

template<std::floating_point T>
--
2.46.2

11 changes: 8 additions & 3 deletions main/vte-common/template.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pkgname = "vte-common"
pkgver = "0.76.4"
pkgver = "0.78.0"
pkgrel = 0
build_style = "meson"
configure_args = [
Expand Down Expand Up @@ -40,13 +40,18 @@
source = (
f"https://gitlab.gnome.org/GNOME/vte/-/archive/{pkgver}/vte-{pkgver}.tar.gz"
)
sha256 = "88979af0b02bac3c6d0bc95fcbeaf0ee025a7fc7a5b127155188b90718af0e78"
sha256 = "82e19d11780fed4b66400f000829ce5ca113efbbfb7975815f26ed93e4c05f2d"
# assert in meson
options = ["!lto", "!cross"]

tool_flags = {
"CFLAGS": ["-Wno-cast-function-type-strict"],
"CXXFLAGS": ["-Wno-cast-function-type-strict"],
"CXXFLAGS": [
"-Wno-cast-function-type-strict",
# these are bad but also very noisy...
"-Wno-cast-align",
"-Wno-float-equal",
],
}


Expand Down

0 comments on commit f8f4002

Please sign in to comment.