Skip to content

Commit 16887f5

Browse files
committed
meson option for openrc
1 parent 39c3ee3 commit 16887f5

4 files changed

Lines changed: 43 additions & 140 deletions

File tree

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ git clone https://github.com/EmixamPP/linux-enable-ir-emitter.git
4343
cd linux-enable-ir-emitter
4444
```
4545

46-
Only if you do not have Systemd but OpenRC (it is not officially supported, so the version maybe oudated):
47-
```
48-
cp sources/boot_service/openrc/meson.build .
49-
```
50-
5146
Download a tiny version of opencv that will be statically linked. If you are on ARM plateform, you have to build it yourself by executing the [script here](https://github.com/EmixamPP/opencv-tiny/blob/main/build_opencv.sh). This is not required, you can use the shared opencv library of your distro. But it is recommanded in order to do not have issues after distro updates:
5247
```
5348
curl -L https://github.com/EmixamPP/opencv-tiny/raw/main/opencv-4.7.0.tar.xz | tar -xJ
@@ -57,6 +52,15 @@ sed -i "3s@prefix=@&${PWD}/@" opencv-4.7.0/lib64/pkgconfig/opencv4.pc
5752
Build linux-enable-ir-emitter (remove `--pkg-config-path...` if you skipped the previous step, or change the path by `opencv-*/build/install_dir/lib*/pkgconfig` if you built it yourself):
5853
```
5954
meson setup build --pkg-config-path opencv-4.7.0/lib64/pkgconfig
55+
```
56+
57+
Only if you do not have Systemd but OpenRC:
58+
```
59+
meson configure build -Dboot_service=openrc
60+
```
61+
62+
Install linux-enable-ir-emitter:
63+
```
6064
sudo meson install -C build
6165
```
6266

meson.build

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ version = '4.5.0'
1717
lib_dir = get_option('libdir') / meson.project_name()
1818
lib_bin_dir = lib_dir / 'bin'
1919
sysconf_dir = get_option('sysconfdir')
20-
systemd_dir = 'lib/systemd/system'
2120
autocomplete_dir = get_option('datadir') / 'bash-completion/completions'
22-
21+
boot_service = get_option('boot_service')
22+
systemd_dir = 'lib/systemd/system'
23+
openrc_dir = '/etc/init.d'
2324

2425
executable(
2526
'driver-generator',
@@ -46,7 +47,7 @@ executable(
4647

4748
configure_version_data = configuration_data({'version': version})
4849
configure_file(
49-
input : 'sources/linux-enable-ir-emitter.py.in',
50+
input : 'sources/linux-enable-ir-emitter.py',
5051
output : 'linux-enable-ir-emitter.py',
5152
configuration : configure_version_data,
5253
install: true,
@@ -65,11 +66,16 @@ configure_paths_data = configuration_data({
6566
'BIN_EXECUTE_DRIVER_PATH': '/usr' / lib_bin_dir / 'execute-driver',
6667
'BIN_DRIVER_GENERATOR_PATH': '/usr' / lib_bin_dir / 'driver-generator',
6768
'UDEV_RULE_PATH': '/etc/udev/rules.d/99-linux-enable-ir-emitter.rules',
68-
'BOOT_SERVICE_NAME': 'linux-enable-ir-emitter.service',
69-
'BOOT_SERVICE_MANAGER': 'systemd'
7069
})
70+
if boot_service == 'systemd'
71+
configure_paths_data.set('BOOT_SERVICE_NAME', 'linux-enable-ir-emitter.service')
72+
configure_paths_data.set('BOOT_SERVICE_MANAGER', 'systemd')
73+
elif boot_service == 'openrc'
74+
configure_paths_data.set('BOOT_SERVICE_NAME', 'linux-enable-ir-emitter')
75+
configure_paths_data.set('BOOT_SERVICE_MANAGER', 'openrc')
76+
endif
7177
configure_file(
72-
input : 'sources/globals.py.in',
78+
input : 'sources/globals.py',
7379
output : 'globals.py',
7480
configuration : configure_paths_data,
7581
install: true,
@@ -102,16 +108,27 @@ install_data(
102108
install_dir : lib_dir / 'boot_service',
103109
)
104110

105-
install_data(
106-
'sources/boot_service/systemd/__init__.py',
107-
'sources/boot_service/systemd/systemd.py',
108-
install_dir : lib_dir / 'boot_service/systemd',
109-
)
110-
111-
install_data(
112-
'sources/boot_service/systemd/linux-enable-ir-emitter.service',
113-
install_dir : systemd_dir,
114-
)
111+
if boot_service == 'systemd'
112+
install_data(
113+
'sources/boot_service/systemd/__init__.py',
114+
'sources/boot_service/systemd/systemd.py',
115+
install_dir : lib_dir / 'boot_service/systemd',
116+
)
117+
install_data(
118+
'sources/boot_service/systemd/linux-enable-ir-emitter.service',
119+
install_dir : systemd_dir,
120+
)
121+
elif boot_service == 'openrc'
122+
install_data(
123+
'sources/boot_service/openrc/__init__.py',
124+
'sources/boot_service/openrc/openrc.py',
125+
install_dir : lib_dir / 'boot_service/openrc',
126+
)
127+
install_data(
128+
'sources/boot_service/openrc/linux-enable-ir-emitter',
129+
install_dir : openrc_dir,
130+
)
131+
endif
115132

116133
install_data(
117134
'sources/autocomplete/linux-enable-ir-emitter',

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
option('boot_service', type : 'combo', choices : ['systemd', 'openrc'], value : 'systemd')

sources/boot_service/openrc/meson.build

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

0 commit comments

Comments
 (0)