all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: dan <i@dan.games>
Cc: Sharlatan Hellseher <sharlatanus@gmail.com>,
	Liliana Marie Prikler <liliana.prikler@gmail.com>,
	71897@debbugs.gnu.org
Subject: [bug#71897] [PATCH v8 6/8] gnu: Add cpp-ada-url-parser.
Date: Sun, 22 Sep 2024 12:13:50 +0900	[thread overview]
Message-ID: <87setsl6s1.fsf@gmail.com> (raw)
In-Reply-To: <2ae23a993d9f52c8a4fd5ef0aff148fa5ab4e509.1726930328.git.i@dan.games> (dan's message of "Sat, 21 Sep 2024 22:53:12 +0800")

Hi Dan,

dan <i@dan.games> writes:

> *
> gnu/packages/patches/cpp-ada-url-parser-find-system-testing-dependencies.patch:
> New file.
> * gnu/local.mk (dist_patch_DATA): Register it.
> * gnu/packages/cpp.scm (cpp-ada-url-parser): New variable.
>
> Change-Id: I9924bba53ed58bbf306bf073c9724cd7bd6f570a
> ---
>  gnu/local.mk                                  |   1 +
>  gnu/packages/cpp.scm                          |  26 ++++
>  ...ser-find-system-testing-dependencies.patch | 130 ++++++++++++++++++
>  3 files changed, 157 insertions(+)
>  create mode 100644 gnu/packages/patches/cpp-ada-url-parser-find-system-testing-dependencies.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 802f4be4fe..829c5e166e 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1103,6 +1103,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/cool-retro-term-wctype.patch		\
>    %D%/packages/patches/coq-autosubst-1.8-remove-deprecated-files.patch		\
>    %D%/packages/patches/coreutils-gnulib-tests.patch		\
> +  %D%/packages/patches/cpp-ada-url-parser-find-system-testing-dependencies.patch\
>    %D%/packages/patches/cppcheck-disable-char-signedness-test.patch	\
>    %D%/packages/patches/cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch\
>    %D%/packages/patches/cpulimit-with-glib-2.32.patch		\
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index c805dae825..92be49967f 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -3284,3 +3284,29 @@ (define-public tl-optional
>  the std::optional for C++11/14/17, with support for monadic operations added in
>  C++23.")
>      (license license:cc0)))
> +
> +(define-public cpp-ada-url-parser
> +  (package
> +    (name "cpp-ada-url-parser")

I wasn't sure about the naming, since it doesn't match with the upstream
repository name convention, but after looking into it, it seems
reasonable given their own naming is not explicit enough and there are
bindings for various languages.

> +    (version "2.9.2")
> +    (source
> +      (origin
> +        (method git-fetch)
> +        (uri (git-reference
> +              (url "https://github.com/ada-url/ada.git")

I believe 'guix lint' would complain about a URL redirect on the
above. '.git' suffices haven't been used in years for GitHub.

> +              (commit (string-append "v" version))))
> +        (file-name (git-file-name name version))
> +        (sha256 (base32 "0xvvjlia627ajl966gdxzy2b1j0jiimx7zx8ypmffwx0k6x72qam"))
> +        (patches (search-patches "cpp-ada-url-parser-find-system-testing-dependencies.patch"))))

Too long line; please break it so it fits under 80 chars (that's our
convention), although 'guix lint' won't warn until 100 chars.

> +    (build-system cmake-build-system)
> +    (native-inputs
> +     (list cxxopts
> +           fmt
> +           googletest
> +           python
> +           simdjson))
> +    (home-page "https://github.com/ada-url/ada")
> +    (synopsis "URL parser")
> +    (description "Ada is a fast and spec-compliant URL parser written in C++.
> +Specification for URL parser can be found from the WHATWG website.")
> +    (license license:gpl3+)))
> diff --git a/gnu/packages/patches/cpp-ada-url-parser-find-system-testing-dependencies.patch b/gnu/packages/patches/cpp-ada-url-parser-find-system-testing-dependencies.patch
> new file mode 100644
> index 0000000000..b32d162530
> --- /dev/null
> +++ b/gnu/packages/patches/cpp-ada-url-parser-find-system-testing-dependencies.patch
> @@ -0,0 +1,130 @@
> +From 74cac57a3cebe0cfbbc44f46270d5e51986f4881 Mon Sep 17 00:00:00 2001
> +From: dan <i@dan.games>
> +Date: Sat, 21 Sep 2024 18:49:10 +0800
> +Subject: [PATCH] find system testing dependencies.
> +
> +---
> + CMakeLists.txt             | 50 +++++++++-----------------------------
> + singleheader/amalgamate.py |  2 +-
> + tools/cli/CMakeLists.txt   |  8 ++----
> + 3 files changed, 14 insertions(+), 46 deletions(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index a7ce3796..0903cc31 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -28,43 +28,23 @@ option(ADA_TESTING "Build tests" ${BUILD_TESTING})
> + # errors due to CPM, so this is here to support disabling all the testing
> + # and tooling for ada if one only wishes to use the ada library.
> + if(ADA_TESTING OR ADA_BENCHMARKS OR ADA_TOOLS)
> +-  include(cmake/CPM.cmake)
> +-  # CPM requires git as an implicit dependency
> +-  find_package(Git QUIET)
> +   # We use googletest in the tests
> +-  if(Git_FOUND AND ADA_TESTING)
> +-    CPMAddPackage(
> +-      NAME GTest
> +-      GITHUB_REPOSITORY google/googletest
> +-      VERSION 1.14.0
> +-      OPTIONS  "BUILD_GMOCK OFF" "INSTALL_GTEST OFF"
> +-    )
> ++  if(ADA_TESTING)
> ++    find_package(GTest)
> +   endif()
> +   # We use simdjson in both the benchmarks and tests
> +-  if(Git_FOUND AND (ADA_TESTING OR ADA_BENCHMARKS))
> +-    CPMAddPackage("gh:simdjson/simdjson@3.9.1")
> ++  if(ADA_TESTING OR ADA_BENCHMARKS)
> ++    find_package(simdjson)
> +   endif()
> +   # We use Google Benchmark, but it does not build under several 32-bit systems.
> +-  if(Git_FOUND AND ADA_BENCHMARKS AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
> +-    CPMAddPackage(
> +-      NAME benchmark
> +-      GITHUB_REPOSITORY google/benchmark
> +-      GIT_TAG f91b6b4
> +-      OPTIONS "BENCHMARK_ENABLE_TESTING OFF"
> +-              "BENCHMARK_ENABLE_INSTALL OFF"
> +-              "BENCHMARK_ENABLE_WERROR OFF"
> +-
> +-    )
> ++  if(ADA_BENCHMARKS AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
> ++    find_package(benchmark)
> +   endif()
> + 
> +   if (ADA_TESTING AND NOT EMSCRIPTEN)
> +-    if(Git_FOUND)
> +-      set(CTEST_TEST_TIMEOUT 5)
> +-      message(STATUS "The tests are enabled.")
> +-      add_subdirectory(tests)
> +-    else()
> +-      message(STATUS "The tests are disabled because git was not found.")
> +-    endif()
> ++    set(CTEST_TEST_TIMEOUT 5)
> ++    message(STATUS "The tests are enabled.")
> ++    add_subdirectory(tests)
> +   else()
> +     if(is_top_project)
> +       message(STATUS "The tests are disabled.")
> +@@ -72,12 +52,8 @@ if(ADA_TESTING OR ADA_BENCHMARKS OR ADA_TOOLS)
> +   endif(ADA_TESTING AND NOT EMSCRIPTEN)
> + 
> +   If(ADA_BENCHMARKS AND NOT EMSCRIPTEN)
> +-    if(Git_FOUND)
> +-      message(STATUS "Ada benchmarks enabled.")
> +-      add_subdirectory(benchmarks)
> +-    else()
> +-      message(STATUS "The benchmarks are disabled because git was not found.")
> +-    endif()
> ++    message(STATUS "Ada benchmarks enabled.")
> ++    add_subdirectory(benchmarks)
> +   else(ADA_BENCHMARKS AND NOT EMSCRIPTEN)
> +     if(is_top_project)
> +       message(STATUS "Ada benchmarks disabled. Set ADA_BENCHMARKS=ON to enable them.")
> +@@ -107,11 +83,7 @@ if(NOT ADA_COVERAGE AND NOT EMSCRIPTEN)
> + endif()
> + 
> + if(ADA_TOOLS)
> +-  if(Git_FOUND)
> +     add_subdirectory(tools)
> +-  else()
> +-    message(STATUS "The tools are disabled because git was not found.")
> +-  endif()
> + endif()
> + 
> + install(
> +diff --git a/singleheader/amalgamate.py b/singleheader/amalgamate.py
> +index 52b154b6..94e4e638 100755
> +--- a/singleheader/amalgamate.py
> ++++ b/singleheader/amalgamate.py
> +@@ -138,7 +138,7 @@ if SCRIPTPATH != AMALGAMATE_OUTPUT_PATH:
> + 
> + shutil.copy2(os.path.join(AMALGAMATE_INCLUDE_PATH, 'ada_c.h'), AMALGAMATE_OUTPUT_PATH)
> + 
> +-zf = zipfile.ZipFile(os.path.join(AMALGAMATE_OUTPUT_PATH, 'singleheader.zip'), 'w', zipfile.ZIP_DEFLATED)
> ++zf = zipfile.ZipFile(os.path.join(AMALGAMATE_OUTPUT_PATH, 'singleheader.zip'), 'w', zipfile.ZIP_DEFLATED, strict_timestamps=False)
> + zf.write(os.path.join(AMALGAMATE_OUTPUT_PATH, 'ada.cpp'), 'ada.cpp')
> + zf.write(os.path.join(AMALGAMATE_OUTPUT_PATH, 'ada.h'), 'ada.h')
> + zf.write(os.path.join(AMALGAMATE_INCLUDE_PATH, 'ada_c.h'), 'ada_c.h')
> +diff --git a/tools/cli/CMakeLists.txt b/tools/cli/CMakeLists.txt
> +index 9f0da167..d0f7e0c9 100644
> +--- a/tools/cli/CMakeLists.txt
> ++++ b/tools/cli/CMakeLists.txt
> +@@ -8,12 +8,8 @@ if(MSVC AND BUILD_SHARED_LIBS)
> +         "$<TARGET_FILE:ada>"      # <--this is in-file
> +         "$<TARGET_FILE_DIR:adaparse>")                 # <--this is out-file path
> + endif()
> +-CPMAddPackage("gh:fmtlib/fmt#10.2.1")
> +-CPMAddPackage(
> +-  GITHUB_REPOSITORY jarro2783/cxxopts
> +-  VERSION 3.2.0
> +-  OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES"
> +-)
> ++find_package(fmt)
> ++find_package(cxxopts)
> + target_link_libraries(adaparse PRIVATE cxxopts::cxxopts fmt::fmt)
> + 
> + if(MSVC OR MINGW)
> +-- 
> +2.45.2
> +

That's not upstreamable work, so should ideally be marked as such as a
patch at the top of the patch file (Upstream-status: N/A or similar).
It's a bit sad that this will need ongoing maintenance (careful rebasing
when they touch that file).  I'd like to see the problem with CPM
commented in a bit more details -- wondering if it could be made to work
without patching it out, e.g. perhaps some CMake variables can be set to
have CPM work offline?

-- 
Thanks,
Maxim




  reply	other threads:[~2024-09-22  3:15 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02  5:18 [bug#71897] [PATCH 1/2] gnu: Add cppgir dan
2024-07-02  5:26 ` [bug#71897] [PATCH 2/2] gnu: telegram-desktop: Update to 5.1.7 dan
2024-07-02 11:09 ` [bug#71897] [PATCH 1/2] gnu: Add cppgir Maxim Cournoyer
2024-07-02 13:17 ` [bug#71897] [PATCH 1/3] " dan
2024-07-02 13:17   ` [bug#71897] [PATCH 2/3] gnu: xdg-desktop-portal: Update to 1.18.4 dan
2024-07-02 13:17   ` [bug#71897] [PATCH 3/3] gnu: telegram-desktop: Update to 5.2.1 dan
2024-07-02 16:58   ` [bug#71897] [PATCH 1/3] gnu: Add cppgir Liliana Marie Prikler
2024-07-03 13:22 ` [bug#71897] [PATCH v3 1/2] gnu: xdg-desktop-portal: Update to 1.18.4 dan
2024-07-03 13:22   ` [bug#71897] [PATCH v3 2/2] gnu: telegram-desktop: Update to 5.2.2 dan
2024-07-03 17:06     ` Liliana Marie Prikler
2024-07-03 17:18       ` dan
2024-07-03 17:22         ` dan
2024-07-03 18:21           ` Liliana Marie Prikler
2024-07-03 17:01   ` [bug#71897] [PATCH v3 1/2] gnu: xdg-desktop-portal: Update to 1.18.4 Liliana Marie Prikler
2024-07-07 15:00 ` [bug#71897] [PATCH 1/5] " dan
2024-07-07 15:00   ` [bug#71897] [PATCH 2/5] gnu: xdg-desktop-portal: Update input style dan
2024-07-09  2:14     ` Maxim Cournoyer
2024-07-07 15:00   ` [bug#71897] [PATCH 3/5] gnu: Add cppgir-for-telegram-desktop dan
2024-07-09  2:25     ` Maxim Cournoyer
2024-07-09  3:07       ` dan
2024-07-10  1:31         ` Maxim Cournoyer
2024-07-07 15:00   ` [bug#71897] [PATCH 4/5] gnu: Add libprisma-for-telegram-desktop dan
2024-07-09  2:29     ` Maxim Cournoyer
     [not found]       ` <a1177ffa-90ba-483e-9c60-2aebf6e5dc4c@dan.games>
2024-07-09 11:54         ` Maxim Cournoyer
2024-07-07 15:00   ` [bug#71897] [PATCH 5/5] gnu: telegram-desktop: Update to 5.2.3 dan
2024-07-09  2:35     ` Maxim Cournoyer
2024-07-09  2:14   ` [bug#71897] [PATCH 1/5] gnu: xdg-desktop-portal: Update to 1.18.4 Maxim Cournoyer
2024-07-14 15:48 ` [bug#71897] [PATCH v5 1/6] " dan
2024-07-14 15:48   ` [bug#71897] [PATCH v5 2/6] gnu: xdg-desktop-portal: Update input style dan
2024-07-14 15:49   ` [bug#71897] [PATCH v5 3/6] gnu: Add cppgir dan
2024-07-14 15:49   ` [bug#71897] [PATCH v5 4/6] gnu: Add cppgir-for-telegram-desktop dan
2024-07-14 15:49   ` [bug#71897] [PATCH v5 5/6] gnu: Add libprisma-for-telegram-desktop dan
2024-07-14 15:49   ` [bug#71897] [PATCH v5 6/6] gnu: telegram-desktop: Update to 5.2.3 dan
2024-07-27 15:56     ` Liliana Marie Prikler
2024-09-26  5:24       ` bug#71897: " Maxim Cournoyer
2024-08-04 14:30 ` [bug#71897] [PATCH v6 0/7] gnu: telegram-desktop: Update to 5.3.2 dan
2024-08-04 14:30   ` [bug#71897] [PATCH v6 1/7] gnu: xdg-desktop-portal: Update to 1.18.4 dan
2024-08-04 14:30   ` [bug#71897] [PATCH v6 2/7] gnu: xdg-desktop-portal: Update input style dan
2024-08-04 14:30   ` [bug#71897] [PATCH v6 3/7] gnu: Add cppgir dan
2024-08-04 14:30   ` [bug#71897] [PATCH v6 4/7] gnu: Add cppgir-for-telegram-desktop dan
2024-08-04 14:30   ` [bug#71897] [PATCH v6 5/7] gnu: Add ada dan
2024-08-04 14:48     ` Liliana Marie Prikler
2024-08-04 14:30   ` [bug#71897] [PATCH v6 6/7] gnu: Add libprisma-for-telegram-desktop dan
2024-08-04 14:30   ` [bug#71897] [PATCH v6 7/7] gnu: telegram-desktop: Update to 5.3.2 dan
2024-09-18  9:58 ` [bug#71897] [PATCH 0/3] gnu: telegram-desktop: Update to 5.2.1 Sharlatan Hellseher
2024-09-21 10:35   ` dan
2024-09-21 14:05     ` Liliana Marie Prikler
2024-09-21 11:34 ` [bug#71897] [PATCH v7 1/9] gnu: xdg-desktop-portal: Update to 1.18.4 dan
2024-09-21 11:34   ` [bug#71897] [PATCH v7 2/9] gnu: xdg-desktop-portal: Update input style dan
2024-09-21 11:34   ` [bug#71897] [PATCH v7 3/9] gnu: Add cppgir dan
2024-09-21 11:34   ` [bug#71897] [PATCH v7 4/9] gnu: Add cppgir-for-telegram-desktop dan
2024-09-21 11:34   ` [bug#71897] [PATCH v7 5/9] gnu: simdjson: Update to 3.10.1 dan
2024-09-21 11:34   ` [bug#71897] [PATCH v7 6/9] gnu: Add ada dan
2024-09-21 11:34   ` [bug#71897] [PATCH v7 7/9] gnu: Add libprisma-for-telegram-desktop dan
2024-09-21 11:34   ` [bug#71897] [PATCH v7 8/9] gnu: telegram-desktop: Update to 5.5.5 dan
2024-09-21 14:18     ` Liliana Marie Prikler
2024-09-21 11:34   ` [bug#71897] [PATCH v7 9/9] gnu: telegram-desktop: Disable jemalloc dan
2024-09-21 14:15     ` Liliana Marie Prikler
2024-09-21 14:14   ` [bug#71897] [PATCH v7 1/9] gnu: xdg-desktop-portal: Update to 1.18.4 Liliana Marie Prikler
2024-09-21 14:53 ` [bug#71897] [PATCH v8 1/8] " dan
2024-09-21 14:53   ` [bug#71897] [PATCH v8 2/8] gnu: xdg-desktop-portal: Improve style dan
2024-09-21 14:53   ` [bug#71897] [PATCH v8 3/8] gnu: Add cppgir dan
2024-09-22  3:04     ` Maxim Cournoyer
2024-09-21 14:53   ` [bug#71897] [PATCH v8 4/8] gnu: Add cppgir-for-telegram-desktop dan
2024-09-21 14:53   ` [bug#71897] [PATCH v8 5/8] gnu: simdjson: Update to 3.10.1 dan
2024-09-22  2:58     ` Maxim Cournoyer
2024-09-21 14:53   ` [bug#71897] [PATCH v8 6/8] gnu: Add cpp-ada-url-parser dan
2024-09-22  3:13     ` Maxim Cournoyer [this message]
2024-09-22  3:37       ` dan
2024-09-22  6:13         ` Maxim Cournoyer
2024-09-21 14:53   ` [bug#71897] [PATCH v8 7/8] gnu: Add libprisma-for-telegram-desktop dan
2024-09-22  3:04     ` Maxim Cournoyer
2024-09-21 14:53   ` [bug#71897] [PATCH v8 8/8] gnu: telegram-desktop: Update to 5.5.5 dan
2024-09-22  3:22     ` Maxim Cournoyer
2024-09-22  3:51       ` dan
2024-09-22  4:09       ` dan
2024-09-24  6:00         ` Maxim Cournoyer
2024-09-22  4:14       ` dan
2024-09-24  5:59         ` Maxim Cournoyer
2024-09-22 11:37 ` [bug#71897] [PATCH v9 1/8] gnu: xdg-desktop-portal: Update to 1.18.4 dan
2024-09-22 11:37   ` [bug#71897] [PATCH v9 2/8] gnu: xdg-desktop-portal: Improve style dan
2024-09-22 11:37   ` [bug#71897] [PATCH v9 3/8] gnu: Add cppgir dan
2024-09-22 11:37   ` [bug#71897] [PATCH v9 4/8] gnu: Add cppgir-for-telegram-desktop dan
2024-09-22 11:37   ` [bug#71897] [PATCH v9 5/8] gnu: simdjson: Update to 3.10.1 dan
2024-09-22 11:37   ` [bug#71897] [PATCH v9 6/8] gnu: Add cpp-ada-url-parser dan
2024-09-22 21:31     ` Liliana Marie Prikler
2024-09-22 11:37   ` [bug#71897] [PATCH v9 7/8] gnu: Add libprisma-for-telegram-desktop dan
2024-09-22 11:37   ` [bug#71897] [PATCH v9 8/8] gnu: telegram-desktop: Update to 5.5.5 dan
2024-09-22 23:04 ` [bug#71897] [PATCH v10 1/9] gnu: xdg-desktop-portal: Update to 1.18.4 dan
2024-09-22 23:04   ` [bug#71897] [PATCH v10 2/9] gnu: xdg-desktop-portal: Improve style dan
2024-09-22 23:04   ` [bug#71897] [PATCH v10 3/9] gnu: Add cppgir dan
2024-09-22 23:04   ` [bug#71897] [PATCH v10 4/9] gnu: Add cppgir-for-telegram-desktop dan
2024-09-22 23:04   ` [bug#71897] [PATCH v10 5/9] gnu: simdjson: Update to 3.10.1 dan
2024-09-22 23:04   ` [bug#71897] [PATCH v10 6/9] gnu: Add cpm-cmake dan
2024-09-22 23:04   ` [bug#71897] [PATCH v10 7/9] gnu: Add cpp-ada-url-parser dan
2024-09-22 23:04   ` [bug#71897] [PATCH v10 8/9] gnu: Add libprisma-for-telegram-desktop dan
2024-09-22 23:04   ` [bug#71897] [PATCH v10 9/9] gnu: telegram-desktop: Update to 5.5.5 dan
2024-09-26  5:26   ` [bug#71897] [PATCH v10 1/9] gnu: xdg-desktop-portal: Update to 1.18.4 Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87setsl6s1.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=71897@debbugs.gnu.org \
    --cc=i@dan.games \
    --cc=liliana.prikler@gmail.com \
    --cc=sharlatanus@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.