Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt « auxiliary_files - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5c2a6addc3689e8fdff0c52697549bc6970194ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 2022 The Mumble Developers. All rights reserved.
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file at the root of the
# Mumble source tree or at <https://www.mumble.info/LICENSE>.

include(delayed_configure_files)
include(pkg-utils)

if(NOT BUILD_RELEASE_DATE)
	# If BUILD_RELEASE_DATE has not been set, default to time of build
	string(TIMESTAMP BUILD_RELEASE_DATE "%Y-%m-%d")
endif()

if(client)
	if(UNIX AND NOT APPLE)
		delayed_configure_files(
			TARGET mumble
			FILES
			"${CMAKE_CURRENT_SOURCE_DIR}/config_files/info.mumble.Mumble.appdata.xml.in=${CMAKE_CURRENT_BINARY_DIR}/info.mumble.Mumble.appdata.xml"
			"${CMAKE_CURRENT_SOURCE_DIR}/config_files/info.mumble.Mumble.desktop.in=${CMAKE_CURRENT_BINARY_DIR}/info.mumble.Mumble.desktop"
			PASSTHROUGH_VARIABLES
				MUMBLE_BUILD_YEAR
				CMAKE_PROJECT_VERSION
				BUILD_RELEASE_DATE
				CMAKE_PROJECT_HOMEPAGE_URL
				CMAKE_PROJECT_DESCRIPTION
			VARIABLES
				"MUMBLE_CLIENT_BINARY_NAME=$<TARGET_FILE_NAME:mumble>"
			PYTHON_INTERPRETER "${PYTHON_INTERPRETER}"
			@ONLY
		)

		install(FILES "${CMAKE_CURRENT_BINARY_DIR}/info.mumble.Mumble.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
		install(FILES "${CMAKE_CURRENT_BINARY_DIR}/info.mumble.Mumble.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")

		# Install Mumble client man files
		install(FILES "man_files/mumble.1" DESTINATION "${MUMBLE_INSTALL_MANDIR}" COMPONENT doc)

	endif()
endif()

if(server)
	file(COPY "mumble-server.ini" DESTINATION ${CMAKE_BINARY_DIR})
	file(COPY "config_files/mumble-server.conf" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

	if(UNIX AND NOT APPLE)
		get_pkgconf_variable(
			OUTPUT_VARIABLE SYSUSERS_DIR
			MODULE systemd
			VARIABLE_NAME sysusersdir
			QUIET
		)
		if(NOT SYSUSERS_DIR)
			# Fallback value, in case it could not be fetched via pkg-config
			set(SYSUSERS_DIR "${CMAKE_INSTALL_SYSCONFDIR}/sysconfig.d")
		endif()
		get_pkgconf_variable(
			OUTPUT_VARIABLE SYSTEMD_SERVICE_DIR
			MODULE systemd
			VARIABLE_NAME systemd_system_unit_dir
			QUIET
		)
		if(NOT SYSTEMD_SERVICE_DIR)
			# Default to /etc/systemd/system - This is not where packages ought to install their service files (rather
			# it's where an admin is supposed to add their system files), but this seems to be the most consistent
			# path across different platforms, so we use it anyway.
			set(SYSTEMD_SERVICE_DIR "${CMAKE_INSTALL_SYSCONFDIR}/systemd/system")
		endif()

		delayed_configure_files(
			TARGET mumble-server
			FILES
				"${CMAKE_CURRENT_SOURCE_DIR}/config_files/mumble-server.service.in=${CMAKE_CURRENT_BINARY_DIR}/mumble-server.service"
				"${CMAKE_CURRENT_SOURCE_DIR}/run_scripts/mumble-server-user-wrapper.in=${CMAKE_CURRENT_BINARY_DIR}/mumble-server-user-wrapper"
			PASSTHROUGH_VARIABLES
				MUMBLE_BUILD_YEAR
				MUMBLE_INSTALL_ABS_EXECUTABLEDIR
				MUMBLE_INSTALL_ABS_SYSCONFDIR
			VARIABLES
				"MUMBLE_SERVER_BINARY_NAME=$<TARGET_FILE_NAME:mumble-server>"
			PYTHON_INTERPRETER "${PYTHON_INTERPRETER}"
			@ONLY
		)

		# Install Mumble server man files
		install(FILES "man_files/mumble-server.1" DESTINATION "${MUMBLE_INSTALL_MANDIR}" COMPONENT doc)
		install(FILES "man_files/mumble-server-user-wrapper.1" DESTINATION "${MUMBLE_INSTALL_MANDIR}" COMPONENT doc)

		install(FILES "mumble-server.ini" DESTINATION "${MUMBLE_INSTALL_SYSCONFDIR}" COMPONENT mumble_server)

		install(FILES "config_files/mumble-server.sysusers" DESTINATION "${SYSUSERS_DIR}" COMPONENT mumble_server RENAME "mumble-server.conf")

		install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mumble-server.service" DESTINATION "${SYSTEMD_SERVICE_DIR}" COMPONENT mumble_server)
		install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mumble-server-user-wrapper" DESTINATION "${MUMBLE_INSTALL_EXECUTABLEDIR}" COMPONENT mumble_server)
	endif()
endif()

if(overlay)
	if(UNIX)
		delayed_configure_files(
			TARGET overlay_gl
			FILES
				"${CMAKE_CURRENT_SOURCE_DIR}/run_scripts/mumble-overlay.in=${CMAKE_CURRENT_BINARY_DIR}/mumble-overlay"
			PASSTHROUGH_VARIABLES
				MUMBLE_BUILD_YEAR
			VARIABLES
				"MUMBLE_OVERLAY_BINARY_BASENAME=$<TARGET_FILE_BASE_NAME:overlay_gl>"
			PYTHON_INTERPRETER "${PYTHON_INTERPRETER}"
			@ONLY
		)

		# install overlay script
		install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/mumble-overlay" DESTINATION "${MUMBLE_INSTALL_SCRIPTDIR}")

		# install overlay man-files
		install(FILES "man_files/mumble-overlay.1" DESTINATION "${MUMBLE_INSTALL_MANDIR}" COMPONENT doc)
	endif()
endif()