Skip to content

Commit

Permalink
Meson: Generate the sqlite3 bind-dnssec schema code
Browse files Browse the repository at this point in the history
  • Loading branch information
fredmorcos committed Mar 20, 2024
1 parent 20bada0 commit fe4e8aa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pdns/generate-bind-dnssec-schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Produce BIND DNSSEC schema usable from C."""

import sys

sql_filename = sys.argv[1]

with open(sql_filename, mode="r", encoding="utf-8") as f_in:
contents = f_in.read()

print("#pragma once")
print()
print("static char sqlCreate[] __attribute__((unused)) =")
for line in contents.split("\n"):
print(f'"{line}"')
print(";")
20 changes: 19 additions & 1 deletion pdns/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
libpdns_bind_dnssec_schema = custom_target(
'libpdns-bind-dnssec-schema',
command: [
python_prog,
'@INPUT0@',
'@INPUT1@',
],
input: [
'generate-bind-dnssec-schema.py',
'bind-dnssec.schema.sqlite3.sql',
],
output: 'bind-dnssec.schema.sqlite3.sql.h',
capture: true,
)
libpdns_bind_dnssec_schema = declare_dependency(
sources: [libpdns_bind_dnssec_schema],
)

libpdns_bind_parser = declare_dependency(
link_with: static_library(
'pdns-bind-parser',
Expand Down Expand Up @@ -162,7 +180,6 @@ libpdns = declare_dependency(
'backends/gsql/ssql.hh',
'base32.hh',
'base64.hh',
'bind-dnssec.schema.sqlite3.sql.h',
'burtle.hh',
'cachecleaner.hh',
'circular_buffer.hh',
Expand Down Expand Up @@ -228,6 +245,7 @@ libpdns = declare_dependency(
],
dependencies: [
deps,
libpdns_bind_dnssec_schema,
libpdns_bind_parser,
libpdns_lua,
libpdns_lua_records,
Expand Down

0 comments on commit fe4e8aa

Please sign in to comment.