Skip to content

Commit

Permalink
feat(deps): add ada - whatwg-compliant and fast url parser
Browse files Browse the repository at this point in the history
### Summary

Adds libada as a dependency.

This is needed for:
#12758

But it may be great for many other uses too.

The `lua-resty-ada` LuaJIT FFI bindings can be found here:
https://github.com/bungle/lua-resty-ada

Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
  • Loading branch information
bungle committed Jul 3, 2024
1 parent ef81e6f commit f521478
Show file tree
Hide file tree
Showing 19 changed files with 140 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ OPENSSL=3.2.1
OPENSSL_SHA256=83c7329fe52c850677d75e5d0b0ca245309b97e8ecbcfdc1dfdc4ab9fac35b39
PCRE=10.43
PCRE_SHA256=889d16be5abb8d05400b33c25e151638b8d4bac0e2d9c76e9d6923118ae8a34e
ADA=2.8.0
ADA_SHA256=b621bdc61655c44e018c936a925fe87a01b1aaa18ea199ed19738b123f600c6d
LIBEXPAT=2.6.2
LIBEXPAT_SHA256=d4cf38d26e21a56654ffe4acd9cd5481164619626802328506a2869afab29ab3

Expand Down
5 changes: 3 additions & 2 deletions build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ clib_deps = [
"@openssl",
"@libexpat",
"@snappy",
"@ada",
]

[
kong_install(
name = "install-%s" % get_workspace_name(k),
src = k,
prefix = "kong/lib" if k in ("@passwdqc", "@snappy") else "kong",
strip_path = "snappy" if k == "@snappy" else "",
prefix = "kong/lib" if k in ("@passwdqc", "@snappy", "@ada") else "kong",
strip_path = "snappy" if k == "@snappy" else "ada" if k == "@ada" else "",
)
for k in clib_deps
]
Expand Down
18 changes: 18 additions & 0 deletions build/openresty/ada/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cc_library(
name = "ada-lib",
srcs = ["ada.cpp"],
hdrs = [
"ada.h",
"ada_c.h",
],
copts = [
"-std=c++17",
],
linkstatic = True,
)

cc_shared_library(
name = "ada",
visibility = ["//visibility:public"],
deps = [":ada-lib"],
)
20 changes: 20 additions & 0 deletions build/openresty/ada/ada_repositories.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""A module defining the third party dependency Ada"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@kong_bindings//:variables.bzl", "KONG_VAR")

def ada_repositories():
"""Defines the ada repository"""

version = KONG_VAR["ADA"]

maybe(
http_archive,
name = "ada",
sha256 = KONG_VAR["ADA_SHA256"],
url = "https://github.com/ada-url/ada/releases/download/v" + version + "/singleheader.zip",
type = "zip",
visibility = ["//visibility:public"], # let this to be referenced by openresty build
build_file = "//build/openresty/ada:BUILD.bazel",
)
2 changes: 2 additions & 0 deletions build/openresty/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ load("//build/openresty/wasmx:wasmx_repositories.bzl", "wasmx_repositories")
load("//build/openresty/wasmx/filters:repositories.bzl", "wasm_filters_repositories")
load("//build/openresty/brotli:brotli_repositories.bzl", "brotli_repositories")
load("//build/openresty/snappy:snappy_repositories.bzl", "snappy_repositories")
load("//build/openresty/ada:ada_repositories.bzl", "ada_repositories")

# This is a dummy file to export the module's repository.
_NGINX_MODULE_DUMMY_FILE = """
Expand All @@ -35,6 +36,7 @@ def openresty_repositories():
wasm_filters_repositories()
brotli_repositories()
snappy_repositories()
ada_repositories()

openresty_version = KONG_VAR["OPENRESTY"]

Expand Down
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/feat-add-ada.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**Core**: Added Ada dependency - WHATWG-compliant and fast URL parser.
type: feature
scope: Core
8 changes: 7 additions & 1 deletion scripts/explain_manifest/fixtures/amazonlinux-2-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down Expand Up @@ -213,4 +220,3 @@
- libc.so.6
- ld-linux-x86-64.so.2
- libstdc++.so.6

7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/amazonlinux-2023-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/amazonlinux-2023-arm64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
- libc.so.6
Rpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libm.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/debian-10-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/debian-11-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/debian-12-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/el7-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/el8-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/el9-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/el9-arm64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
- libc.so.6
Rpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libm.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/ubuntu-20.04-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/ubuntu-22.04-amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
- libc.so.6
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libstdc++.so.6
Expand Down
7 changes: 7 additions & 0 deletions scripts/explain_manifest/fixtures/ubuntu-22.04-arm64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
- Path : /usr/local/kong/lib/engines-3/padlock.so
Runpath : /usr/local/kong/lib

- Path : /usr/local/kong/lib/libada.so
Needed :
- libstdc++.so.6
- libm.so.6
- libgcc_s.so.1
- libc.so.6

- Path : /usr/local/kong/lib/libcrypto.so.3
Needed :
- libc.so.6
Expand Down

0 comments on commit f521478

Please sign in to comment.