From c18626f11c22776763274ebbec589b4133f22a58 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 12 Jun 2016 09:45:14 +0100 Subject: [PATCH 1/6] common: don't distribute generated GDBus files in tarballs Signed-off-by: Simon McVittie --- common/Makefile.am.inc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/common/Makefile.am.inc b/common/Makefile.am.inc index 06d676d9..a3b5ddd5 100644 --- a/common/Makefile.am.inc +++ b/common/Makefile.am.inc @@ -2,7 +2,6 @@ noinst_LTLIBRARIES += libflatpak-common.la dbus_built_sources = common/flatpak-dbus.c common/flatpak-dbus.h systemd_dbus_built_sources = common/flatpak-systemd-dbus.c common/flatpak-systemd-dbus.h -BUILT_SOURCES += $(dbus_built_sources) $(systemd_dbus_built_sources) $(dbus_built_sources) : data/org.freedesktop.Flatpak.xml $(AM_V_GEN) $(GDBUS_CODEGEN) \ @@ -20,6 +19,14 @@ $(systemd_dbus_built_sources) : data/org.freedesktop.systemd1.xml $(srcdir)/data/org.freedesktop.systemd1.xml \ $(NULL) +nodist_libflatpak_common_la_SOURCES = \ + $(dbus_built_sources) \ + $(systemd_dbus_built_sources) \ + $(NULL) + +BUILT_SOURCES += $(nodist_libflatpak_common_la_SOURCES) +CLEANFILES += $(nodist_libflatpak_common_la_SOURCES) + libflatpak_common_la_SOURCES = \ common/flatpak-common-types.h \ common/flatpak-dir.c \ @@ -39,8 +46,6 @@ libflatpak_common_la_SOURCES = \ common/gvdb/gvdb-builder.c \ common/flatpak-db.c \ common/flatpak-db.h \ - $(dbus_built_sources) \ - $(systemd_dbus_built_sources) \ $(NULL) libflatpak_common_la_CFLAGS = \ From 2e729aacab18e30f0cbfac7ca2b7aaa2ba41ed1f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 12 Jun 2016 09:53:36 +0100 Subject: [PATCH 2/6] lib: do not distribute generated files in tarball Signed-off-by: Simon McVittie --- lib/Makefile.am.inc | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/Makefile.am.inc b/lib/Makefile.am.inc index 4dc41fa4..f1d51278 100644 --- a/lib/Makefile.am.inc +++ b/lib/Makefile.am.inc @@ -1,7 +1,9 @@ lib_LTLIBRARIES += libflatpak.la noinst_PROGRAMS += test-libflatpak -public_headers = \ +flatpakincludedir = $(includedir)/flatpak + +flatpakinclude_HEADERS = \ lib/flatpak.h \ lib/flatpak-ref.h \ lib/flatpak-error.h \ @@ -13,37 +15,33 @@ public_headers = \ lib/flatpak-version-macros.h \ $(NULL) -generated_public_headers = \ +nodist_flatpakinclude_HEADERS = \ lib/flatpak-enum-types.h \ $(NULL) BUILT_SOURCES += \ - lib/flatpak-enum-types.c \ - lib/flatpak-enum-types.h \ + $(nodist_flatpakinclude_HEADERS) \ + $(nodist_libflatpak_la_SOURCES) \ $(NULL) DISTCLEANFILES += \ - lib/flatpak-enum-types.c \ - lib/flatpak-enum-types.h \ + $(nodist_flatpakinclude_HEADERS) \ + $(nodist_libflatpak_la_SOURCES) \ $(NULL) -lib/flatpak-enum-types.h: $(public_headers) lib/flatpak-enum-types.h.template +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: $(public_headers) lib/flatpak-enum-types.c.template +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 -flatpakincludedir = $(includedir)/flatpak -flatpakinclude_HEADERS = $(public_headers) $(generated_public_headers) - -sources = \ +libflatpak_la_SOURCES = \ lib/flatpak.c \ - lib/flatpak-enum-types.c \ lib/flatpak-ref.c \ lib/flatpak-installed-ref.c \ lib/flatpak-installed-ref-private.h \ @@ -56,10 +54,13 @@ sources = \ lib/flatpak-installation.c \ $(NULL) -libflatpak_la_SOURCES = \ - $(public_headers) \ - $(generated_public_headers) \ - $(sources) \ +nodist_libflatpak_la_SOURCES = \ + lib/flatpak-enum-types.c \ + $(NULL) + +sources = \ + $(libflatpak_la_SOURCES) \ + $(nodist_libflatpak_la_SOURCES) \ $(NULL) libflatpak_la_CFLAGS = \ @@ -109,7 +110,10 @@ INTROSPECTION_GIRS = if HAVE_INTROSPECTION Flatpak-1.0.gir: libflatpak.la Makefile -introspected_headers = $(public_headers) +introspected_headers = \ + $(flatpakinclude_HEADERS) \ + $(nodist_flatpakinclude_HEADERS) \ + $(NULL) introspected_sources = $(filter-out %-private.h,$(sources)) Flatpak_1_0_gir_NAMESPACE = Flatpak From f8f4f530abe123f807d4a89d052468ff294de674 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 12 Jun 2016 09:54:40 +0100 Subject: [PATCH 3/6] Permission store, document portal: do not distribute generated files Signed-off-by: Simon McVittie --- document-portal/Makefile.am.inc | 7 +++++-- permission-store/Makefile.am.inc | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/document-portal/Makefile.am.inc b/document-portal/Makefile.am.inc index d4929685..64fbe5fc 100644 --- a/document-portal/Makefile.am.inc +++ b/document-portal/Makefile.am.inc @@ -19,11 +19,14 @@ systemduserunit_DATA += document-portal/xdg-document-portal.service service_in_files += document-portal/org.freedesktop.portal.Documents.service.in dbus_service_DATA += document-portal/org.freedesktop.portal.Documents.service +nodist_xdg_document_portal_SOURCES = \ + $(xdp_dbus_built_sources) \ + $(ps_dbus_built_sources) \ + $(NULL) + xdg_document_portal_SOURCES = \ document-portal/xdp-main.c \ document-portal/xdp-enums.h \ - $(xdp_dbus_built_sources) \ - $(ps_dbus_built_sources) \ document-portal/xdp-util.h \ document-portal/xdp-util.c \ document-portal/xdp-fuse.h \ diff --git a/permission-store/Makefile.am.inc b/permission-store/Makefile.am.inc index ec06f642..441f2a9a 100644 --- a/permission-store/Makefile.am.inc +++ b/permission-store/Makefile.am.inc @@ -8,10 +8,11 @@ systemduserunit_DATA += permission-store/xdg-permission-store.service service_in_files += permission-store/org.freedesktop.impl.portal.PermissionStore.service.in dbus_service_DATA += permission-store/org.freedesktop.impl.portal.PermissionStore.service -ps_dbus_built_sources = permission-store/permission-store-dbus.c permission-store/permission-store-dbus.h -BUILT_SOURCES += $(ps_dbus_built_sources) +nodist_xdg_permission_store_SOURCES = permission-store/permission-store-dbus.c permission-store/permission-store-dbus.h +BUILT_SOURCES += $(nodist_xdg_permission_store_SOURCES) +CLEANFILES += $(nodist_xdg_permission_store_SOURCES) -$(ps_dbus_built_sources) : data/org.freedesktop.impl.portal.PermissionStore.xml +$(nodist_xdg_permission_store_SOURCES) : data/org.freedesktop.impl.portal.PermissionStore.xml $(AM_V_GEN) $(GDBUS_CODEGEN) \ --interface-prefix org.freedesktop.impl.portal. \ --c-namespace Xdg \ @@ -19,8 +20,10 @@ $(ps_dbus_built_sources) : data/org.freedesktop.impl.portal.PermissionStore.xml $(srcdir)/data/org.freedesktop.impl.portal.PermissionStore.xml \ $(NULL) +# also used by the document portal +ps_dbus_built_sources = $(nodist_xdg_permission_store_SOURCES) + xdg_permission_store_SOURCES = \ - $(ps_dbus_built_sources) \ permission-store/permission-store.c \ permission-store/xdg-permission-store.c \ permission-store/xdg-permission-store.h \ From ee77be10b557458cebf2ce908126ddada58e4cd9 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 12 Jun 2016 09:56:05 +0100 Subject: [PATCH 4/6] tests: clean up what is distributed Listing variables whose values are conditional in EXTRA_DIST is problematic: if Flatpak was configured without installed-tests, we would not distribute those files. This is a problem during distcheck, where installed-tests are disabled. For files not placed in a special subdirectory, glib-tap.mk handles this for us. For the keyring and the databases, we have to do it ourselves, by arranging for them to be in a dist_ variable that is special to Automake - when determining what to distribute, Automake includes anything that is selected for distribution under any combination of conditionals. While I'm here, include test keyring's README in tarballs: its advice is equally applicable in a tarball release. Signed-off-by: Simon McVittie --- Makefile.am | 1 + tests/Makefile.am.inc | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7bbfef70..88148ac8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,7 @@ NULL = bin_PROGRAMS = $(NULL) +dist_installed_test_scripts = $(NULL) noinst_PROGRAMS = $(NULL) noinst_LTLIBRARIES = $(NULL) libexec_PROGRAMS = $(NULL) diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc index 23a69458..1d4a1074 100644 --- a/tests/Makefile.am.inc +++ b/tests/Makefile.am.inc @@ -59,7 +59,7 @@ tests/package_version.txt: Makefile tests/test-basic.sh: tests/package_version.txt -installed_test_SCRIPTS += \ +dist_installed_test_scripts += \ buildutil/tap-driver.sh \ tests/test-configure \ tests/make-test-app.sh \ @@ -79,16 +79,17 @@ installed_test_keyringdir = $(installed_testdir)/test-keyring installed_test_dbsdir = $(installed_testdir)/dbs if ENABLE_INSTALLED_TESTS -installed_test_keyring_DATA = \ +dist_installed_test_keyring_DATA = \ + tests/test-keyring/README \ tests/test-keyring/pubring.gpg \ tests/test-keyring/secring.gpg \ $(NULL) -installed_test_dbs_DATA = tests/dbs/no_tables +dist_installed_test_dbs_DATA = tests/dbs/no_tables endif -EXTRA_DIST += $(installed_test_SCRIPTS) $(installed_test_data) $(installed_test_keyring_DATA) $(installed_test_dbs_DATA) +EXTRA_DIST += $(installed_test_data) -test_scripts = \ +dist_test_scripts = \ tests/test-basic.sh \ tests/test-run.sh \ tests/test-run-system.sh \ From ccaa7428ae5f63d2ceee860853253d5d135e600c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 12 Jun 2016 10:04:01 +0100 Subject: [PATCH 5/6] autogen.sh: rely on VPATH when generating Makefile-*.am.inc This avoids hard-coding the (potentially absolute) srcdir used at autogen time into the build system. It's fine for an Automake build system to use relative paths in dependencies and rely on them being interpreted as relative to ${srcdir} even though the current working directory is ${buildddir}, because of make's "VPATH" feature, and we do it all the time in the handwritten parts of the build system. In particular, this (finally) makes distcheck work. Signed-off-by: Simon McVittie --- autogen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index b38e34c6..6a100675 100755 --- a/autogen.sh +++ b/autogen.sh @@ -22,8 +22,8 @@ if ! test -f libglnx/README.md -a -f bubblewrap/README.md; then git submodule update --init fi # Workaround automake bug with subdir-objects and computed paths -sed -e 's,$(libglnx_srcpath),'${srcdir}/libglnx,g < libglnx/Makefile-libglnx.am >libglnx/Makefile-libglnx.am.inc -sed -e 's,$(bwrap_srcpath),'${srcdir}/bubblewrap,g < bubblewrap/Makefile-bwrap.am >bubblewrap/Makefile-bwrap.am.inc +sed -e 's,$(libglnx_srcpath),libglnx,g' < libglnx/Makefile-libglnx.am >libglnx/Makefile-libglnx.am.inc +sed -e 's,$(bwrap_srcpath),bubblewrap,g' < bubblewrap/Makefile-bwrap.am >bubblewrap/Makefile-bwrap.am.inc GTKDOCIZE=$(which gtkdocize 2>/dev/null) if test -z $GTKDOCIZE; then From 3fc47aa0d3aa6cb61973df898ea58dca5c3cbced Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 12 Jun 2016 09:59:34 +0100 Subject: [PATCH 6/6] Link libselinux into bwrap (if enabled) with LDADD, not LDFLAGS As explained in bubblewrap commit f6ca3690, libraries should always go in LDADD and not LDFLAGS, because the order of arguments to the linker matters. Many distributions' linkers are tolerant enough that it doesn't matter in practice, but it matters for static linking, and it might also matter on Ubuntu. Signed-off-by: Simon McVittie --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 88148ac8..cd3c8c8b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,7 +82,7 @@ include tests/Makefile.am.inc bwrap_PROGRAMS = flatpak-bwrap flatpak_bwrap_SOURCES = $(bwrap_SOURCES) flatpak_bwrap_CFLAGS = $(bwrap_CFLAGS) -flatpak_bwrap_LDFLAGS = $(bwrap_LDFLAGS) +flatpak_bwrap_LDADD = $(bwrap_LDADD) bwrapdir = $(libexecdir) include bubblewrap/Makefile-bwrap.am.inc