| 
									
										
										
										
											2017-11-29 09:03:12 -05:00
										 |  |  | project(
 | 
					
						
							|  |  |  | 	'sway',
 | 
					
						
							|  |  |  | 	'c',
 | 
					
						
							|  |  |  | 	license: 'MIT',
 | 
					
						
							|  |  |  | 	default_options: [
 | 
					
						
							|  |  |  | 		'c_std=c11',
 | 
					
						
							|  |  |  | 		'warning_level=2',
 | 
					
						
							|  |  |  | 		'werror=true',
 | 
					
						
							|  |  |  | 	],
 | 
					
						
							|  |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-01 05:42:12 -05:00
										 |  |  | add_project_arguments('-Wno-unused-parameter', language: 'c')
 | 
					
						
							| 
									
										
										
										
											2018-02-18 11:20:18 -05:00
										 |  |  | add_project_arguments('-Wno-unused-function', language: 'c')
 | 
					
						
							| 
									
										
										
										
											2017-12-01 05:42:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-29 09:03:12 -05:00
										 |  |  | cc = meson.get_compiler('c')
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-30 08:31:13 -05:00
										 |  |  | is_freebsd = host_machine.system().startswith('freebsd')
 | 
					
						
							|  |  |  | datadir = get_option('datadir')
 | 
					
						
							|  |  |  | sysconfdir = get_option('sysconfdir')
 | 
					
						
							|  |  |  | prefix = get_option('prefix')
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 15:43:40 +00:00
										 |  |  | jsonc          = dependency('json-c', version: '>=0.13')
 | 
					
						
							| 
									
										
										
										
											2017-11-30 03:41:51 -05:00
										 |  |  | pcre           = dependency('libpcre')
 | 
					
						
							| 
									
										
										
										
											2018-03-12 12:21:46 +01:00
										 |  |  | wlroots        = dependency('wlroots', fallback: ['wlroots', 'wlroots'])
 | 
					
						
							| 
									
										
										
										
											2017-11-29 09:03:12 -05:00
										 |  |  | wayland_server = dependency('wayland-server')
 | 
					
						
							|  |  |  | wayland_client = dependency('wayland-client')
 | 
					
						
							|  |  |  | wayland_egl    = dependency('wayland-egl')
 | 
					
						
							|  |  |  | wayland_protos = dependency('wayland-protocols')
 | 
					
						
							|  |  |  | xkbcommon      = dependency('xkbcommon')
 | 
					
						
							| 
									
										
										
										
											2018-03-27 15:25:25 -04:00
										 |  |  | cairo          = dependency('cairo')
 | 
					
						
							| 
									
										
										
										
											2017-11-30 03:41:51 -05:00
										 |  |  | pango          = dependency('pango')
 | 
					
						
							| 
									
										
										
										
											2018-03-27 15:25:25 -04:00
										 |  |  | pangocairo     = dependency('pangocairo')
 | 
					
						
							|  |  |  | gdk_pixbuf     = dependency('gdk-pixbuf-2.0', required: false)
 | 
					
						
							| 
									
										
										
										
											2017-11-30 03:41:51 -05:00
										 |  |  | pixman         = dependency('pixman-1')
 | 
					
						
							|  |  |  | libcap         = dependency('libcap')
 | 
					
						
							| 
									
										
										
										
											2017-12-06 08:28:46 -05:00
										 |  |  | libinput       = dependency('libinput')
 | 
					
						
							| 
									
										
										
										
											2017-11-29 09:03:12 -05:00
										 |  |  | math           = cc.find_library('m')
 | 
					
						
							| 
									
										
										
										
											2018-03-28 23:04:20 -04:00
										 |  |  | rt             = cc.find_library('rt')
 | 
					
						
							| 
									
										
										
										
											2017-11-30 04:48:08 -05:00
										 |  |  | git = find_program('git', required: false)
 | 
					
						
							| 
									
										
										
										
											2017-11-30 11:34:44 -05:00
										 |  |  | a2x = find_program('a2x', required: false)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-28 12:21:50 -04:00
										 |  |  | conf_data = configuration_data()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-27 15:25:25 -04:00
										 |  |  | if gdk_pixbuf.found()
 | 
					
						
							| 
									
										
										
										
											2018-03-28 12:21:50 -04:00
										 |  |  | 	conf_data.set('HAVE_GDK_PIXBUF', true)
 | 
					
						
							| 
									
										
										
										
											2018-03-27 15:25:25 -04:00
										 |  |  | endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-30 11:34:44 -05:00
										 |  |  | if a2x.found()
 | 
					
						
							|  |  |  | 	mandir = get_option('mandir')
 | 
					
						
							|  |  |  | 	man_files = [
 | 
					
						
							|  |  |  | 		'sway/sway.1.txt',
 | 
					
						
							|  |  |  | 		'sway/sway.5.txt',
 | 
					
						
							|  |  |  | 		'sway/sway-bar.5.txt',
 | 
					
						
							|  |  |  | 		'sway/sway-input.5.txt',
 | 
					
						
							|  |  |  | 		'sway/sway-security.7.txt',
 | 
					
						
							|  |  |  | 		'swaymsg/swaymsg.1.txt',
 | 
					
						
							|  |  |  | 	]
 | 
					
						
							|  |  |  | 	foreach filename : man_files
 | 
					
						
							|  |  |  | 		topic = filename.split('.')[-3].split('/')[-1]
 | 
					
						
							|  |  |  | 		section = filename.split('.')[-2]
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		custom_target(
 | 
					
						
							|  |  |  | 			'man-@0@-@1@'.format(topic, section),
 | 
					
						
							|  |  |  | 			input: filename,
 | 
					
						
							|  |  |  | 			output: '@BASENAME@',
 | 
					
						
							|  |  |  | 			command: [
 | 
					
						
							|  |  |  | 				a2x,
 | 
					
						
							|  |  |  | 				'--no-xmllint',
 | 
					
						
							|  |  |  | 				'--doctype', 'manpage',
 | 
					
						
							|  |  |  | 				'--format', 'manpage',
 | 
					
						
							|  |  |  | 				'--destination-dir', meson.current_build_dir(),
 | 
					
						
							|  |  |  | 				'@INPUT@'
 | 
					
						
							|  |  |  | 			],
 | 
					
						
							|  |  |  | 			install: true,
 | 
					
						
							|  |  |  | 			install_dir: '@0@/man@1@'.format(mandir, section)
 | 
					
						
							|  |  |  | 		)
 | 
					
						
							|  |  |  | 	endforeach
 | 
					
						
							|  |  |  | endif
 | 
					
						
							| 
									
										
										
										
											2017-11-29 09:03:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-05 10:40:55 +01:00
										 |  |  | add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c')
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-30 04:48:08 -05:00
										 |  |  | version = get_option('sway_version')
 | 
					
						
							|  |  |  | if version != ''
 | 
					
						
							|  |  |  | 	version = '"@0@"'.format(version)
 | 
					
						
							|  |  |  | else
 | 
					
						
							|  |  |  | 	if not git.found()
 | 
					
						
							|  |  |  | 		error('git is required to make the version string')
 | 
					
						
							|  |  |  | 	endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
 | 
					
						
							|  |  |  | 	git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
 | 
					
						
							|  |  |  | 	version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
 | 
					
						
							|  |  |  | endif
 | 
					
						
							| 
									
										
										
										
											2017-11-30 04:29:32 -05:00
										 |  |  | add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
 | 
					
						
							| 
									
										
										
										
											2017-11-29 09:03:12 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | sway_inc = include_directories('include')
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-28 12:21:50 -04:00
										 |  |  | subdir('include')
 | 
					
						
							| 
									
										
										
										
											2018-03-27 13:35:34 -04:00
										 |  |  | subdir('protocols')
 | 
					
						
							| 
									
										
										
										
											2017-11-30 03:39:27 -05:00
										 |  |  | subdir('common')
 | 
					
						
							|  |  |  | subdir('sway')
 | 
					
						
							| 
									
										
										
										
											2017-11-30 11:40:49 -05:00
										 |  |  | subdir('swaymsg')
 | 
					
						
							| 
									
										
										
										
											2018-03-28 23:04:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-27 15:25:25 -04:00
										 |  |  | subdir('client')
 | 
					
						
							| 
									
										
										
										
											2018-03-27 13:35:34 -04:00
										 |  |  | subdir('swaybg')
 | 
					
						
							| 
									
										
										
										
											2018-03-28 23:04:20 -04:00
										 |  |  | subdir('swaybar')
 | 
					
						
							| 
									
										
										
										
											2017-11-29 09:03:12 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-30 08:31:13 -05:00
										 |  |  | config = configuration_data()
 | 
					
						
							|  |  |  | config.set('sysconfdir', join_paths(prefix, sysconfdir))
 | 
					
						
							|  |  |  | config.set('datadir', join_paths(prefix, datadir))
 | 
					
						
							|  |  |  | config.set('prefix', prefix)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | configure_file(
 | 
					
						
							|  |  |  | 	configuration: config,
 | 
					
						
							|  |  |  | 	input: 'config.in',
 | 
					
						
							|  |  |  | 	output: '@BASENAME@',
 | 
					
						
							|  |  |  | 	install_dir: sysconfdir + '/sway'
 | 
					
						
							|  |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if is_freebsd
 | 
					
						
							|  |  |  | 	configure_file(
 | 
					
						
							|  |  |  | 		configuration: config,
 | 
					
						
							|  |  |  | 		input: 'security.d/10-freebsd.in',
 | 
					
						
							|  |  |  | 		output: '@BASENAME@',
 | 
					
						
							|  |  |  | 		install_dir: sysconfdir + '/sway/security.d'
 | 
					
						
							|  |  |  | 	)
 | 
					
						
							|  |  |  | else
 | 
					
						
							|  |  |  | 	configure_file(
 | 
					
						
							|  |  |  | 		configuration: config,
 | 
					
						
							|  |  |  | 		input: 'security.d/00-defaults.in',
 | 
					
						
							|  |  |  | 		output: '@BASENAME@',
 | 
					
						
							|  |  |  | 		install_dir: sysconfdir + '/sway/security.d'
 | 
					
						
							|  |  |  | 	)
 | 
					
						
							|  |  |  | endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | install_data(
 | 
					
						
							|  |  |  | 	'sway.desktop',
 | 
					
						
							|  |  |  | 	install_dir: datadir + '/wayland-sessions'
 | 
					
						
							|  |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (get_option('default_wallpaper'))
 | 
					
						
							|  |  |  | 	wallpaper_files = files(
 | 
					
						
							|  |  |  | 		'assets/Sway_Wallpaper_Blue_768x1024.png',
 | 
					
						
							|  |  |  | 		'assets/Sway_Wallpaper_Blue_768x1024_Portrait.png',
 | 
					
						
							|  |  |  | 		'assets/Sway_Wallpaper_Blue_1136x640.png',
 | 
					
						
							|  |  |  | 		'assets/Sway_Wallpaper_Blue_1136x640_Portrait.png',
 | 
					
						
							|  |  |  | 		'assets/Sway_Wallpaper_Blue_1366x768.png',
 | 
					
						
							|  |  |  | 		'assets/Sway_Wallpaper_Blue_1920x1080.png',
 | 
					
						
							|  |  |  | 		'assets/Sway_Wallpaper_Blue_2048x1536.png',
 | 
					
						
							|  |  |  | 		'assets/Sway_Wallpaper_Blue_2048x1536_Portrait.png',
 | 
					
						
							|  |  |  | 	)
 | 
					
						
							|  |  |  | 	wallpaper_install_dir = datadir + '/backgrounds/sway'
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	install_data(wallpaper_files, install_dir: wallpaper_install_dir)
 | 
					
						
							|  |  |  | endif
 | 
					
						
							| 
									
										
										
										
											2017-11-30 11:51:58 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | if (get_option('zsh_completions'))
 | 
					
						
							|  |  |  | 	zsh_files = files(
 | 
					
						
							|  |  |  | 		'completions/zsh/_sway',
 | 
					
						
							|  |  |  | 		'completions/zsh/_swaygrab',
 | 
					
						
							|  |  |  | 		'completions/zsh/_swaylock',
 | 
					
						
							|  |  |  | 		'completions/zsh/_swaymsg',
 | 
					
						
							|  |  |  | 	)
 | 
					
						
							|  |  |  | 	zsh_install_dir = datadir + '/zsh/site-functions'
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	install_data(zsh_files, install_dir: zsh_install_dir)
 | 
					
						
							|  |  |  | endif
 |