From 7bcfdebc55f8b50d490201e63461d6533d60c19d Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Mon, 26 Sep 2022 21:30:24 +0800 Subject: gnu: Add abseil-cpp-cxxstd17. * gnu/packages/cpp.scm (abseil-cpp-cxxstd17): New variable. Signed-off-by: Liliana Marie Prikler --- gnu/packages/cpp.scm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index d03e0bc7e18..5e0646444c7 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -1041,6 +1041,15 @@ Google's C++ code base.") `(cons* "-DBUILD_TESTING=ON" (delete "-DABSL_RUN_TESTS=ON" ,flags)))))))) +(define-public abseil-cpp-cxxstd17 + (let ((base abseil-cpp)) + (hidden-package + (package/inherit base + (arguments + (substitute-keyword-arguments (package-arguments base) + ((#:configure-flags flags) + #~(cons* "-DCMAKE_CXX_STANDARD=17" #$flags)))))))) + (define-public pegtl (package (name "pegtl") -- cgit v1.3 From dc07a4ce6c34c2b61d0713a4a6ed89bc128783b4 Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Mon, 26 Sep 2022 21:30:49 +0800 Subject: gnu: Add crc32c. * gnu/packages/cpp.scm (crc32c): New variable. * gnu/packages/patches/crc32c-unbundle-googletest.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it here. Signed-off-by: Liliana Marie Prikler --- gnu/local.mk | 1 + gnu/packages/cpp.scm | 38 ++++++++++++++++++++++ .../patches/crc32c-unbundle-googletest.patch | 21 ++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 gnu/packages/patches/crc32c-unbundle-googletest.patch (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/local.mk b/gnu/local.mk index 9b3b199c7c1..75e2309af53 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -997,6 +997,7 @@ dist_patch_DATA = \ %D%/packages/patches/cpuinfo-system-libraries.patch \ %D%/packages/patches/cpulimit-with-glib-2.32.patch \ %D%/packages/patches/crawl-upgrade-saves.patch \ + %D%/packages/patches/crc32c-unbundle-googletest.patch \ %D%/packages/patches/crda-optional-gcrypt.patch \ %D%/packages/patches/clucene-contribs-lib.patch \ %D%/packages/patches/cube-nocheck.patch \ diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 5e0646444c7..805413cc613 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -1916,3 +1916,41 @@ and above. It is header only and has zero dependencies. It provides a templated string type for compatibility with any STL-like string (std::string, std::wstring, etc).") (license license:boost1.0))) + +(define-public crc32c + (package + (name "crc32c") + (version "1.1.2") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/crc32c") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0966lyy3w5cnrs0c0fkma4hga51k54hns72l4n76944awqssap7j")) + (patches (search-patches "crc32c-unbundle-googletest.patch")))) + (build-system cmake-build-system) + (arguments + (list #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON" + "-DCRC32C_BUILD_BENCHMARKS=OFF" + "-DCRC32C_USE_GLOG=OFF" + (string-append + "-DCRC32C_BUILD_TESTS=" + ;; TODO: perhaps infer #:tests? + (if #$(%current-target-system) + "OFF" "ON"))) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'make-reproducible + (lambda _ + (substitute* "CMakeLists.txt" + (("if\\(HAVE_SSE42\\)") "if(FALSE)"))))))) + (native-inputs (list googletest)) + (home-page "https://github.com/google/crc32c") + (synopsis "Cyclic redundancy check") + (description + "This package provides architecture-specific implementations of the +CRC32C algorithm, which is specified in RFC 3720, section 12.1.") + (license license:bsd-3))) diff --git a/gnu/packages/patches/crc32c-unbundle-googletest.patch b/gnu/packages/patches/crc32c-unbundle-googletest.patch new file mode 100644 index 00000000000..da513c5d4ed --- /dev/null +++ b/gnu/packages/patches/crc32c-unbundle-googletest.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8490728..c7f0952 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -315,15 +315,7 @@ if(CRC32C_BUILD_TESTS) + set(install_gmock OFF) + + # This project is tested using GoogleTest. +- add_subdirectory("third_party/googletest") +- +- # GoogleTest triggers a missing field initializers warning. +- if(CRC32C_HAVE_NO_MISSING_FIELD_INITIALIZERS) +- set_property(TARGET gtest +- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers) +- set_property(TARGET gmock +- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers) +- endif(CRC32C_HAVE_NO_MISSING_FIELD_INITIALIZERS) ++ find_package(GTest REQUIRED) + + add_executable(crc32c_tests "") + target_sources(crc32c_tests -- cgit v1.3 From afd853977a4872748960cd9a74e608509c856c45 Mon Sep 17 00:00:00 2001 From: David Elsing Date: Thu, 13 Oct 2022 21:04:10 +0000 Subject: gnu: Add fast-float. * gnu/packages/cpp.scm (fast-float-test-files, fast-float): New variables. Signed-off-by: Liliana Marie Prikler --- gnu/packages/cpp.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 805413cc613..e8c3b29312d 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -29,6 +29,7 @@ ;;; Copyright © 2022 muradm ;;; Copyright © 2022 Attila Lendvai ;;; Copyright © 2022 Arun Isaac +;;; Copyright © 2022 David Elsing ;;; ;;; This file is part of GNU Guix. ;;; @@ -1954,3 +1955,56 @@ std::wstring, etc).") "This package provides architecture-specific implementations of the CRC32C algorithm, which is specified in RFC 3720, section 12.1.") (license license:bsd-3))) + +(define fast-float-test-files + (let ((commit "97a0b2e638feb479387554cf253e346500541e7e")) + (origin + (method git-fetch) + (uri (git-reference + (url (string-append "https://github.com/fastfloat" + "/supplemental_test_files.git")) + (commit "97a0b2e638feb479387554cf253e346500541e7e"))) + (file-name (string-append "fast-float-test-files-" + (string-take commit 8))) + (sha256 + (base32 + "0dxbiyzyh7i847i89ablfzypfc3ckhm7f74w98jsh73v1mppmxlf"))))) + +(define-public fast-float + (package + (name "fast-float") + (version "3.5.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/fastfloat/fast_float") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0z3rxxd0pwvw70dbnv63rm67biw829vdqf50y16isxm6g3sbrz8g")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags #~(list "-DFASTFLOAT_TEST=ON" + "-DSYSTEM_DOCTEST=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-cmake-tests + (lambda* (#:key inputs native-inputs #:allow-other-keys) + (substitute* "tests/CMakeLists.txt" + (("FetchContent_GetProperties\\(supplemental_test_files.*") + "") + (("if\\(NOT supplemental_test_files_POPULATED.*") + (string-append + "set(supplemental_test_files_BINARY_DIR " + (search-input-directory (or native-inputs inputs) + "data") + ")\nif(0)\n")))))))) + (native-inputs (list doctest fast-float-test-files)) + (home-page "https://github.com/fastfloat/fast_float") + (synopsis "Floating point number parser for C++") + (description "@code{fast_float} is a header-only C++ library for parsing +floating point numbers from strings. It implements the C++ from_chars +functions for the float and double types.") + (license (list license:asl2.0 license:expat)))) ; dual licensed -- cgit v1.3 From c1529021917b28905349d888eb89b461c9ad0fcc Mon Sep 17 00:00:00 2001 From: David Elsing Date: Thu, 13 Oct 2022 21:04:11 +0000 Subject: gnu: Add pocketfft-cpp. * gnu/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it here. * gnu/packages/cpp.scm (pocketfft-cpp): New variable. Signed-off-by: Liliana Marie Prikler --- gnu/local.mk | 1 + gnu/packages/cpp.scm | 28 ++++++ .../pocketfft-cpp-prefer-preprocessor-if.patch | 109 +++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 gnu/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/local.mk b/gnu/local.mk index db76aa21e09..9313ea81f9a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1621,6 +1621,7 @@ dist_patch_DATA = \ %D%/packages/patches/pciutils-hurd-configure.patch \ %D%/packages/patches/pciutils-hurd-fix.patch \ %D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \ + %D%/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch \ %D%/packages/patches/pokerth-boost.patch \ %D%/packages/patches/ppsspp-disable-upgrade-and-gold.patch \ %D%/packages/patches/pthreadpool-system-libraries.patch \ diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index e8c3b29312d..b5adcd8bcc4 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -2008,3 +2008,31 @@ CRC32C algorithm, which is specified in RFC 3720, section 12.1.") floating point numbers from strings. It implements the C++ from_chars functions for the float and double types.") (license (list license:asl2.0 license:expat)))) ; dual licensed + +(define-public pocketfft-cpp + (let ((commit "daa8bb18327bc5c7d22c69428c25cf5dc64167d3") + (revision "0")) + (package + (name "pocketfft-cpp") + (version (git-version "0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mreineck/pocketfft") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1dbkkqkmkxgmz1qjpsqzic5ig3qw1pqndbb3dvjc7xq5f2rdzyq1")) + (patches (search-patches + "pocketfft-cpp-prefer-preprocessor-if.patch")))) + (build-system copy-build-system) + (arguments + (list + #:install-plan #~'(("pocketfft_hdronly.h" "include/")))) + (home-page "https://github.com/mreineck/pocketfft") + (synopsis "C++11 header-only Fast Fourier Transform library") + (description "This package provides a single-header C++11 library for +computing Fast Fourier transformations. It supports multidimensional arrays, +different floating point sizes and complex transformations.") + (license license:bsd-3)))) diff --git a/gnu/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch b/gnu/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch new file mode 100644 index 00000000000..028bdf2f896 --- /dev/null +++ b/gnu/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch @@ -0,0 +1,109 @@ +This patch replaces #ifndef POCKETFFT_NO_VECTORS by #if POCKETFFT_NO_VECTORS. +It also makes it the default, as SIMD instructions are not that well-suited +for substitutes. + +diff --git a/pocketfft_hdronly.h b/pocketfft_hdronly.h +index d75ada6..b2d0a23 100644 +--- a/pocketfft_hdronly.h ++++ b/pocketfft_hdronly.h +@@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #ifndef POCKETFFT_HDRONLY_H + #define POCKETFFT_HDRONLY_H + ++#ifndef POCKETFFT_NO_VECTORS ++#define POCKETFFT_NO_VECTORS 1 ++#endif ++ + #ifndef __cplusplus + #error This file is C++ and requires a C++ compiler. + #endif +@@ -106,29 +110,29 @@ constexpr bool FORWARD = true, + BACKWARD = false; + + // only enable vector support for gcc>=5.0 and clang>=5.0 +-#ifndef POCKETFFT_NO_VECTORS +-#define POCKETFFT_NO_VECTORS ++#if !(POCKETFFT_NO_VECTORS) ++#define POCKETFFT_NO_VECTORS 1 + #if defined(__INTEL_COMPILER) + // do nothing. This is necessary because this compiler also sets __GNUC__. + #elif defined(__clang__) + // AppleClang has their own version numbering + #ifdef __apple_build_version__ + # if (__clang_major__ > 9) || (__clang_major__ == 9 && __clang_minor__ >= 1) +-# undef POCKETFFT_NO_VECTORS ++#define POCKETFFT_NO_VECTORS 0 + # endif + #elif __clang_major__ >= 5 +-# undef POCKETFFT_NO_VECTORS ++#define POCKETFFT_NO_VECTORS 0 + #endif + #elif defined(__GNUC__) + #if __GNUC__>=5 +-#undef POCKETFFT_NO_VECTORS ++#define POCKETFFT_NO_VECTORS 0 + #endif + #endif + #endif + + template struct VLEN { static constexpr size_t val=1; }; + +-#ifndef POCKETFFT_NO_VECTORS ++#if !(POCKETFFT_NO_VECTORS) + #if (defined(__AVX512F__)) + template<> struct VLEN { static constexpr size_t val=16; }; + template<> struct VLEN { static constexpr size_t val=8; }; +@@ -145,7 +149,7 @@ template<> struct VLEN { static constexpr size_t val=2; }; + template<> struct VLEN { static constexpr size_t val=4; }; + template<> struct VLEN { static constexpr size_t val=2; }; + #else +-#define POCKETFFT_NO_VECTORS ++#define POCKETFFT_NO_VECTORS 1 + #endif + #endif + +@@ -180,7 +184,7 @@ template class arr + T *p; + size_t sz; + +-#if defined(POCKETFFT_NO_VECTORS) ++#if POCKETFFT_NO_VECTORS + static T *ralloc(size_t num) + { + if (num==0) return nullptr; +@@ -3026,7 +3030,7 @@ class rev_iter + template struct VTYPE {}; + template using vtype_t = typename VTYPE::type; + +-#ifndef POCKETFFT_NO_VECTORS ++#if !(POCKETFFT_NO_VECTORS) + template<> struct VTYPE + { + using type = float __attribute__ ((vector_size (VLEN::val*sizeof(float)))); +@@ -3139,7 +3143,7 @@ POCKETFFT_NOINLINE void general_nd(const cndarr &in, ndarr &out, + auto storage = alloc_tmp(in.shape(), len, sizeof(T)); + const auto &tin(iax==0? in : out); + multi_iter it(tin, out, axes[iax]); +-#ifndef POCKETFFT_NO_VECTORS ++#if !(POCKETFFT_NO_VECTORS) + if (vlen>1) + while (it.remaining()>=vlen) + { +@@ -3245,7 +3249,7 @@ template POCKETFFT_NOINLINE void general_r2c( + constexpr auto vlen = VLEN::val; + auto storage = alloc_tmp(in.shape(), len, sizeof(T)); + multi_iter it(in, out, axis); +-#ifndef POCKETFFT_NO_VECTORS ++#if !(POCKETFFT_NO_VECTORS) + if (vlen>1) + while (it.remaining()>=vlen) + { +@@ -3300,7 +3304,7 @@ template POCKETFFT_NOINLINE void general_c2r( + constexpr auto vlen = VLEN::val; + auto storage = alloc_tmp(out.shape(), len, sizeof(T)); + multi_iter it(in, out, axis); +-#ifndef POCKETFFT_NO_VECTORS ++#if !(POCKETFFT_NO_VECTORS) + if (vlen>1) + while (it.remaining()>=vlen) + { -- cgit v1.3 From e34bf9b63423f5846fa3b03be0c970cb3d33ac33 Mon Sep 17 00:00:00 2001 From: David Elsing Date: Thu, 13 Oct 2022 21:04:12 +0000 Subject: gnu: Add sajson. * gnu/packages/cpp.scm (sajson): New variable. Signed-off-by: Liliana Marie Prikler --- gnu/packages/cpp.scm | 65 ++++++++++++++++++++++ gnu/packages/patches/sajson-build-with-gcc10.patch | 45 +++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 gnu/packages/patches/sajson-build-with-gcc10.patch (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index b5adcd8bcc4..9a3eeee1956 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -57,6 +57,7 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system meson) #:use-module (guix build-system python) + #:use-module (guix build-system scons) #:use-module (guix modules) #:use-module (guix gexp) #:use-module (gnu packages) @@ -2036,3 +2037,67 @@ functions for the float and double types.") computing Fast Fourier transformations. It supports multidimensional arrays, different floating point sizes and complex transformations.") (license license:bsd-3)))) + +(define-public sajson + (let ((commit "ec644013e34f9984a3cc9ba568cab97a391db9cd") + (revision "0")) + (package + (name "sajson") + (version (git-version "1.0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/chadaustin/sajson") + (commit commit))) + (file-name (git-file-name name version)) + (patches + (search-patches "sajson-build-with-gcc10.patch")) + (sha256 + (base32 + "0fjag27w7gvkc5pdhq3ad7yc09rabpzahndw1sgsg04ipznidmmq")) + (modules '((guix build utils))) + (snippet '(delete-file-recursively "third-party")))) + (build-system scons-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'disable-other-builds + (lambda _ + (substitute* "SConstruct" + (("for name, tools in builds:") + "for name, tools in [('opt', [gcc, opt])]:")))) + (add-after 'unpack 'use-external-unittest-cpp + (lambda _ + (substitute* "SConscript" + (("unittestpp_env\\.Library") "_dummy = ") + (("test_env = env.Clone\\(tools=\\[unittestpp, sajson\\]\\)") + (string-append + "test_env = env.Clone(tools=[sajson])\n" + "test_env.Append(CPPPATH='" + (search-input-directory %build-inputs "/include/UnitTest++") + "', LIBPATH='" + (string-append #$(this-package-native-input "unittest-cpp") + "/lib") + "', LIBS=['UnitTest++'])"))))) + (replace 'build + (lambda* (#:key tests? #:allow-other-keys #:rest args) + (when tests? + (apply (assoc-ref %standard-phases 'build) + args)))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "build/opt/test") + (invoke "build/opt/test_unsorted")))) + (replace 'install + (lambda _ + (let ((out (string-append #$output "/include"))) + (install-file "include/sajson.h" out) + (install-file "include/sajson_ostream.h" out))))))) + (native-inputs (list unittest-cpp)) + (home-page "https://github.com/chadaustin/sajson") + (synopsis "C++11 header-only, in-place JSON parser") + (description "@code{sajson} is an in-place JSON parser with support for +parsing with only a single memory allocation.") + (license license:expat)))) diff --git a/gnu/packages/patches/sajson-build-with-gcc10.patch b/gnu/packages/patches/sajson-build-with-gcc10.patch new file mode 100644 index 00000000000..878706dc79e --- /dev/null +++ b/gnu/packages/patches/sajson-build-with-gcc10.patch @@ -0,0 +1,45 @@ +This patch is from the upstream pull request +https://github.com/chadaustin/sajson/pull/54. +It fixes linking with GCC. + +diff --git a/include/sajson.h b/include/sajson.h +index 8b4e05a..1bd045b 100644 +--- a/include/sajson.h ++++ b/include/sajson.h +@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t, size_t value) { + // header. This trick courtesy of Rich Geldreich's Purple JSON parser. + template + struct globals_struct { ++ static const unsigned char parse_flags[256]; ++}; ++typedef globals_struct<> globals; ++ + // clang-format off + + // bit 0 (1) - set if: plain ASCII string character + // bit 1 (2) - set if: whitespace + // bit 4 (0x10) - set if: 0-9 e E . +- constexpr static const uint8_t parse_flags[256] = { ++ template ++ const unsigned char globals_struct::parse_flags[256] = { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0, // 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1 +@@ -162,15 +167,13 @@ struct globals_struct { + }; + + // clang-format on +-}; +-typedef globals_struct<> globals; + +-constexpr inline bool is_plain_string_character(char c) { ++inline bool is_plain_string_character(char c) { + // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c; + return (globals::parse_flags[static_cast(c)] & 1) != 0; + } + +-constexpr inline bool is_whitespace(char c) { ++inline bool is_whitespace(char c) { + // return c == '\r' || c == '\n' || c == '\t' || c == ' '; + return (globals::parse_flags[static_cast(c)] & 2) != 0; + } -- cgit v1.3 From fd4342728db7969106d2b1eecce0ba369e2e01a3 Mon Sep 17 00:00:00 2001 From: David Elsing Date: Thu, 13 Oct 2022 21:04:15 +0000 Subject: gnu: Add optionparser. * gnu/packages/cpp.scm (optionparser): New variable. Signed-off-by: Liliana Marie Prikler --- gnu/packages/cpp.scm | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 9a3eeee1956..7cf7269f7f0 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -2101,3 +2101,50 @@ different floating point sizes and complex transformations.") (description "@code{sajson} is an in-place JSON parser with support for parsing with only a single memory allocation.") (license license:expat)))) + +(define-public optionparser + (package + (name "optionparser") + (version "1.7") + (source (origin + (method url-fetch) + (uri + (string-append "mirror://sourceforge/optionparser/" + "optionparser-" version ".tar.gz")) + (sha256 + (base32 + "04gfxrdzwacaynb8scsz6rr7nh64n6yk6w9dh2qdhrxw4caqr0dk")))) + (outputs '("out" "doc")) + (build-system gnu-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'chdir + (lambda _ (chdir "src"))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (begin + (invoke "./example_arg") + (invoke "./testparse") + (invoke "./testprintusage") + (invoke "./testodr") + (invoke "./example"))))) + (replace 'install + (lambda _ + (install-file "optionparser.h" + (string-append #$output "/include")))) + (add-after 'install 'install-doc + (lambda _ + (copy-recursively + "../html" + (string-append #$output:doc "/share/doc/optionparser/html"))))))) + (native-inputs (list doxygen)) + (home-page "https://optionparser.sourceforge.net/") + (synopsis "Header-only C++ library to parse command line options") + (description "This package provides a header-only C++ library to parse +command line options. It supports the short and long option formats of +getopt(), getopt_long() and getopt_long_only().") + (license license:expat))) -- cgit v1.3 From 3cbb634a8900f1cb0a9bb057c06fcac3079b7bea Mon Sep 17 00:00:00 2001 From: David Elsing Date: Thu, 13 Oct 2022 21:04:16 +0000 Subject: gnu: Add sajson-for-gemmi. * gnu/packages/cpp.scm (sajson-for-gemmi): New variable. Signed-off-by: Liliana Marie Prikler --- gnu/packages/chemistry.scm | 4 + gnu/packages/cpp.scm | 16 ++ .../sajson-for-gemmi-numbers-as-strings.patch | 195 +++++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm index c517610fe87..3b06d567119 100644 --- a/gnu/packages/chemistry.scm +++ b/gnu/packages/chemistry.scm @@ -27,6 +27,7 @@ #:use-module (guix utils) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (gnu packages) #:use-module (gnu packages algebra) @@ -35,6 +36,7 @@ #:use-module (gnu packages boost) #:use-module (gnu packages check) #:use-module (gnu packages compression) + #:use-module (gnu packages cpp) #:use-module (gnu packages documentation) #:use-module (gnu packages fontutils) #:use-module (gnu packages gl) @@ -50,8 +52,10 @@ #:use-module (gnu packages qt) #:use-module (gnu packages serialization) #:use-module (gnu packages sphinx) + #:use-module (gnu packages stb) #:use-module (gnu packages xml) #:use-module (guix build-system cmake) + #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system python)) diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 7cf7269f7f0..c8df516834b 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -2102,6 +2102,22 @@ different floating point sizes and complex transformations.") parsing with only a single memory allocation.") (license license:expat)))) +(define-public sajson-for-gemmi + (package/inherit sajson + (name "sajson-for-gemmi") + (source (origin + (inherit (package-source sajson)) + (patches (cons + (search-patch + "sajson-for-gemmi-numbers-as-strings.patch") + (origin-patches (package-source sajson)))))) + (arguments + (substitute-keyword-arguments (package-arguments sajson) + ;; This is a modified version used in gemmi, in which numbers are kept + ;; as strings. Building the tests fails with the modification. + ((#:tests? _ #f) #f))) + (properties '((hidden? . #t))))) + (define-public optionparser (package (name "optionparser") diff --git a/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch new file mode 100644 index 00000000000..6f476b8583f --- /dev/null +++ b/gnu/packages/patches/sajson-for-gemmi-numbers-as-strings.patch @@ -0,0 +1,195 @@ +Patch for gemmi: Keep numbers in JSON file as strings. + +Adapted from this commit of the bundled fork of sajson in gemmi: +https://github.com/project-gemmi/gemmi/commit/fccbca4f6040364ba708613e1429c2251872240d + +diff -ur a/include/sajson.h b/include/sajson.h +--- a/include/sajson.h ++++ b/include/sajson.h +@@ -411,43 +411,6 @@ + }; + } // namespace internal + +-namespace integer_storage { +-enum { word_length = 1 }; +- +-inline int load(const size_t* location) { +- int value; +- memcpy(&value, location, sizeof(value)); +- return value; +-} +- +-inline void store(size_t* location, int value) { +- // NOTE: Most modern compilers optimize away this constant-size +- // memcpy into a single instruction. If any don't, and treat +- // punning through a union as legal, they can be special-cased. +- static_assert( +- sizeof(value) <= sizeof(*location), +- "size_t must not be smaller than int"); +- memcpy(location, &value, sizeof(value)); +-} +-} // namespace integer_storage +- +-namespace double_storage { +-enum { word_length = sizeof(double) / sizeof(size_t) }; +- +-inline double load(const size_t* location) { +- double value; +- memcpy(&value, location, sizeof(double)); +- return value; +-} +- +-inline void store(size_t* location, double value) { +- // NOTE: Most modern compilers optimize away this constant-size +- // memcpy into a single instruction. If any don't, and treat +- // punning through a union as legal, they can be special-cased. +- memcpy(location, &value, sizeof(double)); +-} +-} // namespace double_storage +- + /// Represents a JSON value. First, call get_type() to check its type, + /// which determines which methods are available. + /// +@@ -585,70 +548,10 @@ + return length; + } + +- /// If a numeric value was parsed as a 32-bit integer, returns it. +- /// Only legal if get_type() is TYPE_INTEGER. +- int get_integer_value() const { +- assert_tag(tag::integer); +- return integer_storage::load(payload); +- } +- +- /// If a numeric value was parsed as a double, returns it. +- /// Only legal if get_type() is TYPE_DOUBLE. +- double get_double_value() const { +- assert_tag(tag::double_); +- return double_storage::load(payload); +- } +- +- /// Returns a numeric value as a double-precision float. +- /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE. +- double get_number_value() const { +- assert_tag_2(tag::integer, tag::double_); +- if (value_tag == tag::integer) { +- return get_integer_value(); +- } else { +- return get_double_value(); +- } +- } +- +- /// Returns true and writes to the output argument if the numeric value +- /// fits in a 53-bit integer. This is useful for timestamps and other +- /// situations where integral values with greater than 32-bit precision +- /// are used, as 64-bit values are not understood by all JSON +- /// implementations or languages. +- /// Returns false if the value is not an integer or not in range. +- /// Only legal if get_type() is TYPE_INTEGER or TYPE_DOUBLE. +- bool get_int53_value(int64_t* out) const { +- // Make sure the output variable is always defined to avoid any +- // possible situation like +- // https://gist.github.com/chadaustin/2c249cb850619ddec05b23ca42cf7a18 +- *out = 0; +- +- assert_tag_2(tag::integer, tag::double_); +- switch (value_tag) { +- case tag::integer: +- *out = get_integer_value(); +- return true; +- case tag::double_: { +- double v = get_double_value(); +- if (v < -(1LL << 53) || v > (1LL << 53)) { +- return false; +- } +- int64_t as_int = static_cast(v); +- if (as_int != v) { +- return false; +- } +- *out = as_int; +- return true; +- } +- default: +- return false; +- } +- } +- + /// Returns the length of the string. + /// Only legal if get_type() is TYPE_STRING. + size_t get_string_length() const { +- assert_tag(tag::string); ++ assert_tag_3(tag::string, tag::integer, tag::double_); + return payload[1] - payload[0]; + } + +@@ -659,7 +562,7 @@ + /// embedded NULs. + /// Only legal if get_type() is TYPE_STRING. + const char* as_cstring() const { +- assert_tag(tag::string); ++ assert_tag_3(tag::string, tag::integer, tag::double_); + return text + payload[0]; + } + +@@ -667,7 +570,7 @@ + /// Returns a string's value as a std::string. + /// Only legal if get_type() is TYPE_STRING. + std::string as_string() const { +- assert_tag(tag::string); ++ assert_tag_3(tag::string, tag::integer, tag::double_); + return std::string(text + payload[0], text + payload[1]); + } + #endif +@@ -690,6 +593,10 @@ + assert(e1 == value_tag || e2 == value_tag); + } + ++ void assert_tag_3(tag e1, tag e2, tag e3) const { ++ assert(e1 == value_tag || e2 == value_tag || e3 == value_tag); ++ } ++ + void assert_in_bounds(size_t i) const { assert(i < get_length()); } + + const tag value_tag; +@@ -2059,6 +1966,8 @@ + std::pair parse_number(char* p) { + using internal::tag; + ++ size_t start = p - input.get_data(); ++ + // Assume 32-bit, two's complement integers. + static constexpr unsigned RISKY = INT_MAX / 10u; + unsigned max_digit_after_risky = INT_MAX % 10u; +@@ -2235,23 +2144,18 @@ + u = 0u - u; + } + } ++ ++ bool success; ++ size_t* out = allocator.reserve(2, &success); ++ if (SAJSON_UNLIKELY(!success)) { ++ return std::make_pair(oom(p, "number"), tag::null); ++ } ++ out[0] = start; ++ out[1] = p - input.get_data(); ++ + if (try_double) { +- bool success; +- size_t* out +- = allocator.reserve(double_storage::word_length, &success); +- if (SAJSON_UNLIKELY(!success)) { +- return std::make_pair(oom(p, "double"), tag::null); +- } +- double_storage::store(out, d); + return std::make_pair(p, tag::double_); + } else { +- bool success; +- size_t* out +- = allocator.reserve(integer_storage::word_length, &success); +- if (SAJSON_UNLIKELY(!success)) { +- return std::make_pair(oom(p, "integer"), tag::null); +- } +- integer_storage::store(out, static_cast(u)); + return std::make_pair(p, tag::integer); + } + } -- cgit v1.3 From 5a5b729d662c6ad069548b1e4331b7f51c31616b Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sun, 16 Oct 2022 16:17:22 +0200 Subject: gnu: abseil-cpp: Don't use 'package/inherit'. * gnu/packages/cpp.scm (abseil-cpp): Use object inheritance instead of PACKAGE/INHERIT because the inherited package has a different source, thus replacements should not be inherited. --- gnu/packages/cpp.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index c8df516834b..0994ca88bf0 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -1025,7 +1025,8 @@ Google's C++ code base.") (define-public abseil-cpp (let ((base abseil-cpp-20200923.3)) - (package/inherit base + (package + (inherit base) (name "abseil-cpp") (version "20220623.1") (source (origin -- cgit v1.3 From fb28e900d408930631dbcdbeebeeef25246c35f6 Mon Sep 17 00:00:00 2001 From: Z572 <873216071@qq.com> Date: Tue, 1 Nov 2022 23:22:27 +0800 Subject: gnu: ccls: Update to 0.20210330. * gnu/packages/cpp.scm (ccls): Update to 0.20210330. Signed-off-by: Christopher Baines --- gnu/packages/cpp.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 0994ca88bf0..1d7cf807461 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -30,6 +30,7 @@ ;;; Copyright © 2022 Attila Lendvai ;;; Copyright © 2022 Arun Isaac ;;; Copyright © 2022 David Elsing +;;; Copyright © 2022 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -658,7 +659,7 @@ tools (containers, algorithms) used by other QuantStack packages.") (define-public ccls (package (name "ccls") - (version "0.20210330") + (version "0.20220729") (source (origin (method git-fetch) @@ -666,7 +667,7 @@ tools (containers, algorithms) used by other QuantStack packages.") (url "https://github.com/MaskRay/ccls") (commit version))) (sha256 - (base32 "0zzdn7c7a244djqwcsd7rvgclcdacyf9d0vkxpfspl83k2554alf")) + (base32 "0cp534n7afl0rrr778cc0bnd8w091qmyqdpp5k1jh4wxla9s09br")) (file-name (git-file-name name version)))) (build-system cmake-build-system) (arguments -- cgit v1.3 From 8315b70fe4851f8ff26623c317bb9088f19b4511 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 30 Oct 2022 02:00:03 +0100 Subject: gnu: folly: Update to 2022.10.31.00. * gnu/packages/cpp.scm (folly): Update to 2022.10.31.00. --- gnu/packages/cpp.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 1d7cf807461..470f404066f 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -1099,7 +1099,7 @@ standard GNU style syntax for options.") (define-public folly (package (name "folly") - (version "2022.04.11.00") + (version "2022.10.31.00") (source (origin (method git-fetch) (uri (git-reference @@ -1108,7 +1108,7 @@ standard GNU style syntax for options.") (file-name (git-file-name name version)) (sha256 (base32 - "03c1my66xncn8yvgih4kc7j83ckmjbi2w29hdb28j30ixbn0bsjg")))) + "06r9xnj8ilghc0vv6r17k5apl3w19iwd76nr02svnv96c74bz2aa")))) (build-system cmake-build-system) (arguments '(;; Tests must be explicitly enabled -- cgit v1.3 From 0e85fceb385650f165333d5e28b8001660e77349 Mon Sep 17 00:00:00 2001 From: Vinicius Monego Date: Sat, 29 Oct 2022 11:48:31 -0300 Subject: gnu: google-highway: Update to 1.0.2. * gnu/packages/cpp.scm (google-highway): Update to 1.0.2. --- gnu/packages/cpp.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 470f404066f..c789303823e 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -10,7 +10,7 @@ ;;; Copyright © 2020 Roel Janssen ;;; Copyright © 2020, 2021 Ricardo Wurmus ;;; Copyright © 2020 Brice Waegeneire -;;; Copyright © 2020, 2021 Vinicius Monego +;;; Copyright © 2020, 2021, 2022 Vinicius Monego ;;; Copyright © 2020, 2022 Marius Bakke ;;; Copyright © 2020 Michael Rohleder ;;; Copyright © 2020 Alexandros Theodotou @@ -438,7 +438,7 @@ operating on batches.") (define-public google-highway (package (name "google-highway") - (version "0.17.0") + (version "1.0.2") (source (origin (method git-fetch) @@ -447,7 +447,7 @@ operating on batches.") (commit version))) (file-name (git-file-name name version)) (sha256 - (base32 "0iwn7m8f1j7bchwbi5h84nzkzmzqd7byddbr4lh6i6lpd87wny08")))) + (base32 "1dxv61ag0pl5nl6ql4k83k4i95937nhl98img8gz9fx76cpw6z08")))) (build-system cmake-build-system) (arguments `(#:configure-flags (list "-DHWY_SYSTEM_GTEST=on"))) -- cgit v1.3 From bc27d83b96bfa45727eaa168079fc9217e9cba8a Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 4 Nov 2022 13:47:16 -0400 Subject: gnu: Add json-dto. * gnu/packages/cpp.scm (json-dto): New variable. --- gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index c789303823e..928ae5e7e5f 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -31,6 +31,7 @@ ;;; Copyright © 2022 Arun Isaac ;;; Copyright © 2022 David Elsing ;;; Copyright © 2022 Zheng Junjie <873216071@qq.com> +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -554,6 +555,37 @@ container which uses the order in which keys were inserted to the container as ordering relation.") (license license:expat))) +(define-public json-dto + (package + (name "json-dto") + (version "0.3.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Stiffstream/json_dto") + (commit (string-append "v." version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0wr1srp08fr2mv4fmnqr626pwiw60svn6wkvy2xg7j080mgwb3ml")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags #~(list "-DJSON_DTO_INSTALL_SAMPLES=OFF") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'change-directory + (lambda _ + (chdir "dev")))))) + (native-inputs (list catch2)) + (propagated-inputs (list rapidjson)) ;#include'd + (home-page "https://github.com/Stiffstream/json_dto") + (synopsis "JSON to C++ structures conversion library") + (description "@code{json_dto} library is a small header-only helper for +converting data between JSON representation and C++ structs. DTO stands for +data transfer object.") + (license license:bsd-3))) + (define-public json-modern-cxx (package (name "json-modern-cxx") -- cgit v1.3 From 7d1add80b2185176ee017d74522eb663231cbc98 Mon Sep 17 00:00:00 2001 From: Antero Mejr Date: Fri, 4 Nov 2022 20:25:12 +0000 Subject: gnu: Add safeint. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/cpp.scm (safeint): New variable. Signed-off-by: Ludovic Courtès --- gnu/packages/cpp.scm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 928ae5e7e5f..c1e98b771d8 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -2198,3 +2198,42 @@ parsing with only a single memory allocation.") command line options. It supports the short and long option formats of getopt(), getopt_long() and getopt_long_only().") (license license:expat))) + +(define-public safeint + (package + (name "safeint") + (version "3.0.27") + (home-page "https://github.com/dcleblanc/SafeInt") + (source (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "01d2dpdhyw3lghmamknb6g39w2gg0sv53pgxlrs2la8h694z6x7s")))) + (build-system cmake-build-system) + (arguments + (list #:phases #~(modify-phases %standard-phases + (replace 'install + (lambda _ + (let ((include-dir (string-append #$output + "/include"))) + (with-directory-excursion "../source" + (install-file "SafeInt.hpp" include-dir) + (install-file "safe_math.h" include-dir) + (install-file "safe_math_impl.h" include-dir))))) + (add-after 'install 'install-doc + (lambda _ + (let ((doc-dir (string-append #$output + "/share/doc/safeint"))) + (with-directory-excursion "../source" + (install-file "helpfile.md" doc-dir)))))))) + (synopsis "C and C++ library for managing integer overflows") + (description + "SafeInt is a class library for C++ that manages integer overflows. It +also includes a C library that checks casting, multiplication, division, +addition and subtraction for all combinations of signed and unsigned 32-bit and +64-bit integers.") + (license license:expat))) -- cgit v1.3 From abf214cda01d668837a6432370ebd5382ad1612e Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 17 Nov 2022 02:24:46 +0100 Subject: gnu: crc32c: Fix build on x86_64-linux. * gnu/packages/cpp.scm (crc32c)[arguments]: Remove #:phases. The check is for SSE support in the compiler, not the build machine; and the runtime code tests for SSE availability on the CPU before enabling the SSE code path. --- gnu/packages/cpp.scm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index c1e98b771d8..210c76e4824 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -1976,13 +1976,7 @@ std::wstring, etc).") "-DCRC32C_BUILD_TESTS=" ;; TODO: perhaps infer #:tests? (if #$(%current-target-system) - "OFF" "ON"))) - #:phases - #~(modify-phases %standard-phases - (add-after 'unpack 'make-reproducible - (lambda _ - (substitute* "CMakeLists.txt" - (("if\\(HAVE_SSE42\\)") "if(FALSE)"))))))) + "OFF" "ON"))))) (native-inputs (list googletest)) (home-page "https://github.com/google/crc32c") (synopsis "Cyclic redundancy check") -- cgit v1.3 From 627c56f5431b900b120a9fb25b36b7e077b20949 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 11 Dec 2022 01:00:02 +0100 Subject: gnu: gulrak-filesystem: Update to 1.5.12. * gnu/packages/cpp.scm (gulrak-filesystem): Update to 1.5.12. --- gnu/packages/cpp.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 210c76e4824..a3df706f434 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -1901,7 +1901,7 @@ multi-threaded applications and network applications.") (define-public gulrak-filesystem (package (name "gulrak-filesystem") - (version "1.5.10") + (version "1.5.12") (source (origin (method git-fetch) (uri (git-reference @@ -1910,7 +1910,7 @@ multi-threaded applications and network applications.") (file-name (git-file-name name version)) (sha256 (base32 - "0dx1yvbz5rnisymkqap7z0b06ag9fcs6q6l82vgi8caylhkwsqs7")))) + "1qg10akvhp801xirkj4mqcpvcxj90z81ygpyg752xv110zj4914g")))) (build-system cmake-build-system) (synopsis "Header only C++ std::filesystem compatible library") (description "This package provides a header-only single-file -- cgit v1.3 From a8f15711508abab85cba3174f68a4343a15fb116 Mon Sep 17 00:00:00 2001 From: Sughosha Date: Tue, 3 Jan 2023 23:15:52 +0000 Subject: gnu: Add wdl. Alined and improved the definition, as per the chat in IRC. * gnu/packages/cpp.scm (wdl): New public variable. * gnu/packages/patches/wdl-link-libs-and-fix-jnetlib.patch: New file. * gnu/local.mk: Register the patch file. --- gnu/local.mk | 1 + gnu/packages/cpp.scm | 114 ++++++++++++++++++++- .../patches/wdl-link-libs-and-fix-jnetlib.patch | 53 ++++++++++ 3 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/wdl-link-libs-and-fix-jnetlib.patch (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/local.mk b/gnu/local.mk index f0b1b3fd15e..4b6ef757ad3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1987,6 +1987,7 @@ dist_patch_DATA = \ %D%/packages/patches/wacomtablet-add-missing-includes.patch \ %D%/packages/patches/wacomtablet-qt5.15.patch \ %D%/packages/patches/warsow-qfusion-fix-bool-return-type.patch \ + %D%/packages/patches/wdl-link-libs-and-fix-jnetlib.patch \ %D%/packages/patches/webkitgtk-adjust-bubblewrap-paths.patch \ %D%/packages/patches/webrtc-audio-processing-big-endian.patch \ %D%/packages/patches/webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch \ diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index a3df706f434..cc594e56c52 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -8,7 +8,7 @@ ;;; Copyright © 2019 Jan Wielkiewicz ;;; Copyright © 2020, 2021 Nicolò Balzarotti ;;; Copyright © 2020 Roel Janssen -;;; Copyright © 2020, 2021 Ricardo Wurmus +;;; Copyright © 2020, 2021, 2023 Ricardo Wurmus ;;; Copyright © 2020 Brice Waegeneire ;;; Copyright © 2020, 2021, 2022 Vinicius Monego ;;; Copyright © 2020, 2022 Marius Bakke @@ -32,6 +32,7 @@ ;;; Copyright © 2022 David Elsing ;;; Copyright © 2022 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2023 Sughosha ;;; ;;; This file is part of GNU Guix. ;;; @@ -63,6 +64,7 @@ #:use-module (guix modules) #:use-module (guix gexp) #:use-module (gnu packages) + #:use-module (gnu packages assembly) #:use-module (gnu packages autotools) #:use-module (gnu packages boost) #:use-module (gnu packages build-tools) @@ -73,7 +75,11 @@ #:use-module (gnu packages crypto) #:use-module (gnu packages curl) #:use-module (gnu packages documentation) + #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) + #:use-module (gnu packages gl) + #:use-module (gnu packages glib) + #:use-module (gnu packages gtk) #:use-module (gnu packages libevent) #:use-module (gnu packages libunwind) #:use-module (gnu packages linux) @@ -91,6 +97,7 @@ #:use-module (gnu packages tls) #:use-module (gnu packages web) #:use-module (gnu packages xml) + #:use-module (gnu packages xorg) #:use-module (ice-9 match)) (define-public argagg @@ -2231,3 +2238,108 @@ also includes a C library that checks casting, multiplication, division, addition and subtraction for all combinations of signed and unsigned 32-bit and 64-bit integers.") (license license:expat))) + +(define-public wdl + ;; No tag is available. + (let ((commit "da86a62d11e46e4ecd8b16f9775cb5188340a0e2") + (revision "0")) + (package + (name "wdl") + (version (git-version "0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/justinfrankel/WDL") + (commit commit))) + (file-name (git-file-name name version)) + ;; This patch fixes error of undefined functions, due to not + ;; linking libraries, and invalid object. + (patches + (search-patches "wdl-link-libs-and-fix-jnetlib.patch")) + (sha256 + (base32 + "0hdb604szkbrlyffiw94rz8wx4nvmk3zdkycfirqgjs7mh0l6vbq")) + (modules '((guix build utils))) + ;; Unbundle third party libraries which are not needed. + (snippet + '(with-directory-excursion "WDL" + (for-each delete-file-recursively + (list "cmath" + "libpng" + "lice/glew" + "giflib" + "jpeglib" + "zlib")))))) + (build-system gnu-build-system) + (arguments + (list + #:test-target "test" + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "WDL/swell"))) + (delete 'configure) + (replace 'build + (lambda _ + (with-directory-excursion ".." + (invoke "make" "-Ceel2") ;build eel2 + (invoke "make" "-Cjnetlib")) ;build jnetlib + (invoke "make" "SWELL_SUPPORT_GTK=true") + (invoke "make" "libSwell.colortheme"))) + (replace 'install + (lambda _ + (chdir "..") + + ;; Do not install these directories + (delete-file-recursively "lice/test") + (delete-file-recursively "swell/sample_project") + + ;; Install headers. + (let ((include (string-append #$output "/include/WDL"))) + (for-each + (lambda (file) + (install-file file + (string-append include "/" + (dirname file)))) + (find-files "." "\\.h$"))) + (install-file "swell/libSwell.so" + (string-append #$output "/lib")) + (install-file "swell/libSwell.colortheme" + (string-append #$output "/share/WDL")) + (install-file "eel2/loose_eel" + (string-append #$output "/libexec")) + (install-file "jnetlib/jnl.a" + (string-append #$output "/lib"))))))) + (native-inputs (list pkg-config nasm)) + (inputs + (list cairo + fontconfig + freetype + gdk-pixbuf + glib + gtk+ + libxi + libx11 + mesa + zlib)) + (home-page "https://www.cockos.com/wdl/") + (synopsis "Modestly reusable C++ libraries") + (description + "WDL is a modestly reusable C++ library that offers the following: +@itemize +@item Inline classes for cleanly managing memory allocations, lists, +queues, resource pools, strings, etc. +@item File reading/writing wrappers +@item Directory scanning API +@item SHA-1 implementation +@item Mergesort implementation +@item Blowfish implementation +@item Fast FFT implementation (based on DJBFFT) +@item Audio tools +@item LICE - Lightweight Image Compositing Engine +@item WDL Virtual Window system +@item Plush2 - Portable, lightweight software 3d rendering engine +@item SWELL - Simple Windows Emulation Layer +@item And more. +@end itemize") + (license license:zlib)))) diff --git a/gnu/packages/patches/wdl-link-libs-and-fix-jnetlib.patch b/gnu/packages/patches/wdl-link-libs-and-fix-jnetlib.patch new file mode 100644 index 00000000000..29ec0f058c8 --- /dev/null +++ b/gnu/packages/patches/wdl-link-libs-and-fix-jnetlib.patch @@ -0,0 +1,53 @@ +From 2d129502354da4fe39dac13463ea742f8026ab91 Mon Sep 17 00:00:00 2001 +From: Sughosha +Date: Tue, 3 Jan 2023 22:15:09 +0100 +Subject: [PATCH] Link libs and fix jnetlib. + +--- + WDL/eel2/Makefile | 2 +- + WDL/jnetlib/Makefile | 2 +- + WDL/swell/Makefile | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/WDL/eel2/Makefile b/WDL/eel2/Makefile +index ac2e41f1..0ffca97a 100644 +--- a/WDL/eel2/Makefile ++++ b/WDL/eel2/Makefile +@@ -153,7 +153,7 @@ gen-lex: # the output of this, lex.nseel.c, is unused because we have a handwri + $(CXX) $(CXXFLAGS) -c -o $@ $^ + + loose_eel: loose_eel.o $(OBJS) $(OBJS2) +- g++ -o $@ $^ $(CXXFLAGS) $(LFLAGS) ++ g++ -o $@ $^ $(CXXFLAGS) $(LFLAGS) -lGL + + clean: + -rm -f -- loose_eel loose_eel.o $(OBJS) +diff --git a/WDL/jnetlib/Makefile b/WDL/jnetlib/Makefile +index 10d9fe8a..85570c5a 100644 +--- a/WDL/jnetlib/Makefile ++++ b/WDL/jnetlib/Makefile +@@ -7,7 +7,7 @@ CC = gcc + CPP = g++ + CXX = g++ + +-OBJS = asyncdns.o connection.o httpget.o httpserv.o listen.o util.o sercon.o ++OBJS = asyncdns.o connection.o httpget.o httpserv.o listen.o util.o + + jnl.a: ${OBJS} + -rm -f jnl.a +diff --git a/WDL/swell/Makefile b/WDL/swell/Makefile +index 9e7e2d87..8e98a543 100644 +--- a/WDL/swell/Makefile ++++ b/WDL/swell/Makefile +@@ -167,7 +167,7 @@ libSwell$(DLL_EXT): $(OBJS) + $(CXX) -shared -o $@ $(CFLAGS) $(LFLAGS) $^ $(LINKEXTRA) + + test: $(OBJS) test.o +- $(CXX) -o test $(CFLAGS) $(LFLAGS) $^ $(LINKEXTRA) ++ $(CXX) -o test $(CFLAGS) $(LFLAGS) $^ $(LINKEXTRA) -lpthread -ldl $(shell $(PKG_CONFIG) --libs gtk+-3.0 freetype2) -lfontconfig -lGL -lXi -lX11 + + libSwell.colortheme: swell-gdi-generic.cpp $(SWELL_HEADERS) + $(CXX) $(CFLAGS) -o make-theme -DSWELL__MAKE_THEME swell-gdi-generic.cpp -lpthread +-- +2.38.1 + -- cgit v1.3 From a768b0433e0b79c5a32910ce5515086b92725e84 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 6 Jan 2023 12:21:04 +0100 Subject: gnu: Add psascan. * gnu/packages/cpp.scm (psascan): New variable. --- gnu/packages/cpp.scm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index cc594e56c52..f0486a511ef 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -74,6 +74,7 @@ #:use-module (gnu packages compression) #:use-module (gnu packages crypto) #:use-module (gnu packages curl) + #:use-module (gnu packages datastructures) #:use-module (gnu packages documentation) #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) @@ -1114,6 +1115,39 @@ a zero-dependency C++ header-only parser combinator library for creating parsers according to a Parsing Expression Grammar (PEG).") (license license:expat))) +(define-public psascan + (package + (name "psascan") + (version "0.1.0") + (source (origin + (method url-fetch) + (uri (string-append "https://www.cs.helsinki.fi/group" + "/pads/software/pSAscan" + "/pSAscan-" version ".tar.bz2")) + (sha256 + (base32 + "1cphk4gf202nzkxz6jdjzls4zy27055gwpm0r8cn99gr6c8548cy")))) + (build-system gnu-build-system) + (arguments + (list + #:tests? #false ;there are none + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir (lambda _ (chdir "src"))) + (delete 'configure) + (replace 'install + (lambda _ + (install-file "psascan" + (string-append #$output "/bin"))))))) + (inputs (list libdivsufsort)) + (home-page "https://www.cs.helsinki.fi/group/pads/pSAscan.html") + (synopsis "Parallel external memory suffix array construction") + (description "This package contains an implementation of the parallel +external-memory suffix array construction algorithm called pSAscan. The +algorithm is based on the sequential external-memory suffix array construction +algorithm called SAscan.") + (license license:expat))) + (define-public cxxopts (package (name "cxxopts") -- cgit v1.3 From 5f7ce22201c25b0a73dae253b8759fa245c65799 Mon Sep 17 00:00:00 2001 From: "Artyom V. Poptsov" Date: Thu, 5 Jan 2023 08:03:15 +0300 Subject: gnu: Add ftxui. * gnu/packages/cpp.scm (ftxui): New variable. Signed-off-by: Mathieu Othacehe --- gnu/packages/cpp.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index f0486a511ef..7267dfd872b 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -33,6 +33,7 @@ ;;; Copyright © 2022 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2023 Sughosha +;;; Copyright © 2023 Artyom V. Poptsov ;;; ;;; This file is part of GNU Guix. ;;; @@ -2377,3 +2378,52 @@ queues, resource pools, strings, etc. @item And more. @end itemize") (license license:zlib)))) + +(define-public ftxui + (package + (name "ftxui") + (version "3.0.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ArthurSonzogni/FTXUI") + (commit (string-append "v" version)))) + (sha256 + (base32 + "10a4yw2h29kixxyhll6cvrwyscsvz9asxry857a9l8nqvbhs946s")) + (file-name (git-file-name name version)))) + (build-system cmake-build-system) + (native-inputs (list googletest)) + (arguments + (list #:configure-flags + #~(list "-DFTXUI_BUILD_TESTS:BOOL=ON" + "-DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-cmake-tests + (lambda _ + (substitute* "cmake/ftxui_test.cmake" + (("NOT googletest_POPULATED") + "FALSE")) + ;; Disable benchmarks for a while as they require bundled Google + ;; benchmark and when the 'googlebenchmark' is unbundled, there's + ;; a CMake configuration error. + (substitute* "cmake/ftxui_benchmark.cmake" + (("NOT WIN32") + "FALSE")))) ))) + (home-page "https://github.com/ArthurSonzogni/FTXUI") + (synopsis "C++ Functional Terminal User Interface") + (description + "Functional Terminal (X) User interface (FTXUI) is a simple C++ library for +terminal based user interfaces. + +Main features: +@itemize +@item Functional style. +@item Keyboard & mouse navigation. +@item Support for UTF8 and fullwidth chars. +@item Support for animations. +@item Support for drawing. +@item No dependencies. +@end itemize") + (license license:expat))) -- cgit v1.3 From a105e2a392c164233e15636a003d5dc18c94acf3 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 22 Jan 2023 01:00:02 +0100 Subject: gnu: libzen: Update to 0.4.40. * gnu/packages/cpp.scm (libzen): Update to 0.4.40. --- gnu/packages/cpp.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 7267dfd872b..fc294c6eb48 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -294,7 +294,7 @@ various formats, including @code{json}.") (define-public libzen (package (name "libzen") - (version "0.4.39") + (version "0.4.40") (source (origin (method url-fetch) ;; Warning: This source has proved unreliable 1 time at least. @@ -305,7 +305,7 @@ various formats, including @code{json}.") "libzen_" version ".tar.bz2")) (sha256 (base32 - "1rwaxmid9iv65n0y6xlcyxxydsvihjni9ldxpg6pbqz43amp49xx")))) + "17pnp5i1ppcxhxnfs9qlkzzy35h23pkdwhsgpbqdkf8lab2f4hsm")))) (native-inputs (list autoconf automake libtool)) (build-system gnu-build-system) -- cgit v1.3 From 78299e317a25a97609e6741968e8e4534426e054 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 22 Jan 2023 01:00:02 +0100 Subject: gnu: google-highway: Update to 1.0.3. * gnu/packages/cpp.scm (google-highway): Update to 1.0.3. --- gnu/packages/cpp.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index fc294c6eb48..0eecab50fb2 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -448,7 +448,7 @@ operating on batches.") (define-public google-highway (package (name "google-highway") - (version "1.0.2") + (version "1.0.3") (source (origin (method git-fetch) @@ -457,7 +457,7 @@ operating on batches.") (commit version))) (file-name (git-file-name name version)) (sha256 - (base32 "1dxv61ag0pl5nl6ql4k83k4i95937nhl98img8gz9fx76cpw6z08")))) + (base32 "1828rz9w9sr3zlyg25b6nm7j5j5m0xnic7hy36gpsbxvq358ibpf")))) (build-system cmake-build-system) (arguments `(#:configure-flags (list "-DHWY_SYSTEM_GTEST=on"))) -- cgit v1.3