Skip to contentSkip to conversation

libtoml11: Add new recipe

PATCH Superseded [email protected] 2 participants 3 messages Oct 12, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libtoml11: Add new recipe

From: Mingli Yu <[email protected]>

toml11 is a feature-rich TOML language library for C++11/14/17/20 [1].

 # ./run-ptest
PASS: test_comments
PASS: test_datetime
PASS: test_error_message
PASS: test_find
PASS: test_find_or
PASS: test_format_floating
PASS: test_format_integer
PASS: test_format_table
PASS: test_get
PASS: test_get_or
PASS: test_literal
PASS: test_location
PASS: test_parse_array
PASS: test_parse_boolean
PASS: test_parse_datetime
[snip]

[1] https://github.com/ToruNiina/toml11

---
 ...issing-zero-initialization-to-region.patch | 34 ++++++++++++++++
 .../libtoml11/files/run-ptest                 | 12 ++++++
 .../libtoml11/libtoml11_4.2.0.bb              | 39 +++++++++++++++++++
 3 files changed, 85 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/libtoml11/files/0001-fix-add-missing-zero-initialization-to-region.patch
 create mode 100755 meta-oe/recipes-devtools/libtoml11/files/run-ptest
 create mode 100644 meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb
meta-oe/recipes-devtools/libtoml11/files/0001-fix-add-missing-zero-initialization-to-region.patch new file +34 -0
new file mode 100644
index 000000000..b779d493a
@@ -0,0 +1,34 @@
+From 9c7cef94a551cfdbbe2cce262c29221e22643d84 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <[email protected]>
+Date: Mon, 19 Aug 2024 06:35:03 +0200
+Subject: [PATCH] fix: add missing zero initialization to region
+
+Fixes below error:
+
+/build/tmp-glibc/work/core2-64-wrs-linux/libtoml11/1_4.2.0-r0/git/include/toml11/fwd/../fwd/../fwd/region_fwd.hpp:49:5: error: '<unnamed>.toml::detail::region::first_' is used uninitialized [-Werror=uninitialized]
+   49 |     region(region&&)      = default;
+      |     ^~~~~~
+
+Upstream-Status: Backport [https://github.com/ToruNiina/toml11/commit/9c7cef94a551cfdbbe2cce262c29221e22643d84]
+
+---
+ include/toml11/fwd/region_fwd.hpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/toml11/fwd/region_fwd.hpp b/include/toml11/fwd/region_fwd.hpp
+index b40317d..26f1a9b 100644
+--- a/include/toml11/fwd/region_fwd.hpp
++++ b/include/toml11/fwd/region_fwd.hpp
+@@ -34,7 +34,8 @@ class region
+     // a value that is constructed manually does not have input stream info
+     region()
+         : source_(nullptr), source_name_(""), length_(0),
+-          first_line_(0), first_column_(0), last_line_(0), last_column_(0)
++          first_(0), first_line_(0), first_column_(0), last_(0), last_line_(0),
++          last_column_(0)
+     {}
+ 
+     // a value defined in [first, last).
+-- 
+2.34.1
+
meta-oe/recipes-devtools/libtoml11/files/run-ptest new file +12 -0
new file mode 100755
index 000000000..9bc480aa7
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd tests
+for atest in test_* ; do
+    rm -rf tests.log
+    ./${atest} > tests.log 2>&1
+    if [ $? = 0 ] ; then
+        echo "PASS: ${atest}"
+    else
+        echo "FAIL: ${atest}"
+    fi
+done
meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb new file +39 -0
new file mode 100644
index 000000000..758e258a5
@@ -0,0 +1,39 @@
+SUMMARY = "TOML for Modern C++"
+DESCRIPTION = "toml11 is a feature-rich TOML language library for \
+               C++11/14/17/20."
+
+HOMEPAGE = "https://github.com/ToruNiina/toml11"
+
+SECTION = "libs"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=44d1fcf70c7aa6991533c38daf7befa3"
+
+PE = "1"
+
+SRCREV = "cc0bee4fd46ea1f5db147d63ea545208cc9e8405"
+SRCREV_json = "9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03"
+SRCREV_doctest = "ae7a13539fb71f270b87eb2e874fbac80bc8dda2"
+
+SRC_URI = "git://github.com/ToruNiina/toml11;branch=main;protocol=https \
+           git://github.com/nlohmann/json;destsuffix=git/tests/extlib/json;name=json;branch=develop;protocol=https \
+           git://github.com/doctest/doctest;destsuffix=git/tests/extlib/doctest;name=doctest;branch=master;protocol=https \
+           file://0001-fix-add-missing-zero-initialization-to-region.patch \
+           file://run-ptest \
+"
+SRCREV_FORMAT = "json_doctest"
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE += "-DTOML11_PRECOMPILE=ON \
+                  -DTOML11_BUILD_TESTS=${@bb.utils.contains("DISTRO_FEATURES", "ptest", "ON", "OFF", d)} \
+"
+
+ALLOW_EMPTY:${PN} = "1"
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -r ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 ptest-packagelists-meta-oe.inc: Add libtoml11

From: Mingli Yu <[email protected]>

---
 meta-oe/conf/include/ptest-packagelists-meta-oe.inc | 1 +
 1 file changed, 1 insertion(+)
meta-oe/conf/include/ptest-packagelists-meta-oe.inc +1 -0
index 565037469..923179a62 100644
@@ -25,6 +25,7 @@ PTESTS_FAST_META_OE = "\
     librelp \
     libssh \
     libtinyxml2 \
+    libtoml11 \
     libxml++-5.0 \
     libyang \
     lmdb \
Signature · 1 line
2.34.1
#2 lore raw
In reply to [email protected]
Quoted 101 lines · Mingli via lists.openembedded.org

From: Mingli Yu <[email protected]>

toml11 is a feature-rich TOML language library for C++11/14/17/20 [1].

 # ./run-ptest
PASS: test_comments
PASS: test_datetime
PASS: test_error_message
PASS: test_find
PASS: test_find_or
PASS: test_format_floating
PASS: test_format_integer
PASS: test_format_table
PASS: test_get
PASS: test_get_or
PASS: test_literal
PASS: test_location
PASS: test_parse_array
PASS: test_parse_boolean
PASS: test_parse_datetime
[snip]

[1] https://github.com/ToruNiina/toml11

---
 ...issing-zero-initialization-to-region.patch | 34 ++++++++++++++++
 .../libtoml11/files/run-ptest                 | 12 ++++++
 .../libtoml11/libtoml11_4.2.0.bb              | 39 +++++++++++++++++++
 3 files changed, 85 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/libtoml11/files/0001-fix-add-missing-zero-initialization-to-region.patch
 create mode 100755 meta-oe/recipes-devtools/libtoml11/files/run-ptest
 create mode 100644 meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb
meta-oe/recipes-devtools/libtoml11/files/0001-fix-add-missing-zero-initialization-to-region.patch new file +34 -0
new file mode 100644
index 000000000..b779d493a
@@ -0,0 +1,34 @@
+From 9c7cef94a551cfdbbe2cce262c29221e22643d84 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <[email protected]>
+Date: Mon, 19 Aug 2024 06:35:03 +0200
+Subject: [PATCH] fix: add missing zero initialization to region
+
+Fixes below error:
+
+/build/tmp-glibc/work/core2-64-wrs-linux/libtoml11/1_4.2.0-r0/git/include/toml11/fwd/../fwd/../fwd/region_fwd.hpp:49:5: error: '<unnamed>.toml::detail::region::first_' is used uninitialized [-Werror=uninitialized]
+   49 |     region(region&&)      = default;
+      |     ^~~~~~
+
+Upstream-Status: Backport [https://github.com/ToruNiina/toml11/commit/9c7cef94a551cfdbbe2cce262c29221e22643d84]
+
+---
+ include/toml11/fwd/region_fwd.hpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/toml11/fwd/region_fwd.hpp b/include/toml11/fwd/region_fwd.hpp
+index b40317d..26f1a9b 100644
+--- a/include/toml11/fwd/region_fwd.hpp
++++ b/include/toml11/fwd/region_fwd.hpp
+@@ -34,7 +34,8 @@ class region
+     // a value that is constructed manually does not have input stream info
+     region()
+         : source_(nullptr), source_name_(""), length_(0),
+-          first_line_(0), first_column_(0), last_line_(0), last_column_(0)
++          first_(0), first_line_(0), first_column_(0), last_(0), last_line_(0),
++          last_column_(0)
+     {}
+
+     // a value defined in [first, last).
+--
+2.34.1
+
meta-oe/recipes-devtools/libtoml11/files/run-ptest new file +12 -0
new file mode 100755
index 000000000..9bc480aa7
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd tests
+for atest in test_* ; do
+    rm -rf tests.log
+    ./${atest} > tests.log 2>&1
+    if [ $? = 0 ] ; then
+        echo "PASS: ${atest}"
+    else
+        echo "FAIL: ${atest}"
+    fi
+done
meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb new file +2 -0
new file mode 100644
index 000000000..758e258a5
@@ -0,0 +1,39 @@
+SUMMARY = "TOML for Modern C++"
+DESCRIPTION = "toml11 is a feature-rich TOML language library for \

meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb line 12

Quoted 10 lines
meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb new file +10 -0
+               C++11/14/17/20."
+
+HOMEPAGE = "https://github.com/ToruNiina/toml11"
+
+SECTION = "libs"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=44d1fcf70c7aa6991533c38daf7befa3"
+
+PE = "1"

Why do we need PE in a newly added recipe ?

meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb line 24

Quoted 12 lines
meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb new file +12 -0
+
+SRCREV = "cc0bee4fd46ea1f5db147d63ea545208cc9e8405"
+SRCREV_json = "9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03"
+SRCREV_doctest = "ae7a13539fb71f270b87eb2e874fbac80bc8dda2"
+
+SRC_URI = "git://github.com/ToruNiina/toml11;branch=main;protocol=https \
+           git://github.com/nlohmann/json;destsuffix=git/tests/extlib/json;name=json;branch=develop;protocol=https \
+           git://github.com/doctest/doctest;destsuffix=git/tests/extlib/doctest;name=doctest;branch=master;protocol=https \
+           file://0001-fix-add-missing-zero-initialization-to-region.patch \
+           file://run-ptest \
+"
+SRCREV_FORMAT = "json_doctest"

Perhaps it will be good to define name= for the first entry in SRC_URI as well.

Quoted 27 lines
meta-oe/recipes-devtools/libtoml11/libtoml11_4.2.0.bb new file +15 -1
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE += "-DTOML11_PRECOMPILE=ON \
+                  -DTOML11_BUILD_TESTS=${@bb.utils.contains("DISTRO_FEATURES", "ptest", "ON", "OFF", d)} \
+"
+
+ALLOW_EMPTY:${PN} = "1"
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -r ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#112822): https://lists.openembedded.org/g/openembedded-devel/message/112822
Mute This Topic: https://lists.openembedded.org/mt/108963713/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-