2020-11-09 12:23:58 +08:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2017-11-19 01:32:01 +08:00
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
project ( 'systemd' , 'c' ,
2024-02-14 18:04:36 +08:00
version : files ( 'meson.version' ) ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
license : 'LGPLv2+' ,
default_options : [
2022-03-11 14:13:23 +08:00
'c_std=gnu11' ,
2017-04-18 07:25:00 +08:00
'prefix=/usr' ,
'sysconfdir=/etc' ,
'localstatedir=/var' ,
2019-11-10 18:39:15 +08:00
'warning_level=2' ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
] ,
2022-05-16 03:08:21 +08:00
meson_version : '>= 0.60.0' ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
)
2024-04-26 05:26:08 +08:00
libsystemd_version = '0.39.0'
libudev_version = '1.7.9'
2017-09-29 01:24:16 +08:00
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
conf = configuration_data ( )
2022-05-19 19:58:15 +08:00
conf . set_quoted ( 'PROJECT_URL' , 'https://systemd.io/' )
2024-02-14 18:04:36 +08:00
conf . set ( 'PROJECT_VERSION' , meson . project_version ( ) . split ( '~' ) [ 0 ] ,
2020-02-28 18:09:16 +08:00
description : 'Numerical project version (used where a simple number is expected)' )
2024-02-14 18:04:36 +08:00
conf . set_quoted ( 'PROJECT_VERSION_FULL' , meson . project_version ( ) , description : 'Full project version' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2019-02-28 00:19:07 +08:00
# This is to be used instead of meson.source_root(), as the latter will return
# the wrong result when systemd is being built as a meson subproject
project_source_root = meson . current_source_dir ( )
2020-04-25 02:12:03 +08:00
project_build_root = meson . current_build_dir ( )
2019-06-07 20:41:36 +08:00
relative_source_path = run_command ( 'realpath' ,
2020-04-25 02:12:03 +08:00
'--relative-to=@0@' . format ( project_build_root ) ,
2021-11-17 20:58:53 +08:00
project_source_root ,
check : true ) . stdout ( ) . strip ( )
2019-06-07 20:41:36 +08:00
conf . set_quoted ( 'RELATIVE_SOURCE_PATH' , relative_source_path )
2019-02-28 00:19:07 +08:00
2021-04-14 19:17:22 +08:00
conf . set10 ( 'BUILD_MODE_DEVELOPER' , get_option ( 'mode' ) == 'developer' ,
description : 'tailor build to development or release builds' )
2023-11-08 04:51:40 +08:00
2023-08-10 22:00:55 +08:00
feature = get_option ( 'log-message-verification' )
if feature . auto ( )
have = conf . get ( 'BUILD_MODE_DEVELOPER' ) == 1
2022-05-11 22:42:13 +08:00
else
2023-08-10 22:00:55 +08:00
have = feature . enabled ( )
2022-05-11 22:42:13 +08:00
endif
2023-08-10 22:00:55 +08:00
conf . set10 ( 'LOG_MESSAGE_VERIFICATION' , have )
2020-08-27 23:26:49 +08:00
2018-10-10 17:56:45 +08:00
want_ossfuzz = get_option ( 'oss-fuzz' )
want_libfuzzer = get_option ( 'llvm-fuzz' )
2021-09-04 00:43:33 +08:00
if want_ossfuzz and want_libfuzzer
2020-03-30 14:42:19 +08:00
error ( 'only one of oss-fuzz or llvm-fuzz can be specified' )
2018-10-10 17:56:45 +08:00
endif
2019-05-06 03:28:42 +08:00
2020-03-30 14:42:19 +08:00
fuzzer_build = want_ossfuzz or want_libfuzzer
2018-10-10 17:56:45 +08:00
2022-05-12 18:51:11 +08:00
# If we're building *not* for actual fuzzing, allow input samples of any size
# (for testing and for reproduction of issues discovered with previously-higher
# limits).
conf . set10 ( 'FUZZ_USE_SIZE_LIMIT' , fuzzer_build )
2023-01-10 21:25:57 +08:00
# We'll set this to '1' for EFI builds in a different place.
conf . set10 ( 'SD_BOOT' , false )
2021-12-23 20:05:01 +08:00
# Create a title-less summary section early, so it ends up first in the output.
# More items are added later after they have been detected.
summary ( { 'build mode' : get_option ( 'mode' ) } )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
#####################################################################
2017-07-24 16:41:45 +08:00
# Try to install the git pre-commit hook
2024-03-14 17:29:55 +08:00
git_setup_sh = find_program ( 'tools/git-setup.sh' , required : false )
if git_setup_sh . found ( )
git_hook = run_command ( git_setup_sh , check : false )
2020-03-28 16:30:51 +08:00
if git_hook . returncode ( ) == 0
message ( git_hook . stdout ( ) . strip ( ) )
endif
2017-07-24 16:41:45 +08:00
endif
#####################################################################
2021-11-14 00:01:16 +08:00
fs = import ( 'fs' )
2018-03-01 17:28:29 +08:00
if get_option ( 'split-bin' ) == 'auto'
2021-11-14 00:01:16 +08:00
split_bin = not fs . is_symlink ( '/usr/sbin' )
2018-03-01 17:28:29 +08:00
else
split_bin = get_option ( 'split-bin' ) == 'true'
endif
2018-03-02 04:48:36 +08:00
conf . set10 ( 'HAVE_SPLIT_BIN' , split_bin ,
description : 'bin and sbin directories are separate' )
2018-03-01 17:28:29 +08:00
2020-06-04 05:02:59 +08:00
have_standalone_binaries = get_option ( 'standalone-binaries' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
sysvinit_path = get_option ( 'sysvinit-path' )
sysvrcnd_path = get_option ( 'sysvrcnd-path' )
2018-05-07 17:17:35 +08:00
conf . set10 ( 'HAVE_SYSV_COMPAT' , sysvinit_path != '' and sysvrcnd_path != '' ,
2017-10-03 16:41:51 +08:00
description : 'SysV init scripts and rcN.d links are supported' )
2021-07-08 17:47:32 +08:00
conf . set10 ( 'CREATE_LOG_DIRS' , get_option ( 'create-log-dirs' ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2020-04-09 05:59:13 +08:00
if get_option ( 'hibernate' ) and not get_option ( 'initrd' )
error ( 'hibernate depends on initrd' )
endif
2018-10-12 00:23:26 +08:00
conf . set10 ( 'BUMP_PROC_SYS_FS_FILE_MAX' , get_option ( 'bump-proc-sys-fs-file-max' ) )
conf . set10 ( 'BUMP_PROC_SYS_FS_NR_OPEN' , get_option ( 'bump-proc-sys-fs-nr-open' ) )
2018-11-15 16:50:42 +08:00
conf . set ( 'HIGH_RLIMIT_NOFILE' , 512 * 1024 )
2018-10-12 00:23:26 +08:00
2021-07-28 01:32:35 +08:00
# Meson ignores the preceding arguments when joining paths if an absolute
# component is encountered, so this should canonicalize various paths when they
# are absolute or relative.
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
prefixdir = get_option ( 'prefix' )
if not prefixdir . startswith ( '/' )
2017-04-18 07:25:00 +08:00
error ( 'Prefix is not absolute: "@0@"' . format ( prefixdir ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2021-02-25 01:02:36 +08:00
2023-06-12 09:15:19 +08:00
prefixdir_noslash = '/' + prefixdir . strip ( '/' )
2021-07-28 01:32:35 +08:00
bindir = prefixdir / get_option ( 'bindir' )
2023-06-12 09:15:19 +08:00
sbindir = prefixdir / ( split_bin ? 'sbin' : 'bin' )
2023-08-08 09:38:47 +08:00
sbin_to_bin = split_bin ? '../bin/' : ''
2021-07-28 01:32:35 +08:00
libdir = prefixdir / get_option ( 'libdir' )
sysconfdir = prefixdir / get_option ( 'sysconfdir' )
includedir = prefixdir / get_option ( 'includedir' )
datadir = prefixdir / get_option ( 'datadir' )
localstatedir = '/' / get_option ( 'localstatedir' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-06-12 09:15:19 +08:00
libexecdir = prefixdir / 'lib/systemd'
pkglibdir = libdir / 'systemd'
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2020-12-31 07:11:30 +08:00
install_sysconfdir = get_option ( 'install-sysconfdir' ) != 'false'
install_sysconfdir_samples = get_option ( 'install-sysconfdir' ) == 'true'
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
# Dirs of external packages
2021-07-28 01:32:35 +08:00
pkgconfigdatadir = get_option ( 'pkgconfigdatadir' ) != '' ? get_option ( 'pkgconfigdatadir' ) : datadir / 'pkgconfig'
pkgconfiglibdir = get_option ( 'pkgconfiglibdir' ) != '' ? get_option ( 'pkgconfiglibdir' ) : libdir / 'pkgconfig'
polkitpolicydir = datadir / 'polkit-1/actions'
polkitrulesdir = datadir / 'polkit-1/rules.d'
polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
xinitrcdir = get_option ( 'xinitrcdir' ) != '' ? get_option ( 'xinitrcdir' ) : sysconfdir / 'X11/xinit/xinitrc.d'
2017-11-23 21:20:22 +08:00
rpmmacrosdir = get_option ( 'rpmmacrosdir' )
if rpmmacrosdir != 'no'
2021-07-28 01:32:35 +08:00
rpmmacrosdir = prefixdir / rpmmacrosdir
2017-11-23 21:20:22 +08:00
endif
2023-06-12 09:15:19 +08:00
modprobedir = prefixdir / 'lib/modprobe.d'
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
# Our own paths
2021-07-28 01:32:35 +08:00
pkgdatadir = datadir / 'systemd'
environmentdir = prefixdir / 'lib/environment.d'
pkgsysconfdir = sysconfdir / 'systemd'
userunitdir = prefixdir / 'lib/systemd/user'
userpresetdir = prefixdir / 'lib/systemd/user-preset'
tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
2022-06-20 21:06:09 +08:00
usertmpfilesdir = prefixdir / 'share/user-tmpfiles.d'
2021-07-28 01:32:35 +08:00
sysusersdir = prefixdir / 'lib/sysusers.d'
sysctldir = prefixdir / 'lib/sysctl.d'
binfmtdir = prefixdir / 'lib/binfmt.d'
modulesloaddir = prefixdir / 'lib/modules-load.d'
2023-06-12 09:15:19 +08:00
networkdir = prefixdir / 'lib/systemd/network'
systemgeneratordir = libexecdir / 'system-generators'
2021-07-28 01:32:35 +08:00
usergeneratordir = prefixdir / 'lib/systemd/user-generators'
systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
2023-06-12 09:15:19 +08:00
systemshutdowndir = libexecdir / 'system-shutdown'
systemsleepdir = libexecdir / 'system-sleep'
systemunitdir = prefixdir / 'lib/systemd/system'
systempresetdir = prefixdir / 'lib/systemd/system-preset'
udevlibexecdir = prefixdir / 'lib/udev'
2021-07-28 01:32:35 +08:00
udevrulesdir = udevlibexecdir / 'rules.d'
udevhwdbdir = udevlibexecdir / 'hwdb.d'
catalogdir = prefixdir / 'lib/systemd/catalog'
kernel-install: replace 00-entry-directory with K_I_LAYOUT in k-i
341890de866f2ee34919a47ce3fc6c8cd3c1924c made "bootctl install" create
ESP\MID, in preparation of cf73f650890b56a59bfb713c4c82b4e29daa7316 that
followed it and created 00-entry-directory.install to make ESP\MID\KVER
if ESP\MID existed ‒ this meant that "bootctl install" followed by
"kernel-install $(uname -r) /boot/vml*$(uname -r) /boot/ini*$(uname -r)"
actually installed the kernel correctly.
Later, 31e57550b552e113bd3d44355b237c41e42beb58 reverted the first
commit, meaning, that now running those two commands first installs
sd-boot, but then does nothing. Everything appears to work right,
nothing errors out, but no changes are actually done. To the untrained
eye (all of them), even running with -v appears to work:
all the hooks are run, as is depmod, but, again, nothing happens.
This is horrible. Nothing in either manpage suggests what to do
(nor should it, really), but the user is left with a bootloader that
appears fully funxional, since nothing suggests a failure in the output,
but with an unbootable machine, /no way to boot it/, even if they drop
to an EFI shell, since the boot bundle isn't present on the ESP,
and no real recourse even if they boot into a recovery system,
apart from installing like GRUB or whatever.
00- is purely instrumentation for 90-,
and separating one from the other has led to downstream dissatisfaxion
(indeed, the last mentioned commit cited cited exactly that as the
reversion reason), while creating $ENTRY_DIR_ABS is only required
for bootloaders using the BLS, and shouldn't itself toggle anything.
To that end, introduce an /{e,l}/k/install.conf file that allows
overriding the detected layout, and detect it as "bls" if
$BOOT_ROOT/$MACHINE_ID ($ENTRY_DIR_ABS/..) exists, otherwise "other" ‒
if a user wishes to select a different bootloader,
like GRUB, they (or, indeed, the postinst script) can specify
layout=grub. This disables 90- and $ENTRY_DIR_ABS manipulation.
2021-03-16 23:47:34 +08:00
kerneldir = prefixdir / 'lib/kernel'
kernelinstalldir = kerneldir / 'install.d'
2021-07-28 01:32:35 +08:00
factorydir = datadir / 'factory'
bootlibdir = prefixdir / 'lib/systemd/boot/efi'
testsdir = prefixdir / 'lib/systemd/tests'
2023-01-26 23:07:17 +08:00
unittestsdir = testsdir / 'unit-tests'
2023-03-17 21:14:16 +08:00
testdata_dir = testsdir / 'testdata'
2021-07-28 01:32:35 +08:00
systemdstatedir = localstatedir / 'lib/systemd'
catalogstatedir = systemdstatedir / 'catalog'
randomseeddir = localstatedir / 'lib/systemd'
2023-06-12 09:15:19 +08:00
profiledir = libexecdir / 'portable' / 'profile'
2023-09-29 00:16:59 +08:00
repartdefinitionsdir = libexecdir / 'repart/definitions'
2023-06-12 09:15:19 +08:00
ntpservicelistdir = prefixdir / 'lib/systemd/ntp-units.d'
2023-05-24 21:32:17 +08:00
credstoredir = prefixdir / 'lib/credstore'
2023-08-16 17:40:01 +08:00
pcrlockdir = prefixdir / 'lib/pcrlock.d'
2023-11-20 18:51:47 +08:00
mimepackagesdir = prefixdir / 'share/mime/packages'
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
meson: add build option for install path of main config files
This allows distros to install configuration file templates in /usr/lib/systemd
for example.
Currently we install "empty" config files in /etc/systemd/. They serve two
purposes:
- The file contains commented-out values that show the default settings.
- It is easier to edit the right file if it is already there, the user doesn't
have to type in the path correctly, and the basic file structure is already in
place so it's easier to edit.
Things that have happened since this approach was put in place:
- We started supporting drop-ins for config files, and drop-ins are the
recommended way to create local configuration overrides.
- We have systemd-analyze cat-config which takes care of iterating over
all possible locations (/etc, /run, /usr, /usr/local) and figuring out
the right file.
- Because of the first two points, systemd-analyze cat-config is much better,
because it takes care of finding all the drop-ins and figuring out the
precedence. Looking at files manually is still possible of course, but not
very convenient.
The disadvantages of the current approach with "empty" files in /etc:
- We clutter up /etc so it's harder to see what the local configuration actually is.
- If a user edits the file, package updates will not override the file (e.g.
systemd.rpm uses %config(noreplace). This means that the "documented defaults"
will become stale over time, if the user ever edits the main config file.
Thus, I think that it's reasonable to:
- Install the main config file to /usr/lib so that it serves as reference for
syntax and option names and default values and is properly updated on package
upgrades.
- Recommend to users to always use drop-ins for configuration and
systemd-analyze cat-config to view the documentation.
This setting makes this change opt-in.
Fixes #18420.
[zjs: add more text to the description]
2023-08-21 18:37:00 +08:00
configfiledir = get_option ( 'configfiledir' )
if configfiledir == ''
configfiledir = sysconfdir
endif
pkgconfigfiledir = configfiledir / 'systemd'
2018-02-02 05:46:15 +08:00
docdir = get_option ( 'docdir' )
if docdir == ''
2021-07-28 01:32:35 +08:00
docdir = datadir / 'doc/systemd'
2018-02-02 05:46:15 +08:00
endif
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
pamlibdir = get_option ( 'pamlibdir' )
if pamlibdir == ''
2023-06-12 09:15:19 +08:00
pamlibdir = libdir / 'security'
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
pamconfdir = get_option ( 'pamconfdir' )
if pamconfdir == ''
2021-07-28 01:32:35 +08:00
pamconfdir = prefixdir / 'lib/pam.d'
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2024-01-05 06:31:51 +08:00
sshconfdir = get_option ( 'sshconfdir' )
if sshconfdir == ''
sshconfdir = sysconfdir / 'ssh/ssh_config.d'
endif
2023-11-17 01:47:52 +08:00
sshdconfdir = get_option ( 'sshdconfdir' )
if sshdconfdir == ''
sshdconfdir = sysconfdir / 'ssh/sshd_config.d'
endif
2024-03-01 18:25:52 +08:00
sshdprivsepdir = get_option ( 'sshdprivsepdir' )
conf . set10 ( 'CREATE_SSHDPRIVSEPDIR' , sshdprivsepdir != 'no' and not sshdprivsepdir . startswith ( '/usr/' ) )
conf . set ( 'SSHDPRIVSEPDIR' , sshdprivsepdir , description : 'SSH privilege separation directory' )
2021-03-17 03:13:28 +08:00
libcryptsetup_plugins_dir = get_option ( 'libcryptsetup-plugins-dir' )
if libcryptsetup_plugins_dir == ''
2023-06-12 09:15:19 +08:00
libcryptsetup_plugins_dir = libdir / 'cryptsetup'
2021-03-17 03:13:28 +08:00
endif
2018-02-15 18:43:08 +08:00
memory_accounting_default = get_option ( 'memory-accounting-default' )
2019-06-07 01:22:20 +08:00
status_unit_format_default = get_option ( 'status-unit-format-default' )
2022-06-10 02:33:29 +08:00
if status_unit_format_default == 'auto'
status_unit_format_default = conf . get ( 'BUILD_MODE_DEVELOPER' ) == 1 ? 'name' : 'description'
endif
2018-02-15 18:43:08 +08:00
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'BINDIR' , bindir )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'BINFMT_DIR' , binfmtdir )
conf . set_quoted ( 'BOOTLIBDIR' , bootlibdir )
2021-07-28 01:32:35 +08:00
conf . set_quoted ( 'CATALOG_DATABASE' , catalogstatedir / 'database' )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'CERTIFICATE_ROOT' , get_option ( 'certificate-root' ) )
2021-07-08 17:47:32 +08:00
conf . set_quoted ( 'DOC_DIR' , docdir )
2021-07-28 01:32:35 +08:00
conf . set_quoted ( 'DOCUMENT_ROOT' , pkgdatadir / 'gatewayd' )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'ENVIRONMENT_DIR' , environmentdir )
conf . set_quoted ( 'INCLUDE_DIR' , includedir )
conf . set_quoted ( 'LIBDIR' , libdir )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'LIBEXECDIR' , libexecdir )
2024-03-01 04:38:03 +08:00
conf . set_quoted ( 'KERNEL_INSTALL_DIR' , kernelinstalldir )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'MODPROBE_DIR' , modprobedir )
conf . set_quoted ( 'MODULESLOAD_DIR' , modulesloaddir )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
conf . set_quoted ( 'PKGSYSCONFDIR' , pkgsysconfdir )
2021-07-28 01:32:35 +08:00
conf . set_quoted ( 'POLKIT_AGENT_BINARY_PATH' , bindir / 'pkttyagent' )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'PREFIX' , prefixdir )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'PREFIX_NOSLASH' , prefixdir_noslash )
2021-07-28 01:32:35 +08:00
conf . set_quoted ( 'RANDOM_SEED' , randomseeddir / 'random-seed' )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'RANDOM_SEED_DIR' , randomseeddir )
2020-09-15 23:44:26 +08:00
conf . set_quoted ( 'RC_LOCAL_PATH' , get_option ( 'rc-local' ) )
2024-01-05 06:31:51 +08:00
conf . set_quoted ( 'SSHCONFDIR' , sshconfdir )
2023-11-17 01:47:52 +08:00
conf . set_quoted ( 'SSHDCONFDIR' , sshdconfdir )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'SYSCONF_DIR' , sysconfdir )
conf . set_quoted ( 'SYSCTL_DIR' , sysctldir )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'SYSTEMCTL_BINARY_PATH' , bindir / 'systemctl' )
conf . set_quoted ( 'SYSTEMD_BINARY_PATH' , libexecdir / 'systemd' )
core: add systemd-executor binary
Currently we spawn services by forking a child process, doing a bunch
of work, and then exec'ing the service executable.
There are some advantages to this approach:
- quick: we immediately have access to all the enourmous amount of
state simply by virtue of sharing the memory with the parent
- easy to refactor and add features
- part of the same binary, will never be out of sync
There are however significant drawbacks:
- doing work after fork and before exec is against glibc's supported
case for several APIs we call
- copy-on-write trap: anytime any memory is touched in either parent
or child, a copy of that page will be triggered
- memory footprint of the child process will be memory footprint of
PID1, but using the cgroup memory limits of the unit
The last issue is especially problematic on resource constrained
systems where hard memory caps are enforced and swap is not allowed.
As soon as PID1 is under load, with no page out due to no swap, and a
service with a low MemoryMax= tries to start, hilarity ensues.
Add a new systemd-executor binary, that is able to receive all the
required state via memfd, deserialize it, prepare the appropriate
data structures and call exec_child.
Use posix_spawn which uses CLONE_VM + CLONE_VFORK, to ensure there is
no copy-on-write (same address space will be used, and parent process
will be frozen, until exec).
The sd-executor binary is pinned by FD on startup, so that we can
guarantee there will be no incompatibilities during upgrades.
2023-06-02 02:51:42 +08:00
conf . set_quoted ( 'SYSTEMD_EXECUTOR_BINARY_PATH' , libexecdir / 'systemd-executor' )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'SYSTEMD_CATALOG_DIR' , catalogdir )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'SYSTEMD_CGROUPS_AGENT_PATH' , libexecdir / 'systemd-cgroups-agent' )
2023-09-23 00:47:05 +08:00
conf . set_quoted ( 'SYSTEMD_CRYPTSETUP_PATH' , bindir / 'systemd-cryptsetup' )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'SYSTEMD_EXPORT_PATH' , libexecdir / 'systemd-export' )
conf . set_quoted ( 'SYSTEMD_FSCK_PATH' , libexecdir / 'systemd-fsck' )
conf . set_quoted ( 'SYSTEMD_GROWFS_PATH' , libexecdir / 'systemd-growfs' )
conf . set_quoted ( 'SYSTEMD_HOMEWORK_PATH' , libexecdir / 'systemd-homework' )
conf . set_quoted ( 'SYSTEMD_IMPORT_FS_PATH' , libexecdir / 'systemd-import-fs' )
conf . set_quoted ( 'SYSTEMD_IMPORT_PATH' , libexecdir / 'systemd-import' )
conf . set_quoted ( 'SYSTEMD_INTEGRITYSETUP_PATH' , libexecdir / 'systemd-integritysetup' )
2021-07-28 01:32:35 +08:00
conf . set_quoted ( 'SYSTEMD_KBD_MODEL_MAP' , pkgdatadir / 'kbd-model-map' )
conf . set_quoted ( 'SYSTEMD_LANGUAGE_FALLBACK_MAP' , pkgdatadir / 'language-fallback-map' )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'SYSTEMD_MAKEFS_PATH' , libexecdir / 'systemd-makefs' )
conf . set_quoted ( 'SYSTEMD_PULL_PATH' , libexecdir / 'systemd-pull' )
conf . set_quoted ( 'SYSTEMD_SHUTDOWN_BINARY_PATH' , libexecdir / 'systemd-shutdown' )
2023-03-17 21:14:16 +08:00
conf . set_quoted ( 'SYSTEMD_TEST_DATA' , testdata_dir )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH' , bindir / 'systemd-tty-ask-password-agent' )
conf . set_quoted ( 'SYSTEMD_UPDATE_HELPER_PATH' , libexecdir / 'systemd-update-helper' )
conf . set_quoted ( 'SYSTEMD_USERWORK_PATH' , libexecdir / 'systemd-userwork' )
2023-03-09 19:27:29 +08:00
conf . set_quoted ( 'SYSTEMD_MOUNTWORK_PATH' , libexecdir / 'systemd-mountwork' )
2023-04-21 01:07:33 +08:00
conf . set_quoted ( 'SYSTEMD_NSRESOURCEWORK_PATH' , libexecdir / 'systemd-nsresourcework' )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'SYSTEMD_VERITYSETUP_PATH' , libexecdir / 'systemd-veritysetup' )
2021-07-28 01:32:35 +08:00
conf . set_quoted ( 'SYSTEM_CONFIG_UNIT_DIR' , pkgsysconfdir / 'system' )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'SYSTEM_DATA_UNIT_DIR' , systemunitdir )
2020-03-24 23:28:26 +08:00
conf . set_quoted ( 'SYSTEM_ENV_GENERATOR_DIR' , systemenvgeneratordir )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'SYSTEM_GENERATOR_DIR' , systemgeneratordir )
conf . set_quoted ( 'SYSTEM_PRESET_DIR' , systempresetdir )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
conf . set_quoted ( 'SYSTEM_SHUTDOWN_PATH' , systemshutdowndir )
conf . set_quoted ( 'SYSTEM_SLEEP_PATH' , systemsleepdir )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'SYSTEM_SYSVINIT_PATH' , sysvinit_path )
conf . set_quoted ( 'SYSTEM_SYSVRCND_PATH' , sysvrcnd_path )
2021-05-16 22:44:47 +08:00
conf . set_quoted ( 'SYSUSERS_DIR' , sysusersdir )
conf . set_quoted ( 'TMPFILES_DIR' , tmpfilesdir )
2022-06-20 21:06:09 +08:00
conf . set_quoted ( 'USER_TMPFILES_DIR' , usertmpfilesdir )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
conf . set_quoted ( 'UDEVLIBEXECDIR' , udevlibexecdir )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'UDEV_HWDB_DIR' , udevhwdbdir )
conf . set_quoted ( 'UDEV_RULES_DIR' , udevrulesdir )
2021-07-28 01:32:35 +08:00
conf . set_quoted ( 'USER_CONFIG_UNIT_DIR' , pkgsysconfdir / 'user' )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'USER_DATA_UNIT_DIR' , userunitdir )
conf . set_quoted ( 'USER_ENV_GENERATOR_DIR' , userenvgeneratordir )
conf . set_quoted ( 'USER_GENERATOR_DIR' , usergeneratordir )
2021-07-28 01:32:35 +08:00
conf . set_quoted ( 'USER_KEYRING_PATH' , pkgsysconfdir / 'import-pubring.gpg' )
2021-05-17 01:34:52 +08:00
conf . set_quoted ( 'USER_PRESET_DIR' , userpresetdir )
2023-06-12 09:15:19 +08:00
conf . set_quoted ( 'VENDOR_KEYRING_PATH' , libexecdir / 'import-pubring.gpg' )
2021-05-17 01:34:52 +08:00
conf . set ( 'ANSI_OK_COLOR' , 'ANSI_' + get_option ( 'ok-color' ) . underscorify ( ) . to_upper ( ) )
2021-07-11 18:39:33 +08:00
conf . set10 ( 'ENABLE_URLIFY' , get_option ( 'urlify' ) )
2021-05-17 01:34:52 +08:00
conf . set10 ( 'ENABLE_FEXECVE' , get_option ( 'fexecve' ) )
2018-10-17 20:36:09 +08:00
conf . set10 ( 'MEMORY_ACCOUNTING_DEFAULT' , memory_accounting_default )
2019-06-07 01:22:20 +08:00
conf . set ( 'STATUS_UNIT_FORMAT_DEFAULT' , 'STATUS_UNIT_FORMAT_' + status_unit_format_default . to_upper ( ) )
2021-05-16 23:52:42 +08:00
conf . set_quoted ( 'STATUS_UNIT_FORMAT_DEFAULT_STR' , status_unit_format_default )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2021-01-27 03:23:12 +08:00
conf . set ( 'DEFAULT_TIMEOUT_SEC' , get_option ( 'default-timeout-sec' ) )
conf . set ( 'DEFAULT_USER_TIMEOUT_SEC' , get_option ( 'default-user-timeout-sec' ) )
conf . set ( 'UPDATE_HELPER_USER_TIMEOUT_SEC' , get_option ( 'update-helper-user-timeout-sec' ) )
2023-11-08 15:31:13 +08:00
conf . set10 ( 'ENABLE_FIRST_BOOT_FULL_PRESET' , get_option ( 'first-boot-full-preset' ) )
manager: optionally, do a full preset on first boot
A compile time option is added to select behaviour: by default
UNIT_FILE_PRESET_ENABLE_ONLY is still used, but the intent is to change to
UNIT_FILE_PRESET_FULL at some point in the future. Distros that want to
opt-in can use the config option to change the behaviour.
(The option is just a boolean: it would be possible to make it multi-valued,
and allow full, enable-only, disable-only, none. But so far nobody has asked
for this, and it's better not to complicate things needlessly.)
With the configuration option flipped, instead of only doing enablements,
perform a full preset on first boot. The reason is that although
`/etc/machine-id` might be missing, there may be other files provisioned in
`/etc` (in fact, this use case is mentioned in `log_execution_mode`). Some of
those possible files include enablement symlinks even if presets dictate it
should be disabled.
Such a seemingly contradictory situation occurs in {RHEL,Fedora} CoreOS,
where we ship `/etc` as if `preset-all` were called. However, we want to
allow users to disable default-enabled services via Ignition, which does
this by creating preset dropins before switchroot. (For why we do
`preset-all` at compose time, see:
https://github.com/coreos/fedora-coreos-config/pull/77).
For example, the composed FCOS image has a `enable zincati.service`
preset and an enablement for that in `/etc`, while at boot time when we
switch root, there may be a `disable zincati.service` preset with higher
precedence. In that case, we want systemd to disable the service.
This is essentially a revert of 304b3079a203. It seems like systemd
*used* to do this, but it was changed to try to make the container
workflow a bit faster.
Resolves: https://github.com/coreos/fedora-coreos-tracker/issues/392
Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2020-03-24 00:25:19 +08:00
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
#####################################################################
cc = meson . get_compiler ( 'c' )
2023-02-26 18:07:24 +08:00
userspace_c_args = [ ]
userspace_c_ld_args = [ ]
2018-01-19 14:54:30 +08:00
meson_build_sh = find_program ( 'tools/meson-build.sh' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2018-09-12 17:02:58 +08:00
want_tests = get_option ( 'tests' )
slow_tests = want_tests != 'false' and get_option ( 'slow-tests' )
2020-05-21 22:59:40 +08:00
fuzz_tests = want_tests != 'false' and get_option ( 'fuzz-tests' )
2024-04-25 03:17:06 +08:00
integration_tests = want_tests != 'false' and get_option ( 'integration-tests' )
meson: do not attempt to install tests when they are disabled
If -Dtests=false but -Dinstall-tests=true the build will fail, as some tests will
be pulled in the build but not their prerequisites. It doesn't make sense to ask
for tests to be installed if they are disabled.
FAILED: test-acd
cc -o test-acd test-acd.p/src_libsystemd-network_test-acd.c.o -flto -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector -Wl,-z,relro -specs=/usr/share/debhelper/dh_package_notes/debian-package-notes.specs -g -O2 -ffile-prefix-map=/tmp/s=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -ffat-lto-objects -Wdate-time -D_FORTIFY_SOURCE=2 '-Wl,-rpath,$ORIGIN/src/shared:XXXXXXXXXXXXXXX' -Wl,-rpath-link,/tmp/s/obj-x86_64-linux-gnu/src/shared -Wl,--start-group src/shared/libsystemd-shared-255.so src/libsystemd-network/libsystemd-network.a -Wl,--end-group -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections -Wl,--fatal-warnings -Wl,-z,now -Wl,-z,relro -Wl,--warn-common -Wl,--gc-sections
/usr/bin/ld: /tmp/cc0oYwFZ.ltrans0.ltrans.o: in function `main':
./obj-x86_64-linux-gnu/./obj-x86_64-linux-gnu/<artificial>:85:(.text.startup+0x33): undefined reference to `test_setup_logging'
collect2: error: ld returned 1 exit status
2024-02-13 21:43:49 +08:00
install_tests = want_tests != 'false' and get_option ( 'install-tests' )
2018-09-12 17:02:58 +08:00
2022-05-16 02:21:16 +08:00
if add_languages ( 'cpp' , native : false , required : fuzzer_build )
2018-09-12 22:52:08 +08:00
# Used only for tests
2019-11-10 19:16:41 +08:00
cxx = meson . get_compiler ( 'cpp' )
cxx_cmd = ' ' . join ( cxx . cmd_array ( ) )
2018-10-10 00:48:09 +08:00
else
2018-10-10 17:50:57 +08:00
cxx_cmd = ''
2017-05-14 01:23:28 +08:00
endif
2018-01-16 23:25:43 +08:00
if want_libfuzzer
2019-05-09 06:03:41 +08:00
fuzzing_engine = meson . get_compiler ( 'cpp' ) . find_library ( 'Fuzzer' , required : false )
if fuzzing_engine . found ( )
2023-02-26 18:07:24 +08:00
userspace_c_args + = '-fsanitize-coverage=trace-pc-guard,trace-cmp'
2019-05-09 06:03:41 +08:00
elif cc . has_argument ( '-fsanitize=fuzzer-no-link' )
2023-02-26 18:07:24 +08:00
userspace_c_args + = '-fsanitize=fuzzer-no-link'
2019-05-09 06:03:41 +08:00
else
error ( 'Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported' )
endif
2018-10-10 17:56:45 +08:00
elif want_ossfuzz
2018-01-14 08:51:07 +08:00
fuzzing_engine = meson . get_compiler ( 'cpp' ) . find_library ( 'FuzzingEngine' )
endif
2019-11-10 19:16:41 +08:00
# Those generate many false positives, and we do not want to change the code to
# avoid them.
basic_disabled_warnings = [
'-Wno-missing-field-initializers' ,
2021-06-02 14:53:29 +08:00
'-Wno-unused-parameter' ,
2024-01-17 05:25:04 +08:00
'-Wno-nonnull-compare' ,
2019-11-10 19:16:41 +08:00
]
2021-06-02 14:49:44 +08:00
possible_common_cc_flags = [
2023-02-06 03:44:19 +08:00
'-Warray-bounds' , # clang
'-Warray-bounds=2' ,
2021-06-02 14:53:29 +08:00
'-Wdate-time' ,
'-Wendif-labels' ,
'-Werror=format=2' ,
2022-08-30 15:57:53 +08:00
'-Werror=format-signedness' ,
2021-06-02 14:53:29 +08:00
'-Werror=implicit-function-declaration' ,
2023-01-31 23:12:09 +08:00
'-Werror=implicit-int' ,
2021-06-02 14:53:29 +08:00
'-Werror=incompatible-pointer-types' ,
meson: refuse implicit int <-> pointer conversion
Before:
```
Compiling C object src/libsystemd-network/libsystemd-network.a.p/dhcp6-option.c.o
../src/libsystemd-network/dhcp6-option.c: In function ‘dhcp6_option_parse_ia’:
../src/libsystemd-network/dhcp6-option.c:633:70: warning: passing argument 3 of ‘dhcp6_option_parse’ makes pointer from integer without a cast [-Wint-conversion]
633 | r = dhcp6_option_parse(option_data, option_data_len, offset, &subopt, &subdata_len, &subdata);
| ^~~~~~
| |
| size_t {aka long unsigned int}
../src/libsystemd-network/dhcp6-option.c:358:25: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
358 | size_t *offset,
| ~~~~~~~~^~~~~~
```
After:
```
../src/libsystemd-network/dhcp6-option.c: In function ‘dhcp6_option_parse_ia’:
../src/libsystemd-network/dhcp6-option.c:633:70: error: passing argument 3 of ‘dhcp6_option_parse’ makes pointer from integer without a cast [-Werror=int-conversion]
633 | r = dhcp6_option_parse(option_data, option_data_len, offset, &subopt, &subdata_len, &subdata);
| ^~~~~~
| |
| size_t {aka long unsigned int}
../src/libsystemd-network/dhcp6-option.c:358:25: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
358 | size_t *offset,
| ~~~~~~~~^~~~~~
cc1: some warnings being treated as errors
```
2021-09-24 23:16:20 +08:00
'-Werror=int-conversion' ,
2023-03-10 16:57:50 +08:00
'-Werror=missing-declarations' ,
'-Werror=missing-prototypes' ,
2021-06-02 14:53:29 +08:00
'-Werror=overflow' ,
2021-11-26 18:52:04 +08:00
'-Werror=override-init' ,
2021-06-02 14:53:29 +08:00
'-Werror=return-type' ,
'-Werror=shift-count-overflow' ,
'-Werror=shift-overflow=2' ,
2023-05-30 16:30:15 +08:00
'-Werror=strict-flex-arrays' ,
2018-05-10 14:30:42 +08:00
'-Werror=undef' ,
2021-06-02 14:53:29 +08:00
'-Wfloat-equal' ,
2022-05-28 17:41:10 +08:00
# gperf prevents us from enabling this because it does not emit fallthrough
# attribute with clang.
#'-Wimplicit-fallthrough',
2021-06-02 14:53:29 +08:00
'-Wimplicit-fallthrough=5' ,
'-Winit-self' ,
2018-05-10 14:30:42 +08:00
'-Wlogical-op' ,
'-Wmissing-include-dirs' ,
2021-06-02 14:53:29 +08:00
'-Wmissing-noreturn' ,
'-Wnested-externs' ,
2018-05-10 14:30:42 +08:00
'-Wold-style-definition' ,
'-Wpointer-arith' ,
'-Wredundant-decls' ,
'-Wshadow' ,
'-Wstrict-aliasing=2' ,
2021-06-02 14:53:29 +08:00
'-Wstrict-prototypes' ,
'-Wsuggest-attribute=noreturn' ,
2021-11-16 17:52:39 +08:00
'-Wunused-function' ,
2018-05-10 14:30:42 +08:00
'-Wwrite-strings' ,
2023-02-06 16:46:55 +08:00
'-Wzero-length-bounds' ,
2018-09-09 04:55:09 +08:00
# negative arguments are correctly detected starting with meson 0.46.
2019-03-07 17:56:15 +08:00
'-Wno-error=#warnings' , # clang
'-Wno-string-plus-int' , # clang
2023-02-06 03:44:19 +08:00
2023-03-10 16:57:50 +08:00
'-fdiagnostics-show-option' ,
'-fno-common' ,
2023-03-10 16:01:29 +08:00
'-fstack-protector' ,
'-fstack-protector-strong' ,
2023-02-06 03:44:19 +08:00
'-fstrict-flex-arrays' ,
2023-03-10 16:01:29 +08:00
'--param=ssp-buffer-size=4' ,
]
possible_common_link_flags = [
'-fstack-protector' ,
2018-05-10 14:30:42 +08:00
]
2022-04-29 20:35:20 +08:00
c_args = get_option ( 'c_args' )
2022-07-18 04:02:48 +08:00
# Our json library does not support -ffinite-math-only, which is enabled by -Ofast or -ffast-math.
2022-08-09 13:48:14 +08:00
if ( ( '-Ofast' in c_args or '-ffast-math' in c_args or '-ffinite-math-only' in c_args ) and '-fno-finite-math-only' not in c_args )
2022-07-18 04:02:48 +08:00
error ( '-Ofast, -ffast-math, or -ffinite-math-only is specified in c_args.' )
endif
2022-03-07 14:32:22 +08:00
# Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are
meson: re-enable -Wmaybe-uninitialized on -O[02] with recent gcc versions
The warning was disabled in 8794164fed5f0142c34358613f92f4f761af4edd to avoid
false positives. But it is useful in finding errors, even if it sometimes
results in untrue warnings (c.f. 77fac974fe, da46a1bc3c).
After #19168, #19169, and #19175, there are no warnings with
-Dbuildtype=debug-optimized/-O2 and gcc-11.0.1-0.3.fc34.x86_64. Warnings
are reenabled for -O[23]
-O0 is good for development, and -O2 is the default optimization level for
Fedora package builds. -Os, -O3, -O1, and -Og still generate some warnings. In
fact, with -Os the number of warnings seems completely hopeless. Dozens and
dozens.
2021-03-31 23:05:49 +08:00
# too many false positives with gcc >= 8. Effectively, we only test with -O0
# and -O2; this should be enough to catch most important cases without too much
# busywork. See https://github.com/systemd/systemd/pull/19226.
if cc . get_id ( ) == 'gcc' and ( not '02' . contains ( get_option ( 'optimization' ) ) or
2022-04-29 20:35:20 +08:00
cc . version ( ) . version_compare ( '<10' ) or
'-Os' in c_args or
'-O1' in c_args or
'-O3' in c_args or
'-Og' in c_args )
2021-06-02 14:49:44 +08:00
possible_common_cc_flags + = '-Wno-maybe-uninitialized'
meson: re-enable -Wmaybe-uninitialized on -O[02] with recent gcc versions
The warning was disabled in 8794164fed5f0142c34358613f92f4f761af4edd to avoid
false positives. But it is useful in finding errors, even if it sometimes
results in untrue warnings (c.f. 77fac974fe, da46a1bc3c).
After #19168, #19169, and #19175, there are no warnings with
-Dbuildtype=debug-optimized/-O2 and gcc-11.0.1-0.3.fc34.x86_64. Warnings
are reenabled for -O[23]
-O0 is good for development, and -O2 is the default optimization level for
Fedora package builds. -Os, -O3, -O1, and -Og still generate some warnings. In
fact, with -Os the number of warnings seems completely hopeless. Dozens and
dozens.
2021-03-31 23:05:49 +08:00
endif
2021-07-06 21:13:00 +08:00
# Disable -Wno-unused-result with gcc, see
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
if cc . get_id ( ) == 'gcc'
possible_common_cc_flags + = '-Wno-unused-result'
endif
2018-05-10 14:30:42 +08:00
# --as-needed and --no-undefined are provided by meson by default,
2021-07-27 22:16:07 +08:00
# run 'meson configure' to see what is enabled
2018-05-10 14:30:42 +08:00
possible_link_flags = [
2021-11-05 02:03:45 +08:00
'-Wl,--fatal-warnings' ,
2018-05-10 14:30:42 +08:00
'-Wl,-z,now' ,
2021-11-05 02:03:45 +08:00
'-Wl,-z,relro' ,
2018-05-10 14:30:42 +08:00
]
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2021-11-05 02:03:45 +08:00
if get_option ( 'b_sanitize' ) == 'none'
possible_link_flags + = '-Wl,--warn-common'
endif
2018-05-10 14:30:42 +08:00
if cc . get_id ( ) == 'clang'
2021-06-02 14:49:44 +08:00
possible_common_cc_flags + = [
2018-05-10 14:30:42 +08:00
'-Wno-typedef-redefinition' ,
'-Wno-gnu-variable-sized-type-not-at-end' ,
]
endif
2022-05-07 17:31:26 +08:00
if get_option ( 'mode' ) == 'release'
# We could enable 'pattern' for developer mode, but that can interfere with
# valgrind and sanitizer builds. Also, clang does not zero-initialize unions,
# breaking some of our code (https://reviews.llvm.org/D68115).
possible_common_cc_flags + = '-ftrivial-auto-var-init=zero'
endif
2023-02-26 18:07:24 +08:00
possible_cc_flags = [
2021-06-08 08:23:50 +08:00
'-fno-strict-aliasing' ,
2022-11-10 07:56:46 +08:00
'-fstrict-flex-arrays=1' ,
2021-06-08 08:23:50 +08:00
'-fvisibility=hidden' ,
]
2018-05-10 14:30:42 +08:00
if get_option ( 'buildtype' ) != 'debug'
2021-06-08 08:23:50 +08:00
possible_cc_flags + = [
2018-05-10 14:30:42 +08:00
'-ffunction-sections' ,
'-fdata-sections' ,
]
possible_link_flags + = '-Wl,--gc-sections'
endif
2022-06-09 04:32:49 +08:00
if get_option ( 'mode' ) == 'developer'
possible_cc_flags + = '-fno-omit-frame-pointer'
endif
2023-02-26 18:07:24 +08:00
add_project_arguments (
cc . get_supported_arguments (
basic_disabled_warnings ,
possible_common_cc_flags
) ,
language : 'c' )
2023-03-10 16:01:29 +08:00
add_project_link_arguments (
cc . get_supported_link_arguments ( possible_common_link_flags ) ,
language : 'c' )
2023-02-26 18:07:24 +08:00
userspace_c_args + = cc . get_supported_arguments ( possible_cc_flags )
userspace_c_ld_args + = cc . get_supported_link_arguments ( possible_link_flags )
2018-05-10 14:30:42 +08:00
2020-05-09 15:09:11 +08:00
have = cc . has_argument ( '-Wzero-length-bounds' )
conf . set10 ( 'HAVE_ZERO_LENGTH_BOUNDS' , have )
2018-02-19 17:37:19 +08:00
if cc . compiles ( '' '
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
#include <time.h>
#include <inttypes.h>
typedef uint64_t usec_t ;
usec_t now ( clockid_t clock ) ;
int main ( void ) {
struct timespec now ;
return 0 ;
}
2018-11-29 20:22:08 +08:00
'' ', args: ' - Werror = shadow ', name : ' - Werror = shadow with local shadowing ' )
2017-04-18 07:25:00 +08:00
add_project_arguments ( '-Werror=shadow' , language : 'c' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2019-11-10 19:16:41 +08:00
if cxx_cmd != ''
add_project_arguments ( cxx . get_supported_arguments ( basic_disabled_warnings ) , language : 'cpp' )
endif
2023-10-12 02:32:49 +08:00
cpp = ' ' . join ( cc . cmd_array ( ) + get_option ( 'c_args' ) ) + ' -E'
2017-04-11 22:25:34 +08:00
2019-05-07 21:10:58 +08:00
has_wstringop_truncation = cc . has_argument ( '-Wstringop-truncation' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
#####################################################################
# compilation result tests
meson: define _GNU_SOURCE as '1'
This changes the generated config.h file thusly:
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1
Canonically, _GNU_SOURCE is just defined, without any value, but g++ defines
_GNU_SOURCE implicitly [1]. This causes a warning about a redefinition during
complilation of C++ programs after '-include config.h'. Our config attempts to
inject this (and a bunch of other arguments) into all compliations. But before
meson 0.54, flags for dependencies were not propagated correctly (*), and the C++
compilation was done without various flags (**). Once that was fixed, we started
getting a warning.
[1] http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.predefined
(*) Actually, the changelog doesn't say anything. But it mentions various work
related to dependency propagation, and apparently this changes as a side
effect.
(**) -fno-strict-aliasing
-fstrict-flex-arrays=1
-fvisibility=hidden
-fno-omit-frame-pointer
-include config.h
This could be solved in various ways, but it'd require either making the
compilation command line longer, which we want to avoid for readability of the
build logs, or splitting the logic to define the args for C++ progs separately,
which would make our meson.build files more complicated. Changing the
definition to '1' also solves the issue (because apparently now we match the
implicit definition), and shouldn't have other effects. I checked compilation
with gcc and clang. Maybe on other systems this could cause problems. We can
revisit if people report issues.
2023-06-12 16:45:48 +08:00
conf . set ( '_GNU_SOURCE' , 1 )
2017-04-28 09:13:08 +08:00
conf . set ( '__SANE_USERSPACE_TYPES__' , true )
2019-05-07 21:10:58 +08:00
conf . set10 ( 'HAVE_WSTRINGOP_TRUNCATION' , has_wstringop_truncation )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
conf . set ( 'SIZEOF_DEV_T' , cc . sizeof ( 'dev_t' , prefix : '#include <sys/types.h>' ) )
conf . set ( 'SIZEOF_INO_T' , cc . sizeof ( 'ino_t' , prefix : '#include <sys/types.h>' ) )
conf . set ( 'SIZEOF_RLIM_T' , cc . sizeof ( 'rlim_t' , prefix : '#include <sys/resource.h>' ) )
2023-06-01 07:18:15 +08:00
conf . set ( 'SIZEOF_TIME_T' , cc . sizeof ( 'time_t' , prefix : '#include <sys/time.h>' ) )
2021-12-21 19:10:09 +08:00
conf . set ( 'SIZEOF_TIMEX_MEMBER' , cc . sizeof ( 'typeof(((struct timex *)0)->freq)' , prefix : '#include <sys/timex.h>' ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2022-12-18 00:00:56 +08:00
long_max = cc . compute_int (
'LONG_MAX' ,
prefix : '#include <limits.h>' ,
guess : 0x7FFFFFFFFFFFFFFF ,
high : 0x7FFFFFFFFFFFFFFF )
2022-12-03 18:55:55 +08:00
assert ( long_max > 100000 )
conf . set_quoted ( 'LONG_MAX_STR' , '@0@' . format ( long_max ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
decl_headers = '' '
2023-05-10 08:47:13 +08:00
#include <dirent.h>
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
#include <uchar.h>
2021-04-27 20:16:06 +08:00
#include <sys/mount.h>
2018-02-20 19:48:33 +08:00
#include <sys/stat.h>
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
'' '
foreach decl : [ 'char16_t' ,
'char32_t' ,
2021-04-27 20:16:06 +08:00
'struct mount_attr' ,
2018-02-20 19:48:33 +08:00
'struct statx' ,
2023-05-10 08:47:13 +08:00
'struct dirent64' ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
]
2017-04-28 09:13:08 +08:00
# We get -1 if the size cannot be determined
2018-07-18 23:26:17 +08:00
have = cc . sizeof ( decl , prefix : decl_headers , args : '-D_GNU_SOURCE' ) > 0
2022-07-23 18:38:49 +08:00
if decl == 'struct mount_attr'
if have
want_linux_fs_h = false
else
have = cc . sizeof ( decl ,
prefix : decl_headers + '#include <linux/fs.h>' ,
args : '-D_GNU_SOURCE' ) > 0
want_linux_fs_h = have
endif
endif
2018-07-18 23:26:17 +08:00
if decl == 'struct statx'
if have
want_linux_stat_h = false
else
have = cc . sizeof ( decl ,
prefix : decl_headers + '#include <linux/stat.h>' ,
args : '-D_GNU_SOURCE' ) > 0
want_linux_stat_h = have
endif
endif
2017-10-03 16:41:51 +08:00
conf . set10 ( 'HAVE_' + decl . underscorify ( ) . to_upper ( ) , have )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endforeach
2018-07-18 23:26:17 +08:00
conf . set10 ( 'WANT_LINUX_STAT_H' , want_linux_stat_h )
2022-07-23 18:38:49 +08:00
conf . set10 ( 'WANT_LINUX_FS_H' , want_linux_fs_h )
build-sys: Detect whether struct statx is defined in sys/stat.h
Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
definition for struct statx, in which case include file linux/stat.h should be
avoided, in order to prevent a duplicate definition.
In file included from ../src/basic/missing.h:18,
from ../src/basic/util.h:28,
from ../src/basic/hashmap.h:10,
from ../src/shared/bus-util.h:12,
from ../src/libsystemd/sd-bus/bus-creds.c:11:
/usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
struct statx {
^~~~~
In file included from /usr/include/sys/stat.h:446,
from ../src/basic/util.h:19,
from ../src/basic/hashmap.h:10,
from ../src/shared/bus-util.h:12,
from ../src/libsystemd/sd-bus/bus-creds.c:11:
/usr/include/bits/statx.h:36:8: note: originally defined here
struct statx
^~~~~
Extend our meson.build to look for struct statx when only sys/stat.h is
included and, in that case, do not include linux/stat.h anymore.
Tested that systemd builds correctly when using a glibc version that includes a
definition for struct statx.
glibc Fedora RPM update:
https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae
glibc upstream commit:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
2018-07-16 13:43:35 +08:00
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
foreach ident : [ 'secure_getenv' , '__secure_getenv' ]
2017-10-03 16:41:51 +08:00
conf . set10 ( 'HAVE_' + ident . to_upper ( ) , cc . has_function ( ident ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endforeach
foreach ident : [
2017-12-25 19:01:14 +08:00
[ 'memfd_create' , '''#include <sys/mman.h>''' ] ,
2017-12-25 19:35:28 +08:00
[ 'gettid' , '' ' #include <sys/types.h>
#include <unistd.h>'''],
2023-10-20 19:22:50 +08:00
[ 'fchmodat2' , '' ' #include <stdlib.h>
#include <fcntl.h>'''], # no known header declares fchmodat2
2017-12-25 19:07:40 +08:00
[ 'pivot_root' , '' ' #include <stdlib.h>
#include <unistd.h>'''], # no known header declares pivot_root
2021-09-14 22:27:32 +08:00
[ 'ioprio_get' , '''#include <sched.h>''' ] , # no known header declares ioprio_get
[ 'ioprio_set' , '''#include <sched.h>''' ] , # no known header declares ioprio_set
2017-12-25 19:01:14 +08:00
[ 'name_to_handle_at' , '' ' #include <sys/types.h>
2017-04-18 07:25:00 +08:00
#include <sys/stat.h>
#include <fcntl.h>'''],
2017-12-25 19:01:14 +08:00
[ 'setns' , '''#include <sched.h>''' ] ,
2017-12-25 19:35:43 +08:00
[ 'renameat2' , '' ' #include <stdio.h>
#include <fcntl.h>'''],
2017-04-18 07:25:00 +08:00
[ 'kcmp' , '''#include <linux/kcmp.h>''' ] ,
[ 'keyctl' , '' ' #include <sys/types.h>
#include <keyutils.h>'''],
2017-12-25 19:01:14 +08:00
[ 'copy_file_range' , '' ' #include <sys/syscall.h>
2017-04-18 07:25:00 +08:00
#include <unistd.h>'''],
2016-10-18 23:57:10 +08:00
[ 'bpf' , '' ' #include <sys/syscall.h>
#include <unistd.h>'''],
2018-02-20 19:48:33 +08:00
[ 'statx' , '' ' #include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>'''],
2018-02-27 04:20:00 +08:00
[ 'explicit_bzero' , '''#include <string.h>''' ] ,
2020-12-13 08:15:57 +08:00
[ 'reallocarray' , '''#include <stdlib.h>''' ] ,
2019-03-13 01:58:26 +08:00
[ 'set_mempolicy' , '' ' #include <stdlib.h>
#include <unistd.h>'''],
[ 'get_mempolicy' , '' ' #include <stdlib.h>
#include <unistd.h>'''],
2019-10-25 22:06:06 +08:00
[ 'pidfd_send_signal' , '' ' #include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>'''],
[ 'pidfd_open' , '' ' #include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>'''],
2019-10-30 23:29:42 +08:00
[ 'rt_sigqueueinfo' , '' ' #include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>'''],
2022-11-16 22:03:11 +08:00
[ 'rt_tgsigqueueinfo' , '' ' #include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>'''],
2020-10-09 22:48:03 +08:00
[ 'mallinfo' , '''#include <malloc.h>''' ] ,
2021-05-04 02:36:32 +08:00
[ 'mallinfo2' , '''#include <malloc.h>''' ] ,
shared/exec-util: use our own execveat() wrapper instead of fexecve()
For scripts, when we call fexecve(), on new kernels glibc calls execveat(),
which fails with ENOENT, and then we fall back to execve() which succeeds:
[pid 63039] execveat(3, "", ["/home/zbyszek/src/systemd/test/test-path-util/script.sh", "--version"], 0x7ffefa3633f0 /* 0 vars */, AT_EMPTY_PATH) = -1 ENOENT (No such file or directory)
[pid 63039] execve("/home/zbyszek/src/systemd/test/test-path-util/script.sh", ["/home/zbyszek/src/systemd/test/test-path-util/script.sh", "--version"], 0x7ffefa3633f0 /* 0 vars */) = 0
But on older kernels glibc (some versions?) implement a fallback which falls
into the same trap with bash $0:
[pid 13534] execve("/proc/self/fd/3", ["/home/test/systemd/test/test-path-util/script.sh", "--version"], 0x7fff84995870 /* 0 vars */) = 0
We don't want that, so let's call execveat() ourselves. Then we can do the
execve() fallback as we want.
2020-09-23 22:23:30 +08:00
[ 'execveat' , '''#include <unistd.h>''' ] ,
2020-10-13 23:53:25 +08:00
[ 'close_range' , '''#include <unistd.h>''' ] ,
2021-02-25 23:56:07 +08:00
[ 'epoll_pwait2' , '''#include <sys/epoll.h>''' ] ,
2021-04-27 20:16:06 +08:00
[ 'mount_setattr' , '''#include <sys/mount.h>''' ] ,
[ 'move_mount' , '''#include <sys/mount.h>''' ] ,
[ 'open_tree' , '''#include <sys/mount.h>''' ] ,
2022-10-27 19:14:12 +08:00
[ 'fsopen' , '''#include <sys/mount.h>''' ] ,
[ 'fsconfig' , '''#include <sys/mount.h>''' ] ,
2023-03-07 21:36:03 +08:00
[ 'fsmount' , '''#include <sys/mount.h>''' ] ,
2021-10-08 16:46:02 +08:00
[ 'getdents64' , '''#include <dirent.h>''' ] ,
2024-01-13 05:32:20 +08:00
[ 'pidfd_spawn' , '''#include <spawn.h>''' ] ,
2017-04-18 07:25:00 +08:00
]
2017-12-25 19:01:14 +08:00
have = cc . has_function ( ident [ 0 ] , prefix : ident [ 1 ] , args : '-D_GNU_SOURCE' )
2017-10-03 16:32:34 +08:00
conf . set10 ( 'HAVE_' + ident [ 0 ] . to_upper ( ) , have )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endforeach
2017-12-25 19:01:14 +08:00
if cc . has_function ( 'getrandom' , prefix : '''#include <sys/random.h>''' , args : '-D_GNU_SOURCE' )
2017-10-03 16:41:51 +08:00
conf . set10 ( 'USE_SYS_RANDOM_H' , true )
2017-10-03 16:32:34 +08:00
conf . set10 ( 'HAVE_GETRANDOM' , true )
2017-04-20 09:20:54 +08:00
else
have = cc . has_function ( 'getrandom' , prefix : '''#include <linux/random.h>''' )
2017-10-03 16:41:51 +08:00
conf . set10 ( 'USE_SYS_RANDOM_H' , false )
2017-10-03 16:32:34 +08:00
conf . set10 ( 'HAVE_GETRANDOM' , have )
2017-04-20 09:20:54 +08:00
endif
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
#####################################################################
2021-05-14 20:16:17 +08:00
sh = find_program ( 'sh' )
echo = find_program ( 'echo' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
sed = find_program ( 'sed' )
awk = find_program ( 'awk' )
stat = find_program ( 'stat' )
2021-05-14 20:16:17 +08:00
ln = find_program ( 'ln' )
2017-04-07 02:33:27 +08:00
git = find_program ( 'git' , required : false )
2018-01-19 14:54:30 +08:00
env = find_program ( 'env' )
2021-05-14 20:16:17 +08:00
rsync = find_program ( 'rsync' , required : false )
2023-04-27 22:37:39 +08:00
diff = find_program ( 'diff' )
2023-05-01 16:25:18 +08:00
find = find_program ( 'find' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-08 09:38:47 +08:00
ln_s = ln . full_path ( ) + ' -frsT -- "${DESTDIR:-}@0@" "${DESTDIR:-}@1@"'
2017-04-10 11:55:05 +08:00
2021-07-27 22:16:07 +08:00
# If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
# /usr/sbin, /sbin, and fall back to the default from middle column.
2018-01-04 20:14:20 +08:00
progs = [ [ 'quotaon' , '/usr/sbin/quotaon' ] ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
[ 'quotacheck' , '/usr/sbin/quotacheck' ] ,
[ 'kmod' , '/usr/bin/kmod' ] ,
[ 'kexec' , '/usr/sbin/kexec' ] ,
[ 'sulogin' , '/usr/sbin/sulogin' ] ,
[ 'mount' , '/usr/bin/mount' , 'MOUNT_PATH' ] ,
[ 'umount' , '/usr/bin/umount' , 'UMOUNT_PATH' ] ,
[ 'loadkeys' , '/usr/bin/loadkeys' , 'KBD_LOADKEYS' ] ,
[ 'setfont' , '/usr/bin/setfont' , 'KBD_SETFONT' ] ,
2019-07-18 07:24:00 +08:00
[ 'nologin' , '/usr/sbin/nologin' , ] ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
]
foreach prog : progs
2017-04-18 07:25:00 +08:00
path = get_option ( prog [ 0 ] + '-path' )
if path != ''
message ( 'Using @1@ for @0@' . format ( prog [ 0 ] , path ) )
else
exe = find_program ( prog [ 0 ] ,
'/usr/sbin/' + prog [ 0 ] ,
'/sbin/' + prog [ 0 ] ,
required : false )
2022-05-16 02:22:33 +08:00
path = exe . found ( ) ? exe . full_path ( ) : prog [ 1 ]
2017-04-18 07:25:00 +08:00
endif
name = prog . length ( ) > 2 ? prog [ 2 ] : prog [ 0 ] . to_upper ( )
conf . set_quoted ( name , path )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endforeach
2021-11-17 20:58:53 +08:00
if run_command ( ln , '--relative' , '--help' , check : false ) . returncode ( ) != 0
2018-03-09 15:56:23 +08:00
error ( 'ln does not support --relative (added in coreutils 8.16)' )
2017-04-19 07:11:54 +08:00
endif
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-12-15 05:35:00 +08:00
#####################################################################
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
gperf = find_program ( 'gperf' )
gperf_test_format = '' '
#include <string.h>
const char * in_word_set ( const char * , @ 0 @ ) ;
@ 1 @
'' '
2022-05-15 23:11:24 +08:00
gperf_snippet = run_command ( sh , '-c' , 'echo foo,bar | "$1" -L ANSI-C' , '_' , gperf ,
2021-11-17 20:58:53 +08:00
check : true )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
gperf_test = gperf_test_format . format ( 'size_t' , gperf_snippet . stdout ( ) )
if cc . compiles ( gperf_test )
2017-04-18 07:25:00 +08:00
gperf_len_type = 'size_t'
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
else
2017-04-18 07:25:00 +08:00
gperf_test = gperf_test_format . format ( 'unsigned' , gperf_snippet . stdout ( ) )
if cc . compiles ( gperf_test )
gperf_len_type = 'unsigned'
else
error ( 'unable to determine gperf len type' )
endif
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
message ( 'gperf len type is @0@' . format ( gperf_len_type ) )
2017-04-18 07:25:00 +08:00
conf . set ( 'GPERF_LEN_TYPE' , gperf_len_type ,
description : 'The type of gperf "len" parameter' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-12-15 05:35:00 +08:00
#####################################################################
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
if not cc . has_header ( 'sys/capability.h' )
2017-04-18 07:25:00 +08:00
error ( 'POSIX caps headers not found' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2018-01-25 22:30:15 +08:00
foreach header : [ 'crypt.h' ,
2024-03-20 18:51:08 +08:00
'linux/ioprio.h' ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
'linux/memfd.h' ,
2024-03-20 18:51:08 +08:00
'linux/time_types.h' ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
'linux/vm_sockets.h' ,
2017-10-03 18:09:40 +08:00
'sys/auxv.h' ,
2024-03-20 18:51:08 +08:00
'sys/sdt.h' ,
2023-01-04 01:52:08 +08:00
'threads.h' ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
'valgrind/memcheck.h' ,
'valgrind/valgrind.h' ,
]
2017-04-28 09:13:08 +08:00
2017-10-03 16:41:51 +08:00
conf . set10 ( 'HAVE_' + header . underscorify ( ) . to_upper ( ) ,
cc . has_header ( header ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endforeach
2023-12-15 05:35:00 +08:00
#####################################################################
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2020-05-07 23:30:02 +08:00
fallback_hostname = get_option ( 'fallback-hostname' )
if fallback_hostname == '' or fallback_hostname [ 0 ] == '.' or fallback_hostname [ 0 ] == '-'
error ( 'Invalid fallback-hostname configuration' )
# A more extensive test is done in test-hostname-util. Let's catch
# the most obvious errors here so we don't fail with an assert later.
endif
conf . set_quoted ( 'FALLBACK_HOSTNAME' , fallback_hostname )
meson: allow extra net naming schemes to be defined during configuration
In upstream, we have a linearly-growing list of net-naming-scheme defines;
we add a new one for every release where we make user-visible changes to the
naming scheme.
But the general idea was that downstream distributions could define their
own combinations (or even just their own names for existing combinations),
so provide stability for their users. So far this required patching of the
netif-naming-scheme.c and .h files to add the new lines.
With this patch, patching is not required:
$ meson configure build \
-Dextra-net-naming-schemes=gargoyle=v238+npar_ari+allow_rerenames,gargoyle2=gargoyle+nspawn_long_hash \
-Ddefault-net-naming-scheme=gargoyle2
or even
$ meson configure build \
-Dextra-net-naming-schemes=gargoyle=v238+npar_ari+allow_rerenames,gargoyle2=gargoyle+nspawn_long_hash,latest=v249 \
-Ddefault-net-naming-scheme=gargoyle2
The syntax is a comma-separated list of NAME=name+name+…
This syntax is a bit scary, but any typos result in compilation errors,
so I think it should be OK in practice.
With this approach, we don't allow users to define arbitrary combinations:
what is allowed is still defined at compilation time, so it's up to the
distribution maintainers to provide reasonable combinations. In this regard,
the only difference from status quo is that it's much easier to do (and harder
to do incorrectly, for example by forgetting to add a name to one of the
maps).
2021-09-28 16:12:36 +08:00
extra_net_naming_schemes = [ ]
extra_net_naming_map = [ ]
foreach scheme : get_option ( 'extra-net-naming-schemes' ) . split ( ',' )
if scheme != ''
name = scheme . split ( '=' ) [ 0 ]
value = scheme . split ( '=' ) [ 1 ]
NAME = name . underscorify ( ) . to_upper ( )
VALUE = [ ]
foreach field : value . split ( '+' )
VALUE + = 'NAMING_' + field . underscorify ( ) . to_upper ( )
endforeach
extra_net_naming_schemes + = 'NAMING_@0@ = @1@,' . format ( NAME , '|' . join ( VALUE ) )
extra_net_naming_map + = '{ "@0@", NAMING_@1@ },' . format ( name , NAME )
endif
endforeach
conf . set ( 'EXTRA_NET_NAMING_SCHEMES' , ' ' . join ( extra_net_naming_schemes ) )
conf . set ( 'EXTRA_NET_NAMING_MAP' , ' ' . join ( extra_net_naming_map ) )
meson: make net.naming-scheme= default configurable
This is useful for distributions, where the stability of interface names should
be preseved after an upgrade of systemd. So when some specific release of the
distro is made available, systemd defaults to the latest & greatest naming
scheme, and subsequent updates set the same default. This default may still
be overriden through the kernel and env var options.
A special value "latest" is also allowed. Without a specific name, it is harder
to verride from meson. In case of 'combo' options, meson reads the default
during the initial configuration, and "remembers" this choice. When systemd is
updated, old build/ directories could keep the old default, which would be
annoying. Hence, "latest" is introduced to make it explicit, yet follow the
upstream. This is actually useful for the user too, because it may be used
as an override, without having to actually specify a version.
2018-12-12 06:28:29 +08:00
default_net_naming_scheme = get_option ( 'default-net-naming-scheme' )
2023-10-16 18:53:10 +08:00
conf . set_quoted ( 'DEFAULT_NET_NAMING_SCHEME' , default_net_naming_scheme ,
description : 'Default naming scheme as a string' )
2021-09-28 15:33:30 +08:00
if default_net_naming_scheme != 'latest'
2023-10-16 18:53:10 +08:00
conf . set ( '_DEFAULT_NET_NAMING_SCHEME' ,
'NAMING_' + default_net_naming_scheme . underscorify ( ) . to_upper ( ) ,
description : 'Default naming scheme as a constant' )
2021-09-28 15:33:30 +08:00
endif
meson: make net.naming-scheme= default configurable
This is useful for distributions, where the stability of interface names should
be preseved after an upgrade of systemd. So when some specific release of the
distro is made available, systemd defaults to the latest & greatest naming
scheme, and subsequent updates set the same default. This default may still
be overriden through the kernel and env var options.
A special value "latest" is also allowed. Without a specific name, it is harder
to verride from meson. In case of 'combo' options, meson reads the default
during the initial configuration, and "remembers" this choice. When systemd is
updated, old build/ directories could keep the old default, which would be
annoying. Hence, "latest" is introduced to make it explicit, yet follow the
upstream. This is actually useful for the user too, because it may be used
as an override, without having to actually specify a version.
2018-12-12 06:28:29 +08:00
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
time_epoch = get_option ( 'time-epoch' )
2022-07-30 12:44:11 +08:00
if time_epoch < = 0
2021-11-17 20:58:53 +08:00
time_epoch = run_command ( sh , '-c' , 'echo "$SOURCE_DATE_EPOCH"' , check : true ) . stdout ( ) . strip ( )
2023-03-02 05:54:06 +08:00
if time_epoch == '' and git . found ( ) and fs . is_dir ( '.git' )
2020-07-21 03:41:48 +08:00
# If we're in a git repository, use the creation time of the latest git tag.
2021-11-17 20:58:53 +08:00
latest_tag = run_command ( git , 'describe' , '--abbrev=0' , '--tags' ,
check : false )
if latest_tag . returncode ( ) == 0
time_epoch = run_command (
git , 'log' , '--no-show-signature' , '-1' , '--format=%at' ,
latest_tag . stdout ( ) . strip ( ) ,
check : false ) . stdout ( )
endif
2020-07-23 18:23:58 +08:00
endif
if time_epoch == ''
2020-05-16 02:16:05 +08:00
NEWS = files ( 'NEWS' )
2021-11-17 20:58:53 +08:00
time_epoch = run_command ( stat , '-c' , '%Y' , NEWS ,
check : true ) . stdout ( )
2020-05-16 02:16:05 +08:00
endif
2022-07-27 09:13:55 +08:00
time_epoch = time_epoch . strip ( ) . to_int ( )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
conf . set ( 'TIME_EPOCH' , time_epoch )
2021-07-28 17:13:31 +08:00
conf . set ( 'CLOCK_VALID_RANGE_USEC_MAX' , get_option ( 'clock-valid-range-usec-max' ) )
2022-03-25 00:15:39 +08:00
default_user_shell = get_option ( 'default-user-shell' )
conf . set_quoted ( 'DEFAULT_USER_SHELL' , default_user_shell )
conf . set_quoted ( 'DEFAULT_USER_SHELL_NAME' , fs . name ( default_user_shell ) )
2020-09-25 22:50:45 +08:00
foreach tuple : [ [ 'system-alloc-uid-min' , 'SYS_UID_MIN' , 1 ] , # Also see login.defs(5).
[ 'system-uid-max' , 'SYS_UID_MAX' , 999 ] ,
[ 'system-alloc-gid-min' , 'SYS_GID_MIN' , 1 ] ,
[ 'system-gid-max' , 'SYS_GID_MAX' , 999 ] ]
v = get_option ( tuple [ 0 ] )
2022-07-30 12:44:11 +08:00
if v < = 0
2020-09-25 22:50:45 +08:00
v = run_command (
awk ,
'/^\s*@0@\s+/ { uid=$2 } END { print uid }' . format ( tuple [ 1 ] ) ,
2021-11-17 20:58:53 +08:00
'/etc/login.defs' ,
check : false ) . stdout ( ) . strip ( )
2020-09-25 22:50:45 +08:00
if v == ''
v = tuple [ 2 ]
else
v = v . to_int ( )
endif
2018-02-19 10:33:16 +08:00
endif
2020-09-25 22:50:45 +08:00
conf . set ( tuple [ 0 ] . underscorify ( ) . to_upper ( ) , v )
endforeach
if conf . get ( 'SYSTEM_ALLOC_UID_MIN' ) > = conf . get ( 'SYSTEM_UID_MAX' )
error ( 'Invalid uid allocation range' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2020-09-25 22:50:45 +08:00
if conf . get ( 'SYSTEM_ALLOC_GID_MIN' ) > = conf . get ( 'SYSTEM_GID_MAX' )
error ( 'Invalid gid allocation range' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2018-05-10 15:04:16 +08:00
dynamic_uid_min = get_option ( 'dynamic-uid-min' )
dynamic_uid_max = get_option ( 'dynamic-uid-max' )
2017-12-02 19:48:31 +08:00
conf . set ( 'DYNAMIC_UID_MIN' , dynamic_uid_min )
conf . set ( 'DYNAMIC_UID_MAX' , dynamic_uid_max )
2018-05-10 15:04:16 +08:00
container_uid_base_min = get_option ( 'container-uid-base-min' )
container_uid_base_max = get_option ( 'container-uid-base-max' )
2017-12-02 19:48:31 +08:00
conf . set ( 'CONTAINER_UID_BASE_MIN' , container_uid_base_min )
conf . set ( 'CONTAINER_UID_BASE_MAX' , container_uid_base_max )
2017-12-05 18:00:24 +08:00
nobody_user = get_option ( 'nobody-user' )
nobody_group = get_option ( 'nobody-group' )
2018-07-23 14:53:09 +08:00
if not meson . is_cross_build ( )
2021-11-17 20:58:53 +08:00
getent_result = run_command ( 'getent' , 'passwd' , '65534' , check : false )
2018-07-23 14:53:09 +08:00
if getent_result . returncode ( ) == 0
name = getent_result . stdout ( ) . split ( ':' ) [ 0 ]
if name != nobody_user
warning ( '\n' +
'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n' . format ( nobody_user , name ) +
'Your build will result in an user table setup that is incompatible with the local system.' )
endif
2017-12-05 18:00:24 +08:00
endif
2021-11-17 20:58:53 +08:00
id_result = run_command ( 'id' , '-u' , nobody_user , check : false )
2018-07-23 14:53:09 +08:00
if id_result . returncode ( ) == 0
2022-07-27 09:13:55 +08:00
id = id_result . stdout ( ) . strip ( ) . to_int ( )
2018-07-23 14:53:09 +08:00
if id != 65534
warning ( '\n' +
'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n' . format ( nobody_user , id ) +
'Your build will result in an user table setup that is incompatible with the local system.' )
endif
2017-12-05 18:00:24 +08:00
endif
2021-11-17 20:58:53 +08:00
getent_result = run_command ( 'getent' , 'group' , '65534' , check : false )
2018-07-23 14:53:09 +08:00
if getent_result . returncode ( ) == 0
name = getent_result . stdout ( ) . split ( ':' ) [ 0 ]
if name != nobody_group
warning ( '\n' +
'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n' . format ( nobody_group , name ) +
'Your build will result in an group table setup that is incompatible with the local system.' )
endif
2017-12-05 18:00:24 +08:00
endif
2021-11-17 20:58:53 +08:00
id_result = run_command ( 'id' , '-g' , nobody_group , check : false )
2018-07-23 14:53:09 +08:00
if id_result . returncode ( ) == 0
2022-07-27 09:13:55 +08:00
id = id_result . stdout ( ) . strip ( ) . to_int ( )
2018-07-23 14:53:09 +08:00
if id != 65534
warning ( '\n' +
2021-04-15 07:01:53 +08:00
'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n' . format ( nobody_group , id ) +
2018-07-23 14:53:09 +08:00
'Your build will result in an group table setup that is incompatible with the local system.' )
endif
2017-12-05 18:00:24 +08:00
endif
endif
2017-12-07 16:19:11 +08:00
if nobody_user != nobody_group and not ( nobody_user == 'nobody' and nobody_group == 'nogroup' )
2018-05-10 13:50:52 +08:00
warning ( '\n' +
2023-10-16 22:47:41 +08:00
'The configured user name "@0@" and group name "@1@" of the nobody user/group are not equivalent.\n' . format ( nobody_user , nobody_group ) +
2018-05-10 13:50:52 +08:00
'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.' )
2017-12-07 16:19:11 +08:00
endif
2017-12-05 18:00:24 +08:00
conf . set_quoted ( 'NOBODY_USER_NAME' , nobody_user )
conf . set_quoted ( 'NOBODY_GROUP_NAME' , nobody_group )
2017-12-02 19:48:31 +08:00
meson: allow "soft-static" allocations for uids and gids in the initrd
The general idea with users and groups created through sysusers is that an
appropriate number is picked when the allocation is made. The number that is
selected will be different on each system based on the order of creation of
users, installed packages, etc. Since system users and groups are not shared
between installations, this generally is not an issue. But it becomes a problem
for initrd: some file systems are shared between the initrd and the host (/run
and /dev are probably the only ones that matter). If the allocations are
different in the host and the initrd, and files survive switch-root, they will
have wrong ownership.
This makes the gids build-time-configurable for all groups and users where
state may survive the switch from initrd to the host.
In particular, all "hardware access" groups are like this: files in /dev will
be owned by them. Eventually the new udev would change ownership, but there
would be a momemnt where the files were owned by the wrong group. The
allocations are "soft-static" in the language of Fedora packaging guidelines:
the uid/gid will be used if possible, but we'll fall back to a different
one. TTY_GID is the exception, because the number is used directly.
Similarly, the possibility to configure "soft-static" uids is added for daemons
which may usefully run in the initramfs: systemd-network (lease information and
interface state is serialized to /run), systemd-resolve (stub files and
interface state), systemd-timesync (/run/systemd/timesync).
Journal files are owned by the group systemd-journal, and acls are granted
for wheel and adm.
systemd-oom and systemd-coredump are excluded from this patch: I assume that
oomd is not useful in the initrd, and coredump leaves no state (it only creates
a pipe in /run?).
The defaults are not changed: if nothing is configured, dynamic allocation will
be used. I looked at a Debian system, and the numbers are all different than
on Fedora.
For Fedora, see the list of uids and gids at https://pagure.io/setup/blob/master/f/uidgid.
In particular, systemd-network and systemd-resolve got soft-static numbers to
make it easy to transition from a non-host-specific initrd to a host system
already a few years back (https://bugzilla.redhat.com/show_bug.cgi?id=1102002).
I also requested static allocations for sgx, input, render in
https://pagure.io/packaging-committee/issue/1078,
https://pagure.io/setup/pull-request/27.
2021-05-24 04:00:22 +08:00
static_ugids = [ ]
foreach option : [ 'adm-gid' ,
'audio-gid' ,
'cdrom-gid' ,
'dialout-gid' ,
'disk-gid' ,
'input-gid' ,
'kmem-gid' ,
'kvm-gid' ,
'lp-gid' ,
'render-gid' ,
'sgx-gid' ,
'tape-gid' ,
'tty-gid' ,
'users-gid' ,
'utmp-gid' ,
'video-gid' ,
'wheel-gid' ,
'systemd-journal-gid' ,
'systemd-network-uid' ,
'systemd-resolve-uid' ,
'systemd-timesync-uid' ]
name = option . underscorify ( ) . to_upper ( )
val = get_option ( option )
# Ensure provided GID argument is numeric, otherwise fall back to default assignment
2022-07-30 12:44:11 +08:00
conf . set ( name , val > 0 ? val : '-' )
if val > 0
meson: allow "soft-static" allocations for uids and gids in the initrd
The general idea with users and groups created through sysusers is that an
appropriate number is picked when the allocation is made. The number that is
selected will be different on each system based on the order of creation of
users, installed packages, etc. Since system users and groups are not shared
between installations, this generally is not an issue. But it becomes a problem
for initrd: some file systems are shared between the initrd and the host (/run
and /dev are probably the only ones that matter). If the allocations are
different in the host and the initrd, and files survive switch-root, they will
have wrong ownership.
This makes the gids build-time-configurable for all groups and users where
state may survive the switch from initrd to the host.
In particular, all "hardware access" groups are like this: files in /dev will
be owned by them. Eventually the new udev would change ownership, but there
would be a momemnt where the files were owned by the wrong group. The
allocations are "soft-static" in the language of Fedora packaging guidelines:
the uid/gid will be used if possible, but we'll fall back to a different
one. TTY_GID is the exception, because the number is used directly.
Similarly, the possibility to configure "soft-static" uids is added for daemons
which may usefully run in the initramfs: systemd-network (lease information and
interface state is serialized to /run), systemd-resolve (stub files and
interface state), systemd-timesync (/run/systemd/timesync).
Journal files are owned by the group systemd-journal, and acls are granted
for wheel and adm.
systemd-oom and systemd-coredump are excluded from this patch: I assume that
oomd is not useful in the initrd, and coredump leaves no state (it only creates
a pipe in /run?).
The defaults are not changed: if nothing is configured, dynamic allocation will
be used. I looked at a Debian system, and the numbers are all different than
on Fedora.
For Fedora, see the list of uids and gids at https://pagure.io/setup/blob/master/f/uidgid.
In particular, systemd-network and systemd-resolve got soft-static numbers to
make it easy to transition from a non-host-specific initrd to a host system
already a few years back (https://bugzilla.redhat.com/show_bug.cgi?id=1102002).
I also requested static allocations for sgx, input, render in
https://pagure.io/packaging-committee/issue/1078,
https://pagure.io/setup/pull-request/27.
2021-05-24 04:00:22 +08:00
static_ugids + = '@0@:@1@' . format ( option , val )
endif
endforeach
2017-12-03 20:28:23 +08:00
2018-05-07 17:17:35 +08:00
conf . set10 ( 'ENABLE_ADM_GROUP' , get_option ( 'adm-group' ) )
conf . set10 ( 'ENABLE_WHEEL_GROUP' , get_option ( 'wheel-group' ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2018-07-14 05:36:13 +08:00
dev_kvm_mode = get_option ( 'dev-kvm-mode' )
2021-05-16 19:35:51 +08:00
conf . set_quoted ( 'DEV_KVM_MODE' , dev_kvm_mode ) # FIXME: convert to 0o… notation
2018-07-14 05:36:13 +08:00
conf . set10 ( 'DEV_KVM_UACCESS' , dev_kvm_mode != '0666' )
2019-03-14 06:22:26 +08:00
group_render_mode = get_option ( 'group-render-mode' )
2021-05-16 21:51:17 +08:00
conf . set_quoted ( 'GROUP_RENDER_MODE' , group_render_mode )
2019-03-14 06:22:26 +08:00
conf . set10 ( 'GROUP_RENDER_UACCESS' , group_render_mode != '0666' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2017-04-13 07:54:33 +08:00
kill_user_processes = get_option ( 'default-kill-user-processes' )
conf . set10 ( 'KILL_USER_PROCESSES' , kill_user_processes )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2017-04-28 08:54:52 +08:00
dns_servers = get_option ( 'dns-servers' )
conf . set_quoted ( 'DNS_SERVERS' , dns_servers )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2017-04-28 08:54:52 +08:00
ntp_servers = get_option ( 'ntp-servers' )
conf . set_quoted ( 'NTP_SERVERS' , ntp_servers )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2018-12-28 20:38:36 +08:00
default_locale = get_option ( 'default-locale' )
conf . set_quoted ( 'SYSTEMD_DEFAULT_LOCALE' , default_locale )
2022-06-03 19:18:10 +08:00
nspawn_locale = get_option ( 'nspawn-locale' )
conf . set_quoted ( 'SYSTEMD_NSPAWN_LOCALE' , nspawn_locale )
2023-01-18 01:21:59 +08:00
default_keymap = get_option ( 'default-keymap' )
2023-08-03 21:42:00 +08:00
if default_keymap == ''
2023-08-10 21:12:15 +08:00
# We canonicalize empty keymap to '@kernel', as it makes the default value
2023-08-03 21:42:00 +08:00
# in the factory provided /etc/vconsole.conf more obvious.
2023-08-10 21:12:15 +08:00
default_keymap = '@kernel'
2023-08-03 21:42:00 +08:00
endif
2023-01-18 01:21:59 +08:00
conf . set_quoted ( 'SYSTEMD_DEFAULT_KEYMAP' , default_keymap )
2021-01-09 06:59:38 +08:00
localegen_path = get_option ( 'localegen-path' )
if localegen_path != ''
conf . set_quoted ( 'LOCALEGEN_PATH' , localegen_path )
endif
2021-05-17 02:13:14 +08:00
conf . set10 ( 'HAVE_LOCALEGEN' , localegen_path != '' )
2021-01-09 06:59:38 +08:00
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
conf . set_quoted ( 'GETTEXT_PACKAGE' , meson . project_name ( ) )
2019-10-25 18:17:24 +08:00
service_watchdog = get_option ( 'service-watchdog' )
2019-10-26 06:46:21 +08:00
watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
2021-05-16 17:55:36 +08:00
conf . set_quoted ( 'SERVICE_WATCHDOG' , watchdog_value )
2019-10-25 18:17:24 +08:00
2021-05-16 17:55:36 +08:00
conf . set_quoted ( 'SUSHELL' , get_option ( 'debug-shell' ) )
2019-04-25 18:19:16 +08:00
conf . set_quoted ( 'DEBUGTTY' , get_option ( 'debug-tty' ) )
2017-04-11 07:06:45 +08:00
2017-10-03 16:41:51 +08:00
enable_debug_hashmap = false
enable_debug_mmap_cache = false
2018-11-22 23:36:35 +08:00
enable_debug_siphash = false
2018-08-20 01:11:30 +08:00
foreach name : get_option ( 'debug-extra' )
2018-05-02 12:56:28 +08:00
if name == 'hashmap'
enable_debug_hashmap = true
elif name == 'mmap-cache'
enable_debug_mmap_cache = true
2018-11-22 23:36:35 +08:00
elif name == 'siphash'
enable_debug_siphash = true
2018-05-02 12:56:28 +08:00
else
message ( 'unknown debug option "@0@", ignoring' . format ( name ) )
endif
endforeach
2017-10-03 16:41:51 +08:00
conf . set10 ( 'ENABLE_DEBUG_HASHMAP' , enable_debug_hashmap )
conf . set10 ( 'ENABLE_DEBUG_MMAP_CACHE' , enable_debug_mmap_cache )
2018-11-22 23:36:35 +08:00
conf . set10 ( 'ENABLE_DEBUG_SIPHASH' , enable_debug_siphash )
2018-08-07 23:34:47 +08:00
conf . set10 ( 'LOG_TRACE' , get_option ( 'log-trace' ) )
2018-05-14 04:28:24 +08:00
2019-11-12 22:38:19 +08:00
default_user_path = get_option ( 'user-path' )
if default_user_path != ''
conf . set_quoted ( 'DEFAULT_USER_PATH' , default_user_path )
endif
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
#####################################################################
threads = dependency ( 'threads' )
librt = cc . find_library ( 'rt' )
libm = cc . find_library ( 'm' )
libdl = cc . find_library ( 'dl' )
2023-07-07 17:49:04 +08:00
libcrypt = dependency ( 'libcrypt' , 'libxcrypt' , required : false )
if not libcrypt . found ( )
# fallback to use find_library() if libcrypt is provided by glibc, e.g. for LibreELEC.
libcrypt = cc . find_library ( 'crypt' )
endif
2023-06-27 03:53:13 +08:00
libcap = dependency ( 'libcap' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2022-10-19 22:23:41 +08:00
# On some architectures, libatomic is required. But on some installations,
# it is found, but actual linking fails. So let's try to use it opportunistically.
# If it is installed, but not needed, it will be dropped because of --as-needed.
if cc . links ( '''int main(int argc, char **argv) { return 0; }''' ,
args : '-latomic' ,
name : 'libatomic' )
libatomic = declare_dependency ( link_args : '-latomic' )
else
libatomic = [ ]
endif
2020-09-22 02:41:17 +08:00
crypt_header = conf . get ( 'HAVE_CRYPT_H' ) == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
2020-09-09 02:02:31 +08:00
foreach ident : [
2020-09-25 18:19:56 +08:00
[ 'crypt_ra' , crypt_header ] ,
[ 'crypt_preferred_method' , crypt_header ] ,
[ 'crypt_gensalt_ra' , crypt_header ] ]
2020-09-09 02:02:31 +08:00
have = cc . has_function ( ident [ 0 ] , prefix : ident [ 1 ] , args : '-D_GNU_SOURCE' ,
dependencies : libcrypt )
conf . set10 ( 'HAVE_' + ident [ 0 ] . to_upper ( ) , have )
endforeach
2023-08-10 22:33:37 +08:00
bpf_framework = get_option ( 'bpf-framework' )
2022-10-01 08:09:53 +08:00
bpf_compiler = get_option ( 'bpf-compiler' )
2023-08-10 22:33:37 +08:00
libbpf = dependency ( 'libbpf' ,
required : bpf_framework ,
version : bpf_compiler == 'gcc' ? '>= 1.0.0' : '>= 0.1.0' )
meson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options
* Add `bpf-framework` feature gate with 'auto', 'true' and 'false' choices
* Add libbpf [0] dependency
* Search for clang llvm-strip and bpftool binaries in compile time to
generate bpf skeleton.
For libbpf [0], make 0.2.0 [1] the minimum required version.
If libbpf is satisfied, set HAVE_LIBBPF config option to 1.
If `bpf-framework` feature gate is set to 'auto', means that whether
bpf feature is enabled or now is defined by the presence of all of
libbpf, clang, llvm and bpftool in build
environment.
With 'auto' all dependencies are optional.
If the gate is set to `true`, make all of the libbpf, clang and llvm
dependencies mandatory.
If it's set to `false`, set `BPF_FRAMEWORK` to false and make libbpf
dependency optional.
libbpf dependency is dynamic followed by the common pattern in systemd.
meson, bpf: add build rule for socket_bind program
2020-11-14 09:08:15 +08:00
conf . set10 ( 'HAVE_LIBBPF' , libbpf . found ( ) )
2023-08-10 22:33:37 +08:00
if not libbpf . found ( )
2022-05-15 17:10:25 +08:00
conf . set10 ( 'BPF_FRAMEWORK' , false )
meson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options
* Add `bpf-framework` feature gate with 'auto', 'true' and 'false' choices
* Add libbpf [0] dependency
* Search for clang llvm-strip and bpftool binaries in compile time to
generate bpf skeleton.
For libbpf [0], make 0.2.0 [1] the minimum required version.
If libbpf is satisfied, set HAVE_LIBBPF config option to 1.
If `bpf-framework` feature gate is set to 'auto', means that whether
bpf feature is enabled or now is defined by the presence of all of
libbpf, clang, llvm and bpftool in build
environment.
With 'auto' all dependencies are optional.
If the gate is set to `true`, make all of the libbpf, clang and llvm
dependencies mandatory.
If it's set to `false`, set `BPF_FRAMEWORK` to false and make libbpf
dependency optional.
libbpf dependency is dynamic followed by the common pattern in systemd.
meson, bpf: add build rule for socket_bind program
2020-11-14 09:08:15 +08:00
else
2022-06-08 18:13:42 +08:00
clang_found = false
clang_supports_bpf = false
bpf_gcc_found = false
2022-10-01 08:09:53 +08:00
bpftool_strip = false
2022-06-08 18:13:42 +08:00
deps_found = false
if bpf_compiler == 'clang'
# Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
# (like clang-10/llvm-strip-10)
if meson . is_cross_build ( ) or cc . get_id ( ) != 'clang' or cc . cmd_array ( ) [ 0 ] . contains ( 'afl-clang' ) or cc . cmd_array ( ) [ 0 ] . contains ( 'hfuzz-clang' )
2023-08-10 22:33:37 +08:00
r = find_program ( 'clang' ,
required : bpf_framework ,
version : '>= 10.0.0' )
2022-06-08 18:13:42 +08:00
clang_found = r . found ( )
if clang_found
2022-05-16 02:22:33 +08:00
clang = r . full_path ( )
2022-06-08 18:13:42 +08:00
endif
else
clang_found = true
clang = cc . cmd_array ( )
2022-01-13 14:43:24 +08:00
endif
2022-01-13 14:33:46 +08:00
2022-06-08 18:13:42 +08:00
if clang_found
# Check if 'clang -target bpf' is supported.
clang_supports_bpf = run_command ( clang , '-target' , 'bpf' , '--print-supported-cpus' , check : false ) . returncode ( ) == 0
endif
elif bpf_compiler == 'gcc'
bpf_gcc = find_program ( 'bpf-gcc' ,
2023-05-30 05:45:13 +08:00
'bpf-none-gcc' ,
2022-06-08 18:13:42 +08:00
required : true ,
2023-05-30 05:01:34 +08:00
version : '>= 13.1.0' )
2022-06-08 18:13:42 +08:00
bpf_gcc_found = bpf_gcc . found ( )
2022-01-13 14:33:46 +08:00
endif
2022-06-08 18:13:42 +08:00
if clang_supports_bpf or bpf_gcc_found
# Debian installs this in /usr/sbin/ which is not in $PATH.
# We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
# We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13).
2022-01-31 12:47:38 +08:00
bpftool = find_program ( 'bpftool' ,
'/usr/sbin/bpftool' ,
2023-08-10 22:33:37 +08:00
required : bpf_framework . enabled ( ) and bpf_compiler == 'gcc' ,
version : bpf_compiler == 'gcc' ? '>= 7.0.0' : '>= 5.13.0' )
2022-01-31 12:47:38 +08:00
2022-06-08 18:13:42 +08:00
if bpftool . found ( )
bpftool_strip = true
deps_found = true
2022-10-01 08:09:53 +08:00
elif bpf_compiler == 'clang'
2022-06-08 18:13:42 +08:00
# We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
bpftool = find_program ( 'bpftool' ,
'/usr/sbin/bpftool' ,
2023-08-10 22:33:37 +08:00
required : bpf_framework ,
2022-06-08 18:13:42 +08:00
version : '>= 5.6.0' )
2022-01-31 12:47:38 +08:00
endif
2021-07-27 22:20:40 +08:00
2022-06-08 18:13:42 +08:00
# We use `llvm-strip` as a fallback if `bpftool gen object` strip support is not available.
if not bpftool_strip and bpftool . found ( ) and clang_supports_bpf
if not meson . is_cross_build ( )
llvm_strip_bin = run_command ( clang , '--print-prog-name' , 'llvm-strip' ,
check : true ) . stdout ( ) . strip ( )
else
llvm_strip_bin = 'llvm-strip'
endif
2023-08-10 22:33:37 +08:00
llvm_strip = find_program ( llvm_strip_bin ,
required : bpf_framework ,
version : '>= 10.0.0' )
2022-06-08 18:13:42 +08:00
deps_found = llvm_strip . found ( )
endif
endif
2021-07-27 22:20:40 +08:00
meson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options
* Add `bpf-framework` feature gate with 'auto', 'true' and 'false' choices
* Add libbpf [0] dependency
* Search for clang llvm-strip and bpftool binaries in compile time to
generate bpf skeleton.
For libbpf [0], make 0.2.0 [1] the minimum required version.
If libbpf is satisfied, set HAVE_LIBBPF config option to 1.
If `bpf-framework` feature gate is set to 'auto', means that whether
bpf feature is enabled or now is defined by the presence of all of
libbpf, clang, llvm and bpftool in build
environment.
With 'auto' all dependencies are optional.
If the gate is set to `true`, make all of the libbpf, clang and llvm
dependencies mandatory.
If it's set to `false`, set `BPF_FRAMEWORK` to false and make libbpf
dependency optional.
libbpf dependency is dynamic followed by the common pattern in systemd.
meson, bpf: add build rule for socket_bind program
2020-11-14 09:08:15 +08:00
# Can build BPF program from source code in restricted C
2021-08-12 11:59:19 +08:00
conf . set10 ( 'BPF_FRAMEWORK' , deps_found )
meson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options
* Add `bpf-framework` feature gate with 'auto', 'true' and 'false' choices
* Add libbpf [0] dependency
* Search for clang llvm-strip and bpftool binaries in compile time to
generate bpf skeleton.
For libbpf [0], make 0.2.0 [1] the minimum required version.
If libbpf is satisfied, set HAVE_LIBBPF config option to 1.
If `bpf-framework` feature gate is set to 'auto', means that whether
bpf feature is enabled or now is defined by the presence of all of
libbpf, clang, llvm and bpftool in build
environment.
With 'auto' all dependencies are optional.
If the gate is set to `true`, make all of the libbpf, clang and llvm
dependencies mandatory.
If it's set to `false`, set `BPF_FRAMEWORK` to false and make libbpf
dependency optional.
libbpf dependency is dynamic followed by the common pattern in systemd.
meson, bpf: add build rule for socket_bind program
2020-11-14 09:08:15 +08:00
endif
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
libmount = dependency ( 'mount' ,
2018-03-09 21:58:47 +08:00
version : fuzzer_build ? '>= 0' : '>= 2.30' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:07:19 +08:00
libfdisk = dependency ( 'fdisk' ,
version : '>= 2.32' ,
disabler : true ,
required : get_option ( 'fdisk' ) )
conf . set10 ( 'HAVE_LIBFDISK' , libfdisk . found ( ) )
2019-12-11 04:31:41 +08:00
2023-08-10 22:00:55 +08:00
# This prefers pwquality if both are enabled or auto.
feature = get_option ( 'pwquality' ) . disable_auto_if ( get_option ( 'passwdqc' ) . enabled ( ) )
libpwquality = dependency ( 'pwquality' ,
version : '>= 1.4.1' ,
required : feature )
have = libpwquality . found ( )
if not have
# libpwquality is used for both features for simplicity
libpwquality = dependency ( 'passwdqc' ,
required : get_option ( 'passwdqc' ) )
2019-07-05 00:35:39 +08:00
endif
conf . set10 ( 'HAVE_PWQUALITY' , have )
2023-08-10 22:00:55 +08:00
conf . set10 ( 'HAVE_PASSWDQC' , not have and libpwquality . found ( ) )
2019-07-05 00:35:39 +08:00
2023-08-10 00:15:29 +08:00
libseccomp = dependency ( 'libseccomp' ,
version : '>= 2.3.1' ,
required : get_option ( 'seccomp' ) )
conf . set10 ( 'HAVE_SECCOMP' , libseccomp . found ( ) )
2021-08-06 16:41:01 +08:00
2023-08-10 00:15:29 +08:00
libselinux = dependency ( 'libselinux' ,
version : '>= 2.1.9' ,
required : get_option ( 'selinux' ) )
conf . set10 ( 'HAVE_SELINUX' , libselinux . found ( ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libapparmor = dependency ( 'libapparmor' ,
version : '>= 2.13' ,
required : get_option ( 'apparmor' ) )
conf . set10 ( 'HAVE_APPARMOR' , libapparmor . found ( ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2021-09-22 01:53:20 +08:00
have = get_option ( 'smack' ) and get_option ( 'smack-run-label' ) != ''
conf . set10 ( 'HAVE_SMACK_RUN_LABEL' , have )
if have
conf . set_quoted ( 'SMACK_RUN_LABEL' , get_option ( 'smack-run-label' ) )
endif
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2022-07-06 19:09:51 +08:00
have = get_option ( 'smack' ) and get_option ( 'smack-default-process-label' ) != ''
if have
conf . set_quoted ( 'SMACK_DEFAULT_PROCESS_LABEL' , get_option ( 'smack-default-process-label' ) )
endif
2023-08-10 01:52:57 +08:00
feature = get_option ( 'polkit' )
libpolkit = dependency ( 'polkit-gobject-1' ,
required : feature . disabled ( ) ? feature : false )
install_polkit = feature . allowed ( )
install_polkit_pkla = libpolkit . found ( ) and libpolkit . version ( ) . version_compare ( '< 0.106' )
if install_polkit_pkla
message ( 'Old polkit detected, will install pkla files' )
2017-04-13 07:09:26 +08:00
endif
2017-10-03 16:41:51 +08:00
conf . set10 ( 'ENABLE_POLKIT' , install_polkit )
2017-04-13 07:09:26 +08:00
2023-08-10 00:15:29 +08:00
libacl = dependency ( 'libacl' ,
required : get_option ( 'acl' ) )
conf . set10 ( 'HAVE_ACL' , libacl . found ( ) )
2017-04-22 01:53:59 +08:00
2023-08-10 00:15:29 +08:00
libaudit = dependency ( 'audit' ,
required : get_option ( 'audit' ) )
conf . set10 ( 'HAVE_AUDIT' , libaudit . found ( ) )
udev-builtin-blkid: add support for --hint offsets
The next libblkid v2.37 is going to support session offsets for
multi-session CD/DVDs. This feature is implemented by "hint offsets".
These offsets are optional and prober specific (e.g., iso, udf, ...).
For this purpose, the library provides a new function
blkid_probe_set_hint(), and blkid(8) provides a new command-line
option --hint <name>=<offset>. For CD/DVD, the offset name is
"session_offset".
The difference between classic --offset and the new --hint is that
--offset is very restrictive and defines the probing area and the rest
of the device is invisible to the library. The new --hint works
like a suggestion, it provides a hint where the user assumes the
filesystem, but the rest of the device is still readable for the
library (for example, to get some additional superblock information
etc.).
If the --hint is without a value then it defaults to zero.
The option --hint implementation in udev-builtin-blkid.c is backwardly
compatible. If compiled against old libblkid, then the option is used in
the same way as --offset.
Addresses: https://github.com/karelzak/util-linux/issues/1161
Addresses: https://github.com/systemd/systemd/pull/17424
2020-11-30 18:38:21 +08:00
2023-08-10 00:15:29 +08:00
libblkid = dependency ( 'blkid' ,
required : get_option ( 'blkid' ) )
conf . set10 ( 'HAVE_BLKID' , libblkid . found ( ) )
conf . set10 ( 'HAVE_BLKID_PROBE_SET_HINT' ,
libblkid . found ( ) and cc . has_function ( 'blkid_probe_set_hint' , dependencies : libblkid ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libkmod = dependency ( 'libkmod' ,
version : '>= 15' ,
required : get_option ( 'kmod' ) )
conf . set10 ( 'HAVE_KMOD' , libkmod . found ( ) )
2024-01-30 21:50:35 +08:00
libkmod_cflags = libkmod . partial_dependency ( includes : true , compile_args : true )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libxenctrl = dependency ( 'xencontrol' ,
version : '>= 4.9' ,
required : get_option ( 'xenctrl' ) )
conf . set10 ( 'HAVE_XENCTRL' , libxenctrl . found ( ) )
2023-11-02 22:57:34 +08:00
libxenctrl_cflags = libxenctrl . partial_dependency ( includes : true , compile_args : true )
2022-11-01 23:53:02 +08:00
2023-08-10 01:52:57 +08:00
feature = get_option ( 'pam' )
libpam = dependency ( 'pam' ,
required : feature . disabled ( ) ? feature : false )
if not libpam . found ( )
# Debian older than bookworm and Ubuntu older than 22.10 do not provide the .pc file.
libpam = cc . find_library ( 'pam' , required : feature )
endif
libpam_misc = dependency ( 'pam_misc' ,
required : feature . disabled ( ) ? feature : false )
if not libpam_misc . found ( )
libpam_misc = cc . find_library ( 'pam_misc' , required : feature )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2023-08-10 01:52:57 +08:00
conf . set10 ( 'HAVE_PAM' , libpam . found ( ) and libpam_misc . found ( ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libmicrohttpd = dependency ( 'libmicrohttpd' ,
version : '>= 0.9.33' ,
required : get_option ( 'microhttpd' ) )
conf . set10 ( 'HAVE_MICROHTTPD' , libmicrohttpd . found ( ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 22:00:55 +08:00
libcryptsetup = get_option ( 'libcryptsetup' )
libcryptsetup_plugins = get_option ( 'libcryptsetup-plugins' )
if libcryptsetup_plugins . enabled ( )
if libcryptsetup . disabled ( )
2023-11-08 20:50:39 +08:00
error ( 'libcryptsetup-plugins cannot be requested without libcryptsetup' )
2023-06-27 03:53:13 +08:00
endif
2023-08-10 22:00:55 +08:00
libcryptsetup = libcryptsetup_plugins
endif
libcryptsetup = dependency ( 'libcryptsetup' ,
version : libcryptsetup_plugins . enabled ( ) ? '>= 2.4.0' : '>= 2.0.1' ,
required : libcryptsetup )
have = libcryptsetup . found ( )
foreach ident : [ 'crypt_set_metadata_size' ,
'crypt_activate_by_signed_key' ,
'crypt_token_max' ,
'crypt_reencrypt_init_by_passphrase' ,
'crypt_reencrypt' ,
2024-01-31 20:11:21 +08:00
'crypt_set_data_offset' ,
2024-02-01 12:49:24 +08:00
'crypt_set_keyring_to_link' ,
'crypt_resume_by_volume_key' ]
2023-08-10 22:00:55 +08:00
have_ident = have and cc . has_function (
ident ,
prefix : '#include <libcryptsetup.h>' ,
dependencies : libcryptsetup )
conf . set10 ( 'HAVE_' + ident . to_upper ( ) , have_ident )
endforeach
2017-10-03 16:41:51 +08:00
conf . set10 ( 'HAVE_LIBCRYPTSETUP' , have )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 22:00:55 +08:00
# TODO: Use has_function(required : libcryptsetup_plugins) with meson >= 1.3.0
if libcryptsetup_plugins . allowed ( )
2021-12-30 21:51:44 +08:00
have = ( cc . has_function (
'crypt_activate_by_token_pin' ,
prefix : '#include <libcryptsetup.h>' ,
dependencies : libcryptsetup ) and
cc . has_function (
'crypt_token_external_path' ,
prefix : '#include <libcryptsetup.h>' ,
dependencies : libcryptsetup ) )
2021-03-17 03:13:28 +08:00
else
have = false
endif
conf . set10 ( 'HAVE_LIBCRYPTSETUP_PLUGINS' , have )
2023-08-10 00:15:29 +08:00
libcurl = dependency ( 'libcurl' ,
version : '>= 7.32.0' ,
required : get_option ( 'libcurl' ) )
conf . set10 ( 'HAVE_LIBCURL' , libcurl . found ( ) )
2021-04-14 19:17:22 +08:00
conf . set10 ( 'CURL_NO_OLDIES' , conf . get ( 'BUILD_MODE_DEVELOPER' ) == 1 )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 22:00:55 +08:00
feature = get_option ( 'libidn2' ) . disable_auto_if ( get_option ( 'libidn' ) . enabled ( ) )
libidn = dependency ( 'libidn2' ,
required : feature )
have = libidn . found ( )
if not have
2017-07-12 15:25:59 +08:00
# libidn is used for both libidn and libidn2 objects
2019-06-29 02:13:30 +08:00
libidn = dependency ( 'libidn' ,
2023-08-10 22:00:55 +08:00
required : get_option ( 'libidn' ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2023-08-10 22:00:55 +08:00
conf . set10 ( 'HAVE_LIBIDN' , not have and libidn . found ( ) )
conf . set10 ( 'HAVE_LIBIDN2' , have )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libiptc = dependency ( 'libiptc' ,
required : get_option ( 'libiptc' ) )
conf . set10 ( 'HAVE_LIBIPTC' , libiptc . found ( ) )
2023-11-02 22:57:10 +08:00
libiptc_cflags = libiptc . partial_dependency ( includes : true , compile_args : true )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libqrencode = dependency ( 'libqrencode' ,
version : '>= 3' ,
required : get_option ( 'qrencode' ) )
conf . set10 ( 'HAVE_QRENCODE' , libqrencode . found ( ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 01:52:57 +08:00
feature = get_option ( 'gcrypt' )
libgcrypt = dependency ( 'libgcrypt' ,
required : feature )
libgpg_error = dependency ( 'gpg-error' ,
required : feature . disabled ( ) ? feature : false )
if not libgpg_error . found ( )
# CentOS 8 does not provide the .pc file.
libgpg_error = cc . find_library ( 'gpg-error' , required : feature )
2017-10-03 16:41:51 +08:00
endif
2023-08-10 01:52:57 +08:00
have = libgcrypt . found ( ) and libgpg_error . found ( )
2017-10-03 16:41:51 +08:00
if not have
# link to neither of the libs if one is not found
2017-07-27 02:08:46 +08:00
libgcrypt = [ ]
libgpg_error = [ ]
2024-03-30 07:36:51 +08:00
libgcrypt_cflags = [ ]
else
libgcrypt_cflags = libgcrypt . partial_dependency ( includes : true , compile_args : true )
2017-07-27 02:08:46 +08:00
endif
2017-10-03 16:41:51 +08:00
conf . set10 ( 'HAVE_GCRYPT' , have )
2017-07-27 02:08:46 +08:00
2023-08-10 00:15:29 +08:00
libgnutls = dependency ( 'gnutls' ,
version : '>= 3.1.4' ,
required : get_option ( 'gnutls' ) )
conf . set10 ( 'HAVE_GNUTLS' , libgnutls . found ( ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libopenssl = dependency ( 'openssl' ,
version : '>= 1.1.0' ,
required : get_option ( 'openssl' ) )
conf . set10 ( 'HAVE_OPENSSL' , libopenssl . found ( ) )
2018-07-27 05:47:50 +08:00
2023-08-10 00:15:29 +08:00
libp11kit = dependency ( 'p11-kit-1' ,
version : '>= 0.23.3' ,
required : get_option ( 'p11kit' ) )
conf . set10 ( 'HAVE_P11KIT' , libp11kit . found ( ) )
libp11kit_cflags = libp11kit . partial_dependency ( includes : true , compile_args : true )
2019-11-05 18:49:27 +08:00
2023-08-10 21:44:11 +08:00
feature = get_option ( 'libfido2' ) . require (
conf . get ( 'HAVE_OPENSSL' ) == 1 ,
error_message : 'openssl required' )
libfido2 = dependency ( 'libfido2' ,
required : feature )
conf . set10 ( 'HAVE_LIBFIDO2' , libfido2 . found ( ) )
2020-04-14 21:54:52 +08:00
2023-08-10 00:15:29 +08:00
tpm2 = dependency ( 'tss2-esys tss2-rc tss2-mu tss2-tcti-device' ,
required : get_option ( 'tpm2' ) )
conf . set10 ( 'HAVE_TPM2' , tpm2 . found ( ) )
conf . set10 ( 'HAVE_TSS2_ESYS3' , tpm2 . found ( ) and tpm2 . version ( ) . version_compare ( '>= 3.0.0' ) )
2020-11-28 22:27:34 +08:00
2023-08-10 00:15:29 +08:00
libdw = dependency ( 'libdw' ,
required : get_option ( 'elfutils' ) )
conf . set10 ( 'HAVE_ELFUTILS' , libdw . found ( ) )
# New in elfutils 0.177
conf . set10 ( 'HAVE_DWELF_ELF_E_MACHINE_STRING' ,
libdw . found ( ) and cc . has_function ( 'dwelf_elf_e_machine_string' , dependencies : libdw ) )
2021-11-18 08:03:48 +08:00
2023-08-10 00:15:29 +08:00
libz = dependency ( 'zlib' ,
required : get_option ( 'zlib' ) )
conf . set10 ( 'HAVE_ZLIB' , libz . found ( ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 01:52:57 +08:00
feature = get_option ( 'bzip2' )
libbzip2 = dependency ( 'bzip2' ,
required : feature . disabled ( ) ? feature : false )
if not libbzip2 . found ( )
# Debian and Ubuntu do not provide the .pc file.
libbzip2 = cc . find_library ( 'bz2' , required : feature )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endif
2023-08-10 01:52:57 +08:00
conf . set10 ( 'HAVE_BZIP2' , libbzip2 . found ( ) )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libxz = dependency ( 'liblzma' ,
required : get_option ( 'xz' ) )
conf . set10 ( 'HAVE_XZ' , libxz . found ( ) )
2024-02-28 04:28:14 +08:00
libxz_cflags = libxz . partial_dependency ( includes : true , compile_args : true )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
liblz4 = dependency ( 'liblz4' ,
version : '>= 1.3.0' ,
required : get_option ( 'lz4' ) )
conf . set10 ( 'HAVE_LZ4' , liblz4 . found ( ) )
2024-02-28 04:28:14 +08:00
liblz4_cflags = liblz4 . partial_dependency ( includes : true , compile_args : true )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 00:15:29 +08:00
libzstd = dependency ( 'libzstd' ,
version : '>= 1.4.0' ,
required : get_option ( 'zstd' ) )
conf . set10 ( 'HAVE_ZSTD' , libzstd . found ( ) )
2024-02-28 04:28:14 +08:00
libzstd_cflags = libzstd . partial_dependency ( includes : true , compile_args : true )
2020-06-24 22:33:41 +08:00
2023-08-10 00:15:29 +08:00
conf . set10 ( 'HAVE_COMPRESSION' , libxz . found ( ) or liblz4 . found ( ) or libzstd . found ( ) )
2020-04-12 07:09:05 +08:00
2022-04-10 01:38:06 +08:00
compression = get_option ( 'default-compression' )
if compression == 'auto'
2023-08-10 00:15:29 +08:00
if libzstd . found ( )
2022-04-10 01:38:06 +08:00
compression = 'zstd'
2023-08-10 00:15:29 +08:00
elif liblz4 . found ( )
2022-04-10 01:38:06 +08:00
compression = 'lz4'
2023-08-10 00:15:29 +08:00
elif libxz . found ( )
2022-04-10 01:38:06 +08:00
compression = 'xz'
else
compression = 'none'
endif
2023-08-10 00:15:29 +08:00
elif compression == 'zstd' and not libzstd . found ( )
2022-04-10 01:38:06 +08:00
error ( 'default-compression=zstd requires zstd' )
2023-08-10 00:15:29 +08:00
elif compression == 'lz4' and not liblz4 . found ( )
2022-04-10 01:38:06 +08:00
error ( 'default-compression=lz4 requires lz4' )
2023-08-10 00:15:29 +08:00
elif compression == 'xz' and not libxz . found ( )
2022-04-10 01:38:06 +08:00
error ( 'default-compression=xz requires xz' )
endif
2022-04-27 19:49:17 +08:00
conf . set ( 'DEFAULT_COMPRESSION' , 'COMPRESSION_@0@' . format ( compression . to_upper ( ) ) )
2022-04-10 01:38:06 +08:00
2024-01-24 19:28:41 +08:00
libarchive = dependency ( 'libarchive' ,
version : '>= 3.0' ,
required : get_option ( 'libarchive' ) )
conf . set10 ( 'HAVE_LIBARCHIVE' , libarchive . found ( ) )
2023-08-10 00:15:29 +08:00
libxkbcommon = dependency ( 'xkbcommon' ,
version : '>= 0.3.0' ,
required : get_option ( 'xkbcommon' ) )
conf . set10 ( 'HAVE_XKBCOMMON' , libxkbcommon . found ( ) )
2017-07-27 02:08:46 +08:00
2023-08-10 00:15:29 +08:00
libpcre2 = dependency ( 'libpcre2-8' ,
required : get_option ( 'pcre2' ) )
conf . set10 ( 'HAVE_PCRE2' , libpcre2 . found ( ) )
2017-04-07 12:19:09 +08:00
2023-08-10 00:15:29 +08:00
libglib = dependency ( 'glib-2.0' ,
version : '>= 2.22.0' ,
required : get_option ( 'glib' ) )
libgobject = dependency ( 'gobject-2.0' ,
version : '>= 2.22.0' ,
required : get_option ( 'glib' ) )
libgio = dependency ( 'gio-2.0' ,
required : get_option ( 'glib' ) )
conf . set10 ( 'HAVE_GLIB' , libglib . found ( ) and libgobject . found ( ) and libgio . found ( ) )
2017-04-07 12:19:09 +08:00
2023-08-10 21:16:56 +08:00
libdbus = dependency ( 'dbus-1' ,
version : '>= 1.3.2' ,
required : get_option ( 'dbus' ) )
conf . set10 ( 'HAVE_DBUS' , libdbus . found ( ) )
2017-04-07 12:19:09 +08:00
2023-08-10 21:16:56 +08:00
dbusdatadir = libdbus . get_variable ( pkgconfig : 'datadir' , default_value : datadir ) / 'dbus-1'
2021-12-26 15:19:17 +08:00
dbuspolicydir = get_option ( 'dbuspolicydir' )
if dbuspolicydir == ''
dbuspolicydir = dbusdatadir / 'system.d'
endif
dbussessionservicedir = get_option ( 'dbussessionservicedir' )
if dbussessionservicedir == ''
2023-08-10 21:16:56 +08:00
dbussessionservicedir = libdbus . get_variable ( pkgconfig : 'session_bus_services_dir' , default_value : dbusdatadir / 'services' )
2021-12-26 15:19:17 +08:00
endif
dbussystemservicedir = get_option ( 'dbussystemservicedir' )
if dbussystemservicedir == ''
2023-08-10 21:16:56 +08:00
dbussystemservicedir = libdbus . get_variable ( pkgconfig : 'system_bus_services_dir' , default_value : dbusdatadir / 'system-services' )
2021-12-26 15:19:17 +08:00
endif
dbus_interfaces_dir = get_option ( 'dbus-interfaces-dir' )
if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
if meson . is_cross_build ( ) and dbus_interfaces_dir != 'yes'
dbus_interfaces_dir = 'no'
warning ( 'Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.' )
else
2023-08-10 21:16:56 +08:00
dbus_interfaces_dir = libdbus . get_variable ( pkgconfig : 'interfaces_dir' , default_value : dbusdatadir / 'interfaces' )
2021-12-26 15:19:17 +08:00
endif
endif
2023-07-30 05:32:53 +08:00
dmi_arches = [ 'x86' , 'x86_64' , 'aarch64' , 'arm' , 'ia64' , 'loongarch64' , 'mips' ]
conf . set10 ( 'HAVE_DMI' , host_machine . cpu_family ( ) in dmi_arches )
2021-12-02 18:29:45 +08:00
# We support one or the other. If gcrypt is available, we assume it's there to
# be used, and use it in preference.
opt = get_option ( 'cryptolib' )
if opt == 'openssl' and conf . get ( 'HAVE_OPENSSL' ) == 0
error ( 'openssl requested as the default cryptolib, but not available' )
endif
conf . set10 ( 'PREFER_OPENSSL' ,
opt == 'openssl' or ( opt == 'auto' and conf . get ( 'HAVE_OPENSSL' ) == 1 and conf . get ( 'HAVE_GCRYPT' ) == 0 ) )
conf . set10 ( 'HAVE_OPENSSL_OR_GCRYPT' ,
conf . get ( 'HAVE_OPENSSL' ) == 1 or conf . get ( 'HAVE_GCRYPT' ) == 1 )
2021-12-24 09:06:13 +08:00
lib_openssl_or_gcrypt = conf . get ( 'PREFER_OPENSSL' ) == 1 ? [ libopenssl ] : [ libgcrypt , libgpg_error ]
2017-06-18 04:22:32 +08:00
2018-06-21 00:29:49 +08:00
dns_over_tls = get_option ( 'dns-over-tls' )
if dns_over_tls != 'false'
2021-12-02 18:29:45 +08:00
if dns_over_tls == 'gnutls' and conf . get ( 'PREFER_OPENSSL' ) == 1
error ( 'Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib' )
endif
2022-05-18 03:09:49 +08:00
if dns_over_tls == 'gnutls'
have_openssl = false
2018-07-27 05:47:50 +08:00
else
2022-05-18 03:09:49 +08:00
have_openssl = conf . get ( 'HAVE_OPENSSL' ) == 1
if dns_over_tls == 'openssl' and not have_openssl
error ( 'DNS-over-TLS support was requested with openssl, but dependencies are not available' )
2018-07-27 05:47:50 +08:00
endif
2018-06-21 00:29:49 +08:00
endif
2022-05-18 03:09:49 +08:00
if dns_over_tls == 'openssl' or have_openssl
have_gnutls = false
2018-07-27 05:47:50 +08:00
else
2022-05-18 03:09:49 +08:00
have_gnutls = conf . get ( 'HAVE_GNUTLS' ) == 1 and libgnutls . version ( ) . version_compare ( '>= 3.6.0' )
if dns_over_tls != 'auto' and not have_gnutls
str = dns_over_tls == 'gnutls' ? ' with gnutls' : ''
2019-06-17 09:22:54 +08:00
error ( 'DNS-over-TLS support was requested@0@, but dependencies are not available' . format ( str ) )
2018-07-27 05:47:50 +08:00
endif
endif
have = have_gnutls or have_openssl
2018-06-21 00:29:49 +08:00
else
2018-11-11 18:30:53 +08:00
have = false
have_gnutls = false
have_openssl = false
2018-06-21 00:29:49 +08:00
endif
conf . set10 ( 'ENABLE_DNS_OVER_TLS' , have )
2018-07-27 05:47:50 +08:00
conf . set10 ( 'DNS_OVER_TLS_USE_GNUTLS' , have_gnutls )
conf . set10 ( 'DNS_OVER_TLS_USE_OPENSSL' , have_openssl )
2018-06-21 00:29:49 +08:00
2018-06-14 02:26:24 +08:00
default_dns_over_tls = get_option ( 'default-dns-over-tls' )
2018-06-21 00:29:49 +08:00
if default_dns_over_tls != 'no' and conf . get ( 'ENABLE_DNS_OVER_TLS' ) == 0
2019-02-19 03:41:46 +08:00
message ( 'default-dns-over-tls cannot be enabled or set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.' )
2018-06-14 02:26:24 +08:00
default_dns_over_tls = 'no'
2018-04-27 23:50:38 +08:00
endif
2018-06-14 02:26:24 +08:00
conf . set ( 'DEFAULT_DNS_OVER_TLS_MODE' ,
'DNS_OVER_TLS_' + default_dns_over_tls . underscorify ( ) . to_upper ( ) )
2021-05-16 22:55:16 +08:00
conf . set_quoted ( 'DEFAULT_DNS_OVER_TLS_MODE_STR' , default_dns_over_tls )
2018-04-27 23:50:38 +08:00
2020-04-15 04:18:18 +08:00
default_mdns = get_option ( 'default-mdns' )
conf . set ( 'DEFAULT_MDNS_MODE' ,
'RESOLVE_SUPPORT_' + default_mdns . to_upper ( ) )
2021-05-16 22:55:16 +08:00
conf . set_quoted ( 'DEFAULT_MDNS_MODE_STR' , default_mdns )
2020-04-15 04:18:18 +08:00
default_llmnr = get_option ( 'default-llmnr' )
conf . set ( 'DEFAULT_LLMNR_MODE' ,
'RESOLVE_SUPPORT_' + default_llmnr . to_upper ( ) )
2021-05-16 22:55:16 +08:00
conf . set_quoted ( 'DEFAULT_LLMNR_MODE_STR' , default_llmnr )
2020-04-15 04:18:18 +08:00
2023-08-10 21:44:11 +08:00
have = get_option ( 'repart' ) . require (
conf . get ( 'HAVE_LIBFDISK' ) == 1 ,
error_message : 'fdisk required' ) . allowed ( )
2019-12-11 04:31:41 +08:00
conf . set10 ( 'ENABLE_REPART' , have )
2021-10-27 21:39:48 +08:00
default_dnssec = get_option ( 'default-dnssec' )
if default_dnssec != 'no' and conf . get ( 'HAVE_OPENSSL_OR_GCRYPT' ) == 0
message ( 'default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.' )
default_dnssec = 'no'
endif
conf . set ( 'DEFAULT_DNSSEC_MODE' ,
'DNSSEC_' + default_dnssec . underscorify ( ) . to_upper ( ) )
conf . set_quoted ( 'DEFAULT_DNSSEC_MODE_STR' , default_dnssec )
2023-08-10 21:44:11 +08:00
have = get_option ( 'sysupdate' ) . require (
conf . get ( 'HAVE_OPENSSL' ) == 1 and
conf . get ( 'HAVE_LIBFDISK' ) == 1 ,
error_message : 'fdisk and openssl required' ) . allowed ( )
2020-12-28 22:17:54 +08:00
conf . set10 ( 'ENABLE_SYSUPDATE' , have )
storagetm: add new systemd-storagetm component
This implements a "storage target mode", similar to what MacOS provides
since a long time as "Target Disk Mode":
https://en.wikipedia.org/wiki/Target_Disk_Mode
This implementation is relatively simple:
1. a new generic target "storage-target-mode.target" is added, which
when booted into defines the target mode.
2. a small tool and service "systemd-storagetm.service" is added which
exposes a specific device or all devices as NVMe-TCP devices over the
network. NVMe-TCP appears to be hot shit right now how to expose
block devices over the network. And it's really simple to set up via
configs, hence our code is relatively short and neat.
The idea is that systemd-storagetm.target can be extended sooner or
later, for example to expose block devices also as USB mass storage
devices and similar, in case the system has "dual mode" USB controller
that can also work as device, not just as host. (And people could also
plug in sharing as NBD, iSCSI, whatever they want.)
How to use this? Boot into your system with a kernel cmdline of
"rd.systemd.unit=storage-target-mode.target ip=link-local", and you'll see on
screen the precise "nvme connect" command line to make the relevant
block devices available locally on some other machine. This all requires
that the target mode stuff is included in the initrd of course. And the
system will the stay in the initrd forever.
Why bother? Primarily three use-cases:
1. Debug a broken system: with very few dependencies during boot get
access to the raw block device of a broken machine.
2. Migrate from system to another system, by dd'ing the old to the new
directly.
3. Installing an OS remotely on some device (for example via Thunderbolt
networking)
(And there might be more, for example the ability to boot from a
laptop's disk on another system)
Limitations:
1. There's no authentication/encryption. Hence: use this on local links
only.
2. NVMe target mode on Linux supports r/w operation only. Ideally, we'd
have a read-only mode, for security reasons, and default to it.
Future love:
1. We should have another mode, where we simply expose the homed LUKS
home dirs like that.
2. Some lightweight hookup with plymouth, to display a (shortened)
version of the info we write to the console.
To test all this, just run:
mkosi --kernel-command-line-extra="rd.systemd.unit=storage-target-mode.target" qemu
2023-10-27 20:25:49 +08:00
conf . set10 ( 'ENABLE_STORAGETM' , get_option ( 'storagetm' ) )
2023-08-10 21:44:11 +08:00
have = get_option ( 'importd' ) . require (
conf . get ( 'HAVE_LIBCURL' ) == 1 and
conf . get ( 'HAVE_OPENSSL_OR_GCRYPT' ) == 1 and
conf . get ( 'HAVE_ZLIB' ) == 1 and
conf . get ( 'HAVE_XZ' ) == 1 ,
error_message : 'curl, openssl/grypt, zlib and xz required' ) . allowed ( )
2017-10-03 16:41:51 +08:00
conf . set10 ( 'ENABLE_IMPORTD' , have )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-08-10 21:44:11 +08:00
have = get_option ( 'homed' ) . require (
conf . get ( 'HAVE_OPENSSL' ) == 1 and
conf . get ( 'HAVE_LIBFDISK' ) == 1 and
2024-02-01 12:49:24 +08:00
conf . get ( 'HAVE_LIBCRYPTSETUP' ) == 1 and
conf . get ( 'HAVE_CRYPT_RESUME_BY_VOLUME_KEY' ) == 1 ,
2023-08-10 21:44:11 +08:00
error_message : 'openssl, fdisk and libcryptsetup required' ) . allowed ( )
2019-07-05 00:35:39 +08:00
conf . set10 ( 'ENABLE_HOMED' , have )
2020-02-01 10:01:41 +08:00
have = have and conf . get ( 'HAVE_PAM' ) == 1
conf . set10 ( 'ENABLE_PAM_HOME' , have )
2023-08-10 22:00:55 +08:00
feature = get_option ( 'remote' )
have_deps = [ conf . get ( 'HAVE_MICROHTTPD' ) == 1 ,
conf . get ( 'HAVE_LIBCURL' ) == 1 ]
# sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
# it's possible to build one without the other. Complain only if
# support was explicitly requested. The auxiliary files like sysusers
# config should be installed when any of the programs are built.
if feature . enabled ( ) and not ( have_deps [ 0 ] and have_deps [ 1 ] )
error ( 'remote support was requested, but dependencies are not available' )
endif
have = feature . allowed ( ) and ( have_deps [ 0 ] or have_deps [ 1 ] )
2017-10-03 16:41:51 +08:00
conf . set10 ( 'ENABLE_REMOTE' , have )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-11-08 04:51:40 +08:00
feature = get_option ( 'vmspawn' ) . disable_auto_if ( conf . get ( 'BUILD_MODE_DEVELOPER' ) == 0 )
conf . set10 ( 'ENABLE_VMSPAWN' , feature . allowed ( ) )
2023-03-09 19:27:29 +08:00
conf . set10 ( 'DEFAULT_MOUNTFSD_TRUSTED_DIRECTORIES' , get_option ( 'default-mountfsd-trusted-directories' ) )
2020-08-20 23:35:50 +08:00
foreach term : [ 'analyze' ,
'backlight' ,
2017-10-03 19:15:27 +08:00
'binfmt' ,
2023-02-26 21:09:44 +08:00
'compat-mutable-uid-boundaries' ,
2017-10-03 19:15:27 +08:00
'coredump' ,
2020-08-20 23:35:50 +08:00
'efi' ,
'environment-d' ,
'firstboot' ,
'gshadow' ,
'hibernate' ,
2017-10-03 19:15:27 +08:00
'hostnamed' ,
2020-08-20 23:35:50 +08:00
'hwdb' ,
'idn' ,
'ima' ,
'initrd' ,
2023-06-20 07:06:43 +08:00
'kernel-install' ,
2020-08-20 23:35:50 +08:00
'ldconfig' ,
2017-10-03 19:15:27 +08:00
'localed' ,
2020-08-20 23:35:50 +08:00
'logind' ,
2017-10-03 19:15:27 +08:00
'machined' ,
2023-03-09 19:27:29 +08:00
'mountfsd' ,
2017-10-03 19:15:27 +08:00
'networkd' ,
2023-02-26 21:09:44 +08:00
'nscd' ,
2023-04-21 01:07:33 +08:00
'nsresourced' ,
2020-08-20 23:35:50 +08:00
'nss-myhostname' ,
'nss-systemd' ,
2023-06-20 07:06:43 +08:00
'oomd' ,
2020-08-20 23:35:50 +08:00
'portabled' ,
'pstore' ,
2017-10-03 19:15:27 +08:00
'quotacheck' ,
2020-08-20 23:35:50 +08:00
'randomseed' ,
'resolve' ,
'rfkill' ,
'smack' ,
2023-02-26 21:09:44 +08:00
'sysext' ,
2017-10-03 19:15:27 +08:00
'sysusers' ,
2020-08-20 23:35:50 +08:00
'timedated' ,
'timesyncd' ,
2017-10-03 19:15:27 +08:00
'tmpfiles' ,
'tpm' ,
2020-08-20 23:35:50 +08:00
'userdb' ,
'utmp' ,
'vconsole' ,
'xdg-autostart' ]
2017-10-03 19:15:27 +08:00
have = get_option ( term )
name = 'ENABLE_' + term . underscorify ( ) . to_upper ( )
conf . set10 ( name , have )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
endforeach
2020-09-26 17:58:24 +08:00
enable_sysusers = conf . get ( 'ENABLE_SYSUSERS' ) == 1
2018-07-18 08:25:57 +08:00
foreach tuple : [ [ 'nss-mymachines' , 'machined' ] ,
[ 'nss-resolve' , 'resolve' ] ]
want = get_option ( tuple [ 0 ] )
2023-08-10 22:00:55 +08:00
if want . allowed ( )
2018-07-18 08:25:57 +08:00
have = get_option ( tuple [ 1 ] )
2023-08-10 22:00:55 +08:00
if want . enabled ( ) and not have
2018-07-18 08:25:57 +08:00
error ( '@0@ is requested but @1@ is disabled' . format ( tuple [ 0 ] , tuple [ 1 ] ) )
endif
else
have = false
endif
name = 'ENABLE_' + tuple [ 0 ] . underscorify ( ) . to_upper ( )
conf . set10 ( name , have )
endforeach
enable_nss = false
foreach term : [ 'ENABLE_NSS_MYHOSTNAME' ,
'ENABLE_NSS_MYMACHINES' ,
'ENABLE_NSS_RESOLVE' ,
'ENABLE_NSS_SYSTEMD' ]
if conf . get ( term ) == 1
enable_nss = true
endif
endforeach
conf . set10 ( 'ENABLE_NSS' , enable_nss )
2018-05-07 17:17:35 +08:00
conf . set10 ( 'ENABLE_TIMEDATECTL' , get_option ( 'timedated' ) or get_option ( 'timesyncd' ) )
2018-05-03 17:07:43 +08:00
2024-01-30 18:25:19 +08:00
conf . set10 ( 'ENABLE_SSH_PROXY_CONFIG' , sshconfdir != 'no' )
conf . set10 ( 'ENABLE_SSH_USERDB_CONFIG' , conf . get ( 'ENABLE_USERDB' ) == 1 and sshdconfdir != 'no' )
2018-01-19 14:54:30 +08:00
conf . set10 ( 'SYSTEMD_SLOW_TESTS_DEFAULT' , slow_tests )
2017-07-13 05:25:17 +08:00
2023-12-15 05:35:00 +08:00
#####################################################################
2021-12-10 18:55:38 +08:00
2023-02-01 04:43:53 +08:00
pymod = import ( 'python' )
python = pymod . find_installation ( 'python3' , required : true , modules : [ 'jinja2' ] )
python_39 = python . language_version ( ) . version_compare ( '>=3.9' )
2023-12-15 05:35:00 +08:00
#####################################################################
2023-03-16 22:36:26 +08:00
if conf . get ( 'BPF_FRAMEWORK' ) == 1
bpf_clang_flags = [
'-std=gnu11' ,
'-Wno-compare-distinct-pointer-types' ,
'-fno-stack-protector' ,
'-O2' ,
'-target' ,
'bpf' ,
'-g' ,
'-c' ,
]
bpf_gcc_flags = [
'-std=gnu11' ,
'-fno-stack-protector' ,
2024-04-05 06:42:45 +08:00
'-fno-ssa-phiopt' ,
2023-03-16 22:36:26 +08:00
'-O2' ,
'-mcpu=v3' ,
'-mco-re' ,
'-gbtf' ,
'-c' ,
]
# Generate defines that are appropriate to tell the compiler what architecture
# we're compiling for. By default we just map meson's cpu_family to __<cpu_family>__.
# This dictionary contains the exceptions where this doesn't work.
#
# C.f. https://mesonbuild.com/Reference-tables.html#cpu-families
# and src/basic/missing_syscall_def.h.
cpu_arch_defines = {
'ppc' : [ '-D__powerpc__' ] ,
'ppc64' : [ '-D__powerpc64__' , '-D_CALL_ELF=2' ] ,
'riscv32' : [ '-D__riscv' , '-D__riscv_xlen=32' ] ,
'riscv64' : [ '-D__riscv' , '-D__riscv_xlen=64' ] ,
'x86' : [ '-D__i386__' ] ,
# For arm, assume hardware fp is available.
'arm' : [ '-D__arm__' , '-D__ARM_PCS_VFP' ] ,
}
bpf_arch_flags = cpu_arch_defines . get ( host_machine . cpu_family ( ) ,
[ '-D__@0@__' . format ( host_machine . cpu_family ( ) ) ] )
if bpf_compiler == 'gcc'
bpf_arch_flags + = [ '-m' + host_machine . endian ( ) + '-endian' ]
endif
libbpf_include_dir = libbpf . get_variable ( pkgconfig : 'includedir' )
bpf_o_unstripped_cmd = [ ]
if bpf_compiler == 'clang'
bpf_o_unstripped_cmd + = [
clang ,
bpf_clang_flags ,
bpf_arch_flags ,
]
elif bpf_compiler == 'gcc'
bpf_o_unstripped_cmd + = [
bpf_gcc ,
bpf_gcc_flags ,
bpf_arch_flags ,
]
endif
bpf_o_unstripped_cmd + = [ '-I.' ]
2024-03-22 20:26:45 +08:00
if not meson . is_cross_build ( )
2023-03-16 22:36:26 +08:00
target_triplet_cmd = run_command ( 'gcc' , '-dumpmachine' , check : false )
if target_triplet_cmd . returncode ( ) == 0
target_triplet = target_triplet_cmd . stdout ( ) . strip ( )
bpf_o_unstripped_cmd + = [
'-isystem' ,
'/usr/include/@0@' . format ( target_triplet )
]
endif
endif
bpf_o_unstripped_cmd + = [
'-idirafter' ,
libbpf_include_dir ,
'@INPUT@' ,
'-o' ,
'@OUTPUT@'
]
if bpftool_strip
bpf_o_cmd = [
bpftool ,
'gen' ,
'object' ,
'@OUTPUT@' ,
'@INPUT@'
]
elif bpf_compiler == 'clang'
bpf_o_cmd = [
llvm_strip ,
'-g' ,
'@INPUT@' ,
'-o' ,
'@OUTPUT@'
]
endif
skel_h_cmd = [
bpftool ,
'gen' ,
'skeleton' ,
'@INPUT@'
]
endif
2023-02-26 21:09:44 +08:00
#####################################################################
efi_arch = {
2023-03-01 01:05:18 +08:00
'aarch64' : 'aa64' ,
'arm' : 'arm' ,
'loongarch32' : 'loongarch32' ,
'loongarch64' : 'loongarch64' ,
'riscv32' : 'riscv32' ,
'riscv64' : 'riscv64' ,
'x86_64' : 'x64' ,
'x86' : 'ia32' ,
2023-02-26 21:09:44 +08:00
} . get ( host_machine . cpu_family ( ) , '' )
2023-08-10 21:44:11 +08:00
pyelftools = pymod . find_installation ( 'python3' ,
required : get_option ( 'bootloader' ) ,
modules : [ 'elftools' ] )
have = get_option ( 'bootloader' ) . require (
pyelftools . found ( ) and get_option ( 'efi' ) and efi_arch != '' ,
error_message : 'unsupported EFI arch or EFI support is disabled' ) . allowed ( )
conf . set10 ( 'ENABLE_BOOTLOADER' , have )
conf . set_quoted ( 'EFI_MACHINE_TYPE_NAME' , have ? efi_arch : '' )
2023-02-27 23:54:48 +08:00
efi_arch_alt = ''
2023-07-10 01:30:27 +08:00
efi_cpu_family_alt = ''
2023-08-10 21:44:11 +08:00
if have and efi_arch == 'x64' and cc . links ( '' '
2023-02-27 23:54:48 +08:00
#include <limits.h>
int main ( int argc , char * argv [ ] ) {
return __builtin_popcount ( argc - CHAR_MAX ) ;
} '' ', args : [' - m32 ', ' - march = i686 '], name : ' 32 bit build possible ' )
efi_arch_alt = 'ia32'
2023-07-10 01:30:27 +08:00
efi_cpu_family_alt = 'x86'
2023-02-27 23:54:48 +08:00
endif
2023-12-23 16:56:31 +08:00
pefile = pymod . find_installation ( 'python3' , required : false , modules : [ 'pefile' ] )
want_ukify = get_option ( 'ukify' ) . require ( python_39 and ( want_tests != 'true' or pefile . found ( ) ) , error_message : 'Python >= 3.9 and pefile required' ) . allowed ( )
2023-02-01 04:43:53 +08:00
conf . set10 ( 'ENABLE_UKIFY' , want_ukify )
2023-12-15 05:35:00 +08:00
#####################################################################
2023-05-05 15:36:00 +08:00
2024-03-22 20:35:38 +08:00
check_efi_alignment_py = find_program ( 'tools/check-efi-alignment.py' )
2023-12-07 01:37:31 +08:00
#####################################################################
use_provided_vmlinux_h = false
use_generated_vmlinux_h = false
provided_vmlinux_h_path = get_option ( 'vmlinux-h-path' )
# For the more complex BPF programs we really want a vmlinux.h (which is arch
# specific, but only somewhat bound to kernel version). Ideally the kernel
# development headers would ship that, but right now they don't. Hence address
# this in two ways:
#
# 1. Provide a vmlinux.h at build time
# 2. Generate the file on the fly where possible (which requires /sys/ to be mounted)
#
# We generally prefer the former (to support reproducible builds), but will
# fallback to the latter.
if conf . get ( 'BPF_FRAMEWORK' ) == 1
enable_vmlinux_h = get_option ( 'vmlinux-h' )
if enable_vmlinux_h == 'auto'
if provided_vmlinux_h_path != ''
use_provided_vmlinux_h = true
elif fs . exists ( '/sys/kernel/btf/vmlinux' ) and \
bpftool . found ( ) and \
( host_machine . cpu_family ( ) == build_machine . cpu_family ( ) ) and \
host_machine . cpu_family ( ) in [ 'x86_64' , 'aarch64' ]
# We will only generate a vmlinux.h from the running
# kernel if the host and build machine are of the same
# family. Also for now we focus on x86_64 and aarch64,
# since other archs don't seem to be ready yet.
use_generated_vmlinux_h = true
endif
elif enable_vmlinux_h == 'provided'
use_provided_vmlinux_h = true
elif enable_vmlinux_h == 'generated'
if not fs . exists ( '/sys/kernel/btf/vmlinux' )
error ( 'BTF data from kernel not available (/sys/kernel/btf/vmlinux missing), cannot generate vmlinux.h, but was asked to.' )
endif
if not bpftool . found ( )
error ( 'bpftool not available, cannot generate vmlinux.h, but was asked to.' )
endif
use_generated_vmlinux_h = true
endif
endif
if use_provided_vmlinux_h
if not fs . exists ( provided_vmlinux_h_path )
error ( 'Path to provided vmlinux.h does not exist.' )
endif
vmlinux_h_dependency = [ ]
bpf_o_unstripped_cmd + = [ '-I' + fs . parent ( provided_vmlinux_h_path ) ]
message ( 'Using provided @0@' . format ( provided_vmlinux_h_path ) )
elif use_generated_vmlinux_h
vmlinux_h_dependency = custom_target (
'vmlinux.h' ,
output : 'vmlinux.h' ,
command : [ bpftool , 'btf' , 'dump' , 'file' , '/sys/kernel/btf/vmlinux' , 'format' , 'c' ] ,
capture : true )
bpf_o_unstripped_cmd + = [ '-I' + fs . parent ( vmlinux_h_dependency . full_path ( ) ) ]
message ( 'Using generated @0@' . format ( vmlinux_h_dependency . full_path ( ) ) )
else
message ( 'Using neither provided nor generated vmlinux.h, some features will not be available.' )
endif
conf . set10 ( 'HAVE_VMLINUX_H' , use_provided_vmlinux_h or use_generated_vmlinux_h )
#####################################################################
2023-09-27 01:25:06 +08:00
check_version_history_py = find_program ( 'tools/check-version-history.py' )
2023-02-27 23:54:48 +08:00
elf2efi_py = find_program ( 'tools/elf2efi.py' )
export_dbus_interfaces_py = find_program ( 'tools/dbus_exporter.py' )
2021-01-27 21:04:14 +08:00
generate_gperfs = find_program ( 'tools/generate-gperfs.py' )
2021-01-04 19:47:00 +08:00
make_autosuspend_rules_py = find_program ( 'tools/make-autosuspend-rules.py' )
make_directive_index_py = find_program ( 'tools/make-directive-index.py' )
2023-10-04 03:00:19 +08:00
sync_docs_py = find_program ( 'tools/sync-docs.py' )
2021-01-04 19:47:00 +08:00
make_man_index_py = find_program ( 'tools/make-man-index.py' )
meson: replace some m4 templates with jinja2
m4 was nice in '85, but the syntax feels a bit dated. Since we use python for
meson, let's use a popular python templating engine to replace some m4 usage.
A little nicety is that typos are caught:
FAILED: sysusers.d/systemd-remote.conf
/usr/bin/meson --internal exe --capture sysusers.d/systemd-remote.conf -- /home/zbyszek/src/systemd/tools/meson-render-jinja2.py config.h ../sysusers.d/systemd-remote.conf.j2
Traceback (most recent call last):
File "/home/zbyszek/src/systemd/tools/meson-render-jinja2.py", line 28, in <module>
print(render(sys.argv[2], defines))
File "/home/zbyszek/src/systemd/tools/meson-render-jinja2.py", line 24, in render
return template.render(defines)
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 8, in top-level template code
jinja2.exceptions.UndefinedError: 'HAVE_MICROHTTP' is undefined
This checking mirrors what 349cc4a507c4d84fcadf61f42159ea6412717896 did for C defines.
2021-05-16 17:55:36 +08:00
meson_render_jinja2 = find_program ( 'tools/meson-render-jinja2.py' )
2021-01-27 21:04:14 +08:00
update_dbus_docs_py = find_program ( 'tools/update-dbus-docs.py' )
update_hwdb_autosuspend_sh = find_program ( 'tools/update-hwdb-autosuspend.sh' )
2023-02-27 23:54:48 +08:00
update_hwdb_sh = find_program ( 'tools/update-hwdb.sh' )
update_man_rules_py = find_program ( 'tools/update-man-rules.py' )
2021-01-27 21:04:14 +08:00
update_syscall_tables_sh = find_program ( 'tools/update-syscall-tables.sh' )
xml_helper_py = find_program ( 'tools/xml_helper.py' )
2021-01-04 19:47:00 +08:00
2023-12-15 05:35:00 +08:00
#####################################################################
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-07-29 21:41:43 +08:00
version_tag = get_option ( 'version-tag' )
2024-02-16 23:58:58 +08:00
if version_tag == ''
version_tag = meson . project_version ( )
endif
conf . set_quoted ( 'VERSION_TAG' , version_tag )
vcs_tag = get_option ( 'vcs-tag' )
2024-03-14 01:33:59 +08:00
command = [ 'sh' , '-c' ,
vcs_tag and fs . exists ( project_source_root / '.git' ) ?
'echo "-g$(git -C . describe --abbrev=7 --match="" --always --dirty=^)"' : ':' ]
version_h = vcs_tag (
input : 'src/version/version.h.in' ,
output : 'version.h' ,
fallback : '' ,
command : command ,
)
2023-07-29 21:41:43 +08:00
shared_lib_tag = get_option ( 'shared-lib-tag' )
if shared_lib_tag == ''
2024-02-14 18:04:36 +08:00
shared_lib_tag = meson . project_version ( ) . split ( '~' ) [ 0 ]
2023-07-29 21:41:43 +08:00
endif
2023-12-15 05:35:00 +08:00
#####################################################################
2023-07-29 21:41:43 +08:00
2022-04-08 19:20:15 +08:00
if get_option ( 'b_coverage' )
2023-02-26 18:07:24 +08:00
userspace_c_args + = [ '-include' , 'src/basic/coverage.h' ]
2022-04-08 19:20:15 +08:00
endif
2023-12-15 05:35:00 +08:00
#####################################################################
2022-04-08 19:20:15 +08:00
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
config_h = configure_file (
2017-04-18 07:25:00 +08:00
output : 'config.h' ,
configuration : conf )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-02-26 18:07:24 +08:00
userspace_c_args + = [ '-include' , 'config.h' ]
2021-01-04 19:47:00 +08:00
2024-03-06 22:16:52 +08:00
jinja2_cmdline = [ meson_render_jinja2 , config_h ]
2022-04-05 22:52:44 +08:00
2023-02-26 18:07:24 +08:00
userspace = declare_dependency (
compile_args : userspace_c_args ,
link_args : userspace_c_ld_args ,
2023-08-28 19:46:24 +08:00
sources : version_h ,
2023-02-26 18:07:24 +08:00
)
2023-05-30 19:02:57 +08:00
man_page_depends = [ ]
2023-12-15 05:35:00 +08:00
#####################################################################
2018-05-07 17:17:35 +08:00
2023-06-23 10:00:17 +08:00
simple_tests = [ ]
2023-06-26 07:52:26 +08:00
libsystemd_tests = [ ]
2023-06-23 10:00:17 +08:00
simple_fuzzers = [ ]
catalogs = [ ]
2023-06-23 10:09:10 +08:00
modules = [ ] # nss, pam, and other plugins
executables = [ ]
executables_by_name = { }
2023-06-27 00:07:25 +08:00
fuzzer_exes = [ ]
2023-06-23 10:00:17 +08:00
2021-01-04 20:27:00 +08:00
# binaries that have --help and are intended for use by humans,
# usually, but not always, installed in /bin.
public_programs = [ ]
2021-07-24 15:30:42 +08:00
# D-Bus introspection XML export
dbus_programs = [ ]
2023-04-15 00:45:24 +08:00
# A list of boot stubs. Required for testing of ukify.
boot_stubs = [ ]
2023-08-26 17:36:02 +08:00
build_dir_include = include_directories ( '.' )
2021-01-04 22:36:00 +08:00
basic_includes = include_directories (
'src/basic' ,
2021-02-04 02:21:08 +08:00
'src/fundamental' ,
2021-01-04 22:36:00 +08:00
'src/systemd' ,
'.' )
libsystemd_includes = [ basic_includes , include_directories (
'src/libsystemd/sd-bus' ,
'src/libsystemd/sd-device' ,
'src/libsystemd/sd-event' ,
'src/libsystemd/sd-hwdb' ,
'src/libsystemd/sd-id128' ,
'src/libsystemd/sd-journal' ,
'src/libsystemd/sd-netlink' ,
'src/libsystemd/sd-network' ,
'src/libsystemd/sd-resolve' ) ]
includes = [ libsystemd_includes , include_directories ( 'src/shared' ) ]
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
subdir ( 'po' )
subdir ( 'catalog' )
2023-02-26 21:09:44 +08:00
subdir ( 'src/fundamental' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
subdir ( 'src/basic' )
subdir ( 'src/libsystemd' )
2021-01-04 20:13:30 +08:00
subdir ( 'src/shared' )
subdir ( 'src/libudev' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
libsystemd = shared_library (
2017-04-18 07:25:00 +08:00
'systemd' ,
2017-09-29 01:24:16 +08:00
version : libsystemd_version ,
2021-01-04 22:36:00 +08:00
include_directories : libsystemd_includes ,
2017-04-18 07:25:00 +08:00
link_args : [ '-shared' ,
'-Wl,--version-script=' + libsystemd_sym_path ] ,
2024-03-30 07:36:51 +08:00
link_with : [ libbasic ] ,
2021-01-01 03:30:47 +08:00
link_whole : [ libsystemd_static ] ,
2023-02-26 18:07:24 +08:00
dependencies : [ librt ,
threads ,
userspace ] ,
2017-04-18 07:25:00 +08:00
link_depends : libsystemd_sym ,
install : true ,
2022-04-27 17:54:14 +08:00
install_tag : 'libsystemd' ,
2023-06-12 09:15:19 +08:00
install_dir : libdir )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2022-06-12 01:34:08 +08:00
alias_target ( 'libsystemd' , libsystemd )
2018-04-09 17:43:35 +08:00
install_libsystemd_static = static_library (
'systemd' ,
libsystemd_sources ,
meson: recompile all sources for install_libudev_static and install_libsystemd_static
This means that when those targets are built, all the sources are built again,
instead of reusing the work done to create libbasic.a and other convenience static
libraries. It would be nice to not do this, but there seems to be no support in
our toolchain for joining multiple static libraries into one. When linking
a static library, any -l arguments are simply ignored by ar/gcc-ar, and .a
libraries given as positional arguments are copied verbatim into the archive
so they objects in them cannot be accessed.
https://stackoverflow.com/questions/2157629/linking-static-libraries-to-other-static-libraries
suggests either unzipping all the archives and putting them back togather,
or using a linker script. Unzipping and zipping back together seems ugly.
The other option is not very nice. The linker script language does not
allow "+" to appear in the filenames, and filenames that meson generates
use that, so files would have to be renamed before a linker script was used.
And we would have to generate the linker script on the fly. Either way, this
doesn't seem attractive. Since those static libraries are a niche use case,
it seems reasonable to just go with the easiest and safest solution and
recompile all the source files. Thanks to ccache, this is probably almost as
cheap as actually reusing the convenience .a libraries.
test-libsystemd-sym.c and test-libudev-sym.c compile fine with the generated
static libs, so it seems that they indeed provide all the symbols they should.
2018-04-25 21:29:48 +08:00
basic_sources ,
2021-02-04 02:21:08 +08:00
fundamental_sources ,
2021-01-04 22:36:00 +08:00
include_directories : libsystemd_includes ,
2018-04-09 17:43:35 +08:00
build_by_default : static_libsystemd != 'false' ,
install : static_libsystemd != 'false' ,
2022-04-27 17:54:14 +08:00
install_tag : 'libsystemd' ,
2023-06-12 09:15:19 +08:00
install_dir : libdir ,
2021-01-05 13:51:17 +08:00
pic : static_libsystemd_pic ,
2023-02-26 18:07:24 +08:00
dependencies : [ libblkid ,
meson: recompile all sources for install_libudev_static and install_libsystemd_static
This means that when those targets are built, all the sources are built again,
instead of reusing the work done to create libbasic.a and other convenience static
libraries. It would be nice to not do this, but there seems to be no support in
our toolchain for joining multiple static libraries into one. When linking
a static library, any -l arguments are simply ignored by ar/gcc-ar, and .a
libraries given as positional arguments are copied verbatim into the archive
so they objects in them cannot be accessed.
https://stackoverflow.com/questions/2157629/linking-static-libraries-to-other-static-libraries
suggests either unzipping all the archives and putting them back togather,
or using a linker script. Unzipping and zipping back together seems ugly.
The other option is not very nice. The linker script language does not
allow "+" to appear in the filenames, and filenames that meson generates
use that, so files would have to be renamed before a linker script was used.
And we would have to generate the linker script on the fly. Either way, this
doesn't seem attractive. Since those static libraries are a niche use case,
it seems reasonable to just go with the easiest and safest solution and
recompile all the source files. Thanks to ccache, this is probably almost as
cheap as actually reusing the convenience .a libraries.
test-libsystemd-sym.c and test-libudev-sym.c compile fine with the generated
static libs, so it seems that they indeed provide all the symbols they should.
2018-04-25 21:29:48 +08:00
libcap ,
2023-02-26 18:07:24 +08:00
libdl ,
2024-03-30 07:36:51 +08:00
libgcrypt_cflags ,
2024-02-28 04:28:14 +08:00
liblz4_cflags ,
2023-02-26 18:07:24 +08:00
libmount ,
2022-11-08 20:37:27 +08:00
libopenssl ,
2023-02-26 18:07:24 +08:00
librt ,
2024-02-28 04:28:14 +08:00
libxz_cflags ,
libzstd_cflags ,
2023-02-26 18:07:24 +08:00
threads ,
2023-07-29 21:28:58 +08:00
userspace ] ,
2018-04-09 17:43:35 +08:00
c_args : libsystemd_c_args + ( static_libsystemd_pic ? [ ] : [ '-fno-PIC' ] ) )
2021-01-04 20:13:30 +08:00
libudev = shared_library (
'udev' ,
version : libudev_version ,
include_directories : includes ,
link_args : [ '-shared' ,
'-Wl,--version-script=' + libudev_sym_path ] ,
link_with : [ libsystemd_static , libshared_static ] ,
link_whole : libudev_basic ,
2023-02-26 18:07:24 +08:00
dependencies : [ threads ,
userspace ] ,
2021-01-04 20:13:30 +08:00
link_depends : libudev_sym ,
install : true ,
2022-04-27 17:54:14 +08:00
install_tag : 'libudev' ,
2023-06-12 09:15:19 +08:00
install_dir : libdir )
2021-01-04 20:13:30 +08:00
2022-06-12 01:34:08 +08:00
alias_target ( 'libudev' , libudev )
2021-01-04 20:13:30 +08:00
install_libudev_static = static_library (
'udev' ,
basic_sources ,
2021-02-04 02:21:08 +08:00
fundamental_sources ,
2021-01-04 20:13:30 +08:00
shared_sources ,
libsystemd_sources ,
libudev_sources ,
include_directories : includes ,
build_by_default : static_libudev != 'false' ,
install : static_libudev != 'false' ,
2022-04-27 17:54:14 +08:00
install_tag : 'libudev' ,
2023-06-12 09:15:19 +08:00
install_dir : libdir ,
2021-01-04 20:13:30 +08:00
link_depends : libudev_sym ,
2023-02-26 18:07:24 +08:00
dependencies : [ libmount ,
libshared_deps ,
2023-07-29 21:28:58 +08:00
userspace ] ,
2021-01-04 20:13:30 +08:00
c_args : static_libudev_pic ? [ ] : [ '-fno-PIC' ] ,
pic : static_libudev_pic )
2023-12-15 05:35:00 +08:00
#####################################################################
2020-08-18 22:27:20 +08:00
2023-06-26 07:52:26 +08:00
runtest_env = custom_target (
'systemd-runtest.env' ,
output : 'systemd-runtest.env' ,
command : [ sh , '-c' ,
'{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@' . format (
project_source_root / 'test' ,
project_build_root / 'catalog' ) ] ,
depends : catalogs ,
build_by_default : true )
test_cflags = [ '-DTEST_CODE=1' ]
# We intentionally do not do inline initializations with definitions for a
# bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
# use the variable unexpectedly. This triggers a lot of maybe-uninitialized
# false positives when the combination of -O2 and -flto is used. Suppress them.
if '-O2' in c_args and '-flto=auto' in c_args
test_cflags + = cc . first_supported_argument ( '-Wno-maybe-uninitialized' )
endif
2023-12-15 05:35:00 +08:00
#####################################################################
2023-06-26 07:52:26 +08:00
2023-06-23 10:09:10 +08:00
executable_template = {
'include_directories' : includes ,
'link_with' : libshared ,
'install_rpath' : pkglibdir ,
'install' : true ,
}
generator_template = executable_template + {
'install_dir' : systemgeneratordir ,
}
libexec_template = executable_template + {
'install_dir' : libexecdir ,
}
executable_additional_kwargs = {
'dependencies' : userspace ,
}
2023-06-26 07:52:26 +08:00
test_template = executable_template + {
'build_by_default' : want_tests != 'false' ,
'install' : install_tests ,
'install_dir' : unittestsdir ,
}
test_additional_kwargs = {
'c_args' : test_cflags ,
'link_depends' : runtest_env ,
}
2023-06-27 00:07:25 +08:00
fuzz_template = executable_template + {
'build_by_default' : fuzzer_build ,
'install' : false ,
}
if want_ossfuzz or ( want_libfuzzer and fuzzing_engine . found ( ) )
fuzz_additional_kwargs = {
'dependencies' : fuzzing_engine ,
}
elif want_libfuzzer and not fuzzing_engine . found ( )
fuzz_additional_kwargs = {
'link_args' : [ '-fsanitize=fuzzer' ] ,
}
else
fuzz_additional_kwargs = {
'sources' : files ( 'src/fuzz/fuzz-main.c' ) ,
}
endif
fuzz_additional_kwargs + = {
'include_directories' : include_directories ( 'src/fuzz' ) ,
'c_args' : test_cflags ,
}
2023-06-23 10:09:10 +08:00
nss_template = {
'version' : '2' ,
'include_directories' : includes ,
# Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
'link_args' : [ '-z' , 'nodelete' ] ,
'link_with' : [
libsystemd_static ,
libshared_static ,
libbasic ,
] ,
'dependencies' : [
librt ,
threads ,
] ,
'install' : true ,
'install_tag' : 'nss' ,
'install_dir' : libdir ,
}
pam_template = {
'name_prefix' : '' ,
'include_directories' : includes ,
'link_with' : [
libsystemd_static ,
libshared_static ,
] ,
'dependencies' : [
libpam_misc ,
libpam ,
threads ,
] ,
'install' : true ,
'install_tag' : 'pam' ,
'install_dir' : pamlibdir ,
}
module_additional_kwargs = {
'link_args' : [ '-shared' ] ,
'dependencies' : userspace ,
}
2023-12-15 05:35:00 +08:00
#####################################################################
2023-06-23 10:09:10 +08:00
2021-01-04 20:27:00 +08:00
# systemd-analyze requires 'libcore'
2017-04-15 08:10:28 +08:00
subdir ( 'src/core' )
2021-01-04 20:27:00 +08:00
# systemd-networkd requires 'libsystemd_network'
subdir ( 'src/libsystemd-network' )
2023-06-26 02:35:47 +08:00
# hwdb requires 'udev_link_with' and 'udev_rpath'
subdir ( 'src/udev' )
2017-04-15 08:10:28 +08:00
2023-06-25 15:28:21 +08:00
subdir ( 'src/ac-power' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/analyze' )
2023-06-26 02:18:38 +08:00
subdir ( 'src/ask-password' )
2023-06-25 14:55:33 +08:00
subdir ( 'src/backlight' )
2023-06-25 15:31:06 +08:00
subdir ( 'src/battery-check' )
2023-06-25 15:10:00 +08:00
subdir ( 'src/binfmt' )
2023-01-23 21:41:26 +08:00
subdir ( 'src/boot' )
2023-02-26 21:09:44 +08:00
subdir ( 'src/boot/efi' )
2021-01-04 19:35:33 +08:00
subdir ( 'src/busctl' )
2023-06-26 02:21:42 +08:00
subdir ( 'src/cgls' )
2023-06-25 15:34:27 +08:00
subdir ( 'src/cgroups-agent' )
2023-06-26 02:21:42 +08:00
subdir ( 'src/cgtop' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/coredump' )
2023-06-25 15:31:06 +08:00
subdir ( 'src/creds' )
2021-01-04 19:29:01 +08:00
subdir ( 'src/cryptenroll' )
2021-01-04 19:26:20 +08:00
subdir ( 'src/cryptsetup' )
2023-06-25 14:20:29 +08:00
subdir ( 'src/debug-generator' )
2023-06-25 15:31:06 +08:00
subdir ( 'src/delta' )
2023-06-25 15:28:21 +08:00
subdir ( 'src/detect-virt' )
2023-06-25 14:34:09 +08:00
subdir ( 'src/dissect' )
2023-06-25 14:20:29 +08:00
subdir ( 'src/environment-d-generator' )
2023-06-25 15:31:06 +08:00
subdir ( 'src/escape' )
2023-06-25 15:21:17 +08:00
subdir ( 'src/firstboot' )
subdir ( 'src/fsck' )
2023-06-25 14:20:29 +08:00
subdir ( 'src/fstab-generator' )
subdir ( 'src/getty-generator' )
2023-06-25 14:34:09 +08:00
subdir ( 'src/gpt-auto-generator' )
2023-06-25 14:31:38 +08:00
subdir ( 'src/hibernate-resume' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/home' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/hostname' )
2023-06-26 02:28:32 +08:00
subdir ( 'src/hwdb' )
2023-06-25 15:34:27 +08:00
subdir ( 'src/id128' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/import' )
2023-06-26 02:21:42 +08:00
subdir ( 'src/initctl' )
2023-06-25 14:57:47 +08:00
subdir ( 'src/integritysetup' )
2023-09-30 18:08:23 +08:00
subdir ( 'src/journal' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/journal-remote' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/kernel-install' )
subdir ( 'src/locale' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/login' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/machine' )
2023-06-25 15:21:17 +08:00
subdir ( 'src/machine-id-setup' )
2023-03-09 19:27:29 +08:00
subdir ( 'src/mountfsd' )
2023-06-26 02:38:48 +08:00
subdir ( 'src/modules-load' )
2023-06-26 02:21:42 +08:00
subdir ( 'src/mount' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/network' )
2023-06-25 15:31:06 +08:00
subdir ( 'src/notify' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/nspawn' )
2023-04-21 01:07:33 +08:00
subdir ( 'src/nsresourced' )
2023-06-23 10:28:22 +08:00
subdir ( 'src/nss-myhostname' )
subdir ( 'src/nss-mymachines' )
subdir ( 'src/nss-resolve' )
subdir ( 'src/nss-systemd' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/oom' )
subdir ( 'src/partition' )
2023-06-25 15:34:27 +08:00
subdir ( 'src/path' )
pcrphase: rename binary to pcrextend
The tool initially just measured the boot phase, but was subsequently
extended to measure file system and machine IDs, too. At AllSystemsGo
there were request to add more, and make the tool generically
accessible.
Hence, let's rename the binary (but not the pcrphase services), to make
clear the tool is not just measureing the boot phase, but a lot of other
things too.
The tool is located in /usr/lib/ and still relatively new, hence let's
just rename the binary and be done with it, while keeping the unit names
stable.
While we are at it, also move the tool out of src/boot/ and into its own
src/pcrextend/ dir, since it's not really doing boot related stuff
anymore.
2023-09-25 16:38:01 +08:00
subdir ( 'src/pcrextend' )
2023-08-16 17:39:23 +08:00
subdir ( 'src/pcrlock' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/portable' )
subdir ( 'src/pstore' )
2023-06-26 02:35:47 +08:00
subdir ( 'src/quotacheck' )
2023-06-25 15:11:55 +08:00
subdir ( 'src/random-seed' )
2023-06-25 14:59:49 +08:00
subdir ( 'src/rc-local-generator' )
2023-06-25 15:21:17 +08:00
subdir ( 'src/remount-fs' )
2023-06-26 02:18:38 +08:00
subdir ( 'src/reply-password' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/resolve' )
2023-06-25 14:55:33 +08:00
subdir ( 'src/rfkill' )
2021-02-01 00:16:32 +08:00
subdir ( 'src/rpm' )
2023-06-26 02:23:59 +08:00
subdir ( 'src/run' )
2023-06-25 14:20:29 +08:00
subdir ( 'src/run-generator' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/shutdown' )
2023-06-25 15:28:21 +08:00
subdir ( 'src/sleep' )
2023-06-25 14:42:23 +08:00
subdir ( 'src/socket-activate' )
2023-06-26 02:35:47 +08:00
subdir ( 'src/socket-proxy' )
2024-01-05 01:39:03 +08:00
subdir ( 'src/ssh-generator' )
2023-06-26 02:23:59 +08:00
subdir ( 'src/stdio-bridge' )
2023-06-26 02:44:39 +08:00
subdir ( 'src/sulogin-shell' )
2023-06-25 15:28:21 +08:00
subdir ( 'src/sysctl' )
2021-01-08 23:57:27 +08:00
subdir ( 'src/sysext' )
2023-06-25 14:55:33 +08:00
subdir ( 'src/system-update-generator' )
2021-01-04 19:12:28 +08:00
subdir ( 'src/systemctl' )
2020-12-28 22:17:54 +08:00
subdir ( 'src/sysupdate' )
2023-06-26 02:28:32 +08:00
subdir ( 'src/sysusers' )
2023-06-25 14:59:49 +08:00
subdir ( 'src/sysv-generator' )
storagetm: add new systemd-storagetm component
This implements a "storage target mode", similar to what MacOS provides
since a long time as "Target Disk Mode":
https://en.wikipedia.org/wiki/Target_Disk_Mode
This implementation is relatively simple:
1. a new generic target "storage-target-mode.target" is added, which
when booted into defines the target mode.
2. a small tool and service "systemd-storagetm.service" is added which
exposes a specific device or all devices as NVMe-TCP devices over the
network. NVMe-TCP appears to be hot shit right now how to expose
block devices over the network. And it's really simple to set up via
configs, hence our code is relatively short and neat.
The idea is that systemd-storagetm.target can be extended sooner or
later, for example to expose block devices also as USB mass storage
devices and similar, in case the system has "dual mode" USB controller
that can also work as device, not just as host. (And people could also
plug in sharing as NBD, iSCSI, whatever they want.)
How to use this? Boot into your system with a kernel cmdline of
"rd.systemd.unit=storage-target-mode.target ip=link-local", and you'll see on
screen the precise "nvme connect" command line to make the relevant
block devices available locally on some other machine. This all requires
that the target mode stuff is included in the initrd of course. And the
system will the stay in the initrd forever.
Why bother? Primarily three use-cases:
1. Debug a broken system: with very few dependencies during boot get
access to the raw block device of a broken machine.
2. Migrate from system to another system, by dd'ing the old to the new
directly.
3. Installing an OS remotely on some device (for example via Thunderbolt
networking)
(And there might be more, for example the ability to boot from a
laptop's disk on another system)
Limitations:
1. There's no authentication/encryption. Hence: use this on local links
only.
2. NVMe target mode on Linux supports r/w operation only. Ideally, we'd
have a read-only mode, for security reasons, and default to it.
Future love:
1. We should have another mode, where we simply expose the homed LUKS
home dirs like that.
2. Some lightweight hookup with plymouth, to display a (shortened)
version of the info we write to the console.
To test all this, just run:
mkosi --kernel-command-line-extra="rd.systemd.unit=storage-target-mode.target" qemu
2023-10-27 20:25:49 +08:00
subdir ( 'src/storagetm' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/timedate' )
subdir ( 'src/timesync' )
2020-06-04 05:49:53 +08:00
subdir ( 'src/tmpfiles' )
storagetm: add new systemd-storagetm component
This implements a "storage target mode", similar to what MacOS provides
since a long time as "Target Disk Mode":
https://en.wikipedia.org/wiki/Target_Disk_Mode
This implementation is relatively simple:
1. a new generic target "storage-target-mode.target" is added, which
when booted into defines the target mode.
2. a small tool and service "systemd-storagetm.service" is added which
exposes a specific device or all devices as NVMe-TCP devices over the
network. NVMe-TCP appears to be hot shit right now how to expose
block devices over the network. And it's really simple to set up via
configs, hence our code is relatively short and neat.
The idea is that systemd-storagetm.target can be extended sooner or
later, for example to expose block devices also as USB mass storage
devices and similar, in case the system has "dual mode" USB controller
that can also work as device, not just as host. (And people could also
plug in sharing as NBD, iSCSI, whatever they want.)
How to use this? Boot into your system with a kernel cmdline of
"rd.systemd.unit=storage-target-mode.target ip=link-local", and you'll see on
screen the precise "nvme connect" command line to make the relevant
block devices available locally on some other machine. This all requires
that the target mode stuff is included in the initrd of course. And the
system will the stay in the initrd forever.
Why bother? Primarily three use-cases:
1. Debug a broken system: with very few dependencies during boot get
access to the raw block device of a broken machine.
2. Migrate from system to another system, by dd'ing the old to the new
directly.
3. Installing an OS remotely on some device (for example via Thunderbolt
networking)
(And there might be more, for example the ability to boot from a
laptop's disk on another system)
Limitations:
1. There's no authentication/encryption. Hence: use this on local links
only.
2. NVMe target mode on Linux supports r/w operation only. Ideally, we'd
have a read-only mode, for security reasons, and default to it.
Future love:
1. We should have another mode, where we simply expose the homed LUKS
home dirs like that.
2. Some lightweight hookup with plymouth, to display a (shortened)
version of the info we write to the console.
To test all this, just run:
mkosi --kernel-command-line-extra="rd.systemd.unit=storage-target-mode.target" qemu
2023-10-27 20:25:49 +08:00
subdir ( 'src/tpm2-setup' )
2023-06-26 02:18:38 +08:00
subdir ( 'src/tty-ask-password-agent' )
2023-06-26 02:38:48 +08:00
subdir ( 'src/update-done' )
subdir ( 'src/update-utmp' )
2023-06-25 14:39:45 +08:00
subdir ( 'src/user-sessions' )
2021-01-04 20:27:00 +08:00
subdir ( 'src/userdb' )
2023-09-23 04:44:28 +08:00
subdir ( 'src/varlinkctl' )
2023-06-25 15:11:55 +08:00
subdir ( 'src/vconsole' )
2023-06-25 14:57:47 +08:00
subdir ( 'src/veritysetup' )
2023-10-12 20:13:19 +08:00
subdir ( 'src/vmspawn' )
2023-06-25 15:34:27 +08:00
subdir ( 'src/volatile-root' )
2023-03-04 01:26:45 +08:00
subdir ( 'src/vpick' )
2021-01-04 19:41:37 +08:00
subdir ( 'src/xdg-autostart-generator' )
2017-04-15 08:10:28 +08:00
2021-01-04 20:13:30 +08:00
subdir ( 'src/systemd' )
2017-04-15 08:10:28 +08:00
subdir ( 'src/test' )
2018-01-14 08:51:07 +08:00
subdir ( 'src/fuzz' )
2022-11-26 00:21:40 +08:00
subdir ( 'src/ukify/test' ) # needs to be last for test_env variable
2023-06-27 00:07:25 +08:00
subdir ( 'test/fuzz' )
2017-04-15 08:10:28 +08:00
2023-11-20 18:51:47 +08:00
subdir ( 'mime' )
2023-06-12 07:41:49 +08:00
alias_target ( 'devel' , libsystemd_pc , libudev_pc , systemd_pc , udev_pc )
2023-12-15 05:35:00 +08:00
#####################################################################
2017-04-15 08:10:28 +08:00
2023-06-26 07:52:26 +08:00
foreach test : simple_tests
executables + = test_template + { 'sources' : [ test ] }
endforeach
foreach test : libsystemd_tests
executables + = test_template + test
endforeach
2023-06-27 00:07:25 +08:00
foreach fuzzer : simple_fuzzers
executables + = fuzz_template + { 'sources' : [ fuzzer ] }
endforeach
2023-06-23 10:09:10 +08:00
foreach dict : executables
2023-06-26 07:52:26 +08:00
name = dict . get ( 'name' , '' )
if name == ''
name = fs . stem ( dict . get ( 'sources' ) [ 0 ] )
2023-06-27 00:07:25 +08:00
assert ( name . split ( '-' ) [ 0 ] in [ 'test' , 'fuzz' ] )
2023-06-26 07:52:26 +08:00
endif
is_test = name . startswith ( 'test-' )
2023-06-27 00:07:25 +08:00
is_fuzz = name . startswith ( 'fuzz-' )
2023-06-23 10:09:10 +08:00
build = true
foreach cond : dict . get ( 'conditions' , [ ] )
if conf . get ( cond ) != 1
build = false
break
endif
endforeach
if not build
continue
endif
kwargs = { }
foreach key , val : dict
2023-06-26 07:52:26 +08:00
if key in [ 'name' , 'dbus' , 'public' , 'conditions' ,
'type' , 'suite' , 'timeout' , 'parallel' ]
2023-06-23 10:09:10 +08:00
continue
endif
2023-06-26 07:52:26 +08:00
2023-06-23 10:09:10 +08:00
kwargs + = { key : val }
endforeach
foreach key , val : executable_additional_kwargs
kwargs + = { key : [ kwargs . get ( key , [ ] ) , val ] }
endforeach
2023-06-26 07:52:26 +08:00
if is_test
kwargs + = { 'install_dir' : kwargs . get ( 'install_dir' ) / dict . get ( 'type' , '' ) }
foreach key , val : test_additional_kwargs
kwargs + = { key : [ kwargs . get ( key , [ ] ) , val ] }
endforeach
endif
2023-06-27 00:07:25 +08:00
if is_fuzz
foreach key , val : fuzz_additional_kwargs
kwargs + = { key : [ kwargs . get ( key , [ ] ) , val ] }
endforeach
endif
2023-06-23 10:09:10 +08:00
exe = executable (
name ,
kwargs : kwargs ,
)
executables_by_name + = { name : exe }
if dict . get ( 'build_by_default' , true )
if dict . get ( 'dbus' , false )
dbus_programs + = exe
endif
if dict . get ( 'public' , false )
public_programs + = exe
endif
endif
2023-06-26 07:52:26 +08:00
if is_test
type = dict . get ( 'type' , '' )
suite = dict . get ( 'suite' , '' )
if suite == ''
suite = fs . name ( fs . parent ( dict . get ( 'sources' ) [ 0 ] ) )
if suite . startswith ( 'sd-' )
suite = 'libsystemd'
endif
endif
if type == 'manual'
message ( '@0@/@1@ is a manual test' . format ( suite , name ) )
elif type == 'unsafe' and want_tests != 'unsafe'
message ( '@0@/@1@ is an unsafe test' . format ( suite , name ) )
elif dict . get ( 'build_by_default' )
test ( name , exe ,
env : test_env ,
timeout : dict . get ( 'timeout' , 30 ) ,
suite : suite ,
is_parallel : dict . get ( 'parallel' , true ) )
endif
endif
2023-06-27 00:07:25 +08:00
if is_fuzz
fuzzer_exes + = exe
if want_tests != 'false'
# Run the fuzz regression tests without any sanitizers enabled.
2023-09-02 22:23:22 +08:00
# Additional invocations with sanitizers may get added below.
2023-06-27 00:07:25 +08:00
fuzz_ins = fuzz_regression_tests . get ( name , { } )
foreach directive : fuzz_ins . get ( 'directives' , [ ] )
2023-09-02 22:23:22 +08:00
tt = '@0@_@1@' . format ( name , fs . name ( directive . full_path ( ) ) )
if tt . substring ( 45 ) != ''
error ( 'Directive sample name is too long:' , directive . full_path ( ) )
endif
test ( tt ,
2023-06-27 00:07:25 +08:00
exe ,
suite : 'fuzz' ,
args : directive . full_path ( ) ,
depends : directive )
endforeach
foreach file : fuzz_ins . get ( 'files' , [ ] )
2023-09-02 22:23:22 +08:00
tt = '@0@_@1@' . format ( name , fs . name ( file ) )
if tt . substring ( 45 ) != ''
error ( 'Fuzz sample name is too long:' , fs . name ( file ) )
endif
test ( tt ,
2023-06-27 00:07:25 +08:00
exe ,
suite : 'fuzz' ,
args : file )
endforeach
endif
endif
2023-06-23 10:09:10 +08:00
endforeach
2023-06-27 00:07:25 +08:00
alias_target ( 'fuzzers' , fuzzer_exes )
2023-12-15 05:35:00 +08:00
#####################################################################
2023-06-23 10:09:10 +08:00
2023-06-26 07:52:26 +08:00
test_dlopen = executables_by_name . get ( 'test-dlopen' )
2017-04-15 08:10:28 +08:00
2023-06-23 10:09:10 +08:00
foreach dict : modules
name = dict . get ( 'name' )
is_nss = name . startswith ( 'nss_' )
is_pam = name . startswith ( 'pam_' )
build = true
foreach cond : dict . get ( 'conditions' , [ ] )
if conf . get ( cond ) != 1
build = false
break
endif
endforeach
if not build
continue
endif
kwargs = { }
foreach key , val : dict
2023-09-26 21:14:38 +08:00
if key in [ 'name' , 'conditions' , 'version-script' ]
2023-06-23 10:09:10 +08:00
continue
endif
kwargs + = { key : val }
endforeach
kwargs + = {
'link_args' : [
kwargs . get ( 'link_args' , [ ] ) ,
2023-09-26 21:14:38 +08:00
'-Wl,--version-script=' + dict . get ( 'version-script' ) ,
] ,
'link_depends' : [
kwargs . get ( 'link_depends' , [ ] ) ,
dict . get ( 'version-script' ) ,
2023-06-23 10:09:10 +08:00
] ,
}
foreach key , val : module_additional_kwargs
kwargs + = { key : [ kwargs . get ( key , [ ] ) , val ] }
endforeach
lib = shared_library (
name ,
kwargs : kwargs ,
)
if is_nss
# We cannot use shared_module because it does not support version suffix.
# Unfortunately shared_library insists on creating the symlink…
meson: use 'sh' variable everywhere
We went back-and-forth a bit on this. Very old meson would print a message
about detecting the program if a quoted argument was used, leading to a lot of
noise. So we started to convert various places to use the variable, but then it
turned out that meson < 0.56.2 doesn't handle this correctly and we reverted to
using strings everywhere in 7c22f07cbd86b39e78990057687e5509fa299672. Then at
some point we stopped supporting old meson and over time we started using the
variable in various places again, somewhat inconsistently. Then most calls to
'sh' were removed in 9289e093ae6fd5484f9119e1ee07d1dffe37cd10 when
install_emptydir() builtin started being used.
Now meson allows either the string or variable to be used, and doesn't print a
message if the string is used. Let's use the variable everywhere. For 'sh', we
could do either, but for other variables, we _do_ want the detection to happen,
for example for git, find, awk, which might not be installed and we want to
detect that early, before we start the build. It would be ugly to use quotes
for some programs, but not for others. Also, a string is still refused for
test(), so we couldn't use the string version even if we didn't care about
detection.
2023-08-23 18:23:50 +08:00
meson . add_install_script ( sh , '-c' , 'rm $DESTDIR@0@/lib@1@.so' . format ( libdir , name ) ,
2023-06-23 10:09:10 +08:00
install_tag : 'nss' )
endif
if want_tests != 'false' and ( is_nss or is_pam )
test ( 'dlopen-' + name ,
test_dlopen ,
# path to dlopen must include a slash
args : lib . full_path ( ) ,
2023-06-27 00:28:32 +08:00
depends : lib ,
suite : is_nss ? 'nss' : 'pam' )
2023-06-23 10:09:10 +08:00
endif
endforeach
2023-12-15 05:35:00 +08:00
#####################################################################
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2023-04-14 00:11:39 +08:00
ukify = custom_target (
2022-11-16 22:52:47 +08:00
'ukify' ,
input : 'src/ukify/ukify.py' ,
output : 'ukify' ,
command : [ jinja2_cmdline , '@INPUT@' , '@OUTPUT@' ] ,
2023-04-15 00:10:58 +08:00
install : want_ukify ,
2022-11-16 22:52:47 +08:00
install_mode : 'rwxr-xr-x' ,
2023-08-28 23:22:43 +08:00
install_dir : bindir )
2023-04-15 00:10:58 +08:00
if want_ukify
2023-03-14 22:55:18 +08:00
public_programs + = ukify
2023-08-28 23:22:43 +08:00
2023-09-26 23:03:15 +08:00
# symlink for backwards compatibility after rename
2023-08-28 23:22:43 +08:00
meson . add_install_script ( sh , '-c' ,
ln_s . format ( bindir / 'ukify' ,
libexecdir / 'ukify' ) )
2023-04-14 00:11:39 +08:00
endif
2023-12-15 05:35:00 +08:00
#####################################################################
2017-04-07 12:19:09 +08:00
2024-04-19 15:17:58 +08:00
mkosi = find_program ( 'mkosi' , required : false )
2024-04-25 03:17:06 +08:00
if integration_tests and not mkosi . found ( )
error ( 'Could not find mkosi which is required to run the integration tests' )
endif
mkosi_depends = public_programs
foreach executable : [ 'systemd-journal-remote' , 'systemd-measure' ]
if executable in executables_by_name
mkosi_depends + = [ executables_by_name [ executable ] ]
endif
endforeach
2024-04-19 15:17:58 +08:00
if mkosi . found ( )
custom_target ( 'mkosi' ,
2024-04-06 00:19:59 +08:00
build_always_stale : true ,
2024-04-19 15:17:58 +08:00
build_by_default : false ,
2024-04-06 00:19:59 +08:00
console : true ,
2024-04-19 15:17:58 +08:00
output : '.' ,
command : [
'mkosi' ,
'--directory' , meson . current_source_dir ( ) ,
'--output-dir' , meson . current_build_dir ( ) / 'mkosi.output' ,
'--cache-dir' , meson . current_build_dir ( ) / 'mkosi.cache' ,
'--build-dir' , meson . current_build_dir ( ) / 'mkosi.builddir' ,
'--force' ,
2024-04-25 00:31:41 +08:00
'--debug' ,
2024-04-25 03:17:06 +08:00
'build' ,
2024-04-19 15:17:58 +08:00
] ,
2024-04-25 03:17:06 +08:00
depends : mkosi_depends ,
2024-04-06 00:19:59 +08:00
)
endif
############################################################
2023-06-26 02:46:05 +08:00
subdir ( 'rules.d' )
subdir ( 'test' )
2023-12-15 05:35:00 +08:00
#####################################################################
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2022-11-16 22:52:15 +08:00
subdir ( 'docs/sysvinit' )
subdir ( 'docs/var-log' )
subdir ( 'hwdb.d' )
subdir ( 'man' )
2021-07-07 18:39:33 +08:00
subdir ( 'modprobe.d' )
2022-11-16 22:52:15 +08:00
subdir ( 'network' )
subdir ( 'presets' )
subdir ( 'shell-completion/bash' )
subdir ( 'shell-completion/zsh' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
subdir ( 'sysctl.d' )
subdir ( 'sysusers.d' )
subdir ( 'tmpfiles.d' )
2019-10-08 22:52:10 +08:00
subdir ( 'units' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
install_subdir ( 'factory/etc' ,
install_dir : factorydir )
2021-12-23 19:01:07 +08:00
subdir ( 'factory/templates' )
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
2020-11-12 15:01:39 +08:00
if install_sysconfdir
install_data ( 'xorg/50-systemd-user.sh' ,
install_dir : xinitrcdir )
endif
2018-02-26 18:48:46 +08:00
install_data ( 'LICENSE.GPL2' ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
'LICENSE.LGPL2.1' ,
2018-02-26 18:48:46 +08:00
'NEWS' ,
'README' ,
2024-02-23 16:48:47 +08:00
'docs/CODING_STYLE.md' ,
'docs/DISTRO_PORTING.md' ,
'docs/ENVIRONMENT.md' ,
'docs/HACKING.md' ,
'docs/TRANSIENT-SETTINGS.md' ,
'docs/TRANSLATORS.md' ,
'docs/UIDS-GIDS.md' ,
meson: build systemd using meson
It's crucial that we can build systemd using VS2010!
... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.
This is not complete, I'm throwing it out here for your amusement and critique.
- rules for sd-boot are missing. Those might be quite complicated.
- rules for tests are missing too. Those are probably quite simple and
repetitive, but there's lots of them.
- it's likely that I didn't get all the conditions right, I only tested "full"
compilation where most deps are provided and nothing is disabled.
- busname.target and all .busname units are skipped on purpose.
Otherwise, installation into $DESTDIR has the same list of files and the
autoconf install, except for .la files.
It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.
meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.
The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.
v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments
v3:
- drop required:true and fix progs/prog typo
v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute
v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components
v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.
v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
split-usr==true.
v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it
v9:
- indentation
v10:
- fix check for qrencode and libaudit
v11:
- unify handling of executable paths, provide options for all progs
This makes the meson build behave slightly differently than the
autoconf-based one, because we always first try to find the executable in the
filesystem, and fall back to the default. I think different handling of
loadkeys, setfont, and telinit was just a historical accident.
In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
but in Debian, those directories are not included in the path.
C.f. https://github.com/mesonbuild/meson/issues/1576.
- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-05 11:03:47 +08:00
install_dir : docdir )
2017-04-07 02:33:27 +08:00
2021-09-30 05:10:34 +08:00
install_subdir ( 'LICENSES' ,
install_dir : docdir )
2023-08-08 09:38:47 +08:00
install_emptydir ( systemdstatedir )
2017-04-10 11:55:05 +08:00
2023-12-15 05:35:00 +08:00
#####################################################################
2017-04-07 02:33:27 +08:00
2021-05-19 21:45:47 +08:00
# Ensure that changes to the docs/ directory do not break the
# basic Github pages build. But only run it in developer mode,
# as it might be fragile due to changes in the tooling, and it is
# not generally useful for users.
jekyll = find_program ( 'jekyll' , required : false )
if get_option ( 'mode' ) == 'developer' and want_tests != 'false' and jekyll . found ( )
test ( 'github-pages' ,
jekyll ,
2023-05-18 23:16:33 +08:00
suite : 'dist' ,
2021-05-19 21:45:47 +08:00
args : [ 'build' ,
2021-07-28 01:32:35 +08:00
'--source' , project_source_root / 'docs' ,
'--destination' , project_build_root / '_site' ] )
2021-05-19 21:45:47 +08:00
endif
2023-12-15 05:35:00 +08:00
#####################################################################
2021-05-19 21:45:47 +08:00
2020-05-07 19:54:10 +08:00
check_help = find_program ( 'tools/check-help.sh' )
2022-04-05 16:51:21 +08:00
check_version = find_program ( 'tools/check-version.sh' )
2017-04-13 23:52:05 +08:00
foreach exec : public_programs
2023-06-14 22:05:52 +08:00
name = fs . name ( exec . full_path ( ) )
2018-09-12 17:08:49 +08:00
if want_tests != 'false'
test ( 'check-help-' + name ,
2020-05-07 19:54:10 +08:00
check_help ,
2023-05-18 23:16:33 +08:00
suite : 'dist' ,
2022-01-21 22:28:23 +08:00
args : exec . full_path ( ) ,
depends : exec )
2022-04-05 16:51:21 +08:00
2024-02-14 18:04:36 +08:00
version = meson . project_version ( )
if name == 'udevadm'
# For compatibility reasons we can't use the full version in udevadm.
version = version . split ( '~' ) [ 0 ]
endif
2022-04-05 16:51:21 +08:00
test ( 'check-version-' + name ,
check_version ,
2023-05-18 23:16:33 +08:00
suite : 'dist' ,
2022-04-05 16:51:21 +08:00
args : [ exec . full_path ( ) ,
2024-02-14 18:04:36 +08:00
version ] ,
2022-04-05 16:51:21 +08:00
depends : exec )
2018-09-12 17:08:49 +08:00
endif
2017-04-13 23:52:05 +08:00
endforeach
2018-03-14 21:27:04 +08:00
# Enable tests for all supported sanitizers
2022-10-07 01:06:08 +08:00
foreach tuple : fuzz_sanitizers
2018-03-14 21:27:04 +08:00
sanitizer = tuple [ 0 ]
build = tuple [ 1 ]
2018-01-19 14:54:30 +08:00
2018-05-15 19:18:24 +08:00
if cc . has_link_argument ( '-fsanitize=@0@' . format ( sanitizer ) )
2022-10-07 01:06:08 +08:00
foreach fuzzer , fuzz_ins : fuzz_regression_tests
name = '@0@:@1@' . format ( fuzzer , sanitizer )
if want_tests == 'false'
message ( 'Not compiling @0@ because tests is set to false' . format ( name ) )
continue
2018-03-14 21:27:04 +08:00
endif
2022-10-07 01:06:08 +08:00
if not fuzz_tests
message ( 'Not compiling @0@ because fuzz-tests is set to false' . format ( name ) )
continue
endif
exe = custom_target (
name ,
output : name ,
2023-06-27 00:07:25 +08:00
depends : build ,
2022-10-07 01:06:08 +08:00
command : [ ln , '-fs' ,
build . full_path ( ) / fuzzer ,
'@OUTPUT@' ] ,
build_by_default : true )
2023-06-27 00:07:25 +08:00
foreach directive : fuzz_ins . get ( 'directives' , [ ] )
test ( '@0@_@1@_@2@' . format ( fuzzer , fs . name ( directive . full_path ( ) ) , sanitizer ) ,
env ,
suite : 'fuzz+san' ,
env : [ 'UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1' ] ,
timeout : 60 ,
args : [ exe . full_path ( ) , directive . full_path ( ) ] ,
depends : directive )
endforeach
foreach file : fuzz_ins . get ( 'files' , [ ] )
test ( '@0@_@1@_@2@' . format ( fuzzer , fs . name ( file ) , sanitizer ) ,
2018-03-14 21:27:04 +08:00
env ,
2022-05-02 17:12:34 +08:00
suite : 'fuzz+san' ,
2020-05-20 17:33:12 +08:00
env : [ 'UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1' ] ,
timeout : 60 ,
2023-06-27 00:07:25 +08:00
args : [ exe . full_path ( ) , file ] )
2022-10-07 01:06:08 +08:00
endforeach
2018-03-14 21:27:04 +08:00
endforeach
2018-01-19 14:54:30 +08:00
endif
endforeach
2023-12-15 05:35:00 +08:00
#####################################################################
2018-01-19 14:54:30 +08:00
2017-07-04 00:42:29 +08:00
if git . found ( )
2017-04-18 07:25:00 +08:00
all_files = run_command (
2021-05-14 20:16:17 +08:00
env , '-u' , 'GIT_WORK_TREE' ,
git , '--git-dir=@0@/.git' . format ( project_source_root ) ,
2023-05-05 15:33:12 +08:00
'ls-files' , ':/*.[ch]' , ':/*.cc' ,
2021-11-17 20:58:53 +08:00
check : false )
if all_files . returncode ( ) == 0
all_files = files ( all_files . stdout ( ) . split ( ) )
custom_target (
'tags' ,
output : 'tags' ,
command : [ env , 'etags' , '-o' , '@0@/TAGS' . format ( project_source_root ) ] + all_files )
run_target (
'ctags' ,
2022-01-16 14:06:15 +08:00
command : [ env , 'ctags' , '--tag-relative=never' , '-o' , '@0@/tags' . format ( project_source_root ) ] + all_files )
2023-05-05 15:35:54 +08:00
############################################
if want_tests != 'false' and conf . get ( 'BUILD_MODE_DEVELOPER' ) == 1
test ( 'check-includes' ,
files ( 'tools/check-includes.py' ) ,
args : all_files ,
2023-06-27 00:28:32 +08:00
env : [ 'PROJECT_SOURCE_ROOT=@0@' . format ( project_source_root ) ] ,
suite : 'headers' )
2023-05-05 15:35:54 +08:00
endif
2021-11-17 20:58:53 +08:00
endif
2017-04-15 12:16:23 +08:00
2023-05-05 15:35:54 +08:00
####################################################
2020-05-07 19:54:10 +08:00
git_contrib_sh = find_program ( 'tools/git-contrib.sh' )
2017-04-18 07:48:20 +08:00
run_target (
2017-04-18 07:25:00 +08:00
'git-contrib' ,
2020-05-07 19:54:10 +08:00
command : [ git_contrib_sh ] )
2017-04-25 07:28:05 +08:00
2023-05-05 15:35:54 +08:00
####################################################
2017-04-25 07:28:05 +08:00
git_head = run_command (
2021-11-17 20:58:53 +08:00
git , '--git-dir=@0@/.git' . format ( project_source_root ) ,
'rev-parse' , 'HEAD' ,
check : false ) . stdout ( ) . strip ( )
2017-04-25 07:28:05 +08:00
git_head_short = run_command (
2021-11-17 20:58:53 +08:00
git , '--git-dir=@0@/.git' . format ( project_source_root ) ,
'rev-parse' , '--short=7' , 'HEAD' ,
check : false ) . stdout ( ) . strip ( )
2017-04-25 07:28:05 +08:00
run_target (
'git-snapshot' ,
2021-05-14 20:16:17 +08:00
command : [ git , 'archive' ,
2019-02-28 00:19:07 +08:00
'-o' , '@0@/systemd-@1@.tar.gz' . format ( project_source_root ,
2017-04-25 07:28:05 +08:00
git_head_short ) ,
'--prefix' , 'systemd-@0@/' . format ( git_head ) ,
'HEAD' ] )
endif
2017-04-28 08:54:52 +08:00
2023-12-15 05:35:00 +08:00
#####################################################################
2017-04-28 08:54:52 +08:00
2020-05-07 19:54:10 +08:00
check_api_docs_sh = find_program ( 'tools/check-api-docs.sh' )
2017-12-20 19:51:14 +08:00
run_target (
'check-api-docs' ,
depends : [ man , libsystemd , libudev ] ,
2020-05-07 19:54:10 +08:00
command : [ check_api_docs_sh , libsystemd . full_path ( ) , libudev . full_path ( ) ] )
2017-12-20 19:51:14 +08:00
2021-07-28 02:11:41 +08:00
alias_target ( 'update-dbus-docs' , update_dbus_docs )
alias_target ( 'update-man-rules' , update_man_rules )
2021-01-27 16:10:25 +08:00
2022-02-08 21:19:52 +08:00
if not meson . is_cross_build ( )
custom_target (
'export-dbus-interfaces' ,
2022-05-16 03:05:51 +08:00
output : fs . name ( dbus_interfaces_dir ) ,
2022-02-08 21:19:52 +08:00
install : dbus_interfaces_dir != 'no' ,
2022-05-16 03:05:51 +08:00
install_dir : fs . parent ( dbus_interfaces_dir ) ,
2022-02-08 21:19:52 +08:00
command : [ export_dbus_interfaces_py , '@OUTPUT@' , dbus_programs ] )
endif
2021-07-24 15:30:42 +08:00
test: verify our own units (where applicable)
This is inspired by one of our internal tests that does pretty much the
same thing. However, it is slightly more convoluted than I'd like it to
be, since I really don't want to duplicate the list of our units in
another place, so we need to, somehow, pass the list from the meson file
to the test script. I originally envisioned this to be a part of the
unit test suite, but this doesn't work for unit files with absolute
paths to binaries, as we'd have to install the build first (maybe using
a chroot would work?).
It doesn't check man pages (since they might not be installed on the
test machine) and also skip recursive dependencies (as that would trip
over issues in files that are not under our direct control), but it
should still cover typos and such.
There are currently two units for which the check had to be disabled -
syslog.socket, as the corresponding syslog.service might not be
installed, and rc-local.service as that's a compat API and the necessary
/etc/rc.d/rc.local file may not (and most likely won't be) present.
2024-02-20 03:41:49 +08:00
meson_extract_unit_files = find_program ( 'tools/meson-extract-unit-files.py' )
custom_target ( 'installed-unit-files.txt' ,
output : 'installed-unit-files.txt' ,
capture : true ,
install : want_tests != 'no' and install_tests ,
install_dir : testdata_dir ,
command : [ meson_extract_unit_files , project_build_root ] )
2023-12-15 05:35:00 +08:00
#####################################################################
2017-04-28 08:54:52 +08:00
2021-11-17 20:58:53 +08:00
alt_time_epoch = run_command ( 'date' , '-Is' , '-u' , '-d' , '@@0@' . format ( time_epoch ) ,
check : true ) . stdout ( ) . strip ( )
2021-07-28 16:04:01 +08:00
summary ( {
'split bin-sbin' : split_bin ,
'prefix directory' : prefixdir ,
'sysconf directory' : sysconfdir ,
'include directory' : includedir ,
'lib directory' : libdir ,
'SysV init scripts' : sysvinit_path ,
'SysV rc?.d directories' : sysvrcnd_path ,
'PAM modules directory' : pamlibdir ,
'PAM configuration directory' : pamconfdir ,
2024-01-05 06:31:51 +08:00
'ssh server configuration directory' : sshdconfdir ,
2024-03-01 18:25:52 +08:00
'ssh server privilege separation directory' : sshdprivsepdir ,
2024-01-05 06:31:51 +08:00
'ssh client configuration directory' : sshconfdir ,
2021-07-28 16:04:01 +08:00
'libcryptsetup plugins directory' : libcryptsetup_plugins_dir ,
'RPM macros directory' : rpmmacrosdir ,
'modprobe.d directory' : modprobedir ,
'D-Bus policy directory' : dbuspolicydir ,
'D-Bus session directory' : dbussessionservicedir ,
'D-Bus system directory' : dbussystemservicedir ,
2021-12-26 09:44:52 +08:00
'D-Bus interfaces directory' : dbus_interfaces_dir ,
2021-07-28 16:04:01 +08:00
'bash completions directory' : bashcompletiondir ,
'zsh completions directory' : zshcompletiondir ,
2021-12-15 01:03:06 +08:00
'private shared lib version tag' : shared_lib_tag ,
2021-07-28 16:04:01 +08:00
'extra start script' : get_option ( 'rc-local' ) ,
'debug shell' : '@0@ @ @1@' . format ( get_option ( 'debug-shell' ) ,
get_option ( 'debug-tty' ) ) ,
'system UIDs' : '<=@0@ (alloc >=@1@)' . format ( conf . get ( 'SYSTEM_UID_MAX' ) ,
conf . get ( 'SYSTEM_ALLOC_UID_MIN' ) ) ,
'system GIDs' : '<=@0@ (alloc >=@1@)' . format ( conf . get ( 'SYSTEM_GID_MAX' ) ,
conf . get ( 'SYSTEM_ALLOC_GID_MIN' ) ) ,
'dynamic UIDs' : '@0@…@1@' . format ( dynamic_uid_min , dynamic_uid_max ) ,
'container UID bases' : '@0@…@1@' . format ( container_uid_base_min , container_uid_base_max ) ,
'static UID/GID allocations' : ' ' . join ( static_ugids ) ,
'/dev/kvm access mode' : get_option ( 'dev-kvm-mode' ) ,
'render group access mode' : get_option ( 'group-render-mode' ) ,
'certificate root directory' : get_option ( 'certificate-root' ) ,
'support URL' : support_url ,
'nobody user name' : nobody_user ,
'nobody group name' : nobody_group ,
'fallback hostname' : get_option ( 'fallback-hostname' ) ,
2022-04-27 19:47:38 +08:00
'default compression method' : compression ,
2021-07-28 16:04:01 +08:00
'default DNSSEC mode' : default_dnssec ,
'default DNS-over-TLS mode' : default_dns_over_tls ,
'default mDNS mode' : default_mdns ,
'default LLMNR mode' : default_llmnr ,
'default DNS servers' : dns_servers . split ( ' ' ) ,
'default NTP servers' : ntp_servers . split ( ' ' ) ,
2024-02-28 22:31:27 +08:00
'default net.naming_scheme= value' : default_net_naming_scheme ,
'default KillUserProcesses= value' : kill_user_processes ,
2021-07-28 16:04:01 +08:00
'default locale' : default_locale ,
2022-06-27 11:46:57 +08:00
'default nspawn locale' : nspawn_locale ,
2022-06-10 02:32:22 +08:00
'default status unit format' : status_unit_format_default ,
2021-07-28 16:04:01 +08:00
'default user $PATH' :
default_user_path != '' ? default_user_path : '(same as system services)' ,
'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog ,
'time epoch' : '@0@ (@1@)' . format ( time_epoch , alt_time_epoch ) } )
2017-04-28 08:54:52 +08:00
# TODO:
# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
found = [ ]
missing = [ ]
foreach tuple : [
2021-04-15 16:59:03 +08:00
# dependencies
[ 'ACL' ] ,
2017-04-28 08:54:52 +08:00
[ 'AUDIT' ] ,
[ 'AppArmor' ] ,
2021-04-15 16:59:03 +08:00
[ 'IMA' ] ,
[ 'PAM' ] ,
2017-04-28 08:54:52 +08:00
[ 'SECCOMP' ] ,
2021-04-15 16:59:03 +08:00
[ 'SELinux' ] ,
2017-04-28 08:54:52 +08:00
[ 'SMACK' ] ,
2021-04-15 16:59:03 +08:00
[ 'blkid' ] ,
[ 'elfutils' ] ,
2017-04-28 08:54:52 +08:00
[ 'gcrypt' ] ,
[ 'gnutls' ] ,
meson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options
* Add `bpf-framework` feature gate with 'auto', 'true' and 'false' choices
* Add libbpf [0] dependency
* Search for clang llvm-strip and bpftool binaries in compile time to
generate bpf skeleton.
For libbpf [0], make 0.2.0 [1] the minimum required version.
If libbpf is satisfied, set HAVE_LIBBPF config option to 1.
If `bpf-framework` feature gate is set to 'auto', means that whether
bpf feature is enabled or now is defined by the presence of all of
libbpf, clang, llvm and bpftool in build
environment.
With 'auto' all dependencies are optional.
If the gate is set to `true`, make all of the libbpf, clang and llvm
dependencies mandatory.
If it's set to `false`, set `BPF_FRAMEWORK` to false and make libbpf
dependency optional.
libbpf dependency is dynamic followed by the common pattern in systemd.
meson, bpf: add build rule for socket_bind program
2020-11-14 09:08:15 +08:00
[ 'libbpf' ] ,
2021-04-15 16:59:03 +08:00
[ 'libcryptsetup' ] ,
2021-03-17 03:13:28 +08:00
[ 'libcryptsetup-plugins' ] ,
2017-04-28 08:54:52 +08:00
[ 'libcurl' ] ,
2021-04-15 16:59:03 +08:00
[ 'libfdisk' ] ,
[ 'libfido2' ] ,
2017-04-28 08:54:52 +08:00
[ 'libidn' ] ,
2021-04-15 16:59:03 +08:00
[ 'libidn2' ] ,
2017-04-28 08:54:52 +08:00
[ 'libiptc' ] ,
2021-04-15 16:59:03 +08:00
[ 'microhttpd' ] ,
[ 'openssl' ] ,
[ 'p11kit' ] ,
2021-08-06 16:41:01 +08:00
[ 'passwdqc' ] ,
2021-04-15 16:59:03 +08:00
[ 'pcre2' ] ,
[ 'pwquality' ] ,
[ 'qrencode' ] ,
[ 'tpm2' ] ,
[ 'xkbcommon' ] ,
# compression libs
[ 'zstd' ] ,
[ 'lz4' ] ,
[ 'xz' ] ,
[ 'zlib' ] ,
[ 'bzip2' ] ,
# components
[ 'backlight' ] ,
2017-04-28 08:54:52 +08:00
[ 'binfmt' ] ,
2023-02-26 21:09:44 +08:00
[ 'bootloader' ] ,
2022-07-28 05:28:09 +08:00
[ 'bpf-framework' , conf . get ( 'BPF_FRAMEWORK' ) == 1 ] ,
2021-04-15 16:59:03 +08:00
[ 'coredump' ] ,
[ 'efi' ] ,
2023-02-26 21:09:44 +08:00
[ 'environment.d' ] ,
2017-04-28 08:54:52 +08:00
[ 'firstboot' ] ,
2021-04-15 16:59:03 +08:00
[ 'hibernate' ] ,
[ 'homed' ] ,
[ 'hostnamed' ] ,
[ 'hwdb' ] ,
[ 'importd' ] ,
[ 'initrd' ] ,
2022-03-31 17:17:10 +08:00
[ 'kernel-install' ] ,
2021-04-15 16:59:03 +08:00
[ 'localed' ] ,
2017-04-28 08:54:52 +08:00
[ 'logind' ] ,
[ 'machined' ] ,
2021-04-15 16:59:03 +08:00
[ 'networkd' ] ,
[ 'nss-myhostname' ] ,
[ 'nss-mymachines' ] ,
[ 'nss-resolve' ] ,
[ 'nss-systemd' ] ,
[ 'oomd' ] ,
2018-04-17 03:41:40 +08:00
[ 'portabled' ] ,
2021-04-15 16:59:03 +08:00
[ 'pstore' ] ,
[ 'quotacheck' ] ,
[ 'randomseed' ] ,
[ 'repart' ] ,
[ 'resolve' ] ,
[ 'rfkill' ] ,
2021-01-08 23:57:27 +08:00
[ 'sysext' ] ,
2022-07-28 05:28:09 +08:00
[ 'systemd-analyze' , conf . get ( 'ENABLE_ANALYZE' ) == 1 ] ,
2020-12-28 22:17:54 +08:00
[ 'sysupdate' ] ,
2021-04-15 16:59:03 +08:00
[ 'sysusers' ] ,
storagetm: add new systemd-storagetm component
This implements a "storage target mode", similar to what MacOS provides
since a long time as "Target Disk Mode":
https://en.wikipedia.org/wiki/Target_Disk_Mode
This implementation is relatively simple:
1. a new generic target "storage-target-mode.target" is added, which
when booted into defines the target mode.
2. a small tool and service "systemd-storagetm.service" is added which
exposes a specific device or all devices as NVMe-TCP devices over the
network. NVMe-TCP appears to be hot shit right now how to expose
block devices over the network. And it's really simple to set up via
configs, hence our code is relatively short and neat.
The idea is that systemd-storagetm.target can be extended sooner or
later, for example to expose block devices also as USB mass storage
devices and similar, in case the system has "dual mode" USB controller
that can also work as device, not just as host. (And people could also
plug in sharing as NBD, iSCSI, whatever they want.)
How to use this? Boot into your system with a kernel cmdline of
"rd.systemd.unit=storage-target-mode.target ip=link-local", and you'll see on
screen the precise "nvme connect" command line to make the relevant
block devices available locally on some other machine. This all requires
that the target mode stuff is included in the initrd of course. And the
system will the stay in the initrd forever.
Why bother? Primarily three use-cases:
1. Debug a broken system: with very few dependencies during boot get
access to the raw block device of a broken machine.
2. Migrate from system to another system, by dd'ing the old to the new
directly.
3. Installing an OS remotely on some device (for example via Thunderbolt
networking)
(And there might be more, for example the ability to boot from a
laptop's disk on another system)
Limitations:
1. There's no authentication/encryption. Hence: use this on local links
only.
2. NVMe target mode on Linux supports r/w operation only. Ideally, we'd
have a read-only mode, for security reasons, and default to it.
Future love:
1. We should have another mode, where we simply expose the homed LUKS
home dirs like that.
2. Some lightweight hookup with plymouth, to display a (shortened)
version of the info we write to the console.
To test all this, just run:
mkosi --kernel-command-line-extra="rd.systemd.unit=storage-target-mode.target" qemu
2023-10-27 20:25:49 +08:00
[ 'storagetm' ] ,
2017-04-28 08:54:52 +08:00
[ 'timedated' ] ,
[ 'timesyncd' ] ,
2021-04-15 16:59:03 +08:00
[ 'tmpfiles' ] ,
[ 'userdb' ] ,
[ 'vconsole' ] ,
2023-10-12 20:13:19 +08:00
[ 'vmspawn' ] ,
2021-04-15 16:59:03 +08:00
[ 'xdg-autostart' ] ,
# optional features
2023-07-30 05:32:53 +08:00
[ 'dmi' ] ,
2021-04-15 16:59:03 +08:00
[ 'idn' ] ,
2017-04-28 08:54:52 +08:00
[ 'polkit' ] ,
2021-04-15 16:59:03 +08:00
[ 'nscd' ] ,
2022-07-28 05:28:09 +08:00
[ 'legacy-pkla' , install_polkit_pkla ] ,
2017-04-28 08:54:52 +08:00
[ 'kmod' ] ,
2022-11-01 23:53:02 +08:00
[ 'xenctrl' ] ,
2017-04-28 08:54:52 +08:00
[ 'dbus' ] ,
[ 'glib' ] ,
[ 'tpm' ] ,
2022-07-28 05:28:09 +08:00
[ 'man pages' , want_man ] ,
[ 'html pages' , want_html ] ,
[ 'man page indices' , want_man and have_lxml ] ,
2017-04-28 08:54:52 +08:00
[ 'SysV compat' ] ,
2021-04-15 16:59:03 +08:00
[ 'compat-mutable-uid-boundaries' ] ,
2017-04-28 08:54:52 +08:00
[ 'utmp' ] ,
[ 'ldconfig' ] ,
2022-07-28 05:28:09 +08:00
[ 'adm group' , get_option ( 'adm-group' ) ] ,
[ 'wheel group' , get_option ( 'wheel-group' ) ] ,
2017-05-09 20:02:37 +08:00
[ 'gshadow' ] ,
2017-04-28 08:54:52 +08:00
[ 'debug hashmap' ] ,
[ 'debug mmap cache' ] ,
2018-11-22 23:36:35 +08:00
[ 'debug siphash' ] ,
2022-07-28 05:28:09 +08:00
[ 'trace logging' , conf . get ( 'LOG_TRACE' ) == 1 ] ,
2023-03-03 19:15:07 +08:00
[ 'slow tests' , slow_tests ] ,
[ 'fuzz tests' , fuzz_tests ] ,
2022-07-28 05:28:09 +08:00
[ 'install tests' , install_tests ] ,
[ 'link-udev-shared' , get_option ( 'link-udev-shared' ) ] ,
[ 'link-systemctl-shared' , get_option ( 'link-systemctl-shared' ) ] ,
[ 'link-networkd-shared' , get_option ( 'link-networkd-shared' ) ] ,
[ 'link-timesyncd-shared' , get_option ( 'link-timesyncd-shared' ) ] ,
[ 'link-journalctl-shared' , get_option ( 'link-journalctl-shared' ) ] ,
[ 'link-boot-shared' , get_option ( 'link-boot-shared' ) ] ,
2023-05-14 09:17:47 +08:00
[ 'link-portabled-shared' , get_option ( 'link-portabled-shared' ) ] ,
manager: optionally, do a full preset on first boot
A compile time option is added to select behaviour: by default
UNIT_FILE_PRESET_ENABLE_ONLY is still used, but the intent is to change to
UNIT_FILE_PRESET_FULL at some point in the future. Distros that want to
opt-in can use the config option to change the behaviour.
(The option is just a boolean: it would be possible to make it multi-valued,
and allow full, enable-only, disable-only, none. But so far nobody has asked
for this, and it's better not to complicate things needlessly.)
With the configuration option flipped, instead of only doing enablements,
perform a full preset on first boot. The reason is that although
`/etc/machine-id` might be missing, there may be other files provisioned in
`/etc` (in fact, this use case is mentioned in `log_execution_mode`). Some of
those possible files include enablement symlinks even if presets dictate it
should be disabled.
Such a seemingly contradictory situation occurs in {RHEL,Fedora} CoreOS,
where we ship `/etc` as if `preset-all` were called. However, we want to
allow users to disable default-enabled services via Ignition, which does
this by creating preset dropins before switchroot. (For why we do
`preset-all` at compose time, see:
https://github.com/coreos/fedora-coreos-config/pull/77).
For example, the composed FCOS image has a `enable zincati.service`
preset and an enablement for that in `/etc`, while at boot time when we
switch root, there may be a `disable zincati.service` preset with higher
precedence. In that case, we want systemd to disable the service.
This is essentially a revert of 304b3079a203. It seems like systemd
*used* to do this, but it was changed to try to make the container
workflow a bit faster.
Resolves: https://github.com/coreos/fedora-coreos-tracker/issues/392
Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2020-03-24 00:25:19 +08:00
[ 'first-boot-full-preset' ] ,
2020-11-06 22:01:13 +08:00
[ 'fexecve' ] ,
2022-07-28 05:28:09 +08:00
[ 'standalone-binaries' , get_option ( 'standalone-binaries' ) ] ,
[ 'coverage' , get_option ( 'b_coverage' ) ] ,
2017-04-28 08:54:52 +08:00
]
2018-03-09 21:21:08 +08:00
if tuple . length ( ) > = 2
cond = tuple [ 1 ]
else
2017-04-28 08:54:52 +08:00
ident1 = 'HAVE_' + tuple [ 0 ] . underscorify ( ) . to_upper ( )
ident2 = 'ENABLE_' + tuple [ 0 ] . underscorify ( ) . to_upper ( )
2017-10-03 16:41:51 +08:00
cond = conf . get ( ident1 , 0 ) == 1 or conf . get ( ident2 , 0 ) == 1
2017-04-28 08:54:52 +08:00
endif
if cond
2018-07-31 15:44:11 +08:00
found + = tuple [ 0 ]
2017-04-28 08:54:52 +08:00
else
2018-07-31 15:44:11 +08:00
missing + = tuple [ 0 ]
2017-04-28 08:54:52 +08:00
endif
endforeach
2021-04-15 15:56:06 +08:00
if static_libsystemd == 'false'
missing + = 'static-libsystemd'
else
found + = 'static-libsystemd(@0@)' . format ( static_libsystemd )
endif
if static_libudev == 'false'
missing + = 'static-libudev'
else
found + = 'static-libudev(@0@)' . format ( static_libudev )
endif
2021-11-02 16:44:12 +08:00
if conf . get ( 'HAVE_OPENSSL_OR_GCRYPT' ) == 1 and conf . get ( 'PREFER_OPENSSL' ) == 1
found + = 'cryptolib(openssl)'
elif conf . get ( 'HAVE_OPENSSL_OR_GCRYPT' ) == 1
found + = 'cryptolib(gcrypt)'
else
missing + = 'cryptolib'
endif
2021-04-15 17:04:14 +08:00
if conf . get ( 'DNS_OVER_TLS_USE_GNUTLS' ) == 1
found + = 'DNS-over-TLS(gnutls)'
elif conf . get ( 'DNS_OVER_TLS_USE_OPENSSL' ) == 1
found + = 'DNS-over-TLS(openssl)'
else
missing + = 'DNS-over-TLS'
endif
2021-07-28 16:04:01 +08:00
summary ( {
'enabled' : ', ' . join ( found ) ,
'disabled' : ', ' . join ( missing ) } ,
section : 'Features' )