summaryrefslogtreecommitdiff
path: root/mbld/types.myr
blob: 307712d552d0731a03bf5bf2e1c06cac84891fc1 (plain)
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
use std

pkg bld =
	type build = struct
		/* build state */
		basedir	: byte[:]
		tags	: std.htab(byte[:], (int, int, int))#
		libs	: std.htab(byte[:], libdep#)#
		deps	: depgraph#

		/* in flight builds */
		queue	: node#[:]
		proc	: std.htab(std.pid, node#)#
		fail	: bool

		/* build params */
		all	: byte[:][:]
		targs	: std.htab(byte[:], targ)#
		prefix	: byte[:]
		system	: byte[:]
		arch	: byte[:]

	;;

	type targ = union
		`Bin	myrtarg#
		`Lib	myrtarg#
		`Gen	cmdtarg#
		`Cmd	cmdtarg#
		`Man	mantarg#
		`Data	datatarg#
	;;

	type myrtarg = struct
		name	: byte[:]
		dir	: byte[:]

		inputs	: byte[:][:]
		libdeps	: (byte[:], byte[:], byte[:])[:]	/* dir, lib, targname */
		tstdeps	: (byte[:], byte[:], byte[:])[:]	/* dir, lib, targname */
		runtime	: byte[:]
		incpath	: byte[:][:]
		tags	: byte[:][:]
		ldscript	: byte[:]

		islib	: bool
		istest	: bool
		install	: bool

	;;

	type cmdtarg = struct
		dir	: byte[:]
		gen	: byte[:][:]
		cmd	: byte[:][:] 
		deps	: byte[:][:] 
		tags	: byte[:][:]
		durable	: bool
		istest	: bool
	;;

	type mantarg = struct
		dir	: byte[:]
		tags	: byte[:][:]
		pages	: byte[:][:]
	;;

	type datatarg = struct
		dir	: byte[:]
		name	: byte[:]
		tags	: byte[:][:]
		path	: byte[:]
		blobs	: byte[:][:]
	;;

	type libdep = struct
		dir	: byte[:]
		name	: byte[:]
		dep	: byte[:][:]
		dyndep	: byte[:][:]
		genuse	: byte[:]
		genar	: byte[:]
	;;

	type depgraph = struct
		/* the edges of the graph from both ends */
		targs	: std.htab(byte[:], node#[:])#
		gen	: std.htab(byte[:], node#)#

		nodes	: node#[:]
		leaves	: node#[:]
	;;

	type node = struct
		/* for debugging, "primary output" */
		lbl	: byte[:]

		/* run this command in this dir to 'execute' the node */
		cmd	: byte[:][:]
		wdir	: byte[:]

		/* install info */
		instdir	: byte[:]
		instmod	: int64

		/* dependency names */
		gen	: byte[:][:]
		dep	: byte[:][:]
		xdep	: byte[:][:]

		/* resolved dependency nodes */
		ndep	: node#[:]
		ngen	: node#[:]

		/* build state */
		nblock	: int32
		mtime	: std.time
		durable	: bool	/* keep outputs when cleaning */
		want	: bool
	;;
;;