]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: move netlink sources from libcommon to agetty
authorKarel Zak <kzak@redhat.com>
Tue, 3 Mar 2026 10:39:14 +0000 (11:39 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 3 Mar 2026 10:39:14 +0000 (11:39 +0100)
The netlink and netaddrq sources use Linux-specific headers
(linux/netlink.h, linux/rtnetlink.h) and cannot be compiled on
non-Linux systems like GNU/Hurd.

Move them out of libcommon and link directly into agetty (the only
user), following the same pattern as plymouth-ctrl.c. Also move the
corresponding test programs to the Linux-only section.

Co-authored-by: Samuel Thibault <samuel.thibault@aquilenet.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/Makemodule.am
lib/meson.build
term-utils/Makemodule.am
term-utils/meson.build

index 9464bd9d2ef4970f2a77853a92143d19a18bf600..a8542af5b5bc4ee9257190919c1d5b80ee5326d0 100644 (file)
@@ -31,8 +31,6 @@ libcommon_la_SOURCES = \
        lib/mbsalign.c \
        lib/mbsedit.c\
        lib/md5.c \
-       lib/netaddrq.c \
-       lib/netlink.c \
        lib/pidutils.c \
        lib/pidfd-utils.c \
        lib/pwdutils.c \
@@ -99,8 +97,6 @@ check_PROGRAMS += \
        test_ismounted \
        test_pwdutils \
        test_mangle \
-       test_netlink \
-       test_netaddrq \
        test_randutils \
        test_remove_env \
        test_strutils \
@@ -120,7 +116,9 @@ check_PROGRAMS += \
        test_pager \
        test_caputils \
        test_loopdev \
-       test_linux_version
+       test_linux_version \
+       test_netlink \
+       test_netaddrq
 endif
 
 if HAVE_OPENAT
@@ -148,12 +146,6 @@ test_ismounted_LDADD = libcommon.la $(LDADD)
 test_mangle_SOURCES = lib/mangle.c
 test_mangle_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_MANGLE
 
-test_netlink_SOURCES = lib/netlink.c
-test_netlink_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_NETLINK
-
-test_netaddrq_SOURCES = lib/netaddrq.c lib/netlink.c
-test_netaddrq_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_NETADDRQ
-
 test_strutils_SOURCES = lib/strutils.c
 test_strutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_STRUTILS
 test_strutils_LDADD = $(LDADD) libcommon.la
@@ -210,6 +202,12 @@ test_linux_version_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_LINUXVERSION
 test_loopdev_SOURCES = lib/loopdev.c
 test_loopdev_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_LOOPDEV
 test_loopdev_LDADD = $(LDADD) libcommon.la
+
+test_netlink_SOURCES = lib/netlink.c
+test_netlink_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_NETLINK
+
+test_netaddrq_SOURCES = lib/netaddrq.c lib/netlink.c
+test_netaddrq_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM_NETADDRQ
 endif
 
 test_configs_SOURCES = lib/configs.c
index db871913d299e8460336b32dd12b4f9e2a7e5b78..1469fb1404617ffbc51b623bbe9ba20ca20a5bdb 100644 (file)
@@ -17,8 +17,6 @@ lib_common_sources = '''
        mbsalign.c
        mbsedit.c
        md5.c
-       netaddrq.c
-       netlink.c
        pidutils.c
        pidfd-utils.c
        procfs.c
@@ -51,6 +49,8 @@ lib_common_sources += [idcache_c,
                        strutils_c,
                        strv_c]
 
+netlink_files_c = files('netlink.c', 'netaddrq.c')
+
 monotonic_c = files('monotonic.c')
 timer_c = files('timer.c')
 swapprober_c = files('swapprober.c')
index a0ebd077ef6dd1996ff884d0c255c03cbdfa924a..261325dbd92d9b89955e3f3c50f22b51a5d052d9 100644 (file)
@@ -51,6 +51,9 @@ agetty_SOURCES = term-utils/agetty.c \
 if USE_PLYMOUTH_SUPPORT
 agetty_SOURCES += lib/plymouth-ctrl.c
 endif
+if LINUX
+agetty_SOURCES += lib/netlink.c lib/netaddrq.c
+endif
 agetty_LDADD = $(LDADD) libcommon.la
 if BSD
 agetty_LDADD += -lutil
index dca399016d760c657593609562f2d710c1cc2995..c9e3739ee7123c6d9825b7afae89f57f9cbba4b8 100644 (file)
@@ -24,6 +24,9 @@ scriptreplay_manadocs = files('scriptreplay.1.adoc')
 agetty_sources = files(
   'agetty.c',
 )
+if LINUX
+  agetty_sources += netlink_files_c
+endif
 agetty_manadocs = files('agetty.8.adoc')
 
 setterm_sources = files(