Update submodule: composefs
authorAlexander Larsson <alexl@redhat.com>
Tue, 23 May 2023 08:31:23 +0000 (10:31 +0200)
committerAlexander Larsson <alexl@redhat.com>
Wed, 31 May 2023 08:57:37 +0000 (10:57 +0200)
Instead of using pkg-config, etc we just include composefs.
In the end the library is just 5 c source files, and it is set up
to be easy to use as a submodule.

For now, composefs support is disabled by default.

.gitmodules
Makefile-libostree.am
Makefile-switchroot.am
Makefile.am
autogen.sh
composefs [new submodule]
configure.ac

index 1da1f9b2972586e10edacd65628daa3d75f3be20..0de0c83106659c8aad64734c773c7548f87ef3c0 100644 (file)
@@ -4,3 +4,6 @@
 [submodule "bsdiff"]
        path = bsdiff
        url = https://github.com/mendsley/bsdiff
+[submodule "composefs"]
+       path = composefs
+       url = https://github.com/containers/composefs.git
index 0e984c7d5e9b22cf7959912dd1dc0b72384fd1f1..8edd7f4de17d922f5e16d3359be1bf5ba75d52a9 100644 (file)
@@ -185,7 +185,7 @@ EXTRA_DIST += \
        $(top_srcdir)/src/libostree/libostree-released.sym \
        $(NULL)
 
-libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
+libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/composefs -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
        $(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_CRYPTO_CFLAGS) \
        -fvisibility=hidden '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) extern' \
        -DPKGLIBEXECDIR=\"$(pkglibexecdir)\"
@@ -268,8 +268,7 @@ libostree_1_la_LIBADD += $(OT_DEP_LIBSODIUM_LIBS)
 endif # USE_LIBSODIUM
 
 if USE_COMPOSEFS
-libostree_1_la_CFLAGS += $(OT_DEP_COMPOSEFS_CFLAGS)
-libostree_1_la_LIBADD += $(OT_DEP_COMPOSEFS_LIBS)
+libostree_1_la_LIBADD += libcomposefs.la
 endif # USE_COMPOSEFS
 
 # XXX: work around clang being passed -fstack-clash-protection which it doesn't understand
index 8c486e4935b0a01e3228a57c08182312d3c56422..8063d9e0cbaae0d08a9a08f79866ddb47bc209b1 100644 (file)
@@ -45,10 +45,10 @@ if BUILDOPT_USE_STATIC_COMPILER
 ostree_boot_SCRIPTS += ostree-prepare-root
 
 ostree-prepare-root : $(ostree_prepare_root_SOURCES)
-       $(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) $(OT_DEP_COMPOSEFS_CFLAGS) $(OT_DEP_COMPOSEFS_LIBS) -DOSTREE_PREPARE_ROOT_STATIC=1
+       $(STATIC_COMPILER) -o $@ -static $(top_srcdir)/src/switchroot/ostree-prepare-root.c $(ostree_prepare_root_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) -DOSTREE_PREPARE_ROOT_STATIC=1
 else
 ostree_boot_PROGRAMS += ostree-prepare-root
-ostree_prepare_root_CFLAGS += $(AM_CFLAGS) -Isrc/switchroot
+ostree_prepare_root_CFLAGS += $(AM_CFLAGS) -Isrc/switchroot -I$(srcdir)/composefs
 endif
 
 ostree_remount_SOURCES = \
