From 88cc7e31781a0d42bdd4f9eee646c02ff03857c4 Mon Sep 17 00:00:00 2001
From: Tony Crisci <tony@dubstepdish.com>
Date: Thu, 30 Nov 2017 03:39:27 -0500
Subject: use meson subdirectories

---
 sway/meson.build | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 sway/meson.build

(limited to 'sway')

diff --git a/sway/meson.build b/sway/meson.build
new file mode 100644
index 00000000..1f17ed31
--- /dev/null
+++ b/sway/meson.build
@@ -0,0 +1,29 @@
+sway_sources = sway_common + files(
+	'main.c',
+	'server.c',
+	'commands.c',
+	'commands/exit.c',
+	'ipc-json.c',
+	'ipc-server.c',
+	'desktop/output.c',
+	'desktop/xdg_shell_v6.c',
+	'tree/container.c',
+	'tree/layout.c',
+	'tree/workspace.c',
+)
+
+sway_deps = [
+	pixman,
+	wayland_server,
+	jsonc,
+	wlroots,
+	libcap,
+	math,
+]
+
+executable(
+	'sway',
+	sway_sources,
+	include_directories: [sway_inc],
+	dependencies: sway_deps
+)
-- 
cgit v1.2.3


From cc310cffb0bf4cd2333be26a2ae16848655a306b Mon Sep 17 00:00:00 2001
From: Tony Crisci <tony@dubstepdish.com>
Date: Thu, 30 Nov 2017 06:25:13 -0500
Subject: meson: common static library

---
 common/meson.build | 17 ++++++++++-------
 sway/meson.build   |  5 +++--
 2 files changed, 13 insertions(+), 9 deletions(-)

(limited to 'sway')

