Commit Graph

32 Commits

Author SHA1 Message Date
Sam James
17de4e5dfd librc: mark stringlist functions as mallocs
This gives a hint to the compiler that allocations (return values)
from this function should be paired with a corresponding dealloc/free
function

In this case, it means that every rc_stringlist that rc_stringlist_new()
returns should eventually be freed by calling rc_stringlist_free(ptr)
where ptr is the relevant rc_stringlist.

We have to add a test for this into the build system
because only GCC supports this for now. In future, we might
be able to use meson's has_function_attribute (it does support
'malloc', just not AFAICT 'malloc with arguments').

Signed-off-by: Sam James <sam@gentoo.org>
2022-05-08 14:56:26 -05:00
William Hubbs
fdfa6dbb0e
rewrite tests (#515)
* rewrite tests to work with meson

This ports our tests to meson and makes them able to be run in parallel.

* add tests to ci

* rewrite test/check-trailing-newlines in bash

This test was using a GNU sed command which does not work on Alpine Linux.
2022-04-16 15:13:08 -05:00
William Hubbs
391d12db48 migrate fully to meson build system
- drop old build system
- move shared include and source files to common directory
- drop "rc-" prefix from shared include and source files
- move executable-specific code to individual directories under src
- adjust top-level .gitignore file for new build system

This closes #489.
2022-04-06 10:51:55 -05:00
LinkTed
5e127608c3 Fix indentation in the meson.build file 2022-03-05 13:14:59 -05:00
William Hubbs
0f8fe2a6cb define the pam directory at the top level 2021-12-31 11:01:55 -06:00
William Hubbs
29477075c8 remove a tab 2021-12-31 10:56:42 -06:00
William Hubbs
5e9797035b fix libkvm dependency for *bsd 2021-12-30 18:45:39 -06:00
William Hubbs
21d81ea5a9 build: always add subdirs 2021-12-30 12:17:47 -06:00
William Hubbs
fd70988587 remove separate pam directory 2021-12-29 19:04:06 -06:00
William Hubbs
cab458e27a build: rename sh_dir variable to rc_shdir 2021-12-29 15:57:04 -06:00
LinkTed
6e214b2616 capabilities: Add support for Linux capabilities(7)
This adds capabilities for start-stop-daemon by adding --capabilities
option. As a result, the user can specify the inheritable, ambient and
bounding set by define capabilities in the service script.

This fixes #314.
2021-12-23 17:29:10 -05:00
William Hubbs
cc0037e9ca build: set rootprefix_default to /usr if on a /usr merged system
This requires at leaste meson 0.53.0 since it uses the fs module.

This is for #474.
2021-11-28 12:35:29 -06:00
Sam James
2ba16135cb meson: fallback to libcrypt detection outside of pkg-config
Much like PAM, not all implementations of libcrypt provide a pkg-config
file, and hence we can't find it using the old logic.

Let's fall back to the standard AC_SEARCH_LIBS-style check if the pkg-config-style
detection fails.

This fixes finding e.g. musl's libcrypt.

X-Gentoo-Bug: 827074
X-Gentoo-Bug-URL: https://bugs.gentoo.org/827074
2021-11-27 13:14:10 -06:00
Sam James
b868fc2c8d meson: only find libcrypt if SELinux and no PAM
We only need libcrypt if we're building _with_ SELinux and
_without_ PAM. We don't use libcrypt for general SELinux
with PAM.

This is mostly a correctness change as libcrypt should
generally be available (as opposed to the previous
change which fixed some real-world cases).

Fixes: f3f0fde861
Fixes: #478
2021-11-27 13:13:35 -06:00
Sam James
f3f0fde861 meson: link against libcrypt for SELinux if no PAM
We use libcrypt's crypt() if we're _not_ using PAM
in the SELinux code (rc-selinux, specifically).

X-Gentoo-Bug: 824954
X-Gentoo-Bug-URL: https://bugs.gentoo.org/824954
Fixes: https://github.com/openrc/openrc/pull/477
2021-11-20 17:33:14 -06:00
Sam James
bd5cdaafad meson: fix pam_misc_dep definition
X-Gentoo-Bug: 824954
X-Gentoo-Bug-URL: https://bugs.gentoo.org/824954
Fixes: https://github.com/OpenRC/openrc/issues/470
Fixes: https://github.com/OpenRC/openrc/pull/477
2021-11-20 17:31:17 -06:00
William Hubbs
9d4f11f726 build: pam fix
Set the HAVE_PAM option if the dependency is found *and* pam is
requested.

X-Gentoo-Bug: 821211
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=821211
2021-11-06 19:37:37 -05:00
William Hubbs
1033909f0e fix bug in pam build tests 2021-10-08 16:39:21 -05:00
William Hubbs
5a5ede3156 support older pam versions
Some distros are still using versions of pam which do not create
*.pc files, so we need fallback logic for that situation.
2021-10-08 10:46:42 -05:00
William Hubbs
bfa634493d build: fix pam and pam_misc dependencies
Pam generates pkgconfig files now, so meson can use them to find the pam
dependencies.
2021-10-02 16:10:45 -05:00
William Hubbs
a4d4d390be move rc_bindir and rc_sbindir definitions to the top level 2021-09-21 12:34:22 -05:00
William Hubbs
d07572e1b7 build: fix rootprefix
This fixes #438.
2021-09-21 10:26:57 -05:00
William Hubbs
a25ccbd8f2 build: install pam files 2021-09-08 15:05:46 -05:00
William Hubbs
46a0bfedd1 build: fix symlinks 2021-09-08 11:59:38 -05:00
William Hubbs
803aa1c637 version 0.44 2021-09-07 16:16:51 -05:00
William Hubbs
7c29fbd36f build: install bash and zsh completions 2021-09-07 12:45:53 -05:00
William Hubbs
593be166d1 build: fix libexecdir 2021-09-06 18:52:54 -05:00
William Hubbs
3a187f88f4 build: typo fix 2021-09-06 16:04:46 -05:00
William Hubbs
f2362cc277 build: add split-usr option 2021-09-06 15:22:28 -05:00
William Hubbs
444e44eb9d build: change root_prefix to rootprefix 2021-09-06 14:30:30 -05:00
William Hubbs
c0f8313164 sync meson build version with makefiles 2021-09-05 20:04:55 -05:00
William Hubbs
d6622a1156 add meson build files
Closes #116.
Closes #171.
Closes #172.
Closes #175.
2021-09-04 16:01:29 -05:00