Add a meson option for a local public suffix list

gen-public-suffix.py downloads public_suffix_list.dat at build time and
only falls back to a few hardcoded Linux paths when that fails. Package
builds usually run without network access, and on FreeBSD the list is
installed under /usr/local/share/public_suffix_list, so the build dies
with "unable to load public suffix list".

Add a public-suffix-list option that takes the path of a local copy.
When it is set the generator reads just that file and never goes
online, which also keeps the generated table reproducible.
This commit is contained in:
Piotr Kubaj authored and Piotr Kubaj committed 2026-10-25 20:10:14 +01:00
1 parent 6e5ed9270e
commit d691ffcffd
3 files changed
+21 -10

No files matched your search

+9 -9
View File
@@ -38,16 +38,16 @@ def main():
if len(sys.argv) not in (2, 3):
raise SystemExit("usage: gen-public-suffix.py <output> [source]")
output = Path(sys.argv[1])
sources = []
if len(sys.argv) == 3:
sources.append(Path(sys.argv[2]))
sources.extend(
[
Path(__file__).with_name("public_suffix_list.dat"),
Path("/usr/share/publicsuffix/public_suffix_list.dat"),
Path("/app/share/publicsuffix/public_suffix_list.dat"),
]
)
# An explicit source is authoritative, don't go online behind its back.
rules = parse_rules(Path(sys.argv[2]).read_text(encoding="utf-8"))
emit_header(str(output), rules)
return
sources = [
Path(__file__).with_name("public_suffix_list.dat"),
Path("/usr/share/publicsuffix/public_suffix_list.dat"),
Path("/app/share/publicsuffix/public_suffix_list.dat"),
]
data = None
for url in URLS:
try:
+7 -1
View File
@@ -110,9 +110,15 @@ make_te = find_program('make-te.py')
python3 = find_program('python3', required: true)
public_suffix_cmd = [python3, files('gen-public-suffix.py'), '@OUTPUT@']
public_suffix_list = get_option('public-suffix-list')
if public_suffix_list != ''
public_suffix_cmd += public_suffix_list
endif
public_suffix_data = custom_target('public_suffix_data_h',
output: 'public_suffix_data.h',
command: [python3, files('gen-public-suffix.py'), '@OUTPUT@']
command: public_suffix_cmd
)
emoji_data_table = custom_target('emoji_data_table_h',