]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: split shells.c out of lib_common into lib_common_shells
authorKarel Zak <kzak@redhat.com>
Mon, 4 May 2026 12:02:39 +0000 (14:02 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 11 May 2026 09:05:41 +0000 (11:05 +0200)
Remove shells.c from lib_common_sources and build it as a separate
static library (lib_common_shells) with lib_econf dependency.

Link lib_common_shells only into binaries that use the econf-dependent
shell enumeration functions (is_known_shell, print_shells,
open_etc_shells): chsh, su, runuser, login.

Other binaries that only need ul_default_shell() get it from
lib_common via default_shell.c and don't need libeconf.

Signed-off-by: Karel Zak <kzak@redhat.com>
lib/meson.build
meson.build

index 2164d57dd110af853554cde203d9dab641810fef..15077dbf40046d72efaad3a1342138546a367389 100644 (file)
@@ -20,7 +20,6 @@ lib_common_sources = '''
        pidutils.c
        pwdutils.c
        sha256.c
-       shells.c
        signames.c
        timeutils.c
        ttyutils.c
@@ -57,6 +56,13 @@ logindefs_c = static_library('logindefs',
   include_directories : dir_include,
   dependencies : lib_econf,
 )
+
+lib_common_shells = static_library('common_shells',
+  sources : ['shells.c'],
+  include_directories : dir_include,
+  dependencies : lib_econf,
+)
+
 selinux_utils_c = files('selinux-utils.c')
 
 caputils_c = files('caputils.c')
index b1efd315ca997edf8f2ef0a9eb7c4d497766c2f1..5fbbe3376bf9b0de81784a1e94ed3998e2d02cbe 100644 (file)
@@ -1079,10 +1079,9 @@ exe = executable(
 exe2 = executable(
   'chsh',
   'login-utils/chsh.c',
-  'lib/shells.c',
   chfn_chsh_sources,
   include_directories : includes,
-  link_with : lib_common,
+  link_with : [lib_common, lib_common_shells],
   dependencies : chfn_chsh_deps,
   install_dir : usrbin_exec_dir,
   install_mode : 'rwsr-xr-x',
@@ -1170,11 +1169,10 @@ exe = executable(
   'login-utils/su.c',
   'login-utils/su-common.c',
   'login-utils/su-common.h',
-  'lib/shells.c',
   pty_session_c,
   monotonic_c,
   include_directories : includes,
-  link_with : [lib_common, logindefs_c],
+  link_with : [lib_common, logindefs_c, lib_common_shells],
   dependencies : [lib_pam,
                   lib_pam_misc,
                   lib_util,
@@ -1257,11 +1255,10 @@ exe = executable(
   'login-utils/runuser.c',
   'login-utils/su-common.c',
   'login-utils/su-common.h',
-  'lib/shells.c',
   pty_session_c,
   monotonic_c,
   include_directories : includes,
-  link_with : [lib_common, logindefs_c],
+  link_with : [lib_common, logindefs_c, lib_common_shells],
   dependencies : [lib_pam,
                   lib_pam_misc,
                   lib_util,
@@ -2846,7 +2843,7 @@ exe = executable(
   'login',
   login_sources,
   include_directories : includes,
-  link_with : [lib_common, logindefs_c],
+  link_with : [lib_common, logindefs_c, lib_common_shells],
   dependencies : [lib_pam,
                   lib_audit,
                   lib_selinux],