meson.build \
meson_options.txt \
meson_post_install.py \
- meson_post_install_systemd.py \
subprojects/expat.wrap \
subprojects/glib.wrap \
test/CMakeLists.txt \
install_dir: get_option('libexecdir'),
)
endif
+
+if use_systemd
+ install_symlinks += [
+ {
+ 'link_name': 'dbus.service',
+ 'install_dir': systemd_system_unitdir / 'multi-user.target.wants',
+ 'pointing_to': '../dbus.service',
+ },
+ {
+ 'link_name': 'dbus.socket',
+ 'install_dir': systemd_system_unitdir / 'sockets.target.wants',
+ 'pointing_to': '../dbus.socket',
+ },
+ ]
+endif
+
+if use_systemd and get_option('user_session')
+ install_symlinks += [
+ {
+ 'link_name': 'dbus.socket',
+ 'install_dir': systemd_user_unitdir / 'sockets.target.wants',
+ 'pointing_to': '../dbus.socket',
+ },
+ ]
+endif
compile_args = []
link_args = []
+install_symlinks = []
+
###############################################################################
# Project configuration
'@0@'.format(use_systemd),
)
-if use_systemd
- meson.add_install_script('meson_post_install_systemd.py',
- systemd_system_unitdir,
- systemd_user_unitdir,
- )
-endif
-
pkgconfig.generate(
libdbus,
name: 'dbus',
}
)
+foreach symlink : install_symlinks
+ if not platform_unix
+ warning(
+ 'Not creating symbolic link @0@/@1@ -> @2@'.format(
+ symlink['install_dir'],
+ symlink['link_name'],
+ symlink['pointing_to'],
+ )
+ )
+ elif meson.version().version_compare('>=0.61.0')
+ install_symlink(
+ symlink['link_name'],
+ install_dir : symlink['install_dir'],
+ pointing_to : symlink['pointing_to'],
+ )
+ else
+ meson.add_install_script(
+ 'tools/meson-compat-install-symlink.py',
+ symlink['link_name'],
+ symlink['install_dir'],
+ symlink['pointing_to'],
+ )
+ endif
+endforeach
+
summary_dict = {
'prefix': get_option('prefix'),
'exec_prefix': get_option('prefix'),
+++ /dev/null
-#!/usr/bin/env python3
-# Copyright © 2019-2020 Salamandar <felix@piedallu.me>
-# SPDX-License-Identifier: MIT
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-from meson_post_install import *
-
-import os, sys
-
-###############################################################################
-
-systemd_system_dir = to_destdir(sys.argv[1])
-systemd_user_dir = to_destdir(sys.argv[2])
-
-def force_symlink(src, dst):
- try:
- os.unlink(dst)
- except OSError:
- pass
- os.symlink(src, dst)
-
-def post_install_data():
- # Install dbus.socket as default implementation of a D-Bus stack.
- # Unconditionally enable D-Bus on systemd installations
- #
- # TODO meson >=0.61 has install_symlink()
-
- (systemd_system_dir / 'sockets.target.wants') .mkdir(parents=True, exist_ok=True)
- (systemd_system_dir / 'multi-user.target.wants').mkdir(parents=True, exist_ok=True)
- force_symlink('../dbus.socket', systemd_system_dir / 'sockets.target.wants' / 'dbus.socket')
- force_symlink('../dbus.service', systemd_system_dir / 'multi-user.target.wants' / 'dbus.service')
-
- if get_option('user_session'):
- (systemd_user_dir / 'sockets.target.wants') .mkdir(parents=True, exist_ok=True)
- force_symlink('../dbus.socket',systemd_user_dir / 'sockets.target.wants' / 'dbus.socket')
-
-if __name__ == "__main__":
- post_install_data()
EXTRA_DIST += build-timestamp.py
EXTRA_DIST += meson.build
+EXTRA_DIST += meson-compat-install-symlink.py
--- /dev/null
+#!/usr/bin/env python3
+# Copyright 2022 Simon McVittie
+# Copyright 2022 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+# Compatibility shim for installing symlinks with Meson < 0.61
+
+import os
+import sys
+from pathlib import Path
+
+link_name, d, pointing_to = sys.argv[1:]
+
+if os.path.isabs(d):
+ p = Path(d)
+ d = p.relative_to(p.anchor)
+ dest = os.path.join(os.environ['DESTDIR'], d)
+else:
+ dest = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], d)
+
+os.makedirs(dest, mode=0o755, exist_ok=True)
+os.symlink(pointing_to, os.path.join(dest, link_name))