From 2f3633433e2f1d840f3a98ca777d79d658a66e3f Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Thu, 30 Nov 2017 08:31:13 -0500 Subject: [PATCH] add meson install files --- config.in | 4 +-- meson.build | 54 ++++++++++++++++++++++++++++++++++++++- meson_options.txt | 3 ++- security.d/00-defaults.in | 18 ++++++------- sway/meson.build | 3 ++- 5 files changed, 68 insertions(+), 14 deletions(-) diff --git a/config.in b/config.in index b39a39aa..086b66dc 100644 --- a/config.in +++ b/config.in @@ -21,7 +21,7 @@ set $menu dmenu_run ### Output configuration # # Default wallpaper (more resolutions are available in __DATADIR__/backgrounds/sway/) -output * bg __DATADIR__/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill +output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # # Example configuration: # @@ -194,4 +194,4 @@ bar { } } -include __SYSCONFDIR__/sway/config.d/* +include @sysconfdir@/sway/config.d/* diff --git a/meson.build b/meson.build index ac161987..494f2866 100644 --- a/meson.build +++ b/meson.build @@ -11,6 +11,11 @@ project( cc = meson.get_compiler('c') +is_freebsd = host_machine.system().startswith('freebsd') +datadir = get_option('datadir') +sysconfdir = get_option('sysconfdir') +prefix = get_option('prefix') + jsonc = dependency('json-c', version: '>=0.12.1') pcre = dependency('libpcre') wlroots = dependency('wlroots') @@ -37,7 +42,6 @@ else 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 - add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') sway_inc = include_directories('include') @@ -45,3 +49,51 @@ sway_inc = include_directories('include') subdir('common') subdir('sway') +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 diff --git a/meson_options.txt b/meson_options.txt index 5015a986..03bc1986 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1 +1,2 @@ -option('sway_version', type : 'string', description : 'The version string reported in `sway --version`.') +option('sway_version', type : 'string', description: 'The version string reported in `sway --version`.') +option('default_wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.') diff --git a/security.d/00-defaults.in b/security.d/00-defaults.in index 05098dea..e4626477 100644 --- a/security.d/00-defaults.in +++ b/security.d/00-defaults.in @@ -6,17 +6,17 @@ # installation. # # DO NOT CHANGE THIS FILE. Override these defaults by writing new files in -# __SYSCONFDIR__/sway/security.d/* +# @sysconfdir@/sway/security.d/* # Configures enabled compositor features for specific programs permit * fullscreen keyboard mouse -permit __PREFIX__/bin/swaylock lock -permit __PREFIX__/bin/swaybg background -permit __PREFIX__/bin/swaygrab screenshot -permit __PREFIX__/bin/swaybar panel +permit @prefix@/bin/swaylock lock +permit @prefix@/bin/swaybg background +permit @prefix@/bin/swaygrab screenshot +permit @prefix@/bin/swaybar panel # Configures enabled IPC features for specific programs -ipc __PREFIX__/bin/swaymsg { +ipc @prefix@/bin/swaymsg { * enabled events { @@ -24,7 +24,7 @@ ipc __PREFIX__/bin/swaymsg { } } -ipc __PREFIX__/bin/swaybar { +ipc @prefix@/bin/swaybar { bar-config enabled outputs enabled workspaces enabled @@ -36,12 +36,12 @@ ipc __PREFIX__/bin/swaybar { } } -ipc __PREFIX__/bin/swaygrab { +ipc @prefix@/bin/swaygrab { outputs enabled tree enabled } -ipc __PREFIX__/bin/swaylock { +ipc @prefix@/bin/swaylock { outputs enabled } diff --git a/sway/meson.build b/sway/meson.build index b02506c8..cf2aa913 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -26,5 +26,6 @@ executable( sway_sources, include_directories: [sway_inc], dependencies: sway_deps, - link_with: [lib_sway_common] + link_with: [lib_sway_common], + install: true )