logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

gen.lua (2193B)


  1. cflags{
  2. '-Wall',
  3. '-I $dir',
  4. '-I $srcdir',
  5. '-I $basedir/pkg/openbsd/include',
  6. }
  7. lib('libcommon.a', [[
  8. answer.c axfr.c buffer.c configlexer.c configparser.c dname.c dns.c
  9. edns.c iterated_hash.c lookup3.c namedb.c nsec3.c options.c packet.c
  10. query.c rbtree.c radtree.c rdata.c region-allocator.c rrl.c tsig.c
  11. tsig-openssl.c udb.c udbradtree.c udbzone.c util.c bitset.c popen3.c
  12. compat/(cpuset.c setproctitle.c)
  13. $builddir/pkg/openbsd/libbsd.a
  14. ]])
  15. lib('libnsd.a', [[
  16. dbaccess.c dbcreate.c difffile.c ipc.c mini_event.c netio.c server.c
  17. zlexer.c zonec.c zparser.c
  18. xfrd-disk.c xfrd-notify.c xfrd-tcp.c xfrd.c remote.c
  19. libcommon.a.d
  20. ]])
  21. exe('nsd', {'nsd.c', 'libnsd.a.d'})
  22. exe('nsd-checkconf', {'nsd-checkconf.c', 'libcommon.a.d'})
  23. exe('nsd-checkzone', {'nsd-checkzone.c', 'libnsd.a.d'})
  24. local cfg = {
  25. logfile='/var/log/nsd.log', -- just used for man page example
  26. chrootdir='',
  27. ratelimit_default='on',
  28. }
  29. for line in iterlines('config.h', 1) do
  30. local var, val = line:match('^#define ([%w_]+) "(.*)"$')
  31. if var then
  32. cfg[var:lower()] = val
  33. elseif line:find('^#define RATELIMIT') then
  34. cfg.ratelimit = 'on'
  35. elseif line:find('^#define RATELIMIT_DEFAULT_OFF') then
  36. cfg.ratelimit_default = 'off'
  37. end
  38. end
  39. local subst = {
  40. '-e s,@configdir@,'..cfg.configdir..',g',
  41. '-e s,@zonesdir@,'..cfg.zonesdir..',g',
  42. '-e s,@chrootdir@,'..cfg.chrootdir..',g',
  43. '-e s,@pidfile@,'..cfg.pidfile..',g',
  44. '-e s,@logfile@,'..cfg.logfile..',g',
  45. '-e s,@dbfile@,'..cfg.dbfile..',g',
  46. '-e s,@xfrdir@,'..cfg.xfrdir..',g',
  47. '-e s,@xfrdfile@,'..cfg.xfrdfile..',g',
  48. '-e s,@zonelistfile@,'..cfg.zonelistfile..',g',
  49. '-e s,@nsdconfigfile@,'..cfg.configfile..',g',
  50. '-e s,@ratelimit_default@,'..cfg.ratelimit_default..',g',
  51. '-e s,@dnstap_socket_path@,,g',
  52. '-e s,@user@,'..cfg.user..',g',
  53. }
  54. if not cfg.ratelimit then
  55. table.insert(subst, '-e /rrlstart/,/rrlend/d')
  56. end
  57. set('subst', subst)
  58. local function substman(file)
  59. build('sed', '$outdir/'..file, '$srcdir/'..file..'.in', {expr='$subst'})
  60. man{'$outdir/'..file}
  61. end
  62. for _, cmd in ipairs{'nsd', 'nsd-checkconf', 'nsd-checkzone'} do
  63. file('bin/'..cmd, '755', '$outdir/'..cmd)
  64. substman(cmd..'.8')
  65. end
  66. substman('nsd.conf.5')
  67. fetch 'curl'