@@ -59,8 +59,7 @@ ostree_remount_CPPFLAGS = $(AM_CPPFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -Isrc/sw
 ostree_remount_LDADD = $(AM_LDFLAGS) $(OT_INTERNAL_GIO_UNIX_LIBS) libglnx.la
 
 if USE_COMPOSEFS
-ostree_prepare_root_CFLAGS += $(OT_DEP_COMPOSEFS_CFLAGS)
-ostree_prepare_root_LDADD += $(OT_DEP_COMPOSEFS_LIBS)
+ostree_prepare_root_LDADD += libcomposefs.la
 endif
 
 if BUILDOPT_SYSTEMD
index cccf6ae7eaa7ffa225f65d4819b042498dbf5c0a..ca7dec9e4f3f6bd8dbdd6c40c35f008759130b24 100644 (file)
@@ -117,6 +117,15 @@ include bsdiff/Makefile-bsdiff.am.inc
 EXTRA_DIST += bsdiff/Makefile-bsdiff.am
 noinst_LTLIBRARIES += libbsdiff.la
 
+COMPOSEFSDIR=$(srcdir)/composefs/libcomposefs
+LCFS_DEP_CRYPTO_CFLAGS=$(OT_DEP_CRYPTO_CFLAGS)
+LCFS_DEP_CRYPTO_LIBS=$(OT_DEP_CRYPTO_LIBS)
+include composefs/libcomposefs/Makefile-lib.am.inc
+EXTRA_DIST += composefs/libcomposefs/Makefile-lib.am
+if USE_COMPOSEFS
+noinst_LTLIBRARIES += libcomposefs.la
+endif
+
 include Makefile-otutil.am
 include Makefile-libostree.am
 include Makefile-ostree.am
index 689bba8f89327186e98b47062b179b225dabbad0..ea2412c4e91e9a9eeaac679f8cb98d9706d91a5e 100755 (executable)
@@ -35,6 +35,7 @@ fi
 # changing this, please also change Makefile.am.
 sed -e 's,$(libglnx_srcpath),libglnx,g' < libglnx/Makefile-libglnx.am >libglnx/Makefile-libglnx.am.inc
 sed -e 's,$(libbsdiff_srcpath),bsdiff,g' < bsdiff/Makefile-bsdiff.am >bsdiff/Makefile-bsdiff.am.inc
+sed -e 's,$(COMPOSEFSDIR),composefs/libcomposefs,g' < composefs/libcomposefs/Makefile-lib.am >composefs/libcomposefs/Makefile-lib.am.inc
 
 # FIXME - figure out how to get aclocal to find this by default
 ln -sf ../libglnx/libglnx.m4 buildutil/libglnx.m4
diff --git a/composefs b/composefs
new file mode 160000 (submodule)
index 0000000..e5ab5e2
--- /dev/null
+++ b/composefs
@@ -0,0 +1 @@
+Subproject commit e5ab5e2dc6aa6bd2daab3052553b787efe16fc7d
index 95f0047d87e4f7489e8c0fb44713bff79cc2353d..f7ae2d64b7725b4dafcf3d771a6efa827d3947ca 100644 (file)
@@ -280,31 +280,34 @@ AS_IF([test x$have_gpgme = xyes],
 )
 AM_CONDITIONAL(USE_GPGME, test "x$have_gpgme" = xyes)
 
-COMPOSEFS_DEPENDENCY="composefs >= 0.1.2"
+# These are needed by libcomposefs
+AC_MSG_CHECKING([for new mount API (fsconfig)])
+AC_COMPILE_IFELSE(
+       [AC_LANG_SOURCE([[
+                       #include <sys/mount.h>
+                       int cmd = FSCONFIG_CMD_CREATE;
+       ]])],
+       [AC_MSG_RESULT(yes)
+                AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE_SYS_MOUNT_H], 1, [Define if FSCONFIG_CMD_CREATE is available in sys/mount.h])],
+       [AC_MSG_RESULT(no)])
+AC_COMPILE_IFELSE(
+       [AC_LANG_SOURCE([[
+                       /* also make sure it doesn't conflict with <sys/mount.h> since it is always used.  */
+                       #include <sys/mount.h>
+                       #include <linux/mount.h>
+                       int cmd = FSCONFIG_CMD_CREATE;
+       ]])],
+       [AC_MSG_RESULT(yes)
+                AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H], 1, [Define if FSCONFIG_CMD_CREATE is available in linux/mount.h])],
+       [AC_MSG_RESULT(no)])
+
 AC_ARG_WITH(composefs,
-           AS_HELP_STRING([--without-composefs], [Do not use composefs]),
-           :, with_composefs=maybe)
-
-AS_IF([ test x$with_composefs != xno ], [
-    AC_MSG_CHECKING([for $COMPOSEFS_DEPENDENCY])
-    PKG_CHECK_EXISTS($COMPOSEFS_DEPENDENCY, have_composefs=yes, have_composefs=no)
-    AC_MSG_RESULT([$have_composefs])
-    AS_IF([ test x$have_composefs = xno && test x$with_composefs != xmaybe ], [
-       AC_MSG_ERROR([composefs is enabled but could not be found])
-    ])
-    AS_IF([ test x$have_composefs = xyes], [
-        AC_DEFINE([HAVE_COMPOSEFS], 1, [Define if we have composefs.pc])
-       PKG_CHECK_MODULES(OT_DEP_COMPOSEFS, $COMPOSEFS_DEPENDENCY)
-        save_LIBS=$LIBS
-        LIBS=$OT_DEP_COMPOSEFS_LIBS
-        AC_CHECK_FUNCS(lcfs_node_new)
-        LIBS=$save_LIBS
-       with_composefs=yes
-    ], [
-       with_composefs=no
-    ])
-], [ with_composefs=no ])
-if test x$with_composefs != xno; then OSTREE_FEATURES="$OSTREE_FEATURES composefs"; fi
+           AS_HELP_STRING([--with-composefs], [Support composefs]),
+           :, with_composefs=no)
+
+if test x$with_composefs != xno; then OSTREE_FEATURES="$OSTREE_FEATURES composefs";
+   AC_DEFINE([HAVE_COMPOSEFS], 1, [Define if we have libcomposefs])
+fi
 AM_CONDITIONAL(USE_COMPOSEFS, test $with_composefs != no)
 
 LIBSODIUM_DEPENDENCY="1.0.14"