diff --git a/projects/rockdaboot.github.io/libpsl/package.yml b/projects/rockdaboot.github.io/libpsl/package.yml new file mode 100644 index 00000000..abeb8a71 --- /dev/null +++ b/projects/rockdaboot.github.io/libpsl/package.yml @@ -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 diff --git a/projects/rockdaboot.github.io/libpsl/test.c b/projects/rockdaboot.github.io/libpsl/test.c new file mode 100644 index 00000000..6fb285c7 --- /dev/null +++ b/projects/rockdaboot.github.io/libpsl/test.c @@ -0,0 +1,20 @@ +#include +#include +#include + +#include + +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; +} \ No newline at end of file