1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 autoreconfHook,
7 docbook_xsl,
8 docbook_xml_dtd_43,
9 gtk-doc,
10 lzip,
11 libidn2,
12 libunistring,
13 libxslt,
14 pkg-config,
15 buildPackages,
16 publicsuffix-list,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "libpsl";
21 version = "0.21.5";
22
23 src = fetchurl {
24 url = "https://github.com/rockdaboot/libpsl/releases/download/${version}/libpsl-${version}.tar.lz";
25 hash = "sha256-mp9qjG7bplDPnqVUdc0XLdKEhzFoBOnHMgLZdXLNOi0=";
26 };
27
28 patches = [
29 # Can be dropped on next release, or if we switch to Meson for
30 # this package. Test pkgsStatic.curl still builds.
31 (fetchpatch {
32 name = "static.patch";
33 url = "https://github.com/rockdaboot/libpsl/commit/490bd6f98a2addcade55028ea60c36cce07e21e4.patch";
34 hash = "sha256-7Uu9gaVuA9Aly2mmnhUVgv2BYQTSBODJ2rDl5xp0uVY=";
35 })
36 ];
37
38 outputs = [
39 "out"
40 "dev"
41 ];
42
43 nativeBuildInputs = [
44 autoreconfHook
45 docbook_xsl
46 docbook_xml_dtd_43
47 gtk-doc
48 lzip
49 pkg-config
50 libxslt
51 ];
52
53 buildInputs = [
54 libidn2
55 libunistring
56 libxslt
57 ];
58
59 propagatedBuildInputs = [
60 publicsuffix-list
61 ];
62
63 # bin/psl-make-dafsa brings a large runtime closure through python3
64 # use the libpsl-with-scripts package if you need this
65 postInstall = ''
66 rm $out/bin/psl-make-dafsa $out/share/man/man1/psl-make-dafsa*
67 '';
68
69 preAutoreconf = ''
70 gtkdocize
71 '';
72
73 configureFlags = [
74 # "--enable-gtk-doc"
75 "--enable-man"
76 "--with-psl-distfile=${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat"
77 "--with-psl-file=${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat"
78 "--with-psl-testfile=${publicsuffix-list}/share/publicsuffix/test_psl.txt"
79 "PYTHON=${lib.getExe buildPackages.python3}"
80 ];
81
82 enableParallelBuilding = true;
83
84 doCheck = true;
85
86 meta = {
87 description = "C library for the Publix Suffix List";
88 longDescription = ''
89 libpsl is a C library for the Publix Suffix List (PSL). A "public suffix"
90 is a domain name under which Internet users can directly register own
91 names. Browsers and other web clients can use it to avoid privacy-leaking
92 "supercookies" and "super domain" certificates, for highlighting parts of
93 the domain in a user interface or sorting domain lists by site.
94 '';
95 homepage = "https://rockdaboot.github.io/libpsl/";
96 changelog = "https://raw.githubusercontent.com/rockdaboot/libpsl/libpsl-${version}/NEWS";
97 license = lib.licenses.mit;
98 maintainers = [ lib.maintainers.c0bw3b ];
99 mainProgram = "psl";
100 platforms = lib.platforms.unix ++ lib.platforms.windows;
101 pkgConfigModules = [ "libpsl" ];
102 };
103}