new file: projects/rockdaboot.github.io/libpsl/package.yml

new file:   projects/rockdaboot.github.io/libpsl/test.c
This commit is contained in:
Andrii Riabchenko 2023-11-12 11:29:40 +02:00 committed by Max Howell
parent e128d80d29
commit 2281d05cba
2 changed files with 56 additions and 0 deletions

View file

@ -0,0 +1,36 @@
distributable:
url: https://github.com/rockdaboot/libpsl/releases/download/{{version}}/libpsl-{{version}}.tar.gz
strip-components: 1
versions:
github: rockdaboot/libpsl
dependencies:
unicode.org: '*'
build:
dependencies:
mesonbuild.com: '*'
ninja-build.org: '*'
freedesktop.org/pkg-config: '*'
python.org: ~3.11
linux:
gnu.org/gcc: '*'
script:
- meson setup build $MESON_ARGS
- meson compile -C build
- meson install -C build
env:
linux:
LDFLAGS: -fPIC
MESON_ARGS:
- --prefix="{{prefix}}"
- --libdir="{{prefix}}/lib"
- --buildtype=release
- --wrap-mode=nofallback
- -Druntime=libicu
- -Dbuiltin=true
test:
dependencies:
linux:
gnu.org/gcc: '*'
script:
- cc test.c -lpsl -o test
- ./test

View file

@ -0,0 +1,20 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <libpsl.h>
int main(void)
{
const psl_ctx_t *psl = psl_builtin();
const char *domain = ".eu";
assert(psl_is_public_suffix(psl, domain));
const char *host = "www.example.com";
const char *expected_domain = "example.com";
const char *actual_domain = psl_registrable_domain(psl, host);
assert(strcmp(actual_domain, expected_domain) == 0);
return 0;
}