master hovercats/oakiss / pkg / neuswc / gen.lua
  1cflags{
  2	'-Wall',
  3	'-D _GNU_SOURCE',
  4	'-D screen_new=swc__screen_new',
  5	'-D remove_resource=swc__remove_resource',
  6	'-I $outdir',
  7	'-I $outdir/include',
  8	'-I $srcdir',
  9	'-isystem $builddir/pkg/fontconfig/include',
 10	'-isystem $builddir/pkg/libinput/include',
 11	'-isystem $builddir/pkg/libxkbcommon/include',
 12	'-isystem $builddir/pkg/libdrm/include',
 13	'-isystem $builddir/pkg/linux-headers/include',
 14	'-isystem $builddir/pkg/pixman/include',
 15	'-isystem $builddir/pkg/wayland-protocols/include',
 16	'-isystem $builddir/pkg/wayland/include',
 17	'-isystem $builddir/pkg/wld/include',
 18}
 19
 20cc('launch/protocol.c')
 21
 22waylandproto('protocol/swc.xml', {
 23	client='include/swc-client-protocol.h',
 24	server='include/swc-server-protocol.h',
 25	code='swc-protocol.c',
 26})
 27
 28waylandproto('protocol/server-decoration.xml', {
 29	server='include/server-decoration-server-protocol.h',
 30	code='server-decoration-protocol.c',
 31})
 32
 33waylandproto('protocol/swc_snap.xml', {
 34       server='include/swc_snap-server-protocol.h',
 35       client='include/swc_snap-client-protocol.h',
 36       code='swc_snap-protocol.c',
 37})
 38
 39waylandproto('protocol/swc_select.xml', {
 40       server='include/swc_select-server-protocol.h',
 41       client='include/swc_select-client-protocol.h',
 42       code='swc_select-protocol.c',
 43})
 44
 45waylandproto('protocol/wayland-drm.xml', {
 46       server='include/wayland-drm-server-protocol.h',
 47       code='wayland-drm-protocol.c',
 48})
 49
 50waylandproto('protocol/wlr-layer-shell-unstable-v1.xml', {
 51       client='include/wlr-layer-shell-unstable-v1-client-protocol.h',
 52       server='include/wlr-layer-shell-unstable-v1-server-protocol.h',
 53       code='wlr-layer-shell-unstable-v1.c'
 54})
 55
 56pkg.hdrs = {
 57	copy('$outdir/include', '$srcdir/libswc', {'swc.h'}),
 58}
 59
 60sub('tools.ninja', function()
 61	toolchain(config.host)
 62	cflags{'-std=c99', '-D _POSIX_C_SOURCE=200809L'}
 63	exe('convert_font', {'cursor/convert_font.c'})
 64end)
 65
 66rule('convert_font', '$outdir/convert_font $in $out 2>/dev/null')
 67build('convert_font', '$outdir/cursor/cursor_data.h', {'$srcdir/cursor/cursor.pcf', '|', '$outdir/convert_font'})
 68
 69pkg.deps = {
 70	'$gendir/headers',
 71	'$outdir/include/swc-client-protocol.h',
 72	'$outdir/include/swc-server-protocol.h',
 73	'$outdir/include/swc_snap-server-protocol.h',
 74	'$outdir/include/swc_snap-client-protocol.h',
 75	'$outdir/include/server-decoration-server-protocol.h',
 76	'$outdir/include/swc_select-server-protocol.h',
 77	'$outdir/include/swc_select-client-protocol.h',
 78	'$outdir/include/wlr-layer-shell-unstable-v1-client-protocol.h',
 79	'$outdir/include/wlr-layer-shell-unstable-v1-server-protocol.h',
 80	'$outdir/include/wayland-drm-server-protocol.h',
 81	'$outdir/cursor/cursor_data.h',
 82	'pkg/fontconfig/headers',
 83	'pkg/libdrm/headers',
 84	'pkg/libinput/headers',
 85	'pkg/libxkbcommon/headers',
 86	'pkg/linux-headers/headers',
 87	'pkg/pixman/headers',
 88	'pkg/wayland/headers',
 89	'pkg/wayland-protocols/headers',
 90	'pkg/wld/headers',
 91}
 92
 93lib('libswc.a', [[
 94	libswc/(
 95		bindings.c
 96		compositor.c
 97		data.c
 98		data_device.c
 99		data_device_manager.c
100		decor.c
101		dmabuf.c
102		drm.c
103		input.c
104		kde_decoration.c
105		keyboard.c
106		launch.c
107		layer_shell.c
108		mode.c
109		output.c
110		panel.c
111		panel_manager.c
112		plane.c
113		pointer.c
114		primary_plane.c
115		region.c
116		screen.c
117		select.c
118		shell.c
119		shell_surface.c
120		shm.c
121		snap.c
122		subcompositor.c
123		subsurface.c
124		surface.c
125		swc.c
126		util.c
127		view.c
128		wayland_buffer.c
129		window.c
130		xdg_decoration.c
131		xdg_output.c
132		xdg_shell.c
133
134		seat.c
135	)
136	launch/protocol.c.o
137	server-decoration-protocol.c.o
138	swc-protocol.c.o
139	swc_snap-protocol.c.o
140	swc_select-protocol.c.o
141	wayland-drm-protocol.c.o
142	wlr-layer-shell-unstable-v1.c.o
143	$builddir/(
144		pkg/libinput/libinput.a.d
145		pkg/libxkbcommon/libxkbcommon.a
146		pkg/wayland-protocols/xdg-decoration-unstable-v1-protocol.c.o
147		pkg/wayland-protocols/xdg-shell-protocol.c.o
148		pkg/wayland-protocols/xdg-output-unstable-v1-protocol.c.o
149		pkg/wayland-protocols/linux-dmabuf-unstable-v1-protocol.c.o
150		pkg/wayland/libwayland-server.a.d
151		pkg/wld/libwld.a.d
152	)
153]])
154
155exe('swcsnap', {'extra/swcsnap.c', 'libswc.a.d'})
156file('bin/swcsnap', '755', '$outdir/swcsnap')
157
158exe('neuswc-launch', {'launch/launch.c', 'launch/devmajor-linux.c', 'launch/protocol.c.o', '$builddir/pkg/libdrm/libdrm.a'})
159file('bin/neuswc-launch', '4755', '$outdir/neuswc-launch')
160
161fetch 'git'