SubDir TOP misc-apps ;



###############  Scénario: hog-demos.run  #################

AddInteractiveComponents
	hog-demos.run
	;
AddComponentService
	hog-demos.run : 1M : pc_rtc : Rtc
	;

if $(HAS_GENODE_BACKDROP)
{
	AddRawComponent     hog-demos.run : libpng.lib.so : libpng.lib.so ;
	AddRawComponent     hog-demos.run : zlib.lib.so : zlib.lib.so ;
	AddComponentService hog-demos.run : 99M : backdrop : backdrop :
		<config>
			<vfs>
		#		<rom name=\"genode_logo.png\"/>
			</vfs>
			<fill color=\"#224433\" />
		#	<image png="genode_logo.png" anchor="bottom_right" alpha="150" xpos="-20" ypos="-20" />
		</config>
		<route>
			<any-service> <child name=\"wm\"/><parent/> <any-child/></any-service>
		</route>
		;
}  # ~HAS_GENODE_BACKDROP....


# _local_ var: as noted in jamrules-qemu-hog, we don't want to pollute the _global_ namespace
local HAS_WINDOW_MANAGER = 1 ;

if $(HAS_WINDOW_MANAGER)
{
	AddComponentAsStart hog-demos.run : 32M
		: wm : "name=\"wm\" caps=\"1000\"" : "
	\	<binary name=\"init\"/>
	\	<provides>
	\		<service name=\"Gui\"/> <service name=\"Report\"/> <service name=\"ROM\"/>
	\	</provides>
	\	<route>
	\		<service name=\"ROM\" label=\"config\"> <parent label=\"wm.config\"/> </service>
	\		<service name=\"Gui\"> <child name=\"nitpicker\"/> </service>
	\		<any-service> <parent/> <any-child/> </any-service>
	\	</route>
		"
		;
	
	# find wm.config, layouter_config etc
	SEARCH_SOURCE += $(GenodeRepos)/gems/recipes/raw/motif_wm ;
	
	# find "focus" file
#	SEARCH_SOURCE += $(GenodeRepos) ; # for "focus"...
#	AddRawComponent hog-demos.run : focus : focus ;
#///Instead of the above, should create a rule CreateFocusFile, leveraging MakeLocate
#UPD: seems we can do without.... If that ever changes, look at the file's format in repos/gems/run/wm.run, i.e. the file should look like: <focus label=\"wm -> focus\"/>
#AddRawComponent hog-demos.run : focus : focus ;
	
	AddRawComponent hog-demos.run : wm.config : wm.config ;
	
	AddRawComponent hog-demos.run : window_layouter : window_layouter ;
	AddRawComponent hog-demos.run : layouter.config : layouter.config ;
	
	AddRawComponent hog-demos.run : decorator : decorator ;
	AddRawComponent hog-demos.run : decorator_init.config : decorator_init.config ;
}

#SEARCH_SOURCE += $(GenodeBuild)/..... ;
#AddRawComponent
#	hog-demos.run : Vera.ttf : Vera.ttf ;

# - Demonstrate Haiku apps running side by side with Genode's Nano3D demo -

# use  32 MB in qemu
# use 132 MB for running on bare metal
# leave "capabilities" field empty, to use the default value
AddPosixApp hog-demos.run : 32M :  :
	Clock
	Mandelbrot
	Pulse
	;

# Nano3D goes through the WM to get "Motif" decorations etc (and to not get full-screen)
AddComponentClient  hog-demos.run
	: 9M
	: nano3d
	: "		<route>
	\			<service name=\"Gui\"> <child name=\"wm\"/> <parent/> <any-child/> </service>
	\			<any-service> <parent/> <any-child/> </any-service>
	\		</route>
		"
	;
#AddComponentClient  hog-demos.run
#	: 1M
#	: top
#	;


if $(HAS_MESA_GEARS)
{
	Config_Route on hog-demos.run +=
		"			<service name=\"Gui\"> <child name=\"wm\"/> <parent/> <any-child/> </service>
			#///later: dual <service> tags: the above tag gets prepended to another (dupe) "route GUI to nitpicker" entry (see config file) ; we should override/clobber the other one instead...
		\			<service name=\"ROM\" label=\"mesa_gpu.lib.so\">
		\				<parent label=\"mesa_gpu-softpipe.lib.so\"/>
		\			</service>
		\			<any-service> <parent/> <any-child/> </any-service>
		"
		;
	AddPosixApp			hog-demos.run : 32M : 230 : gears ;
	
	AddAudioComponents	hog-demos.run ;  # zlib.lib.so...
	AddRawComponent		hog-demos.run : egl.lib.so : egl.lib.so ;
	AddRawComponent		hog-demos.run : mesa.lib.so : mesa.lib.so ;
	AddRawComponent		hog-demos.run : expat.lib.so : expat.lib.so ;
	AddRawComponent		hog-demos.run : glapi.lib.so : glapi.lib.so ;
	AddRawComponent		hog-demos.run : libdrm.lib.so : libdrm.lib.so ;
	AddRawComponent		hog-demos.run : vfs_gpu.lib.so : vfs_gpu.lib.so ;
	AddRawComponent		hog-demos.run : mesa_gpu-softpipe.lib.so : mesa_gpu-softpipe.lib.so ;  # will be routed/aliased to driver/mesa_gpu
}

# Front-end
RunQemu hog-demos.run :
	;



SubInclude TOP misc-apps clock ;
SubInclude TOP misc-apps mandelbrot ;
SubInclude TOP misc-apps pulse ;

#///ToDo-2: build StyledEdit, Pairs, ShowImage, Terminal, etc :
# + diskusage..
# + fontdemo..
# + pairs..
# + people..
# + resedit ??..
# + showimage..
# + stylededit..
# + terminal..?

