From 4d722cd3eb41f83ab09a1275402c7a3e1f99ce11 Mon Sep 17 00:00:00 2001 From: Ryusuke Konishi Date: Sat, 17 Feb 2024 01:39:47 +0900 Subject: [PATCH] Make installation of kernel uapi header files optional The bundled kernel's uapi header files ("nilfs2_ondisk.h" and "nilfs2_api.h") are included in kernel-related development packages in modern Linux distributions, resulting in duplicate installations. In order to eliminate this duplication, make the installation of these files optional and not install them by default. The utilities will continue to refer to the included uapi header files, and will only allow installation on the system, which can be specified using the "--enable-uapi-header-install" option in configure file arguments. This is a workaround for older environments and should normally be disabled. Signed-off-by: Ryusuke Konishi --- README | 17 +++++++++++++++++ configure.ac | 9 +++++++++ include/Makefile.am | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/README b/README index 5192800..e0c971d 100644 --- a/README +++ b/README @@ -55,6 +55,23 @@ of selinux context mount options (-o context=, etc): For helpers built with mount library (libmount), support of the context mount depends on the libmount that distro provides. +If you are having problems due to the missing nilfs2 disk format or +ioctl interface definition file (nilfs2_ondisk.h or nilfs2_api.h, +respectively), try installing the Linux kernel source or header file +package first. + +If you still cannot install these files, or if you want to overwrite +them with files from this package, specify the +"--enable-uapi-header-install" option as an argument to the configure +script. This will install the uapi header files included in this +package: + + $ ./configure --enable-uapi-header-install + +Note that the utility package itself references bundled local header +files, so you don't need to install these files with this option to +build. + * How to get development sources diff --git a/configure.ac b/configure.ac index 98bc107..ff450aa 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,12 @@ AC_ARG_WITH([blkid], AS_HELP_STRING([--without-blkid], [compile without blkid support]), [], with_blkid=yes) +AC_ARG_ENABLE([uapi_header_install], + AS_HELP_STRING([--enable-uapi-header-install], + [install kernel uapi header files]), + [enable_uapi_header_install="${enableval}"], + [enable_uapi_header_install=no]) + # Checks for libraries. AC_CHECK_LIB([uuid], [uuid_generate], [AC_DEFINE([HAVE_LIBUUID], 1, @@ -139,6 +145,9 @@ if test "${with_selinux}" = "yes"; then fi AC_SUBST([LIB_SELINUX]) +AM_CONDITIONAL(CONFIG_UAPI_HEADER_INSTALL, + [test "$enable_uapi_header_install" = yes]) + # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE diff --git a/include/Makefile.am b/include/Makefile.am index 93f3c01..dc43dad 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,4 +5,8 @@ noinst_HEADERS = realpath.h nls.h parser.h nilfs_feature.h \ vector.h nilfs_gc.h cnormap.h cleaner_msg.h cleaner_exec.h \ compat.h crc32.h pathnames.h segment.h util.h +if CONFIG_UAPI_HEADER_INSTALL nobase_include_HEADERS = linux/nilfs2_api.h linux/nilfs2_ondisk.h +else +noinst_HEADERS += linux/nilfs2_api.h linux/nilfs2_ondisk.h +endif