Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipe for ada-url #28258

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions recipes/ada-url/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This is for testing
cmake_minimum_required(VERSION 3.15)

project(test_ada_install VERSION 0.1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(ada REQUIRED)

# You can provide your own code, this is just an example:
file(WRITE main.cpp "
#include \"ada.h\"
#include <iostream>

int main(int , char *[]) {
ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator>(\"https://www.google.com\");
url->set_protocol(\"http\");
std::cout << url->get_protocol() << std::endl;
std::cout << url->get_host() << std::endl;
return EXIT_SUCCESS;
}")

add_executable(main main.cpp)
target_link_libraries(main PUBLIC ada::ada)
84 changes: 84 additions & 0 deletions recipes/ada-url/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
context:
version: "2.9.2"
build: 0

package:
name: ada-url
version: ${{ version }}

source:
url: "https://github.com/ada-url/ada/archive/refs/tags/v${{ version }}.tar.gz"
sha256: f41575ad7eec833afd9f6a0d6101ee7dc2f947fdf19ae8f1b54a71d59f4ba5ec

build:
number: ${{ build|int + (microarch_level|default('0'))|int * 100 }}
script:
- if: win
then: |
cmake -G Ninja ^
%CMAKE_ARGS% ^
-DADA_TESTING=OFF ^
-DADA_TOOLS=OFF ^
-DADA_BENCHMARKS=OFF ^
-B build -S %SRC_DIR%
cmake --build build --target install
else: |
cmake -G Ninja \
$CMAKE_ARGS \
-DADA_TESTING=OFF \
-DADA_TOOLS=OFF \
-DADA_BENCHMARKS=OFF \
-S $SRC_DIR -B build
cmake --build build --target install

requirements:
build:
- if: (microarch_level|default('0'))|int > 0
then: "${{ 'x86_64-microarch-level ' ~ (microarch_level|default('0')) }}"
- "${{ compiler('cxx') }}"
- "${{ stdlib('c') }}"
- cmake
- ninja

tests:
- script:
- if: win
then: |
cmake -GNinja %CMAKE_ARGS% -B build -S .
cmake --build build
.\build\main.exe
else: |
cmake -GNinja $CMAKE_ARGS -B build -S .
cmake --build build
./build/main
requirements:
build:
- "${{ compiler('cxx') }}"
- "${{ stdlib('c') }}"
- cmake
- ninja

files:
recipe:
- CMakeLists.txt

- package_contents:
include:
- ada.h

about:
homepage: "https://ada-url.com/"
summary: 'WHATWG-compliant and fast URL parser written in modern C++'
description: |
WHATWG-compliant and fast URL parser written in modern C++, part of
Node.js, Clickhouse, Redpanda, Kong, Telegram and Cloudflare Workers.
license: "MIT OR Apache-2.0"
license_file:
- LICENSE-APACHE
- LICENSE-MIT
documentation: https://ada-url.com/introduction/
repository: https://github.com/ada-url/ada

extra:
recipe-maintainers:
- rHermes
7 changes: 7 additions & 0 deletions recipes/ada-url/variants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
microarch_level:
- if: win or not(x86_64)
then:
- 0
else:
- 1
- 3