Skip to content

Commit 3e65b8c

Browse files
committed
build: drop 'os' option and use host_machine.system()
to specify a different host, meson's machine files should be used instead.
1 parent 452c295 commit 3e65b8c

File tree

18 files changed

+39
-49
lines changed

18 files changed

+39
-49
lines changed

conf.d/meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ conf_data = conf_common
5151
if get_option('newnet')
5252
conf_data = conf_data + conf_net
5353
endif
54-
if os == 'FreeBSD'
54+
if os == 'freebsd'
5555
conf_data = conf_data + conf_FreeBSD
56-
elif os == 'Linux'
56+
elif os == 'linux'
5757
conf_data = conf_data + conf_Linux
58-
elif os == 'NetBSD'
58+
elif os == 'netbsd'
5959
conf_data = conf_data + conf_NetBSD
6060
endif
6161

etc/meson.build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
etc_conf_data = configuration_data()
2-
if os == 'FreeBSD'
2+
if os == 'freebsd'
33
etc_conf_data.set('TERM', 'cons25')
4-
elif os == 'Linux'
4+
elif os == 'linux'
55
etc_conf_data.set('TERM', 'wsvt25')
66
endif
77

@@ -25,15 +25,15 @@ etc_bin_NetBSD = [
2525
install_data(etc_conf_common,
2626
install_dir : get_option('sysconfdir'))
2727

28-
if os == 'FreeBSD'
28+
if os == 'freebsd'
2929
install_data(etc_bin_FreeBSD,
3030
install_dir : get_option('sysconfdir'),
3131
install_mode: 'rwxr-xr-x')
3232
install_data(etc_conf_FreeBSD,
3333
install_dir : get_option('sysconfdir'))
3434
endif
3535

36-
if os == 'FreeBSD' or os == 'NetBSD'
36+
if os == 'freebsd' or os == 'netbsd'
3737
foreach file : etc_bin_NetBSD
3838
configure_file(input : file,
3939
output : '@BASENAME@',

init.d/meson.build

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ init_NetBSD = [
8383
]
8484

8585
init_data = init_common
86-
if os == 'Dragonfly'
86+
if os == 'dragonfly'
8787
init_data = init_data + init_BSD
88-
elif os == 'FreeBSD'
88+
elif os == 'freebsd'
8989
init_data = init_data + init_BSD + init_FreeBSD
90-
elif os == 'Linux'
90+
elif os == 'linux'
9191
init_data = init_data + init_Linux
92-
elif os == 'NetBSD'
92+
elif os == 'netbsd'
9393
init_data = init_data + init_BSD + init_NetBSD
9494
endif
9595

@@ -104,7 +104,7 @@ install_symlink('functions.sh',
104104
pointing_to: rc_shdir / 'functions.sh',
105105
install_dir: init_d_dir)
106106

107-
if get_option('sysvinit') == true and os == 'Linux'
107+
if get_option('sysvinit') == true and os == 'linux'
108108
foreach x : get_option('agetty')
109109
link_name = 'agetty.' + x
110110
install_symlink(link_name,

man/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ man8 = [
1919
'supervise-daemon.8',
2020
]
2121

22-
if os == 'Linux'
22+
if os == 'linux'
2323
man8 = man8 + [
2424
'rc-sstat.8',
2525
'openrc-init.8',

meson.build

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,8 @@ if local_prefix == ''
3232
local_prefix = get_option('prefix') / 'usr' / 'local'
3333
endif
3434

35-
os = get_option('os')
36-
if os == ''
37-
r = run_command(find_program('uname'), '-s', check: true)
38-
os = r.stdout().strip()
39-
os = '-'.join(os.split('/'))
40-
endif
41-
42-
if os != 'Linux'
35+
os = host_machine.system()
36+
if os != 'linux'
4337
cap_dep = []
4438
kvm_dep = cc.find_library('kvm')
4539
else
@@ -58,11 +52,11 @@ endif
5852

5953
pkg_prefix = get_option('pkg_prefix')
6054
if pkg_prefix == ''
61-
if os == 'Dragonfly' or os == 'FreeBSD'
55+
if os == 'dragonfly' or os == 'freebsd'
6256
pkg_prefix = '/usr/local'
63-
elif os == 'GNU' or os == 'Linux'
57+
elif os == 'gnu' or os == 'linux'
6458
pkg_prefix = '/usr'
65-
elif os == 'NetBSD'
59+
elif os == 'netbsd'
6660
pkg_prefix = '/usr/pkg'
6761
endif
6862
endif
@@ -99,11 +93,11 @@ if get_option('buildtype').startswith('debug')
9993
c_flags += '-DRC_DEBUG'
10094
endif
10195

102-
if os == 'Linux'
96+
if os == 'linux'
10397
c_flags += '-D_DEFAULT_SOURCE'
104-
elif os == 'FreeBSD'
98+
elif os == 'freebsd'
10599
c_flags += '-D_BSD_SOURCE'
106-
elif os == 'GNU'
100+
elif os == 'gnu'
107101
c_flags += ['-D_DEFAULT_SOURCE', '-DPATH_MAX=4096']
108102
endif
109103

meson_options.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ option('local_prefix', type : 'string', value : '/usr/local',
88
description : 'default location of user maintained packages')
99
option('newnet', type : 'boolean',
1010
description : 'build and install our networking scripts')
11-
option('os', type : 'combo',
12-
choices :
13-
[ '', 'DragonFly', 'FreeBSD', 'GNU', 'Linux', 'NetBSD' ],
14-
description : 'Operating System (autodetected if not specified)')
1511
option('pam', type : 'boolean',
1612
description : 'enable PAM support')
1713
option('pam_libdir', type : 'string',

runlevels/meson.build

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sysinit_linux = [
66
'devfs',
77
'dmesg',
88
'sysfs']
9-
if os == 'Linux'
9+
if os == 'linux'
1010
sysinit += sysinit_linux
1111
endif
1212

@@ -53,11 +53,11 @@ if get_option('newnet')
5353
endif
5454
if os == 'DragonFly'
5555
boot += boot_bsd
56-
elif os == 'FreeBSD'
56+
elif os == 'freebsd'
5757
boot += boot_bsd + boot_freebsd
58-
elif os == 'Linux'
58+
elif os == 'linux'
5959
boot += boot_linux
60-
elif os == 'NetBSD'
60+
elif os == 'netbsd'
6161
boot += boot_bsd + boot_netbsd
6262
endif
6363

@@ -71,7 +71,7 @@ shutdown = ['savecache']
7171
shutdown_linux = [
7272
'killprocs',
7373
'mount-ro']
74-
if os == 'Linux'
74+
if os == 'linux'
7575
shutdown += shutdown_linux
7676
endif
7777

@@ -89,7 +89,7 @@ foreach runlevel: runlevels.keys()
8989
install_dir: runlevel_dir / runlevel,
9090
pointing_to: init_d_dir / service)
9191
endforeach
92-
if get_option('sysvinit') == true and os == 'Linux' and runlevel == 'default'
92+
if get_option('sysvinit') == true and os == 'linux' and runlevel == 'default'
9393
foreach tty : get_option('agetty')
9494
install_symlink('agetty.' + tty,
9595
install_dir: runlevel_dir / runlevel,

sh/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ scripts_config = [
2727
's6-svscanboot.sh.in'
2828
]
2929

30-
if os == 'Linux'
30+
if os == 'linux'
3131
sh += [
3232
'rc-cgroup.sh',
3333
]
@@ -39,7 +39,7 @@ if os == 'Linux'
3939
['init-early.sh.Linux.in', 'init-early.sh'],
4040
['init.sh.Linux.in', 'init.sh'],
4141
]
42-
elif os == 'GNU'
42+
elif os == 'gnu'
4343
scripts_config_os = [
4444
['init.sh.GNU.in', 'init.sh'],
4545
]

src/halt/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if os == 'Linux' and get_option('sysvinit')
1+
if os == 'linux' and get_option('sysvinit')
22
configure_file(input : 'halt.in',
33
output : '@BASENAME@',
44
configuration : script_conf_data,

src/kill_all/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if os == 'Linux'
1+
if os == 'linux'
22
executable('kill_all', 'kill_all.c',
33
include_directories: incdir,
44
dependencies: [rc, einfo, shared],

0 commit comments

Comments
 (0)