diff --git a/common/meson.build b/common/meson.build
index ca1f1752..3a4282ad 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -1,8 +1,11 @@
-sway_common = files(
-	'log.c',
-	'list.c',
-	'util.c',
-	'stringop.c',
-	'readline.c',
-	'ipc-client.c'
+lib_sway_common = static_library('sway-common',
+	files(
+		'log.c',
+		'list.c',
+		'util.c',
+		'stringop.c',
+		'readline.c',
+		'ipc-client.c'
+	),
+	include_directories: sway_inc
 )
diff --git a/sway/meson.build b/sway/meson.build
index 1f17ed31..b02506c8 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -1,4 +1,4 @@
-sway_sources = sway_common + files(
+sway_sources = files(
 	'main.c',
 	'server.c',
 	'commands.c',
@@ -25,5 +25,6 @@ executable(
 	'sway',
 	sway_sources,
 	include_directories: [sway_inc],
-	dependencies: sway_deps
+	dependencies: sway_deps,
+	link_with: [lib_sway_common]
 )
-- 
cgit v1.2.3


From 2f3633433e2f1d840f3a98ca777d79d658a66e3f Mon Sep 17 00:00:00 2001
From: Tony Crisci <tony@dubstepdish.com>
Date: Thu, 30 Nov 2017 08:31:13 -0500
Subject: 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(-)

(limited to 'sway')

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
 )
-- 
cgit v1.2.3


From 517af37cc9a9f7b5efa3e22d7021aab691c80244 Mon Sep 17 00:00:00 2001
From: Tony Crisci <tony@dubstepdish.com>
Date: Thu, 30 Nov 2017 11:54:01 -0500
Subject: remove relevant CMakeLists.txt

---
 CMakeLists.txt                 | 165 -----------------------------------------
 common/CMakeLists.txt          |  15 ----
 completions/zsh/CMakeLists.txt |   4 -
 sway/CMakeLists.txt            |  96 ------------------------
 swaymsg/CMakeLists.txt         |  23 ------
 5 files changed, 303 deletions(-)
 delete mode 100644 CMakeLists.txt
 delete mode 100644 common/CMakeLists.txt
 delete mode 100644 completions/zsh/CMakeLists.txt
 delete mode 100644 sway/CMakeLists.txt
 delete mode 100644 swaymsg/CMakeLists.txt

(limited to 'sway')

diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 9580e15d..00000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,165 +0,0 @@
-cmake_minimum_required(VERSION 3.1.0)
-
-project(sway C)
-
-add_compile_options(-g)
-set(CMAKE_C_STANDARD 99)
-set(CMAKE_C_EXTENSIONS OFF)
-set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
-add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Werror)
-
-# Add Address Sanitiezed build type
-set(CMAKE_C_FLAGS_ASAN
-    "${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer"
-    CACHE STRING "Flags used by the C compiler during address sanitizer builds."
-    FORCE )
-mark_as_advanced(
-    CMAKE_C_FLAGS_ASAN
-    CMAKE_EXE_LINKER_FLAGS_DEBUG
-    CMAKE_SHARED_LINKER_FLAGS_DEBUG
-    )
-
-list(INSERT CMAKE_MODULE_PATH 0
-	${CMAKE_CURRENT_SOURCE_DIR}/CMake
-	)
-
-if (VERSION)
-	add_definitions(-DSWAY_VERSION=\"${VERSION}\")
-else()
-	execute_process(
-		COMMAND git describe --always --tags
-		OUTPUT_VARIABLE GIT_COMMIT_HASH
-		OUTPUT_STRIP_TRAILING_WHITESPACE
-		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-		)
-	execute_process(
-		COMMAND git rev-parse --abbrev-ref HEAD
-		OUTPUT_VARIABLE GIT_BRANCH
-		OUTPUT_STRIP_TRAILING_WHITESPACE
-		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-		)
-
-	string(TIMESTAMP CURRENT_DATE "%Y-%m-%d" UTC)
-	add_definitions("-DSWAY_VERSION=\"${GIT_COMMIT_HASH} (${CURRENT_DATE}, branch \\\"${GIT_BRANCH}\\\")\"")
-endif()
-
-option(enable-swaylock "Enables the swaylock utility" YES)
-option(enable-swaybg "Enables the wallpaper utility" YES)
-option(enable-swaybar "Enables the swaybar utility" YES)
-option(enable-swaygrab "Enables the swaygrab utility" YES)
-option(enable-swaymsg "Enables the swaymsg utility" YES)
-option(enable-gdk-pixbuf "Use Pixbuf to support more image formats" YES)
-option(enable-tray "Enables the swaybar tray" YES)
-option(zsh-completions "Zsh shell completions" NO)
-option(default-wallpaper "Installs the default wallpaper" YES)
-option(LD_LIBRARY_PATH "Configure sway's default LD_LIBRARY_PATH")
-
-if (LD_LIBRARY_PATH)
-	add_definitions(-D_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}")
-endif()
-
-find_package(JsonC 0.12.1 REQUIRED)
-find_package(PCRE REQUIRED)
-find_package(Wlroots REQUIRED)
-find_package(Wayland REQUIRED)
-find_package(XKBCommon REQUIRED)
-find_package(Cairo REQUIRED)
-find_package(Pango REQUIRED)
-find_package(GdkPixbuf)
-find_package(PAM)
-find_package(DBus 1.10)
-
-find_package(LibInput REQUIRED)
-
-if (CMAKE_SYSTEM_NAME STREQUAL Linux)
-	find_package(Libcap REQUIRED)
-endif (CMAKE_SYSTEM_NAME STREQUAL Linux)
-
-if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
-	find_package(EpollShim REQUIRED)
-endif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
-
-include(FeatureSummary)
-include(Manpage)
-include(GNUInstallDirs)
-
-if (enable-gdk-pixbuf)
-	if (GDK_PIXBUF_FOUND)
-		set(WITH_GDK_PIXBUF YES)
-		add_definitions(-DWITH_GDK_PIXBUF)
-	else()
-		message(WARNING "gdk-pixbuf required but not found, only png images supported.")
-	endif()
-else()
-	message(STATUS "Building without gdk-pixbuf, only png images supported.")
-endif()
-
-if (enable-tray)
-	if (DBUS_FOUND)
-		set(ENABLE_TRAY TRUE)
-		add_definitions(-DENABLE_TRAY)
-	else()
-		message(WARNING "Tray required but DBus was not found. Tray will not be included")
-	endif()
-else()
-	message(STATUS "Building without the tray.")
-endif()
-
-include_directories(include)
-
-add_subdirectory(protocols)
-add_subdirectory(common)
-add_subdirectory(wayland)
-
-add_subdirectory(sway)
-if(enable-swaybg)
-	if(CAIRO_FOUND AND PANGO_FOUND)
-        # TODO WLR
-        #add_subdirectory(swaybg)
-	else()
-		message(WARNING "Not building swaybg - cairo, and pango are required.")
-	endif()
-endif()
-if(enable-swaymsg)
-	add_subdirectory(swaymsg)
-endif()
-if(enable-swaygrab)
-    # TODO WLR
-    #add_subdirectory(swaygrab)
-endif()
-if(enable-swaybar)
-	if(CAIRO_FOUND AND PANGO_FOUND)
-        # TODO WLR
-        #add_subdirectory(swaybar)
-	else()
-		message(WARNING "Not building swaybar - cairo, and pango  are required.")
-	endif()
-endif()
-if(enable-swaylock)
-	if(CAIRO_FOUND AND PANGO_FOUND AND PAM_FOUND)
-        # TODO WLR
-        #add_subdirectory(swaylock)
-	else()
-		message(WARNING "Not building swaylock - cairo, pango, and PAM are required.")
-	endif()
-endif()
-if(zsh-completions)
-	add_subdirectory(completions/zsh)
-endif()
-install(
-	FILES ${CMAKE_CURRENT_SOURCE_DIR}/sway.desktop
-	DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/wayland-sessions
-	COMPONENT data
-	)
-
-if(default-wallpaper)
-	install(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/assets/
-		DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/backgrounds/sway
-		COMPONENT data
-        FILES_MATCHING PATTERN "*Wallpaper*"
-		)
-endif()
-
-feature_summary(WHAT ALL)
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
deleted file mode 100644
index 4fa71f3a..00000000
--- a/common/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-include_directories(
-	${WLC_INCLUDE_DIRS}
-	${XKBCOMMON_INCLUDE_DIRS}
-)
-
-add_library(sway-common STATIC
-	ipc-client.c
-	list.c
-	log.c
-	util.c
-	readline.c
-	stringop.c
-)
-
-target_link_libraries(sway-common m)
diff --git a/completions/zsh/CMakeLists.txt b/completions/zsh/CMakeLists.txt
deleted file mode 100644
index 62c85090..00000000
--- a/completions/zsh/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-install(
-	FILES _sway _swaymsg _swaygrab _swaylock
-	DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/zsh/site-functions/
-)
diff --git a/sway/CMakeLists.txt b/sway/CMakeLists.txt
deleted file mode 100644
index 274fcc4a..00000000
--- a/sway/CMakeLists.txt
+++ /dev/null
@@ -1,96 +0,0 @@
-include_directories(
-	${PROTOCOLS_INCLUDE_DIRS}
-	${WLR_INCLUDE_DIRS}
-	${PCRE_INCLUDE_DIRS}
-	${JSONC_INCLUDE_DIRS}
-	${XKBCOMMON_INCLUDE_DIRS}
-	${LIBINPUT_INCLUDE_DIRS}
-	${CAIRO_INCLUDE_DIRS}
-	${PANGO_INCLUDE_DIRS}
-	${WAYLAND_INCLUDE_DIR}
-)
-
-add_executable(sway
-    desktop/output.c
-    desktop/xdg_shell_v6.c
-
-    commands.c
-    commands/exit.c
-
-    tree/container.c
-    tree/layout.c
-    tree/workspace.c
-
-	base64.c
-	main.c
-    server.c
-    ipc-json.c
-    ipc-server.c
-)
-
-add_definitions(
-	-DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}"
-)
-
-target_link_libraries(sway
-	sway-common
-	sway-protocols
-	sway-wayland
-	${WLR_LIBRARIES}
-	${XKBCOMMON_LIBRARIES}
-	${PCRE_LIBRARIES}
-	${JSONC_LIBRARIES}
-	${WAYLAND_SERVER_LIBRARIES}
-	${LIBINPUT_LIBRARIES}
-	${PANGO_LIBRARIES}
-	${JSONC_LIBRARIES}
-	m
-)
-
-if (CMAKE_SYSTEM_NAME STREQUAL Linux)
-	target_link_libraries(sway cap)
-endif (CMAKE_SYSTEM_NAME STREQUAL Linux)
-
-install(
-	TARGETS sway
-	RUNTIME
-	DESTINATION bin
-	COMPONENT runtime
-)
-
-add_custom_target(configs ALL)
-
-function(add_config name source destination)
-    add_custom_command(
-        OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}
-        COMMAND sed -r
-            's?__PREFIX__?${CMAKE_INSTALL_PREFIX}?g\; s?__SYSCONFDIR__?${CMAKE_INSTALL_FULL_SYSCONFDIR}?g\; s?__DATADIR__?${CMAKE_INSTALL_FULL_DATADIR}?g'
-            ${PROJECT_SOURCE_DIR}/${source}.in > ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}
-        DEPENDS ${PROJECT_SOURCE_DIR}/${source}.in
-        COMMENT "Generating config file ${source}"
-    )
-
-    install(
-        FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}
-        DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/${destination}
-        COMPONENT configuration
-    )
-
-	add_custom_target(config-${name} DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name})
-    add_dependencies(configs config-${name})
-endfunction()
-
-add_config(config config sway)
-add_config(00-defaults security.d/00-defaults sway/security.d)
-
-if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
-    add_config(10-freebsd security.d/10-freebsd sway/security.d)
-endif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
-
-if (A2X_FOUND)
-    add_manpage(sway 1)
-    add_manpage(sway 5)
-    add_manpage(sway-input 5)
-    add_manpage(sway-bar 5)
-    add_manpage(sway-security 7)
-endif()
diff --git a/swaymsg/CMakeLists.txt b/swaymsg/CMakeLists.txt
deleted file mode 100644
index b428a409..00000000
--- a/swaymsg/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-add_executable(swaymsg
-	main.c
-)
-
-include_directories(
-	${JSONC_INCLUDE_DIRS}
-)
-
-target_link_libraries(swaymsg
-	sway-common
-	${JSONC_LIBRARIES}
-)
-
-install(
-	TARGETS swaymsg
-	RUNTIME
-	DESTINATION bin
-	COMPONENT runtime
-)
-
-if (A2X_FOUND)
-    add_manpage(swaymsg 1)
-endif()
-- 
cgit v1.2.3