ada, new recipe (#11643)

This commit is contained in:
Schrijvers Luc
2025-01-11 15:46:41 +01:00
committed by GitHub
parent f534c3831e
commit 096a26fc1c
2 changed files with 210 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
SUMMARY="WHATWG-compliant and fast URL parser written in modern C++"
DESCRIPTION="Ada is a fast and spec-compliant URL parser written in C++. Specification for URL \
parser can be found from the *WHATWG* https://url.spec.whatwg.org/#url-parsing website.
The Ada library passes the full range of tests from the specification, across a wide range of \
platforms (e.g., Windows, Linux, macOS). It fully supports the relevant *Unicode Technical \
Standard* https://www.unicode.org/reports/tr46/#ToUnicode.
A common use of a URL parser is to take a URL string and normalize it.
The WHATWG URL specification has been adopted by most browsers. Other tools, such as curl and \
many standard libraries, follow the RFC 3986. The following table illustrates possible \
differences in practice (encoding of the host, encoding of the path):
"
HOMEPAGE="https://github.com/ada-url/ada"
COPYRIGHT="2023 Yagiz Nizipli and Daniel Lemire"
LICENSE="MIT
Apache v2"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="f41575ad7eec833afd9f6a0d6101ee7dc2f947fdf19ae8f1b54a71d59f4ba5ec"
SOURCE_FILENAME="ada-v$portVersion.tar.gz"
PATCHES="ada-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
ada$secondaryArchSuffix = $portVersion
cmd:adaparse$commandSuffix
lib:libada$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libfmt$secondaryArchSuffix
"
PROVIDES_devel="
ada${secondaryArchSuffix}_devel = $portVersion
devel:libada$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
ada$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
cxxopts${secondaryArchSuffix}_devel
devel:libfmt$secondaryArchSuffix >= 11
devel:libgtest$secondaryArchSuffix
devel:libsimdjson$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:python3
"
BUILD()
{
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release \
$cmakeDirArgs \
-DCMAKE_INSTALL_BINDIR=$commandBinDir \
-DBUILD_SHARED_LIBS=ON
make -C build $jobArgs
}
INSTALL()
{
make -C build install
prepareInstalledDevelLib \
libada
fixPkgconfig
packageEntries devel \
$developDir \
$libDir/cmake
}
TEST()
{
ctest --test-dir build --output-on-failure
}

View File

@@ -0,0 +1,114 @@
From 685e4f1feafe80b6a44ba1311cfc614fa67965e0 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Sat, 11 Jan 2025 14:59:28 +0100
Subject: applying patch 1000-Remove-cmake-CPM.patch
https://src.fedoraproject.org/rpms/ada-url/blob/rawhide/f/1000-Remove-cmake-CPM.patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7ce379..924049e 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 REQUIRED)
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 REQUIRED)
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()
+ add_subdirectory(tools)
endif()
install(
diff --git a/tools/cli/CMakeLists.txt b/tools/cli/CMakeLists.txt
index 9f0da16..96b9ea2 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 REQUIRED)
+find_package(cxxopts REQUIRED)
target_link_libraries(adaparse PRIVATE cxxopts::cxxopts fmt::fmt)
if(MSVC OR MINGW)
--
2.45.2