Skip to content

Commit cb413c0

Browse files
rjarrychristophefontaine
authored andcommitted
build: move file installation to meson
Previously, systemd service files, bash completions, and configuration files were installed through package-specific scripts (debian/rules and rpm/grout.spec). This approach required maintaining duplicate installation logic across different packaging systems and made it harder to support other distributions or installation methods. By moving this logic to meson.build files, the installation becomes uniform across all platforms and packaging systems. The systemd service is now installed using the canonical pkg-config method to determine the correct system unit directory. Bash completions are installed to the standard datadir location. Configuration files are installed to sysconfdir. Package-specific install files (debian/grout.install) are updated to reference the new meson-installed paths, and manual install commands are removed from packaging scripts since meson handles them now. Signed-off-by: Robin Jarry <[email protected]> Reviewed-by: Christophe Fontaine <[email protected]>
1 parent 29d0fb2 commit cb413c0

File tree

9 files changed

+35
-11
lines changed

9 files changed

+35
-11
lines changed

.github/workflows/package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
libjson-c-dev libnuma-dev libprotobuf-c-dev libreadline-dev \
3232
librtr-dev libsmartcols-dev libtool libyang-dev meson ninja-build \
3333
patch pkg-config protobuf-c-compiler python3-dev python3-pyelftools \
34-
texinfo
34+
systemd-dev texinfo
3535
- uses: actions/checkout@v4
3636
with:
3737
fetch-depth: 0 # force fetch all history

cli/meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ if not compiler.has_function(
2323
endif
2424

2525
cli_inc += include_directories('.')
26+
27+
install_data(
28+
files('grcli.bash-completion'),
29+
rename: ['grcli'],
30+
install_dir: get_option('datadir') / 'bash-completion/completions',
31+
)

debian/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Build-Depends:
2121
patch,
2222
pkg-config,
2323
python3-pyelftools,
24+
systemd-dev,
2425
Standards-Version: 4.7.0
2526
Rules-Requires-Root: no
2627
Homepage: https://github.com/DPDK/grout

debian/grout.bash-completion

Lines changed: 0 additions & 2 deletions
This file was deleted.

debian/grout.install

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
/etc/grout.init
33
/usr/bin/grcli
44
/usr/bin/grout
5+
/usr/lib/systemd/system/grout.service
6+
/usr/share/bash-completion/completions/grcli
7+
/usr/share/bash-completion/completions/grout
58
/usr/share/man/man1/grcli.1
69
/usr/share/man/man8/grout.8

debian/grout.service

Lines changed: 0 additions & 1 deletion
This file was deleted.

debian/rules

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ override_dh_auto_configure:
2222

2323
override_dh_auto_install:
2424
meson install -C $(build) --skip-subprojects --destdir=$(dest)
25-
install -D -m 644 main/grout.default $(dest)/etc/default/grout
26-
install -D -m 644 main/grout.init $(dest)/etc/grout.init
2725
install -D -m 0755 subprojects/dpdk/usertools/dpdk-telemetry-exporter.py \
2826
$(dest)/usr/bin/grout-telemetry-exporter
2927
install -D -m 0644 -t $(dest)/usr/share/dpdk/telemetry-endpoints \

main/meson.build

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,27 @@ tests += [
2727
],
2828
},
2929
]
30+
31+
systemd_dep = dependency('systemd', required: false)
32+
if systemd_dep.found()
33+
systemd_system_unit_dir = systemd_dep.get_variable(
34+
pkgconfig: 'systemdsystemunitdir',
35+
pkgconfig_define: ['prefix', get_option('prefix')]
36+
)
37+
install_data(
38+
files('grout.service'),
39+
install_dir: systemd_system_unit_dir,
40+
)
41+
install_data(
42+
files('grout.default'),
43+
rename: ['grout'],
44+
install_dir: get_option('sysconfdir') / 'default',
45+
)
46+
install_data('grout.init', install_dir: get_option('sysconfdir'))
47+
endif
48+
49+
install_data(
50+
files('grout.bash-completion'),
51+
rename: ['grout'],
52+
install_dir: get_option('datadir') / 'bash-completion/completions',
53+
)

rpm/grout.spec

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ FRR dplane plugin for grout
8181
%install
8282
%meson_install --skip-subprojects
8383

84-
install -D -m 0644 main/grout.default %{buildroot}%{_sysconfdir}/default/grout
85-
install -D -m 0644 main/grout.init %{buildroot}%{_sysconfdir}/grout.init
86-
install -D -m 0644 main/grout.service %{buildroot}%{_unitdir}/grout.service
87-
install -D -m 0644 main/grout.bash-completion %{buildroot}%{_datadir}/bash-completion/completions/grout
88-
install -D -m 0644 cli/grcli.bash-completion %{buildroot}%{_datadir}/bash-completion/completions/grcli
8984
install -D -m 0755 subprojects/dpdk/usertools/dpdk-telemetry-exporter.py %{buildroot}%{_bindir}/grout-telemetry-exporter
9085
install -D -m 0644 -t %{buildroot}%{_datadir}/dpdk/telemetry-endpoints subprojects/dpdk/usertools/telemetry-endpoints/*
9186

0 commit comments

Comments
 (0)