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 (7158B)


  1. cflags{
  2. '-D HAVE_CONFIG_H',
  3. '-D IN_STRACE',
  4. -- it is important that the arch-specific directory is searched first
  5. '-I $srcdir/src/linux/x86_64',
  6. '-I $srcdir/src/linux/generic',
  7. '-I $srcdir/src',
  8. '-I $outdir',
  9. '-isystem $builddir/pkg/linux-headers/include',
  10. }
  11. build('cat', '$outdir/config.h', {
  12. '$builddir/probe/HAVE___BUILTIN_POPCOUNT',
  13. '$dir/config.h',
  14. })
  15. build('cpp', '$outdir/ioctl_iocdef.i', '$srcdir/src/ioctl_iocdef.c')
  16. build('sed', '$outdir/ioctl_iocdef.h', '$outdir/ioctl_iocdef.i', {
  17. expr=[[-n 's/^DEFINE HOST/#define /p']],
  18. })
  19. sub('tools.ninja', function()
  20. toolchain(config.host)
  21. cflags{
  22. '-D X86_64=1',
  23. '-I $srcdir/src/linux/x86_64',
  24. '-I $srcdir/src/linux',
  25. '-I $outdir',
  26. }
  27. for i = 0, 2 do
  28. build('cat', '$outdir/ioctls_all'..i..'.h', {
  29. '$srcdir/src/linux/x86_64/ioctls_inc'..i..'.h',
  30. '$srcdir/src/linux/x86_64/ioctls_arch'..i..'.h',
  31. })
  32. build('cc', '$outdir/ioctlsort'..i..'.c.o', {
  33. '$srcdir/src/ioctlsort.c',
  34. '|', '$outdir/ioctl_iocdef.h', '$srcdir/ioctls_zfs.h', '$outdir/ioctls_all'..i..'.h',
  35. }, {cflags=string.format([[$cflags -D 'IOCTLSORT_INC="ioctls_all%d.h"']], i)})
  36. exe('ioctlsort'..i, {'ioctlsort'..i..'.c.o'})
  37. rule('ioctlsort'..i, '$outdir/ioctlsort'..i..' >$out')
  38. build('ioctlsort'..i, '$outdir/ioctlent'..i..'.h', {'|', '$outdir/ioctlsort'..i})
  39. end
  40. end)
  41. local mpers = lines('mpers.txt')
  42. for _, f in ipairs(mpers) do
  43. build('cpp', '$outdir/'..f..'.mpers.i', {'$srcdir/src/'..f, '|', '$outdir/config.h'}, {
  44. cflags='$cflags -DIN_MPERS_BOOTSTRAP',
  45. })
  46. end
  47. local function makempers(name, script)
  48. build('awk', '$outdir/'..name, {expand{'$outdir/', mpers, '.mpers.i'}, '|', '$dir/'..script}, {
  49. expr='-f $dir/'..script,
  50. })
  51. end
  52. makempers('printers.h', 'printers.awk')
  53. makempers('native_printer_decls.h', 'printerdecls.awk')
  54. makempers('native_printer_defs.h', 'printerdefs.awk')
  55. build('cpp', '$outdir/syscallent.i', '$srcdir/src/linux/x86_64/syscallent.h')
  56. build('awk', '$outdir/scno-syscallent.h', {'$outdir/syscallent.i', '|', '$dir/scno.awk'}, {
  57. expr='-f $dir/scno.awk',
  58. })
  59. build('cat', '$outdir/scno.h', {'$srcdir/src/scno.head', '$outdir/scno-syscallent.h'})
  60. -- this seems to be enough syscall headers to build
  61. local syscalls = expand{'$srcdir/src/linux/', {
  62. '32/syscallent.h',
  63. '64/syscallent.h',
  64. 'arm/syscallent.h',
  65. 'i386/syscallent.h',
  66. 'sparc/syscallent.h',
  67. 'sparc64/syscallent.h',
  68. 'generic/subcallent.h',
  69. 'generic/syscallent-common.h',
  70. 'x86_64/syscallent.h',
  71. }}
  72. build('awk', '$outdir/sen.h', {syscalls, '|', '$dir/sen.awk'}, {
  73. expr='-f $dir/sen.awk',
  74. })
  75. local srcs = paths[[src/(
  76. access.c
  77. affinity.c
  78. aio.c
  79. alpha.c
  80. basic_filters.c
  81. bind.c
  82. bjm.c
  83. block.c
  84. bpf.c
  85. bpf_filter.c
  86. bpf_seccomp_filter.c
  87. bpf_sock_filter.c
  88. btrfs.c
  89. cacheflush.c
  90. cachestat.c
  91. capability.c
  92. chdir.c
  93. chmod.c
  94. clone.c
  95. close_range.c
  96. copy_file_range.c
  97. count.c
  98. counter_ioctl.c
  99. delay.c
  100. desc.c
  101. dirent.c
  102. dirent64.c
  103. dirent_types.c
  104. dm.c
  105. dup.c
  106. dyxlat.c
  107. epoll.c
  108. epoll_ioctl.c
  109. error_prints.c
  110. evdev.c
  111. evdev_mpers.c
  112. eventfd.c
  113. execve.c
  114. exitkill.c
  115. fadvise.c
  116. fallocate.c
  117. fanotify.c
  118. fchownat.c
  119. fcntl.c
  120. fetch_bpf_fprog.c
  121. fetch_indirect_syscall_args.c
  122. fetch_struct_flock.c
  123. fetch_struct_iovec.c
  124. fetch_struct_keyctl_kdf_params.c
  125. fetch_struct_mmsghdr.c
  126. fetch_struct_msghdr.c
  127. fetch_struct_stat.c
  128. fetch_struct_stat64.c
  129. fetch_struct_statfs.c
  130. fetch_struct_xfs_quotastat.c
  131. file_handle.c
  132. filter_qualify.c
  133. filter_seccomp.c
  134. flock.c
  135. fs_0x94_ioctl.c
  136. fs_f_ioctl.c
  137. fs_x_ioctl.c
  138. fsconfig.c
  139. fsmount.c
  140. fsopen.c
  141. fspick.c
  142. fstatfs.c
  143. fstatfs64.c
  144. futex.c
  145. futex2.c
  146. gen/gen_hdio.c
  147. get_personality.c
  148. get_robust_list.c
  149. getcpu.c
  150. getcwd.c
  151. getpagesize.c
  152. getpid.c
  153. getrandom.c
  154. gpio_ioctl.c
  155. hdio.c
  156. hostname.c
  157. inotify.c
  158. inotify_ioctl.c
  159. io.c
  160. io_uring.c
  161. ioctl.c
  162. ioperm.c
  163. ioprio.c
  164. ipc.c
  165. ipc_msg.c
  166. ipc_msgctl.c
  167. ipc_sem.c
  168. ipc_semctl.c
  169. ipc_shm.c
  170. ipc_shmctl.c
  171. kcmp.c
  172. kd_ioctl.c
  173. kd_mpers_ioctl.c
  174. kexec.c
  175. keyctl.c
  176. kvm.c
  177. landlock.c
  178. ldt.c
  179. link.c
  180. lirc_ioctl.c
  181. listen.c
  182. listmount.c
  183. lookup_dcookie.c
  184. loop.c
  185. lseek.c
  186. lsm.c
  187. map_shadow_stack.c
  188. mem.c
  189. membarrier.c
  190. memfd_create.c
  191. memfd_secret.c
  192. mknod.c
  193. mmap_cache.c
  194. mmap_notify.c
  195. mmsghdr.c
  196. mount.c
  197. mount_setattr.c
  198. move_mount.c
  199. mq.c
  200. msghdr.c
  201. mtd.c
  202. nbd_ioctl.c
  203. net.c
  204. netlink.c
  205. netlink_crypto.c
  206. netlink_generic.c
  207. netlink_inet_diag.c
  208. netlink_kobject_uevent.c
  209. netlink_netfilter.c
  210. netlink_netlink_diag.c
  211. netlink_nlctrl.c
  212. netlink_packet_diag.c
  213. netlink_route.c
  214. netlink_selinux.c
  215. netlink_smc_diag.c
  216. netlink_sock_diag.c
  217. netlink_unix_diag.c
  218. nlattr.c
  219. nsfs.c
  220. numa.c
  221. number_set.c
  222. oldstat.c
  223. open.c
  224. open_tree.c
  225. or1k_atomic.c
  226. pathtrace.c
  227. perf.c
  228. perf_ioctl.c
  229. personality.c
  230. pidfd_getfd.c
  231. pidfd_open.c
  232. pidns.c
  233. pkeys.c
  234. poke.c
  235. poll.c
  236. prctl.c
  237. print_dev_t.c
  238. print_group_req.c
  239. print_ifindex.c
  240. print_instruction_pointer.c
  241. print_kernel_sigset.c
  242. print_kernel_version.c
  243. print_mac.c
  244. print_mq_attr.c
  245. print_msgbuf.c
  246. print_sg_req_info.c
  247. print_sigevent.c
  248. print_statfs.c
  249. print_struct_stat.c
  250. print_syscall_number.c
  251. print_time.c
  252. print_timespec32.c
  253. print_timespec64.c
  254. print_timeval.c
  255. print_timeval64.c
  256. print_timex.c
  257. printmode.c
  258. printrusage.c
  259. printsiginfo.c
  260. process_vm.c
  261. ptp.c
  262. ptrace.c
  263. ptrace_syscall_info.c
  264. quota.c
  265. random_ioctl.c
  266. readahead.c
  267. readlink.c
  268. reboot.c
  269. regset.c
  270. renameat.c
  271. resource.c
  272. retval.c
  273. riscv.c
  274. rt_sigframe.c
  275. rt_sigreturn.c
  276. rtc.c
  277. rtnl_addr.c
  278. rtnl_addrlabel.c
  279. rtnl_cachereport.c
  280. rtnl_dcb.c
  281. rtnl_link.c
  282. rtnl_mdb.c
  283. rtnl_neigh.c
  284. rtnl_neightbl.c
  285. rtnl_netconf.c
  286. rtnl_nh.c
  287. rtnl_nsid.c
  288. rtnl_route.c
  289. rtnl_rule.c
  290. rtnl_stats.c
  291. rtnl_tc.c
  292. rtnl_tc_action.c
  293. s390.c
  294. sched.c
  295. scsi.c
  296. seccomp.c
  297. seccomp_ioctl.c
  298. sendfile.c
  299. sg_io_v3.c
  300. sg_io_v4.c
  301. shutdown.c
  302. sigaltstack.c
  303. signal.c
  304. signalfd.c
  305. sigreturn.c
  306. sock.c
  307. sockaddr.c
  308. socketcall.c
  309. socketutils.c
  310. sparc.c
  311. sram_alloc.c
  312. stage_output.c
  313. stat.c
  314. stat64.c
  315. statfs.c
  316. statfs64.c
  317. statmount.c
  318. statx.c
  319. strauss.c
  320. string_to_uint.c
  321. swapon.c
  322. sync_file_range.c
  323. sync_file_range2.c
  324. syscall.c
  325. syscall_name.c
  326. sysctl.c
  327. sysinfo.c
  328. syslog.c
  329. sysmips.c
  330. tee.c
  331. term.c
  332. time.c
  333. times.c
  334. trie.c
  335. truncate.c
  336. ubi.c
  337. ucopy.c
  338. uid.c
  339. uid16.c
  340. umask.c
  341. umount.c
  342. uname.c
  343. upeek.c
  344. upoke.c
  345. userfaultfd.c
  346. ustat.c
  347. util.c
  348. utime.c
  349. utimes.c
  350. v4l2.c
  351. wait.c
  352. watchdog_ioctl.c
  353. xattr.c
  354. xgetdents.c
  355. xlat.c
  356. xmalloc.c
  357. )]]
  358. build('sed', '$outdir/sys_func.h', expand{'$srcdir/', srcs}, {
  359. expr=[[-n 's/^SYS_FUNC(.*/extern &;/p']],
  360. })
  361. pkg.deps = {
  362. '$outdir/config.h',
  363. '$outdir/ioctlent0.h',
  364. '$outdir/ioctlent1.h',
  365. '$outdir/ioctlent2.h',
  366. '$outdir/native_printer_decls.h',
  367. '$outdir/native_printer_defs.h',
  368. '$outdir/printers.h',
  369. '$outdir/scno.h',
  370. '$outdir/sen.h',
  371. '$outdir/sys_func.h',
  372. 'pkg/linux-headers/headers',
  373. }
  374. lib('libstrace.a', srcs)
  375. exe('strace', {'src/strace.c', 'libstrace.a'})
  376. file('bin/strace', '755', '$outdir/strace')
  377. build('sed', '$outdir/strace.1', '$srcdir/doc/strace.1.in', {
  378. expr={
  379. [[-e 's,@STRACE_MANPAGE_DATE@,2024-06-30,']],
  380. [[-e 's,@VERSION@,6.12,']],
  381. [[-e 's,@ENABLE_STACKTRACE_TRUE@,#,']],
  382. [[-e 's,@ENABLE_STACKTRACE_FALSE@,,']],
  383. [[-e 's,@ENABLE_SECONTEXT_TRUE@,#,']],
  384. [[-e 's,@ENABLE_SECONTEXT_FALSE@,,']],
  385. },
  386. })
  387. man{'$outdir/strace.1'}
  388. fetch 'curl'