1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
# Copyright the NTPsec project contributors
#
# SPDX-License-Identifier: BSD-2-Clause
def build(ctx):
bldnode = ctx.bldnode.abspath()
if ctx.variant == "host":
bison_source = ["ntp_parser.y"]
ctx(
features="c",
includes=[ctx.bldnode.parent.abspath(), "../include", "."],
source=bison_source,
target="bison_obj",
)
# Generate Bison file first.
ctx.add_group()
keyword_gen_source = ["keyword-gen.c", ]
ctx(
features="c cprogram",
includes=[ctx.bldnode.parent.abspath(), "../include", "."],
install_path=None,
source=keyword_gen_source,
target="keyword-gen",
)
# XXX: needs a dependency to rebuild ntp_keyword.h
# when keyword-gen is rebuilt
# Make sure keyword-gen is created next.
ctx.add_group()
ctx(
features="c",
rule="%s/ntpd/keyword-gen ${SRC} > ${TGT}" % bldnode,
source="ntp_parser.tab.h",
target="ntp_keyword.h"
)
# Make sure ntp_keyword.h is created last.
ctx.add_group()
return
libntpd_source = [
"ntp_control.c",
"ntp_filegen.c",
"ntp_leapsec.c",
"ntp_monitor.c", # Needed by the restrict code
"ntp_recvbuff.c",
"ntp_restrict.c",
"ntp_util.c",
]
if not ctx.env.DISABLE_NTS:
libntpd_source += [
"nts.c",
"nts_server.c",
"nts_client.c",
"nts_cookie.c",
"nts_extens.c",
]
ctx(
features="c",
includes=[ctx.bldnode.parent.abspath(), "../include", "../libaes_siv"],
source=libntpd_source,
target="libntpd_obj",
use="CRYPTO aes_siv",
)
ctx(
target="ntpd_lib",
features="c cstlib",
use="libntpd_obj",
# use="libntpd_obj bison_obj",
)
# Build the parser separately, so that we can disable -Wswitch-default
# on this one build, since old Bisons run afoul of it. Also, at least
# one old Bison generates a couple of references to undefined macros,
# so we disable that warning as well.
ctx(
target="parser_obj",
features="c",
source=ctx.bldnode.parent.find_node("host/ntpd/ntp_parser.tab.c"),
includes=[
ctx.bldnode.parent.abspath(), "../include",
"%s/host/ntpd/" % ctx.bldnode.parent.abspath(), "." ],
cflags=["-Wno-switch-default", "-Wno-undef"], # For old Bisons
)
use_refclock = "" # XXX: there must be a better way to do this
if ctx.env.REFCLOCK_ENABLE:
refclock_source = ["ntp_refclock.c",
"refclock_conf.c"
]
ctx(
target="refclock",
features="c",
includes=[ctx.bldnode.parent.abspath(), "../include"],
source=refclock_source,
)
use_refclock += "refclock"
for file, define in ctx.env.REFCLOCK_SOURCE:
ctx(
defines=["%s=1" % define],
features="c",
includes=[ctx.bldnode.parent.abspath(), "../include"],
# XXX: These need to go into config.h
# rather than the command line for the individual drivers
source="refclock_%s.c" % file,
target="refclock_%s" % file,
)
use_refclock += " refclock_%s" % file
ntpd_source = [
"ntp_config.c",
"ntp_io.c",
"ntp_loopfilter.c",
"ntp_packetstamp.c",
"ntp_peer.c",
"ntp_proto.c",
"ntp_sandbox.c",
"ntp_scanner.c",
"ntp_signd.c",
"ntp_timer.c",
"ntp_dns.c",
"ntpd.c",
]
ctx(
features="c cprogram",
includes=[
ctx.bldnode.parent.abspath(), "../include",
"%s/host/ntpd/" % ctx.bldnode.parent.abspath(), "." ],
install_path='${SBINDIR}',
source=ntpd_source,
target="ntpd",
use="libntpd_obj parser_obj ntp M parse RT CAP SECCOMP PTHREAD NTPD "
"CRYPTO SSL DNS_SD %s SOCKET NSL SCF" % use_refclock,
)
ctx.manpage(8, "ntpd-man.adoc")
ctx.manpage(5, "ntp.conf-man.adoc")
ctx.manpage(5, "ntp.keys-man.adoc")
|