diff --git a/.gitignore b/.gitignore index 51d4ce70..762e5048 100644 --- a/.gitignore +++ b/.gitignore @@ -51,10 +51,10 @@ document-portal/xdp-dbus.[ch] document-portal/xdp-resources.[ch] .dirstamp test-suite*.log -lib/flatpak-version-macros.h +common/flatpak-version-macros.h flatpak.pc -lib/flatpak-enum-types.c -lib/flatpak-enum-types.h +common/flatpak-enum-types.c +common/flatpak-enum-types.h test-libflatpak Flatpak-1.0.* /app/parse-datetime.c diff --git a/Makefile.am b/Makefile.am index b880832d..5f99e152 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,8 +51,6 @@ AM_CPPFLAGS = \ -I$(srcdir)/libglnx \ -I$(srcdir)/common \ -I$(builddir)/common \ - -I$(srcdir)/lib \ - -I$(builddir)/lib \ -include "config.h" \ $(NULL) @@ -90,7 +88,6 @@ include libglnx/Makefile-libglnx.am.inc include common/Makefile.am.inc include data/Makefile.am.inc include app/Makefile.am.inc -include lib/Makefile.am.inc include session-helper/Makefile.am.inc include portal/Makefile.am.inc include system-helper/Makefile.am.inc diff --git a/app/flatpak-builtins-install.c b/app/flatpak-builtins-install.c index bd6a1482..ff024b79 100644 --- a/app/flatpak-builtins-install.c +++ b/app/flatpak-builtins-install.c @@ -35,7 +35,7 @@ #include "flatpak-builtins-utils.h" #include "flatpak-transaction.h" #include "flatpak-utils-private.h" -#include "lib/flatpak-error.h" +#include "flatpak-error.h" #include "flatpak-chain-input-stream-private.h" static char *opt_arch; diff --git a/common/Makefile.am.inc b/common/Makefile.am.inc index bb74d859..ab544cd9 100644 --- a/common/Makefile.am.inc +++ b/common/Makefile.am.inc @@ -1,8 +1,39 @@ +lib_LTLIBRARIES += libflatpak.la noinst_LTLIBRARIES += libflatpak-common.la +noinst_PROGRAMS += test-libflatpak + +flatpakincludedir = $(includedir)/flatpak + +flatpakinclude_HEADERS = \ + common/flatpak.h \ + common/flatpak-ref.h \ + common/flatpak-error.h \ + common/flatpak-installed-ref.h \ + common/flatpak-remote-ref.h \ + common/flatpak-related-ref.h \ + common/flatpak-bundle-ref.h \ + common/flatpak-installation.h \ + common/flatpak-remote.h \ + common/flatpak-version-macros.h \ + $(NULL) + +nodist_flatpakinclude_HEADERS = \ + common/flatpak-enum-types.h \ + $(NULL) dbus_built_sources = common/flatpak-dbus-generated.c common/flatpak-dbus-generated.h common/flatpak-document-dbus-generated.c common/flatpak-document-dbus-generated.h systemd_dbus_built_sources = common/flatpak-systemd-dbus-generated.c common/flatpak-systemd-dbus-generated.h +common/flatpak-enum-types.h: $(flatpakinclude_HEADERS) common/flatpak-enum-types.h.template + $(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \ + common/flatpak-enum-types.h.tmp && mv common/flatpak-enum-types.h.tmp common/flatpak-enum-types.h + +common/flatpak-enum-types.c: $(flatpakinclude_HEADERS) common/flatpak-enum-types.c.template + $(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \ + common/flatpak-enum-types.c.tmp && mv common/flatpak-enum-types.c.tmp common/flatpak-enum-types.c + +EXTRA_DIST += common/flatpak-enum-types.c.template common/flatpak-enum-types.h.template + common/flatpak-dbus-generated.c: data/org.freedesktop.Flatpak.xml Makefile mkdir -p $(builddir)/common $(AM_V_GEN) $(GDBUS_CODEGEN) \ @@ -34,15 +65,18 @@ common/%-dbus-generated.h: common/%-dbus-generated.c @true # Built as a side-effect of the rules for the .c nodist_libflatpak_common_la_SOURCES = \ + $(nodist_flatpakinclude_HEADERS) \ $(dbus_built_sources) \ $(systemd_dbus_built_sources) \ $(xdp_dbus_built_sources) \ + common/flatpak-enum-types.c \ $(NULL) BUILT_SOURCES += $(nodist_libflatpak_common_la_SOURCES) CLEANFILES += $(nodist_libflatpak_common_la_SOURCES) libflatpak_common_la_SOURCES = \ + $(flatpakinclude_HEADERS) \ common/flatpak-common-types-private.h \ common/flatpak-bwrap.c \ common/flatpak-bwrap-private.h \ @@ -66,9 +100,22 @@ libflatpak_common_la_SOURCES = \ common/flatpak-json-oci-private.h \ common/flatpak-oci-registry.c \ common/flatpak-oci-registry-private.h \ + common/flatpak-ref.c \ + common/flatpak-installed-ref.c \ + common/flatpak-installed-ref-private.h \ + common/flatpak-remote-ref.c \ + common/flatpak-remote-ref-private.h \ + common/flatpak-bundle-ref.c \ + common/flatpak-related-ref.c \ + common/flatpak-related-ref-private.h \ + common/flatpak-remote-private.h \ + common/flatpak-remote.c \ + common/flatpak-error.c \ + common/flatpak-installation.c \ $(NULL) libflatpak_common_la_CFLAGS = \ + -DFLATPAK_COMPILATION \ $(AM_CFLAGS) \ $(BASE_CFLAGS) \ $(HIDDEN_VISIBILITY_CFLAGS) \ @@ -81,3 +128,90 @@ libflatpak_common_la_CFLAGS = \ -I$(srcdir)/dbus-proxy \ $(NULL) libflatpak_common_la_LIBADD = $(AM_LIBADD) libglnx.la $(BASE_LIBS) $(OSTREE_LIBS) $(SOUP_LIBS) $(JSON_LIBS) $(XAUTH_LIBS) $(LIBSECCOMP_LIBS) $(INTERNAL_GPGME_LIBS) + + +libflatpak_la_SOURCES = \ + common/flatpak.c \ + $(NULL) + +libflatpak_la_CFLAGS = \ + $(HIDDEN_VISIBILITY_CFLAGS) \ + -DFLATPAK_COMPILATION \ + -I$(top_srcdir)/common \ + -I$(top_builddir)/common \ + $(AM_CFLAGS) \ + $(BASE_CFLAGS) \ + $(OSTREE_CFLAGS) \ + $(SOUP_CFLAGS) \ + $(JSON_CFLAGS) \ + $(NULL) + +libflatpak_la_LDFLAGS = \ + $(AM_LDFLAGS) \ + -version-info $(LT_VERSION_INFO) \ + -export-dynamic \ + -rpath $(libdir) \ + $(NULL) + +libflatpak_la_LIBADD = \ + $(AM_LIBADD) \ + libflatpak-common.la \ + $(BASE_LIBS) \ + $(OSTREE_LIBS) \ + $(SOUP_LIBS) \ + $(JSON_LIBS) \ + $(NULL) + +test_libflatpak_SOURCES = \ + common/test-lib.c \ + $(NULL) + +test_libflatpak_CFLAGS = \ + $(AM_CFLAGS) \ + $(BASE_CFLAGS) \ + -I$(top_srcdir)/common \ + -I$(top_builddir)/common \ + $(NULL) + +test_libflatpak_LDADD = \ + $(AM_LDADD) \ + $(BASE_LIBS) \ + libflatpak.la \ + $(NULL) + +# gobject-introspection rules +-include $(INTROSPECTION_MAKEFILE) + +INTROSPECTION_GIRS = + +if HAVE_INTROSPECTION +Flatpak-1.0.gir: libflatpak.la Makefile + +introspected_headers = \ + $(flatpakinclude_HEADERS) \ + $(nodist_flatpakinclude_HEADERS) \ + $(NULL) +introspected_sources = $(filter-out %-private.h,$(sources)) + +Flatpak_1_0_gir_NAMESPACE = Flatpak +Flatpak_1_0_gir_VERSION = 1.0 +Flatpak_1_0_gir_LIBS = libflatpak.la +Flatpak_1_0_gir_FILES = $(introspected_headers) $(introspected_sources) +Flatpak_1_0_gir_CFLAGS = $(libflatpak_la_CFLAGS) +Flatpak_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 +Flatpak_1_0_gir_SCANNERFLAGS = \ + --warn-all \ + --c-include='flatpak.h' \ + --pkg-export=flatpak + +INTROSPECTION_GIRS += Flatpak-1.0.gir + +girdir = $(datadir)/gir-1.0 +nodist_gir_DATA = $(INTROSPECTION_GIRS) +CLEANFILES += $(nodist_gir_DATA) + +typelibdir = $(libdir)/girepository-1.0 +nodist_typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) +CLEANFILES += $(nodist_typelib_DATA) + +endif # HAVE_INTROSPECTION diff --git a/lib/flatpak-bundle-ref.c b/common/flatpak-bundle-ref.c similarity index 100% rename from lib/flatpak-bundle-ref.c rename to common/flatpak-bundle-ref.c diff --git a/lib/flatpak-bundle-ref.h b/common/flatpak-bundle-ref.h similarity index 100% rename from lib/flatpak-bundle-ref.h rename to common/flatpak-bundle-ref.h diff --git a/common/flatpak-context.c b/common/flatpak-context.c index 30472c66..179aee21 100644 --- a/common/flatpak-context.c +++ b/common/flatpak-context.c @@ -42,7 +42,7 @@ #include "flatpak-utils-private.h" #include "flatpak-dir-private.h" #include "flatpak-systemd-dbus-generated.h" -#include "lib/flatpak-error.h" +#include "flatpak-error.h" /* Same order as enum */ const char *flatpak_context_shares[] = { diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 2262fbc0..19911528 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -38,7 +38,7 @@ #include #include #include "libglnx/libglnx.h" -#include "lib/flatpak-error.h" +#include "flatpak-error.h" #include #include "flatpak-dir-private.h" diff --git a/lib/flatpak-enum-types.c.template b/common/flatpak-enum-types.c.template similarity index 100% rename from lib/flatpak-enum-types.c.template rename to common/flatpak-enum-types.c.template diff --git a/lib/flatpak-enum-types.h.template b/common/flatpak-enum-types.h.template similarity index 100% rename from lib/flatpak-enum-types.h.template rename to common/flatpak-enum-types.h.template diff --git a/lib/flatpak-error.c b/common/flatpak-error.c similarity index 100% rename from lib/flatpak-error.c rename to common/flatpak-error.c diff --git a/lib/flatpak-error.h b/common/flatpak-error.h similarity index 100% rename from lib/flatpak-error.h rename to common/flatpak-error.h diff --git a/common/flatpak-exports.c b/common/flatpak-exports.c index af6d5ea9..807f04d0 100644 --- a/common/flatpak-exports.c +++ b/common/flatpak-exports.c @@ -46,7 +46,7 @@ #include "flatpak-utils-private.h" #include "flatpak-dir-private.h" #include "flatpak-systemd-dbus-generated.h" -#include "lib/flatpak-error.h" +#include "flatpak-error.h" /* We don't want to export paths pointing into these, because they are readonly (so we can't create mountpoints there) and don't match whats on the host anyway */ diff --git a/lib/flatpak-installation.c b/common/flatpak-installation.c similarity index 100% rename from lib/flatpak-installation.c rename to common/flatpak-installation.c diff --git a/lib/flatpak-installation.h b/common/flatpak-installation.h similarity index 100% rename from lib/flatpak-installation.h rename to common/flatpak-installation.h diff --git a/lib/flatpak-installed-ref-private.h b/common/flatpak-installed-ref-private.h similarity index 100% rename from lib/flatpak-installed-ref-private.h rename to common/flatpak-installed-ref-private.h diff --git a/lib/flatpak-installed-ref.c b/common/flatpak-installed-ref.c similarity index 100% rename from lib/flatpak-installed-ref.c rename to common/flatpak-installed-ref.c diff --git a/lib/flatpak-installed-ref.h b/common/flatpak-installed-ref.h similarity index 100% rename from lib/flatpak-installed-ref.h rename to common/flatpak-installed-ref.h diff --git a/lib/flatpak-ref.c b/common/flatpak-ref.c similarity index 100% rename from lib/flatpak-ref.c rename to common/flatpak-ref.c diff --git a/lib/flatpak-ref.h b/common/flatpak-ref.h similarity index 100% rename from lib/flatpak-ref.h rename to common/flatpak-ref.h diff --git a/lib/flatpak-related-ref-private.h b/common/flatpak-related-ref-private.h similarity index 100% rename from lib/flatpak-related-ref-private.h rename to common/flatpak-related-ref-private.h diff --git a/lib/flatpak-related-ref.c b/common/flatpak-related-ref.c similarity index 100% rename from lib/flatpak-related-ref.c rename to common/flatpak-related-ref.c diff --git a/lib/flatpak-related-ref.h b/common/flatpak-related-ref.h similarity index 100% rename from lib/flatpak-related-ref.h rename to common/flatpak-related-ref.h diff --git a/lib/flatpak-remote-private.h b/common/flatpak-remote-private.h similarity index 100% rename from lib/flatpak-remote-private.h rename to common/flatpak-remote-private.h diff --git a/lib/flatpak-remote-ref-private.h b/common/flatpak-remote-ref-private.h similarity index 100% rename from lib/flatpak-remote-ref-private.h rename to common/flatpak-remote-ref-private.h diff --git a/lib/flatpak-remote-ref.c b/common/flatpak-remote-ref.c similarity index 100% rename from lib/flatpak-remote-ref.c rename to common/flatpak-remote-ref.c diff --git a/lib/flatpak-remote-ref.h b/common/flatpak-remote-ref.h similarity index 100% rename from lib/flatpak-remote-ref.h rename to common/flatpak-remote-ref.h diff --git a/lib/flatpak-remote.c b/common/flatpak-remote.c similarity index 100% rename from lib/flatpak-remote.c rename to common/flatpak-remote.c diff --git a/lib/flatpak-remote.h b/common/flatpak-remote.h similarity index 100% rename from lib/flatpak-remote.h rename to common/flatpak-remote.h diff --git a/common/flatpak-run.c b/common/flatpak-run.c index 21c5f5ec..5b5e8a50 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -52,7 +52,7 @@ #include "flatpak-dir-private.h" #include "flatpak-systemd-dbus-generated.h" #include "flatpak-document-dbus-generated.h" -#include "lib/flatpak-error.h" +#include "flatpak-error.h" #define DEFAULT_SHELL "/bin/sh" diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 318e11b7..5709f21f 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -21,7 +21,7 @@ #include "config.h" #include "flatpak-utils-private.h" -#include "lib/flatpak-error.h" +#include "flatpak-error.h" #include "flatpak-dir-private.h" #include "flatpak-oci-registry-private.h" #include "flatpak-run-private.h" diff --git a/lib/flatpak-version-macros.h.in b/common/flatpak-version-macros.h.in similarity index 100% rename from lib/flatpak-version-macros.h.in rename to common/flatpak-version-macros.h.in diff --git a/lib/flatpak.c b/common/flatpak.c similarity index 100% rename from lib/flatpak.c rename to common/flatpak.c diff --git a/lib/flatpak.h b/common/flatpak.h similarity index 100% rename from lib/flatpak.h rename to common/flatpak.h diff --git a/lib/test-lib.c b/common/test-lib.c similarity index 100% rename from lib/test-lib.c rename to common/test-lib.c diff --git a/configure.ac b/configure.ac index 57d3cd1a..a14792f6 100644 --- a/configure.ac +++ b/configure.ac @@ -437,7 +437,7 @@ Makefile doc/Makefile doc/reference/Makefile flatpak.pc -lib/flatpak-version-macros.h +common/flatpak-version-macros.h doc/reference/version.xml doc/flatpak-docs.xml po/Makefile.in diff --git a/lib/Makefile.am.inc b/lib/Makefile.am.inc deleted file mode 100644 index 06751b8a..00000000 --- a/lib/Makefile.am.inc +++ /dev/null @@ -1,149 +0,0 @@ -lib_LTLIBRARIES += libflatpak.la -noinst_PROGRAMS += test-libflatpak - -flatpakincludedir = $(includedir)/flatpak - -flatpakinclude_HEADERS = \ - lib/flatpak.h \ - lib/flatpak-ref.h \ - lib/flatpak-error.h \ - lib/flatpak-installed-ref.h \ - lib/flatpak-remote-ref.h \ - lib/flatpak-related-ref.h \ - lib/flatpak-bundle-ref.h \ - lib/flatpak-installation.h \ - lib/flatpak-remote.h \ - lib/flatpak-version-macros.h \ - $(NULL) - -nodist_flatpakinclude_HEADERS = \ - lib/flatpak-enum-types.h \ - $(NULL) - -BUILT_SOURCES += \ - $(nodist_flatpakinclude_HEADERS) \ - $(nodist_libflatpak_la_SOURCES) \ - $(NULL) - -DISTCLEANFILES += \ - $(nodist_flatpakinclude_HEADERS) \ - $(nodist_libflatpak_la_SOURCES) \ - $(NULL) - - -lib/flatpak-enum-types.h: $(flatpakinclude_HEADERS) lib/flatpak-enum-types.h.template - $(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \ - lib/flatpak-enum-types.h.tmp && mv lib/flatpak-enum-types.h.tmp lib/flatpak-enum-types.h - -lib/flatpak-enum-types.c: $(flatpakinclude_HEADERS) lib/flatpak-enum-types.c.template - $(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \ - lib/flatpak-enum-types.c.tmp && mv lib/flatpak-enum-types.c.tmp lib/flatpak-enum-types.c - -EXTRA_DIST += lib/flatpak-enum-types.c.template lib/flatpak-enum-types.h.template - -libflatpak_la_SOURCES = \ - lib/flatpak.c \ - lib/flatpak-ref.c \ - lib/flatpak-installed-ref.c \ - lib/flatpak-installed-ref-private.h \ - lib/flatpak-remote-ref.c \ - lib/flatpak-remote-ref-private.h \ - lib/flatpak-bundle-ref.c \ - lib/flatpak-related-ref.c \ - lib/flatpak-related-ref-private.h \ - lib/flatpak-remote-private.h \ - lib/flatpak-remote.c \ - lib/flatpak-error.c \ - lib/flatpak-installation.c \ - $(NULL) - -nodist_libflatpak_la_SOURCES = \ - lib/flatpak-enum-types.c \ - $(NULL) - -sources = \ - $(libflatpak_la_SOURCES) \ - $(nodist_libflatpak_la_SOURCES) \ - $(NULL) - -libflatpak_la_CFLAGS = \ - $(HIDDEN_VISIBILITY_CFLAGS) \ - -DFLATPAK_COMPILATION \ - -I$(top_srcdir)/lib \ - -I$(top_builddir)/lib \ - $(AM_CFLAGS) \ - $(BASE_CFLAGS) \ - $(OSTREE_CFLAGS) \ - $(SOUP_CFLAGS) \ - $(JSON_CFLAGS) \ - $(NULL) - -libflatpak_la_LDFLAGS = \ - $(AM_LDFLAGS) \ - -version-info $(LT_VERSION_INFO) \ - -export-dynamic \ - -rpath $(libdir) \ - $(NULL) - -libflatpak_la_LIBADD = \ - $(AM_LIBADD) \ - libflatpak-common.la \ - $(BASE_LIBS) \ - $(OSTREE_LIBS) \ - $(SOUP_LIBS) \ - $(JSON_LIBS) \ - $(NULL) - -test_libflatpak_SOURCES = \ - lib/test-lib.c \ - $(NULL) - -test_libflatpak_CFLAGS = \ - $(AM_CFLAGS) \ - $(BASE_CFLAGS) \ - -I$(top_srcdir)/lib \ - -I$(top_builddir)/lib \ - $(NULL) - -test_libflatpak_LDADD = \ - $(AM_LDADD) \ - $(BASE_LIBS) \ - libflatpak.la \ - $(NULL) - -# gobject-introspection rules --include $(INTROSPECTION_MAKEFILE) - -INTROSPECTION_GIRS = - -if HAVE_INTROSPECTION -Flatpak-1.0.gir: libflatpak.la Makefile - -introspected_headers = \ - $(flatpakinclude_HEADERS) \ - $(nodist_flatpakinclude_HEADERS) \ - $(NULL) -introspected_sources = $(filter-out %-private.h,$(sources)) - -Flatpak_1_0_gir_NAMESPACE = Flatpak -Flatpak_1_0_gir_VERSION = 1.0 -Flatpak_1_0_gir_LIBS = libflatpak.la -Flatpak_1_0_gir_FILES = $(introspected_headers) $(introspected_sources) -Flatpak_1_0_gir_CFLAGS = $(libflatpak_la_CFLAGS) -Flatpak_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 -Flatpak_1_0_gir_SCANNERFLAGS = \ - --warn-all \ - --c-include='flatpak.h' \ - --pkg-export=flatpak - -INTROSPECTION_GIRS += Flatpak-1.0.gir - -girdir = $(datadir)/gir-1.0 -nodist_gir_DATA = $(INTROSPECTION_GIRS) -CLEANFILES += $(nodist_gir_DATA) - -typelibdir = $(libdir)/girepository-1.0 -nodist_typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) -CLEANFILES += $(nodist_typelib_DATA) - -endif # HAVE_INTROSPECTION diff --git a/system-helper/Makefile.am.inc b/system-helper/Makefile.am.inc index c4749869..c2838f2f 100644 --- a/system-helper/Makefile.am.inc +++ b/system-helper/Makefile.am.inc @@ -16,7 +16,6 @@ systemdsystemunit_DATA = system-helper/flatpak-system-helper.service flatpak_system_helper_SOURCES = \ system-helper/flatpak-system-helper.c \ - lib/flatpak-error.c \ $(NULL) flatpak_system_helper_LDADD = $(BASE_LIBS) $(OSTREE_LIBS) $(JSON_LIBS) $(POLKIT_LIBS) libflatpak-common.la diff --git a/system-helper/flatpak-system-helper.c b/system-helper/flatpak-system-helper.c index 6692928e..b9ede81b 100644 --- a/system-helper/flatpak-system-helper.c +++ b/system-helper/flatpak-system-helper.c @@ -29,7 +29,7 @@ #include "flatpak-dbus-generated.h" #include "flatpak-dir-private.h" #include "flatpak-oci-registry-private.h" -#include "lib/flatpak-error.h" +#include "flatpak-error.h" static PolkitAuthority *authority = NULL; static FlatpakSystemHelper *helper = NULL;